Bladeren bron

Merge remote-tracking branch 'origin/master'

chenxiqiang 6 jaren geleden
bovenliggende
commit
3564b467e8

+ 1
- 1
miniapp/app/app.wxss Bestand weergeven

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

+ 21
- 1
miniapp/app/pages/goodsDetail/index.js Bestand weergeven

@@ -35,7 +35,27 @@ new $.Page({
35 35
             });
36 36
         }
37 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 Bestand weergeven

@@ -20,6 +20,8 @@ new $.Page({
20 20
                 res.data.forEach(e => {
21 21
                     e.orderText = orderTexts[e.status];
22 22
                     if (e.order_type == 'product_order') {
23
+                        if (e.status == 0) 
24
+                            e.orderText = '待付款';
23 25
                         goods.push(e);
24 26
                     } else {
25 27
                         services.push(e);
@@ -34,10 +36,20 @@ new $.Page({
34 36
     },
35 37
     toPay(e) {
36 38
         const {
37
-            id
39
+            id,
40
+            type
38 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 55
     addComment(e) {

+ 2
- 1
miniapp/app/pages/order/index.wxml Bestand weergeven

@@ -15,7 +15,7 @@
15 15
                     <view class="right">
16 16
                         <view class="text-top">{{item.orderText}}</view>
17 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 19
                         <view class="btn-blue" bindtap="addComment" data-id="{{item.id}}" wx:if="{{item.status == 2 && !item.comment}}">添加评价</view>
20 20
                     </view>
21 21
                 </view>
@@ -49,6 +49,7 @@
49 49
                     <view class="right">
50 50
                         <view class="text-top">{{item.orderText}}</view>
51 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 53
                     </view>
53 54
                 </view>
54 55
             </view>

Loading…
Annuleren
Opslaan