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
+9
View File
@@ -165,3 +165,12 @@ export function cancelOrder(data) {
data, data,
}); });
} }
// 删除订单
export function deleteOrderQuery(data) {
return request({
url: "/order/deleteOrder",
method: "post",
data,
});
}
+110 -47
View File
@@ -60,10 +60,20 @@
</view> </view>
</view> </view>
<view class="content_item_yd" v-if="pItem.expressNo && pItem.expressData"> <view class="content_item_yd" v-if="pItem.expressNo && pItem.expressData">
<view class="express-view text-overflow1" v-if="Array.isArray(pItem.expressData?.logisticsTraceDetailList)"> <view class="express-view text-overflow1" v-if="
Array.isArray(pItem.expressData?.logisticsTraceDetailList)
">
<u-icon name="email" color="#333" size="20"></u-icon> <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-zu1 text-space" style="margin-left: 10rpx">{{
<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> 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>
<!-- <view style="margin-left: 10rpx"> <!-- <view style="margin-left: 10rpx">
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" <up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00"
@@ -90,8 +100,8 @@
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE" <view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE"
@click="confirmReceiptOk(item)">确认收货</view> @click="confirmReceiptOk(item)">确认收货</view>
<view class="operate_comm operate_but_1" style="borderColor: #7732FF;" v-if="form.type == 3" <view class="operate_comm operate_but_1" style="bordercolor: #7732ff" v-if="form.type == 3"
@click="onExpress(item.id,item.items.expressNo)"> @click="onExpress(item.id, item.items.expressNo)">
<text class="text-zi">查看物流</text> <text class="text-zi">查看物流</text>
</view> </view>
@@ -113,7 +123,9 @@
? 'operate_but_3' ? 'operate_but_3'
: 'operate_but_1', : 'operate_but_1',
]" v-if="!item.isAfter && form.type !== MINE_ORDER_TYPE.AFTER_SALE" @click="onSaleAfter(item)"> ]" 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>
<view class="operate_comm operate_but_1" v-if="form.type === MINE_ORDER_TYPE.AFTER_SALE" <view class="operate_comm operate_but_1" v-if="form.type === MINE_ORDER_TYPE.AFTER_SALE"
@@ -121,7 +133,12 @@
售后详情 售后详情
</view> </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="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 class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(item.status)">再次购买</view> -->
</view> </view>
</view> </view>
@@ -187,7 +204,7 @@
<up-image src="/static/common/kf_dh.png" width="40" height="40" bgColor="#f1f6ff00"></up-image> <up-image src="/static/common/kf_dh.png" width="40" height="40" bgColor="#f1f6ff00"></up-image>
</view> </view>
<view class="content_info" @click="onKefu"> <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"> <!-- <view class="content_info_mobile">
{{ PHONE_NUMBER }} {{ PHONE_NUMBER }}
<view style="margin-left: 20rpx"> <view style="margin-left: 20rpx">
@@ -244,9 +261,11 @@
confirmColor="#7934F6" title="提示" content="签署合同需要进行实名认证,请先完成实名认证"></u-modal> confirmColor="#7934F6" title="提示" content="签署合同需要进行实名认证,请先完成实名认证"></u-modal>
<DownPopup :show="downShow" @ok="onSignContract" @cancel="onCancel" /> <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" <u-modal class="sure_pay" :show="surePayShow" title="提示" showCancelButton @cancel="surePayShow = false"
content="确定取消支付吗?"></u-modal> @confirm="cancelPay" confirmColor="#7934F6" content="确定取消支付吗?"></u-modal>
</view> </view>
</template> </template>
@@ -268,7 +287,8 @@ import {
getMiniProgramSignUrl, getMiniProgramSignUrl,
afterSaleDetail, afterSaleDetail,
cancelOrder, cancelOrder,
orderLogistics orderLogistics,
deleteOrderQuery
} from "@/api/order.js"; } from "@/api/order.js";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { formatDate1, copyData } from "@/utils/index.js"; import { formatDate1, copyData } from "@/utils/index.js";
@@ -354,15 +374,16 @@ export default {
search: "", search: "",
activeIndex: 0, activeIndex: 0,
aftterSalesProduct: {}, //售后商品信息 aftterSalesProduct: {}, //售后商品信息
deleteShow: false,
deleteInfo: {}
}; };
}, },
onLoad(options) { onLoad(options) {
const type = options.type; const type = options.type;
this.form.type = this.form.type = type ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID;
type ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID; this.$nextTick(() => {
this.$nextTick(()=>{
this.loadData(); this.loadData();
}) });
// 待收货判断是否签署 // 待收货判断是否签署
if ( if (
this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE || this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE ||
@@ -377,12 +398,12 @@ export default {
getValue, getValue,
formatDate1, formatDate1,
copyData, copyData,
onExpress(itemId){ onExpress(itemId) {
console.log('onExpress',itemId) console.log("onExpress", itemId);
// let expressId = // let expressId =
uni.navigateTo({ uni.navigateTo({
url:`/pages/rwa_package/setting/express?id=${itemId}` url: `/pages/rwa_package/setting/express?id=${itemId}`,
}) });
}, },
onNextRefund() { onNextRefund() {
this.salesServer = 2; this.salesServer = 2;
@@ -390,16 +411,15 @@ export default {
this.aftterSalesProduct = { this.aftterSalesProduct = {
...this.aftterSalesProduct, ...this.aftterSalesProduct,
...{ afterReason: this.cancelForm.afterReason }, ...{ afterReason: this.cancelForm.afterReason },
};
}
}, },
onSaleAfterTab() { onSaleAfterTab() {
this.checkType({ id: MINE_ORDER_TYPE.AFTER_SALE, title: "售后" }); this.checkType({ id: MINE_ORDER_TYPE.AFTER_SALE, title: "售后" });
}, },
onKefu(){ onKefu() {
uni.navigateTo({ uni.navigateTo({
url:'/pages/rwa_package/setting/kefu?type=5261' url: "/pages/rwa_package/setting/kefu?type=5261",
}) });
}, },
// 售后 // 售后
onSaleAfter(item) { onSaleAfter(item) {
@@ -409,7 +429,6 @@ export default {
// 取消支付 // 取消支付
this.cancelPayParams = { orderId: item.id }; this.cancelPayParams = { orderId: item.id };
this.surePayShow = true; this.surePayShow = true;
} else { } else {
// 未售后 // 未售后
this.cancelForm.afterReason = ""; this.cancelForm.afterReason = "";
@@ -418,7 +437,8 @@ export default {
this.aftterSalesProduct = item; this.aftterSalesProduct = item;
this.afterShow = true; this.afterShow = true;
this.aftterSalesProduct.status = 9; 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; 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() { cancelPay() {
cancelOrder(this.cancelPayParams).then((res) => { cancelOrder(this.cancelPayParams).then((res) => {
if (res.bizcode == 100) { if (res.bizcode == 100) {
this.$refs.uToastRef.show({ this.$refs.uToastRef.show({
@@ -548,10 +601,10 @@ export default {
}, },
// 加载数据的方法 // 加载数据的方法
async loadData(type = null) { async loadData(type = null) {
console.log("加载数据的方法",type); console.log("加载数据的方法", type);
if (this.loading) return; // 如果正在加载,则不重复加载 if (this.loading) return; // 如果正在加载,则不重复加载
this.loading = true; // 设置加载状态为true this.loading = true; // 设置加载状态为true
if(type){ if (type) {
this.form.page = 1; this.form.page = 1;
this.orderList = []; this.orderList = [];
} }
@@ -566,11 +619,13 @@ export default {
this.form.page++; // 页码加1 this.form.page++; // 页码加1
console.log("this.orderList", this.orderList); console.log("this.orderList", this.orderList);
} }
} catch (error) { } catch (error) {
console.error("加载数据失败:", error); console.error("加载数据失败:", error);
} finally { } finally {
console.log("this.orderList1111",JSON.parse(JSON.stringify(this.orderList))); console.log(
"this.orderList1111",
JSON.parse(JSON.stringify(this.orderList))
);
this.$forceUpdate(); this.$forceUpdate();
this.loading = false; // 设置加载状态为false this.loading = false; // 设置加载状态为false
} }
@@ -587,10 +642,13 @@ export default {
} }
const data = await getOrderList(params); const data = await getOrderList(params);
if (data && data.bizcode === 100) { if (data && data.bizcode === 100) {
for(let i=0;i<data.data.entitys.length;i++){ for (let i = 0; i < data.data.entitys.length; i++) {
for(let j=0;j<data.data.entitys[i].items.length;j++){ for (let j = 0; j < data.data.entitys[i].items.length; j++) {
if(data.data.entitys[i].items[j].expressNo){ 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[i].items[j].expressData =
await this.getOrderLogistics(
data.data.entitys[i].items[j].expressNo
);
} }
} }
} }
@@ -606,21 +664,20 @@ export default {
return data.data; return data.data;
} else { } else {
return ''; return "";
} }
}, },
async getOrderLogistics(id){ async getOrderLogistics(id) {
const params = { const params = {
mailNo:id mailNo: id,
}; };
const data = await orderLogistics(params); const data = await orderLogistics(params);
if(data.bizcode == 100){ if (data.bizcode == 100) {
return data.data; return data.data;
}else{ } else {
return []; return [];
} }
}, },
// 当滚动到底部时触发的方法 // 当滚动到底部时触发的方法
loadMore() { loadMore() {
@@ -774,16 +831,17 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.express-view{ .express-view {
width:100%; width: 100%;
height:52rpx; height: 52rpx;
background-color: #f5f5f5; background-color: #f5f5f5;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
border-radius: 4rpx; border-radius: 4rpx;
line-height: 1.6; line-height: 1.6;
} }
.after-sales-popup { .after-sales-popup {
height: 400px !important; height: 400px !important;
@@ -1101,8 +1159,13 @@ export default {
color: #ffffff; color: #ffffff;
} }
.sure_pay{ .operate_comm_delete {
::v-deep(.u-modal__content__text){ color: #f24a00;
border: 1rpx solid #f24a00;
}
.sure_pay {
::v-deep(.u-modal__content__text) {
text-align: center; text-align: center;
} }
} }