Merge branch 'v2.2' into v1.8.1
* v2.2: feat: 延迟发货调试 feat: 多规格延迟发货 feat: 店铺订单多规格展示 feat: 延迟发货api
This commit is contained in:
+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>
|
||||
|
||||
Reference in New Issue
Block a user