Explorar el Código

个人中心优惠券列表

kk.shi hace 3 años
padre
commit
0bd459e796
Se han modificado 4 ficheros con 249 adiciones y 54 borrados
  1. 74 5
      pages/luckDraw/profile.js
  2. 48 1
      pages/luckDraw/profile.wxml
  3. 74 1
      pages/luckDraw/profile.wxss
  4. 53 47
      project.private.config.json

+ 74 - 5
pages/luckDraw/profile.js

@@ -1,10 +1,20 @@
 // pages/luckDraw/profile.js
+import LuckDraw from '../../api/luck-draw'
+import { parseTime } from '../../utils/util';
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
+        page: 1,
+        pageSize: 10,
+        lock: false,
+        noResult: false,
+        noMore: false,
+        couponNum: 0,
+        productNum: 0,
+        goodsItemList: []
 
     },
 
@@ -12,7 +22,7 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        this.getUserPrizeList();
     },
 
     /**
@@ -51,16 +61,75 @@ Page({
     },
 
     /**
-     * 页面上拉触底事件的处理函数
+     * 用户点击右上角分享
      */
-    onReachBottom: function () {
+    onShareAppMessage: function () {
 
     },
+    getUserPrizeList: function() {
+        LuckDraw.getUserPrizeList({
+            page: this.data.page,
+            pageSize: this.data.pageSize,
+            mobile:'16602120168',
+            goodsType: 1
+        }).then(res => {
+            if (res.code == 200) {
+                this.uaerPrizeListView(res.data)
+            }
+            this.data.lock = false
+        }).catch(_ => {
+            this.data.lock = false
+        })
+    },
+
+    uaerPrizeListView: function(data) {
+        if (!Array.isArray(data.goodsItemList) || data.goodsItemList.length == 0) {
+            console.log("没有获取到数据");
+            if (this.data.couponNum == 1) {
+                this.setData({
+                    noResult: true
+                })
+            } else {
+                this.setData({
+                    noMore: true
+                })
+            }
+            return
+        }
+        data.goodsItemList.forEach(v => {
+            let beginTime = v.couponBeginTimestamp
+            let endTime = v.couponEndTimestamp
+            v.couponBeginTimestamp = parseTime(beginTime, "{y}.{m}.{d}")
+            v.couponEndTimestamp = parseTime(endTime, "{y}.{m}.{d}")
+            if(v.couponTitle.search("元") != -1){
+
+            }
+        })
+
+        this.data.goodsItemList = this.data.goodsItemList.concat(...data.goodsItemList)
+        this.setData({
+            couponNum: data.couponNum,
+            productNum: data.productNum,
+            goodsItemList: this.data.goodsItemList
+        })
+    },
 
     /**
-     * 用户点击右上角分享
+     * 页面上拉触底事件的处理函数
      */
-    onShareAppMessage: function () {
+    onReachBottom: function () {
+        if (this.data.lock || this.data.noMore) {
+            return
+        }
+        this.data.lock = true
+        this.data.page++
+        this.getUserPrizeList()
+    },
 
+    toDetail(e) {
+        const url = "detail?id=" + e.currentTarget.dataset.id
+        wx.redirectTo({
+            url
+        })
     }
 })

+ 48 - 1
pages/luckDraw/profile.wxml

@@ -1,5 +1,52 @@
 <!--pages/luckDraw/profile.wxml-->
-
+<view class="personal">
+<!-- 个人中心视图 -->
+    <view class="head-bg">
+       <image class="image_bg" src="/images/luck-draw/per_head.png" />
+       <image class="image_portrait" src="/images/luck-draw/portrait.png" />
+       <view class="luck-draw-pro-nickname">TONY WU</view>
+    </view>
+    <view class="luck-draw-pro-cp">
+      <!-- 优惠券 -->
+      <view class="luck-draw-coupon">
+        <view class="luck-draw-cn">{{couponNum}}</view>
+        <view class="luck-draw-cz">优惠券</view>
+        <view class="luck-draw-cjh"><view class="luck-draw-cj"></view></view>
+      </view>
+      <!-- 奖品 -->
+      <view class="luck-draw-prize">
+        <view class="luck-draw-pn">{{productNum}}</view>
+        <view class="luck-draw-pz">奖品</view>
+      </view>
+    </view>
+    <view class="luck-draw-theme">
+      <!-- 折扣券 -->
+      <view class="luck-draw-content" wx:for="{{goodsItemList}}" wx:key="index" data-id="{{item.id}}" catchtap="toDetail">
+        <image class="image_zk" src="/images/luck-draw/coupon1.png" />
+        <image class="image_zk_un" src="/images/luck-draw/coupon_use_now.png" />
+        <view class="luck-draw-zkz1">{{item.goodsName}}</view>
+        <view class="luck-draw-zkz21"></view>
+        <view class="luck-draw-zkz2">{{item.couponTitle}}</view>
+        <view class="luck-draw-zkz22"></view>
+        <view class="luck-draw-zkz3">{{item.couponBeginTimestamp}}-{{item.couponEndTimestamp}}</view>
+        <view class="luck-draw-zkz4">7</view>
+        <view class="luck-draw-zkz5">折</view>
+      </view>
+      <!-- 代金券 -->
+      <view class="luck-draw-content">
+        <image class="image_zk" src="/images/luck-draw/cash_coupon.png" />
+        <image class="image_zk_un" src="/images/luck-draw/cc_use_now.png" />
+        <view class="luck-draw-zkz1">鲜果茶品活动代金券</view>
+        <view class="luck-draw-zkz21"></view>
+        <view class="luck-draw-zkz2">满199使用</view>
+        <view class="luck-draw-zkz22"></view>
+        <view class="luck-draw-zkz3">2021.10.10-2022.01.02</view>
+        <view class="luck-draw-djz4">¥</view>
+        <view class="luck-draw-djz5">10</view>
+      </view>
+      
+    </view>
+</view>
 
 
 <!-- 底部导航 -->

+ 74 - 1
pages/luckDraw/profile.wxss

@@ -1 +1,74 @@
-/* pages/luckDraw/profile.wxss */
+/* pages/luckDraw/profile.wxss */
+.personal{
+  width: 750rpx;
+  height: auto;
+}
+
+.head-bg{
+  width: 750rpx;
+  height: 464rpx;
+}
+.image_bg{
+  width: 750rpx;
+  height: 464rpx;
+  position: absolute;
+  left: 0;
+  top: 0;
+  z-index: 1;
+}
+
+.image_portrait{
+  width: 140rpx;
+  height: 144rpx;
+  position: relative;
+  z-index: 2;
+  left: 304rpx;
+  top: 170rpx;
+}
+
+.luck-draw-pro-nickname{
+  width: 750rpx;
+  height: 50rpx;
+  font-size: 40rpx;
+  font-family: Source Han Sans CN;
+  font-weight: 500;
+  color: #FEFEFE;
+  position: relative;
+  z-index: 2;
+  text-align: center;
+  top: 180rpx;
+}
+
+.luck-draw-pro-cp{
+  width: 750rpx;
+  height: 180rpx;
+}
+
+.luck-draw-coupon,.luck-draw-prize{
+  display: inline-block;
+  width: 50%;
+  height: 100%;
+}
+.luck-draw-cn,.luck-draw-cz,.luck-draw-pn,.luck-draw-pz,.luck-draw-cjh{
+  text-align: center;
+}
+.luck-draw-cn,.luck-draw-pn{
+  margin-top: 30rpx;
+  font-size: 36rpx;
+  font-family: Source Han Sans CN;
+  font-weight: 500;
+  color: #BF2637;
+}
+.luck-draw-cz,.luck-draw-pz{
+  font-size: 32rpx;
+  font-family: Source Han Sans CN;
+  font-weight: 400;
+  color: #303030;
+}
+.luck-draw-cj{
+  width: 78rpx;
+  height: 6rpx;
+  background: #BF2637;
+  border-radius: 4rpx;
+  margin: 10rpx auto;
+}

+ 53 - 47
project.private.config.json

@@ -1,54 +1,60 @@
 {
-    "setting": {},
-    "condition": {
-        "plugin": {
-            "list": []
+  "setting": {},
+  "condition": {
+    "plugin": {
+      "list": []
+    },
+    "game": {
+      "list": []
+    },
+    "gamePlugin": {
+      "list": []
+    },
+    "miniprogram": {
+      "list": [
+        {
+          "name": "pages/activityInfo/activityInfo",
+          "pathName": "pages/activityInfo/activityInfo",
+          "query": "id=Bg5740r78w&mobile=18636653274",
+          "scene": null
         },
-        "game": {
-            "list": []
+        {
+          "name": "pages/couponReceive/couponReceive",
+          "pathName": "pages/couponReceive/couponReceive",
+          "query": "codeId=JyZmVzKm0D-47",
+          "scene": null
         },
-        "gamePlugin": {
-            "list": []
+        {
+          "name": "pages/myCoupons/myCoupons",
+          "pathName": "pages/myCoupons/myCoupons",
+          "query": "mobile=18636653274",
+          "scene": null
         },
-        "miniprogram": {
-            "list": [
-                {
-                    "name": "pages/activityInfo/activityInfo",
-                    "pathName": "pages/activityInfo/activityInfo",
-                    "query": "id=Bg5740r78w&mobile=18636653274",
-                    "scene": null
-                },
-                {
-                    "name": "pages/couponReceive/couponReceive",
-                    "pathName": "pages/couponReceive/couponReceive",
-                    "query": "codeId=JyZmVzKm0D-47",
-                    "scene": null
-                },
-                {
-                    "name": "pages/myCoupons/myCoupons",
-                    "pathName": "pages/myCoupons/myCoupons",
-                    "query": "mobile=18636653274",
-                    "scene": null
-                },
-                {
-                    "name": "pages/receiveCoupon/receiveCoupon",
-                    "pathName": "pages/receiveCoupon/receiveCoupon",
-                    "query": "",
-                    "scene": 1013
-                },
-                {
-                    "name": "pages/luckDraw/detail",
-                    "pathName": "pages/luckDraw/detail",
-                    "query": "id=8",
-                    "scene": null
-                },
-                {
-                    "name": "pages/luckDraw/index",
-                    "pathName": "pages/luckDraw/index",
-                    "query": "",
-                    "scene": null
-                }
-            ]
+        {
+          "name": "pages/receiveCoupon/receiveCoupon",
+          "pathName": "pages/receiveCoupon/receiveCoupon",
+          "query": "",
+          "scene": 1013
+        },
+        {
+          "name": "pages/luckDraw/detail",
+          "pathName": "pages/luckDraw/detail",
+          "query": "id=8",
+          "scene": null
+        },
+        {
+          "name": "pages/luckDraw/index",
+          "pathName": "pages/luckDraw/index",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "pages/luckDraw/profile",
+          "pathName": "pages/luckDraw/profile",
+          "query": "",
+          "scene": null
         }
+      ]
     }
+  }
 }