zm
This commit is contained in:
@@ -180,6 +180,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import debounce from "@/common/debounce.js";
|
||||
import courseDescription from "@/pages/component/commonComponents/list";
|
||||
import { setPay, setPayAssign, setWXPay } from "@/config/utils";
|
||||
import $http from "@/config/requestConfig.js";
|
||||
@@ -529,180 +530,179 @@ export default {
|
||||
}
|
||||
},
|
||||
async goBuyJie() {
|
||||
var that = this;
|
||||
// if (this.addressList.length == 0) {
|
||||
// this.dizhiShow = true // 如果没有地址信息
|
||||
// }
|
||||
// if (!this.nowClick) {
|
||||
// return
|
||||
// }
|
||||
this.nowClick = false;
|
||||
setTimeout(() => {
|
||||
this.nowClick = true;
|
||||
}, 5000);
|
||||
// let youPre = {
|
||||
// id: "",
|
||||
// coupons: {
|
||||
// amount: 0,
|
||||
// name: "",
|
||||
// },
|
||||
// };
|
||||
// if (this.youhuiContent.id != undefined) {
|
||||
// youPre = this.youhuiContent;
|
||||
// }
|
||||
let xiaBiao = [];
|
||||
// for (let i = 0; i < this.cartList.length; i++) {
|
||||
// xiaBiao.push({
|
||||
// productId: this.cartList[i].productId,
|
||||
// quantity: this.cartList[i].productAmount,
|
||||
// });
|
||||
// }
|
||||
debounce(async () => {
|
||||
var that = this;
|
||||
// if (this.addressList.length == 0) {
|
||||
// this.dizhiShow = true // 如果没有地址信息
|
||||
// }
|
||||
// if (!this.nowClick) {
|
||||
// return
|
||||
// }
|
||||
this.nowClick = false;
|
||||
setTimeout(() => {
|
||||
this.nowClick = true;
|
||||
}, 5000);
|
||||
// let youPre = {
|
||||
// id: "",
|
||||
// coupons: {
|
||||
// amount: 0,
|
||||
// name: "",
|
||||
// },
|
||||
// };
|
||||
// if (this.youhuiContent.id != undefined) {
|
||||
// youPre = this.youhuiContent;
|
||||
// }
|
||||
let xiaBiao = [];
|
||||
// for (let i = 0; i < this.cartList.length; i++) {
|
||||
// xiaBiao.push({
|
||||
// productId: this.cartList[i].productId,
|
||||
// quantity: this.cartList[i].productAmount,
|
||||
// });
|
||||
// }
|
||||
|
||||
let data = {
|
||||
paymentMethod: this.payType, //1微信2支付宝3苹果支付4虚拟币
|
||||
orderMoney: this.dataInfo.lastFee, //订单金额
|
||||
realMoney: this.dataInfo.lastFee, //实际金额
|
||||
shippingMoney: 0, //运费
|
||||
jfDeduction: 0, //积分抵扣
|
||||
vipBuyConfigId: this.dataInfo.id,
|
||||
come: 1, //订单来源,0疯子读书1国学众妙之门2医学吴门医述
|
||||
let data = {
|
||||
paymentMethod: this.payType, //1微信2支付宝3苹果支付4虚拟币
|
||||
orderMoney: this.dataInfo.lastFee, //订单金额
|
||||
realMoney: this.dataInfo.lastFee, //实际金额
|
||||
shippingMoney: 0, //运费
|
||||
jfDeduction: 0, //积分抵扣
|
||||
vipBuyConfigId: this.dataInfo.id,
|
||||
come: 1, //订单来源,0疯子读书1国学众妙之门2医学吴门医述
|
||||
|
||||
// appName: "zmzm",
|
||||
};
|
||||
// appName: "zmzm",
|
||||
};
|
||||
|
||||
console.log("data at line 477:", data);
|
||||
console.log("data at line 477:", data);
|
||||
|
||||
await $http
|
||||
.request({
|
||||
// url: "book/buyOrder/buySave",
|
||||
url: that.urlList.buyOrder,
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log("res at line 598111111111111:", res);
|
||||
if (res.code == 0) {
|
||||
if (res.orderSn == null) {
|
||||
uni.showToast({
|
||||
title: "失败,请重新下单",
|
||||
icon: "none",
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
} else {
|
||||
console.log("that.payType at line 607:", that.payType);
|
||||
if (that.payType == 2) {
|
||||
// 常规支付
|
||||
await $http
|
||||
.request({
|
||||
// url: "book/buyOrder/buySave",
|
||||
url: that.urlList.buyOrder,
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log("res at line 598111111111111:", res);
|
||||
if (res.code == 0) {
|
||||
if (res.orderSn == null) {
|
||||
uni.showToast({
|
||||
title: "正在支付",
|
||||
icon: "loading",
|
||||
title: "失败,请重新下单",
|
||||
icon: "none",
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
await setPay(
|
||||
{
|
||||
typePay: "alipay",
|
||||
subject: "order",
|
||||
} else {
|
||||
console.log("that.payType at line 607:", that.payType);
|
||||
if (that.payType == 2) {
|
||||
// 常规支付
|
||||
uni.showToast({
|
||||
title: "正在支付",
|
||||
icon: "loading",
|
||||
});
|
||||
await setPay(
|
||||
{
|
||||
typePay: "alipay",
|
||||
subject: "vip",
|
||||
totalAmount: res.money,
|
||||
type: 2,
|
||||
relevanceoid: res.orderSn,
|
||||
customerId: that.userInfo.id,
|
||||
},
|
||||
(res) => {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
});
|
||||
console.log(res, "支付支付");
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.setStorageSync("orderStatus", 0);
|
||||
uni.switchTab({
|
||||
url: "/pages/bookShop/orderList?type=order",
|
||||
success: function (res) {},
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
console.log("失败失败失败");
|
||||
|
||||
// that.$commonJS.showToast('支付是失败')
|
||||
setTimeout(() => {
|
||||
console.log("延迟调用 失败提示");
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
}, 0);
|
||||
|
||||
// setTimeout(() => {
|
||||
|
||||
// uni.navigateTo({
|
||||
// url: './orderList'
|
||||
// });
|
||||
// }, 1000)
|
||||
}
|
||||
}
|
||||
);
|
||||
} else if (this.payType == 1) {
|
||||
// 微信支付
|
||||
let data1 = {
|
||||
orderSn: res.orderSn,
|
||||
buyOrderId: null,
|
||||
totalAmount: res.money,
|
||||
type: 2,
|
||||
relevanceoid: res.orderSn,
|
||||
customerId: that.userInfo.id,
|
||||
},
|
||||
(res) => {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
});
|
||||
console.log(res, "支付支付");
|
||||
};
|
||||
setWXPay(data1, (res) => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
});
|
||||
setTimeout(() => {uni.setStorageSync("orderStatus", 0);
|
||||
setTimeout(() => {
|
||||
uni.setStorageSync("orderStatus", 0);
|
||||
uni.switchTab({
|
||||
url: "/pages/bookShop/orderList?type=order",
|
||||
success: function (res) {
|
||||
|
||||
},
|
||||
success: function (res) {},
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
console.log("失败失败失败");
|
||||
|
||||
// that.$commonJS.showToast('支付是失败')
|
||||
setTimeout(() => {
|
||||
console.log("延迟调用 失败提示");
|
||||
console.log(res, "微信支付111111111111111");
|
||||
if (res.data.errMsg.indexOf("User canceled") != -1) {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
|
||||
title: "用户取消支付",
|
||||
icon: "none",
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
}, 0);
|
||||
|
||||
// setTimeout(() => {
|
||||
|
||||
// uni.navigateTo({
|
||||
// url: './orderList'
|
||||
// });
|
||||
// }, 1000)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} else if (this.payType == 1) {
|
||||
// 微信支付
|
||||
let data1 = {
|
||||
orderSn: res.orderSn,
|
||||
buyOrderId: null,
|
||||
totalAmount: res.money,
|
||||
};
|
||||
setWXPay(data1, (res) => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
});
|
||||
setTimeout(() => { uni.setStorageSync("orderStatus", 0);
|
||||
uni.switchTab({
|
||||
url: "/pages/bookShop/orderList?type=order",
|
||||
success: function (res) {
|
||||
|
||||
},
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
console.log(res, "微信支付111111111111111");
|
||||
if (res.data.errMsg.indexOf("User canceled") != -1) {
|
||||
uni.showToast({
|
||||
title: "用户取消支付",
|
||||
icon: "none",
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: "../../../static/icon/ic_close.png",
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (this.payType == 4) {
|
||||
// 天医币支付
|
||||
uni.showToast({
|
||||
title: "购买成功",
|
||||
icon: "success",
|
||||
});
|
||||
setTimeout(() => { uni.setStorageSync("orderStatus", 0);
|
||||
uni.switchTab({
|
||||
url: "/pages/bookShop/orderList?type=order",
|
||||
success: function (res) {
|
||||
|
||||
},
|
||||
});
|
||||
}, 1000);
|
||||
} else if (this.payType == 4) {
|
||||
// 天医币支付
|
||||
uni.showToast({
|
||||
title: "购买成功",
|
||||
icon: "success",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.setStorageSync("orderStatus", 0);
|
||||
uni.switchTab({
|
||||
url: "/pages/bookShop/orderList?type=order",
|
||||
success: function (res) {},
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 200);
|
||||
},
|
||||
|
||||
radioChange(index) {
|
||||
@@ -1288,11 +1288,13 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "@/style/mixin.scss";
|
||||
|
||||
.pay_title {
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.order_box {
|
||||
padding: 20rpx;
|
||||
|
||||
@@ -1822,6 +1824,7 @@ export default {
|
||||
.bgGrey {
|
||||
// background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.pay_info {
|
||||
margin-bottom: 60rpx;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user