2 次代码提交 4ae6f5d073 ... 9aee8aa4d0

作者 SHA1 备注 提交日期
  bobo 9aee8aa4d0 Merge branch 'bobo/feat/coupon-card' into pre 3 年之前
  bobo 93548be580 适用商品 3 年之前

+ 2 - 1
components/couponWrap/index.js

@@ -114,8 +114,9 @@ Component({
         },
         toFixFoodPage(e) {
             const couponId = this.data.list[e.currentTarget.dataset.index].couponId;
+            const title = this.data.list[e.currentTarget.dataset.index].title;
             wx.navigateTo({
-                url: '/pages/welfareMall/couponFitFood/index?couponId=' + couponId,
+                url: '/pages/welfareMall/couponFitFood/index?couponId=' + couponId + "&couponName=" + title,
             })
         }
     }

+ 34 - 1
pages/welfareMall/couponFitFood/index.js

@@ -1,4 +1,5 @@
 // pages/welfareMall/couponFitFood/index.js
+import activity from '../../../api/activity'
 Page({
 
     /**
@@ -12,7 +13,17 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        console.log(options)
+        if (!options.couponId) {
+            wx.reLaunch({
+              url: '/pages/welfareMall/index/index',
+            })
+        }
+        this.data.couponId = options.couponId
+        this.setData({
+            couponName: decodeURIComponent(options.couponName)
+        })
+        this.loadData()
     },
 
     /**
@@ -62,5 +73,27 @@ Page({
      */
     onShareAppMessage: function () {
 
+    },
+    loadData() {
+        activity.getFoodListByCoupon({
+            couponId: this.data.couponId,
+            page: 1,
+            pageSize: 10000,
+        }).then(data => {
+            if (data.code == 200) {
+                this.dataMapToView(data.data)
+            }
+        }).catch(_ => {
+            console.log(_)
+        })
+    },
+    dataMapToView(data) {
+        const foodList = []
+        data.forEach(v => {
+            foodList.push(v.foodName)
+        })
+        this.setData({
+            foodListStr: foodList.join("、")
+        })
     }
 })

+ 14 - 1
pages/welfareMall/couponFitFood/index.wxml

@@ -1,2 +1,15 @@
 <!--pages/welfareMall/couponFitFood/index.wxml-->
-<text>pages/welfareMall/couponFitFood/index.wxml</text>
+<page-wrap id="Page">
+    
+    <view class="food_body">
+        
+        <view class="coupon_title">{{couponName}}</view>
+
+        <view class="_s_t">指定可用商品:</view>
+        <view class="_pro_list">
+         {{foodListStr}}
+        </view>
+
+    </view>
+
+</page-wrap>

+ 22 - 1
pages/welfareMall/couponFitFood/index.wxss

@@ -1 +1,22 @@
-/* pages/welfareMall/couponFitFood/index.wxss */
+/* pages/welfareMall/couponFitFood/index.wxss */
+
+.food_body {
+    border-top: 10rpx solid #f4f4f4;
+}
+
+.coupon_title {
+    font-size: 36rpx;
+    padding: 48rpx 0 30rpx 28rpx;
+    font-weight: bold;
+    color: #444;
+}
+._s_t {
+    font-size: 28rpx;
+    color: #a0a0a0;
+    padding-left: 28rpx;
+}
+._pro_list {
+    font-size: 26rpx;
+    color: #444;
+    padding: 10rpx 28rpx;
+}

+ 6 - 0
project.private.config.json

@@ -149,6 +149,12 @@
                     "pathName": "pages/welfareMall/couponFitStore/index",
                     "query": "couponId=1PmexHzevy-1300",
                     "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/welfareMall/couponFitFood/index",
+                    "query": "couponId=1PmexHzevy-1300&couponName=9%E6%8A%98%E5%88%B8",
+                    "scene": null
                 }
             ]
         }