feat: 新增订单api
This commit is contained in:
@@ -59,6 +59,14 @@
|
|||||||
下单时间:{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM') }}
|
下单时间:{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM') }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="getReceiverName(item) || getMaskedReceiverMobile(item)" class="buyer-top">
|
||||||
|
<view class="buyer-top__left">
|
||||||
|
<text v-if="getReceiverName(item)" class="buyer-top__name">{{ getReceiverName(item) }}</text>
|
||||||
|
<text v-if="getMaskedReceiverMobile(item)" class="buyer-top__mobile">
|
||||||
|
{{ getMaskedReceiverMobile(item) }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="card-bd flex-center al-flex-start">
|
<view class="card-bd flex-center al-flex-start">
|
||||||
<view class="goods-thumb">
|
<view class="goods-thumb">
|
||||||
<image
|
<image
|
||||||
@@ -75,9 +83,22 @@
|
|||||||
规格:{{ getItemSpec(getMainItem(item)) }}
|
规格:{{ getItemSpec(getMainItem(item)) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="meta c_999 size24 m-t-8">数量:x{{ getMainItem(item)?.count || 0 }}</view>
|
<view class="meta c_999 size24 m-t-8">数量:x{{ getMainItem(item)?.count || 0 }}</view>
|
||||||
<view class="meta c_999 size24 m-t-10">订单号:{{ item.orderNo }}</view>
|
<view class="order-no-row c_999 size24 m-t-10">
|
||||||
|
<text class="order-no-row__text">订单号:{{ item.orderNo || '--' }}</text>
|
||||||
|
<view v-if="item.orderNo" class="order-no-row__copy" @tap.stop="copyOrderNo(item.orderNo)">
|
||||||
|
<image class="order-no-row__copy-icon" :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="getReceiverMobileDigits(item) || Number(item.status) === 0 || Number(item.status) === 1"
|
||||||
|
class="actions"
|
||||||
|
>
|
||||||
|
<view v-if="getReceiverMobileDigits(item)" class="btn btnGhost" @tap.stop="callReceiver(item)">
|
||||||
|
<uni-icons type="phone" size="16" color="#2556ec" />
|
||||||
|
<text>拨打电话</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="actions">
|
|
||||||
<view v-if="Number(item.status) === 0" class="btn btnPrimary" @tap="markPicked(item)">
|
<view v-if="Number(item.status) === 0" class="btn btnPrimary" @tap="markPicked(item)">
|
||||||
标记已分拣
|
标记已分拣
|
||||||
</view>
|
</view>
|
||||||
@@ -85,7 +106,6 @@
|
|||||||
去核销
|
去核销
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
<view
|
<view
|
||||||
v-if="getExtraItems(item).length"
|
v-if="getExtraItems(item).length"
|
||||||
class="fold-box"
|
class="fold-box"
|
||||||
@@ -346,6 +366,49 @@
|
|||||||
return goods?.spec || '';
|
return goods?.spec || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getReceiverName = (item) => {
|
||||||
|
return String(item?.receiverName || item?.userName || item?.nickname || '').trim();
|
||||||
|
};
|
||||||
|
|
||||||
|
const maskMobile = (mobile) => {
|
||||||
|
const digits = String(mobile || '').replace(/\D/g, '');
|
||||||
|
if (digits.length < 7) return String(mobile || '').trim();
|
||||||
|
if (digits.length === 11) return `${digits.slice(0, 3)}****${digits.slice(7)}`;
|
||||||
|
return `${digits.slice(0, 3)}**${digits.slice(-4)}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getMaskedReceiverMobile = (item) => {
|
||||||
|
const mobile = String(item?.receiverMobile || item?.receiverPhone || item?.mobile || '').trim();
|
||||||
|
return mobile ? maskMobile(mobile) : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const getReceiverMobileDigits = (item) => {
|
||||||
|
return String(item?.receiverMobile || item?.receiverPhone || item?.mobile || '').replace(/\D/g, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
const callReceiver = (item) => {
|
||||||
|
const phoneNumber = getReceiverMobileDigits(item);
|
||||||
|
if (!phoneNumber) {
|
||||||
|
uni.showToast({ title: '暂无手机号', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber,
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({ title: '拨打失败', icon: 'none' });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyOrderNo = (orderNo) => {
|
||||||
|
const text = String(orderNo || '').trim();
|
||||||
|
if (!text) {
|
||||||
|
uni.showToast({ title: '暂无订单号', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sheep.$helper.copyText(text);
|
||||||
|
};
|
||||||
|
|
||||||
const getExpandKey = (item) => {
|
const getExpandKey = (item) => {
|
||||||
return String(item?.orderId || item?.id || '');
|
return String(item?.orderId || item?.id || '');
|
||||||
};
|
};
|
||||||
@@ -481,6 +544,38 @@
|
|||||||
margin-bottom: 14rpx;
|
margin-bottom: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buyer-top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
|
padding: 10rpx 12rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #f7f8fc;
|
||||||
|
margin-bottom: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buyer-top__left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12rpx;
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buyer-top__name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
color: #222;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buyer-top__mobile {
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
color: #7b8494;
|
||||||
|
}
|
||||||
|
|
||||||
.status-wrap {
|
.status-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -542,20 +637,56 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-no-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-no-row__text {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 0 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-no-row__copy {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-no-row__copy-icon {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
align-items: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 12rpx;
|
gap: 16rpx;
|
||||||
flex-shrink: 0;
|
margin-top: 16rpx;
|
||||||
margin-left: 14rpx;
|
padding-top: 16rpx;
|
||||||
|
border-top: 2rpx solid #f1f3f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
padding: 14rpx 20rpx;
|
min-width: 176rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
padding: 0 26rpx;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-weight: 600;
|
||||||
|
gap: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btnPrimary {
|
.btnPrimary {
|
||||||
@@ -568,6 +699,14 @@
|
|||||||
color: #2556ec;
|
color: #2556ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btnGhost {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
border: 2rpx solid #dbe3f2;
|
||||||
|
color: #2556ec;
|
||||||
|
background: #f7faff;
|
||||||
|
}
|
||||||
|
|
||||||
.fold-box {
|
.fold-box {
|
||||||
margin-top: 16rpx;
|
margin-top: 16rpx;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
|
|||||||
+109
-12
@@ -35,10 +35,23 @@
|
|||||||
:styles="{ fontSize: '28rpx' }"
|
:styles="{ fontSize: '28rpx' }"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="btnAdd" @tap="addStore">+ 新增网店</view>
|
<picker
|
||||||
|
mode="selector"
|
||||||
|
class="status-picker"
|
||||||
|
:value="statusIndex"
|
||||||
|
:range="statusOptions"
|
||||||
|
range-key="label"
|
||||||
|
@change="bindStatusChange"
|
||||||
|
>
|
||||||
|
<view class="status-picker__inner">
|
||||||
|
<text class="status-picker__text">{{ statusOptions[statusIndex].label }}</text>
|
||||||
|
<uni-icons type="bottom" size="14" color="#8a8a8a" />
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<!-- <view class="btnAdd" @tap="addStore">+ 新增网店</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="table bg24">
|
<view class="table">
|
||||||
<view v-for="(row, index) in filteredList" :key="row.id" class="tr">
|
<view v-for="(row, index) in filteredList" :key="row.id" class="tr">
|
||||||
<view class="store-card flex-center">
|
<view class="store-card flex-center">
|
||||||
<view class="store-rank">#{{ index + 1 }}</view>
|
<view class="store-rank">#{{ index + 1 }}</view>
|
||||||
@@ -61,7 +74,7 @@
|
|||||||
<view class="store-code c_999">编号:{{ row.code || '--' }}</view>
|
<view class="store-code c_999">编号:{{ row.code || '--' }}</view>
|
||||||
<view class="store-contact c_999 lineOne">联系电话:{{ row.phone || '--' }}</view>
|
<view class="store-contact c_999 lineOne">联系电话:{{ row.phone || '--' }}</view>
|
||||||
<view class="store-address c_999">{{ row.address || '--' }}</view>
|
<view class="store-address c_999">{{ row.address || '--' }}</view>
|
||||||
<view class="store-capacity">
|
<!-- <view class="store-capacity">
|
||||||
<view class="store-capacity__head flex-center ju-between">
|
<view class="store-capacity__head flex-center ju-between">
|
||||||
<view class="store-capacity__label">库存容量</view>
|
<view class="store-capacity__label">库存容量</view>
|
||||||
<view class="store-capacity__value">{{ row.capacityText }}</view>
|
<view class="store-capacity__value">{{ row.capacityText }}</view>
|
||||||
@@ -72,11 +85,11 @@
|
|||||||
:style="{ width: `${row.capacityPercent}%` }"
|
:style="{ width: `${row.capacityPercent}%` }"
|
||||||
></view>
|
></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="store-actions flex-center ju-flex-end">
|
<view class="store-actions flex-center ju-flex-end">
|
||||||
<view class="op opPrimary" @tap="edit(row)">编辑</view>
|
<view v-if="showEdit" class="op opPrimary" @tap="edit(row)">编辑</view>
|
||||||
<view
|
<view
|
||||||
v-if="row.toggleActionText"
|
v-if="row.toggleActionText"
|
||||||
class="op"
|
class="op"
|
||||||
@@ -101,14 +114,23 @@
|
|||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import modeSwitch from '@/components/mode_switch/mode_switch.vue';
|
import modeSwitch from '@/components/mode_switch/mode_switch.vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
|
import OrderStoreApi from '@/sheep/api/trade/orderStore';
|
||||||
import StoreApi from '@/sheep/api/trade/store';
|
import StoreApi from '@/sheep/api/trade/store';
|
||||||
|
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
|
const statusIndex = ref(0);
|
||||||
|
const showEdit = false;
|
||||||
|
|
||||||
const list = ref([]);
|
const list = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
const todayOrders = ref(0);
|
||||||
const updatingStoreId = ref(0);
|
const updatingStoreId = ref(0);
|
||||||
const userStore = sheep.$store('user');
|
const userStore = sheep.$store('user');
|
||||||
|
const statusOptions = [
|
||||||
|
{ label: '全部状态', value: '' },
|
||||||
|
{ label: '营业中', value: 1 },
|
||||||
|
{ label: '休息中', value: 2 },
|
||||||
|
];
|
||||||
|
|
||||||
const toStoreIdsString = (raw) => {
|
const toStoreIdsString = (raw) => {
|
||||||
if (raw === null || raw === undefined) return '';
|
if (raw === null || raw === undefined) return '';
|
||||||
@@ -251,10 +273,24 @@
|
|||||||
return {
|
return {
|
||||||
total,
|
total,
|
||||||
open,
|
open,
|
||||||
todayOrders: 0,
|
todayOrders: todayOrders.value,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const updateTodayOrders = async (storeIds = '') => {
|
||||||
|
const pickUpStoreId = toStoreIdsString(storeIds);
|
||||||
|
if (!pickUpStoreId) {
|
||||||
|
todayOrders.value = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const { code, data } = await OrderStoreApi.getTodayNewCount(pickUpStoreId);
|
||||||
|
todayOrders.value = code === 0 ? Math.max(0, Number(data) || 0) : 0;
|
||||||
|
} catch (error) {
|
||||||
|
todayOrders.value = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
if (loading.value) return;
|
if (loading.value) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@@ -262,12 +298,19 @@
|
|||||||
const storeIds = await getUserStoreIds();
|
const storeIds = await getUserStoreIds();
|
||||||
if (!storeIds) {
|
if (!storeIds) {
|
||||||
list.value = [];
|
list.value = [];
|
||||||
|
todayOrders.value = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const status = statusOptions[statusIndex.value]?.value;
|
||||||
|
const params = status === '' ? {} : { status };
|
||||||
|
const { code, data } = await StoreApi.getStoreListByStoreIds(storeIds, params);
|
||||||
|
if (code !== 0) {
|
||||||
|
todayOrders.value = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { code, data } = await StoreApi.getStoreListByStoreIds(storeIds);
|
|
||||||
if (code !== 0) return;
|
|
||||||
const rows = Array.isArray(data) ? data : [];
|
const rows = Array.isArray(data) ? data : [];
|
||||||
list.value = rows.map(normalizeRow).filter((r) => r.id > 0);
|
list.value = rows.map(normalizeRow).filter((r) => r.id > 0);
|
||||||
|
await updateTodayOrders(storeIds);
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
@@ -277,6 +320,11 @@
|
|||||||
uni.showToast({ title: '功能开发中', icon: 'none' });
|
uni.showToast({ title: '功能开发中', icon: 'none' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const bindStatusChange = (e) => {
|
||||||
|
statusIndex.value = Number(e?.detail?.value || 0);
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
const edit = () => {
|
const edit = () => {
|
||||||
uni.showToast({ title: '功能开发中', icon: 'none' });
|
uni.showToast({ title: '功能开发中', icon: 'none' });
|
||||||
};
|
};
|
||||||
@@ -366,6 +414,29 @@
|
|||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-picker {
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-width: 180rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #f6f7fb;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-picker__inner {
|
||||||
|
height: 72rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-picker__text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.btnAdd {
|
.btnAdd {
|
||||||
padding: 14rpx 18rpx;
|
padding: 14rpx 18rpx;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
@@ -376,14 +447,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
border-radius: 24rpx;
|
padding: 0;
|
||||||
padding: 16rpx;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tr {
|
.tr {
|
||||||
padding: 18rpx 0;
|
margin-bottom: 18rpx;
|
||||||
border-bottom: 2rpx solid #f6f7fb;
|
padding: 18rpx 18rpx 20rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.05);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tr:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.store-rank {
|
.store-rank {
|
||||||
@@ -537,18 +616,36 @@
|
|||||||
|
|
||||||
.op {
|
.op {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
min-width: 120rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-weight: 600;
|
||||||
|
border: 2rpx solid #e5e7eb;
|
||||||
|
background: #fff;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.opPrimary {
|
.opPrimary {
|
||||||
color: #2556ec;
|
color: #2556ec;
|
||||||
|
border-color: rgba(37, 86, 236, 0.2);
|
||||||
|
background: rgba(37, 86, 236, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.opDanger {
|
.opDanger {
|
||||||
color: #ff4d4f;
|
color: #ff4d4f;
|
||||||
|
border-color: rgba(255, 77, 79, 0.28);
|
||||||
|
background: #fff5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.opSuccess {
|
.opSuccess {
|
||||||
color: #14a44d;
|
color: #14a44d;
|
||||||
|
border-color: rgba(20, 164, 77, 0.28);
|
||||||
|
background: #f2fbf5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.opDisabled {
|
.opDisabled {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
orderId: 0,
|
orderId: 0,
|
||||||
pickUpStoreId: 0,
|
pickUpStoreId: 0,
|
||||||
|
preparationStatus: null,
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
@@ -105,11 +106,13 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveStage = (data = {}) => {
|
const resolveStage = (data = {}, preparationStatus) => {
|
||||||
const rawStatus = Number(data?.preparationStatus ?? data?.status ?? 0);
|
const external = Number(preparationStatus);
|
||||||
|
const rawStatus = Number.isFinite(external) ? external : Number(data?.preparationStatus ?? data?.status ?? 0);
|
||||||
if (data?.pickUpVerifyTime || data?.verifyTime || data?.completedTime || rawStatus === 30 || rawStatus === 3) {
|
if (data?.pickUpVerifyTime || data?.verifyTime || data?.completedTime || rawStatus === 30 || rawStatus === 3) {
|
||||||
return 'done';
|
return 'done';
|
||||||
}
|
}
|
||||||
|
if (rawStatus === 1) return 'wait';
|
||||||
if (
|
if (
|
||||||
data?.deliveryTime ||
|
data?.deliveryTime ||
|
||||||
data?.arriveStoreTime ||
|
data?.arriveStoreTime ||
|
||||||
@@ -123,7 +126,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const stage = computed(() => {
|
const stage = computed(() => {
|
||||||
return resolveStage(state.orderInfo);
|
return resolveStage(state.orderInfo, state.preparationStatus);
|
||||||
});
|
});
|
||||||
|
|
||||||
const steps = computed(() => {
|
const steps = computed(() => {
|
||||||
@@ -131,7 +134,7 @@
|
|||||||
const s = stage.value;
|
const s = stage.value;
|
||||||
const sortingState = s === 'sorting' ? 'active' : 'done';
|
const sortingState = s === 'sorting' ? 'active' : 'done';
|
||||||
const deliveredState = s === 'delivered' ? 'active' : s === 'sorting' ? 'todo' : 'done';
|
const deliveredState = s === 'delivered' ? 'active' : s === 'sorting' ? 'todo' : 'done';
|
||||||
const waitState = s === 'done' ? 'done' : 'todo';
|
const waitState = s === 'wait' ? 'active' : s === 'done' ? 'done' : 'todo';
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: 'created',
|
key: 'created',
|
||||||
@@ -190,9 +193,10 @@
|
|||||||
|
|
||||||
const getDetail = async () => {
|
const getDetail = async () => {
|
||||||
if (!state.orderId || state.loading) return;
|
if (!state.orderId || state.loading) return;
|
||||||
if (!(state.pickUpStoreId > 0)) {
|
if (!state.orderInfo || !Object.keys(state.orderInfo).length || !(state.pickUpStoreId > 0)) {
|
||||||
const detailRes = await OrderApi.getOrderDetail(state.orderId);
|
const detailRes = await OrderApi.getOrderDetail(state.orderId);
|
||||||
if (detailRes?.code === 0) {
|
if (detailRes?.code === 0) {
|
||||||
|
state.orderInfo = detailRes.data || {};
|
||||||
state.pickUpStoreId = resolvePickUpStoreId(detailRes.data);
|
state.pickUpStoreId = resolvePickUpStoreId(detailRes.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,11 +211,20 @@
|
|||||||
const res = await OrderStoreApi.getPreparationStatus(state.pickUpStoreId, state.orderId);
|
const res = await OrderStoreApi.getPreparationStatus(state.pickUpStoreId, state.orderId);
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
if (res?.code !== 0) return;
|
if (res?.code !== 0) return;
|
||||||
const data = res.data || {};
|
const data = res.data;
|
||||||
state.orderInfo = data?.orderInfo || data;
|
if (data !== null && typeof data === 'object') {
|
||||||
if (!(state.pickUpStoreId > 0)) {
|
const merged = data?.orderInfo || data;
|
||||||
state.pickUpStoreId = resolvePickUpStoreId(state.orderInfo);
|
state.orderInfo = {
|
||||||
|
...(state.orderInfo || {}),
|
||||||
|
...(merged || {}),
|
||||||
|
};
|
||||||
|
const next = Number(merged?.preparationStatus ?? merged?.status);
|
||||||
|
if (Number.isFinite(next)) state.preparationStatus = next;
|
||||||
|
} else {
|
||||||
|
const next = Number(data);
|
||||||
|
if (Number.isFinite(next)) state.preparationStatus = next;
|
||||||
}
|
}
|
||||||
|
if (!(state.pickUpStoreId > 0)) state.pickUpStoreId = resolvePickUpStoreId(state.orderInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
const notifyStore = () => {
|
const notifyStore = () => {
|
||||||
|
|||||||
@@ -34,6 +34,18 @@ const OrderStoreApi = {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getTodayNewCount: (pickUpStoreId) => {
|
||||||
|
return request({
|
||||||
|
url: '/trade/order-store/staff/today-new-count',
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
pickUpStoreId,
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
showLoading: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
getPreparationStatus: (pickUpStoreId, orderId) => {
|
getPreparationStatus: (pickUpStoreId, orderId) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/trade/order-store/preparation-status',
|
url: '/trade/order-store/preparation-status',
|
||||||
|
|||||||
@@ -29,12 +29,13 @@ const StoreApi = {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
getStoreListByStoreIds: async (storeIds) => {
|
getStoreListByStoreIds: async (storeIds, params = {}) => {
|
||||||
const res = await request({
|
const res = await request({
|
||||||
url: '/trade/store/list-by-store-ids',
|
url: '/trade/store/list-by-store-ids',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
params: {
|
||||||
storeIds,
|
storeIds,
|
||||||
|
...params,
|
||||||
},
|
},
|
||||||
custom: {
|
custom: {
|
||||||
showLoading: false,
|
showLoading: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user