RedeemView.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <template>
  2. <div class="right-wrap">
  3. <el-breadcrumb separator="/" style="margin-bottom: 13px;">
  4. <el-breadcrumb-item :to="{ path: '/home/pointsMall' }">积分商城</el-breadcrumb-item>
  5. <el-breadcrumb-item>兑换详情</el-breadcrumb-item>
  6. </el-breadcrumb>
  7. <el-card class="box-card">
  8. <div slot="header" class="clearfix">
  9. <span>兑换详情</span>
  10. <!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button> -->
  11. </div>
  12. <div class="footer">
  13. <div class="left-info" style="width: 100%;">
  14. <span class="info-title">
  15. <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
  16. xmlns="http://www.w3.org/2000/svg" class="info-icon">
  17. <path fill-rule="evenodd" clip-rule="evenodd"
  18. d="M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1Z"
  19. fill="#165DFF"></path>
  20. <path fill-rule="evenodd" clip-rule="evenodd"
  21. d="M8.54189 6.70582C8.67075 6.70582 8.77522 6.81029 8.77522 6.93915L8.77511 10.2335L9.46743 10.2343C9.61176 10.2343 9.72876 10.3513 9.72876 10.4956V11.3319C9.72876 11.4762 9.61176 11.5932 9.46743 11.5932H6.58458C6.44025 11.5932 6.32324 11.4762 6.32324 11.3319V10.4956C6.32324 10.3513 6.44025 10.2343 6.58458 10.2343L7.28178 10.2335V8.08122L7.14759 8.08198C7.00326 8.08198 6.88626 7.96498 6.88626 7.82065V6.97073C6.88626 6.8264 7.00326 6.70939 7.14759 6.70939L7.47956 6.70859C7.49132 6.70677 7.50337 6.70582 7.51565 6.70582H8.54189ZM8.40513 4.41602C8.54946 4.41602 8.66646 4.53302 8.66646 4.67735V5.64802C8.66646 5.79235 8.54946 5.90935 8.40513 5.90935H7.43446C7.29013 5.90935 7.17313 5.79235 7.17313 5.64802V4.67735C7.17313 4.53302 7.29013 4.41602 7.43446 4.41602H8.40513Z"
  22. fill="white"></path>
  23. </svg>
  24. 物品介绍
  25. </span>
  26. <div v-html="data.comment"></div>
  27. </div>
  28. </div>
  29. <p class="label">收货地址</p>
  30. <div class="address">
  31. <div v-if="addressDetail">
  32. <div class="address-container">
  33. <div class="header">
  34. <div class="left">
  35. <span>{{ name }}</span>
  36. </div>
  37. <span @click="handleClickAddress" role="button" class="btn">修改</span>
  38. </div>
  39. <p class="phone">{{ phone }}</p>
  40. <p class="address">{{ address }}{{ email }}</p>
  41. </div>
  42. </div>
  43. <div v-else @click="handleClickAddress">
  44. <div class="address-container new"><i class="add-icon byte-icon byte-icon--plus"><svg
  45. xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
  46. <path fill="none" d="M0 0h48v48H0z"></path>
  47. <path
  48. d="M24.7 4c.4 0 .6 0 .8.1.2.1.3.2.4.4.1.2.1.3.1.8V22h16.7c.4 0 .6 0 .8.1.2.1.3.2.4.4.1.2.1.3.1.8v1.4c0 .4 0 .6-.1.8-.1.2-.2.3-.4.4-.2.1-.3.1-.8.1H26v16.7c0 .4 0 .6-.1.8-.1.2-.2.3-.4.4-.2.1-.3.1-.8.1h-1.4c-.4 0-.6 0-.8-.1-.2-.1-.3-.2-.4-.4-.1-.2-.1-.3-.1-.8V26H5.3c-.4 0-.6 0-.8-.1-.2-.1-.3-.2-.4-.4-.1-.2-.1-.3-.1-.8v-1.4c0-.4 0-.6.1-.8.1-.2.2-.3.4-.4.2-.1.3-.1.8-.1H22V5.3c0-.4 0-.6.1-.8.1-.2.2-.3.4-.4.2-.1.3-.1.8-.1h1.4z">
  49. </path>
  50. </svg></i> <span class="add-label">添加收货地址</span></div>
  51. </div>
  52. </div>
  53. <p class="label">物品信息</p>
  54. <div v-if="activeName=='goodsNotice'">
  55. <table class="table">
  56. <thead>
  57. <tr>
  58. <th width="35%">兑换物品</th>
  59. <th>数量</th>
  60. <th>单价</th>
  61. <th>兑换方式</th>
  62. <th>总计</th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <tr>
  67. <td>
  68. <div class="prize-info">
  69. <div class="prize-img-container">
  70. <el-image class="lazy prize-img" :src="data.imgUrl" alt="prize" lazy></el-image>
  71. </div>
  72. <div class="prize-detail-info">
  73. <h3 class="title">{{ data.name }}</h3>
  74. <p class="desc">
  75. <span>{{ data.location }}</span>
  76. </p>
  77. </div>
  78. </div>
  79. </td>
  80. <td>
  81. <el-input-number @change="changeCount" size="mini" v-model="skuCount" :step="1" :min="1" step-strictly></el-input-number>
  82. </td>
  83. <td>{{ data.price }} 积分</td>
  84. <td>{{ data.deliveryName }}</td>
  85. <td class="finlly-price">
  86. {{ total }} 积分
  87. </td>
  88. </tr>
  89. </tbody>
  90. </table>
  91. </div>
  92. <div v-else>
  93. <table class="table">
  94. <thead>
  95. <tr>
  96. <th width="35%">兑换物品</th>
  97. <th>消耗福利券</th>
  98. <th>物品属性</th>
  99. <th>兑换方式</th>
  100. </tr>
  101. </thead>
  102. <tbody>
  103. <tr>
  104. <td>
  105. <div class="prize-info">
  106. <div class="prize-img-container">
  107. <el-image class="lazy prize-img" :src="data.imgUrl" alt="prize"></el-image>
  108. </div>
  109. <div class="prize-detail-info">
  110. <h3 class="title">{{ data.name }}</h3>
  111. <p class="desc">
  112. <span>{{ data.location }}</span>
  113. </p>
  114. </div>
  115. </div>
  116. </td>
  117. <td>{{ data.title }}</td>
  118. <td>{{ data.productAttributeName }}</td>
  119. <td class="finlly-price">
  120. {{ data.deliveryName }}
  121. </td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. </div>
  126. <div class="footer">
  127. <div class="right">
  128. <!-- <div class="remark-line">
  129. <span>备注:</span>
  130. <el-input class="remark" placeholder="请输入备注,例如兑换产品的期望尺码" type="textarea"></el-input>
  131. </div> -->
  132. <div class="btn-line">
  133. <el-button :disabled="disabled" @click="handleClickExchange" type="primary" round>确认兑换</el-button>
  134. </div>
  135. </div>
  136. </div>
  137. </el-card>
  138. <el-dialog title="兑换物品收货地址" :visible.sync="dialogFormVisible" width="500px">
  139. <el-form :model="dataForm" ref="dataForm" style="padding: 0 75px;" :rules="rules">
  140. <el-form-item label="联系姓名" :label-width="formLabelWidth" prop="name">
  141. <el-input size="medium" v-model="dataForm.name" placeholder="请输入联系姓名"></el-input>
  142. </el-form-item>
  143. <el-form-item label="联系方式" :label-width="formLabelWidth" prop="phone">
  144. <el-input size="medium" v-model="dataForm.phone" placeholder="请输入11位手机号码"></el-input>
  145. </el-form-item>
  146. <el-form-item v-if="data.productAttribute == 1 && data.deliveryType == 1" label="联系地址" :label-width="formLabelWidth" prop="address">
  147. <el-input size="medium" v-model="dataForm.address" placeholder="请输入详细联系地址"></el-input>
  148. </el-form-item>
  149. <el-form-item v-else label="联系邮箱" :label-width="formLabelWidth" prop="email">
  150. <el-input size="medium" v-model="dataForm.email" placeholder="请输入联系邮箱"></el-input>
  151. </el-form-item>
  152. </el-form>
  153. <div slot="footer" class="dialog-footer" style="text-align: center;">
  154. <el-button class="addButton-address" type="primary" @click="submitForm('dataForm')">提交</el-button>
  155. </div>
  156. </el-dialog>
  157. <el-dialog :visible.sync="dialogMsgVisible" width="400px" @close="handleClose">
  158. <div class="wrapper">
  159. <svg width="291" height="93" viewBox="0 0 291 93" fill="none" xmlns="http://www.w3.org/2000/svg" src="./success.svg" class="success-icon"><g filter="url(#filter0_f_6844:108643)"><circle cx="143" cy="56.5723" r="3" fill="#51F1E8"></circle></g><path d="M195.768 48.1699L195.768 39.5097L203.268 43.8398L195.768 48.1699Z" fill="#FF5E54"></path><path d="M232.39 10.953L230.149 2.58781L238.514 4.82925L232.39 10.953Z" fill="#9F54FF"></path><path d="M7.519 27.6623L1.39528 21.5385L9.76044 19.2971L7.519 27.6623Z" fill="#FF834E"></path><path d="M106.774 8.99609L96.2168 11.168C94.5498 27.4571 102.885 34.5158 107.886 36.6877C113.999 37.7736 120.031 35.8701 124 32.8869C111.22 33.4298 104.552 19.3126 106.774 8.99609Z" fill="#51F1E8"></path><path d="M283.89 68.9961L290.383 70.4176C292.692 77.5253 288.076 83.9223 283.89 84.9096C280.384 85.3438 277.597 84.0817 275 82.5007C284.452 83.364 285.768 73.9715 283.89 68.9961Z" fill="#FF5E54"></path><g filter="url(#filter1_f_6844:108643)"><path d="M50 82.4171L55.3529 77.9961C57.902 79.4698 63 83.3014 63 86.8382C59.8213 88.1508 58.6931 89.8153 58.427 90.9879C58.4503 91.3588 58.4426 91.6987 58.4118 91.9961C58.3461 91.7429 58.3346 91.395 58.427 90.9879C58.2575 88.2958 56.4523 83.9714 50 82.4171Z" fill="#FFCF8B"></path></g><defs data-v-50d84ad4=""><filter id="filter0_f_6844:108643" x="139" y="52.5723" width="8" height="8" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="0.5" result="effect1_foregroundBlur_6844:108643"></feGaussianBlur></filter><filter id="filter1_f_6844:108643" x="49" y="76.9961" width="15" height="16" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="0.5" result="effect1_foregroundBlur_6844:108643"></feGaussianBlur></filter></defs></svg>
  160. <h2 class="header">恭喜你,兑换成功!</h2>
  161. <img :src="data.imgUrl" class="icon">
  162. <div class="desc">
  163. <span data-v-50d84ad4="">恭喜你成功兑换{{ data.name }},随后你可在</span>
  164. <a href="/home/festiveEvents" class="link">个人中心</a>中查看兑换的物品
  165. </div>
  166. </div>
  167. <div slot="footer" class="dialog-footer" style="text-align: center;">
  168. <router-link to="/home/festiveEvents">
  169. <el-button class="addButton-address" type="primary">
  170. 查看物品
  171. </el-button>
  172. </router-link>
  173. </div>
  174. </el-dialog>
  175. </div>
  176. </template>
  177. <script>
  178. import { integralInfo, festivalInfo, start, kill } from "@/api/allApi";
  179. export default {
  180. data() {
  181. var validPhone = (rule, value, callback) => {
  182. if (value === '') {
  183. callback(new Error('请输入手机号'));
  184. }
  185. else {
  186. const reg_tel= /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
  187. const isCheckPhone = reg_tel.test(value);
  188. if (!isCheckPhone) {
  189. callback(new Error('请输入正确手机号'));
  190. }
  191. callback();
  192. }
  193. };
  194. return {
  195. activeName:this.$route.query.activeName,
  196. name: '',
  197. phone: '',
  198. email:'',
  199. address: '',
  200. disabled:true,
  201. skuCount:1,
  202. total:undefined,
  203. data:{},
  204. addressDetail:false,
  205. dialogFormVisible:false,
  206. dialogMsgVisible:false,
  207. dataForm: {
  208. name: '',
  209. phone: '',
  210. email:'',
  211. address: '',
  212. },
  213. rules: {
  214. name: [
  215. { required: true, message: '请输入联系姓名', trigger: 'blur' },
  216. { min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' }
  217. ],
  218. phone: [
  219. {required: true, validator: validPhone, trigger: 'blur' }
  220. ],
  221. email: [
  222. { required: true, message: '请输入联系邮箱', trigger: 'blur' },
  223. ],
  224. address: [
  225. { required: true, message: '请输入联系地址', trigger: 'blur' },
  226. { min: 1, max: 120, message: '长度在 1 到 120 个字符', trigger: 'blur' }
  227. ],
  228. },
  229. formLabelWidth: '80px',
  230. };
  231. },
  232. created(){
  233. const skuId = this.$route.query.id;
  234. const activeName = this.$route.query.activeName;
  235. this.dataForm.skuId = skuId;
  236. this.getInfo(skuId,activeName);
  237. },
  238. methods: {
  239. changeCount(val){
  240. this.total = this.data.price * val;
  241. },
  242. handleClose() {
  243. this.dialogMsgVisible = false;
  244. this.$router.push({
  245. path: '/home/pointsMall',
  246. });
  247. },
  248. getInfo(skuId,activeName){
  249. if(activeName=='goodsNotice'){
  250. integralInfo({skuId:skuId}).then(response => {
  251. this.data = response.data.data;
  252. this.total = response.data.data.price;
  253. }).catch(() => {
  254. })
  255. }else{
  256. festivalInfo({skuId:skuId}).then(response => {
  257. this.data = response.data.data;
  258. }).catch(() => {
  259. })
  260. }
  261. },
  262. handleClickAddress(){
  263. this.dialogFormVisible = true;
  264. },
  265. submitForm(formName) {
  266. this.$refs[formName].validate((valid) => {
  267. if (valid) {
  268. // alert('submit!');
  269. this.name = this.dataForm.name,
  270. this.phone = this.dataForm.phone,
  271. this.email = this.dataForm.email,
  272. this.address = this.dataForm.address,
  273. this.addressDetail = true;
  274. this.dialogFormVisible = false;
  275. this.disabled = false;
  276. } else {
  277. console.log('error submit!!');
  278. return false;
  279. }
  280. });
  281. },
  282. handleClickExchange(){
  283. const params = {
  284. skuId:this.data.skuId,
  285. skuSeq:this.data.skuSeq,
  286. skuCount:this.skuCount,
  287. total:this.total,
  288. price:this.data.price,
  289. skuType:this.data.skuType,
  290. contact:this.dataForm.name,
  291. contactPhone:this.dataForm.phone,
  292. contactAddr:this.dataForm.address,
  293. contactEmail:this.dataForm.email,
  294. welfareId:this.data.welfareId,
  295. }
  296. if(this.activeName=='goodsNotice'){
  297. start(params).then(response => {
  298. console.log(response.data.data);
  299. this.dialogMsgVisible = true;
  300. }).catch(() => {})
  301. }else{
  302. kill(params).then(response => {
  303. console.log(response.data.data);
  304. this.dialogMsgVisible = true;
  305. }).catch(() => {})
  306. }
  307. },
  308. }
  309. };
  310. </script>
  311. <style scoped>
  312. .clearfix:before,
  313. .clearfix:after {
  314. display: table;
  315. content: "";
  316. }
  317. .clearfix:after {
  318. clear: both
  319. }
  320. .box-card {
  321. width: 100%;
  322. }
  323. .label:first-child {
  324. margin-top: 0;
  325. }
  326. .label {
  327. font-size: 16px;
  328. line-height: 24px;
  329. margin: 16px 0 24px;
  330. }
  331. .address-container{
  332. padding: 16px;
  333. min-height: 112px;
  334. background-color: #f7f8fa;
  335. box-sizing: border-box;
  336. border-radius: 4px;
  337. width: 320px;
  338. border: 1px solid #abcdff;
  339. }
  340. .address-container .header{
  341. font-weight: 500;
  342. font-size: 14px;
  343. line-height: 24px;
  344. color: #252933;
  345. display: flex;
  346. justify-content: space-between;
  347. margin: 0 0 8px;
  348. }
  349. .address-container .header .left {
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. }
  354. .address-container .btn{
  355. flex: none;
  356. color: #1e80ff;
  357. cursor: pointer;
  358. font-weight: 400;
  359. margin-left: 1em;
  360. }
  361. .address-container .address, .address-container .phone{
  362. margin: 0;
  363. font-size: 14px;
  364. line-height: 24px;
  365. color: #515767;
  366. }
  367. .address-container.new {
  368. border: 1px dashed #e4e6eb;
  369. width: 100%;
  370. display: flex;
  371. align-items: center;
  372. justify-content: center;
  373. cursor: pointer;
  374. flex-flow: column nowrap;
  375. }
  376. .address-container {
  377. padding: 16px;
  378. min-height: 112px;
  379. background-color: #f7f8fa;
  380. box-sizing: border-box;
  381. border-radius: 4px;
  382. width: 320px;
  383. border: 1px solid #abcdff;
  384. }
  385. .address-container.new .add-icon {
  386. font-size: 16px;
  387. color: #515767;
  388. }
  389. .byte-icon {
  390. width: 1em;
  391. height: 1em;
  392. display: inline-block;
  393. vertical-align: middle;
  394. line-height: 1;
  395. }
  396. svg:not(:root) {
  397. overflow-clip-margin: content-box;
  398. overflow: hidden;
  399. }
  400. .byte-icon svg {
  401. width: 100%;
  402. height: 100%;
  403. fill: currentColor;
  404. pointer-events: none;
  405. }
  406. .address-container.new .add-label {
  407. font-size: 14px;
  408. line-height: 24px;
  409. color: #8a919f;
  410. margin: 18px 0 0;
  411. }
  412. .table {
  413. border-collapse: collapse;
  414. border: 1px solid #e4e6eb;
  415. box-sizing: border-box;
  416. border-radius: 2px;
  417. width: 100%;
  418. text-align: left;
  419. font-size: 14px;
  420. line-height: 24px;
  421. border-collapse: separate;
  422. border-spacing: 0;
  423. border-radius: 4px;
  424. }
  425. .table tr {
  426. border: 1px solid #e4e6eb;
  427. }
  428. .table th {
  429. padding: 12px 16px;
  430. background-color: #f7f8fa;
  431. font-weight: 500;
  432. color: #282f38;
  433. }
  434. .table td {
  435. padding: 16px;
  436. vertical-align: middle;
  437. color: #515767;
  438. }
  439. .table .prize-info {
  440. display: flex;
  441. }
  442. .table .prize-img-container {
  443. display: flex;
  444. align-items: center;
  445. justify-content: center;
  446. background: #f7f8fa;
  447. width: 80px;
  448. height: 80px;
  449. }
  450. .table .prize-detail-info {
  451. margin-left: 16px;
  452. display: flex;
  453. flex-flow: column;
  454. align-items: flex-start;
  455. justify-content: center;
  456. }
  457. .table .prize-img-container .prize-img {
  458. max-height: 64px;
  459. }
  460. .lazy {
  461. position: relative;
  462. -o-object-fit: cover;
  463. object-fit: cover;
  464. }
  465. img {
  466. border-style: none;
  467. }
  468. .table .prize-detail-info {
  469. margin-left: 16px;
  470. display: flex;
  471. flex-flow: column;
  472. align-items: flex-start;
  473. justify-content: center;
  474. }
  475. .table .prize-detail-info .title {
  476. font-weight: 400;
  477. font-size: 14px;
  478. line-height: 24px;
  479. color: #1d2129;
  480. margin: 0 0 3px;
  481. }
  482. .table .prize-detail-info .desc {
  483. margin: 0;
  484. line-height: 18px;
  485. height: 18px;
  486. }
  487. .table .prize-detail-info .desc span {
  488. font-size: 12px;
  489. line-height: 14px;
  490. color: #ff7d00;
  491. background: #fff7e8;
  492. padding: 2px 4px;
  493. }
  494. .table .finlly-price {
  495. font-weight: 500;
  496. font-size: 14px;
  497. line-height: 24px;
  498. color: #1e80ff;
  499. }
  500. .footer {
  501. margin-top: 16px;
  502. /* display: flex; */
  503. /* justify-content: space-between; */
  504. }
  505. .footer .left-info {
  506. box-sizing: border-box;
  507. width: 400px;
  508. height: -webkit-fit-content;
  509. height: -moz-fit-content;
  510. height: fit-content;
  511. background-color: #e8f3ff;
  512. border-radius: 4px;
  513. padding: 16px;
  514. }
  515. .footer .left-info .info-title {
  516. font-size: 14px;
  517. line-height: 24px;
  518. color: #282f38;
  519. display: flex;
  520. align-items: center;
  521. }
  522. .footer .left-info .info-icon {
  523. margin-right: 8px;
  524. }
  525. .footer .left-info .info-content {
  526. margin: 4px 0 4px 2em;
  527. white-space: pre-line;
  528. font-size: 12px;
  529. line-height: 20px;
  530. color: #8a919f;
  531. }
  532. .footer .right {
  533. font-size: 14px;
  534. line-height: 24px;
  535. color: #282f38;
  536. }
  537. .footer .right .remark-line {
  538. display: flex;
  539. position: relative;
  540. }
  541. .footer .right .remark {
  542. width: 400px;
  543. }
  544. .footer .right .btn-line {
  545. margin-top: 16px;
  546. text-align: right;
  547. }
  548. .addButton-address{
  549. background: #1e80ff;
  550. border-color: #1e80ff;
  551. color: #fff;
  552. width: 160px;
  553. height: 48px;
  554. border-radius: 50px;
  555. line-height: 46px;
  556. padding: 0;
  557. font-size: 16px;
  558. border: 1px solid transparent;
  559. }
  560. </style>
  561. <style>
  562. .el-dialog__body {
  563. padding-bottom: 0px;
  564. }
  565. </style>