Merge branch 'v2.2' into v1.8.1
* v2.2: feat: 延迟发货调试 feat: 多规格延迟发货 feat: 店铺订单多规格展示 feat: 延迟发货api
This commit is contained in:
@@ -0,0 +1,518 @@
|
||||
<template>
|
||||
<uni-popup ref="popupRef" :type="popupType" background-color="#fff">
|
||||
<view class="shipment-popup" :class="`shipment-popup--${popupType}`" @tap.stop>
|
||||
<view class="shipment-popup__header">
|
||||
<view>
|
||||
<view class="shipment-popup__title">{{ titleText }}</view>
|
||||
<view class="shipment-popup__order-no">订单号:{{ orderNo || '-' }}</view>
|
||||
<view class="shipment-popup__order-time">下单时间:{{ orderTime || '-' }}</view>
|
||||
</view>
|
||||
<view class="shipment-popup__close" @tap.stop="handleClose">×</view>
|
||||
</view>
|
||||
<view class="shipment-popup__desc">{{ descText }}</view>
|
||||
<scroll-view scroll-y class="shipment-popup__content">
|
||||
<view v-if="renderItems.length === 0" class="shipment-popup__empty">
|
||||
{{ emptyText }}
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="shipment-popup__item"
|
||||
v-for="(item, index) in renderItems"
|
||||
:key="item.itemKey || index"
|
||||
>
|
||||
<image class="shipment-popup__item-image" :src="item.picUrl" mode="aspectFill" />
|
||||
<view class="shipment-popup__item-main">
|
||||
<view class="shipment-popup__item-name lineTwo">{{ item.spuName }}</view>
|
||||
<view class="shipment-popup__item-sku">{{ item.skuText || '-' }}</view>
|
||||
<view class="shipment-popup__item-footer flex-center ju-between">
|
||||
<view class="shipment-popup__item-count">最多可选 x{{ item.maxCount }}</view>
|
||||
<su-number-box
|
||||
v-model="item.selectedCount"
|
||||
:min="0"
|
||||
:max="item.maxCount"
|
||||
:step="1"
|
||||
background="#F6F7FB"
|
||||
color="#333333"
|
||||
@change="onCountChange(index, $event)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="shipment-popup__actions">
|
||||
<view class="shipment-popup__btn shipment-popup__btn--ghost" @tap.stop="handleClose">
|
||||
取消
|
||||
</view>
|
||||
<view class="shipment-popup__btn shipment-popup__btn--primary" @tap.stop="handleSubmit">
|
||||
{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'delay',
|
||||
},
|
||||
popupType: {
|
||||
type: String,
|
||||
default: 'bottom',
|
||||
},
|
||||
orderNo: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
orderTime: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
orderData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
delayRecords: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['close', 'submit']);
|
||||
const popupRef = ref();
|
||||
const innerItems = ref([]);
|
||||
|
||||
const titleText = computed(() => (props.mode === 'now' ? '立即发货' : '延迟发货'));
|
||||
const submitText = computed(() => (props.mode === 'now' ? '确认立即发货' : '确认延迟发货'));
|
||||
const descText = computed(() =>
|
||||
props.mode === 'now' ? '请选择当前延迟商品及立即发货数量' : '请选择当前商品及延迟发货数量',
|
||||
);
|
||||
const emptyText = computed(() =>
|
||||
props.mode === 'now' ? '暂无可立即发货的商品' : '暂无可延迟发货的商品',
|
||||
);
|
||||
|
||||
const getFirstValidValue = (...values) =>
|
||||
values.find((value) => value !== undefined && value !== null && String(value).trim() !== '') ?? '';
|
||||
|
||||
const hasValue = (value) => value !== undefined && value !== null && String(value).trim() !== '';
|
||||
|
||||
const formatSkuPropertyItem = (property) => {
|
||||
const value = getFirstValidValue(
|
||||
property?.valueName,
|
||||
property?.value,
|
||||
property?.specValue,
|
||||
property?.attrValue,
|
||||
property?.optionValue,
|
||||
property?.propertyValue,
|
||||
typeof property === 'string' ? property : '',
|
||||
);
|
||||
const name = getFirstValidValue(
|
||||
property?.name,
|
||||
property?.propertyName,
|
||||
property?.specName,
|
||||
property?.attrName,
|
||||
property?.key,
|
||||
property?.label,
|
||||
);
|
||||
if (name && value) {
|
||||
return `${name} ${value}`;
|
||||
}
|
||||
return value || name || '';
|
||||
};
|
||||
|
||||
const formatSkuProperties = (properties) => {
|
||||
if (typeof properties === 'string' && properties.trim()) {
|
||||
return properties.trim();
|
||||
}
|
||||
const list = Array.isArray(properties) ? properties : [];
|
||||
if (!list.length) {
|
||||
return '';
|
||||
}
|
||||
return list
|
||||
.map((property) => formatSkuPropertyItem(property))
|
||||
.filter(Boolean)
|
||||
.join(' ');
|
||||
};
|
||||
|
||||
const resolveOrderItemId = (item = {}) =>
|
||||
getFirstValidValue(item?.id, item?.orderItemId, item?.itemId, item?.orderGoodsId, item?.goodsId, item?.skuId);
|
||||
|
||||
const resolveDelayItemCount = (item = {}) => {
|
||||
const candidates = [
|
||||
item?.count,
|
||||
item?.remainingCount,
|
||||
item?.availableCount,
|
||||
item?.canCount,
|
||||
item?.maxCount,
|
||||
];
|
||||
const matched = candidates
|
||||
.map((value) => Number(value))
|
||||
.find((value) => Number.isFinite(value) && value > 0);
|
||||
return matched || 0;
|
||||
};
|
||||
|
||||
const resolveDelayRecordId = (item = {}) =>
|
||||
getFirstValidValue(item?.delayRecordId, item?.recordId, item?.id);
|
||||
|
||||
const resolveDelayRecordCount = (item = {}) => {
|
||||
const candidates = [
|
||||
item?.count,
|
||||
item?.delayCount,
|
||||
item?.recordCount,
|
||||
item?.remainingCount,
|
||||
item?.availableCount,
|
||||
item?.canCount,
|
||||
item?.maxCount,
|
||||
];
|
||||
const matched = candidates
|
||||
.map((value) => Number(value))
|
||||
.find((value) => Number.isFinite(value) && value > 0);
|
||||
return matched || 0;
|
||||
};
|
||||
|
||||
const createDelayShipmentItem = (item, parentItem = {}) => {
|
||||
const maxCount = resolveDelayItemCount(item);
|
||||
const orderItemId = resolveOrderItemId(item);
|
||||
const parentOrderItemId = resolveOrderItemId(parentItem);
|
||||
const submitOrderItemId = getFirstValidValue(orderItemId, parentOrderItemId);
|
||||
const skuText = getFirstValidValue(
|
||||
formatSkuProperties(item?.properties || parentItem?.properties),
|
||||
formatSkuProperties(item?.skuProperties || parentItem?.skuProperties),
|
||||
formatSkuProperties(item?.attrs || parentItem?.attrs),
|
||||
formatSkuProperties(item?.specs || parentItem?.specs),
|
||||
formatSkuProperties(item?.specifications || parentItem?.specifications),
|
||||
getFirstValidValue(item?.skuText, parentItem?.skuText),
|
||||
getFirstValidValue(item?.specText, parentItem?.specText),
|
||||
getFirstValidValue(item?.propertiesText, parentItem?.propertiesText),
|
||||
getFirstValidValue(item?.skuDesc, parentItem?.skuDesc),
|
||||
getFirstValidValue(item?.specDesc, parentItem?.specDesc),
|
||||
);
|
||||
return {
|
||||
itemKey: getFirstValidValue(
|
||||
submitOrderItemId,
|
||||
`${item?.spuName || item?.name || parentItem?.spuName || parentItem?.name || ''}_${skuText}_${maxCount}`,
|
||||
),
|
||||
orderItemId,
|
||||
parentOrderItemId,
|
||||
submitOrderItemId,
|
||||
picUrl: item?.picUrl || parentItem?.picUrl || '',
|
||||
spuName: item?.spuName || item?.name || parentItem?.spuName || parentItem?.name || '',
|
||||
skuText,
|
||||
maxCount,
|
||||
selectedCount: maxCount,
|
||||
};
|
||||
};
|
||||
|
||||
const createDelayShipmentItems = (data) => {
|
||||
const sourceItems = Array.isArray(data?.items) ? data.items : [];
|
||||
return sourceItems
|
||||
.flatMap((item) => {
|
||||
const children = Array.isArray(item?.items) ? item.items : [];
|
||||
if (children.length) {
|
||||
return children.filter(Boolean).map((child) => createDelayShipmentItem(child, item));
|
||||
}
|
||||
return [createDelayShipmentItem(item, item)];
|
||||
})
|
||||
.filter((item) => item.maxCount > 0);
|
||||
};
|
||||
|
||||
const createNowShipmentItem = (item) => {
|
||||
const maxCount = resolveDelayRecordCount(item);
|
||||
const delayRecordId = resolveDelayRecordId(item);
|
||||
const skuText = getFirstValidValue(
|
||||
formatSkuProperties(item?.properties),
|
||||
formatSkuProperties(item?.skuProperties),
|
||||
formatSkuProperties(item?.attrs),
|
||||
formatSkuProperties(item?.specs),
|
||||
formatSkuProperties(item?.specifications),
|
||||
getFirstValidValue(item?.skuText, item?.specText, item?.propertiesText),
|
||||
getFirstValidValue(item?.propertiesValue, item?.skuValue),
|
||||
getFirstValidValue(item?.skuDesc, item?.specDesc, item?.specification),
|
||||
getFirstValidValue(item?.sku, item?.specInfo, item?.attrText),
|
||||
);
|
||||
return {
|
||||
itemKey: getFirstValidValue(
|
||||
delayRecordId,
|
||||
`${item?.spuName || item?.name || item?.title || ''}_${skuText}_${maxCount}`,
|
||||
),
|
||||
delayRecordId,
|
||||
picUrl: getFirstValidValue(
|
||||
item?.picUrl,
|
||||
item?.image,
|
||||
item?.imgUrl,
|
||||
item?.thumbnail,
|
||||
item?.pic,
|
||||
item?.cover,
|
||||
item?.spuImage,
|
||||
item?.skuImage,
|
||||
),
|
||||
spuName: getFirstValidValue(
|
||||
item?.spuName,
|
||||
item?.name,
|
||||
item?.title,
|
||||
item?.goodsName,
|
||||
item?.productName,
|
||||
item?.spuTitle,
|
||||
),
|
||||
skuText,
|
||||
maxCount,
|
||||
selectedCount: maxCount,
|
||||
};
|
||||
};
|
||||
|
||||
const createNowShipmentItems = (data) => {
|
||||
const rawExternal = Array.isArray(props.delayRecords) && props.delayRecords.length > 0
|
||||
? props.delayRecords
|
||||
: [];
|
||||
const rawFromData = Array.isArray(data?.delayRecords)
|
||||
? data.delayRecords
|
||||
: Array.isArray(data?.delayRecordList)
|
||||
? data.delayRecordList
|
||||
: [];
|
||||
const raw = rawExternal.length > 0 ? rawExternal : rawFromData;
|
||||
return raw
|
||||
.filter(Boolean)
|
||||
.filter((item) => {
|
||||
const status = Number(item?.status);
|
||||
if (!status) return true;
|
||||
return status === 1;
|
||||
})
|
||||
.map((item) => createNowShipmentItem(item))
|
||||
.filter((item) => item.maxCount > 0);
|
||||
};
|
||||
|
||||
const renderItems = computed(() => innerItems.value || []);
|
||||
|
||||
const open = () => {
|
||||
const nextItems = props.mode === 'now' ? createNowShipmentItems(props.orderData) : createDelayShipmentItems(props.orderData);
|
||||
innerItems.value = nextItems;
|
||||
if (!popupRef.value || typeof popupRef.value.open !== 'function') {
|
||||
uni.showToast({
|
||||
title: '弹窗组件初始化失败,请重试',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
popupRef.value.open();
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
if (popupRef.value && typeof popupRef.value.close === 'function') {
|
||||
popupRef.value.close();
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close');
|
||||
close();
|
||||
};
|
||||
|
||||
const onCountChange = (index, value) => {
|
||||
const current = innerItems.value[index];
|
||||
if (!current) return;
|
||||
const next = Number(value);
|
||||
if (!Number.isFinite(next)) {
|
||||
current.selectedCount = 0;
|
||||
return;
|
||||
}
|
||||
current.selectedCount = Math.min(current.maxCount, Math.max(0, next));
|
||||
};
|
||||
|
||||
const buildSubmitPayload = () => {
|
||||
if (props.mode === 'now') {
|
||||
const hasSelectedCount = innerItems.value.some((item) => Number(item.selectedCount) > 0);
|
||||
const items = innerItems.value
|
||||
.filter((item) => Number(item.selectedCount) > 0 && hasValue(item.delayRecordId))
|
||||
.map((item) => ({
|
||||
delayRecordId: item.delayRecordId,
|
||||
count: Number(item.selectedCount),
|
||||
}));
|
||||
return {
|
||||
hasSelectedCount,
|
||||
items,
|
||||
emptyTitle: hasSelectedCount ? '订单商品信息异常' : '请选择立即发货数量',
|
||||
};
|
||||
}
|
||||
const hasSelectedCount = innerItems.value.some((item) => Number(item.selectedCount) > 0);
|
||||
const items = innerItems.value
|
||||
.filter((item) => Number(item.selectedCount) > 0 && hasValue(item.submitOrderItemId))
|
||||
.map((item) => ({
|
||||
orderItemId: item.submitOrderItemId,
|
||||
count: Number(item.selectedCount),
|
||||
}));
|
||||
return {
|
||||
hasSelectedCount,
|
||||
items,
|
||||
emptyTitle: hasSelectedCount ? '订单商品信息异常' : '请选择延迟发货数量',
|
||||
};
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
const payload = buildSubmitPayload();
|
||||
if (!payload.items.length) {
|
||||
uni.showToast({
|
||||
title: payload.emptyTitle,
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: props.mode,
|
||||
items: payload.items,
|
||||
close,
|
||||
});
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.shipment-popup {
|
||||
background: #ffffff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.shipment-popup--bottom {
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
padding: 32rpx 24rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.shipment-popup--center {
|
||||
width: 680rpx;
|
||||
max-height: 78vh;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.shipment-popup__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.shipment-popup__title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.shipment-popup__order-no {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
color: #999999;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.shipment-popup__order-time {
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.shipment-popup__close {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 50%;
|
||||
background: #f3f4f6;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
font-size: 36rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.shipment-popup__desc {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.shipment-popup__content {
|
||||
max-height: 720rpx;
|
||||
}
|
||||
|
||||
.shipment-popup__item {
|
||||
display: flex;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
}
|
||||
|
||||
.shipment-popup__item-image {
|
||||
width: 144rpx;
|
||||
height: 144rpx;
|
||||
border-radius: 12rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.shipment-popup__item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.shipment-popup__item-name {
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.shipment-popup__item-sku {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.shipment-popup__item-footer {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.shipment-popup__item-count {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.shipment-popup__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.shipment-popup__btn {
|
||||
flex: 1;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
text-align: center;
|
||||
border-radius: 42rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.shipment-popup__btn--ghost {
|
||||
background: #f2f3f5;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.shipment-popup__btn--primary {
|
||||
background: linear-gradient(135deg, #fa8735 0%, #fe3b48 100%);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.shipment-popup__empty {
|
||||
padding: 40rpx 24rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
@@ -1,17 +1,10 @@
|
||||
<template>
|
||||
<view class="order_con" :class="{ bg24: props.theme == 2 }">
|
||||
<view
|
||||
class="flex-center ju-between m-b-28"
|
||||
v-if="(props.type == 2 || props.type == 4) && props.data.logisticsNo"
|
||||
>
|
||||
<view class="flex-center ju-between m-b-28" v-if="(props.type == 2 || props.type == 4) && props.data.logisticsNo">
|
||||
<view>{{ props.data.logisticsName }} {{ props.data.logisticsNo }}</view>
|
||||
<view class="flex-center">
|
||||
<view @click.stop="onCopy(props.data.logisticsNo)">复制</view>
|
||||
<truckLine
|
||||
:data="props.data"
|
||||
:code="2"
|
||||
v-if="props.data.deliveryTime && props.data.logisticsNo"
|
||||
></truckLine>
|
||||
<truckLine :data="props.data" :code="2" v-if="props.data.deliveryTime && props.data.logisticsNo"></truckLine>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -31,37 +24,101 @@
|
||||
:class="{ 'p-r-10': props.type == 3, c0: props.theme == 2 }"
|
||||
>
|
||||
{{ v.spuName }}
|
||||
<text v-if="!isCompletedOrder && getSpuDelayInfo(v).delayed" class="delay-tag delay-tag--spu">
|
||||
已延迟 {{ getSpuDelayInfo(v).text }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="shrink price" v-if="props.type != 4 && !showMultiSku(v)">
|
||||
<span class="size24">¥</span>
|
||||
<span class="size36" style="font-weight: 600">{{ fen2yuan(v.price) }}</span>
|
||||
</view>
|
||||
<view class="shrink price" v-if="props.type != 4"
|
||||
><span class="size24">¥</span
|
||||
><span class="size36" style="font-weight: 600">{{ fen2yuan(v.price) }}</span></view
|
||||
>
|
||||
</view>
|
||||
<view v-if="props.type == 4">
|
||||
<view class="m-b-12 size24 h_52" v-for="(item, i) in v.items" :key="i">
|
||||
<view class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
|
||||
<view class="m-b-12" v-for="(item, i) in v.items" :key="i">
|
||||
<view class="size24 flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
|
||||
<view class="lineOne c19">
|
||||
{{ formatSkuProperties(item?.properties) }}
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="c19">x{{ item.count }}</view>
|
||||
<view class="size28 m-l-12 weight900"
|
||||
>¥<span class="">{{ fen2yuan(item.price) }}</span>
|
||||
<view class="size28 m-l-12 weight900">
|
||||
¥<span class="">{{ fen2yuan(item.price) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="c13 size28 weight900">
|
||||
<view
|
||||
class="delay-record-line"
|
||||
:class="`delay-record-line--status-${resolveDelayStatus(record)}`"
|
||||
v-for="(record, recordIndex) in getSkuDelayRecords(v, item)"
|
||||
:key="recordIndex"
|
||||
>
|
||||
<view class="delay-record-line__dot" />
|
||||
<view class="delay-record-line__text">
|
||||
{{ getDelayRecordSkuText(record) }}
|
||||
</view>
|
||||
<view class="delay-record-line__meta">
|
||||
<text class="delay-record-line__status">{{ getDelayStatusText(record) }}</text>
|
||||
<text class="delay-record-line__count">x{{ getDelayRecordCount(record) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="c13 size28 weight900 m-t-4">
|
||||
¥<span class="size40">{{ fen2yuan(item.payPrice) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else-if="showMultiSku(v)" class="multi-sku-list">
|
||||
<view class="multi-sku-item m-b-12" v-for="(item, itemIndex) in v.items" :key="item.id || itemIndex">
|
||||
<view class="multi-sku-row flex1 flex-center ju-between bg18 radius8 p-l-8 p-r-16">
|
||||
<view class="multi-sku-text lineOne c19">
|
||||
{{ formatSkuProperties(item?.properties) }}
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="c19">x{{ item.count }}</view>
|
||||
<view class="size28 m-l-12 weight900">
|
||||
¥<span>{{ fen2yuan(item.payPrice || item.price) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="delay-record-line delay-record-line--nested"
|
||||
:class="`delay-record-line--status-${resolveDelayStatus(record)}`"
|
||||
v-for="(record, recordIndex) in getSkuDelayRecords(v, item)"
|
||||
:key="recordIndex"
|
||||
>
|
||||
<view class="delay-record-line__dot" />
|
||||
<view class="delay-record-line__text">
|
||||
{{ getDelayRecordSkuText(record) }}
|
||||
</view>
|
||||
<view class="delay-record-line__meta">
|
||||
<text class="delay-record-line__status">{{ getDelayStatusText(record) }}</text>
|
||||
<text class="delay-record-line__count">x{{ getDelayRecordCount(record) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between" :class="{ 'm-t-8': props.type == 3 }" v-else>
|
||||
<view class="valueName size28" :class="{ c19: props.theme == 2 }">{{
|
||||
formatSkuProperties(v.properties)
|
||||
}}</view>
|
||||
<view class="shrink size28 c_333" :class="{ c0: props.theme == 2 }">{{
|
||||
`x${v.count}`
|
||||
}}</view>
|
||||
<view class="valueName size28" :class="{ c19: props.theme == 2 }">
|
||||
{{ formatSkuProperties(v.properties) }}
|
||||
</view>
|
||||
<view class="shrink size28 c_333" :class="{ c0: props.theme == 2 }">
|
||||
{{ `x${v.count}` }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="!hasNestedSkuBlock(v)"
|
||||
class="delay-record-line delay-record-line--single"
|
||||
:class="`delay-record-line--status-${resolveDelayStatus(record)}`"
|
||||
v-for="(record, recordIndex) in getSkuDelayRecords(v, v)"
|
||||
:key="`single-${recordIndex}`"
|
||||
>
|
||||
<view class="delay-record-line__dot" />
|
||||
<view class="delay-record-line__text">
|
||||
{{ getDelayRecordSkuText(record) }}
|
||||
</view>
|
||||
<view class="delay-record-line__meta">
|
||||
<text class="delay-record-line__status">{{ getDelayStatusText(record) }}</text>
|
||||
<text class="delay-record-line__count">x{{ getDelayRecordCount(record) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn flex-row ju-flex-end" v-if="props.type == 2">
|
||||
<button
|
||||
@@ -87,7 +144,7 @@
|
||||
>
|
||||
取消售后
|
||||
</view>
|
||||
<view class="btnItem" v-if="v.afterSaleStatus === 20"> 售后成功 </view>
|
||||
<view class="btnItem" v-if="v.afterSaleStatus === 20">售后成功</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -95,11 +152,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, getCurrentInstance, defineProps } from 'vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { computed, defineProps } from 'vue';
|
||||
import { fen2yuan, formatOrderStatus } from '@/sheep/hooks/useGoods';
|
||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let emit = defineEmits(['getOrderDetail']);
|
||||
const formatSkuProperties = (properties: any) => {
|
||||
const list = Array.isArray(properties) ? properties : [];
|
||||
@@ -108,6 +164,18 @@
|
||||
.filter(Boolean)
|
||||
.join(' ');
|
||||
};
|
||||
const showMultiSku = (item: any) => {
|
||||
return (
|
||||
['2', '3'].includes(props.type) &&
|
||||
[String(props.source), String(props.data?.__source)].includes('aishop') &&
|
||||
Array.isArray(item?.items) &&
|
||||
item.items.length > 1
|
||||
);
|
||||
};
|
||||
const hasNestedSkuBlock = (item: any) => {
|
||||
if (props.type == 4) return true;
|
||||
return showMultiSku(item);
|
||||
};
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -117,19 +185,355 @@
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '0', //0列表2订单详情 3订单列表 4ai订单详情
|
||||
default: '0',
|
||||
},
|
||||
source: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: '2', //1浅色 2深色
|
||||
default: '2',
|
||||
},
|
||||
delayRecords: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
});
|
||||
const cancelAfterSale = (v) => {
|
||||
|
||||
const isAiStoreOrder = computed(() =>
|
||||
[String(props.source), String(props.data?.__source)].includes('aishop'),
|
||||
);
|
||||
|
||||
const orderStatusText = computed(() => {
|
||||
try {
|
||||
return formatOrderStatus(props.data || {});
|
||||
} catch (e) {
|
||||
const status = Number(props.data?.status);
|
||||
if (status === 30) return '已完成';
|
||||
return '';
|
||||
}
|
||||
});
|
||||
const isCompletedOrder = computed(() => orderStatusText.value === '已完成');
|
||||
|
||||
const hasDelayRecords = computed(() => {
|
||||
if (isCompletedOrder.value) return false;
|
||||
if (!isAiStoreOrder.value) return false;
|
||||
if (Array.isArray(props.delayRecords) && props.delayRecords.length > 0) {
|
||||
return true;
|
||||
}
|
||||
const records = Array.isArray(props.data?.delayRecords)
|
||||
? props.data.delayRecords
|
||||
: Array.isArray(props.data?.delayRecordList)
|
||||
? props.data.delayRecordList
|
||||
: [];
|
||||
return records.length > 0;
|
||||
});
|
||||
|
||||
const delayRecords = computed(() => {
|
||||
if (!hasDelayRecords.value) return [];
|
||||
if (Array.isArray(props.delayRecords) && props.delayRecords.length > 0) {
|
||||
return props.delayRecords;
|
||||
}
|
||||
return Array.isArray(props.data?.delayRecords)
|
||||
? props.data.delayRecords
|
||||
: Array.isArray(props.data?.delayRecordList)
|
||||
? props.data.delayRecordList
|
||||
: [];
|
||||
});
|
||||
|
||||
const DELAY_STATUS_MAP = {
|
||||
1: { text: '延迟中', color: '#FA7E31' },
|
||||
2: { text: '已激活(待发货)', color: '#1AAD19' },
|
||||
3: { text: '已发货', color: '#1677FF' },
|
||||
4: { text: '已收货', color: '#999999' },
|
||||
};
|
||||
|
||||
const resolveDelayStatus = (record: any) => {
|
||||
const status = Number(record?.status);
|
||||
if ([1, 2, 3, 4].includes(status)) return status;
|
||||
return 0;
|
||||
};
|
||||
|
||||
const getDelayStatusText = (record: any) => {
|
||||
const status = resolveDelayStatus(record);
|
||||
const fallback = getFirstValidValue(record?.statusDesc, '');
|
||||
if (DELAY_STATUS_MAP[status]) {
|
||||
return DELAY_STATUS_MAP[status].text;
|
||||
}
|
||||
return fallback || '延迟中';
|
||||
};
|
||||
|
||||
const getFirstValidValue = (...values: any[]) =>
|
||||
values.find((value) => value !== undefined && value !== null && String(value).trim() !== '') ?? '';
|
||||
|
||||
const getNumber = (value: any) => {
|
||||
const n = Number(value);
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
};
|
||||
|
||||
const resolveItemId = (item: any) =>
|
||||
getFirstValidValue(item?.orderItemId, item?.itemId, item?.orderGoodsId, item?.id);
|
||||
|
||||
const resolveRecordItemId = (record: any) =>
|
||||
getFirstValidValue(record?.orderItemId, record?.itemId, record?.orderGoodsId);
|
||||
|
||||
const resolveRecordCount = (record: any) => {
|
||||
const candidates = [
|
||||
record?.count,
|
||||
record?.delayCount,
|
||||
record?.recordCount,
|
||||
record?.remainingCount,
|
||||
record?.availableCount,
|
||||
record?.canCount,
|
||||
record?.maxCount,
|
||||
];
|
||||
const matched = candidates.map((value) => getNumber(value)).find((value) => value > 0);
|
||||
return matched || 0;
|
||||
};
|
||||
|
||||
const isSameSku = (item: any, record: any) => {
|
||||
const itemProps = Array.isArray(item?.properties)
|
||||
? item.properties
|
||||
: Array.isArray(item?.skuProperties)
|
||||
? item.skuProperties
|
||||
: Array.isArray(item?.attrs)
|
||||
? item.attrs
|
||||
: [];
|
||||
const recordProps = Array.isArray(record?.properties)
|
||||
? record.properties
|
||||
: Array.isArray(record?.skuProperties)
|
||||
? record.skuProperties
|
||||
: Array.isArray(record?.attrs)
|
||||
? record.attrs
|
||||
: [];
|
||||
if (itemProps.length && recordProps.length && itemProps.length === recordProps.length) {
|
||||
const itemKey = itemProps
|
||||
.map((p) => `${getFirstValidValue(p?.valueName, p?.value)}`)
|
||||
.filter(Boolean)
|
||||
.join('|');
|
||||
const recordKey = recordProps
|
||||
.map((p) => `${getFirstValidValue(p?.valueName, p?.value)}`)
|
||||
.filter(Boolean)
|
||||
.join('|');
|
||||
if (itemKey && recordKey) {
|
||||
return itemKey === recordKey;
|
||||
}
|
||||
if (itemKey || recordKey) {
|
||||
return false;
|
||||
}
|
||||
} else if (itemProps.length || recordProps.length) {
|
||||
return false;
|
||||
}
|
||||
const itemSkuText = getFirstValidValue(
|
||||
item?.skuText,
|
||||
item?.specText,
|
||||
item?.propertiesText,
|
||||
item?.skuDesc,
|
||||
item?.specDesc,
|
||||
);
|
||||
const recordSkuText = getFirstValidValue(
|
||||
record?.skuText,
|
||||
record?.specText,
|
||||
record?.propertiesText,
|
||||
formatSkuProperties(record?.properties),
|
||||
formatSkuProperties(record?.skuProperties),
|
||||
formatSkuProperties(record?.attrs),
|
||||
record?.skuDesc,
|
||||
record?.specDesc,
|
||||
);
|
||||
if (itemSkuText && recordSkuText) {
|
||||
return itemSkuText === recordSkuText;
|
||||
}
|
||||
if (itemSkuText || recordSkuText) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const resolveRecordUniqueId = (record: any) =>
|
||||
getFirstValidValue(record?.id, record?.delayRecordId, record?.recordId);
|
||||
|
||||
const uniqueByRecordId = (records: any[]) => {
|
||||
const map = new Map();
|
||||
(records || []).forEach((record) => {
|
||||
const key = resolveRecordUniqueId(record) || JSON.stringify(record);
|
||||
if (!map.has(key)) {
|
||||
map.set(key, record);
|
||||
}
|
||||
});
|
||||
return Array.from(map.values());
|
||||
};
|
||||
|
||||
const buildSpuRecordAssignment = (spuItem: any) => {
|
||||
if (!hasDelayRecords.value) {
|
||||
return { spuRecords: [], skuMap: new Map() };
|
||||
}
|
||||
const skuItems = Array.isArray(spuItem?.items) && spuItem.items.length > 0 ? spuItem.items : [spuItem];
|
||||
const targetSpuId = getFirstValidValue(spuItem?.spuId, spuItem?.productId, spuItem?.goodsId);
|
||||
const targetSpuName = getFirstValidValue(
|
||||
spuItem?.spuName,
|
||||
spuItem?.name,
|
||||
spuItem?.goodsName,
|
||||
spuItem?.productName,
|
||||
);
|
||||
const matchSpuIdentity = (record: any) => {
|
||||
const recordSpuId = getFirstValidValue(record?.spuId, record?.productId, record?.goodsId);
|
||||
if (targetSpuId && recordSpuId) {
|
||||
return String(targetSpuId) === String(recordSpuId);
|
||||
}
|
||||
const recordSpuName = getFirstValidValue(
|
||||
record?.spuName,
|
||||
record?.name,
|
||||
record?.goodsName,
|
||||
record?.productName,
|
||||
);
|
||||
if (targetSpuName && recordSpuName) {
|
||||
return String(targetSpuName).trim() === String(recordSpuName).trim();
|
||||
}
|
||||
if (targetSpuId || recordSpuId) return false;
|
||||
return false;
|
||||
};
|
||||
const spuRecordsRaw = delayRecords.value.filter((record) => {
|
||||
if (!matchSpuIdentity(record)) return false;
|
||||
const recordItemId = resolveRecordItemId(record);
|
||||
const spuItemId = resolveItemId(spuItem);
|
||||
if (recordItemId && spuItemId && String(recordItemId) === String(spuItemId)) {
|
||||
return true;
|
||||
}
|
||||
const anySkuMatched = skuItems.some((skuItem) => {
|
||||
const skuItemId = resolveItemId(skuItem);
|
||||
if (recordItemId && skuItemId && String(recordItemId) === String(skuItemId)) {
|
||||
return true;
|
||||
}
|
||||
return isSameSku(skuItem, record);
|
||||
});
|
||||
return anySkuMatched;
|
||||
});
|
||||
const spuRecords = uniqueByRecordId(spuRecordsRaw);
|
||||
const skuMap = new Map();
|
||||
skuItems.forEach((skuItem, idx) => {
|
||||
const key = resolveItemId(skuItem) || `sku-${idx}`;
|
||||
skuMap.set(key, []);
|
||||
});
|
||||
const usedRecordKeys = new Set();
|
||||
const assignRecordToSku = (record: any, skuItem: any, skuIdx: number) => {
|
||||
const key = resolveRecordUniqueId(record) || JSON.stringify(record);
|
||||
if (usedRecordKeys.has(key)) return false;
|
||||
const skuKey = resolveItemId(skuItem) || `sku-${skuIdx}`;
|
||||
if (!skuMap.has(skuKey)) {
|
||||
skuMap.set(skuKey, []);
|
||||
}
|
||||
skuMap.get(skuKey).push(record);
|
||||
usedRecordKeys.add(key);
|
||||
return true;
|
||||
};
|
||||
|
||||
spuRecords.forEach((record) => {
|
||||
const recordItemId = resolveRecordItemId(record);
|
||||
if (!recordItemId) return;
|
||||
const matchedIndex = skuItems.findIndex((skuItem) => {
|
||||
const skuItemId = resolveItemId(skuItem);
|
||||
return !!(skuItemId && String(recordItemId) === String(skuItemId));
|
||||
});
|
||||
if (matchedIndex >= 0) {
|
||||
assignRecordToSku(record, skuItems[matchedIndex], matchedIndex);
|
||||
}
|
||||
});
|
||||
|
||||
spuRecords.forEach((record) => {
|
||||
const key = resolveRecordUniqueId(record) || JSON.stringify(record);
|
||||
if (usedRecordKeys.has(key)) return;
|
||||
const matchedIndex = skuItems.findIndex((skuItem) => isSameSku(skuItem, record));
|
||||
if (matchedIndex >= 0) {
|
||||
assignRecordToSku(record, skuItems[matchedIndex], matchedIndex);
|
||||
}
|
||||
});
|
||||
|
||||
spuRecords.forEach((record) => {
|
||||
const key = resolveRecordUniqueId(record) || JSON.stringify(record);
|
||||
if (usedRecordKeys.has(key)) return;
|
||||
if (skuItems.length === 1 && matchSpuIdentity(record)) {
|
||||
assignRecordToSku(record, skuItems[0], 0);
|
||||
}
|
||||
});
|
||||
return { spuRecords, skuMap };
|
||||
};
|
||||
|
||||
const findMatchedRecords = (spuItem: any, skuItem?: any) => {
|
||||
if (!hasDelayRecords.value) return [];
|
||||
const target = skuItem || spuItem;
|
||||
const { skuMap, spuRecords } = buildSpuRecordAssignment(spuItem);
|
||||
const skuItems = Array.isArray(spuItem?.items) && spuItem.items.length > 0 ? spuItem.items : [spuItem];
|
||||
const targetIndex = skuItems.findIndex((item) => item === target);
|
||||
if (targetIndex >= 0) {
|
||||
const skuKey = resolveItemId(target) || `sku-${targetIndex}`;
|
||||
return uniqueByRecordId(skuMap.get(skuKey) || []);
|
||||
}
|
||||
return spuRecords;
|
||||
};
|
||||
|
||||
const sumDelayCount = (records: any[]) =>
|
||||
records.reduce((sum, record) => sum + resolveRecordCount(record), 0);
|
||||
|
||||
const getSpuDelayInfo = (spuItem: any) => {
|
||||
if (!isAiStoreOrder.value || !hasDelayRecords.value) {
|
||||
return { delayed: false, count: 0, text: '' };
|
||||
}
|
||||
const { spuRecords } = buildSpuRecordAssignment(spuItem);
|
||||
const count = sumDelayCount(spuRecords);
|
||||
if (!count) {
|
||||
return { delayed: false, count: 0, text: '' };
|
||||
}
|
||||
return { delayed: true, count, text: `${count}件` };
|
||||
};
|
||||
|
||||
const getSkuDelayRecords = (spuItem: any, skuItem: any) => {
|
||||
if (!isAiStoreOrder.value || !hasDelayRecords.value || !skuItem) return [];
|
||||
const skuItems = Array.isArray(spuItem?.items) && spuItem.items.length > 0 ? spuItem.items : [spuItem];
|
||||
const targetIndex = skuItems.findIndex((item) => item === skuItem);
|
||||
if (targetIndex < 0) {
|
||||
if (skuItem === spuItem && skuItems.length === 1) {
|
||||
return findMatchedRecords(spuItem, skuItem);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
return findMatchedRecords(spuItem, skuItem);
|
||||
};
|
||||
|
||||
const getDelayRecordCount = (record: any) => resolveRecordCount(record) || 0;
|
||||
|
||||
const getDelayRecordSkuText = (record: any) => {
|
||||
const text = getFirstValidValue(
|
||||
formatSkuProperties(record?.properties),
|
||||
formatSkuProperties(record?.skuProperties),
|
||||
formatSkuProperties(record?.attrs),
|
||||
formatSkuProperties(record?.specs),
|
||||
formatSkuProperties(record?.specifications),
|
||||
getFirstValidValue(
|
||||
record?.skuText,
|
||||
record?.specText,
|
||||
record?.propertiesText,
|
||||
record?.propertiesValue,
|
||||
record?.skuValue,
|
||||
),
|
||||
getFirstValidValue(record?.skuDesc, record?.specDesc, record?.specification),
|
||||
getFirstValidValue(record?.sku, record?.specInfo, record?.attrText),
|
||||
);
|
||||
if (text && String(text).trim()) {
|
||||
return text;
|
||||
}
|
||||
return getFirstValidValue(record?.spuName, record?.name, record?.goodsName, record?.productName);
|
||||
};
|
||||
|
||||
const cancelAfterSale = (v: any) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消此申请吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
success: async function (res: any) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
@@ -143,10 +547,11 @@
|
||||
const getOrderDetail = () => {
|
||||
emit('getOrderDetail');
|
||||
};
|
||||
const onCopy = (text) => {
|
||||
const onCopy = (text: any) => {
|
||||
sheep.$helper.copyText(text);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.order_con {
|
||||
.con_item {
|
||||
@@ -175,6 +580,209 @@
|
||||
}
|
||||
}
|
||||
|
||||
.delay-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2rpx 12rpx;
|
||||
margin-left: 10rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #FFF4EA;
|
||||
color: #FA7E31;
|
||||
font-size: 20rpx;
|
||||
line-height: 30rpx;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.delay-tag--spu {
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
|
||||
.delay-tag--sku {
|
||||
font-size: 20rpx;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.multi-sku-list {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.multi-sku-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.multi-sku-row {
|
||||
height: 52rpx;
|
||||
}
|
||||
|
||||
.multi-sku-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #777777;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.delay-record-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 8rpx 10rpx 28rpx;
|
||||
margin-top: 8rpx;
|
||||
background: #FFF4EA;
|
||||
border-radius: 8rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.delay-record-line--status-1 {
|
||||
background: #FFF4EA;
|
||||
}
|
||||
|
||||
.delay-record-line--status-2 {
|
||||
background: #E8F9E7;
|
||||
}
|
||||
|
||||
.delay-record-line--status-3 {
|
||||
background: #E8F1FF;
|
||||
}
|
||||
|
||||
.delay-record-line--status-4 {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
.delay-record-line--status-0 {
|
||||
background: #FFF4EA;
|
||||
}
|
||||
|
||||
.delay-record-line--nested {
|
||||
margin-left: 8rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.delay-record-line--single {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.delay-record-line__dot {
|
||||
position: absolute;
|
||||
left: 12rpx;
|
||||
top: 50%;
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 50%;
|
||||
background: #FA7E31;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.delay-record-line--status-2 .delay-record-line__dot {
|
||||
background: #1AAD19;
|
||||
}
|
||||
|
||||
.delay-record-line--status-3 .delay-record-line__dot {
|
||||
background: #1677FF;
|
||||
}
|
||||
|
||||
.delay-record-line--status-4 .delay-record-line__dot {
|
||||
background: #999999;
|
||||
}
|
||||
|
||||
.delay-record-line--status-0 .delay-record-line__dot {
|
||||
background: #FA7E31;
|
||||
}
|
||||
|
||||
.delay-record-line__text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
color: #FA7E31;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.delay-record-line--status-2 .delay-record-line__text {
|
||||
color: #1AAD19;
|
||||
}
|
||||
|
||||
.delay-record-line--status-3 .delay-record-line__text {
|
||||
color: #1677FF;
|
||||
}
|
||||
|
||||
.delay-record-line--status-4 .delay-record-line__text {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.delay-record-line--status-0 .delay-record-line__text {
|
||||
color: #FA7E31;
|
||||
}
|
||||
|
||||
.delay-record-line__meta {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin-left: 12rpx;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.delay-record-line__status {
|
||||
font-size: 20rpx;
|
||||
line-height: 30rpx;
|
||||
padding: 2rpx 12rpx;
|
||||
border-radius: 16rpx;
|
||||
background: rgba(250, 126, 49, 0.1);
|
||||
color: #FA7E31;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.delay-record-line--status-2 .delay-record-line__status {
|
||||
background: rgba(26, 173, 25, 0.1);
|
||||
color: #1AAD19;
|
||||
}
|
||||
|
||||
.delay-record-line--status-3 .delay-record-line__status {
|
||||
background: rgba(22, 119, 255, 0.1);
|
||||
color: #1677FF;
|
||||
}
|
||||
|
||||
.delay-record-line--status-4 .delay-record-line__status {
|
||||
background: rgba(153, 153, 153, 0.1);
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.delay-record-line--status-0 .delay-record-line__status {
|
||||
background: rgba(250, 126, 49, 0.1);
|
||||
color: #FA7E31;
|
||||
}
|
||||
|
||||
.delay-record-line__count {
|
||||
flex-shrink: 0;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #FA7E31;
|
||||
}
|
||||
|
||||
.delay-record-line--status-2 .delay-record-line__count {
|
||||
color: #1AAD19;
|
||||
}
|
||||
|
||||
.delay-record-line--status-3 .delay-record-line__count {
|
||||
color: #1677FF;
|
||||
}
|
||||
|
||||
.delay-record-line--status-4 .delay-record-line__count {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.delay-record-line--status-0 .delay-record-line__count {
|
||||
color: #FA7E31;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
|
||||
+624
-399
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,8 @@
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
source="aishop"
|
||||
:delay-records="state.delayRecords"
|
||||
type="4"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
></card_order>
|
||||
@@ -151,6 +153,7 @@
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
delayRecords: [],
|
||||
});
|
||||
let statusObj = ref({
|
||||
0: {
|
||||
@@ -229,6 +232,20 @@
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
if (orderId.value) {
|
||||
try {
|
||||
const delayRes = await OrderApi.getAiOrderDelayRecords({ orderId: orderId.value });
|
||||
if (delayRes.code === 0 && Array.isArray(delayRes.data)) {
|
||||
state.delayRecords = delayRes.data;
|
||||
} else {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} catch (e) {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} else {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
+271
-3
@@ -26,6 +26,8 @@
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
:source="state.source"
|
||||
:delay-records="state.delayRecords"
|
||||
type="2"
|
||||
theme="2"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
@@ -102,7 +104,7 @@
|
||||
<AiOrderActionBar
|
||||
v-if="isAiActionOrder"
|
||||
:status="Number(state.orderInfo.status)"
|
||||
:disableDelayShipment="isPickUpOrder"
|
||||
:disableDelayShipment="isPickUpOrder || !isAiStoreOrder"
|
||||
@delay="delayShipment"
|
||||
@now="nowShipment"
|
||||
@confirm="confirmReceiveOrder"
|
||||
@@ -117,6 +119,27 @@
|
||||
></card_orderBan>
|
||||
</view>
|
||||
</su-fixed>
|
||||
<ShipmentPopup
|
||||
ref="nowShipmentPopupRef"
|
||||
mode="now"
|
||||
popup-type="center"
|
||||
:order-no="state.orderInfo.no || ''"
|
||||
:order-time="formatCreateTime(state.orderInfo.createTime) || ''"
|
||||
:order-data="state.orderInfo"
|
||||
:delay-records="state.delayRecords"
|
||||
@close="closeNowShipmentPopup"
|
||||
@submit="handleNowShipmentSubmit"
|
||||
/>
|
||||
<ShipmentPopup
|
||||
ref="delayShipmentPopupRef"
|
||||
mode="delay"
|
||||
popup-type="center"
|
||||
:order-no="state.orderInfo.no || ''"
|
||||
:order-time="formatCreateTime(state.orderInfo.createTime) || ''"
|
||||
:order-data="state.orderInfo"
|
||||
@close="closeDelayShipmentPopup"
|
||||
@submit="handleDelayShipmentSubmit"
|
||||
/>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
@@ -135,10 +158,12 @@
|
||||
getOpenOrderDetail,
|
||||
cancelOrder as cancelAiOrderRequest,
|
||||
cancelOpenOrder,
|
||||
getAiOrderDelayRecords,
|
||||
} from '@/sheep/api/ai';
|
||||
import StoreApi from '@/sheep/api/trade/store';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
|
||||
import ShipmentPopup from '@/components/orderItem/ShipmentPopup.vue';
|
||||
import truckLine from '@/components/truckLine/truckLine.vue';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
|
||||
@@ -150,6 +175,7 @@
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
orderType: '',
|
||||
source: '',
|
||||
delayRecords: [],
|
||||
});
|
||||
|
||||
// ========== 门店自提(核销) ==========
|
||||
@@ -159,6 +185,13 @@
|
||||
const onCopy = () => {
|
||||
sheep.$helper.copyText(state.orderInfo.no);
|
||||
};
|
||||
const formatCreateTime = (value) => {
|
||||
if (!value) return '';
|
||||
const s = sheep?.$helper?.timeFormat
|
||||
? sheep.$helper.timeFormat(value, 'yyyy-mm-dd hh:MM:ss')
|
||||
: String(value);
|
||||
return s || '';
|
||||
};
|
||||
|
||||
const pickUpVerifyRef = ref();
|
||||
|
||||
@@ -185,6 +218,7 @@
|
||||
if (!isAiActionOrder.value) return true;
|
||||
const status = Number(state.orderInfo?.status);
|
||||
if ([0, 20].includes(status)) return true;
|
||||
if (!isAiStoreOrder.value) return false;
|
||||
if (isPickUpOrder.value) return false;
|
||||
return [10, 50, 70].includes(status);
|
||||
});
|
||||
@@ -206,9 +240,78 @@
|
||||
const resolveAiOrderId = (data) => {
|
||||
return data?.id || data?.orderId;
|
||||
};
|
||||
const isAiStoreOrder = computed(() => {
|
||||
return String(state.source) === 'aishop' || String(state.orderInfo?.__source) === 'aishop';
|
||||
});
|
||||
const delayShipmentPopupRef = ref();
|
||||
const nowShipmentPopupRef = ref();
|
||||
const closeDelayShipmentPopup = () => {};
|
||||
const closeNowShipmentPopup = () => {};
|
||||
|
||||
const openDelayShipmentPopup = () => {
|
||||
const id = resolveAiOrderId(state.orderInfo);
|
||||
if (!id) {
|
||||
uni.showToast({
|
||||
title: '订单信息异常',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
delayShipmentPopupRef.value?.open();
|
||||
};
|
||||
const openNowShipmentPopup = () => {
|
||||
const id = resolveAiOrderId(state.orderInfo);
|
||||
if (!id) {
|
||||
uni.showToast({
|
||||
title: '订单信息异常',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
nowShipmentPopupRef.value?.open();
|
||||
};
|
||||
|
||||
const handleDelayShipmentSubmit = async ({ items, close }) => {
|
||||
const orderId = resolveAiOrderId(state.orderInfo);
|
||||
if (!orderId || !Array.isArray(items) || items.length === 0) {
|
||||
return;
|
||||
}
|
||||
const { code } = await aiDelayedShipment({
|
||||
orderId,
|
||||
items,
|
||||
});
|
||||
if (code === 0) {
|
||||
close?.();
|
||||
getOrderDetail();
|
||||
}
|
||||
};
|
||||
const handleNowShipmentSubmit = async ({ items, close }) => {
|
||||
const orderId = resolveAiOrderId(state.orderInfo);
|
||||
if (!orderId || !Array.isArray(items) || items.length === 0) {
|
||||
return;
|
||||
}
|
||||
const { code } = await aiPendingShipment({
|
||||
orderId,
|
||||
items,
|
||||
});
|
||||
if (code === 0) {
|
||||
close?.();
|
||||
getOrderDetail();
|
||||
}
|
||||
};
|
||||
|
||||
function delayShipment() {
|
||||
if (isPickUpOrder.value) return;
|
||||
if (isPickUpOrder.value) {
|
||||
uni.showToast({
|
||||
title: '自提订单不支持延迟发货',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (isAiStoreOrder.value) {
|
||||
openDelayShipmentPopup();
|
||||
return;
|
||||
}
|
||||
const id = resolveAiOrderId(state.orderInfo);
|
||||
if (!id) {
|
||||
uni.showToast({
|
||||
@@ -235,7 +338,17 @@
|
||||
}
|
||||
|
||||
function nowShipment() {
|
||||
if (isPickUpOrder.value) return;
|
||||
if (isPickUpOrder.value) {
|
||||
uni.showToast({
|
||||
title: '自提订单不支持立即发货',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (isAiStoreOrder.value) {
|
||||
openNowShipmentPopup();
|
||||
return;
|
||||
}
|
||||
const id = resolveAiOrderId(state.orderInfo);
|
||||
if (!id) {
|
||||
uni.showToast({
|
||||
@@ -342,6 +455,26 @@
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
// 店铺订单:延迟记录独立拉取
|
||||
if (isAiStoreOrder.value) {
|
||||
const orderId = resolveAiOrderId(state.orderInfo);
|
||||
if (orderId) {
|
||||
try {
|
||||
const delayRes = await getAiOrderDelayRecords({ orderId });
|
||||
if (delayRes.code === 0 && Array.isArray(delayRes.data)) {
|
||||
state.delayRecords = delayRes.data;
|
||||
} else {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} catch (e) {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} else {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} else {
|
||||
state.delayRecords = [];
|
||||
}
|
||||
} else {
|
||||
sheep.$router.back();
|
||||
}
|
||||
@@ -659,4 +792,139 @@
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.delay-popup {
|
||||
width: 680rpx;
|
||||
max-height: 78vh;
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.delay-popup__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.delay-popup__title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.delay-popup__order-no {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
color: #999999;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.delay-popup__order-time {
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.delay-popup__close {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 50%;
|
||||
background: #f3f4f6;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
font-size: 36rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.delay-popup__desc {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.delay-popup__content {
|
||||
max-height: 760rpx;
|
||||
}
|
||||
|
||||
.delay-popup__item {
|
||||
display: flex;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
}
|
||||
|
||||
.delay-popup__item-image {
|
||||
width: 144rpx;
|
||||
height: 144rpx;
|
||||
border-radius: 12rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.delay-popup__item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.delay-popup__item-name {
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.delay-popup__item-sku {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.delay-popup__item-footer {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.delay-popup__item-count {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.delay-popup__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.delay-popup__btn {
|
||||
flex: 1;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
text-align: center;
|
||||
border-radius: 42rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.delay-popup__btn--ghost {
|
||||
background: #f2f3f5;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.delay-popup__btn--primary {
|
||||
background: linear-gradient(135deg, #fa8735 0%, #fe3b48 100%);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.now-shipment-empty {
|
||||
padding: 40rpx 24rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
|
||||
+21
-12
@@ -344,12 +344,12 @@ export function getAiProduct(params: any) {
|
||||
});
|
||||
}
|
||||
// 延迟发货
|
||||
export function aiDelayedShipment(params: any) {
|
||||
return request({
|
||||
url: '/aishop/order/update/delayedShipment',
|
||||
method: 'post',
|
||||
params,
|
||||
});
|
||||
export function aiDelayedShipment(params : any) {
|
||||
return request({
|
||||
url: '/aishop/order/update/delayedShipment',
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
export function getMyShop(params: any) {
|
||||
@@ -361,10 +361,19 @@ export function getMyShop(params: any) {
|
||||
}
|
||||
|
||||
// 立即发货
|
||||
export function aiPendingShipment(params: any) {
|
||||
return request({
|
||||
url: '/aishop/order/update/pendingShipment',
|
||||
method: 'post',
|
||||
params,
|
||||
});
|
||||
export function aiPendingShipment(params : any) {
|
||||
return request({
|
||||
url: '/aishop/order/update/pendingShipment',
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询订单延迟记录列表
|
||||
export function getAiOrderDelayRecords(params : any) {
|
||||
return request({
|
||||
url: '/aishop/order/delay-records',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user