feat:售后&订单加删除

This commit is contained in:
2025-09-27 17:23:05 +08:00
parent 424166dce3
commit 428a70fac9
2 changed files with 174 additions and 102 deletions
+165 -102
View File
@@ -60,10 +60,20 @@
</view>
</view>
<view class="content_item_yd" v-if="pItem.expressNo && pItem.expressData">
<view class="express-view text-overflow1" v-if="Array.isArray(pItem.expressData?.logisticsTraceDetailList)">
<u-icon name="email" color="#333" size="20"></u-icon>
<text class="text-24 text-zu1 text-space" style="margin-left:10rpx;">{{pItem.expressData.logisticsStatusDesc}}</text>
<text class="text-24 text-fu text-space text-overflow1" style="margin-left:10rpx;">{{Array.isArray(pItem.expressData?.logisticsTraceDetailList) ? pItem.expressData?.logisticsTraceDetailList[pItem.expressData.logisticsTraceDetailList.length - 1].desc : ''}}</text>
<view class="express-view text-overflow1" v-if="
Array.isArray(pItem.expressData?.logisticsTraceDetailList)
">
<u-icon name="email" color="#333" size="20"></u-icon>
<text class="text-24 text-zu1 text-space" style="margin-left: 10rpx">{{
pItem.expressData.logisticsStatusDesc }}</text>
<text class="text-24 text-fu text-space text-overflow1" style="margin-left: 10rpx">{{
Array.isArray(pItem.expressData?.logisticsTraceDetailList)
? pItem.expressData?.logisticsTraceDetailList[
pItem.expressData.logisticsTraceDetailList.length -
1
].desc
: ""
}}</text>
</view>
<!-- <view style="margin-left: 10rpx">
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00"
@@ -74,7 +84,7 @@
</view>
<!-- 汇总 -->
<view class="order_item_collect">
<!-- <view class="collect_msg collect_msg_s" v-if="this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE">
<!-- <view class="collect_msg collect_msg_s" v-if="this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE">
<view class="content_item_yd_msg">(快递动态跟进请复制单号至[快递100官网] 查询)</view>
<view>共{{ item.buyNum }}件,合计¥{{ item.sumAmount }}</view>
</view> -->
@@ -89,12 +99,12 @@
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE"
@click="confirmReceiptOk(item)">确认收货</view>
<view class="operate_comm operate_but_1" style="borderColor: #7732FF;" v-if="form.type == 3"
@click="onExpress(item.id,item.items.expressNo)">
<text class="text-zi">查看物流</text>
</view>
<view class="operate_comm operate_but_1" style="bordercolor: #7732ff" v-if="form.type == 3"
@click="onExpress(item.id, item.items.expressNo)">
<text class="text-zi">查看物流</text>
</view>
<view class="operate_comm operate_but_2" v-if="
!isCheckSigne &&
index == 0 &&
@@ -113,7 +123,9 @@
? 'operate_but_3'
: 'operate_but_1',
]" v-if="!item.isAfter && form.type !== MINE_ORDER_TYPE.AFTER_SALE" @click="onSaleAfter(item)">
{{ form.type === MINE_ORDER_TYPE.UNPAID ? "取消支付" : "售后" }}
{{
form.type === MINE_ORDER_TYPE.UNPAID ? "取消支付" : "去售后"
}}
</view>
<view class="operate_comm operate_but_1" v-if="form.type === MINE_ORDER_TYPE.AFTER_SALE"
@@ -121,7 +133,12 @@
售后详情
</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="[ORDER_TYPE.COMPLETED].includes(item.status)">删除记录</view> -->
<view class="operate_comm operate_but_1 operate_comm_delete" v-if="
[
MINE_ORDER_TYPE.SUCCEED,
MINE_ORDER_TYPE.AFTER_SALE,
].includes(form.type)
" @click="deleteOrder(item)">删除</view>
<!-- <view class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(item.status)">再次购买</view> -->
</view>
</view>
@@ -187,7 +204,7 @@
<up-image src="/static/common/kf_dh.png" width="40" height="40" bgColor="#f1f6ff00"></up-image>
</view>
<view class="content_info" @click="onKefu">
<view class="content_info_title" style="margin-top:20rpx">在线客服</view>
<view class="content_info_title" style="margin-top: 20rpx">在线客服</view>
<!-- <view class="content_info_mobile">
{{ PHONE_NUMBER }}
<view style="margin-left: 20rpx">
@@ -242,11 +259,13 @@
<u-modal :show="tipsShow" :showCancelButton="true" confirmText="去认证" @cancel="onTipsCancel" @confirm="onConfirm"
confirmColor="#7934F6" title="提示" content="签署合同需要进行实名认证,请先完成实名认证"></u-modal>
<DownPopup :show="downShow" @ok="onSignContract" @cancel="onCancel" />
<u-modal class="sure_pay" :show="surePayShow" title="提示" showCancelButton @cancel="surePayShow = false" @confirm="cancelPay" confirmColor="#7934F6"
content="确定取消支付吗?"></u-modal>
<DownPopup :show="downShow" @ok="onSignContract" @cancel="onCancel" />
<u-modal :show="deleteShow" title="提示" showCancelButton @cancel="deleteShow = false" @confirm="againDeleteOrder"
content="确定删除吗?"></u-modal>
<u-modal class="sure_pay" :show="surePayShow" title="提示" showCancelButton @cancel="surePayShow = false"
@confirm="cancelPay" confirmColor="#7934F6" content="确定取消支付吗?"></u-modal>
</view>
</template>
@@ -268,7 +287,8 @@ import {
getMiniProgramSignUrl,
afterSaleDetail,
cancelOrder,
orderLogistics
orderLogistics,
deleteOrderQuery
} from "@/api/order.js";
import dayjs from "dayjs";
import { formatDate1, copyData } from "@/utils/index.js";
@@ -354,15 +374,16 @@ export default {
search: "",
activeIndex: 0,
aftterSalesProduct: {}, //售后商品信息
deleteShow: false,
deleteInfo: {}
};
},
onLoad(options) {
const type = options.type;
this.form.type =
type ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID;
this.$nextTick(()=>{
this.loadData();
})
this.form.type = type ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID;
this.$nextTick(() => {
this.loadData();
});
// 待收货判断是否签署
if (
this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE ||
@@ -377,30 +398,29 @@ export default {
getValue,
formatDate1,
copyData,
onExpress(itemId){
console.log('onExpress',itemId)
// let expressId =
uni.navigateTo({
url:`/pages/rwa_package/setting/express?id=${itemId}`
})
},
onExpress(itemId) {
console.log("onExpress", itemId);
// let expressId =
uni.navigateTo({
url: `/pages/rwa_package/setting/express?id=${itemId}`,
});
},
onNextRefund() {
this.salesServer = 2;
this.aftterSalesProduct = {
...this.aftterSalesProduct,
...{ afterReason: this.cancelForm.afterReason },
}
};
},
onSaleAfterTab() {
this.checkType({ id: MINE_ORDER_TYPE.AFTER_SALE, title: "售后" });
},
onKefu(){
uni.navigateTo({
url:'/pages/rwa_package/setting/kefu?type=5261'
})
},
onKefu() {
uni.navigateTo({
url: "/pages/rwa_package/setting/kefu?type=5261",
});
},
// 售后
onSaleAfter(item) {
console.log("售后---1", item, this.form.type);
@@ -409,7 +429,6 @@ export default {
// 取消支付
this.cancelPayParams = { orderId: item.id };
this.surePayShow = true;
} else {
// 未售后
this.cancelForm.afterReason = "";
@@ -418,7 +437,8 @@ export default {
this.aftterSalesProduct = item;
this.afterShow = true;
this.aftterSalesProduct.status = 9;
this.aftterSalesProduct.afterType = this.form.type == MINE_ORDER_TYPE.UNSHIPPED ? 1 : 2;
this.aftterSalesProduct.afterType =
this.form.type == MINE_ORDER_TYPE.UNSHIPPED ? 1 : 2;
}
},
// 售后订单详情
@@ -453,9 +473,42 @@ export default {
this.afterShow = false;
},
// 删除
deleteOrder(item) {
console.log("删除", item);
this.deleteShow = true;
this.deleteInfo = item;
},
async againDeleteOrder() {
let params;
if (this.deleteInfo.status === 4) {
params = {
orderId: this.deleteInfo.id,
type: 1
}
}
if (this.deleteInfo.status === 7) {
params = {
orderId: this.deleteInfo.afterId,
type: 2
}
}
console.log("删除-1", params);
const res = await deleteOrderQuery(params);
if (res.bizcode == 100) {
this.$refs.uToastRef.show({
type: "success",
message: "删除成功",
});
this.deleteShow = false;
this.form.page = 1;
this.orderList = [];
this.loadData();
}
},
// 取消支付
cancelPay() {
cancelOrder(this.cancelPayParams).then((res) => {
if (res.bizcode == 100) {
this.$refs.uToastRef.show({
@@ -548,30 +601,32 @@ export default {
},
// 加载数据的方法
async loadData(type = null) {
console.log("加载数据的方法",type);
console.log("加载数据的方法", type);
if (this.loading) return; // 如果正在加载,则不重复加载
this.loading = true; // 设置加载状态为true
if(type){
this.form.page = 1;
this.orderList = [];
}
if (type) {
this.form.page = 1;
this.orderList = [];
}
try {
// 模拟异步获取数据,实际应用中应该替换为你的数据获取逻辑,例如API调用
const newData = await this.fetchData(
this.form.page,
this.form.pageSize
);
if (newData.entitys && newData.entitys.length !== 0) {
this.orderList = [...this.orderList, ...newData.entitys]; // 将新数据添加到列表中
this.form.page++; // 页码加1
console.log("this.orderList", this.orderList);
}
const newData = await this.fetchData(
this.form.page,
this.form.pageSize
);
if (newData.entitys && newData.entitys.length !== 0) {
this.orderList = [...this.orderList, ...newData.entitys]; // 将新数据添加到列表中
this.form.page++; // 页码加1
console.log("this.orderList", this.orderList);
}
} catch (error) {
console.error("加载数据失败:", error);
} finally {
console.log("this.orderList1111",JSON.parse(JSON.stringify(this.orderList)));
this.$forceUpdate();
console.log(
"this.orderList1111",
JSON.parse(JSON.stringify(this.orderList))
);
this.$forceUpdate();
this.loading = false; // 设置加载状态为false
}
},
@@ -587,41 +642,43 @@ export default {
}
const data = await getOrderList(params);
if (data && data.bizcode === 100) {
for(let i=0;i<data.data.entitys.length;i++){
for(let j=0;j<data.data.entitys[i].items.length;j++){
if(data.data.entitys[i].items[j].expressNo){
data.data.entitys[i].items[j].expressData = await this.getOrderLogistics(data.data.entitys[i].items[j].expressNo);
}
}
}
// data.data.entitys.forEach(item=>{
// if(item.items.length){
// item.items.forEach(async (Iitem)=>{
// if(Iitem.expressNo){
// Iitem.expressData = await this.getOrderLogistics(Iitem.expressNo);
// }
// })
// }
// })
for (let i = 0; i < data.data.entitys.length; i++) {
for (let j = 0; j < data.data.entitys[i].items.length; j++) {
if (data.data.entitys[i].items[j].expressNo) {
data.data.entitys[i].items[j].expressData =
await this.getOrderLogistics(
data.data.entitys[i].items[j].expressNo
);
}
}
}
// data.data.entitys.forEach(item=>{
// if(item.items.length){
// item.items.forEach(async (Iitem)=>{
// if(Iitem.expressNo){
// Iitem.expressData = await this.getOrderLogistics(Iitem.expressNo);
// }
// })
// }
// })
return data.data;
} else {
return '';
return "";
}
},
async getOrderLogistics(id) {
const params = {
mailNo: id,
};
const data = await orderLogistics(params);
if (data.bizcode == 100) {
return data.data;
} else {
return [];
}
},
async getOrderLogistics(id){
const params = {
mailNo:id
};
const data = await orderLogistics(params);
if(data.bizcode == 100){
return data.data;
}else{
return [];
}
},
// 当滚动到底部时触发的方法
loadMore() {
this.loadData(); // 加载更多数据
@@ -774,16 +831,17 @@ export default {
</script>
<style lang="scss" scoped>
.express-view{
width:100%;
height:52rpx;
background-color: #f5f5f5;
display: flex;
flex-direction: row;
align-items: center;
border-radius: 4rpx;
line-height: 1.6;
}
.express-view {
width: 100%;
height: 52rpx;
background-color: #f5f5f5;
display: flex;
flex-direction: row;
align-items: center;
border-radius: 4rpx;
line-height: 1.6;
}
.after-sales-popup {
height: 400px !important;
@@ -862,7 +920,7 @@ export default {
}
.order_warp {
height: calc(100vh - env(safe-area-inset-bottom));
height: calc(100vh - env(safe-area-inset-bottom));
background-color: $app-bj;
padding: 100rpx 30rpx 30rpx;
overflow-y: hidden;
@@ -1101,8 +1159,13 @@ export default {
color: #ffffff;
}
.sure_pay{
::v-deep(.u-modal__content__text){
.operate_comm_delete {
color: #f24a00;
border: 1rpx solid #f24a00;
}
.sure_pay {
::v-deep(.u-modal__content__text) {
text-align: center;
}
}