浏览代码

开发购买页

bayi 1 年之前
父节点
当前提交
b770f24362

+ 10 - 6
components/donutBuy/index.js

@@ -41,9 +41,11 @@ Component({
             // #if MP
             this.toBuy()
             // #elif ANDROID
-            this.getTabBar().setData({
-                mask: true
-            })
+            if (this.getTabBar()) {
+                this.getTabBar().setData({
+                    mask: true
+                })
+            }
             this.setData({
                 state: true,
             })
@@ -60,9 +62,11 @@ Component({
             })
         },
         closeTranscript() {
-            this.getTabBar().setData({
-                mask: false
-            })
+            if (this.getTabBar()) {
+                this.getTabBar().setData({
+                    mask: true
+                })
+            }
             this.setData({
                 state: false
             })

+ 4 - 0
components/donutBuy/index.less

@@ -67,6 +67,10 @@
                     }
                 }
             }
+
+            .weui-cell:first-child {
+                border-bottom: 2rpx solid white;
+            }
         }
 
         .paymentBox {

+ 1 - 16
components/donutBuy/index.wxml

@@ -4,28 +4,13 @@
             <image src="/static/bclose.png" class="close" bindtap="closeTranscript" />
         </view>
         <radio-group catch:change="radioChange" class="group">
-            <label class="weui-cell" wx:for="{{items}}" wx:key="value"
-                style="border-bottom: 2rpx solid white;">
+            <label class="weui-cell" wx:for="{{items}}" wx:key="value">
                 <view class="pay-row">
                     <image src="/static/{{item.value}}.png" class="{{item.value}}" />
                     <view class="name">{{item.name}}支付</view>
                 </view>
                 <radio value="{{item.value}}" checked="{{item.checked}}" color='#FFAC00' />
             </label>
-            <!-- <label class="weui-cell" style="border-bottom: 2rpx solid white;">
-                <view class="pay-row">
-                    <image src="/static/wxpay.png" class="wximg" />
-                    <view class="name">微信支付</view>
-                </view>
-                <radio value="wxpay" checked="true" color='#FFAC00' />
-            </label>
-            <label class="weui-cell">
-                <view class="pay-row">
-                    <image src="/static/alipay.png" class="img" />
-                    <view class="name">支付宝支付</view>
-                </view>
-                <radio value="alipay" checked="true" color='#FFAC00' />
-            </label> -->
         </radio-group>
         <view class="paymentBox">
             <view class="payment">应付款:<view class="num">¥{{product.price/100}}</view>

+ 3 - 0
components/donutBuy/index.wxss

@@ -61,6 +61,9 @@
   margin-left: 34rpx;
   font-size: 36rpx;
 }
+.gradeContainer .popBox .group .weui-cell:first-child {
+  border-bottom: 2rpx solid white;
+}
 .gradeContainer .popBox .paymentBox {
   position: absolute;
   left: 0;

+ 5 - 2
pages/commodity/index.js

@@ -39,7 +39,6 @@ Page({
         } = await getProducts()
         this.setData({
             products,
-            active: products[0].id,
             product: products[0]
         })
     },
@@ -47,7 +46,6 @@ Page({
         currentTarget
     }) {
         this.setData({
-            active: currentTarget.dataset.product.id,
             product: currentTarget.dataset.product
         })
     },
@@ -137,6 +135,11 @@ Page({
         })
         // #endif
     },
+    openDonutBuy() {
+        let product = this.data.product
+        console.log(product);
+        this.selectComponent('#donutBuy').open(product)
+    },
     // 设置用户信息及vip状态
     async setUserInfo() {
         let userInfo = await getMyInfo()

+ 3 - 1
pages/commodity/index.json

@@ -1,3 +1,5 @@
 {
-    "usingComponents": {}
+    "usingComponents": {
+        "donutBuy":"/components/donutBuy/index"
+    }
 }

+ 6 - 4
pages/commodity/index.wxml

@@ -1,18 +1,19 @@
 <view id="container">
     <view class="commoditys" wx:if="{{products.length>0}}">
-        <view wx:for="{{products}}" wx:key="id" class="['commodity,{{item.payType=='LIFELONG'?'c-1':item.payType=='YEAR'?'c-2':'c-3'}} {{active==item.id?'aborder':''}}]"
+        <view wx:for="{{products}}" wx:key="id"
+            class="['commodity,{{item.payType=='LIFELONG'?'c-1':item.payType=='YEAR'?'c-2':'c-3'}} {{product.id==item.id?'aborder':''}}]"
             bindtap="selected" data-product="{{item}}">
             <image src="http://reader-wx.ai160.com/images/reader/v3/active.png" class="active"
-                wx:if="{{active==item.id}}" />
+                wx:if="{{product.id==item.id}}" />
         </view>
     </view>
-    <view class="payBox" wx:if="{{active!=''}}">
+    <view class="payBox" wx:if="{{product.id!=''}}">
         <view class="left">
             {{product.title}}
             <span class="price">{{product.price/100}}</span>
         </view>
-        <view class="pay" bindtap="toBuy">立即支付</view>
+        <view class="pay" bindtap="openDonutBuy">立即支付</view>
     </view>
     <view class="mask" wx:if="{{mask}}">
         <view class="payTips">
@@ -21,4 +22,5 @@
             <view class="goXkx" bindtap="closeMask">确认</view>
         </view>
     </view>
+    <donutBuy id="donutBuy"></donutBuy>
 </view>

+ 1 - 1
pages/my/index.wxml

@@ -102,7 +102,7 @@
             <image src="/static/lollipop.png" class="close" catchtap="closeModal" />
         </view>
     </view>
-    <donutBuy id="donutBuy"></donutBuy>
+    <donutBuy id="donutBuy" bind:reload='setUserInfo'></donutBuy>
     <vipModal id="vipModal"></vipModal>
     <gzhModal id="gzh"></gzhModal>
     <canvas id='vip' type="2d"> </canvas>