|
|
@@ -1141,60 +1141,35 @@ export default {
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
- let data = {
|
|
|
- userId: uni.getStorageSync('userId'),
|
|
|
- type: 4, //支付方式 1表示微信支付、4或5表示支付宝支付
|
|
|
- activityId: this.huodong ? this.huodong.activityId : '',
|
|
|
- reservationFlag: this.reservationFlag, //是否预约单 1是、0否
|
|
|
- expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
|
|
|
- parentId: this.dataList.parentId,
|
|
|
- couponId: this.coupon ? this.coupon.id : '',
|
|
|
- addressId: this.address.addressId ? this.address.addressId : '',
|
|
|
- orderType: this.orderType,
|
|
|
- type: 3
|
|
|
- }
|
|
|
- this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
|
|
|
+
|
|
|
+ this.$Request.get('/app/new-pay/enable-new-pay').then((res) => {
|
|
|
+ console.log(res, '666')
|
|
|
if (res.code == 0) {
|
|
|
- uni.requestPayment({
|
|
|
- provider: 'wxpay',
|
|
|
- timeStamp: res.data.timestamp,
|
|
|
- nonceStr: res.data.noncestr,
|
|
|
- package: res.data.package,
|
|
|
- signType: res.data.signType,
|
|
|
- paySign: res.data.sign,
|
|
|
- success: function (suc) {
|
|
|
- uni.hideLoading()
|
|
|
- that.$queue.showToast('支付成功')
|
|
|
- setTimeout(function () {
|
|
|
- that.isThrottle = true
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/order/index'
|
|
|
- })
|
|
|
- }, 1000)
|
|
|
- },
|
|
|
- fail: function (err) {
|
|
|
- console.log('fail:' + JSON.stringify(err))
|
|
|
- that.isThrottle = true
|
|
|
- uni.showToast({
|
|
|
- title: '支付失败',
|
|
|
- icon: 'none',
|
|
|
- mask: true
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/order/index'
|
|
|
- })
|
|
|
- }, 1500)
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- that.isThrottle = true
|
|
|
+ let data = {
|
|
|
+ userId: uni.getStorageSync('userId'),
|
|
|
+ // type: 4, //支付方式 1表示微信支付、4或5表示支付宝支付
|
|
|
+ activityId: this.huodong ? this.huodong.activityId : '',
|
|
|
+ reservationFlag: this.reservationFlag, //是否预约单 1是、0否
|
|
|
+ expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
|
|
|
+ parentId: this.dataList.parentId,
|
|
|
+ couponId: this.coupon ? this.coupon.id : '',
|
|
|
+ addressId: this.address.addressId ? this.address.addressId : '',
|
|
|
+ orderType: this.orderType,
|
|
|
+ type: res.enable ? 1 : 3
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(data)
|
|
|
+
|
|
|
+ if (res.enable) {
|
|
|
+ console.log('xin')
|
|
|
+ this.newPay(data)
|
|
|
+ } else {
|
|
|
+ console.log('jiu')
|
|
|
+ this.oldPay(data)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef APP
|
|
|
@@ -1249,6 +1224,99 @@ export default {
|
|
|
// #endif
|
|
|
}
|
|
|
},
|
|
|
+ newPay(data) {
|
|
|
+ this.$Request.get('/app/order/get-pay-param', data).then((res) => {
|
|
|
+ console.log(res, '新支付')
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: res.timeStamp,
|
|
|
+ nonceStr: res.nonceStr,
|
|
|
+ package: res.packageStr,
|
|
|
+ signType: res.signType,
|
|
|
+ paySign: res.paySign,
|
|
|
+ success: (suc) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ this.$queue.showToast('支付成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isThrottle = true
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('fail:' + JSON.stringify(err))
|
|
|
+ this.isThrottle = true
|
|
|
+ uni.setStorageSync('isClear', true)
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付失败',
|
|
|
+ icon: 'none',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+ }, 1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ this.isThrottle = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ oldPay(data) {
|
|
|
+ this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
|
|
|
+ console.log(res, '旧支付')
|
|
|
+ // uni.hideLoading();
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: res.data.timestamp,
|
|
|
+ nonceStr: res.data.noncestr,
|
|
|
+ package: res.data.package,
|
|
|
+ signType: res.data.signType,
|
|
|
+ paySign: res.data.sign,
|
|
|
+ success: (suc) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ this.$queue.showToast('支付成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isThrottle = true
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('fail:' + JSON.stringify(err))
|
|
|
+ this.isThrottle = true
|
|
|
+ uni.setStorageSync('isClear', true)
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付失败',
|
|
|
+ icon: 'none',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+ }, 1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ this.isThrottle = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
callPay: function (response) {
|
|
|
if (typeof WeixinJSBridge === 'undefined') {
|
|
|
if (document.addEventListener) {
|