feat: ai店铺订单添加修改配送功能
This commit is contained in:
@@ -0,0 +1,745 @@
|
||||
<template>
|
||||
<s-pages title="修改配送" :pink_bg="true">
|
||||
<!-- 订单信息(商品) -->
|
||||
<view class="modify-delivery">
|
||||
<view class="bg24 m-b-12 order-info-card">
|
||||
<view class="notice-item notice-item--center">
|
||||
<view class="ss-flex ss-flex-1 flex-row ju-between">
|
||||
<text class="title c0">订单编号</text>
|
||||
<text class="detail right c0">{{ orderSn }}</text>
|
||||
</view>
|
||||
<view class="copy" @click.stop="onCopy(orderSn)">
|
||||
<image :src="`${appUrl}goods/copy2.svg`" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c0">下单时间</text>
|
||||
<text class="detail right c0">
|
||||
{{ formatTime(orderCreateTime) }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bg24 m-b-12 goods-card">
|
||||
<view
|
||||
class="con_item flex-center ju-between"
|
||||
v-for="(v, i) in displayGoodsItems"
|
||||
:key="v.key || i"
|
||||
>
|
||||
<view class="order_img shrink">
|
||||
<image :src="`${resolvePicUrl(v)}`" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="flex1">
|
||||
<view class="flex-row ju-between m-b-6">
|
||||
<view class="size28 spuName lineTwo c0 p-r-10">
|
||||
{{ v.spuName }}
|
||||
</view>
|
||||
<view class="shrink price">
|
||||
<span class="size24">¥</span>
|
||||
<span class="size36" style="font-weight: 600">{{ fen2yuan(resolvePrice(v)) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between">
|
||||
<view class="valueName size28 c19">
|
||||
{{ formatSkuProperties(v.properties) }}
|
||||
</view>
|
||||
<view class="shrink size28 c0">
|
||||
{{ `x${resolveCount(v)}` }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!displayGoodsItems.length" class="goods-card__empty c15 size24">
|
||||
商品信息加载中…
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 配送方式 -->
|
||||
<view class="bg24 m-b-12 delivery-card">
|
||||
<view
|
||||
class="address flex flex-wrap flex-center ss-row-between"
|
||||
@tap="selectStore"
|
||||
>
|
||||
<view class="addressCon" v-if="deliveryInfo.pickUpInfo?.id">
|
||||
<view class="name c0">
|
||||
{{ deliveryInfo.pickUpInfo.name }}
|
||||
<text class="phone">{{ deliveryInfo.pickUpInfo.phone || '' }}</text>
|
||||
</view>
|
||||
<view class="line1 line2 c0">
|
||||
{{ formatPickUpAddress(deliveryInfo.pickUpInfo) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="addressCon" v-else>
|
||||
<view class="setaddress c0">选择自提门店</view>
|
||||
</view>
|
||||
<view class="iconfont">
|
||||
<uni-icons type="right" color="#989898" size="18" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="delivery-contact">
|
||||
<view class="delivery-contact__row">
|
||||
<view class="delivery-contact__label c0">联系人</view>
|
||||
<uni-easyinput
|
||||
class="delivery-contact__input"
|
||||
v-model="deliveryInfo.receiverName"
|
||||
placeholder="请填写您的联系姓名"
|
||||
:inputBorder="false"
|
||||
:clearable="false"
|
||||
placeholderStyle="color:#b0b3a6"
|
||||
/>
|
||||
</view>
|
||||
<view class="delivery-contact__row">
|
||||
<view class="delivery-contact__label c0">联系电话</view>
|
||||
<uni-easyinput
|
||||
class="delivery-contact__input"
|
||||
v-model="deliveryInfo.receiverMobile"
|
||||
type="number"
|
||||
maxlength="11"
|
||||
placeholder="请填写您的联系电话"
|
||||
:inputBorder="false"
|
||||
:clearable="false"
|
||||
placeholderStyle="color:#b0b3a6"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<su-fixed bottom placeholder>
|
||||
<view class="footer-actions">
|
||||
<view
|
||||
class="save-btn"
|
||||
:class="{ 'is-disabled': submitting }"
|
||||
@click="onSave"
|
||||
>确认修改</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { onLoad, onUnload } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import StorePickupApi from '@/sheep/api/trade/storePickup';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||
import {
|
||||
getOrderDetail as getAiOrderDetail,
|
||||
getOpenOrderDetail,
|
||||
updateDeliveryType as updateAiDeliveryType,
|
||||
} from '@/sheep/api/ai';
|
||||
import { createDeliveryInfo, getDeliveryValidationMessage } from '@/sheep/helper/delivery';
|
||||
|
||||
// 与 main.js 中 app.config.globalProperties.$url 保持一致(goods/copy2.svg 等 OSS 静态资源前缀)
|
||||
const appUrl = 'https://sycbuck.oss-cn-hangzhou.aliyuncs.com/app/';
|
||||
|
||||
const routeParams = ref({});
|
||||
const orderId = ref('');
|
||||
const orderTypeId = ref(1);
|
||||
const backCurrentType = ref(0);
|
||||
const source = ref('');
|
||||
const orderType = ref('');
|
||||
const orderData = ref({});
|
||||
const submitting = ref(false);
|
||||
let cleanupListeners = () => {};
|
||||
const deliveryInfo = reactive(createDeliveryInfo());
|
||||
|
||||
// 基于「初始路由参数」判断订单类型/来源(拉取详情前必须先确定用哪个接口)
|
||||
const resolveInitOrderType = () => {
|
||||
const fromOptions = Number(orderType.value ?? orderTypeId.value ?? 0);
|
||||
return fromOptions || 0;
|
||||
};
|
||||
const resolveInitOrderSource = () => String(source.value || '');
|
||||
const initIsOpenOrder = () => resolveInitOrderType() === 5;
|
||||
const initIsAiStoreOrder = () => resolveInitOrderSource() === 'aishop';
|
||||
const initIsInStoreOrder = () => resolveInitOrderType() === 4;
|
||||
const shouldUseAiDetailApiInitially = () => {
|
||||
if (initIsOpenOrder() || initIsAiStoreOrder() || initIsInStoreOrder()) {
|
||||
return true;
|
||||
}
|
||||
// 兜底:从店铺订单 tab(currentType=1)进入,或者 orderTypeId!=1,都不是普通商城订单
|
||||
const t = resolveInitOrderType();
|
||||
if (t && t !== 1) return true;
|
||||
if (Number(backCurrentType.value) === 1) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
// 基于 orderData 返回值的二次判断(兼容详情返回后再次校正)
|
||||
const resolveOrderType = () => {
|
||||
const fromData = Number(orderData.value?.type ?? 0);
|
||||
const fromInit = resolveInitOrderType();
|
||||
return fromData || fromInit || 0;
|
||||
};
|
||||
const resolveOrderSource = () => {
|
||||
const s1 = String(orderData.value?.__source || '');
|
||||
const s2 = resolveInitOrderSource();
|
||||
return s1 || s2 || '';
|
||||
};
|
||||
const isOpenOrder = computed(() => resolveOrderType() === 5);
|
||||
const isAiStoreOrder = computed(() => resolveOrderSource() === 'aishop');
|
||||
const isInStoreOrder = computed(() => resolveOrderType() === 4);
|
||||
const shouldUseAiDetailApi = computed(() =>
|
||||
isOpenOrder.value || isAiStoreOrder.value || isInStoreOrder.value,
|
||||
);
|
||||
|
||||
const orderSn = computed(() => {
|
||||
const d = orderData.value || {};
|
||||
return d.no || d.orderSn || d.orderNo || '';
|
||||
});
|
||||
const orderCreateTime = computed(() => {
|
||||
const d = orderData.value || {};
|
||||
return d.createTime || d.payTime || d.orderTime || d.createdAt;
|
||||
});
|
||||
const formatTime = (v) => {
|
||||
if (!v) return '';
|
||||
if (sheep?.$helper?.timeFormat) {
|
||||
return sheep.$helper.timeFormat(v, 'yyyy-mm-dd hh:MM:ss');
|
||||
}
|
||||
return String(v);
|
||||
};
|
||||
const resolvePicUrl = (item) =>
|
||||
item?.thumbnail || item?.picUrl || item?.spuMainPicUrl || '';
|
||||
const resolvePrice = (item) => item?.salePrice || item?.price || 0;
|
||||
const resolveCount = (item) => item?.buyNum || item?.count || 1;
|
||||
const formatSkuProperties = (properties = []) => {
|
||||
if (!Array.isArray(properties) || !properties.length) return '';
|
||||
return properties.map((p) => p?.valueName || '').filter(Boolean).join(' ');
|
||||
};
|
||||
const buildItemKey = (it, fallbackIndex) => {
|
||||
const stableId = it?.id || it?.itemId || it?.orderItemId || it?.order_item_id || it?.item_id;
|
||||
if (stableId !== undefined && stableId !== null && String(stableId) !== '') {
|
||||
return `item-${stableId}`;
|
||||
}
|
||||
const spuId = it?.spuId || it?.spu_id || it?.productId || '';
|
||||
const skuId = it?.skuId || it?.sku_id || '';
|
||||
if (spuId || skuId) {
|
||||
return `sku-${spuId}-${skuId}`;
|
||||
}
|
||||
return `idx-${fallbackIndex ?? 0}`;
|
||||
};
|
||||
const displayGoodsItems = computed(() => {
|
||||
const raw = orderData.value?.items || [];
|
||||
return raw.map((it, index) => ({
|
||||
...it,
|
||||
key: it?.key ?? buildItemKey(it, index),
|
||||
}));
|
||||
});
|
||||
const formatPickUpAddress = (info = {}) => {
|
||||
if (!info || typeof info !== 'object') return '';
|
||||
const detail = info.detailAddress || info.address || '';
|
||||
const area = info.areaName || info.district || '';
|
||||
const province = info.provinceName || '';
|
||||
const city = info.cityName || '';
|
||||
const base = [province, city, area, detail]
|
||||
.map((s) => (s ?? '').toString().trim())
|
||||
.filter(Boolean)
|
||||
.join('');
|
||||
return base;
|
||||
};
|
||||
|
||||
const loadDeliveryConfig = async () => {
|
||||
try {
|
||||
await TradeConfigApi.getTradeConfig();
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
const resolveOrderDetailApi = () => {
|
||||
// 优先用「初始路由参数」判断,保证第一次调用详情接口就命中正确的 API
|
||||
if (shouldUseAiDetailApiInitially()) {
|
||||
if (initIsOpenOrder()) return getOpenOrderDetail;
|
||||
return getAiOrderDetail;
|
||||
}
|
||||
if (isOpenOrder.value) return getOpenOrderDetail;
|
||||
if (isAiStoreOrder.value) return getAiOrderDetail;
|
||||
if (isInStoreOrder.value) return getAiOrderDetail;
|
||||
return OrderApi.getOrderDetail;
|
||||
};
|
||||
const resolveOrderDetailApiLabel = (api) => {
|
||||
if (api === getOpenOrderDetail) return '/aishop/order/get-detail-open';
|
||||
if (api === getAiOrderDetail) return '/aishop/order/get-detail';
|
||||
if (api === OrderApi.getOrderDetail) return '/trade/order/get-detail(商城)';
|
||||
return 'unknown';
|
||||
};
|
||||
const callOrderDetailApi = async () => {
|
||||
const api = resolveOrderDetailApi();
|
||||
if (api === OrderApi.getOrderDetail) {
|
||||
return api(orderId.value);
|
||||
}
|
||||
return api({ id: orderId.value });
|
||||
};
|
||||
|
||||
const getOrderDetail = async () => {
|
||||
if (!orderId.value) return;
|
||||
try {
|
||||
const res = await callOrderDetailApi();
|
||||
if (res?.code !== 0) return;
|
||||
const data = res.data || {};
|
||||
orderData.value = data;
|
||||
|
||||
deliveryInfo.deliveryType = 2;
|
||||
|
||||
const mainPickup = data?.pickup || data?.pickupInfo || data?.pickUpInfo || {};
|
||||
const storeCandidate =
|
||||
mainPickup?.pickUpStore ||
|
||||
mainPickup?.store ||
|
||||
mainPickup?.pickUpStoreVO ||
|
||||
mainPickup ||
|
||||
{};
|
||||
const storeId =
|
||||
Number(
|
||||
data?.pickUpStoreId ||
|
||||
mainPickup?.storeId ||
|
||||
storeCandidate?.id ||
|
||||
storeCandidate?.storeId ||
|
||||
0,
|
||||
) || 0;
|
||||
const storeName =
|
||||
mainPickup?.storeName || storeCandidate?.name || storeCandidate?.storeName || '';
|
||||
const storeAddress =
|
||||
mainPickup?.storeAddress ||
|
||||
storeCandidate?.address ||
|
||||
storeCandidate?.storeAddress ||
|
||||
formatPickUpAddress(storeCandidate);
|
||||
const storePhone =
|
||||
mainPickup?.storePhone ||
|
||||
mainPickup?.phone ||
|
||||
storeCandidate?.phone ||
|
||||
storeCandidate?.storePhone ||
|
||||
storeCandidate?.mobile ||
|
||||
'';
|
||||
|
||||
const pickUpId = storeId;
|
||||
const pickUpStoreIdFinal = storeId || Number(storeCandidate?.storeId || 0) || 0;
|
||||
if (!deliveryInfo.pickUpInfo || typeof deliveryInfo.pickUpInfo !== 'object') {
|
||||
deliveryInfo.pickUpInfo = {};
|
||||
}
|
||||
const baseAssign = {
|
||||
id: pickUpId,
|
||||
storeId: pickUpStoreIdFinal,
|
||||
name: storeName,
|
||||
storeName,
|
||||
address: storeAddress,
|
||||
storeAddress,
|
||||
phone: storePhone,
|
||||
storePhone,
|
||||
};
|
||||
Object.keys(baseAssign).forEach((k) => {
|
||||
const v = baseAssign[k];
|
||||
if (v === undefined || v === null || v === '') {
|
||||
delete deliveryInfo.pickUpInfo[k];
|
||||
return;
|
||||
}
|
||||
deliveryInfo.pickUpInfo[k] = v;
|
||||
});
|
||||
|
||||
if (!deliveryInfo.receiverName) {
|
||||
deliveryInfo.receiverName =
|
||||
mainPickup?.receiverName ||
|
||||
mainPickup?.contactName ||
|
||||
data?.receiverName ||
|
||||
'';
|
||||
}
|
||||
if (!deliveryInfo.receiverMobile) {
|
||||
deliveryInfo.receiverMobile =
|
||||
mainPickup?.receiverMobile ||
|
||||
mainPickup?.contactMobile ||
|
||||
data?.receiverMobile ||
|
||||
'';
|
||||
}
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
const onSave = async () => {
|
||||
if (submitting.value) return;
|
||||
const validationMessage = getDeliveryValidationMessage(deliveryInfo);
|
||||
if (validationMessage) {
|
||||
return uni.showToast({ title: validationMessage, icon: 'none' });
|
||||
}
|
||||
const payload = {
|
||||
id: orderId.value,
|
||||
deliveryType: 2,
|
||||
pickUpStoreId: Number(deliveryInfo.pickUpInfo?.id) || 0,
|
||||
receiverName: String(deliveryInfo.receiverName || '').trim(),
|
||||
receiverMobile: String(deliveryInfo.receiverMobile || '').trim(),
|
||||
};
|
||||
submitting.value = true;
|
||||
let shouldUnlock = true;
|
||||
try {
|
||||
const useAiUpdate = shouldUseAiDetailApiInitially() ||
|
||||
(orderData.value && (
|
||||
orderData.value.__source === 'aishop' ||
|
||||
Number(orderData.value.type) === 4 ||
|
||||
Number(orderData.value.type) === 5 ||
|
||||
Number(orderData.value.orderType) === 4 ||
|
||||
Number(orderData.value.orderType) === 5 ||
|
||||
Number(orderTypeId.value) !== 1
|
||||
));
|
||||
const updateFn = useAiUpdate ? updateAiDeliveryType : OrderApi.updateDeliveryType;
|
||||
const res = await updateFn(payload);
|
||||
if (res?.code === 0) {
|
||||
shouldUnlock = false;
|
||||
uni.showToast({ title: '修改成功', icon: 'success' });
|
||||
uni.$emit('REFRESH_ORDER_LIST');
|
||||
setTimeout(() => {
|
||||
sheep.$router.go('/pages/order/list', { currentType: backCurrentType.value });
|
||||
}, 600);
|
||||
}
|
||||
} finally {
|
||||
if (shouldUnlock) submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const onCopy = (text) => {
|
||||
if (!text) return;
|
||||
sheep.$helper.copyText(String(text));
|
||||
};
|
||||
|
||||
const selectStore = () => {
|
||||
sheep.$router.go('/pages/user/goods_details_store/index');
|
||||
};
|
||||
|
||||
const buildPickUpAddressFromRaw = function buildSafePickUpAddress(rawItemSafe) {
|
||||
if (!rawItemSafe || typeof rawItemSafe !== 'object') return '';
|
||||
const provinceSafe = String(rawItemSafe?.provinceName || rawItemSafe?.province || '').trim();
|
||||
const citySafe = String(rawItemSafe?.cityName || rawItemSafe?.city || '').trim();
|
||||
const areaSafe = String(rawItemSafe?.areaName || rawItemSafe?.area || rawItemSafe?.district || '').trim();
|
||||
const detailSafe = String(
|
||||
(rawItemSafe?.detailAddress != null ? rawItemSafe.detailAddress : '') +
|
||||
((rawItemSafe?.address != null ? rawItemSafe.address : '') || ''),
|
||||
).trim();
|
||||
if (provinceSafe || citySafe || areaSafe || detailSafe) {
|
||||
return [provinceSafe, citySafe, areaSafe, detailSafe].filter(Boolean).join('');
|
||||
}
|
||||
const districtSafe = String(rawItemSafe?.district || '').trim();
|
||||
const descSafe = String(rawItemSafe?.description || '').trim();
|
||||
const addrLineSafe = String(rawItemSafe?.address || '').trim();
|
||||
return [districtSafe, descSafe, addrLineSafe].filter(Boolean).join(' ').trim();
|
||||
};
|
||||
|
||||
const onStoreSelected = function onSafeStoreSelected(evtPayloadSafe) {
|
||||
try {
|
||||
const rawSafe =
|
||||
(evtPayloadSafe && evtPayloadSafe.addressInfo) ||
|
||||
(evtPayloadSafe && evtPayloadSafe.storeInfo) ||
|
||||
(evtPayloadSafe && evtPayloadSafe.store) ||
|
||||
null;
|
||||
if (!rawSafe || typeof rawSafe !== 'object') return;
|
||||
const rawItemSafe = rawSafe;
|
||||
const storeIdSafe = Number(rawItemSafe?.id || rawItemSafe?.storeId || 0) || 0;
|
||||
const storeNameSafe = String(
|
||||
rawItemSafe?.name ||
|
||||
rawItemSafe?.storeName ||
|
||||
rawItemSafe?.shopName ||
|
||||
rawItemSafe?.pickUpName ||
|
||||
'',
|
||||
).trim();
|
||||
const addressSafe = String(
|
||||
rawItemSafe?.storeAddress ||
|
||||
rawItemSafe?.address ||
|
||||
rawItemSafe?.pickUpAddress ||
|
||||
buildPickUpAddressFromRaw(rawItemSafe),
|
||||
).trim();
|
||||
const phoneSafe = String(
|
||||
rawItemSafe?.storePhone ||
|
||||
rawItemSafe?.phone ||
|
||||
rawItemSafe?.mobile ||
|
||||
rawItemSafe?.telephone ||
|
||||
rawItemSafe?.pickUpPhone ||
|
||||
'',
|
||||
).trim();
|
||||
const latSafe = Number(rawItemSafe?.latitude) || 0;
|
||||
const lngSafe = Number(rawItemSafe?.longitude) || 0;
|
||||
const nextSafe = {
|
||||
id: storeIdSafe,
|
||||
storeId: storeIdSafe,
|
||||
name: storeNameSafe,
|
||||
storeName: storeNameSafe,
|
||||
address: addressSafe,
|
||||
storeAddress: addressSafe,
|
||||
phone: phoneSafe,
|
||||
storePhone: phoneSafe,
|
||||
latitude: latSafe || undefined,
|
||||
longitude: lngSafe || undefined,
|
||||
};
|
||||
// 根因级优化:
|
||||
// 1) 不用 {...prev, ...next} 整对象替换 → 避免 Vue reactive trigger 太多响应式副作用,
|
||||
// 被埋点/统计 SDK 采集到异常的空 entry 后读 .startTime 失败
|
||||
// 2) 只写值非空的字段;字段名保持双兼容(id/storeId, name/storeName …)
|
||||
if (!deliveryInfo.pickUpInfo || typeof deliveryInfo.pickUpInfo !== 'object') {
|
||||
deliveryInfo.pickUpInfo = {};
|
||||
}
|
||||
Object.keys(nextSafe).forEach((kSafe) => {
|
||||
const vSafe = nextSafe[kSafe];
|
||||
if (vSafe === undefined || vSafe === null || vSafe === '') {
|
||||
// 空 latitude/longitude 直接删掉,不保留 undefined 字段
|
||||
delete deliveryInfo.pickUpInfo[kSafe];
|
||||
return;
|
||||
}
|
||||
deliveryInfo.pickUpInfo[kSafe] = vSafe;
|
||||
});
|
||||
} catch (errSafe) {
|
||||
}
|
||||
};
|
||||
|
||||
onLoad(async (options) => {
|
||||
routeParams.value = options || {};
|
||||
orderId.value = options?.orderId || options?.id || '';
|
||||
orderTypeId.value = Number(options?.orderTypeId || options?.typeId) || 1;
|
||||
backCurrentType.value = Number(options?.currentType ?? 0);
|
||||
if (options?.orderType !== undefined) {
|
||||
orderType.value = options.orderType;
|
||||
}
|
||||
if (options?.type !== undefined) {
|
||||
orderType.value = options.type;
|
||||
}
|
||||
if (options?.source !== undefined) {
|
||||
source.value = options.source;
|
||||
}
|
||||
if (options?.__source !== undefined && !source.value) {
|
||||
source.value = options.__source;
|
||||
}
|
||||
const onPickUpInfoSafe = (evtSafe) => {
|
||||
try {
|
||||
onStoreSelected(evtSafe);
|
||||
} catch (errSafe) {
|
||||
}
|
||||
};
|
||||
const onPickUpStoreSafe = (evtSafe) => {
|
||||
try {
|
||||
if (evtSafe?.storeInfo) {
|
||||
onStoreSelected({ addressInfo: evtSafe.storeInfo });
|
||||
}
|
||||
} catch (errSafe) {
|
||||
}
|
||||
};
|
||||
try {
|
||||
// 先解绑旧的同名监听(避免 HMR/热更新叠加回调),再绑定新版
|
||||
uni.$off('SELECT_PICK_UP_INFO');
|
||||
uni.$off('SELECT_PICK_UP_STORE');
|
||||
} catch (eSafe) { /* ignore */ }
|
||||
uni.$on('SELECT_PICK_UP_INFO', onPickUpInfoSafe);
|
||||
uni.$on('SELECT_PICK_UP_STORE', onPickUpStoreSafe);
|
||||
cleanupListeners = () => {
|
||||
try { uni.$off('SELECT_PICK_UP_INFO', onPickUpInfoSafe); } catch (eSafe) {}
|
||||
try { uni.$off('SELECT_PICK_UP_STORE', onPickUpStoreSafe); } catch (eSafe) {}
|
||||
};
|
||||
await Promise.all([loadDeliveryConfig(), getOrderDetail()]);
|
||||
});
|
||||
|
||||
onUnload(() => {
|
||||
if (typeof cleanupListeners === 'function') {
|
||||
try { cleanupListeners(); } catch (e) {}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.modify-delivery {
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx 24rpx 24rpx;
|
||||
}
|
||||
|
||||
.order-info-card {
|
||||
border-radius: 16rpx;
|
||||
padding: 0 24rpx;
|
||||
.notice-item {
|
||||
padding: 24rpx 0;
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
.notice-item--center {
|
||||
.ss-flex > .title {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.notice-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
&.notice-item--center {
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
.copy {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-left: 12rpx;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.goods-card {
|
||||
border-radius: 16rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
.goods-card__empty {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
.con_item {
|
||||
padding: 24rpx 0;
|
||||
border-top: 1rpx solid #f2f2f2;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
.order_img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
margin-right: 16rpx;
|
||||
background: #f0f2f0;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.spuName {
|
||||
line-height: 1.3;
|
||||
color: #333;
|
||||
}
|
||||
.price {
|
||||
color: #ff5542;
|
||||
padding-left: 10rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.valueName {
|
||||
color: #8f97a0;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.c19 {
|
||||
color: #8f97a0;
|
||||
}
|
||||
.c0 {
|
||||
color: #000;
|
||||
}
|
||||
.c15 {
|
||||
color: #999;
|
||||
}
|
||||
.size24 {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.size28 {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.size36 {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.lineTwo {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.delivery-card {
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
}
|
||||
.address {
|
||||
padding: 28rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
}
|
||||
.addressCon {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-right: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.name {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 6rpx;
|
||||
.phone {
|
||||
margin-left: 16rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: normal;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.line1.line2 {
|
||||
font-size: 26rpx;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
}
|
||||
.setaddress {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
.iconfont {
|
||||
flex-shrink: 0;
|
||||
margin-left: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.delivery-contact {
|
||||
padding: 0 24rpx;
|
||||
&__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 96rpx;
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
&__label {
|
||||
flex-shrink: 0;
|
||||
width: 140rpx;
|
||||
margin-right: 16rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
&__input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-actions {
|
||||
padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom));
|
||||
background: #ffffff;
|
||||
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.save-btn {
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
background: linear-gradient(131deg, #FA8735 0%, #FE3B48 100%);
|
||||
border-radius: 48rpx;
|
||||
&.is-disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -343,22 +343,40 @@ const checked = (addressInfo) => {
|
||||
uni.showToast({ title: '当前门店暂不支持自提', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.$emit('SELECT_PICK_UP_INFO', {
|
||||
addressInfo,
|
||||
});
|
||||
const routerBack = sheep?.$router?.back;
|
||||
if (typeof routerBack === 'function') {
|
||||
try {
|
||||
routerBack.call(sheep.$router);
|
||||
return;
|
||||
} catch (e) {
|
||||
console.error('[checked] sheep.$router.back err', e);
|
||||
const goBackSafe = () => {
|
||||
const fallbackBack = () => {
|
||||
try {
|
||||
uni.navigateBack({
|
||||
fail: () => {
|
||||
try {
|
||||
const go = sheep?.$router?.go;
|
||||
if (typeof go === 'function') {
|
||||
go.call(sheep.$router, '/pages/order/modifyDelivery');
|
||||
return;
|
||||
}
|
||||
} catch (e2) { /* ignore */ }
|
||||
try { uni.redirectTo({ url: '/pages/order/modifyDelivery' }); } catch (e3) { /* ignore */ }
|
||||
},
|
||||
});
|
||||
} catch (e) {}
|
||||
};
|
||||
const routerBack = sheep?.$router?.back;
|
||||
if (typeof routerBack === 'function') {
|
||||
try {
|
||||
routerBack.call(sheep.$router);
|
||||
return;
|
||||
} catch (e) {
|
||||
fallbackBack();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
uni.navigateBack();
|
||||
} catch (e) {
|
||||
console.error('[checked] top exception', e);
|
||||
}
|
||||
fallbackBack();
|
||||
};
|
||||
try {
|
||||
uni.$emit('SELECT_PICK_UP_INFO', { addressInfo });
|
||||
} catch (e) {}
|
||||
goBackSafe();
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
const onSelect = (item) => {
|
||||
|
||||
Reference in New Issue
Block a user