添加复读订单功能

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

@@ -166,6 +166,23 @@
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'relearn'">
<image
src="/static/icon/fugou.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 100rpx">
<text>{{ orderContet.remark }}</text>
</view>
<view class="orderPrice">
<text style="font-weight: bold"></text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'vip'">
<image
src="/static/icon/vip.png"

View File

@@ -128,7 +128,40 @@
>
</view>
</view>
<view
v-if="slotProps.row.orderType == 'relearn'"
class="bookinfolist"
>
<image
class="feng fengPoint"
src="/static/icon/fugou.png"
mode="aspectFill"
></image>
<!-- <view class="description" >课程复读订单
</view> -->
<view class="btns flexbox">
<view class="booknameleft">
{{ slotProps.row.remark }}
</view>
<view
style="
line-height: 58rpx;
color: #333;
font-size: 26rpx;
font-weight: 700;
"
>
<text style="font-size: 20rpx"></text>
</view>
</view>
<!-- <view
class="btns flexbox"
style="color: #9f9f9f; margin-top: 10rpx; font-size: 24rpx"
>
下单时间{{ slotProps.row.createTime }}
</view> -->
</view>
<view
v-if="slotProps.row.orderType == 'vip'"
class="bookinfolist"
@@ -897,7 +930,7 @@ export default {
},
})
.then((res) => {
// console.log(res, "内容获取成功");
console.log("订单列表内容获取成功",res );
that.pagination.total = res.data.total;
if (res.data.total == 0) {
this.isLoadingHide = true;

View File

@@ -44,8 +44,8 @@
<view
class="related_courses_name"
:class="`goods_item ${
selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId
!isFudu && selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId || isFudu && selectGoodsData.productName == slotProps.row.productName
? 'isSelectGoods color_shandow'
: ''
}`"
@@ -109,6 +109,7 @@ export default {
"selectGoodsData",
"customButtonGroup1",
"buyOptions",
"isFudu", // 是否复读
],
data() {
return {

View File

@@ -229,9 +229,7 @@
<text style="line-height: 50rpx;">课程有效期截止到{{librayList[curIndex].endTime}} </text>
<!-- 自己买的可以续费 -->
<text class="xufeiBtn"
@click="handleClickGetGoodsList(librayList[curIndex])">续费</text>
<text class="xufeiBtn"
@click="handleClickGetGoodsList(librayList[curIndex])" v-if="showNewPayBtn">复读</text>
@click="handleClickGetGoodsList(librayList[curIndex])">续费</text>
</template>
</view>
</view>
@@ -245,6 +243,10 @@
<view class="tag-view flex_box">
<u-button class="btn" type="warning" size="small"
@click="handleClickGetGoodsList(librayList[curIndex])" text="购买课程"></u-button>
<u-button class="btn" type="success" size="small"
@click="goNewPay(librayList[curIndex])" text="复读" v-if="showNewPayBtn"></u-button>
<!-- <text class="xufeiBtn"
@click="goNewPay(librayList[curIndex])" >复读</text> -->
<u-button size="small" v-if="isAndorid" class="btn" type="primary"
@click="onPageJump('/pages/mine/vip/index')" text="开通VIP"></u-button>
<!-- <uni-tag size="normal" style="margin-left: 20rpx;" text="" type="success" /> -->
@@ -465,10 +467,10 @@
</view>
<common-select-goods ref="commonSelectGoods" :selectGoodsData="selectGoodsData" :goodsList="goodsList"
<common-select-goods ref="commonSelectGoods" isFudu="isFudu" :selectGoodsData="selectGoodsData" :goodsList="goodsList"
:buyOptions="buyOptions" :customButtonGroup1="customButtonGroup1" @selectGoods="handleClickSelectGoods"
@onHandleClickBuy="
$refs.commonSelectGoods.close();
$refs.commonSelectGoods.close();
protocolShow = true;
"></common-select-goods>
<u-popup :show="protocolShow" mode="center" round="6" v-if="protocolShow">
@@ -625,7 +627,8 @@
list: "sociology/course/getCourseDetail",
goodsList: "sociology/product/getProductListForCourse",
startStudyForMF: "sociology/course/startStudyForMF",
newPayment:"common/courseRelearn/courseCatalogueCanRelearn", // 复读地址
newPayment:"common/courseRelearn/courseCatalogueCanRelearn", // 检查复读地址
newPaymentList:"common/courseRelearn/relearnShopProductList", // 获取复读列表
},
isAndorid: true,
oprateOsName: '',
@@ -642,6 +645,8 @@
canJoinTestTime: false, //时间上是否可以参加自考考试
courseCompletion: undefined, // 课程学习进度
showNewPayBtn:false,
newPaymentProList:[],
isFudu:false, // 是否复读
};
},
//第一次加载
@@ -1112,6 +1117,7 @@
typeId: 0,
navTitle: this.course.title,
title: this.course.title,
isFudu: this.isFudu
// sourceType: "curriculum",
}); // 这里转换成 字符串
uni.navigateTo({
@@ -1123,9 +1129,41 @@
this.pricespop = false;
this.protocolShow = true;
},
// 查询课程复读列表
async getNewPaymentList(id){
uni.showLoading({
title:'加载中'
})
await this.$http
.request({
url: this.urlList.newPaymentList,
method: "POST",
data: {
catalogueId: id,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
console.log("复读列表", res);
uni.hideLoading()
if(res.code != 0){return this.$commonJS.showToast(res.errMsg);}
// if (res.code == 0) {
this.newPaymentProList = res.productList
// }
this.$forceUpdate();
}).catch(e => {
uni.hideLoading()
console.log('e',e);
this.newPaymentProList = []
this.$commonJS.showToast(e.errMsg);
});
},
// 查询目录续费情况
async checkRenewPayment(id){
console.log('999999999999999999999999999');
async checkRenewPayment(id){
var ss = false
await this.$http
.request({
@@ -1192,6 +1230,7 @@
}
},
getCourseDescriptionData(v){
this.isFudu = false
this.$http
.request({
url: this.urlList.goodsList,
@@ -1817,6 +1856,22 @@
console.log("datas at line 1300:", datas);
return datas;
},
// 选择复读选项
async goNewPay(item){
this.showNewPayBtn ? await this.getNewPaymentList(item.id) : ''
if(this.newPaymentProList.length > 0){
// this.getCourseDescriptionData(v);
this.goodsList = this.newPaymentProList;
this.selectGoodsData = this.goodsList[0];
this.$refs.commonSelectGoods.open();
this.isFudu = true
this.show = true;
}else{
this.show = false
this.isFudu = false
this.$commonJS.showToast('暂无复读方案');
}
},
async clicklib(item, index) {
console.log('hhhhhhhhhhhhhhhhhhh++++++++', item);
@@ -1829,10 +1884,10 @@
if(item.isBuy == 0 && this.userMsg.vip != 2 && this.userMsg.vip != 1 ){
console.log('hhhhhhhhhhhhhhhhhhh++++++++');
this.showNewPayBtn = await this.checkRenewPayment(item.id)
}else{
// this.showNewPayBtn = await this.checkRenewPayment(item.id)
console.log('hhhhhhhhhhhhhhhhhhh不用复读');
this.showNewPayBtn = await this.checkRenewPayment(item.id)
console.log('可以复读吗?', this.showNewPayBtn );
}else{ // this.showNewPayBtn = await this.checkRenewPayment(item.id)
console.log('不用复读');
}
this.chapterList = await this.getChapterList(item.id);

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({

BIN
static/icon/fugou.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB