This commit is contained in:
parent
0237af3c38
commit
3aaacf98f0
|
@ -607,24 +607,25 @@
|
||||||
|
|
||||||
payJZ() {
|
payJZ() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (that.openWay == 1) { //零钱支付
|
uni.showModal({
|
||||||
uni.showModal({
|
title: '付款提示',
|
||||||
title: '付款提示',
|
content: '确认支付' + that.tpayMoney + '元吗?',
|
||||||
content: '确认支付' + that.tpayMoney + '元吗?',
|
success: function(re) {
|
||||||
success: function(re) {
|
if (re.confirm) {
|
||||||
if (re.confirm) {
|
that.$queue.showLoading('支付中...')
|
||||||
that.$queue.showLoading('支付中...')
|
// console.log('用户点击确定');
|
||||||
// console.log('用户点击确定');
|
if (that.openWay == 1) { //零钱支付
|
||||||
that.$Request.post("/app/artificer/payOrders", {
|
that.$Request.post("/app/artificer/payOrders", {
|
||||||
ordersId: that.ordersId,
|
ordersId: that.ordersId,
|
||||||
}).then(ret => {
|
}).then(ret => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (ret.code == 0) {
|
if (ret.code == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功',
|
title: '支付成功'
|
||||||
icon: 'none'
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
})
|
})
|
||||||
// that.getOrder()
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -633,137 +634,163 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (re.cancel) {
|
} else if (that.openWay == 2) { //微信支付
|
||||||
// that.getOrder()
|
// #ifdef MP-WEIXIN
|
||||||
}
|
let data = {
|
||||||
}
|
ordersId: that.tordersId,
|
||||||
})
|
type: 3
|
||||||
} else if (that.openWay == 2) { //微信支付
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
let data = {
|
|
||||||
ordersId: that.tordersId,
|
|
||||||
type: 3
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(ret => {
|
|
||||||
console.log(ret)
|
|
||||||
if (ret.code == 0) {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.requestPayment({
|
|
||||||
provider: 'wxpay',
|
|
||||||
timeStamp: ret.data.timestamp,
|
|
||||||
nonceStr: ret.data.noncestr,
|
|
||||||
package: ret.data.package,
|
|
||||||
signType: ret.data.signType,
|
|
||||||
paySign: ret.data.sign,
|
|
||||||
success: function(ret) {
|
|
||||||
console.log(ret)
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
// that.getOrder()
|
|
||||||
// this.$queue.showToast('支付成功');
|
|
||||||
|
|
||||||
// uni.switchTab({
|
|
||||||
// url: '/pages/my/index'
|
|
||||||
// })
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
// this.$queue.showToast('支付失败');
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付失败',
|
|
||||||
icon: 'nones'
|
|
||||||
});
|
|
||||||
// that.getOrder()
|
|
||||||
}
|
}
|
||||||
});
|
that.$Request.post('/app/wxPay/payOrder', data).then(ret => {
|
||||||
}
|
console.log(ret)
|
||||||
});
|
if (ret.code == 0) {
|
||||||
// #endif
|
uni.hideLoading();
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
timeStamp: ret.data.timestamp,
|
||||||
|
nonceStr: ret.data.noncestr,
|
||||||
|
package: ret.data.package,
|
||||||
|
signType: ret.data.signType,
|
||||||
|
paySign: ret.data.sign,
|
||||||
|
success: function(ret) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
// that.getOrder()
|
||||||
|
// this.$queue.showToast('支付成功');
|
||||||
|
|
||||||
// #ifdef H5
|
// uni.switchTab({
|
||||||
let ua = navigator.userAgent.toLowerCase();
|
// url: '/pages/my/index'
|
||||||
if (ua.indexOf('micromessenger') != -1) {
|
// })
|
||||||
let data = {
|
},
|
||||||
ordersId: that.tordersId,
|
fail: function(err) {
|
||||||
type: 2
|
// this.$queue.showToast('支付失败');
|
||||||
}
|
uni.showToast({
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
title: '支付失败',
|
||||||
that.showpay = false
|
icon: 'nones'
|
||||||
if (rea.code == 0) {
|
});
|
||||||
that.callPay(rea.data);
|
// that.getOrder()
|
||||||
} else {
|
}
|
||||||
uni.showToast({
|
});
|
||||||
title: rea.msg,
|
}
|
||||||
icon: 'none'
|
});
|
||||||
})
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
let ua = navigator.userAgent.toLowerCase();
|
||||||
|
if (ua.indexOf('micromessenger') != -1) {
|
||||||
|
let data = {
|
||||||
|
ordersId: that.tordersId,
|
||||||
|
type: 2
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.callPay(rea.data);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: rea.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let data = {
|
||||||
|
ordersId: that.tordersId,
|
||||||
|
type: 4
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
const urlArr = window.location.href;
|
||||||
|
const hostUrl = urlArr.split("/");
|
||||||
|
const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
||||||
|
const url = '&redirect_url=' + callBack + 'my/order/pay';
|
||||||
|
window.location = rea.data.mweb_url + url
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: rea.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
console.log(rea)
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
} else if (that.openWay == 3) { //支付宝支付
|
||||||
|
// #ifdef H5
|
||||||
|
let data = {
|
||||||
|
ordersId: that.tordersId,
|
||||||
|
type: 2
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/aliPay/payOrder', data).then(
|
||||||
|
rea => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.showpay = false
|
||||||
|
const div = document.createElement('div')
|
||||||
|
div.innerHTML = rea.data //此处form就是后台返回接收到的数据
|
||||||
|
document.body.appendChild(div)
|
||||||
|
document.forms[0].submit()
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
let data = {
|
||||||
|
ordersId: that.tordersId,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/aliPay/payOrder', data).then(
|
||||||
|
rea => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.showpay = false
|
||||||
|
that.setPayment('alipay', rea.data);
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} else {
|
} else if (re.cancel) {
|
||||||
let data = {
|
// that.getOrder()
|
||||||
ordersId: that.tordersId,
|
|
||||||
type: 4
|
|
||||||
}
|
}
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
|
||||||
that.showpay = false
|
|
||||||
if (rea.code == 0) {
|
|
||||||
const urlArr = window.location.href;
|
|
||||||
const hostUrl = urlArr.split("/");
|
|
||||||
const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
|
||||||
const url = '&redirect_url=' + callBack + 'my/order/pay';
|
|
||||||
window.location = rea.data.mweb_url + url
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: rea.msg,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef APP
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 1
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
|
||||||
console.log(rea)
|
|
||||||
that.showpay = false
|
|
||||||
if (rea.code == 0) {
|
|
||||||
that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
} else if (that.openWay == 3) { //支付宝支付
|
|
||||||
// #ifdef H5
|
|
||||||
let data = {
|
|
||||||
ordersId: that.tordersId,
|
|
||||||
type: 2
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/aliPay/payOrder', data).then(
|
|
||||||
rea => {
|
|
||||||
that.showpay = false
|
|
||||||
const div = document.createElement('div')
|
|
||||||
div.innerHTML = rea.data //此处form就是后台返回接收到的数据
|
|
||||||
document.body.appendChild(div)
|
|
||||||
document.forms[0].submit()
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
let data = {
|
|
||||||
ordersId: that.tordersId,
|
|
||||||
type: 1
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/aliPay/payOrder', data).then(
|
|
||||||
rea => {
|
|
||||||
that.showpay = false
|
|
||||||
that.setPayment('alipay', rea.data);
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
saveJZ(classifyId) {
|
saveJZ(classifyId) {
|
||||||
|
@ -928,14 +955,14 @@
|
||||||
this.payJZ();
|
this.payJZ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (that.openWay == 1) { //零钱支付
|
uni.showModal({
|
||||||
uni.showModal({
|
title: '付款提示',
|
||||||
title: '付款提示',
|
content: '确认支付' + that.tpayMoney + '元吗?',
|
||||||
content: '确认支付' + that.tpayMoney + '元吗?',
|
success: function(re) {
|
||||||
success: function(re) {
|
if (re.confirm) {
|
||||||
if (re.confirm) {
|
that.$queue.showLoading('支付中...')
|
||||||
that.$queue.showLoading('支付中...')
|
console.log('用户点击确定');
|
||||||
console.log('用户点击确定');
|
if (that.openWay == 1) { //零钱支付
|
||||||
that.$Request.post("/app/artificer/payOrders", {
|
that.$Request.post("/app/artificer/payOrders", {
|
||||||
ordersId: that.ordersId,
|
ordersId: that.ordersId,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
@ -944,7 +971,10 @@
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功'
|
title: '支付成功'
|
||||||
})
|
})
|
||||||
// that.getOrder()
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.getOrder()
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
|
@ -952,145 +982,171 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (re.cancel) {
|
} else if (that.openWay == 2) { //微信支付
|
||||||
uni.hideLoading();
|
that.$queue.showLoading('支付中...')
|
||||||
console.log('用户点击取消');
|
// #ifdef MP-WEIXIN
|
||||||
}
|
let data = {
|
||||||
}
|
ordersId: that.order.ordersId,
|
||||||
|
type: 3
|
||||||
})
|
|
||||||
} else if (that.openWay == 2) { //微信支付
|
|
||||||
that.$queue.showLoading('支付中...')
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 3
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(ret => {
|
|
||||||
console.log(ret)
|
|
||||||
if (ret.code == 0) {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.requestPayment({
|
|
||||||
provider: 'wxpay',
|
|
||||||
timeStamp: ret.data.timestamp,
|
|
||||||
nonceStr: ret.data.noncestr,
|
|
||||||
package: ret.data.package,
|
|
||||||
signType: ret.data.signType,
|
|
||||||
paySign: ret.data.sign,
|
|
||||||
success: function(ret) {
|
|
||||||
console.log(ret)
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
// that.getOrder()
|
|
||||||
// this.$queue.showToast('支付成功');
|
|
||||||
|
|
||||||
// uni.switchTab({
|
|
||||||
// url: '/pages/my/index'
|
|
||||||
// })
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
// this.$queue.showToast('支付失败');
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付失败',
|
|
||||||
icon: 'nones'
|
|
||||||
});
|
|
||||||
// that.getOrder()
|
|
||||||
}
|
}
|
||||||
});
|
that.$Request.post('/app/wxPay/payOrder', data).then(ret => {
|
||||||
}
|
console.log(ret)
|
||||||
});
|
if (ret.code == 0) {
|
||||||
// #endif
|
uni.hideLoading();
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
timeStamp: ret.data.timestamp,
|
||||||
|
nonceStr: ret.data.noncestr,
|
||||||
|
package: ret.data.package,
|
||||||
|
signType: ret.data.signType,
|
||||||
|
paySign: ret.data.sign,
|
||||||
|
success: function(ret) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.getOrder()
|
||||||
|
// that.getOrder()
|
||||||
|
// this.$queue.showToast('支付成功');
|
||||||
|
|
||||||
// #ifdef H5
|
|
||||||
let ua = navigator.userAgent.toLowerCase();
|
},
|
||||||
if (ua.indexOf('micromessenger') != -1) {
|
fail: function(err) {
|
||||||
let data = {
|
// this.$queue.showToast('支付失败');
|
||||||
ordersId: that.order.ordersId,
|
uni.showToast({
|
||||||
type: 2
|
title: '支付失败',
|
||||||
}
|
icon: 'nones'
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
});
|
||||||
that.showpay = false
|
// that.getOrder()
|
||||||
if (rea.code == 0) {
|
}
|
||||||
that.callPay(rea.data);
|
});
|
||||||
} else {
|
}
|
||||||
uni.showToast({
|
});
|
||||||
title: rea.msg,
|
// #endif
|
||||||
icon: 'none'
|
|
||||||
})
|
// #ifdef H5
|
||||||
|
let ua = navigator.userAgent.toLowerCase();
|
||||||
|
if (ua.indexOf('micromessenger') != -1) {
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 2
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.callPay(rea.data);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: rea.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 4
|
||||||
|
}
|
||||||
|
// debugger;
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
// const urlArr = window.location.href;
|
||||||
|
// const hostUrl = urlArr.split("/");
|
||||||
|
// const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
||||||
|
// const url = '&redirect_url=' + callBack + 'my/order/pay';
|
||||||
|
// window.location = rea.mweb_url + url
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
const urlArr = window.location.href;
|
||||||
|
const hostUrl = urlArr.split("/");
|
||||||
|
const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
||||||
|
const url = '&redirect_url=' + callBack + 'my/order/pay';
|
||||||
|
window.location = rea.data.mweb_url + url
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: rea.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
console.log(rea)
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
} else if (that.openWay == 3) { //支付宝支付
|
||||||
|
that.$queue.showLoading('支付中...')
|
||||||
|
// #ifdef H5
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 2
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/aliPay/payOrder', data).then(
|
||||||
|
rea => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
const div = document.createElement('div')
|
||||||
|
div.innerHTML = rea.data //此处form就是后台返回接收到的数据
|
||||||
|
document.body.appendChild(div)
|
||||||
|
document.forms[0].submit()
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/aliPay/payOrder', data).then(
|
||||||
|
rea => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.setPayment('alipay', rea.data);
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} else {
|
} else if (re.cancel) {
|
||||||
let data = {
|
uni.hideLoading();
|
||||||
ordersId: that.order.ordersId,
|
console.log('用户点击取消');
|
||||||
type: 4
|
|
||||||
}
|
}
|
||||||
// debugger;
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
|
||||||
// const urlArr = window.location.href;
|
|
||||||
// const hostUrl = urlArr.split("/");
|
|
||||||
// const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
|
||||||
// const url = '&redirect_url=' + callBack + 'my/order/pay';
|
|
||||||
// window.location = rea.mweb_url + url
|
|
||||||
that.showpay = false
|
|
||||||
if (rea.code == 0) {
|
|
||||||
const urlArr = window.location.href;
|
|
||||||
const hostUrl = urlArr.split("/");
|
|
||||||
const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
|
||||||
const url = '&redirect_url=' + callBack + 'my/order/pay';
|
|
||||||
window.location = rea.data.mweb_url + url
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: rea.msg,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #endif
|
})
|
||||||
|
|
||||||
// #ifdef APP
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 1
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
|
||||||
console.log(rea)
|
|
||||||
that.showpay = false
|
|
||||||
if (rea.code == 0) {
|
|
||||||
that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
} else if (that.openWay == 3) { //支付宝支付
|
|
||||||
that.$queue.showLoading('支付中...')
|
|
||||||
// #ifdef H5
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 2
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/aliPay/payOrder', data).then(
|
|
||||||
rea => {
|
|
||||||
const div = document.createElement('div')
|
|
||||||
div.innerHTML = rea.data //此处form就是后台返回接收到的数据
|
|
||||||
document.body.appendChild(div)
|
|
||||||
document.forms[0].submit()
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 1
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/aliPay/payOrder', data).then(
|
|
||||||
rea => {
|
|
||||||
that.setPayment('alipay', rea.data);
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callPay: function(response) {
|
callPay: function(response) {
|
||||||
if (typeof WeixinJSBridge === "undefined") {
|
if (typeof WeixinJSBridge === "undefined") {
|
||||||
|
|
|
@ -957,18 +957,18 @@
|
||||||
pay() {
|
pay() {
|
||||||
let that = this
|
let that = this
|
||||||
this.showpay = false
|
this.showpay = false
|
||||||
if (this.paySel != 0) {
|
// if (this.paySel != 0) {
|
||||||
this.payJZ();
|
// this.payJZ();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (that.openWay == 1) { //零钱支付
|
uni.showModal({
|
||||||
uni.showModal({
|
title: '付款提示',
|
||||||
title: '付款提示',
|
content: '确认支付' + that.tpayMoney + '元吗?',
|
||||||
content: '确认支付' + that.tpayMoney + '元吗?',
|
success: function(re) {
|
||||||
success: function(re) {
|
if (re.confirm) {
|
||||||
if (re.confirm) {
|
that.$queue.showLoading('支付中...')
|
||||||
that.$queue.showLoading('支付中...')
|
console.log('用户点击确定');
|
||||||
console.log('用户点击确定');
|
if (that.openWay == 1) { //零钱支付
|
||||||
that.$Request.post("/app/artificer/payOrders", {
|
that.$Request.post("/app/artificer/payOrders", {
|
||||||
ordersId: that.ordersId,
|
ordersId: that.ordersId,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
@ -977,6 +977,9 @@
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功'
|
title: '支付成功'
|
||||||
})
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
// that.getOrder()
|
// that.getOrder()
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -985,145 +988,178 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (re.cancel) {
|
} else if (that.openWay == 2) { //微信支付
|
||||||
uni.hideLoading();
|
that.$queue.showLoading('支付中...')
|
||||||
console.log('用户点击取消');
|
// #ifdef MP-WEIXIN
|
||||||
}
|
let data = {
|
||||||
}
|
ordersId: that.order.ordersId,
|
||||||
|
type: 3
|
||||||
})
|
|
||||||
} else if (that.openWay == 2) { //微信支付
|
|
||||||
that.$queue.showLoading('支付中...')
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 3
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(ret => {
|
|
||||||
console.log(ret)
|
|
||||||
if (ret.code == 0) {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.requestPayment({
|
|
||||||
provider: 'wxpay',
|
|
||||||
timeStamp: ret.data.timestamp,
|
|
||||||
nonceStr: ret.data.noncestr,
|
|
||||||
package: ret.data.package,
|
|
||||||
signType: ret.data.signType,
|
|
||||||
paySign: ret.data.sign,
|
|
||||||
success: function(ret) {
|
|
||||||
console.log(ret)
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
// that.getOrder()
|
|
||||||
// this.$queue.showToast('支付成功');
|
|
||||||
|
|
||||||
// uni.switchTab({
|
|
||||||
// url: '/pages/my/index'
|
|
||||||
// })
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
// this.$queue.showToast('支付失败');
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付失败',
|
|
||||||
icon: 'nones'
|
|
||||||
});
|
|
||||||
// that.getOrder()
|
|
||||||
}
|
}
|
||||||
});
|
that.$Request.post('/app/wxPay/payOrder', data).then(ret => {
|
||||||
}
|
console.log(ret)
|
||||||
});
|
if (ret.code == 0) {
|
||||||
// #endif
|
uni.hideLoading();
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
timeStamp: ret.data.timestamp,
|
||||||
|
nonceStr: ret.data.noncestr,
|
||||||
|
package: ret.data.package,
|
||||||
|
signType: ret.data.signType,
|
||||||
|
paySign: ret.data.sign,
|
||||||
|
success: function(ret) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
// that.getOrder()
|
||||||
|
// this.$queue.showToast('支付成功');
|
||||||
|
|
||||||
// #ifdef H5
|
// uni.switchTab({
|
||||||
let ua = navigator.userAgent.toLowerCase();
|
// url: '/pages/my/index'
|
||||||
if (ua.indexOf('micromessenger') != -1) {
|
// })
|
||||||
let data = {
|
},
|
||||||
ordersId: that.order.ordersId,
|
fail: function(err) {
|
||||||
type: 2
|
// this.$queue.showToast('支付失败');
|
||||||
}
|
uni.showToast({
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
title: '支付失败',
|
||||||
that.showpay = false
|
icon: 'nones'
|
||||||
if (rea.code == 0) {
|
});
|
||||||
that.callPay(rea.data);
|
// that.getOrder()
|
||||||
} else {
|
}
|
||||||
uni.showToast({
|
});
|
||||||
title: rea.msg,
|
}
|
||||||
icon: 'none'
|
});
|
||||||
})
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
let ua = navigator.userAgent.toLowerCase();
|
||||||
|
if (ua.indexOf('micromessenger') != -1) {
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 2
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.callPay(rea.data);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: rea.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 4
|
||||||
|
}
|
||||||
|
// debugger;
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
// const urlArr = window.location.href;
|
||||||
|
// const hostUrl = urlArr.split("/");
|
||||||
|
// const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
||||||
|
// const url = '&redirect_url=' + callBack + 'my/order/pay';
|
||||||
|
// window.location = rea.mweb_url + url
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
const urlArr = window.location.href;
|
||||||
|
const hostUrl = urlArr.split("/");
|
||||||
|
const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
||||||
|
const url = '&redirect_url=' + callBack + 'my/order/pay';
|
||||||
|
window.location = rea.data.mweb_url + url
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: rea.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
||||||
|
console.log(rea)
|
||||||
|
that.showpay = false
|
||||||
|
if (rea.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
} else if (that.openWay == 3) { //支付宝支付
|
||||||
|
that.$queue.showLoading('支付中...')
|
||||||
|
// #ifdef H5
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 2
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/aliPay/payOrder', data).then(
|
||||||
|
rea => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
const div = document.createElement('div')
|
||||||
|
div.innerHTML = rea.data //此处form就是后台返回接收到的数据
|
||||||
|
document.body.appendChild(div)
|
||||||
|
document.forms[0].submit()
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
let data = {
|
||||||
|
ordersId: that.order.ordersId,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
that.$Request.post('/app/aliPay/payOrder', data).then(
|
||||||
|
rea => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/my/index'
|
||||||
|
})
|
||||||
|
that.setPayment('alipay', rea.data);
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} else {
|
} else if (re.cancel) {
|
||||||
let data = {
|
uni.hideLoading();
|
||||||
ordersId: that.order.ordersId,
|
console.log('用户点击取消');
|
||||||
type: 4
|
|
||||||
}
|
}
|
||||||
// debugger;
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
|
||||||
// const urlArr = window.location.href;
|
|
||||||
// const hostUrl = urlArr.split("/");
|
|
||||||
// const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
|
||||||
// const url = '&redirect_url=' + callBack + 'my/order/pay';
|
|
||||||
// window.location = rea.mweb_url + url
|
|
||||||
that.showpay = false
|
|
||||||
if (rea.code == 0) {
|
|
||||||
const urlArr = window.location.href;
|
|
||||||
const hostUrl = urlArr.split("/");
|
|
||||||
const callBack = hostUrl[0] + "//" + hostUrl[2] + "/";
|
|
||||||
const url = '&redirect_url=' + callBack + 'my/order/pay';
|
|
||||||
window.location = rea.data.mweb_url + url
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: rea.msg,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #endif
|
})
|
||||||
|
|
||||||
// #ifdef APP
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 1
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/wxPay/payOrder', data).then(rea => {
|
|
||||||
console.log(rea)
|
|
||||||
that.showpay = false
|
|
||||||
if (rea.code == 0) {
|
|
||||||
that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
} else if (that.openWay == 3) { //支付宝支付
|
|
||||||
that.$queue.showLoading('支付中...')
|
|
||||||
// #ifdef H5
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 2
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/aliPay/payOrder', data).then(
|
|
||||||
rea => {
|
|
||||||
const div = document.createElement('div')
|
|
||||||
div.innerHTML = rea.data //此处form就是后台返回接收到的数据
|
|
||||||
document.body.appendChild(div)
|
|
||||||
document.forms[0].submit()
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
let data = {
|
|
||||||
ordersId: that.order.ordersId,
|
|
||||||
type: 1
|
|
||||||
}
|
|
||||||
that.$Request.post('/app/aliPay/payOrder', data).then(
|
|
||||||
rea => {
|
|
||||||
that.setPayment('alipay', rea.data);
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callPay: function(response) {
|
callPay: function(response) {
|
||||||
if (typeof WeixinJSBridge === "undefined") {
|
if (typeof WeixinJSBridge === "undefined") {
|
||||||
|
|
Loading…
Reference in New Issue