deguodaigou/components/order/commodity/index.js
2019-12-24 14:08:26 +08:00

61 lines
1.8 KiB
JavaScript

import bin from "../../../utils/bin"
Component({
properties: {
num: String,
cprice: String,
freight: String,
goods: Array,
gid: String,
type:String
},
data: {},
methods: {
shouhuo(){
bin.getuserid().then((id)=>{
bin.request({
url:"User/orderConfirm",
urldata:{
user_id:id,
order_id:this.data.gid
}
}).then((res)=>{
console.log(res)
})
})
},
cancel() {
bin.getuserid().then((id) => {
bin.request({
url: "User/cancelOrder",
urldata: {
user_id: id,
order_id: this.data.gid
}
}).then((res) => {
console.log(res)
})
})
},
pay(){
bin.getuserid().then((id)=>{
bin.request({
url:"Cart/getWXPayData",
urldata:{
user_id:id,
order_id:this.data.gid
}
}).then((res)=>{
console.log(res)
wx.requestPayment({
timeStamp:res.data.result.wdata.timeStamp + "",
nonceStr:res.data.result.wdata.nonceStr,
package:res.data.result.wdata.package,
signType:"MD5",
paySign:res.data.result.wdata.sign
})
})
})
}
}
})