Explorar el Código

优惠券积分判断

kk.shi hace 3 años
padre
commit
206bfc5da7
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      pages/integral/integral.js

+ 9 - 2
pages/integral/integral.js

@@ -52,6 +52,7 @@ Page({
         status: false
     },
     isIphoneX:false,
+    codeNum: '',
   },
 
   /**
@@ -112,12 +113,16 @@ Page({
                 setPhone: getMobileCache(),
                 mobile: getMobileCache(),
                 integralNum: arr.data,
+                codeNum: arr.code,
             })
            
         }
     }).catch(error=>{
         console.log(error);
         if (error.data.code === '2000') {
+            this.setData({
+                codeNum: error.data.code,
+            })
             this.scoreClick()
         }
     })
@@ -382,6 +387,7 @@ getphoneClick() {
                    integralNum: arr.data,
                    setPhone: getMobileCache(),
                    phone: getMobileCache().replace(reg, "$1****$2"),
+                   codeNum: arr.code,
                 })
                 // this.data.integralNum = arr.data
                 // var reg = /^(\d{3})\d{4}(\d{4})$/;
@@ -437,7 +443,8 @@ getphoneClick() {
             this.setData({
                 scorePhone: false,
                 loading: true,
-                bgStatus: true
+                bgStatus: true,
+                codeNum: arr.code,
             })
             
             setTimeout(() => {
@@ -498,7 +505,7 @@ reduceClick(e) {
 addClick(e) {
    let index = e.currentTarget.dataset.index
    this.findIntegral()
-    if (this.data.phone !== '********') {
+    if (this.data.phone !== '********' && this.data.codeNum === '0000') {
         if (this.data.total + parseInt(this.data.couponList[index].integral) > 20000) {
             wx.showToast({
                 title: '单笔限额两万分',