Browse Source

积分加现金

sunlupeng 1 year ago
parent
commit
88400e0a73

+ 1 - 1
src/permission.js

@@ -4,7 +4,7 @@ import { getToken, setToken } from '@/utils/auth' // getToken from cookie
 import { lockStatus,unlock } from "@/api/allApi";
 //路由跳转之前
 router.beforeEach((to, _from, next) => {
-  setToken('96fcd42ce2f48d221d7fe73b9634aaaa');
+  setToken('bb205f6fcd05bcdb30b645cbedf35fab');
   const path = to.path;
   const Authorization = to.query.Authorization
   if (path.indexOf('auth') != -1 && Authorization) { 

File diff suppressed because it is too large
+ 969 - 0
src/views/HomeView/PointsMall copy.vue


File diff suppressed because it is too large
+ 1 - 1
src/views/HomeView/PointsMall.vue


File diff suppressed because it is too large
+ 1450 - 0
src/views/HomeView/RedeemView copy.vue


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

@@ -154,8 +154,9 @@
                                 <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="请选择"
@@ -174,8 +175,8 @@
                                 </el-select>
                             </td>
                             <td style="text-align: center" class="finlly-price">
-                                {{ money ? userInfo.surplusIntegral : total }} 积分
-                                <span style="color: red;" v-if="money">+{{ money }}元</span>
+                                {{ total }} 积分
+                                <span style="color: red;" v-if="money">+ {{ totalMoney }}元</span>
                             </td>
                         </tr>
                     </tbody>
@@ -314,8 +315,12 @@
         <el-dialog title="结算明细" :visible.sync="dialogFormOrderInfo" width="300px">
             <div class="checklist">
                 <div class="listItem">
-                    <div class="itemName">商品积分</div>
-                    <div class="itemValue">{{ data.price }}</div>
+                    <div class="itemName">商品</div>
+                    <div class="itemValue">
+                        {{ data.price }} 积分 
+                        <span style="color: red;" v-if="money">+ {{ money }}元</span>
+                    </div>
+                    
                 </div>
                 <div class="listItem">
                     <div class="itemName">商品数量</div>
@@ -328,8 +333,8 @@
                 <div class="listItem">
                     <div class="itemName">合计</div>
                     <div class="itemValue">
-                        {{ money ? userInfo.surplusIntegral : total }}
-                        <span style="color: red;" v-if="money">+{{ money }}元</span>
+                        {{ total }} 积分
+                        <span style="color: red;"v-if="money">+ {{ totalMoney }}元</span>
                     </div>
                 </div>
             </div>
@@ -411,8 +416,12 @@
                     <div class="itemValue">{{ couponName }}</div>
                 </div>
                 <div v-if="activeName == 'goodsNotice'" class="listItem">
-                    <div class="itemName">商品积分</div>
-                    <div class="itemValue">{{ data.price }}</div>
+                    <div class="itemName">商品</div>
+                    <div class="itemValue">
+                        {{ data.price }} 积分
+                        <span style="color: red;" v-if="money">+ {{ money }} 元</span>
+                    </div>
+                    
                 </div>
                 <div v-if="activeName == 'goodsNotice'" class="listItem">
                     <div class="itemName">商品数量</div>
@@ -432,8 +441,8 @@
                 </div>
                 <div v-if="activeName == 'goodsNotice'" class="listItem">
                     <div class="itemName">合计</div>
-                    <div class="itemValue">{{ money ? userInfo.surplusIntegral : total }}<span style="color: red;"
-                            v-if="money">+{{ money }}元</span></div>
+                    <div class="itemValue">{{ total }} 积分<span style="color: red;"
+                            v-if="money">+ {{ totalMoney }}元</span></div>
                 </div>
             </div>
             <span slot="footer" class="dialog-footer">
@@ -453,7 +462,7 @@
                     <div class="item-right">
                         <div class="up">
                             <div>应付金额</div>
-                            <div style="color: #fe2c55;margin-left: 8px;">¥ {{ money }}</div>
+                            <div style="color: #fe2c55;margin-left: 8px;">¥ {{ totalMoney }}</div>
                         </div>
                         <div class="down">
                             <img style="height: 18px;" src="../../assets/icon/weixinPay.png" alt="weixinpay">
@@ -511,6 +520,7 @@ export default {
             recharge: false,
             //充值金额
             money: undefined,
+            totalMoney: undefined,
             couponName: '',
             voucher: '',
             couponList: [],
@@ -604,16 +614,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);
@@ -643,8 +653,8 @@ export default {
         },
         handlePayWxQRcode() {  // 获取微信支付二维码
             getWxPayCode({    // 这里根据不同的后端接口去修改
-                integral: this.money * 10,
-                totalFee: this.money,
+                integral: this.totalMoney * 10,
+                totalFee: this.totalMoney,
             }).then(res => {
                 let data = res.data.data;
                 this.qrcode(data.payUrl);    // 例如:data.payUrl 的值为 "weixin://wxpay/bizpayurl?pr=......",根据这个值生成相对应的微信支付二维码
@@ -670,7 +680,7 @@ export default {
                         type: 'success',
                         message: '支付成功!'
                     });
-                    this.money = 0;
+                    this.totalMoney =  this.money;
                     this.recharge = false;
                     clearInterval(this.timer);    // 清除定时器;   
                     clearInterval(this.timerPayWxQRcode);
@@ -720,22 +730,23 @@ export default {
                     this.dialogVisible = true;
                 }
             } else {
-                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;
-                }
+                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) {
@@ -762,6 +773,7 @@ export default {
             this.disabled = true;
             if (val == "0" || val == "") {
                 this.total = this.data.price;
+                this.totalMoney = this.money;
                 this.skuCount = 1;
             }
             if (val == "1") {
@@ -777,11 +789,13 @@ 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;
@@ -794,6 +808,7 @@ export default {
             this.disabled = true;
             if (val == "0" || val == "") {
                 this.total = this.data.price;
+                this.totalMoney = this.money;
                 this.skuCount = 1;
             }
             if (val == "1") {
@@ -804,11 +819,13 @@ 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;
@@ -820,6 +837,9 @@ 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" &&
@@ -850,6 +870,8 @@ 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 => {
@@ -1226,6 +1248,8 @@ img {
     font-size: 14px;
     line-height: 24px;
     color: #1e80ff;
+    /* color: red; */
+    
 }
 
 .footer {