浏览代码

还原积分加现金

sunlupeng 1 年之前
父节点
当前提交
482aa599cc
共有 2 个文件被更改,包括 42 次插入66 次删除
  1. 1 1
      src/views/HomeView/PointsMall.vue
  2. 41 65
      src/views/HomeView/RedeemView.vue

文件差异内容过多而无法显示
+ 1 - 1
src/views/HomeView/PointsMall.vue


+ 41 - 65
src/views/HomeView/RedeemView.vue

@@ -154,9 +154,8 @@
                                 <el-input-number @change="changeCount" size="mini" v-model="skuCount" :step="1" :min="1"
                                     step-strictly></el-input-number>
                             </td>
-                            <td style="text-align: center;">
+                            <td style="text-align: center">
                                 {{ data.price }} 积分
-                                <span style="color: red;" v-if="money">+ {{ money }}元</span>
                             </td>
                             <td style="text-align: center">
                                 <el-select size="small" clearable v-model="deliveryType" placeholder="请选择"
@@ -175,8 +174,8 @@
                                 </el-select>
                             </td>
                             <td style="text-align: center" class="finlly-price">
-                                {{ total }} 积分
-                                <span style="color: red;" v-if="money">+ {{ totalMoney }}元</span>
+                                {{ money ? userInfo.surplusIntegral : total }} 积分
+                                <span style="color: red;" v-if="money">+{{ money }}元</span>
                             </td>
                         </tr>
                     </tbody>
@@ -315,12 +314,8 @@
         <el-dialog title="结算明细" :visible.sync="dialogFormOrderInfo" width="300px">
             <div class="checklist">
                 <div class="listItem">
-                    <div class="itemName">商品</div>
-                    <div class="itemValue">
-                        {{ data.price }} 积分 
-                        <span style="color: red;" v-if="money">+ {{ money }}元</span>
-                    </div>
-                    
+                    <div class="itemName">商品积分</div>
+                    <div class="itemValue">{{ data.price }}</div>
                 </div>
                 <div class="listItem">
                     <div class="itemName">商品数量</div>
@@ -333,8 +328,8 @@
                 <div class="listItem">
                     <div class="itemName">合计</div>
                     <div class="itemValue">
-                        {{ total }} 积分
-                        <span style="color: red;"v-if="money">+ {{ totalMoney }}元</span>
+                        {{ money ? userInfo.surplusIntegral : total }}
+                        <span style="color: red;" v-if="money">+{{ money }}元</span>
                     </div>
                 </div>
             </div>
@@ -416,12 +411,8 @@
                     <div class="itemValue">{{ couponName }}</div>
                 </div>
                 <div v-if="activeName == 'goodsNotice'" class="listItem">
-                    <div class="itemName">商品</div>
-                    <div class="itemValue">
-                        {{ data.price }} 积分
-                        <span style="color: red;" v-if="money">+ {{ money }} 元</span>
-                    </div>
-                    
+                    <div class="itemName">商品积分</div>
+                    <div class="itemValue">{{ data.price }}</div>
                 </div>
                 <div v-if="activeName == 'goodsNotice'" class="listItem">
                     <div class="itemName">商品数量</div>
@@ -441,8 +432,8 @@
                 </div>
                 <div v-if="activeName == 'goodsNotice'" class="listItem">
                     <div class="itemName">合计</div>
-                    <div class="itemValue">{{ total }} 积分<span style="color: red;"
-                            v-if="money">+ {{ totalMoney }}元</span></div>
+                    <div class="itemValue">{{ money ? userInfo.surplusIntegral : total }}<span style="color: red;"
+                            v-if="money">+{{ money }}元</span></div>
                 </div>
             </div>
             <span slot="footer" class="dialog-footer">
@@ -462,7 +453,7 @@
                     <div class="item-right">
                         <div class="up">
                             <div>应付金额</div>
-                            <div style="color: #fe2c55;margin-left: 8px;">¥ {{ totalMoney }}</div>
+                            <div style="color: #fe2c55;margin-left: 8px;">¥ {{ money }}</div>
                         </div>
                         <div class="down">
                             <img style="height: 18px;" src="../../assets/icon/weixinPay.png" alt="weixinpay">
@@ -520,7 +511,6 @@ export default {
             recharge: false,
             //充值金额
             money: undefined,
-            totalMoney: undefined,
             couponName: '',
             voucher: '',
             couponList: [],
@@ -614,16 +604,16 @@ export default {
         ...mapGetters(['userInfo'])
     },
     watch: {
-        // total(val) {
-        //     let surplusIntegral = this.$store.getters.userInfo.surplusIntegral;
-        //     let money = (val - surplusIntegral) / 10;
-        //     if (money >= 0) {
-        //         this.money = money
-        //     } else {
-        //         this.money = 0
-        //     }
-        //     console.log(this.money);
-        // },
+        total(val) {
+            let surplusIntegral = this.$store.getters.userInfo.surplusIntegral;
+            let money = (val - surplusIntegral) / 10;
+            if (money >= 0) {
+                this.money = money
+            } else {
+                this.money = 0
+            }
+            console.log(this.money);
+        },
         '$route' (to, from) {
             // 路由发生变化页面刷新
             this.$router.go(0);
@@ -653,8 +643,8 @@ export default {
         },
         handlePayWxQRcode() {  // 获取微信支付二维码
             getWxPayCode({    // 这里根据不同的后端接口去修改
-                integral: this.totalMoney * 10,
-                totalFee: this.totalMoney,
+                integral: this.money * 10,
+                totalFee: this.money,
             }).then(res => {
                 let data = res.data.data;
                 this.qrcode(data.payUrl);    // 例如:data.payUrl 的值为 "weixin://wxpay/bizpayurl?pr=......",根据这个值生成相对应的微信支付二维码
@@ -680,7 +670,7 @@ export default {
                         type: 'success',
                         message: '支付成功!'
                     });
-                    this.totalMoney =  this.money;
+                    this.money = 0;
                     this.recharge = false;
                     clearInterval(this.timer);    // 清除定时器;   
                     clearInterval(this.timerPayWxQRcode);
@@ -730,23 +720,22 @@ export default {
                     this.dialogVisible = true;
                 }
             } else {
-                this.dialogVisible = true;
-                // if (this.money) {
-                //     this.$confirm('积分不足,差额部分可用现金补齐,是否购买积分?', {
-                //         confirmButtonText: '确定',
-                //         cancelButtonText: '取消',
-                //         type: 'warning'
-                //     }).then(() => {
-                //         this.recharge = true;
-                //         this.$nextTick(function () {
-                //             this.handlePayWxQRcode();
-                //             // this.qrcode(this.payUrl);
-                //         })
-
-                //     }).catch(() => { });
-                // } else {
-                //     this.dialogVisible = true;
-                // }
+                if (this.money) {
+                    this.$confirm('积分不足,差额部分可用现金补齐,是否购买积分?', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        this.recharge = true;
+                        this.$nextTick(function () {
+                            this.handlePayWxQRcode();
+                            // this.qrcode(this.payUrl);
+                        })
+
+                    }).catch(() => { });
+                } else {
+                    this.dialogVisible = true;
+                }
             }
         },
         handleChange(value) {
@@ -773,7 +762,6 @@ export default {
             this.disabled = true;
             if (val == "0" || val == "") {
                 this.total = this.data.price;
-                this.totalMoney = this.money;
                 this.skuCount = 1;
             }
             if (val == "1") {
@@ -789,13 +777,11 @@ export default {
             }
             if (val == "2" || val == "3") {
                 this.total = this.data.price;
-                this.totalMoney = this.money;
                 this.skuCount = 1;
                 this.disabled = false;
             }
             if (val == "4") {
                 this.total = this.data.price;
-                this.totalMoney = this.money;
                 this.skuCount = 1;
                 if (this.phoneNumber) {
                     this.disabled = false;
@@ -808,7 +794,6 @@ export default {
             this.disabled = true;
             if (val == "0" || val == "") {
                 this.total = this.data.price;
-                this.totalMoney = this.money;
                 this.skuCount = 1;
             }
             if (val == "1") {
@@ -819,13 +804,11 @@ export default {
             }
             if (val == "2" || val == "3") {
                 this.total = this.data.price;
-                this.totalMoney = this.money;
                 this.skuCount = 1;
                 this.disabled = false;
             }
             if (val == "4") {
                 this.total = this.data.price;
-                this.totalMoney = this.money;
                 this.skuCount = 1;
                 if (this.phoneNumber) {
                     this.disabled = false;
@@ -837,9 +820,6 @@ export default {
             setTab("exchange");
         },
         changeCount(val) {
-            if(this.money){
-                this.totalMoney = ((this.money * 100) * val)/ 100;
-            }
             this.total = this.data.price * val;
             if (
                 this.deliveryType == "1" &&
@@ -870,8 +850,6 @@ export default {
                         this.address = this.contactInfo.contactAddr;
                     }
                     this.total = response.data.data.price;
-                    this.money = 12.34;
-                    this.totalMoney = 12.34;
                     let imgs = response.data.data.imgs;
                     if (imgs) {
                         imgs.forEach(element => {
@@ -1248,8 +1226,6 @@ img {
     font-size: 14px;
     line-height: 24px;
     color: #1e80ff;
-    /* color: red; */
-    
 }
 
 .footer {