功能完成
This commit is contained in:
parent
7e90cc1757
commit
064be93e1b
2
app.js
2
app.js
|
@ -1,4 +1,4 @@
|
||||||
const baseUrl = "http://localhost:8082"
|
const baseUrl = "http://49.233.248.140:8082"
|
||||||
|
|
||||||
|
|
||||||
App({
|
App({
|
||||||
|
|
|
@ -73,7 +73,14 @@ Page({
|
||||||
toPay() {
|
toPay() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const orderData = this.data.orders;
|
const orderData = this.data.orders;
|
||||||
|
wx.request({
|
||||||
|
url: baseUrl + "/user/getById",
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
openId: wx.getStorageSync('openid'),
|
||||||
|
},
|
||||||
|
success(res) {
|
||||||
|
if (res.data.data.address != null && res.data.data.address != "" && res.data.data.phone != null && res.data.data.phone != "") {
|
||||||
// 假设用户ID暂时写死
|
// 假设用户ID暂时写死
|
||||||
orderData.openId = wx.getStorageSync('openid');
|
orderData.openId = wx.getStorageSync('openid');
|
||||||
orderData.status = 1;
|
orderData.status = 1;
|
||||||
|
@ -103,7 +110,7 @@ Page({
|
||||||
data: {
|
data: {
|
||||||
nonceStr: randomString, //随机字符串,String(32)
|
nonceStr: randomString, //随机字符串,String(32)
|
||||||
outTradeNo: outTradeNo, //商户订单号,String(32)
|
outTradeNo: outTradeNo, //商户订单号,String(32)
|
||||||
totalFee: self.data.total, //Int
|
totalFee: self.data.total * 100, //Int
|
||||||
},
|
},
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('下单结果: ', res);
|
console.log('下单结果: ', res);
|
||||||
|
@ -181,5 +188,14 @@ Page({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
wx.showToast({
|
||||||
|
title: "请填写收货信息",
|
||||||
|
icon: "error",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue