Compare commits
11
Commits
9ade530194
...
v1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b090a3c070 | ||
|
|
39100c71be | ||
|
|
1c34e15f8a | ||
|
|
0cbbf4309d | ||
|
|
82f6737820 | ||
|
|
4b0aab8a51 | ||
|
|
6d2f1c4fdb | ||
|
|
31c4aa36a5 | ||
|
|
8dee31e18c | ||
|
|
4e190b5879 | ||
|
|
2a25354ee4 |
@@ -1,36 +1,20 @@
|
||||
# 版本号
|
||||
SHOPRO_VERSION=v2.4.1
|
||||
# 后端接口 - 正式环境(通过 process.env.NODE_ENV 非 development)
|
||||
SHOPRO_BASE_URL=https://yougou.api.qflyqzy.net
|
||||
# SHOPRO_BASE_URL=https://yougoutest.api.riananyoumu.com
|
||||
|
||||
# 后端接口 - 测试环境(通过 process.env.NODE_ENV = development)
|
||||
|
||||
# 霍慧超
|
||||
#SHOPRO_DEV_BASE_URL=http://192.168.101.7:48092
|
||||
|
||||
# 陈力
|
||||
# SHOPRO_DEV_BASE_URL=http://192.168.101.57:48092
|
||||
|
||||
# 张吉生
|
||||
#SHOPRO_DEV_BASE_URL=http://192.168.101.58:48090
|
||||
SHOPRO_BASE_URL=https://kyj.api.suwizihe.org.cn
|
||||
|
||||
# 服务器
|
||||
# SHOPRO_DEV_BASE_URL=https://yougou.api.qflyqzy.net
|
||||
|
||||
# SHOPRO_DEV_BASE_URL=https://www.qflyqzy.net/yg-api
|
||||
SHOPRO_DEV_BASE_URL=https://kyj.api.suwizihe.org.cn
|
||||
|
||||
# 伟伟
|
||||
# SHOPRO_DEV_BASE_URL=http://192.168.1.7:48080
|
||||
|
||||
# 测试环境
|
||||
SHOPRO_DEV_BASE_URL=https://yougoutest.api.riananyoumu.com
|
||||
# SHOPRO_DEV_BASE_URL=https://yougoutest.api.riananyoumu.com
|
||||
|
||||
# 本地
|
||||
# SHOPRO_DEV_BASE_URL=http://192.168.1.3:48080
|
||||
|
||||
### SHOPRO_DEV_BASE_URL=http://10.171.1.188:48090
|
||||
### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
|
||||
SHOPRO_UPLOAD_TYPE=server
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
- 更改版本号
|
||||
- 当前版本号`1.4.1`
|
||||
- 包名:`uni.UNI8B187414/com.yougou.mall`
|
||||
- 应用名称:`优购商城`
|
||||
- 应用名称:`康源家园`
|
||||
- appId:`__UNI__8B19741`
|
||||
- api地址`.env`:
|
||||
- 线上`https://www.qflyqzy.net/yg-api`
|
||||
|
||||
@@ -15,14 +15,17 @@
|
||||
>
|
||||
催一催
|
||||
</view>
|
||||
<view
|
||||
v-if="showModifyDeliveryBtn"
|
||||
class="btn size28 f500 modify-delivery-btn"
|
||||
@click.stop="btnClick(13)"
|
||||
>
|
||||
修改配送
|
||||
</view>
|
||||
<view v-for="(item, index) in btns" :key="index">
|
||||
<view
|
||||
v-if="
|
||||
item.id !== 3 &&
|
||||
item.value.split(',').indexOf(String(props?.data?.status)) !== -1 &&
|
||||
!(item.id === 3 && Number(props?.data?.type) === 5) &&
|
||||
!(item.id === 3 && props?.data?.payChannelCode === 'cash_payment') &&
|
||||
!(item.id === 3 && isAllRefunded)
|
||||
shouldShowBtn(item)
|
||||
"
|
||||
class="btn size28 f500"
|
||||
@click.stop="btnClick(item.id)"
|
||||
@@ -105,6 +108,38 @@
|
||||
isSorting.value
|
||||
);
|
||||
});
|
||||
|
||||
const isThirdPartyOrder = computed(() => {
|
||||
const d = props.data || {};
|
||||
if (d.thirdPartyOrder === true || d.thirdPartyOrder === 'true' || d.thirdPartyOrder === 1) {
|
||||
return true;
|
||||
}
|
||||
const items = Array.isArray(d.items) ? d.items : [];
|
||||
return items.some(
|
||||
(it) => it.thirdPartyOrder === true || it.thirdPartyOrder === 'true' || it.thirdPartyOrder === 1,
|
||||
);
|
||||
});
|
||||
const showModifyDeliveryBtn = computed(() => {
|
||||
if (!isThirdPartyOrder.value) return false;
|
||||
const d = props.data || {};
|
||||
const canUpdate = d.canUpdateDeliveryType === true || d.canUpdateDeliveryType === 'true' || d.canUpdateDeliveryType === 1;
|
||||
if (!canUpdate) return false;
|
||||
return String(d?.status) === '10';
|
||||
});
|
||||
|
||||
const shouldShowBtn = (item) => {
|
||||
if (item.id !== 3 && item.value.split(',').indexOf(String(props?.data?.status)) === -1) {
|
||||
return false;
|
||||
}
|
||||
if (item.id === 3 && Number(props?.data?.type) === 5) return false;
|
||||
if (item.id === 3 && props?.data?.payChannelCode === 'cash_payment') return false;
|
||||
if (item.id === 3 && isAllRefunded.value) return false;
|
||||
if (Number(props.data?.deliveryType) === 2 && [4, 8, 11].includes(item.id)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
let btns = ref([
|
||||
{
|
||||
id: 1,
|
||||
@@ -144,6 +179,11 @@
|
||||
name: '取消售后',
|
||||
value: '60',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: '删除订单',
|
||||
value: '40',
|
||||
},
|
||||
]);
|
||||
const btnClick = (index) => {
|
||||
let timestamp = new Date().getTime();
|
||||
@@ -189,6 +229,12 @@
|
||||
case 7:
|
||||
remindStore();
|
||||
break;
|
||||
case 8:
|
||||
deleteOrder();
|
||||
break;
|
||||
case 13:
|
||||
goModifyDelivery();
|
||||
break;
|
||||
}
|
||||
};
|
||||
// 取消订单
|
||||
@@ -215,6 +261,28 @@
|
||||
},
|
||||
});
|
||||
};
|
||||
const deleteOrder = () => {
|
||||
const orderId = props.data?.id;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除订单吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { code } = await OrderApi.deleteOrder(orderId);
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
title: '订单已删除',
|
||||
icon: 'none',
|
||||
});
|
||||
upData();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
// 去付款
|
||||
const payOrder = (id) => {
|
||||
sheep.$router.go('/pages/pay/index', {
|
||||
@@ -280,6 +348,22 @@
|
||||
const upData = () => {
|
||||
emit('downData');
|
||||
};
|
||||
const goModifyDelivery = () => {
|
||||
const id = props.data?.orderId || props.data?.id;
|
||||
if (!id) return;
|
||||
const params = {
|
||||
id,
|
||||
orderTypeId: 1,
|
||||
currentType: 0,
|
||||
};
|
||||
if (props.data?.type !== undefined && props.data?.type !== null) {
|
||||
params.type = props.data.type;
|
||||
}
|
||||
if (props.data?.__source) {
|
||||
params.source = props.data.__source;
|
||||
}
|
||||
sheep.$router.go('/pages/order/modifyDelivery', params);
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.more {
|
||||
@@ -305,4 +389,9 @@
|
||||
background: rgba(37, 86, 236, 0.08);
|
||||
border: 2rpx solid rgba(37, 86, 236, 0.28);
|
||||
}
|
||||
.modify-delivery-btn {
|
||||
color: #1677FF;
|
||||
background: rgba(22, 119, 255, 0.06);
|
||||
border: 2rpx solid rgba(22, 119, 255, 0.28);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<view class="tabbar-wrap">
|
||||
<view class="tabbar safe-bottom">
|
||||
<image class="tabbar-bg" :src="bgSrc" mode="scaleToFill" />
|
||||
<!-- :src="bgSrc" -->
|
||||
<image class="tabbar-bg" mode="scaleToFill" />
|
||||
<view class="tabbar-inner">
|
||||
<view
|
||||
v-for="item in items"
|
||||
@@ -92,19 +93,19 @@
|
||||
iconPath: '/static/index/2.png',
|
||||
selectedIconPath: '/static/index/blue_icon/2_1.png',
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/home/seed',
|
||||
text: '',
|
||||
iconPath: '/static/index/jinzhongzi.png',
|
||||
selectedIconPath: '/static/index/jinzhongzi.png',
|
||||
isMid: true,
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/cart/cart',
|
||||
text: '购物车',
|
||||
iconPath: '/static/index/3.png',
|
||||
selectedIconPath: '/static/index/blue_icon/3_1.png',
|
||||
},
|
||||
// {
|
||||
// pagePath: '/pages/home/seed',
|
||||
// text: '',
|
||||
// iconPath: '/static/index/jinzhongzi.png',
|
||||
// selectedIconPath: '/static/index/jinzhongzi.png',
|
||||
// isMid: true,
|
||||
// },
|
||||
// {
|
||||
// pagePath: '/pages/cart/cart',
|
||||
// text: '购物车',
|
||||
// iconPath: '/static/index/3.png',
|
||||
// selectedIconPath: '/static/index/blue_icon/3_1.png',
|
||||
// },
|
||||
{
|
||||
pagePath: '/pages/index/user',
|
||||
text: '我的',
|
||||
@@ -212,6 +213,7 @@
|
||||
bottom: env(safe-area-inset-bottom);
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #ffffff;
|
||||
filter: drop-shadow(0 -6rpx 24rpx rgba(0, 0, 0, 0.12));
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
>
|
||||
催一催
|
||||
</view>
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10 modify-delivery-btn"
|
||||
v-if="showModifyDelivery"
|
||||
@tap.stop="emit('modifyDelivery')"
|
||||
>
|
||||
修改配送
|
||||
</view>
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
v-if="showDelay && !props.disableDelayShipment"
|
||||
@@ -129,6 +136,27 @@
|
||||
type: [Number, String],
|
||||
default: '',
|
||||
},
|
||||
thirdPartyOrder: {
|
||||
type: [Boolean, Number, String],
|
||||
default: false,
|
||||
},
|
||||
canUpdateDeliveryType: {
|
||||
type: [Boolean, Number, String],
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const isThirdPartyOrder = computed(() => {
|
||||
const v = props.thirdPartyOrder;
|
||||
if (v === true || v === 'true' || v === 1) return true;
|
||||
return false;
|
||||
});
|
||||
const showModifyDelivery = computed(() => {
|
||||
if (!isThirdPartyOrder.value) return false;
|
||||
const v = props.canUpdateDeliveryType;
|
||||
if (!(v === true || v === 'true' || v === 1)) return false;
|
||||
const s = Number(props.status);
|
||||
return s === 10;
|
||||
});
|
||||
|
||||
// 延迟发货按钮:仅允许【待发货(10/伪50)、部分发货(15)】状态展示
|
||||
@@ -197,7 +225,7 @@
|
||||
);
|
||||
});
|
||||
|
||||
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel', 'express', 'remind']);
|
||||
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel', 'express', 'remind', 'modifyDelivery']);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -206,4 +234,9 @@
|
||||
background: rgba(37, 86, 236, 0.08);
|
||||
border: 2rpx solid rgba(37, 86, 236, 0.28) !important;
|
||||
}
|
||||
.modify-delivery-btn {
|
||||
color: #1677FF !important;
|
||||
background: rgba(22, 119, 255, 0.06);
|
||||
border: 2rpx solid rgba(22, 119, 255, 0.28) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -87,6 +87,8 @@
|
||||
:logisticsNo="props.data.logisticsNo"
|
||||
:deliveryTime="props.data.deliveryTime"
|
||||
:hasLogistics="hasLogistics"
|
||||
:thirdPartyOrder="resolveThirdPartyOrder()"
|
||||
:canUpdateDeliveryType="props.data?.canUpdateDeliveryType"
|
||||
@delay="onDelayShipment"
|
||||
@now="onNowShipment"
|
||||
@view="goAiOrderInfo"
|
||||
@@ -94,6 +96,7 @@
|
||||
@pay="goPay"
|
||||
@cancel="cancelAiOrder"
|
||||
@express="goExpressLog"
|
||||
@modifyDelivery="goModifyDelivery"
|
||||
/>
|
||||
</view>
|
||||
<view class="" style="margin-top: 32rpx" v-else-if="!props.isAfterSale">
|
||||
@@ -231,6 +234,44 @@
|
||||
Number(props.data?.type) === 4 ||
|
||||
Number(props.data?.type) === 5;
|
||||
const isAiStoreOrder = computed(() => String(props.data?.__source) === 'aishop');
|
||||
const resolveThirdPartyOrder = () => {
|
||||
const d = props.data || {};
|
||||
if (d.thirdPartyOrder === true || d.thirdPartyOrder === 'true' || d.thirdPartyOrder === 1) {
|
||||
return true;
|
||||
}
|
||||
const items = Array.isArray(d.items) ? d.items : [];
|
||||
return items.some(
|
||||
(it) => it.thirdPartyOrder === true || it.thirdPartyOrder === 'true' || it.thirdPartyOrder === 1,
|
||||
);
|
||||
};
|
||||
const resolveOrderTypeForModify = () => {
|
||||
const t = Number(props.data?.type ?? 0);
|
||||
if (t === 4 || t === 5) return t;
|
||||
// 只要能触发 AiOrderActionBar 的 modifyDelivery 按钮,就是 AI/店铺类订单
|
||||
if (isAiActionOrder) return 4;
|
||||
return 1;
|
||||
};
|
||||
const goModifyDelivery = () => {
|
||||
const id = props.data?.id || props.data?.orderId;
|
||||
if (!id) return;
|
||||
const dataType = Number(props.data?.type ?? 0);
|
||||
let finalType = dataType;
|
||||
if (finalType !== 4 && finalType !== 5) {
|
||||
finalType = isAiActionOrder ? 4 : 1;
|
||||
}
|
||||
const finalSource = props.data?.__source || (isAiActionOrder ? 'aishop' : '');
|
||||
const currentType = isAiStoreOrder.value || isAiActionOrder ? 1 : 0;
|
||||
const params = {
|
||||
id,
|
||||
orderTypeId: resolveOrderTypeForModify(),
|
||||
type: finalType,
|
||||
currentType,
|
||||
};
|
||||
if (finalSource) {
|
||||
params.source = finalSource;
|
||||
}
|
||||
proxy.utils.go('/pages/order/modifyDelivery', params);
|
||||
};
|
||||
const isPickUpOrder = computed(() => {
|
||||
if (Number(props.data?.deliveryType) === 2) return true;
|
||||
return Boolean(
|
||||
@@ -781,8 +822,8 @@
|
||||
}
|
||||
|
||||
.pickup-tag {
|
||||
margin-left: 16rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
margin-left: 10rpx;
|
||||
padding: 2rpx 7rpx;
|
||||
line-height: 1.6;
|
||||
font-size: 22rpx;
|
||||
color: #2556ec;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
||||
<title>优购商城</title>
|
||||
<title>康源家园</title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
|
||||
@@ -19,7 +19,6 @@ import { gethotupdatelist } from '@/sheep/api/index/index'
|
||||
// import { setupVConsole } from '@/utils/vconsole.js'
|
||||
|
||||
|
||||
|
||||
export function createApp() {
|
||||
|
||||
// setupVConsole();
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name" : "优购商城",
|
||||
"name" : "康源家园",
|
||||
"appid" : "__UNI__8B19741",
|
||||
"description" : "",
|
||||
"versionName" : "1.7.3",
|
||||
"versionCode" : 173,
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : 100,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"privacy" : {
|
||||
|
||||
+17
@@ -297,6 +297,16 @@
|
||||
"auth": true,
|
||||
"title": "物流轨迹"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "modifyDelivery",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改配送"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true,
|
||||
"title": "修改配送"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -851,6 +861,13 @@
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "seedExchange",
|
||||
"style": {
|
||||
"navigationBarTitleText": "金种子兑换",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pointsDetail",
|
||||
"style": {
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@
|
||||
<radio color="#FB4D32" class="radio" value="1" :checked="radioValue" />
|
||||
<view class="flex-center size24">
|
||||
我已阅读并同意
|
||||
<text class="c8" @click="go()">《臻选优购服务协议》</text>
|
||||
<text class="c8" @click="go()">《臻选康源家服务协议》</text>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
|
||||
+208
-66
@@ -32,6 +32,7 @@
|
||||
</view>
|
||||
<view class="tip-text">{{ amountTipText }}</view>
|
||||
</view>
|
||||
|
||||
<view class="card code-card">
|
||||
<view class=" code-row--mobile">
|
||||
<view class="code-label size28">手机号</view>
|
||||
@@ -44,8 +45,18 @@
|
||||
:maxlength="11"
|
||||
/>
|
||||
</view>
|
||||
<view
|
||||
v-if="isHuaxiaType && showHuaxiaMobileTip"
|
||||
:class="[
|
||||
'huaxia-mobile-tip',
|
||||
{ 'huaxia-mobile-tip--verified': isHuaxiaMobileVerified },
|
||||
]"
|
||||
>
|
||||
{{ isHuaxiaMobileVerified ? '账户核验完成' : '请正确输入华夏手机号' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="card code-card">
|
||||
|
||||
<view v-if="requireSmsCode" class="card code-card">
|
||||
<view class="code-row">
|
||||
<uni-easyinput
|
||||
v-model="smsCode"
|
||||
@@ -78,7 +89,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, watch, onBeforeUnmount } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as payApi from '@/sheep/api/home/pay';
|
||||
import * as incrementApi from '@/sheep/api/increment';
|
||||
@@ -94,10 +105,86 @@
|
||||
let smsTimer = null;
|
||||
const submitting = ref(false);
|
||||
const liquidationType = ref(1);
|
||||
const pageTitle = ref('去变现');
|
||||
const channelId = ref(null);
|
||||
const pageTitle = computed(
|
||||
() =>
|
||||
({
|
||||
1: '去变现',
|
||||
2: '无双变现',
|
||||
3: '华夏变现',
|
||||
}[Number(liquidationType.value)] || '去变现'),
|
||||
);
|
||||
const integerOnly = computed(() => Number(liquidationType.value) === 2);
|
||||
const isHuaxiaType = computed(() => Number(liquidationType.value) === 3);
|
||||
const requireSmsCode = computed(() => !isHuaxiaType.value);
|
||||
const amountPlaceholder = computed(() => (integerOnly.value ? '00' : '00.00'));
|
||||
const amountTipText = computed(() => (integerOnly.value ? '请输入整数变现金额' : '请输入去变现数量'));
|
||||
const amountTipText = computed(() =>
|
||||
integerOnly.value ? '请输入整数变现金额' : isHuaxiaType.value ? '请输入变现金额' : '请输入去变现数量'
|
||||
);
|
||||
|
||||
const huaxiaMobileRegistered = ref(null);
|
||||
const checkingHuaxiaMobile = ref(false);
|
||||
let huaxiaCheckTimer = null;
|
||||
const isHuaxiaMobileVerified = computed(
|
||||
() => huaxiaMobileRegistered.value === true,
|
||||
);
|
||||
const showHuaxiaMobileTip = computed(() => {
|
||||
if (!isHuaxiaType.value) return false;
|
||||
const mobile = String(smsMobile.value || '').trim();
|
||||
if (!isMobileValid(mobile)) return false;
|
||||
if (checkingHuaxiaMobile.value) return false;
|
||||
return (
|
||||
huaxiaMobileRegistered.value === false ||
|
||||
huaxiaMobileRegistered.value === true
|
||||
);
|
||||
});
|
||||
|
||||
const isMobileValid = (val) => /^1\d{10}$/.test(String(val ?? '').trim());
|
||||
|
||||
const checkHuaxiaMobile = async (mobile) => {
|
||||
if (!isHuaxiaType.value || !isMobileValid(mobile)) return;
|
||||
checkingHuaxiaMobile.value = true;
|
||||
try {
|
||||
const params = { mobile };
|
||||
if (channelId.value != null && channelId.value !== '') {
|
||||
params.channelId = Number(channelId.value);
|
||||
}
|
||||
const res = await incrementApi
|
||||
.checkHuaxiaMobile(params)
|
||||
.catch(() => ({ code: -1, data: false }));
|
||||
if (res?.code === 0) {
|
||||
huaxiaMobileRegistered.value = !!res?.data;
|
||||
} else {
|
||||
huaxiaMobileRegistered.value = null;
|
||||
}
|
||||
} finally {
|
||||
checkingHuaxiaMobile.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => smsMobile.value,
|
||||
(val) => {
|
||||
huaxiaMobileRegistered.value = null;
|
||||
if (huaxiaCheckTimer) {
|
||||
clearTimeout(huaxiaCheckTimer);
|
||||
huaxiaCheckTimer = null;
|
||||
}
|
||||
const mobile = String(val || '').trim();
|
||||
if (!isHuaxiaType.value) return;
|
||||
if (!isMobileValid(mobile)) return;
|
||||
huaxiaCheckTimer = setTimeout(() => {
|
||||
checkHuaxiaMobile(mobile);
|
||||
}, 300);
|
||||
},
|
||||
);
|
||||
|
||||
const stopCountdown = () => {
|
||||
if (smsTimer) {
|
||||
clearInterval(smsTimer);
|
||||
smsTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const sanitizeAmountInput = (val) => {
|
||||
let next = String(val ?? '').replace(integerOnly.value ? /[^\d]/g : /[^\d.]/g, '');
|
||||
@@ -149,66 +236,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
if (submitting.value) return;
|
||||
const amt = amountNumber.value;
|
||||
if (!amt) {
|
||||
sheep.$helper.toast(integerOnly.value ? '请输入整数变现金额' : '请输入去变现数量');
|
||||
return;
|
||||
}
|
||||
if (integerOnly.value && !Number.isInteger(amt)) {
|
||||
sheep.$helper.toast('无双变现金额只能输入整数');
|
||||
return;
|
||||
}
|
||||
if (amt > availableYuan.value) {
|
||||
sheep.$helper.toast('变现金额不能大于钱包余额');
|
||||
amount.value = availableYuan.value > 0
|
||||
? integerOnly.value
|
||||
? String(Math.floor(availableYuan.value))
|
||||
: String(availableYuan.value.toFixed(2))
|
||||
: '0';
|
||||
return;
|
||||
}
|
||||
if (!String(smsCode.value || '').trim()) {
|
||||
sheep.$helper.toast('请输入验证码');
|
||||
return;
|
||||
}
|
||||
const mobile = resolveMobile();
|
||||
if (!mobile) return;
|
||||
const money = Math.round(amt * 100);
|
||||
const payload = { money, mobile, scene: smsScene, code: smsCode.value, type: liquidationType.value };
|
||||
submitting.value = true;
|
||||
try {
|
||||
const res = await incrementApi.walletLiquidation(payload).catch(() => ({ code: -1 }));
|
||||
if (res?.code === 0) {
|
||||
sheep.$helper.toast('变现成功,请等待审核');
|
||||
amount.value = '';
|
||||
smsCode.value = '';
|
||||
refreshWallet();
|
||||
return;
|
||||
}
|
||||
if (res?.code === 1006001000) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未实名认证,是否前往实名认证?',
|
||||
cancelText: '取消',
|
||||
confirmText: '去认证',
|
||||
success: (modalRes) => {
|
||||
if (!modalRes?.confirm) return;
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/realname',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const resolveMobile = () => {
|
||||
const mobile = String(smsMobile.value || '').trim();
|
||||
if (!/^1\d{10}$/.test(mobile)) {
|
||||
if (!isMobileValid(mobile)) {
|
||||
sheep.$helper.toast('请输入正确手机号');
|
||||
return '';
|
||||
}
|
||||
@@ -216,6 +246,7 @@
|
||||
};
|
||||
|
||||
const sendSmsCode = async () => {
|
||||
if (isHuaxiaType.value) return;
|
||||
if (smsCountdown.value > 0) return;
|
||||
const amt = amountNumber.value;
|
||||
if (!amt) {
|
||||
@@ -246,6 +277,74 @@
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
if (submitting.value) return;
|
||||
const amt = amountNumber.value;
|
||||
if (!amt) {
|
||||
sheep.$helper.toast(integerOnly.value ? '请输入整数变现金额' : (isHuaxiaType.value ? '请输入变现金额' : '请输入去变现数量'));
|
||||
return;
|
||||
}
|
||||
if (integerOnly.value && !Number.isInteger(amt)) {
|
||||
sheep.$helper.toast('无双变现金额只能输入整数');
|
||||
return;
|
||||
}
|
||||
if (amt > availableYuan.value) {
|
||||
sheep.$helper.toast('变现金额不能大于钱包余额');
|
||||
amount.value = availableYuan.value > 0
|
||||
? integerOnly.value
|
||||
? String(Math.floor(availableYuan.value))
|
||||
: String(availableYuan.value.toFixed(2))
|
||||
: '0';
|
||||
return;
|
||||
}
|
||||
const mobile = resolveMobile();
|
||||
if (!mobile) return;
|
||||
if (requireSmsCode.value) {
|
||||
if (!String(smsCode.value || '').trim()) {
|
||||
sheep.$helper.toast('请输入验证码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const money = Math.round(amt * 100);
|
||||
const payload = { money, mobile, type: liquidationType.value };
|
||||
if (requireSmsCode.value) {
|
||||
payload.scene = smsScene;
|
||||
payload.code = String(smsCode.value || '').trim();
|
||||
}
|
||||
if (channelId.value != null && channelId.value !== '') {
|
||||
payload.channelId = Number(channelId.value);
|
||||
}
|
||||
submitting.value = true;
|
||||
try {
|
||||
const res = await incrementApi.walletLiquidation(payload).catch(() => ({ code: -1 }));
|
||||
if (res?.code === 0) {
|
||||
sheep.$helper.toast('变现成功,请等待审核');
|
||||
amount.value = '';
|
||||
smsCode.value = '';
|
||||
refreshWallet();
|
||||
return;
|
||||
}
|
||||
if (res?.code === 1006001000) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未实名认证,是否前往实名认证?',
|
||||
cancelText: '取消',
|
||||
confirmText: '去认证',
|
||||
success: (modalRes) => {
|
||||
if (!modalRes?.confirm) return;
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/realname',
|
||||
});
|
||||
},
|
||||
});
|
||||
} else if (res?.msg) {
|
||||
sheep.$helper.toast(res.msg);
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const goRecord = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/home/liquidationRecord?type=${liquidationType.value}`,
|
||||
@@ -254,15 +353,46 @@
|
||||
|
||||
onLoad((options) => {
|
||||
const nextType = Number(options?.type || 1);
|
||||
liquidationType.value = nextType === 2 ? 2 : 1;
|
||||
pageTitle.value = liquidationType.value === 2 ? '无双变现' : String(options?.title || '去变现');
|
||||
liquidationType.value = [1, 2, 3].includes(nextType) ? nextType : 1;
|
||||
if (options?.channelId != null && options?.channelId !== '') {
|
||||
channelId.value = Number(options.channelId);
|
||||
}
|
||||
try {
|
||||
uni.setNavigationBarTitle({ title: pageTitle.value });
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
watch(
|
||||
() => liquidationType.value,
|
||||
() => {
|
||||
try {
|
||||
uni.setNavigationBarTitle({ title: pageTitle.value });
|
||||
} catch (e) {}
|
||||
},
|
||||
);
|
||||
|
||||
onShow(async () => {
|
||||
refreshWallet();
|
||||
const userStore = sheep.$store('user');
|
||||
try {
|
||||
await userStore.getInfo();
|
||||
} catch (e) {}
|
||||
const mobile = userStore?.userInfo?.mobile;
|
||||
if (!smsMobile.value && mobile) smsMobile.value = mobile;
|
||||
if (mobile && !smsMobile.value) smsMobile.value = mobile;
|
||||
if (isHuaxiaType.value) {
|
||||
const curMobile = String(smsMobile.value || '').trim();
|
||||
if (isMobileValid(curMobile)) {
|
||||
await checkHuaxiaMobile(curMobile);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
stopCountdown();
|
||||
if (huaxiaCheckTimer) {
|
||||
clearTimeout(huaxiaCheckTimer);
|
||||
huaxiaCheckTimer = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -401,6 +531,18 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.huaxia-mobile-tip {
|
||||
margin-top: 8rpx;
|
||||
padding-left: 4rpx;
|
||||
color: #ff4d4f;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
|
||||
&.huaxia-mobile-tip--verified {
|
||||
color: #12b46b;
|
||||
}
|
||||
}
|
||||
|
||||
.tip-card {
|
||||
margin-top: 20rpx;
|
||||
padding: 28rpx;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<s-pages title="提现" :pink_bg="true">
|
||||
<view class="pages p-y-28 p-x-40 c0">
|
||||
<!-- <view class="m-b-20 tab-header">
|
||||
<text class="tab-item" :class="{ active: type === 'yougou' }" @click="changeType('yougou')">优购提现</text>
|
||||
<text class="tab-item" :class="{ active: type === 'yougou' }" @click="changeType('yougou')">康源家提现</text>
|
||||
<text class="tab-item m-l-20" :class="{ active: type === 'huamao' }"
|
||||
@click="changeType('huamao')">华贸提现</text>
|
||||
</view> -->
|
||||
|
||||
+49
-7
@@ -52,10 +52,14 @@
|
||||
</view>
|
||||
<view class="seed-card seed-card--summary m-b-50">
|
||||
<view class="seed-summary__top">
|
||||
<view class="seed-summary__label">当前价格</view>
|
||||
<view class="seed-summary__price">
|
||||
{{ formatSeedPrice(dataObj.todayPrice) }}
|
||||
<!-- **.**** -->
|
||||
<view class="seed-summary__price-col">
|
||||
<view class="seed-summary__label">当前价格</view>
|
||||
<view class="seed-summary__price">
|
||||
{{ formatSeedPrice(dataObj.todayPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="seed-summary__action">
|
||||
<view class="seed-summary__btn" @click="goExchange">兑换</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="seed-summary__divider"></view>
|
||||
@@ -65,6 +69,11 @@
|
||||
<view class="seed-summary__item-value">{{ dataObj.myCount || 0 }}</view>
|
||||
</view>
|
||||
<view class="seed-summary__v-divider"></view>
|
||||
<view class="seed-summary__item">
|
||||
<view class="seed-summary__item-label">冻结数量</view>
|
||||
<view class="seed-summary__item-value">{{ dataObj.frozenCount || 0 }}</view>
|
||||
</view>
|
||||
<view class="seed-summary__v-divider"></view>
|
||||
<view class="seed-summary__item">
|
||||
<view class="seed-summary__item-label">已核销</view>
|
||||
<view class="seed-summary__item-value">{{ dataObj.writeOffCount || 0 }}</view>
|
||||
@@ -664,6 +673,10 @@
|
||||
});
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
|
||||
const goExchange = () => {
|
||||
uni.navigateTo({ url: '/pages/home/seedExchange' });
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
@@ -768,13 +781,14 @@
|
||||
}
|
||||
|
||||
.seed-card {
|
||||
background: #ffffff;
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.5);
|
||||
border-radius: 28rpx;
|
||||
overflow: hidden;
|
||||
padding: 24rpx 20rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
box-shadow: 0 8rpx 22rpx rgba(38, 107, 246, 0.55);
|
||||
}
|
||||
|
||||
.seed-card--summary {
|
||||
@@ -782,9 +796,18 @@
|
||||
}
|
||||
|
||||
.seed-summary__top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.seed-summary__price-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
gap: 6rpx;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.seed-summary__label {
|
||||
@@ -800,6 +823,25 @@
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.seed-summary__action {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-top: 6rpx;
|
||||
}
|
||||
|
||||
.seed-summary__btn {
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
padding: 0 32rpx;
|
||||
border-radius: 32rpx;
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.seed-summary__divider {
|
||||
height: 1rpx;
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+121
-24
@@ -10,9 +10,15 @@
|
||||
<view class="more-trigger" @click.stop="toggleLiquidationMenu">
|
||||
<uni-icons type="more-filled" color="#fff" size="34rpx" />
|
||||
</view>
|
||||
<view v-if="showLiquidationMenu" class="more-menu">
|
||||
<view class="more-menu-item" @click.stop="goLiquidation">去变现</view>
|
||||
<view class="more-menu-item" @click.stop="goWushuangLiquidation">无双变现</view>
|
||||
<view v-if="showLiquidationMenu && enabledLiquidations.length" class="more-menu">
|
||||
<view
|
||||
v-for="item in enabledLiquidations"
|
||||
:key="item.type"
|
||||
class="more-menu-item"
|
||||
@click.stop="goLiquidationByType(item)"
|
||||
>
|
||||
{{ item.title }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="num size68 m-y-8" @click="jumpPage('充值', '/pages/home/recharge')">
|
||||
@@ -21,7 +27,7 @@
|
||||
<view class="line" />
|
||||
<view class="flex m-t-22 withdraw_row">
|
||||
<view class="title"> 可提现金额 </view>
|
||||
<view class="num m-l-34" @click="jumpPage('提现', '/pages/home/pay/withdraw')">
|
||||
<view class="num m-l-34" @click="onWithdrawClick">
|
||||
{{ $fen2yuan(money_obj?.withdrawAmount || 0) }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -43,15 +49,89 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as apiIndex from '@/sheep/api/index/index';
|
||||
import * as incrementApi from '@/sheep/api/increment';
|
||||
import goods from '@/components/goods/goods.vue';
|
||||
|
||||
const money_obj = ref();
|
||||
const tagList = ref([]);
|
||||
const showLiquidationMenu = ref(false);
|
||||
const tradeChannelList = ref([]);
|
||||
|
||||
const LIQUIDATION_TYPE_META = {
|
||||
1: { type: 1, title: '去变现', keywords: ['千里马', '去变现', '变现'] },
|
||||
2: { type: 2, title: '无双变现', keywords: ['无双'] },
|
||||
3: { type: 3, title: '华夏变现', keywords: ['华夏'] },
|
||||
};
|
||||
|
||||
const matchLiquidationMeta = (channel) => {
|
||||
const lt = Number(channel?.liquidationType);
|
||||
if ([1, 2, 3].includes(lt) && LIQUIDATION_TYPE_META[lt]) {
|
||||
return { type: lt, meta: LIQUIDATION_TYPE_META[lt] };
|
||||
}
|
||||
const name = String(channel?.channelName || channel?.name || '').trim();
|
||||
if (!name) return null;
|
||||
for (const key of Object.keys(LIQUIDATION_TYPE_META)) {
|
||||
const m = LIQUIDATION_TYPE_META[key];
|
||||
const keywords = Array.isArray(m?.keywords) ? m.keywords : [];
|
||||
if (keywords.some((kw) => name.includes(kw))) {
|
||||
return { type: Number(key), meta: m };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const enabledLiquidations = computed(() => {
|
||||
const channels = Array.isArray(tradeChannelList.value) ? tradeChannelList.value : [];
|
||||
const list = [];
|
||||
const added = new Set();
|
||||
channels.forEach((it) => {
|
||||
if (Number(it?.status) !== 1) return;
|
||||
const matched = matchLiquidationMeta(it);
|
||||
if (!matched) return;
|
||||
const type = matched.type;
|
||||
const meta = matched.meta;
|
||||
if (added.has(type)) return;
|
||||
added.add(type);
|
||||
list.push({
|
||||
type,
|
||||
title: meta.title,
|
||||
channelId: it?.id ?? it?.channelId,
|
||||
});
|
||||
});
|
||||
return list;
|
||||
});
|
||||
|
||||
const withdrawChannelEnabled = computed(() => {
|
||||
const channels = Array.isArray(tradeChannelList.value) ? tradeChannelList.value : [];
|
||||
const exact = channels.find(
|
||||
(it) => String(it?.channelName || it?.name || '').trim() === '去提现'
|
||||
);
|
||||
if (exact) return Number(exact?.status) === 1;
|
||||
const fuzzy = channels.find((it) => {
|
||||
const name = String(it?.channelName || it?.name || '').trim();
|
||||
return name.includes('去提现');
|
||||
});
|
||||
if (fuzzy) return Number(fuzzy?.status) === 1;
|
||||
const anyWithdrawLike = channels.find((it) => {
|
||||
const name = String(it?.channelName || it?.name || '').trim();
|
||||
return name.includes('提现');
|
||||
});
|
||||
if (anyWithdrawLike) return Number(anyWithdrawLike?.status) === 1;
|
||||
return !channels.length;
|
||||
});
|
||||
|
||||
const fetchTradeChannels = async () => {
|
||||
try {
|
||||
const res = await incrementApi.getTradeChannelList();
|
||||
if (res?.code === 0 && Array.isArray(res?.data)) {
|
||||
tradeChannelList.value = res.data;
|
||||
}
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
//获取钱包
|
||||
function getData() {
|
||||
@@ -72,19 +152,25 @@
|
||||
onLoad(() => {
|
||||
getData();
|
||||
});
|
||||
onMounted(() => {
|
||||
fetchTradeChannels();
|
||||
});
|
||||
//充值提现弹框提示去跳转
|
||||
function onWithdrawClick() {
|
||||
showLiquidationMenu.value = false;
|
||||
if (!withdrawChannelEnabled.value) {
|
||||
return;
|
||||
}
|
||||
jumpPage('提现', '/pages/home/pay/withdraw');
|
||||
}
|
||||
function jumpPage(typeTxt, url) {
|
||||
showLiquidationMenu.value = false;
|
||||
uni.showModal({
|
||||
// title: '',
|
||||
content: '是否去' + typeTxt,
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
//用户点击确定
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
uni.navigateTo({ url: url });
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -92,14 +178,26 @@
|
||||
function toggleLiquidationMenu() {
|
||||
showLiquidationMenu.value = !showLiquidationMenu.value;
|
||||
}
|
||||
function goLiquidation() {
|
||||
showLiquidationMenu.value = false;
|
||||
jumpPage('变现', '/pages/home/liquidation?type=1&title=去变现');
|
||||
}
|
||||
function goWushuangLiquidation() {
|
||||
function goLiquidationByType(item) {
|
||||
showLiquidationMenu.value = false;
|
||||
const type = Number(item?.type || 1);
|
||||
const title = item?.title || LIQUIDATION_TYPE_META[type]?.title || '去变现';
|
||||
const channelId = item?.channelId ? `&channelId=${item.channelId}` : '';
|
||||
if (type === 1) {
|
||||
uni.showModal({
|
||||
content: '是否去' + title,
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
uni.navigateTo({
|
||||
url: `/pages/home/liquidation?type=${type}${channelId}`,
|
||||
});
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/liquidation?type=2&title=无双变现',
|
||||
url: `/pages/home/liquidation?type=${type}${channelId}`,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -107,11 +205,10 @@
|
||||
<style lang="scss" scoped>
|
||||
.header {
|
||||
height: 318rpx;
|
||||
// background: linear-gradient(270deg, #75AFF6 0%, #366DEE 98.57%);
|
||||
margin: 32rpx;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
.header-content {
|
||||
padding: 80rpx 32rpx 24rpx;
|
||||
@@ -144,18 +241,18 @@
|
||||
|
||||
.more-menu {
|
||||
position: absolute;
|
||||
top: 62rpx;
|
||||
top: 58rpx;
|
||||
right: 0;
|
||||
min-width: 176rpx;
|
||||
min-width: 200rpx;
|
||||
padding: 10rpx;
|
||||
border-radius: 18rpx;
|
||||
background: rgba(26, 45, 88, 0.96);
|
||||
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.18);
|
||||
z-index: 10;
|
||||
background: rgba(26, 45, 88, 0.98);
|
||||
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.28);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.more-menu-item {
|
||||
height: 68rpx;
|
||||
height: 64rpx;
|
||||
padding: 0 24rpx;
|
||||
border-radius: 14rpx;
|
||||
color: #ffffff;
|
||||
|
||||
+2
-34
@@ -7,7 +7,7 @@
|
||||
<view class="pagesIndex">
|
||||
<view class="index-header">
|
||||
<view class="index-header__left">
|
||||
<view class="index-header__title">优购商城</view>
|
||||
<view class="index-header__title">康源家园</view>
|
||||
<view class="index-header__subtitle">AI店铺 · 一人店铺 · 共建共享</view>
|
||||
</view>
|
||||
<view class="index-notice-btn" @click="goNotice"></view>
|
||||
@@ -165,38 +165,6 @@
|
||||
},
|
||||
],
|
||||
});
|
||||
let nav = ref([
|
||||
{
|
||||
icon: 'i1.png',
|
||||
title: '大健康',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
icon: 'i2.png',
|
||||
title: '大农业',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
icon: 'i3.png',
|
||||
title: '大文旅',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
icon: 'i4.png',
|
||||
title: '本地生活',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
icon: 'i5.png',
|
||||
title: '数据处理',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
icon: 'i6.png',
|
||||
title: '跨境电商',
|
||||
url: '',
|
||||
},
|
||||
]);
|
||||
|
||||
const getBanner = () => {
|
||||
api
|
||||
@@ -217,7 +185,7 @@
|
||||
categoryId: 1,
|
||||
})
|
||||
.then((res) => {
|
||||
tagList.value = res.data;
|
||||
tagList.value = [res.data[res.data.length-1]];
|
||||
});
|
||||
};
|
||||
// 消息通知
|
||||
|
||||
+258
-80
@@ -110,7 +110,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showThirdPartyServiceCard" class="card card5 third-party-card bg24">
|
||||
<view
|
||||
v-if="showThirdPartyServiceCard&&false"
|
||||
class="card card5 third-party-card bg24"
|
||||
>
|
||||
<view class="card_title">第三方服务</view>
|
||||
|
||||
<view class="flex-center card5_con wrap ju-flex-start">
|
||||
@@ -118,10 +121,10 @@
|
||||
class="flex-center flex-column card5_item"
|
||||
v-for="(v, i) in thirdPartyServiceList"
|
||||
:key="i"
|
||||
@click="openThirdPartyService(v)"
|
||||
@click="onThirdPartyServiceClick(v)"
|
||||
>
|
||||
<view class="card5_icon third-party-icon m-b-18 w_84 h_84">
|
||||
<image :src="v.icon" mode="scaleToFill" />
|
||||
<image :src="getThirdPartyIcon(v.icon)" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="card5_name size28 color_3">{{ v.name }}</view>
|
||||
</view>
|
||||
@@ -134,9 +137,19 @@
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import cardTabber from '@/components/card_tabber/card_tabber.vue';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick, computed } from 'vue';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
computed,
|
||||
} from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { getWallet } from '@/sheep/api/home/pay';
|
||||
import * as incrementApi from '@/sheep/api/increment';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
@@ -176,20 +189,6 @@
|
||||
url: '/pages/home/pointsDetail?type=1',
|
||||
color: '#0ED72C',
|
||||
},
|
||||
// {
|
||||
// id: 2,
|
||||
// name: '佣金',
|
||||
// value: 'commission_num',
|
||||
// unit: '元',
|
||||
// url: '/pages/home/pointsDetail?type=2',
|
||||
// },
|
||||
// {
|
||||
// id: 3,
|
||||
// name: '代理收益',
|
||||
// value: 'agency_income',
|
||||
// unit: '元',
|
||||
// url: '/pages/home/pointsDetail?type=3',
|
||||
// },
|
||||
{
|
||||
id: 4,
|
||||
name: '消费金',
|
||||
@@ -231,81 +230,198 @@
|
||||
},
|
||||
]);
|
||||
let menuList = ref([
|
||||
{
|
||||
name: '邀请好友',
|
||||
icon: 'home/icon1.png',
|
||||
url: '/pages/home/share',
|
||||
},
|
||||
// {
|
||||
// name: '邀请好友',
|
||||
// icon: 'home/icon1.png',
|
||||
// url: '/pages/home/share',
|
||||
// },
|
||||
{
|
||||
name: '收货地址',
|
||||
icon: 'home/icon2.png',
|
||||
url: '/pages/user/address/list',
|
||||
},
|
||||
{
|
||||
name: '联系客服',
|
||||
icon: 'home/icon3.png',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
name: '意见反馈',
|
||||
icon: 'home/icon4.png',
|
||||
url: '/pages/home/feedback',
|
||||
},
|
||||
{
|
||||
name: '我的收藏',
|
||||
icon: 'home/icon5.png',
|
||||
url: '/pages/user/goods-collect',
|
||||
},
|
||||
{
|
||||
name: '我的收益',
|
||||
icon: 'home/icon6.png',
|
||||
url: '/pages/home/agency',
|
||||
},
|
||||
{
|
||||
name: '我的社员',
|
||||
icon: 'home/icon8.png',
|
||||
url: '/pages/home/staff',
|
||||
},
|
||||
// {
|
||||
// name: '联系客服',
|
||||
// icon: 'home/icon3.png',
|
||||
// url: '',
|
||||
// },
|
||||
// {
|
||||
// name: '意见反馈',
|
||||
// icon: 'home/icon4.png',
|
||||
// url: '/pages/home/feedback',
|
||||
// },
|
||||
// {
|
||||
// name: '我的收藏',
|
||||
// icon: 'home/icon5.png',
|
||||
// url: '/pages/user/goods-collect',
|
||||
// },
|
||||
// {
|
||||
// name: '我的收益',
|
||||
// icon: 'home/icon6.png',
|
||||
// url: '/pages/home/agency',
|
||||
// },
|
||||
// {
|
||||
// name: '我的社员',
|
||||
// icon: 'home/icon8.png',
|
||||
// url: '/pages/home/staff',
|
||||
// },
|
||||
{
|
||||
name: '设置',
|
||||
icon: 'home/icon7.png',
|
||||
url: '/pages/public/setting',
|
||||
},
|
||||
]);
|
||||
const showThirdPartyServiceCard = true;
|
||||
let thirdPartyServiceList = ref([
|
||||
{
|
||||
name: '无双',
|
||||
icon: '/static/icon/web/wushuang.png',
|
||||
title: '无双',
|
||||
url: 'https://shop.wushuange.com/web/#/pages/store/index?store_id=5',
|
||||
},
|
||||
]);
|
||||
const goReal = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/realname?status=' + realStatus.value,
|
||||
// query: obj,
|
||||
});
|
||||
};
|
||||
const go = (path, obj) => {
|
||||
if (!path) {
|
||||
// 打电话
|
||||
|
||||
// uni.makePhoneCall({
|
||||
// phoneNumber: '4000621698',
|
||||
// });
|
||||
uni.showToast({
|
||||
title: '功能开发中, 敬请期待',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
query: obj,
|
||||
});
|
||||
}
|
||||
const LIQUIDATION_TYPE_META = {
|
||||
2: {
|
||||
name: '无双',
|
||||
title: '无双',
|
||||
icon: '/static/icon/web/wushuang.png',
|
||||
keywords: ['无双'],
|
||||
},
|
||||
3: {
|
||||
name: '华夏',
|
||||
title: '华夏',
|
||||
inlineIcon: true,
|
||||
keywords: ['华夏'],
|
||||
},
|
||||
};
|
||||
|
||||
const matchChannelMeta = (channel) => {
|
||||
const lt = Number(channel?.liquidationType);
|
||||
if ([2, 3].includes(lt) && LIQUIDATION_TYPE_META[lt]) {
|
||||
return { liquidationType: lt, meta: LIQUIDATION_TYPE_META[lt] };
|
||||
}
|
||||
const name = String(channel?.channelName || channel?.name || '').trim();
|
||||
if (!name) return null;
|
||||
for (const key of Object.keys(LIQUIDATION_TYPE_META)) {
|
||||
const m = LIQUIDATION_TYPE_META[key];
|
||||
const keywords = Array.isArray(m?.keywords) ? m.keywords : [];
|
||||
if (keywords.some((kw) => name.includes(kw))) {
|
||||
return { liquidationType: Number(key), meta: m };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const WUSHUANG_DEFAULT_STORE_ID = 5;
|
||||
const resolveWushuangStoreId = () => WUSHUANG_DEFAULT_STORE_ID;
|
||||
const buildWushuangStoreUrl = (fallbackBaseUrl) => {
|
||||
const id = resolveWushuangStoreId();
|
||||
if (!id) return '';
|
||||
let base = String(fallbackBaseUrl || '').trim().replace(/`/g, '').trim();
|
||||
const tail = `/web/#/pages/store/index?store_id=${id}`;
|
||||
if (/^https?:\/\//i.test(base)) {
|
||||
const cleanBase = base.replace(/\/+$/, '');
|
||||
return cleanBase + tail;
|
||||
}
|
||||
return `https://shop.wushuange.com${tail}`;
|
||||
};
|
||||
|
||||
const buildHuaxiaInlineIcon = () => {
|
||||
const svg =
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 84 84">' +
|
||||
'<circle cx="42" cy="42" r="42" fill="#18b37b"/>' +
|
||||
'<text x="42" y="42" font-family="PingFang SC,Helvetica Neue,Microsoft YaHei,Arial,sans-serif" font-weight="700" font-size="30" fill="#ffffff" text-anchor="middle" dominant-baseline="middle">华夏</text>' +
|
||||
'</svg>';
|
||||
return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg);
|
||||
};
|
||||
|
||||
const tradeChannelList = ref([]);
|
||||
const fetchTradeChannels = async () => {
|
||||
try {
|
||||
const res = await incrementApi.getTradeChannelList();
|
||||
if (res?.code === 0 && Array.isArray(res?.data)) {
|
||||
tradeChannelList.value = res.data.filter((it) => Number(it?.status) === 1);
|
||||
}
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
const normalizeChannelUrl = (raw, liquidationType) => {
|
||||
let base = String(raw || '').trim().replace(/`/g, '').trim();
|
||||
if (!base) return '';
|
||||
if (Number(liquidationType) === 2) {
|
||||
return buildWushuangStoreUrl(base);
|
||||
}
|
||||
return base;
|
||||
};
|
||||
|
||||
const showThirdPartyServiceCard = computed(
|
||||
() => thirdPartyServiceList.value.length > 0,
|
||||
);
|
||||
const thirdPartyServiceList = computed(() => {
|
||||
const list = [];
|
||||
const added = new Set();
|
||||
const channels = Array.isArray(tradeChannelList.value) ? tradeChannelList.value : [];
|
||||
channels.forEach((it) => {
|
||||
if (Number(it?.status) !== 1) return;
|
||||
const matched = matchChannelMeta(it);
|
||||
if (!matched) return;
|
||||
const lt = matched.liquidationType;
|
||||
const meta = matched.meta;
|
||||
if (added.has(lt)) return;
|
||||
let url = '';
|
||||
if (lt !== 3) {
|
||||
url = normalizeChannelUrl(it?.baseUrl || it?.url, lt);
|
||||
if (!url) return;
|
||||
}
|
||||
added.add(lt);
|
||||
const item = {
|
||||
name: meta.name,
|
||||
title: meta.title,
|
||||
url,
|
||||
liquidationType: lt,
|
||||
channelId: it?.id ?? it?.channelId,
|
||||
channelBaseUrl: String(it?.baseUrl || it?.url || '').trim(),
|
||||
};
|
||||
if (meta.inlineIcon) {
|
||||
item.icon = buildHuaxiaInlineIcon();
|
||||
} else if (meta.icon) {
|
||||
item.icon = meta.icon;
|
||||
}
|
||||
list.push(item);
|
||||
});
|
||||
return list;
|
||||
});
|
||||
|
||||
const getThirdPartyIcon = (icon) => {
|
||||
const iconText = String(icon || '');
|
||||
if (iconText.startsWith('data:') || iconText.startsWith('/')) {
|
||||
return iconText;
|
||||
}
|
||||
return iconText;
|
||||
};
|
||||
|
||||
const showModalAsync = (options) =>
|
||||
new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
...(options || {}),
|
||||
success: (res) => resolve(res),
|
||||
fail: () => resolve({ confirm: false, cancel: true }),
|
||||
});
|
||||
});
|
||||
|
||||
const pendingThirdPartyItem = ref(null);
|
||||
const ensureRealNameOrRedirect = async (item) => {
|
||||
if (Number(realStatus.value || dataInfo.value?.realStatus) === 1) return true;
|
||||
pendingThirdPartyItem.value = item || null;
|
||||
const res = await showModalAsync({
|
||||
title: '实名认证提示',
|
||||
content: '使用华夏服务需先完成实名认证,是否前往认证?',
|
||||
confirmText: '去认证',
|
||||
cancelText: '取消',
|
||||
confirmColor: '#2c8cfa',
|
||||
});
|
||||
if (!res?.confirm) {
|
||||
pendingThirdPartyItem.value = null;
|
||||
return false;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/realname?status=0',
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
const openThirdPartyService = (item) => {
|
||||
if (!item?.url) return;
|
||||
const title = encodeURIComponent(item.title || item.name || '第三方服务');
|
||||
@@ -328,6 +444,60 @@
|
||||
}
|
||||
openWebview();
|
||||
};
|
||||
|
||||
const onThirdPartyServiceClick = async (item) => {
|
||||
if (!item) return;
|
||||
const isHuaxia =
|
||||
Number(item?.liquidationType) === 3 || String(item?.name || '') === '华夏';
|
||||
if (isHuaxia) {
|
||||
const ok = await ensureRealNameOrRedirect(item);
|
||||
if (!ok) return;
|
||||
const query = {};
|
||||
if (item?.channelId != null && item?.channelId !== '') {
|
||||
query.channelId = Number(item.channelId);
|
||||
}
|
||||
const regRes = await incrementApi
|
||||
.checkHuaxiaRegister(query)
|
||||
.catch(() => ({ code: -1 }));
|
||||
if (regRes?.code !== 0) {
|
||||
if (regRes?.msg) {
|
||||
uni.showToast({ title: regRes.msg, icon: 'none' });
|
||||
}
|
||||
return;
|
||||
}
|
||||
const data = regRes?.data || {};
|
||||
const url = typeof data === 'string'
|
||||
? String(data).trim()
|
||||
: String(data?.url || data?.redirectUrl || '').trim();
|
||||
if (!url) {
|
||||
uni.showToast({ title: '跳转链接为空', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
openThirdPartyService({ ...item, url });
|
||||
return;
|
||||
}
|
||||
openThirdPartyService(item);
|
||||
};
|
||||
|
||||
const goReal = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/realname?status=' + realStatus.value,
|
||||
});
|
||||
};
|
||||
const go = (path, obj) => {
|
||||
if (!path) {
|
||||
uni.showToast({
|
||||
title: '功能开发中, 敬请期待',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
query: obj,
|
||||
});
|
||||
}
|
||||
};
|
||||
const updateAvatar = async (avatar) => {
|
||||
if (!avatar) return;
|
||||
const res = await UserApi.updateUser({
|
||||
@@ -404,9 +574,17 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
fetchTradeChannels();
|
||||
});
|
||||
onShow(async () => {
|
||||
getData();
|
||||
getNumData();
|
||||
if (pendingThirdPartyItem.value && Number(realStatus.value || 0) === 1) {
|
||||
const next = pendingThirdPartyItem.value;
|
||||
pendingThirdPartyItem.value = null;
|
||||
nextTick(() => onThirdPartyServiceClick(next));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -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>
|
||||
@@ -8,7 +8,7 @@
|
||||
<view class="login_con w100 flex-column ju-between">
|
||||
<view class="login_top">
|
||||
<view class="font-Heavy size52 c1">Hello!</view>
|
||||
<view class="font-Heavy size52 c1">欢迎使用优购商城</view>
|
||||
<view class="font-Heavy size52 c1">欢迎使用康源家园</view>
|
||||
</view>
|
||||
<view class="bottomCon">
|
||||
<view class="login_bottom">
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -157,6 +157,29 @@ export function getOrderDetail(params: any) {
|
||||
params,
|
||||
});
|
||||
}
|
||||
// 修改订单配送方式(待发货第三方订单)- AI 店铺订单专用
|
||||
export function updateDeliveryType(data: any) {
|
||||
const payload = { ...(data || {}) };
|
||||
if (Number(payload.deliveryType) === 2) {
|
||||
delete payload.addressId;
|
||||
} else {
|
||||
delete payload.pickUpStoreId;
|
||||
delete payload.receiverName;
|
||||
delete payload.receiverMobile;
|
||||
}
|
||||
if (!['', undefined, null].includes(payload.receiverMobile)) {
|
||||
payload.receiverMobile = String(payload.receiverMobile);
|
||||
}
|
||||
return request({
|
||||
url: `/aishop/order/update-delivery-type`,
|
||||
method: 'PUT',
|
||||
data: payload,
|
||||
custom: {
|
||||
showLoading: true,
|
||||
showError: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
// 获取订单列表 aishop/order/page
|
||||
export function getOrderPage(params: any) {
|
||||
return request({
|
||||
|
||||
@@ -72,6 +72,53 @@ export const goldSeedFluctuation = (params) => {
|
||||
params: params,
|
||||
});
|
||||
};
|
||||
// 金种子兑换流水分页
|
||||
export const goldSeedExchangePage = (params) => {
|
||||
return request({
|
||||
url: '/member/app/gold-seed-exchange/page',
|
||||
method: 'GET',
|
||||
params: params,
|
||||
});
|
||||
};
|
||||
// 获取金种子兑换配置
|
||||
export const goldSeedExchangeGetConfig = (params) => {
|
||||
return request({
|
||||
url: '/member/app/gold-seed-exchange/get-config',
|
||||
method: 'GET',
|
||||
params: params,
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
};
|
||||
// 创建金种子兑换申请
|
||||
export const goldSeedExchangeCreate = (params) => {
|
||||
return request({
|
||||
url: '/member/app/gold-seed-exchange/create',
|
||||
method: 'POST',
|
||||
params: params,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
showError: false,
|
||||
loadingMsg: '兑换中',
|
||||
successMsg: '兑换申请已提交',
|
||||
},
|
||||
});
|
||||
};
|
||||
// 撤销金种子兑换
|
||||
export const goldSeedExchangeCancel = (params) => {
|
||||
return request({
|
||||
url: '/member/app/gold-seed-exchange/cancel',
|
||||
method: 'POST',
|
||||
params: params,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
showError: false,
|
||||
loadingMsg: '撤销中',
|
||||
successMsg: '撤销成功',
|
||||
},
|
||||
});
|
||||
};
|
||||
// 社员统计
|
||||
export const getTeamStats = (params) => {
|
||||
return request({
|
||||
|
||||
@@ -149,3 +149,26 @@ export const walletLiquidationRecordPage = (params: any) => {
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function checkHuaxiaMobile(params: any) {
|
||||
return request({
|
||||
url: '/trade/wallet-liquidation-record/check-huaxia-mobile',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function checkHuaxiaRegister(params?: any) {
|
||||
return request({
|
||||
url: '/trade/wallet-liquidation-record/check-huaxia-register',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export const getTradeChannelList = () => {
|
||||
return request({
|
||||
url: '/trade/channel/get',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -168,7 +168,30 @@ const OrderApi = {
|
||||
return request({
|
||||
url: `/trade/after-sale/create`,
|
||||
method: 'POST',
|
||||
params: params,
|
||||
params: params
|
||||
});
|
||||
},
|
||||
// 修改订单配送方式(待发货第三方订单)
|
||||
updateDeliveryType: (data) => {
|
||||
const payload = { ...(data || {}) };
|
||||
if (Number(payload.deliveryType) === 2) {
|
||||
delete payload.addressId;
|
||||
} else {
|
||||
delete payload.pickUpStoreId;
|
||||
delete payload.receiverName;
|
||||
delete payload.receiverMobile;
|
||||
}
|
||||
if (!['', undefined, null].includes(payload.receiverMobile)) {
|
||||
payload.receiverMobile = String(payload.receiverMobile);
|
||||
}
|
||||
return request({
|
||||
url: `/trade/order/update-delivery-type`,
|
||||
method: 'PUT',
|
||||
data: payload,
|
||||
custom: {
|
||||
showLoading: true,
|
||||
showError: true,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
const StorePickupApi = {
|
||||
getByOrderId: (orderId) =>
|
||||
request({
|
||||
url: '/trade/store-pickup/get',
|
||||
method: 'GET',
|
||||
params: { orderId },
|
||||
custom: { showLoading: false },
|
||||
}),
|
||||
getByOrderIds: (orderIds) =>
|
||||
request({
|
||||
url: '/trade/store-pickup/list-by-order-ids',
|
||||
method: 'GET',
|
||||
params: { orderIds: (orderIds || []).join(',') },
|
||||
custom: { showLoading: false },
|
||||
}),
|
||||
};
|
||||
|
||||
export default StorePickupApi;
|
||||
@@ -0,0 +1,43 @@
|
||||
export const createDeliveryInfo = () => ({
|
||||
deliveryType: 1,
|
||||
addressInfo: {},
|
||||
pickUpInfo: {},
|
||||
receiverName: '',
|
||||
receiverMobile: '',
|
||||
});
|
||||
|
||||
export const buildDeliveryPayload = (deliveryInfo = {}) => {
|
||||
if (Number(deliveryInfo.deliveryType) === 2) {
|
||||
return {
|
||||
deliveryType: 2,
|
||||
pickUpStoreId: deliveryInfo.pickUpInfo?.id,
|
||||
receiverName: String(deliveryInfo.receiverName || '').trim(),
|
||||
receiverMobile: String(deliveryInfo.receiverMobile || '').trim(),
|
||||
};
|
||||
}
|
||||
return {
|
||||
deliveryType: 1,
|
||||
addressId: deliveryInfo.addressInfo?.id,
|
||||
};
|
||||
};
|
||||
|
||||
export const getDeliveryValidationMessage = (deliveryInfo = {}) => {
|
||||
const payload = buildDeliveryPayload(deliveryInfo);
|
||||
if (payload.deliveryType === 1) return payload.addressId ? '' : '请选择收货地址';
|
||||
if (!(Number(payload.pickUpStoreId) > 0)) return '请选择自提门店';
|
||||
if (!payload.receiverName) return '请输入联系人姓名';
|
||||
if (!/^1\d{10}$/.test(payload.receiverMobile)) return '请输入正确的联系人手机号';
|
||||
return '';
|
||||
};
|
||||
|
||||
export const normalizeDeliveryFields = (data = {}) => {
|
||||
const normalized = { ...data };
|
||||
if (Number(normalized.deliveryType) === 2) {
|
||||
delete normalized.addressId;
|
||||
} else {
|
||||
delete normalized.pickUpStoreId;
|
||||
delete normalized.receiverName;
|
||||
delete normalized.receiverMobile;
|
||||
}
|
||||
return normalized;
|
||||
};
|
||||
Reference in New Issue
Block a user