Bladeren bron

联调vip过期续费

bayi 2 jaren geleden
bovenliggende
commit
f69678a097
5 gewijzigde bestanden met toevoegingen van 16 en 27 verwijderingen
  1. 4 1
      pages/my/index.js
  2. 11 7
      pages/my/index.wxml
  3. 0 12
      pages/reading/buyVip/index.js
  4. 1 6
      pages/reading/buyVip/index.wxml
  5. 0 1
      pages/reading/index.js

+ 4 - 1
pages/my/index.js

@@ -24,7 +24,8 @@ Page({
          */
         activationModal: false,
         activationRes: {},
-        products: []
+        products: [],
+        isPreferential: false
     },
     onLoad() {
         // 手工绑定 
@@ -64,9 +65,11 @@ Page({
     async getProducts() {
         let {
             productList: products,
+            isPreferential
         } = await getProducts()
         this.setData({
             products,
+            isPreferential
         })
     },
     activationCode() {

+ 11 - 7
pages/my/index.wxml

@@ -62,19 +62,23 @@
         <view class="tips">请输入学习卡激活码</view>
         <view class="subBtn">激活</view>
     </view>
-    <view class="payBox" wx:if="{{!vipTime||vipTime=='1'}}">
-        <view class="buyBtn" bindtap="toBuy" data-id="{{products[0].id}}">
-            {{ !vipTime?'立即开通':'终身使用'}}
+    <view class="payBox" wx:if="{{!isPreferential||vipTime=='1'}}">
+        <view class="buyBtn" bindtap="toBuy" data-id="{{products[0].id}}" wx:if="{{!isPreferential}}">
+            立即开通
+        </view>
+        <view class="buyBtn" wx:else>
+            终身使用
         </view>
     </view>
     <view class="payBox payBox2" wx:if="{{vipTime!='1'}}">
-        <view class="buyBtn" bindtap="toBuy" data-id="{{products[1].id}}" wx:if="{{!vipTime}}">立即开通
-        </view>
-        <view class="buyBtn" style="font-size: 22rpx;" wx:else>
+        <view class="buyBtn" style="font-size: 22rpx;" wx:if="{{vipTime}}">
             有效期:{{filters.formatDate(vipTime,5)}}
         </view>
+        <view class="buyBtn" bindtap="toBuy" data-id="{{products[1].id}}" wx:else>
+            {{!vipTime&&!isPreferential?'立即开通':'已到期 请续费使用'}}
+        </view>
     </view>
-    <view class="renewBox" wx:if="{{vipTime&&vipTime!='1'}}">
+    <view class="renewBox" wx:if="{{isPreferential&&vipTime!='1'}}">
         <view class="title">续费</view>
         <view class="renew">
             <view class="left">{{products[0].title}} <view class="money">+{{products[0].price/100}}元</view>

+ 0 - 12
pages/reading/buyVip/index.js

@@ -3,26 +3,15 @@ import {
 } from '~/api/global'
 
 Component({
-    /**
-     * 组件的属性列表
-     */
     properties: {
 
     },
-
-    /**
-     * 组件的初始数据
-     */
     data: {
         show: false,
         products: [],
         // 是否购买过vip
         isPreferential: false
     },
-
-    /**
-     * 组件的方法列表
-     */
     methods: {
         open() {
             this.getProducts()
@@ -48,7 +37,6 @@ Component({
         triggerPay({
             currentTarget
         }) {
-            console.log(currentTarget.dataset.goods);
             this.triggerEvent('toBuy', currentTarget.dataset.goods)
         }
     }

+ 1 - 6
pages/reading/buyVip/index.wxml

@@ -13,17 +13,12 @@
             <view class="payBox" bindtap="triggerPay" data-goods="{{products[0]}}">
             </view>
             <view class="payBox payBox2" bindtap="triggerPay" data-goods="{{products[1]}}">
-                <!--    <view class="buyBtn" bindtap="toBuy" data-id="{{products[1].id}}" wx:if="{{!vipTime}}">立即开通
-                </view>
-                <view class="buyBtn" style="font-size: 22rpx;" wx:else>
-                    有效期:{{filters.formatDate(vipTime,5)}}
-                </view> -->
             </view>
         </view>
         <view wx:else>
             <view class="payBox payBox3">
                 <view class="validity">
-                    有效期:{{filters.formatDate(vipTime,5)}}
+                    已到期 请续费使用
                 </view>
             </view>
             <view class="renewBox">

+ 0 - 1
pages/reading/index.js

@@ -194,7 +194,6 @@ Page({
     // 获取是否vip
     async getVipInfo() {
         let vipTime = await getVipInfo()
-        console.log(vipTime, '111');
         this.setData({
             isVip: vipTime != ''
         })