Quellcode durchsuchen

个人中心调整

kk.shi vor 3 Jahren
Ursprung
Commit
be88442669

+ 0 - 171
pages/luckDraw/prize.js

@@ -1,171 +0,0 @@
-// pages/luckDraw/prize.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,
-        mobileTop: 'TONY WU',
-        couponNum: 0,
-        productNum: 0,
-        goodsItemList: []
-
-    },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-        isLogin: getMobileCache() != ''
-    })
-    if(this.data.isLogin){
-        this.getUserPrizeList();
-    }
-    
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  },
-  getUserPrizeList: function() {
-      LuckDraw.getUserPrizeList({
-          page: this.data.page,
-          pageSize: this.data.pageSize,
-          mobile: getMobileCache(),
-          goodsType: 2
-      }).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.page == 1) {
-                this.setData({
-                    mobileTop:getMobileCache(),
-                    couponNum: data.couponNum,
-                    productNum: data.productNum,
-                    noResult: true
-                })
-            } else {
-                this.setData({
-                    mobileTop:getMobileCache(),
-                    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 (this.data.page == 1) {
-        this.setData({
-            couponNum: data.couponNum,
-            productNum: data.productNum
-        })
-      }
-      this.data.goodsItemList = this.data.goodsItemList.concat(...data.goodsItemList)
-      this.setData({
-          mobileTop:getMobileCache(),
-          goodsItemList: this.data.goodsItemList
-      })
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-      if (this.data.lock || this.data.noResult) {
-          return
-      }
-      this.data.lock = true
-      this.data.page++
-      this.getUserPrizeList()
-  },
-
-  toProfile(e) {
-    const url = "profile?id=" + e.currentTarget.dataset.id
-    wx.redirectTo({
-        url
-    })
-   },
-    turnPrize: function() {
-        console.log("开始查看")
-        if (this.islock || !this.data.isLogin) {
-            return
-        }
-    },
-    // 授权手机号
-    getPhoneNumber(e) {
-        getPhoneNumberSync(e, _ => {
-            this.setData({
-                isLogin: true,
-                mobileTop:getMobileCache(),
-            })
-            this.getUserPrizeList()
-        })
-    },
-    toRecordPrize(e) {
-        const url = "recordPrize?id=" + e.currentTarget.dataset.id
-        wx.redirectTo({
-            url
-        })
-    },
-})

+ 0 - 6
pages/luckDraw/prize.json

@@ -1,6 +0,0 @@
-{
-  "navigationBarTitleText": "个人中心",
-  "usingComponents": {
-    "tab-bar": "./components/tabbar"
-  }
-}

+ 0 - 58
pages/luckDraw/prize.wxml

@@ -1,58 +0,0 @@
-<!--pages/luckDraw/prize.wxml-->
-<view class="personal">
-<!-- 个人中心视图 -->
-    <view class="head-bg" catchtap="turnPrize">
-       <image class="image_bg" src="/images/luck-draw/per_head.png" />
-       <image class="image_portrait" src="/images/luck-draw/portrait.png" />
-       <button class="luck-draw-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" >登录</button>
-       <view class="luck-draw-pro-nickname" wx:if="{{isLogin}}">{{phone.toHide(mobileTop)}}</view>
-    </view>
-    <view class="luck-draw-pro-cp">
-      <!-- 优惠券 -->
-      <view class="luck-draw-coupon" catchtap="toProfile">
-        <view class="luck-draw-cn">{{couponNum}}</view>
-        <view class="luck-draw-cz">优惠券</view>
-      </view>
-      <!-- 奖品 -->
-      <view class="luck-draw-prize">
-        <view class="luck-draw-pn">{{productNum}}</view>
-        <view class="luck-draw-pz">奖品</view>
-        <view class="luck-draw-cjh"><view class="luck-draw-cj"></view></view>
-      </view>
-    </view>
-    <view class="luck-draw-theme">
-      <!-- 奖品 -->
-      <view class="luck-draw-content" wx:for="{{goodsItemList}}" wx:key="index" data-id="{{item.id}}">
-        <view class="luck-draw-words">
-          <view class="luck-draw-discount1">
-           
-            <image class="luck-draw-zkz5" src="/images/luck-draw/prize.png" />
-          </view>
-          <view class="luck-draw-discount2">
-            <view class="luck-draw-zkz1">{{item.goodsName}}</view>
-            <view class="luck-draw-zkz3">奖品参数</view>
-          </view>
-        </view>
-        <image class="image_zk_un" src="/images/luck-draw/choice.png" />
-        <navigator class="_btn _exchange" 
-            target = "miniProgram" 
-            app-id="wxd92a2d29f8022f40"
-            path="page/index/index"
-            open-type='navigate'> 
-            </navigator>
-      </view>
-      <view class="no_result" wx:if="{{noResult}}">———— 抱歉,您暂无可领取奖品 ————</view>
-      <view class="no_result" wx:if="{{noMore}}">———— 更多奖品 | 敬请期待 ————</view>
-    </view>
-</view>
-
-<!-- 使用wxs 手机号码中间四位显示为*号 -->
-<wxs module="phone">
-var toHide = function(array) {
-  var mphone = array.substring(0, 3) + '****' + array.substring(7);
-  return mphone;
-}
-module.exports.toHide = toHide;
-</wxs>
-<!-- 底部导航 -->
-<tab-bar />

+ 0 - 204
pages/luckDraw/prize.wxss

@@ -1,204 +0,0 @@
-/* pages/luckDraw/prize.wxss */
-.personal{
-  width: 750rpx;
-  height: auto;
-  padding-bottom: 119rpx;
-}
-
-.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;
-}
-
-.luck-draw-content{
-  width: 708rpx;
-  height: 220rpx;
-  position: relative;
-  margin: 0 auto 20rpx;
-}
-.image_zk{
-  width: 708rpx;
-  height: 220rpx;
-  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;
-}
-._btn {
-  display: inline-block;
-  width: 162rpx;
-  height: 56rpx;
-  position:absolute;
-  z-index: 3;
-  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: 220rpx;
-  display: flex;
-  flex-direction: row;
-  background: #FFFFFF;
-  border: 0.5rpx solid #FF7A03;
-  box-shadow: 0rpx 0rpx 50rpx 8rpx rgba(127, 127, 127, 0.09);
-  border-radius: 20rpx;
-}
-.luck-draw-discount1{
-  width: 214rpx;
-  height: 220rpx;
-  background: #FFE9B0;
-  border: 0rpx solid #FF7A03;
-  border-radius: 20rpx 0 0 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: 134rpx;
-  height: 106rpx;
-  position: relative;
-  top: 55rpx;
-}
-
-.luck-draw-zkz1{
-  font-size: 40rpx;
-  font-family: Source Han Sans CN;
-  font-weight: 500;
-  color: #443E5B;
-  line-height: 40rpx;
-  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;
-}
-
-.luck-draw-isLogin{
-  background-color: transparent;
-  width: 750rpx;
-  height: 70rpx;
-  font-size: 40rpx;
-  font-family: Source Han Sans CN;
-  font-weight: 500;
-  color: #FEFEFE;
-  position: relative;
-  z-index: 2;
-  text-align: center;
-  top: 180rpx;
-}

+ 14 - 8
pages/luckDraw/profile.js

@@ -29,7 +29,7 @@ Page({
             isLogin: getMobileCache() != ''
         })
         if(this.data.isLogin){
-            this.getUserPrizeList();
+            this.getUserPrizeList(1);
         }
     },
 
@@ -74,12 +74,12 @@ Page({
     onShareAppMessage: function () {
 
     },
-    getUserPrizeList: function() {
+    getUserPrizeList: function(sum) {
         LuckDraw.getUserPrizeList({
             page: this.data.page,
             pageSize: this.data.pageSize,
-            mobile: getMobileCache(),
-            goodsType: 1
+            mobile: "13205528979",
+            goodsType: sum
         }).then(res => {
             if (res.code == 200) {
                 this.uaerPrizeListView(res.data)
@@ -114,12 +114,12 @@ Page({
             let endTime = v.couponEndTimestamp
             v.couponBeginTimestamp = parseTime(beginTime, "{y}.{m}.{d}")
             v.couponEndTimestamp = parseTime(endTime, "{y}.{m}.{d}")
-            if(v.couponType == 'D' && v.discount >0){
+            /**if(v.couponType == 'D' && v.discount >0){
                 v.discount /= 10
             }
             if(v.couponType == 'C' && v.discount >0){
                 v.reduceCost /= 100
-            }
+            }*/
         })
 
         if (this.data.page == 1) {
@@ -144,7 +144,7 @@ Page({
         }
         this.data.lock = true
         this.data.page++
-        this.getUserPrizeList()
+        this.getUserPrizeList(1)
     },
     
 
@@ -154,6 +154,12 @@ Page({
             url
         })
     },
+    getProfile(e) {
+        this.getUserPrizeList(1)
+    },
+    getPrize(e) {
+        this.getUserPrizeList(2)
+    },
     turnPrize: function() {
         console.log("开始查看")
         if (this.lock || !this.data.isLogin) {
@@ -169,7 +175,7 @@ Page({
                 mobileTop:getMobileCache(),
             })
             console.log(this.data.mobileTop)
-            this.getUserPrizeList()
+            this.getUserPrizeList(1)
         })
     },
     toRecordPrize(e) {

+ 31 - 6
pages/luckDraw/profile.wxml

@@ -9,23 +9,23 @@
     </view>
     <view class="luck-draw-pro-cp">
       <!-- 优惠券 -->
-      <view class="luck-draw-coupon">
+      <view class="luck-draw-coupon" catchtap="getProfile">
         <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" catchtap="toPrize">
+      <view class="luck-draw-prize" catchtap="getPrize">
         <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}}" wx:if="{{item.couponType == 'D'}}">
+      <view class="luck-draw-content" wx:for="{{goodsItemList}}" wx:key="index" data-id="{{item.id}}" wx:if="{{item.couponType == 'D' && item.goodsType == 1}}">
         <view class="luck-draw-words">
           <view class="luck-draw-discount1">
-            <view class="luck-draw-zkz4">{{item.discount ?item.discount:0}}</view>
+            <view class="luck-draw-zkz4">{{item.formatDiscount ?item.formatDiscount:0}}</view>
             <view class="luck-draw-zkz5">折</view>
           </view>
           <view class="luck-draw-discount2">
@@ -48,7 +48,7 @@
             </navigator>
       </view>
       <!-- 代金券 -->
-      <view class="luck-draw-content" wx:for="{{goodsItemList}}" wx:key="index" data-id="{{item.id}}" wx:if="{{item.couponType == 'C'}}">
+      <view class="luck-draw-content" wx:for="{{goodsItemList}}" wx:key="index" data-id="{{item.id}}" wx:if="{{item.couponType == 'C' && item.goodsType == 1}}">
         <image class="image_zk" src="/images/luck-draw/cash_coupon.png" />
         <image class="image_zk_un" src="/images/luck-draw/cc_use_now.png" />
             <navigator class="_btn _exchange" 
@@ -60,7 +60,7 @@
         <view class="luck-draw-words">
           <view class="luck-draw-discount1">
             <view class="luck-draw-djz4">¥</view>
-            <view class="luck-draw-djz5">{{item.reduceCost ?item.reduceCost:0}}</view>
+            <view class="luck-draw-djz5">{{item.formatReduceCost ?item.formatReduceCost:0}}</view>
           </view>
           <view class="luck-draw-discount2">
             <view class="luck-draw-zkz1">{{item.goodsName}}</view>
@@ -77,6 +77,31 @@
       <view class="no_result" wx:if="{{noResult}}">———— 抱歉,您暂无可用优惠券 ————</view>
       <view class="no_result" wx:if="{{noMore}}">———— 更多优惠券 | 敬请期待 ————</view>
     </view>
+
+    <view class="luck-draw-theme">
+      <!-- 奖品 -->
+      <view class="luck-draw-content" wx:for="{{goodsItemList}}" wx:key="index" data-id="{{item.id}}" wx:if="{{item.goodsType == 2}}">
+        <view class="luck-draw-wordsj">
+          <view class="luck-draw-discount1j">
+           
+            <image class="luck-draw-zkzj" src="/images/luck-draw/prize.png" />
+          </view>
+          <view class="luck-draw-discount2">
+            <view class="luck-draw-zkz1j">{{item.goodsName}}</view>
+            <view class="luck-draw-zkz3j">奖品参数</view>
+          </view>
+        </view>
+        <image class="image_zk_unj" src="/images/luck-draw/choice.png" />
+        <navigator class="_btn _exchange" 
+            target = "miniProgram" 
+            app-id="wxd92a2d29f8022f40"
+            path="page/index/index"
+            open-type='navigate'> 
+            </navigator>
+      </view>
+      <view class="no_result" wx:if="{{noResult}}">———— 抱歉,您暂无可领取奖品 ————</view>
+      <view class="no_result" wx:if="{{noMore}}">———— 更多奖品 | 敬请期待 ————</view>
+    </view>
 </view>
 
 <!-- 使用wxs 手机号码中间四位显示为*号 -->

+ 70 - 0
pages/luckDraw/profile.wxss

@@ -98,6 +98,16 @@
   bottom: 70rpx;
   right: 26rpx;
 }
+
+.image_zk_unj{
+  display: inline-block;
+  width: 162rpx;
+  height: 56rpx;
+  position:absolute;
+  z-index: 2;
+  bottom: 70rpx;
+  right: 26rpx;
+}
 ._btn {
   display: inline-block;
   width: 162rpx;
@@ -111,6 +121,10 @@
 .luck-draw-discount1,.luck-draw-discount2,.luck-draw-zkz4,.luck-draw-zkz5,.luck-draw-zkz21,.luck-draw-zkz22,.luck-draw-zkz2,.luck-draw-djz4,.luck-draw-djz5{
   display: inline-block;
 }
+
+.luck-draw-discountj,.luck-draw-zkzj{
+  display: inline-block;
+}
 .luck-draw-words{
   position:relative;
   z-index: 2;
@@ -119,17 +133,44 @@
   display: flex;
   flex-direction: row;
 }
+
+.luck-draw-wordsj{
+  position:relative;
+  z-index: 2;
+  width: 708rpx;
+  height: 220rpx;
+  display: flex;
+  flex-direction: row;
+  background: #FFFFFF;
+  border: 0.5rpx solid #FF7A03;
+  box-shadow: 0rpx 0rpx 50rpx 8rpx rgba(127, 127, 127, 0.09);
+  border-radius: 20rpx;
+}
+
 .luck-draw-discount1{
   width: 208rpx;
   height: 100%;
   text-align: center;
   line-height: 220rpx;
 }
+.luck-draw-discount1j{
+  width: 214rpx;
+  height: 220rpx;
+  background: #FFE9B0;
+  border: 0rpx solid #FF7A03;
+  border-radius: 20rpx 0 0 20rpx;
+  text-align: center;
+}
 .luck-draw-discount1 view:nth-child(1) {
   position: relative;
   top: 60rpx;
 }
 
+.luck-draw-discountj view:nth-child(1) {
+  position: relative;
+  top: 40rpx;
+}
+
 .luck-draw-discount1 view:nth-child(2) {
   position: relative;
   top: 60rpx;
@@ -156,6 +197,13 @@
   line-height: 142rpx;
 }
 
+.luck-draw-zkzj{
+  width: 134rpx;
+  height: 106rpx;
+  position: relative;
+  top: 55rpx;
+}
+
 .luck-draw-zkz5,.luck-draw-djz4{
   font-size: 40rpx;
   font-family: Microsoft YaHei;
@@ -173,6 +221,17 @@
   margin-top: 48rpx;
   margin-left: 48rpx;
 }
+
+.luck-draw-zkz1j{
+  font-size: 40rpx;
+  font-family: Source Han Sans CN;
+  font-weight: 500;
+  color: #443E5B;
+  line-height: 40rpx;
+  margin-top: 48rpx;
+  margin-left: 48rpx;
+}
+
 .luck-draw-mj{
   margin-left: 48rpx;
   margin-top: 20rpx;
@@ -201,6 +260,17 @@
   margin-left: 48rpx;
 }
 
+.luck-draw-zkz3j{
+  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;