feat:申请售后价格展示调整

This commit is contained in:
2026-08-07 14:18:26 +08:00
parent 8ac4d594c0
commit dde77fb6d7
+26 -10
View File
@@ -43,8 +43,8 @@
@tap="state.showModal = true" @tap="state.showModal = true"
> >
<text class="item-title">退款金额</text> <text class="item-title">退款金额</text>
<view class="ss-flex refund-cause ss-col-center"> <view class="ss-flex ss-col-center">
<text class="ss-m-r-20">¥{{ fen2yuan(state.item.payPrice) }}</text> <text class="ss-m-r-20">¥{{ fen2yuan(state.payPrice) }}</text>
</view> </view>
</view> </view>
<!-- 申请原因 --> <!-- 申请原因 -->
@@ -130,6 +130,7 @@
order: {}, // 订单 order: {}, // 订单
item: {}, // 订单项 item: {}, // 订单项
config: {}, // 交易配置 config: {}, // 交易配置
payPrice: 0, // 退款金额:单品取item.payPrice,整单取外层order.payPrice
// 售后类型 // 售后类型
wayList: [ wayList: [
@@ -157,8 +158,8 @@
// 提交表单 // 提交表单
async function submit() { async function submit() {
let data = { let data = {
orderItemId: state.item.id, orderItemId: state.item?.id,
refundPrice: state.item.payPrice, refundPrice: state.payPrice,
...formData, ...formData,
}; };
const { code } = await AfterSaleApi.createAfterSale(data); const { code } = await AfterSaleApi.createAfterSale(data);
@@ -210,22 +211,37 @@
} }
onLoad(async (options) => { onLoad(async (options) => {
// 解析参数 // 解析参数:兼容单品入口(传orderId+itemId)和整单入口(传订单对象即props.data.id)
if (!options.id || !options.id) { const orderId = parseInt(options.orderId || options.id);
const itemId = options.itemId ? parseInt(options.itemId) : 0;
if (!orderId) {
sheep.$helper.toast(`缺少订单信息,请检查`); sheep.$helper.toast(`缺少订单信息,请检查`);
return; return;
} }
state.orderId = options.id; state.orderId = orderId;
state.itemId = parseInt(options.itemId); state.itemId = itemId;
// 读取订单信息 // 读取订单信息
const { code, data } = await OrderApi.getOrderDetail(state.orderId); const { code, data } = await OrderApi.getOrderDetail(state.orderId);
if (code !== 0) { if (code !== 0) {
return; return;
} }
// console.log('aaa',data);
state.order = data; state.order = data;
state.item = data.items.find((item) => item.orderId == state.orderId) || {};
// 按itemId精确查找订单项(单品入口),否则默认取第1项(整单入口仅用于商品卡片展示)
if (state.itemId > 0) {
state.item = data.items.find((item) => item.id === state.itemId) || {};
} else {
state.item = data.items?.[0] || {};
}
// 退款金额:单品用订单项的payPrice,整单使用订单外层的payPrice(含randomDiscountPrice等优惠抵扣后的值)
if (state.itemId > 0 && state.item?.id) {
state.payPrice = state.item.payPrice;
} else {
state.payPrice = state.order.payPrice;
}
// 设置选项 // 设置选项
if (state.order.status === 10) { if (state.order.status === 10) {
state.wayList.splice(1, 1); state.wayList.splice(1, 1);