Explorar el Código

修改生成优惠码

秦鹏 hace 3 años
padre
commit
435f011a99
Se han modificado 1 ficheros con 22 adiciones y 9 borrados
  1. 22 9
      src/components/payment/Confirmorder.vue

+ 22 - 9
src/components/payment/Confirmorder.vue

@@ -36,9 +36,11 @@
       <span class="sp2" v-loading="codeloading" @click="verifyCode" v-if="isShow">
       <span class="sp2" v-loading="codeloading" @click="verifyCode" v-if="isShow">
         <!-- 确定 -->{{ $t("Key94") }}
         <!-- 确定 -->{{ $t("Key94") }}
       </span>
       </span>
-      <span class="sp2" v-else>
-      -¥<span v-html="changePrice(discount_money, 16)"></span
-      ></span></span>
+      <template v-else>
+        <span class="sp2" v-if="discount_code_status == 1"
+          >-<span v-html="changePrice(discount_money, 16)"></span
+        ></span>
+      </template>
     </div>
     </div>
     <div class="total">
     <div class="total">
       <p class="p1">
       <p class="p1">
@@ -47,7 +49,8 @@
       </p>
       </p>
       <p class="p2">
       <p class="p2">
         <span> {{ $t("Key54") }}: </span>
         <span> {{ $t("Key54") }}: </span>
-        <span class="co-value">-¥<span v-html="changePrice(discount_money, 16)"></span
+        <span class="co-value"
+          >-¥<span v-html="changePrice(discount_money, 16)"></span
         ></span>
         ></span>
       </p>
       </p>
       <p class="p3">
       <p class="p3">
@@ -80,6 +83,7 @@ export default {
       loading: false,
       loading: false,
       codeloading: false,
       codeloading: false,
       isShow: true,
       isShow: true,
+      discount_code_status: 0,
     };
     };
   },
   },
   //计算属性 类似于data概念
   //计算属性 类似于data概念
@@ -88,7 +92,7 @@ export default {
   watch: {},
   watch: {},
   //方法集合
   //方法集合
   methods: {
   methods: {
-        changePrice(price, fontSize) {
+    changePrice(price, fontSize) {
       let str = "";
       let str = "";
       price = price ? price.toString() : "0.00";
       price = price ? price.toString() : "0.00";
       if (price.indexOf(".") > -1) {
       if (price.indexOf(".") > -1) {
@@ -195,10 +199,19 @@ export default {
       };
       };
       LearnWebSI(MethodName, data).then((res) => {
       LearnWebSI(MethodName, data).then((res) => {
         this.codeloading = false;
         this.codeloading = false;
-        this.isShow = false;
-        this.back_discount_code = res.discount_code;
-        this.discount_money = res.discount_money; // 优惠金额
-        this.receivables_money = res.receivables_money; // 应收款
+        this.discount_code_status = res.discount_code_status;
+        if (this.discount_code_status != 1 && this.discount_code_status != 2) {
+          this.$message.warning("优惠码无效");
+        } else {
+          if (this.discount_code_status == 2) {
+            this.$message.warning("优惠码已被使用");
+          } else {
+            this.isShow = false;
+            this.back_discount_code = res.discount_code;
+            this.discount_money = res.discount_money; // 优惠金额
+            this.receivables_money = res.receivables_money; // 应收款
+          }
+        }
       });
       });
     },
     },
   },
   },