Ver código fonte

畅由跳转调整

kk.shi 3 anos atrás
pai
commit
7f932dfb6d
1 arquivos alterados com 36 adições e 30 exclusões
  1. 36 30
      pages/integral/integral.js

+ 36 - 30
pages/integral/integral.js

@@ -90,34 +90,39 @@ Page({
     // 获取优惠券列表
     this.getCouponList()
     if(getMobileCache() != ''){
-        Integralinfo.getBalance({
-            mobile: getMobileCache(), 
-            callbackUrl: '../integral/integral.wxml',
-            fingerprint: '',
-            sessionid: '',
-            shopid: this.data.shopid,
-            type: 'wx',
-        }).then(arr => {
-            if (arr.code === '0000') {
-                var reg = /^(\d{3})\d{4}(\d{4})$/;
-                this.setData({
-                    isLogin: getMobileCache() != '',
-                    phone: getMobileCache() == ''?'********':getMobileCache().replace(reg, "$1****$2"),
-                    setPhone: getMobileCache(),
-                    mobile: getMobileCache(),
-                    integralNum: arr.data,
-                })
-               
-            }
-        }).catch(error=>{
-            console.log(error);
-            if (error.data.code === '2000') {
-                this.scoreClick()
-            }
-        })
+        this.findIntegral()
     }
   },
 
+  /** 积分查询 */
+  findIntegral: function(){
+    Integralinfo.getBalance({
+        mobile: getMobileCache(), 
+        callbackUrl: '../integral/integral.wxml',
+        fingerprint: '',
+        sessionid: '',
+        shopid: this.data.shopid,
+        type: 'wx',
+    }).then(arr => {
+        if (arr.code === '0000') {
+            var reg = /^(\d{3})\d{4}(\d{4})$/;
+            this.setData({
+                isLogin: getMobileCache() != '',
+                phone: getMobileCache() == ''?'********':getMobileCache().replace(reg, "$1****$2"),
+                setPhone: getMobileCache(),
+                mobile: getMobileCache(),
+                integralNum: arr.data,
+            })
+           
+        }
+    }).catch(error=>{
+        console.log(error);
+        if (error.data.code === '2000') {
+            this.scoreClick()
+        }
+    })
+  },
+
   /**
    * 判断是否是iphone
    */
@@ -321,7 +326,7 @@ getPhoneNumber(e) {
         setTimeout(()=>{
             that.data.setPhone = ''
             that.scoreClick()
-            wx.hideLoading()
+            // wx.hideLoading()
         },500)
     } else {
         var reg = /^(\d{3})\d{4}(\d{4})$/;
@@ -370,7 +375,7 @@ getphoneClick() {
             type: 'wx',
         }).then(arr => {
             console.log(arr)
-            wx.hideLoading();
+            // wx.hideLoading();
             if (arr.code === '0000') {
                 var reg = /^(\d{3})\d{4}(\d{4})$/;
                 this.setData({
@@ -492,6 +497,7 @@ reduceClick(e) {
 // 商品数量添加按钮
 addClick(e) {
    let index = e.currentTarget.dataset.index
+   this.findIntegral()
     if (this.data.phone !== '********') {
         if (this.data.total + parseInt(this.data.couponList[index].integral) > 20000) {
             wx.showToast({
@@ -536,7 +542,7 @@ shuaxinClick() {
         type: 'wx',
     }).then(arr => {
         if (arr.code === '0000') {
-            wx.hideLoading();
+            // wx.hideLoading();
             wx.showToast({
                 title: '查询成功!',
                 icon: 'success',
@@ -698,12 +704,12 @@ paymentClick() {
                             paymentBgStatus: false,
                         })
                         wx.setStorageSync('orderDetails', null)
-                        wx.hideLoading();
+                        // wx.hideLoading();
                         wx.navigateTo({
                             url: '../integral/success?row=' + JSON.stringify(obj)
                         })
                     } else {
-                        wx.hideLoading();
+                        // wx.hideLoading();
                         wx.showToast({
                             icon: 'none',
                             title: res.message