浏览代码

优惠券的使用

zhuliu 1 年之前
父节点
当前提交
039e67638d
共有 4 个文件被更改,包括 10 次插入33 次删除
  1. 5 2
      myComponents/pay/pay.js
  2. 1 27
      pages/memberCenter/menberCenter2.js
  3. 3 3
      pages/memberCenter/menberCenter2.wxml
  4. 1 1
      pages/voucher/voucher.js

+ 5 - 2
myComponents/pay/pay.js

@@ -66,10 +66,13 @@ Component({
       api.queryPersonVoucher(params).then(res=>{
         if(res.code == 200){
           if(res.data.total>0){
+            var data = res.data.data.filter(item=>{
+              return item.threshold <= Number(this.data.data.price)
+            })
             this.setData(
               {
-                voucherShow:`${res.data.total}张待使用券`,
-                voucherTotal:res.data.total
+                voucherShow:`${data.length}张待使用券`,
+                voucherTotal:data.length
               }
             )
           }else{

+ 1 - 27
pages/memberCenter/menberCenter2.js

@@ -11,32 +11,7 @@ Page({
     localImagePath:app.globalData.localImagePath,
     imgHttp:app.globalData.imghttp,
     userinfo:{},
-    vipType:[
-      {
-        name:'1个月',
-        price:'20',
-        // currentPrice:'20',
-        description:'开通1个月会员,享尊贵特权'
-      },
-      {
-        name:'连续包月',
-        price:'8',
-        currentPrice:'20',
-        description:'前两个月仅需8元,续费20元/月,可随时取消'
-      },
-      {
-        name:'3个月',
-        price:'40',
-        currentPrice:'160',
-        description:'40元购3个月会员,享尊贵特权'
-      },
-      {
-        name:'12个月',
-        price:'138',
-        currentPrice:'580',
-        description:'138元购12个月会员,享尊贵特权'
-      }
-    ],
+    vipType:[],
     chooseVip:null,
     tableData:[
       { functionName: '查看爆款产品', notVip: '23', vip: '20'},
@@ -122,7 +97,6 @@ Page({
             tableData:tableData
           }
         )
-        console.log(that.data.tableHead,that.data.tableData)
       }
     })
   },

+ 3 - 3
pages/memberCenter/menberCenter2.wxml

@@ -22,14 +22,14 @@
         <view  wx:for="{{vipType}}" class="vipType_item {{chooseVip.name == item.name?'checked':''}}" data-item="{{item}}" bind:tap="chooseVip">
           <view class="vipType_item_title">{{item.name}}</view>
           <view class="vipType_item_price"><span wx:if="{{item.finalPrice || item.finalPrice == 0}}" style="font-size: 12px;">¥</span>{{item.finalPrice}}</view>
-          <view class="vipType_item_currentPrice"><span wx:if="{{item.price || item.price == 0}}">¥</span>{{item.price}}</view>
+          <view class="vipType_item_currentPrice" wx:if="{{(item.price || item.price == 0) && item.finalPrice < item.price}}"><span wx:if="{{item.price || item.price == 0}}">¥</span>{{item.price}}</view>
         </view>
       </view>
     </scroll-view>
     <!-- 会员权益 -->
     <view class="vipDescription">
       <!-- <view>{{chooseVip.description}}</view> -->
-      <view class="vipDescription_title">赠送以下权益:</view>
+      <view class="vipDescription_title">赠送以下福利:</view>
       <view class="vipDescription_content">
         <view class="vipDescription_content_item">
           <view class="vipDescription_content_item_img">
@@ -37,7 +37,7 @@
           </view>
           <view class="vipDescription_content_item_text">
             <view>专属优惠券</view>
-            <view style="font-size: 20rpx;margin-top: 4px;">100元无门槛</view>
+            <!-- <view style="font-size: 20rpx;margin-top: 4px;">100元无门槛</view> -->
           </view>
         </view>
         <view class="vipDescription_content_item">

+ 1 - 1
pages/voucher/voucher.js

@@ -82,7 +82,7 @@ Page({
       if(res.code == 200){
         var data = res.data.data
         var data2 = data.filter(item=>{
-          if(item.threshold < Number(this.data.totalPrice) || this.data.all){
+          if(item.threshold <= Number(this.data.totalPrice) || this.data.all){
             item.useScopesText = this.getUseScopeText(item.useScopes)
             return item
           }