支付相关调整
This commit is contained in:
@@ -53,15 +53,25 @@
|
||||
<view class="normal_box">
|
||||
<view class="normal_box_top" style="justify-content: space-between">
|
||||
<view class="curriulum_title">{{ v.productName }} </view>
|
||||
<view class="price_box">
|
||||
<!-- <view class="price_box">
|
||||
<text class="price" style="margin-right: 0">
|
||||
¥{{ v.activityPrice && v.activityPrice > 0 ? v.activityPrice : v.price}}
|
||||
</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view style="width: 100%; text-align: right">
|
||||
x 1
|
||||
<!-- <view class=""></view> -->
|
||||
<view style="width: 100% !important; text-align: right;" class=" ">
|
||||
<!-- <view class="flexbox" style="justify-content: space-between; align-items: center;"> -->
|
||||
<!-- -->
|
||||
<text style="color: #999; text-decoration: line-through; margin-right: 20rpx;"
|
||||
v-if="v.activityPrice > 0 && v.activityPrice < v.price" >原价:¥{{v.price}}</text>
|
||||
<text class="" style="margin-right: 26rpx">
|
||||
¥{{ v.activityPrice && v.activityPrice > 0 ? v.activityPrice : v.price}}
|
||||
</text>
|
||||
<text>x 1</text>
|
||||
<!-- </view> -->
|
||||
|
||||
|
||||
<!-- <u-number-box v-model="number" style="float: right">
|
||||
<view slot="minus" class="minus">
|
||||
<u-icon name="minus" size="12"></u-icon>
|
||||
@@ -412,6 +422,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
historyOrderInfo:undefined, //上一个订单的参数
|
||||
isDefaultCurrency: false,
|
||||
isShowAddress: false,
|
||||
jfNumber: 0,
|
||||
@@ -484,6 +495,7 @@
|
||||
"margin-left": "30rpx",
|
||||
},
|
||||
modalInfo: {},
|
||||
canjump:true, // 是否可以跳转到其他页面
|
||||
currentCateIndex: 0,
|
||||
show: false,
|
||||
playData: {},
|
||||
@@ -929,6 +941,7 @@
|
||||
}
|
||||
},
|
||||
async goBuyJie() {
|
||||
console.log('this.buyingFlag',this.buyingFlag);
|
||||
if (this.buyingFlag) {
|
||||
uni.showToast({
|
||||
title: '操作太频繁了,休息下吧',
|
||||
@@ -948,6 +961,7 @@
|
||||
setTimeout(() => {
|
||||
this.nowClick = true;
|
||||
}, 5000);
|
||||
|
||||
// let youPre = {
|
||||
// id: "",
|
||||
// coupons: {
|
||||
@@ -970,7 +984,8 @@
|
||||
this.$commonJS.showToast("请选择收货地址");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let data = {
|
||||
buyType: this.options.typeId, //0- 商品页直接下单 1- 购物车结算
|
||||
userId: this.userInfo.id, //下单人ID
|
||||
@@ -998,9 +1013,48 @@
|
||||
appName: "wumen",
|
||||
come: "2",
|
||||
};
|
||||
|
||||
console.log("data at line 477:", data);
|
||||
|
||||
var productList = [...data.productList]
|
||||
var thisproduct = productList.map(item => {
|
||||
return item.productId+"_"+item.quantity
|
||||
})
|
||||
thisproduct = thisproduct.join(',')
|
||||
console.log("data at line 477:", data);
|
||||
// console.log('成功信息',product,thisproduct,data.addressId, data.realMoney);
|
||||
if(this.historyOrderInfo &&
|
||||
thisproduct == this.historyOrderInfo.product &&
|
||||
data.addressId == this.historyOrderInfo.addressId &&
|
||||
this.historyOrderInfo.realMoney == data.realMoney){
|
||||
that.canjump = false
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
content:'您短时间内有一笔相同金额的订单,是否确定继续下单?',
|
||||
cancelText:'点错了',
|
||||
confirmText:'继续操作',
|
||||
success: function(res) {
|
||||
that.canjump = true
|
||||
if (res.confirm) {
|
||||
|
||||
that.buyingFlag = false
|
||||
console.log('用户点击确定',that.buyingFlag);
|
||||
that.submitorder(data)
|
||||
}
|
||||
else{
|
||||
that.buyingFlag = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
that.submitorder(data)
|
||||
}
|
||||
},
|
||||
|
||||
async submitorder(data){
|
||||
uni.showLoading({
|
||||
title:'正在请求订单'
|
||||
})
|
||||
// this.buyingFlag = false
|
||||
console.log('进来请求了吗?');
|
||||
let that = this
|
||||
await $http
|
||||
.request({
|
||||
// url: "book/buyOrder/buySave",
|
||||
@@ -1013,9 +1067,19 @@
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
this.buyingFlag = false
|
||||
that.buyingFlag = false
|
||||
var product = data.productList.map(item => {
|
||||
return item.productId+"_"+item.quantity
|
||||
})
|
||||
product = product.join(',')
|
||||
that.historyOrderInfo = {
|
||||
'product':product,
|
||||
'addressId':data.addressId,
|
||||
'realMoney':data.realMoney
|
||||
}
|
||||
|
||||
console.log("res at line 598系统下单返回结果:", res);
|
||||
if (res.code == 0) {
|
||||
if (res.code == 0) {
|
||||
if (res.orderSn == null) {
|
||||
uni.showToast({
|
||||
title: "失败,请重新下单",
|
||||
@@ -1024,12 +1088,12 @@
|
||||
});
|
||||
} else {
|
||||
console.log("that.payType at line 607:", that.payType);
|
||||
uni.showToast({
|
||||
title: "下单成功,即将进行支付",
|
||||
icon:'none'
|
||||
})
|
||||
if (that.payType == 2) {
|
||||
// 常规支付
|
||||
uni.showToast({
|
||||
title: "正在支付",
|
||||
icon: "loading",
|
||||
});
|
||||
// 常规支付
|
||||
await setPay({
|
||||
typePay: "alipay",
|
||||
subject: "order",
|
||||
@@ -1043,12 +1107,14 @@
|
||||
title: "加载中",
|
||||
});
|
||||
console.log(res, "支付支付");
|
||||
if (res.success) {
|
||||
if (res.success) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
});
|
||||
setTimeout(() => {
|
||||
if (that.goToInfo.type == 1) {
|
||||
if(that.canjump){
|
||||
if (that.goToInfo.type == 1 ) {
|
||||
uni.switchTab({
|
||||
url: `${that.goToInfo.url}?type=order`,
|
||||
});
|
||||
@@ -1060,8 +1126,10 @@
|
||||
url: `${that.goToInfo.url}?backType=order`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
console.log("失败失败失败");
|
||||
// this.buyingFlag = false
|
||||
// that.$commonJS.showToast('支付是失败')
|
||||
@@ -1069,13 +1137,12 @@
|
||||
console.log("延迟调用 失败提示");
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
}, 0);
|
||||
|
||||
|
||||
// setTimeout(() => {
|
||||
|
||||
|
||||
// uni.navigateTo({
|
||||
// url: './orderList'
|
||||
// });
|
||||
@@ -1083,7 +1150,7 @@
|
||||
}
|
||||
}
|
||||
);
|
||||
} else if (this.payType == 1) {
|
||||
} else if (that.payType == 1) {
|
||||
// 微信支付
|
||||
let data1 = {
|
||||
orderSn: res.orderSn,
|
||||
@@ -1093,26 +1160,26 @@
|
||||
setWXPay(data1, (res) => {
|
||||
if (res.success) {
|
||||
// this.buyingFlag = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
});
|
||||
setTimeout(() => {
|
||||
if(that.canjump){
|
||||
if (that.goToInfo.type == 1) {
|
||||
uni.switchTab({
|
||||
url: `${that.goToInfo.url}?type=order`,
|
||||
});
|
||||
} else {
|
||||
// uni.navigateBack({
|
||||
// delta: 2,
|
||||
// });
|
||||
// uni.n
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: `${that.goToInfo.url}?backType=order`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
// this.buyingFlag = false
|
||||
uni.hideLoading()
|
||||
console.log(res, "微信支付111111111111111");
|
||||
if (res.data.errMsg.indexOf("User canceled") != -1) {
|
||||
uni.showToast({
|
||||
@@ -1129,14 +1196,16 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (this.payType == 4) {
|
||||
// this.buyingFlag = false
|
||||
} else if (that.payType == 4) {
|
||||
that.buyingFlag = false
|
||||
// 天医币支付
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: "购买成功",
|
||||
icon: "success",
|
||||
});
|
||||
setTimeout(() => {
|
||||
if(that.canjump){
|
||||
if (that.goToInfo.type == 1) {
|
||||
uni.switchTab({
|
||||
url: `${that.goToInfo.url}?type=order`,
|
||||
@@ -1146,15 +1215,16 @@
|
||||
url: `${that.goToInfo.url}?backType=order`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch(e => {
|
||||
this.buyingFlag = false
|
||||
that.buyingFlag = false
|
||||
uni.hideLoading()
|
||||
});
|
||||
},
|
||||
|
||||
radioChange(index) {
|
||||
if (index == this.selectPayIndex) {
|
||||
return
|
||||
@@ -1867,6 +1937,7 @@
|
||||
background-color: #fff;
|
||||
|
||||
.curriulum_title {
|
||||
// width: calc(100% - 80rpx);
|
||||
width: calc(100% - 80rpx);
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
|
||||
Reference in New Issue
Block a user