deguodaigou/components/order/commodity/index.js
2019-12-26 09:13:34 +08:00

68 lines
2.1 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)
this.triggerEvent('shua', { bubbles: true,composed: true })
})
})
},
cancel() {
bin.getuserid().then((id) => {
bin.request({
url: "User/cancelOrder",
urldata: {
user_id: id,
order_id: this.data.gid
}
}).then((res) => {
console.log(res)
this.triggerEvent('shua', { bubbles: true,composed: true })
})
})
},
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,
complete(){
this.triggerEvent('shua', { bubbles: true,composed: true })
}
})
})
})
}
}
})