sharp-agezi 6 年之前
父節點
當前提交
99b09db3b1
共有 2 個文件被更改,包括 27 次插入2 次删除
  1. 26 1
      customized/pages/accounts/accounts.js
  2. 1 1
      customized/pages/order/order.wxml

+ 26 - 1
customized/pages/accounts/accounts.js

@@ -90,6 +90,9 @@ Page({
 
   },
   submitOrder(){
+    wx.showLoading({
+      title:'结算中...'
+    })
     let that = this, goodsList = that.data.goodsList, address = that.data.address;
     //生成订单
     goodsList.forEach(res=>{
@@ -100,6 +103,7 @@ Page({
       res['province'] = address.province;
       res['consignee'] = address.consignee;
       res['phone'] = address.phone;
+      res['openId'] = app.globalData.openid;
       delete res.imgArray
     });
     wx.request({
@@ -108,8 +112,29 @@ Page({
       data: {
         shopCarList:JSON.stringify(goodsList)
       },
-      success(res){
+      success(el){
+        let res = el.data;
         console.log(res)
+        wx.requestPayment({
+          timeStamp: res.timeStamp,
+          nonceStr: res.nonceStr,
+          package: res.pkg,
+          signType: res.signType,
+          paySign: res.sign,
+          success(res){
+            console.log(res,"结算结果")
+          },
+          fail(err){
+            wx.showToast({
+              title: err.errMsg,
+              icon:'error'
+            })
+            console.log(err)
+          },
+          complete(){
+            wx.hideLoading()
+          }
+        })
       }
     })
   },

+ 1 - 1
customized/pages/order/order.wxml

@@ -14,7 +14,7 @@
     <!-- 操作按钮 -->
     <view class='f-box f-justify-content-end pad-t20 pad-b20 f-s30'>
       <view class='order-btn bg-orange' wx:if="{{item.orderStatus === '0'}}">立即付款</view>
-      <view class='order-btn bg-orange' wx:if="{{item.orderStatus === '3'}}">查看物流</view>
+      <!-- <view class='order-btn bg-orange' wx:if="{{item.orderStatus === '3'}}">查看物流</view> -->
       <view class='order-btn bg-green' wx:if="{{item.orderStatus === '3'}}">确认收货</view>
     </view>
   </view>