|
|
@@ -78,10 +78,23 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
// 查看物流详情
|
|
|
- goLogistics() {
|
|
|
- wx.navigateTo({
|
|
|
- url: `/module/order/pages/logistics-detail/logistics-detail`,
|
|
|
- });
|
|
|
+ goLogistics(e: any) {
|
|
|
+ const { id } = e.currentTarget.dataset.goods;
|
|
|
+ const { liaison, phone, provinceName, cityName, areaName, detailAddress } = this.data.orderDetail;
|
|
|
+ let address = `${provinceName}${cityName ? `${cityName}` : ""
|
|
|
+ }${areaName ? `${areaName}` : ""}${detailAddress ? `${detailAddress}` : ""
|
|
|
+ }`;
|
|
|
+ const goods = JSON.stringify({ ...e.currentTarget.dataset.goods, liaison, phone, address });
|
|
|
+ if (id) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/module/order/pages/logistics-detail/logistics-detail?id=${id}&goods=${goods}`,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: "无参数id",
|
|
|
+ icon: "none",
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 订单详情
|
|
|
async load(id: string) {
|
|
|
@@ -145,15 +158,15 @@ Page({
|
|
|
receiptType: item?.receiptType || '', //收货类型 0-快递 1-线下取货
|
|
|
expressType: item?.expressType || '', //快递类型 0-邮政速递 1-顺丰速运 2-京东快递 3-中通快递 4-圆通速递 5-申通快递 6-韵达快递 7-极兔速递
|
|
|
expressNo: item?.expressNo || '', //快递单号
|
|
|
- expressTypeName: this.getExpressTypeName(item?.expressType), //快递公司名称
|
|
|
- expressTypeIcon: this.getExpressTypeIcon(item?.expressType), //快递公司图标
|
|
|
+ expressTypeName: item?.expressType, //快递公司名称
|
|
|
+ // expressTypeIcon: this.getExpressTypeIcon(item?.expressType), //快递公司图标
|
|
|
//end实体商品所用到的字段
|
|
|
progress: item?.progress || '', //进度 0-进行中 1-已完成 2-未开始 3-已取消 这个字段用于线下服务商品以及线上权益商品的进度状态
|
|
|
image: item.conditioningProgramPhoto || '',
|
|
|
price: item?.unitPrice || 0,
|
|
|
quantity: item?.totalMeasure || 0,
|
|
|
- statusClass: this.getStatusClass(item?.sellType, item?.progress, item?.receiptStatus),
|
|
|
- statusText: this.getGoodsStatusText(item?.sellType, item?.progress, item?.receiptStatus),
|
|
|
+ statusClass: this.getStatusClass(item?.sellType, item?.progress, item?.receiptStatus, item.expressStatus),
|
|
|
+ statusText: this.getGoodsStatusText(item?.sellType, item?.progress, item?.receiptStatus, item.expressStatus),
|
|
|
isCanEvaluate: item?.isCanEvaluate, //是否可以评价 false-否 true-是
|
|
|
evaluateTime: item?.evaluateTime, //有评价时间就是已评价,是空就是未评价
|
|
|
}
|
|
|
@@ -221,13 +234,9 @@ Page({
|
|
|
}, (error: any) => {
|
|
|
this.setData({ isPaymentLoading: false });
|
|
|
if (error?.errMsg === 'requestPayment:fail cancel') {
|
|
|
- // 支付取消跳到支付订单页面
|
|
|
+ // 支付取消跳到支付订单页面
|
|
|
wx.navigateBack({ delta: 1 });
|
|
|
}
|
|
|
- // wx.showToast({
|
|
|
- // title: error.errMsg,
|
|
|
- // icon: "none",
|
|
|
- // });
|
|
|
});
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
@@ -261,27 +270,13 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- preventTap() {
|
|
|
- // 仅用于 catchtap 阻止冒泡,避免触发父级 goAppointment
|
|
|
- },
|
|
|
+ preventTap() {},
|
|
|
onApplyAfterSale(_e: any) {
|
|
|
wx.showToast({ title: "申请售后", icon: "none" });
|
|
|
},
|
|
|
onReview(e: WechatMiniprogram.TouchEvent) {
|
|
|
- // const orderId = this.data.id || "";
|
|
|
console.log(e.currentTarget.dataset);
|
|
|
const { evaluateTime } = e.currentTarget.dataset.goods;
|
|
|
- // const { name = "", image = "", description = ''} = (e.currentTarget.dataset.goods || {}) as {
|
|
|
- // name?: string;
|
|
|
- // image?: string;
|
|
|
- // description?: string;
|
|
|
- // };
|
|
|
- // const parts: string[] = [];
|
|
|
- // if (orderId) parts.push(`orderId=${encodeURIComponent(orderId)}`);
|
|
|
- // if (name) parts.push(`name=${encodeURIComponent(name)}`);
|
|
|
- // if (image) parts.push(`image=${encodeURIComponent(image)}`);
|
|
|
- // if (description != null) parts.push(`description=${encodeURIComponent(description.toString())}`);
|
|
|
- // const query = parts.length ? "?" + parts.join("&") : "";
|
|
|
if (evaluateTime) {
|
|
|
// 单商品评价详情
|
|
|
wx.navigateTo({
|
|
|
@@ -293,14 +288,6 @@ Page({
|
|
|
wx.navigateTo({
|
|
|
url: `/module/order/pages/goods-evaluate/goods-evaluate?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
|
|
|
});
|
|
|
- // 线下服务评价
|
|
|
- // wx.navigateTo({
|
|
|
- // url: `/module/order/pages/offline-evaluate/offline-evaluate?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
|
|
|
- // });
|
|
|
- // 线下服务评价详情
|
|
|
- // wx.navigateTo({
|
|
|
- // url: `/module/order/pages/offline-evaluateDetail/offline-evaluateDetail?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
|
|
|
- // });
|
|
|
}
|
|
|
},
|
|
|
// 复制订单号
|
|
|
@@ -325,9 +312,9 @@ Page({
|
|
|
// sellType: 商品类型 1-实体商品 2-线下服务 3-线上权益
|
|
|
// progress: 进度状态(用于线下服务和线上权益):0-进行中 1-已完成 2-未开始
|
|
|
// receiptStatus: 收货状态(用于实体商品):0-待发货 1-已发货 2-已收货
|
|
|
- getStatusClass(sellType?: string | number, progress?: string | number, receiptStatus?: string | number): string {
|
|
|
+ getStatusClass(sellType?: string | number, progress?: string | number, receiptStatus?: string | number, expressStatus?: string): string {
|
|
|
const type = String(sellType || '');
|
|
|
- // 实体商品 (sellType === 1) 使用 receiptStatus(三种状态)
|
|
|
+ // 实体商品 (sellType === 1) 使用 receiptStatus(三种状态)实体商品增加运输中
|
|
|
if (type === "1") {
|
|
|
const status = String(receiptStatus || '');
|
|
|
if (status === "0") {
|
|
|
@@ -336,6 +323,8 @@ Page({
|
|
|
return "status-received"; // 已发货
|
|
|
} else if (status === "2") {
|
|
|
return "status-completed"; // 已收货
|
|
|
+ } else {
|
|
|
+ return "status-received"
|
|
|
}
|
|
|
}
|
|
|
// 线下服务 (sellType === 2) 和线上权益 (sellType === 3) 使用 progress(三种状态)
|
|
|
@@ -353,17 +342,21 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 获取商品状态文本
|
|
|
- getGoodsStatusText(sellType?: string | number, progress?: string | number, receiptStatus?: string | number): string {
|
|
|
+ getGoodsStatusText(sellType?: string | number, progress?: string | number, receiptStatus?: string | number, expressStatus?: string): string {
|
|
|
const type = String(sellType || '');
|
|
|
- // 实体商品 (sellType === 1) 使用 receiptStatus(三种状态)
|
|
|
+ // 实体商品 (sellType === 1) 使用 receiptStatus(三种状态)新增expressStatus运输状态
|
|
|
if (type === "1") {
|
|
|
const status = String(receiptStatus || '');
|
|
|
- if (status === "0") {
|
|
|
- return "待发货";
|
|
|
- } else if (status === "1") {
|
|
|
- return "已发货";
|
|
|
- } else if (status === "2") {
|
|
|
- return "已收货";
|
|
|
+ if (expressStatus) {
|
|
|
+ return expressStatus
|
|
|
+ } else {
|
|
|
+ if (status === "0") {
|
|
|
+ return "待发货";
|
|
|
+ } else if (status === "1") {
|
|
|
+ return "已发货";
|
|
|
+ } else if (status === "2") {
|
|
|
+ return "已收货";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 线下服务 (sellType === 2) 和线上权益 (sellType === 3) 使用 progress(三种状态)
|
|
|
@@ -379,37 +372,6 @@ Page({
|
|
|
}
|
|
|
return "";
|
|
|
},
|
|
|
-
|
|
|
- // 获取快递公司名称
|
|
|
- getExpressTypeName(expressType?: string | number): string {
|
|
|
- const expressTypeMap: Record<string, string> = {
|
|
|
- "0": "邮政速递",
|
|
|
- "1": "顺丰速运",
|
|
|
- "2": "京东快递",
|
|
|
- "3": "中通快递",
|
|
|
- "4": "圆通速递",
|
|
|
- "5": "申通快递",
|
|
|
- "6": "韵达快递",
|
|
|
- "7": "极兔速递",
|
|
|
- };
|
|
|
- return expressTypeMap[String(expressType || '')] || "";
|
|
|
- },
|
|
|
-
|
|
|
- // 获取快递公司图标
|
|
|
- getExpressTypeIcon(expressType?: string | number): string {
|
|
|
- const expressIconMap: Record<string, string> = {
|
|
|
- "0": "icon-youzhengkuaidi", // 邮政速递
|
|
|
- "1": "icon-shunfengkuaidi", // 顺丰速运
|
|
|
- "2": "icon-jingdong", // 京东快递
|
|
|
- "3": "icon-zhongtong", // 中通快递
|
|
|
- "4": "icon-yuantongkuaidi", // 圆通速递
|
|
|
- "5": "icon-shentong", // 申通快递
|
|
|
- "6": "icon-yunda", // 韵达快递
|
|
|
- "7": "icon-jitukuaidi", // 极兔速递
|
|
|
- };
|
|
|
- return expressIconMap[String(expressType || '')] || "";
|
|
|
- },
|
|
|
-
|
|
|
// 获取订单状态文本
|
|
|
getStatusText(status: string | number): string {
|
|
|
const statusTextMap: Record<string, string> = {
|