添加复读订单功能

This commit is contained in:
@fawn-nine
2024-10-23 15:03:52 +08:00
parent 31bf1f301b
commit 2471c703b6
6 changed files with 206 additions and 69 deletions

View File

@@ -89,7 +89,7 @@
</view>
</view>
</view>
<view class="pay_box" style="margin-top: 20rpx">
<view class="pay_box" style="margin-top: 20rpx" v-if="!options.isFudu">
<view @click="openOrderModal(v)" class="curriulum_title_box goods_item pay_item"
v-for="(v, i) in orderInfoList" :key="i">
<view class="top">
@@ -571,6 +571,7 @@
detailInfo: "app/phoneDoctor.do?getTaiHuClassInfo_new",
addressList: "common/userAddress/getUserAddress",
freightNum: "book/buyOrder/calculateTransportPrice", //运费
renewPayment:'common/courseRelearn/relearnSave' , // 复读下单地址
},
customButton: [{
width: "340rpx",
@@ -804,6 +805,19 @@
},
// 获取订单初始话
async initPrepareOrder() {
if(this.options.isFudu){
this.priceBreakdownList = [{
text: "商品总价",
imgUrl: "",
type: 1,
},
{
text: "运费",
imgUrl: "",
type: 2,
}
];
}else{
this.priceBreakdownList = [{
text: "商品总价",
imgUrl: "",
@@ -820,6 +834,7 @@
type: 3,
}
];
}
// this.goodsDataList
console.log("this.goodsDataList at line 595:", this.goodsDataList);
@@ -852,7 +867,7 @@
if (res.code == 0) {
this.initData = res.data;
this.isShowAddress = res.data.is_course ? false : true;
if (!this.isShowAddress) {
if (!this.isShowAddress && !this.options.isFudu) {
this.priceBreakdownList.push({
text: "积分",
imgUrl: require("@/static/icon/jifen.png"),
@@ -1090,47 +1105,61 @@
// productId: this.cartList[i].productId,
// quantity: this.cartList[i].productAmount,
// });
// }
if (this.options.goods[0].goodsType != "05") {
if (!this.addressData.id) {
this.$commonJS.showToast("请选择收货地址");
return false;
// }
console.log('99999999999',this.options);
let data = {}
if(this.options.isFudu){
console.log(888888888, this.goodsDataList.map((e) => e.productId +","+ e.productName ).join(','));
data = {
paymentMethod: this.payType, //支付方式 2支付宝1微信3ios内购 4天医币购买
orderMoney: this.totalPrice, //订单金额
realMoney: this.actualPayment, //实收金额
remark: this.goodsDataList.map((e) => e.productId +","+ e.productName ).join(','), //productId,商品名
come: "2",
};
}else{
if (this.options.goods[0].goodsType != "05") {
if (!this.addressData.id) {
this.$commonJS.showToast("请选择收货地址");
return false;
}
}
}
data = {
buyType: this.options.typeId, //0- 商品页直接下单 1- 购物车结算
userId: this.userInfo.id, //下单人ID
shippingUser: this.addressData ? this.addressData.consigneeName : "111", //收货人姓名
userPhone: this.addressData.consigneePhone, //收货人手机号
jfDeduction: this.jfNumber,
paymentMethod: this.payType, //支付方式 2支付宝1微信3ios内购 4天医币购买
orderMoney: this.totalPrice, //订单金额
realMoney: this.actualPayment, //实收金额
shippingMoney: this.freightNum, //运费
remark: this.remark, //备注
couponId: this.curCouponId ? this.curCoupon.id : null, //优惠券Id
// isSend: this.isSend,
couponName: this.curCouponId && this.curCoupon.id ? this.curCoupon.couponEntity.couponName : '', //优惠券名称
districtMoney: 0, //优惠金额
productList: this.goodsDataList.map((e) => {
return {
productId: e.productId,
quantity: 1,
};
}), //订单列表商品
orderType: "order", //订单类型
addressId: this.options.goods[0].goodsType != "05" ? this.addressData.id : 0, // 地址ID
appName: "wumen",
come: "2",
};
var productList = [...data.productList]
var thisproduct = productList.map(item => {
return item.productId+"_"+item.quantity
})
thisproduct = thisproduct.join(',')
}
let data = {
buyType: this.options.typeId, //0- 商品页直接下单 1- 购物车结算
userId: this.userInfo.id, //下单人ID
shippingUser: this.addressData ? this.addressData.consigneeName : "111", //收货人姓名
userPhone: this.addressData.consigneePhone, //收货人手机号
jfDeduction: this.jfNumber,
paymentMethod: this.payType, //支付方式 2支付宝1微信3ios内购 4天医币购买
orderMoney: this.totalPrice, //订单金额
realMoney: this.actualPayment, //实收金额
shippingMoney: this.freightNum, //运费
remark: this.remark, //备注
couponId: this.curCouponId ? this.curCoupon.id : null, //优惠券Id
// isSend: this.isSend,
couponName: this.curCouponId && this.curCoupon.id ? this.curCoupon.couponEntity.couponName : '', //优惠券名称
districtMoney: 0, //优惠金额
productList: this.goodsDataList.map((e) => {
return {
productId: e.productId,
quantity: 1,
};
}), //订单列表商品
orderType: "order", //订单类型
addressId: this.options.goods[0].goodsType != "05" ? this.addressData.id : 0, // 地址ID
appName: "wumen",
come: "2",
};
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("data at line 477 提交后台的下单数据:", data);
// console.log('成功信息',product,thisproduct,data.addressId, data.realMoney);
if(this.historyOrderInfo &&
thisproduct == this.historyOrderInfo.product &&
@@ -1166,11 +1195,12 @@
})
// this.buyingFlag = false
console.log('进来请求了吗?');
let that = this
let that = this
await $http
.request({
// url: "book/buyOrder/buySave",
url: that.urlList.buyOrder,
url: that.options.isFudu ? that.urlList.renewPayment : that.urlList.buyOrder,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
@@ -1179,18 +1209,19 @@
},
})
.then(async (res) => {
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);
that.buyingFlag = false
if(!that.options.isFudu){
var product = data.productList.map(item => {
return item.productId+"_"+item.quantity
})
product = product.join(',')
that.historyOrderInfo = {
'product':product,
'addressId':data.addressId,
'realMoney':data.realMoney
}
}
if (res.code == 0) {
if (res.orderSn == null) {
uni.showToast({