feat:售后展示问题
This commit is contained in:
@@ -153,7 +153,13 @@
|
|||||||
};
|
};
|
||||||
// 申请售后
|
// 申请售后
|
||||||
const applyAfterSale = () => {
|
const applyAfterSale = () => {
|
||||||
sheep.$router.go('/pages/order/aftersale/apply', props.data);
|
const source = String(props?.data?.__source || props?.data?.source || '').trim();
|
||||||
|
sheep.$router.go('/pages/order/aftersale/apply', {
|
||||||
|
...props.data,
|
||||||
|
id: props?.data?.id,
|
||||||
|
orderId: props?.data?.id,
|
||||||
|
...(source ? { source } : {}),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
// 确认收货
|
// 确认收货
|
||||||
const confirmReceive = () => {
|
const confirmReceive = () => {
|
||||||
|
|||||||
@@ -117,7 +117,10 @@
|
|||||||
<text class="delay-record-line__count">x{{ getDelayRecordCount(record) }}</text>
|
<text class="delay-record-line__count">x{{ getDelayRecordCount(record) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn flex-row ju-flex-end" v-if="props.type == 2">
|
<view
|
||||||
|
class="btn flex-row ju-flex-end"
|
||||||
|
v-if="props.type == 2 && !props.hideItemAfterSale"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
class="ss-reset-button btnItem btnItem1"
|
class="ss-reset-button btnItem btnItem1"
|
||||||
v-if="
|
v-if="
|
||||||
@@ -129,6 +132,7 @@
|
|||||||
sheep.$router.go('/pages/order/aftersale/apply', {
|
sheep.$router.go('/pages/order/aftersale/apply', {
|
||||||
orderId: props.data.id,
|
orderId: props.data.id,
|
||||||
itemId: v.id,
|
itemId: v.id,
|
||||||
|
source: String(props.source || props.data?.__source || props.data?.source || '').trim(),
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
@@ -198,6 +202,10 @@
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
hideItemAfterSale: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const isAiStoreOrder = computed(() =>
|
const isAiStoreOrder = computed(() =>
|
||||||
|
|||||||
@@ -3,13 +3,27 @@
|
|||||||
<s-pages title="申请售后" :pink_bg="true">
|
<s-pages title="申请售后" :pink_bg="true">
|
||||||
<!-- 售后商品 -->
|
<!-- 售后商品 -->
|
||||||
<view class="goods-box">
|
<view class="goods-box">
|
||||||
<s-goods-item
|
<template v-if="state.itemId > 0 && state.item?.id">
|
||||||
:img="state.item.picUrl"
|
<s-goods-item
|
||||||
:title="state.item.spuName"
|
:img="state.item.picUrl"
|
||||||
:skuText="state.item.properties?.map((property) => property.valueName).join(' ')"
|
:title="state.item.spuName"
|
||||||
:price="state.item.price"
|
:skuText="state.item.properties?.map((property) => property.valueName).join(' ')"
|
||||||
:num="state.item.count"
|
:price="state.item.price"
|
||||||
/>
|
:num="state.item.count"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="state.orderItems?.length">
|
||||||
|
<s-goods-item
|
||||||
|
v-for="(item, index) in state.orderItems"
|
||||||
|
:key="item?.id || index"
|
||||||
|
:img="item.picUrl"
|
||||||
|
:title="item.spuName"
|
||||||
|
:skuText="item.properties?.map((property) => property.valueName).join(' ')"
|
||||||
|
:price="item.price"
|
||||||
|
:num="item.count"
|
||||||
|
:style="index < state.orderItems.length - 1 ? { marginBottom: '16rpx' } : {}"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
|
<uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
|
||||||
@@ -117,18 +131,24 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||||
|
import {
|
||||||
|
getOrderDetail as getAiOrderDetail,
|
||||||
|
getOpenOrderDetail,
|
||||||
|
} from '@/sheep/api/ai';
|
||||||
|
|
||||||
const form = ref(null);
|
const form = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
orderId: 0, // 订单编号
|
orderId: 0, // 订单编号
|
||||||
itemId: 0, // 订单项编号
|
itemId: 0, // 订单项编号
|
||||||
|
source: '', // 订单来源:空=普通商城订单 | aishop=店铺订单
|
||||||
order: {}, // 订单
|
order: {}, // 订单
|
||||||
item: {}, // 订单项
|
item: {}, // 订单项
|
||||||
|
orderItems: [], // 用于展示的订单项列表(整单售后时展示全部,单品售后时展示单个)
|
||||||
config: {}, // 交易配置
|
config: {}, // 交易配置
|
||||||
payPrice: 0, // 退款金额:单品取item.payPrice,整单取外层order.payPrice
|
payPrice: 0, // 退款金额:单品取item.payPrice,整单取外层order.payPrice
|
||||||
|
|
||||||
@@ -214,15 +234,40 @@
|
|||||||
// 解析参数:兼容单品入口(传orderId+itemId)和整单入口(传订单对象即props.data.id)
|
// 解析参数:兼容单品入口(传orderId+itemId)和整单入口(传订单对象即props.data.id)
|
||||||
const orderId = parseInt(options.orderId || options.id);
|
const orderId = parseInt(options.orderId || options.id);
|
||||||
const itemId = options.itemId ? parseInt(options.itemId) : 0;
|
const itemId = options.itemId ? parseInt(options.itemId) : 0;
|
||||||
|
const source = String(options.source || options.orderSource || '').trim();
|
||||||
if (!orderId) {
|
if (!orderId) {
|
||||||
sheep.$helper.toast(`缺少订单信息,请检查`);
|
sheep.$helper.toast(`缺少订单信息,请检查`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.orderId = orderId;
|
state.orderId = orderId;
|
||||||
state.itemId = itemId;
|
state.itemId = itemId;
|
||||||
|
state.source = source;
|
||||||
|
|
||||||
// 读取订单信息
|
// 读取订单详情:按订单来源分流
|
||||||
const { code, data } = await OrderApi.getOrderDetail(state.orderId);
|
// aishop 普通店铺订单 → /aishop/order/get-detail
|
||||||
|
// aishop 开通店铺订单 type===5 → /aishop/order/get-detail-open
|
||||||
|
// 普通商城订单(默认兜底) → /trade/order/get-detail
|
||||||
|
let detailResult = null;
|
||||||
|
try {
|
||||||
|
// 开通店铺订单(type===5)优先:先用 getOpenOrderDetail 试一次,命中 type===5 直接用
|
||||||
|
const openRes = await getOpenOrderDetail({ id: state.orderId });
|
||||||
|
if (openRes?.code === 0 && openRes?.data && Number(openRes.data?.type) === 5) {
|
||||||
|
detailResult = openRes;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
if (!detailResult) {
|
||||||
|
if (source === 'aishop') {
|
||||||
|
const aiRes = await getAiOrderDetail({ id: state.orderId });
|
||||||
|
if (aiRes?.code === 0 && aiRes?.data) detailResult = aiRes;
|
||||||
|
} else {
|
||||||
|
const mallRes = await OrderApi.getOrderDetail(state.orderId);
|
||||||
|
if (mallRes?.code === 0 && mallRes?.data) detailResult = mallRes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!detailResult) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { code, data } = detailResult;
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -231,8 +276,10 @@
|
|||||||
// 按itemId精确查找订单项(单品入口),否则默认取第1项(整单入口仅用于商品卡片展示)
|
// 按itemId精确查找订单项(单品入口),否则默认取第1项(整单入口仅用于商品卡片展示)
|
||||||
if (state.itemId > 0) {
|
if (state.itemId > 0) {
|
||||||
state.item = data.items.find((item) => item.id === state.itemId) || {};
|
state.item = data.items.find((item) => item.id === state.itemId) || {};
|
||||||
|
state.orderItems = state.item?.id ? [state.item] : [];
|
||||||
} else {
|
} else {
|
||||||
state.item = data.items?.[0] || {};
|
state.item = data.items?.[0] || {};
|
||||||
|
state.orderItems = Array.isArray(data.items) ? data.items : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退款金额:单品用订单项的payPrice,整单使用订单外层的payPrice(含randomDiscountPrice等优惠抵扣后的值)
|
// 退款金额:单品用订单项的payPrice,整单使用订单外层的payPrice(含randomDiscountPrice等优惠抵扣后的值)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
:data="state.orderInfo"
|
:data="state.orderInfo"
|
||||||
:source="state.source"
|
:source="state.source"
|
||||||
:delay-records="state.delayRecords"
|
:delay-records="state.delayRecords"
|
||||||
|
:hide-item-after-sale="true"
|
||||||
type="2"
|
type="2"
|
||||||
theme="2"
|
theme="2"
|
||||||
@getOrderDetail="getOrderDetail"
|
@getOrderDetail="getOrderDetail"
|
||||||
|
|||||||
Reference in New Issue
Block a user