kk.shi 3 rokov pred
rodič
commit
f1a6780a89

+ 2 - 1
app.json

@@ -9,7 +9,8 @@
     "pages/luckDraw/detail",
     "pages/luckDraw/index",
     "pages/luckDraw/profile",
-    "pages/luckDraw/prize"
+    "pages/luckDraw/prize",
+    "pages/luckDraw/recordPrize"
   ],
   "window": {
     "backgroundTextStyle": "light",

BIN
images/luck-draw/recordPrize.png


+ 6 - 0
pages/luckDraw/prize.js

@@ -140,4 +140,10 @@ Page({
             this.getUserPrizeList()
         })
     },
+    toRecordPrize(e) {
+        const url = "recordPrize?id=" + e.currentTarget.dataset.id
+        wx.redirectTo({
+            url
+        })
+    },
 })

+ 1 - 1
pages/luckDraw/prize.wxml

@@ -4,7 +4,7 @@
     <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 class="luck-draw-pro-nickname"  catchtap="toRecordPrize">TONY WU</view>
     </view>
     <view class="luck-draw-pro-cp">
       <!-- 优惠券 -->

+ 6 - 0
pages/luckDraw/profile.js

@@ -142,4 +142,10 @@ Page({
             this.getUserPrizeList()
         })
     },
+    toRecordPrize(e) {
+        const url = "recordPrize?id=" + e.currentTarget.dataset.id
+        wx.redirectTo({
+            url
+        })
+    },
 })

+ 1 - 1
pages/luckDraw/profile.wxml

@@ -4,7 +4,7 @@
     <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 class="luck-draw-pro-nickname" catchtap="toRecordPrize">TONY WU</view>
     </view>
     <view class="luck-draw-pro-cp">
       <!-- 优惠券 -->

+ 143 - 0
pages/luckDraw/recordPrize.js

@@ -0,0 +1,143 @@
+// pages/luckDraw/recordPrize.js
+import LuckDraw from '../../api/luck-draw'
+import { parseTime } from '../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../utils/user'
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        page: 1,
+        pageSize: 10,
+        lock: false,
+        noResult: false,
+        noMore: false,
+        isLogin: false,
+        userDrawItemList: []
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        this.setData({
+            isLogin: getMobileCache() != ''
+        })
+        this.getUserDrawRecord();
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    },
+    getUserDrawRecord: function() {
+        LuckDraw.getUserDrawRecord({
+            page: this.data.page,
+            pageSize: this.data.pageSize,
+            mobile:  getMobileCache(),
+            goodsType: 1
+        }).then(res => {
+            if (res.code == 200) {
+                this.uaerPrizeListView(res.data)
+            }
+            this.data.lock = false
+        }).catch(_ => {
+            console.log(_)
+            this.data.lock = false
+        })
+    },
+
+    uaerPrizeListView: function(data) {
+        if (!Array.isArray(data) || data.length == 0) {
+            console.log("没有获取到数据");
+                this.setData({
+                    noResult: true
+                })
+            return
+        }
+        data.forEach(v => {
+            let beginTime = v.couponBeginTimestamp
+            let endTime = v.couponEndTimestamp
+            let createTime = v.createTime
+            v.couponBeginTimestamp = parseTime(beginTime, "{y}.{m}.{d}")
+            v.couponEndTimestamp = parseTime(endTime, "{y}.{m}.{d}")
+            v.createTime = parseTime(createTime, "{y}.{m}.{d} {h}:{s}")
+        })
+
+        this.data.userDrawItemList = this.data.userDrawItemList.concat(...data)
+        this.setData({
+            userDrawItemList: this.data.userDrawItemList
+        })
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     
+    onReachBottom: function () {
+        if (this.data.lock || this.data.noMore) {
+            return
+        }
+        this.data.lock = true
+        this.data.page++
+        this.getUserPrizeList()
+    },
+    */
+
+   toRecordPrize(e) {
+        const url = "recordPrize?id=" + e.currentTarget.dataset.id
+        wx.redirectTo({
+            url
+        })
+    },
+    turnPrize: function() {
+        console.log("开始查看")
+        if (this.isLock || !this.data.isLogin) {
+            return
+        }
+    },
+    // 授权手机号
+    getPhoneNumber(e) {
+        getPhoneNumberSync(e, _ => {
+            this.getUserDrawRecord()
+        })
+    },
+})

+ 6 - 0
pages/luckDraw/recordPrize.json

@@ -0,0 +1,6 @@
+{
+  "navigationBarTitleText": "中奖记录",
+  "usingComponents": {
+    "tab-bar": "./components/tabbar"
+  }
+}

+ 27 - 0
pages/luckDraw/recordPrize.wxml

@@ -0,0 +1,27 @@
+<!--pages/luckDraw/recordPrize.wxml-->
+<view class="personal">
+<!-- 中奖记录 -->
+    <view class="luck-draw-theme" catchtap="turnPrize">
+      <button class="luck-draw-cz" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" >请进行用户授权</button>
+      <!-- 奖品 -->
+      <view class="luck-draw-content" wx:for="{{userDrawItemList}}" wx:key="index" data-id="{{item.id}}">
+        <view class="luck-draw-words">
+          <view class="luck-draw-discount1">
+            <view class="luck-draw-zkz4">{{item.goodsName}}</view>
+            <image class="luck-draw-zkz5" src="/images/luck-draw/recordPrize.png" />
+          </view>
+          <view class="luck-draw-discount2">
+            <view class="luck-draw-zkz1">{{item.goodsName}}</view>
+            <view class="luck-draw-zkz3">{{item.createTime}}</view>
+          </view>
+        </view>
+      </view>
+      <view class="no_result" wx:if="{{noResult}}">———— 抱歉,您暂无中奖记录 ————</view>
+    </view>
+</view>
+
+
+<!-- 底部导航 -->
+<tab-bar />
+
+

+ 141 - 0
pages/luckDraw/recordPrize.wxss

@@ -0,0 +1,141 @@
+/* pages/luckDraw/recordPrize.wxss */
+.personal{
+  width: 750rpx;
+  height: auto;
+  padding-bottom: 119rpx;
+}
+
+.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;
+}
+
+.luck-draw-content{
+  width: 708rpx;
+  height: 190rpx;
+  position: relative;
+  margin: 0 auto 20rpx;
+}
+.image_zk{
+  width: 708rpx;
+  height: 190rpx;
+  position: absolute;
+  z-index: 1;
+  left: 0;
+  top: 0;
+}
+
+.image_zk_un{
+  display: inline-block;
+  width: 162rpx;
+  height: 56rpx;
+  position:absolute;
+  z-index: 2;
+  bottom: 70rpx;
+  right: 26rpx;
+}
+.luck-draw-discount1,.luck-draw-discount2,.luck-draw-zkz2,.luck-draw-djz4,.luck-draw-djz5{
+  display: inline-block;
+}
+.luck-draw-words{
+  position:relative;
+  z-index: 2;
+  width: 708rpx;
+  height: 190rpx;
+  display: flex;
+  flex-direction: row;
+  background: #FFFFFF;
+  border: 0rpx solid #FF7A03;
+  box-shadow: 0 0 50rpx 8rpx rgba(127, 127, 127, 0.09);
+  border-radius: 20rpx;
+}
+.luck-draw-discount1{
+  width: 214rpx;
+  height: 190rpx;
+  background: #FFE9B0;
+  border: 0rpx solid #FF7A03;
+  border-radius: 20rpx;
+  text-align: center;
+}
+.luck-draw-discount1 view:nth-child(1) {
+  position: relative;
+  top: 40rpx;
+}
+
+.luck-draw-discount2{
+  width: 500rpx;
+  height: 100%;
+}
+
+.luck-draw-zkz4{
+  font-size: 32rpx;
+  font-family: YouSheBiaoTiHei;
+  font-weight: 400;
+  color: #FF7A03;
+  line-height: 44rpx;
+}
+
+.luck-draw-zkz5{
+  width: 116rpx;
+  height: 92rpx;
+  position: relative;
+  top: 50rpx;
+}
+
+.luck-draw-zkz1{
+  font-size: 32rpx;
+  font-family: Microsoft YaHei;
+  font-weight: 400;
+  color: #443E5B;
+  line-height: 32rpx;
+  margin-top: 48rpx;
+  margin-left: 48rpx;
+}
+.luck-draw-mj{
+  margin-left: 48rpx;
+  margin-top: 20rpx;
+  margin-bottom: 20rpx;
+}
+
+.luck-draw-zkz3{
+  font-size: 26rpx;
+  font-family: Microsoft YaHei;
+  font-weight: 400;
+  color: #443E5B;
+  line-height: 32rpx;
+  line-height: 32rpx;
+  margin-left: 48rpx;
+  margin-top: 30rpx;
+}
+
+.no_result {
+  font-size: 24rpx;
+  color: #B1B1B1;
+  text-align: center;
+  line-height: 100rpx;
+  font-weight: 1000;
+}