deguodaigou/components/order/commodity/index.js

68 lines
2.1 KiB
JavaScript
Raw Normal View History

2019-12-23 17:24:26 +08:00
import bin from "../../../utils/bin"
2019-12-23 10:04:09 +08:00
Component({
2019-12-23 16:53:54 +08:00
properties: {
2019-12-23 17:24:26 +08:00
num: String,
cprice: String,
freight: String,
goods: Array,
2019-12-24 14:08:26 +08:00
gid: String,
type:String
2019-12-23 16:53:54 +08:00
},
2019-12-23 10:04:09 +08:00
data: {},
methods: {
2019-12-24 14:08:26 +08:00
shouhuo(){
bin.getuserid().then((id)=>{
bin.request({
url:"User/orderConfirm",
urldata:{
user_id:id,
order_id:this.data.gid
}
}).then((res)=>{
console.log(res)
2019-12-26 09:13:34 +08:00
this.triggerEvent('shua', { bubbles: true,composed: true })
2019-12-24 14:08:26 +08:00
})
2019-12-23 10:04:09 +08:00
})
2019-12-23 17:24:26 +08:00
},
cancel() {
bin.getuserid().then((id) => {
bin.request({
url: "User/cancelOrder",
urldata: {
user_id: id,
order_id: this.data.gid
}
}).then((res) => {
console.log(res)
2019-12-26 09:13:34 +08:00
this.triggerEvent('shua', { bubbles: true,composed: true })
2019-12-23 17:24:26 +08:00
})
})
},
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",
2019-12-26 09:13:34 +08:00
paySign:res.data.result.wdata.sign,
complete(){
this.triggerEvent('shua', { bubbles: true,composed: true })
}
2019-12-23 17:24:26 +08:00
})
})
})
2019-12-23 10:04:09 +08:00
}
}
2019-12-14 10:25:59 +08:00
})