Browse Source

修改门店不显示bug

bobo 3 years ago
parent
commit
41128a1b58

+ 14 - 1
components/couponWrap/index.js

@@ -38,7 +38,11 @@ Component({
      */
     methods: {
         prepareData() {
-            this.data.couponList.forEach(v => {
+            if (!this.data.couponList || this.data.couponList.length == 0) {
+                this.data.list = [];
+                this.data.flodMap = {};
+            }
+            this.data.couponList.forEach((v, i) => {
                 v.validTimesStr = this.validTimes(v)
                 if (typeof (v.type || v.couponType) == "string") {
                     v.type = { value: (v.type || v.couponType) }
@@ -65,6 +69,15 @@ Component({
                 } else {
                     v.stateStr = "不可用"
                 }
+                if (this.data.list) {
+                    let node = this.data.list[i];
+                    if (node) {
+                        v.description = node.description || '';
+                        v.bindShopType = node.bindShopType || 1;
+                        v.bindGoodsType = node.bindGoodsType || 1;
+                        v.isLoadCouponDetail = node.isLoadCouponDetail || false;
+                    }
+                }
             })
             this.setData({
                 list: this.data.couponList

+ 3 - 2
components/couponWrap/index.wxss

@@ -19,7 +19,7 @@
 }
 
 .coupon-card {
-    height: 156rpx;
+    min-height: 156rpx;
     width: 100%;
     position: relative;
     display: flex;
@@ -81,12 +81,13 @@
     font-weight: 600;
     font-size: 34rpx;
     padding-top: 32rpx;
-    white-space: nowrap;
+    max-width: 300rpx;
 }
 .coupon-card-right ._time_des {
     font-size: 24rpx;
     color: #A0A0A0;
     margin-top: 14rpx;
+    padding-bottom: 20rpx;
 }
 
 .coupon-card-num {

+ 19 - 21
pages/welfareMall/couponFitStore/index.js

@@ -49,27 +49,25 @@ Page({
                 })
                 }else {
                     // 2. 用户未授权的情况下, 打开授权界面, 引导用户授权.
-                    wx.openSetting({
+                    wx.authorize({
+                        scope: "scope.userLocation",
                         success(res) {
-                            // 2.1 如果二次授权允许了 userLocation 权限, 就再次执行获取位置的接口
-                            if (res.authSetting["scope.userLocation"]) {
-                                wx.getLocation({
-                                    success(res){
-                                        // 2.2 获取用户位置成功后,将会返回 latitude, longitude 两个字段,代表用户的经纬度位置
-                                        // 2.3 将获取到的 经纬度传值给 getAddress 解析出 具体的地址
-                                        that.setData({
-                                            latitude: res.latitude,
-                                            longitude: res.longitude,
-                                        })                
-                                        that.loadStoreListData()
-                                    },
-                                    fail() {
-                                        wx.navigateBack({
-                                          delta: -1,
-                                        })
-                                    }
-                                })
-                            }
+                            wx.getLocation({
+                                success(res){
+                                    // 2.2 获取用户位置成功后,将会返回 latitude, longitude 两个字段,代表用户的经纬度位置
+                                    // 2.3 将获取到的 经纬度传值给 getAddress 解析出 具体的地址
+                                    that.setData({
+                                        latitude: res.latitude,
+                                        longitude: res.longitude,
+                                    })                
+                                    that.loadStoreListData()
+                                },
+                                fail() {
+                                    wx.navigateBack({
+                                        delta: -1,
+                                    })
+                                }
+                            })     
                         }
                     })
                 }
@@ -212,7 +210,7 @@ Page({
         this.data.storeList = this.data.storeList.concat(list)
 
         this.setData({
-            storeList: list
+            storeList: this.data.storeList
         })
     },
     callPhone(e) {