Ver código fonte

代码更新

andypliang 6 anos atrás
pai
commit
478d061259

+ 1
- 1
miniapp/app/app.wxss Ver arquivo

153
 .total {
153
 .total {
154
     height: 100rpx;
154
     height: 100rpx;
155
     margin-top: 20rpx;
155
     margin-top: 20rpx;
156
-    line-height: 100rpx;
156
+    line-height: 97rpx;
157
     background-color: #fff;
157
     background-color: #fff;
158
     display: flex;
158
     display: flex;
159
 }
159
 }

+ 21
- 1
miniapp/app/pages/goodsDetail/index.js Ver arquivo

35
             });
35
             });
36
         }
36
         }
37
         $.wx.showToast({
37
         $.wx.showToast({
38
-            title: '微信支付尚未接入'
38
+            title: '购买中'
39
+        }, 'loading');
40
+        $.request('product_order/store', 'POST', {
41
+            amount,
42
+            address,
43
+            contact: name,
44
+            phone,
45
+            product_id: 1
46
+        }).then((res) => {
47
+            if (res.data) {
48
+                this.callWXPay(res.data.id, res.data.order_type || 'product_order');
49
+            }
50
+        });
51
+    },
52
+    callWXPay(order_id, order_type) {
53
+        $.request('payments/pay', 'POST', {
54
+            order_id,
55
+            order_type
56
+        }).then((res) => {
57
+            $.wx.hideToast('loading');
58
+
39
         });
59
         });
40
     }
60
     }
41
 });
61
 });

+ 15
- 3
miniapp/app/pages/order/index.js Ver arquivo

20
                 res.data.forEach(e => {
20
                 res.data.forEach(e => {
21
                     e.orderText = orderTexts[e.status];
21
                     e.orderText = orderTexts[e.status];
22
                     if (e.order_type == 'product_order') {
22
                     if (e.order_type == 'product_order') {
23
+                        if (e.status == 0) 
24
+                            e.orderText = '待付款';
23
                         goods.push(e);
25
                         goods.push(e);
24
                     } else {
26
                     } else {
25
                         services.push(e);
27
                         services.push(e);
34
     },
36
     },
35
     toPay(e) {
37
     toPay(e) {
36
         const {
38
         const {
37
-            id
39
+            id,
40
+            type
38
         } = e.target.dataset;
41
         } = e.target.dataset;
39
-        if (id) {
40
-
42
+        if (id && type) {
43
+            $.wx.showToast({
44
+                title: '支付中'
45
+            }, 'loading');
46
+            $.request('payments/pay', 'POST', {
47
+                order_id: id,
48
+                order_type: type
49
+            }).then((res) => {
50
+                $.wx.hideToast('loading');
51
+    
52
+            });
41
         }
53
         }
42
     },
54
     },
43
     addComment(e) {
55
     addComment(e) {

+ 2
- 1
miniapp/app/pages/order/index.wxml Ver arquivo

15
                     <view class="right">
15
                     <view class="right">
16
                         <view class="text-top">{{item.orderText}}</view>
16
                         <view class="text-top">{{item.orderText}}</view>
17
                         <view class="text-bottom" wx:if="{{item.status != 0}}">¥{{item.price}}</view>
17
                         <view class="text-bottom" wx:if="{{item.status != 0}}">¥{{item.price}}</view>
18
-                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" wx:if="{{item.status == 1}}">立即付款</view>
18
+                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" data-type="{{item.order_type}}" wx:if="{{item.status == 1}}">立即付款</view>
19
                         <view class="btn-blue" bindtap="addComment" data-id="{{item.id}}" wx:if="{{item.status == 2 && !item.comment}}">添加评价</view>
19
                         <view class="btn-blue" bindtap="addComment" data-id="{{item.id}}" wx:if="{{item.status == 2 && !item.comment}}">添加评价</view>
20
                     </view>
20
                     </view>
21
                 </view>
21
                 </view>
49
                     <view class="right">
49
                     <view class="right">
50
                         <view class="text-top">{{item.orderText}}</view>
50
                         <view class="text-top">{{item.orderText}}</view>
51
                         <view class="text-bottom">¥{{item.price}}</view>
51
                         <view class="text-bottom">¥{{item.price}}</view>
52
+                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" data-type="{{item.order_type}}" wx:if="{{item.status == 0}}">立即付款</view>
52
                     </view>
53
                     </view>
53
                 </view>
54
                 </view>
54
             </view>
55
             </view>

Carregando…
Cancelar
Salvar