|
@@ -5,6 +5,7 @@
|
|
|
- 含花束且某花束包运费 → hsFreeKm/hsPerKmPrice;含花束且都不包运费 → 跑腿或自定义
|
|
- 含花束且某花束包运费 → hsFreeKm/hsPerKmPrice;含花束且都不包运费 → 跑腿或自定义
|
|
|
- 不含花束:符合 xhPsReduceRule 免跑腿;不符合则跑腿或自定义
|
|
- 不含花束:符合 xhPsReduceRule 免跑腿;不符合则跑腿或自定义
|
|
|
- calcType=0 时跑腿计算异常,最终用自定义计费兜底
|
|
- calcType=0 时跑腿计算异常,最终用自定义计费兜底
|
|
|
|
|
+ - 用户手动点选「用跑腿/用自定义」后,切换 Tab、回页 loadConfig 不得覆盖该选择
|
|
|
-->
|
|
-->
|
|
|
<template> <view class="ps-method-page app-content">
|
|
<template> <view class="ps-method-page app-content">
|
|
|
<!-- 顶部 Tab 切换 -->
|
|
<!-- 顶部 Tab 切换 -->
|
|
@@ -414,6 +415,11 @@ export default {
|
|
|
sortsList: [], // 存储所有配送方式的排序和别名信息
|
|
sortsList: [], // 存储所有配送方式的排序和别名信息
|
|
|
/** 是否已绑定跑腿商户(至少一个平台已授权) */
|
|
/** 是否已绑定跑腿商户(至少一个平台已授权) */
|
|
|
deliveryMerchantBound: false,
|
|
deliveryMerchantBound: false,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 用户手动选定的算运费方式;null 表示尚未手选,以接口为准
|
|
|
|
|
+ * 手选后切 Tab / 从其它页返回时,loadConfig 必须沿用此值
|
|
|
|
|
+ */
|
|
|
|
|
+ userLockedCalcType: null,
|
|
|
form: {
|
|
form: {
|
|
|
id: 0,
|
|
id: 0,
|
|
|
style: 0,
|
|
style: 0,
|
|
@@ -478,12 +484,13 @@ export default {
|
|
|
this.loadSorts();
|
|
this.loadSorts();
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
|
- if (Number(this.form.style) === 2) {
|
|
|
|
|
- // 从跑腿管理返回时同步绑定状态与服务端配置(取消授权可能已自动禁用)
|
|
|
|
|
- this.loadDeliveryBindStatus().then(() => {
|
|
|
|
|
- this.loadConfig(2)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if (Number(this.form.style) !== 2) {
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
+ // 从跑腿管理返回:只同步绑定态与启用状态,整表重拉会冲掉已手选的 calcType
|
|
|
|
|
+ this.loadDeliveryBindStatus().then(() => {
|
|
|
|
|
+ this.syncRunnerStatusFromServer()
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
init(){},
|
|
init(){},
|
|
@@ -536,10 +543,27 @@ export default {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 切换算运费方式(不在此处校验自定义规则,保存时再提示)
|
|
* 切换算运费方式(不在此处校验自定义规则,保存时再提示)
|
|
|
|
|
+ * 手选后写入 userLockedCalcType,后续 loadConfig 不得覆盖
|
|
|
* @param {number} calcType - 0 用跑腿,1 用自定义
|
|
* @param {number} calcType - 0 用跑腿,1 用自定义
|
|
|
*/
|
|
*/
|
|
|
changeCalcType(calcType) {
|
|
changeCalcType(calcType) {
|
|
|
- this.form.calcType = Number(calcType)
|
|
|
|
|
|
|
+ const next = Number(calcType) === 1 ? 1 : 0
|
|
|
|
|
+ this.userLockedCalcType = next
|
|
|
|
|
+ this.form.calcType = next
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 解析本次应展示的算运费方式
|
|
|
|
|
+ * 跑腿 Tab 且用户已手选时,忽略接口返回,避免切 Tab / 回页把按钮改回去
|
|
|
|
|
+ * @param {number} style - 当前配送类型
|
|
|
|
|
+ * @param {number} serverCalcType - 接口返回的 calcType
|
|
|
|
|
+ * @returns {number} 0 用跑腿,1 用自定义
|
|
|
|
|
+ */
|
|
|
|
|
+ resolveCalcType(style, serverCalcType) {
|
|
|
|
|
+ if (Number(style) === 2 && this.userLockedCalcType != null) {
|
|
|
|
|
+ return this.userLockedCalcType
|
|
|
|
|
+ }
|
|
|
|
|
+ return Number(serverCalcType) === 1 ? 1 : 0
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -592,8 +616,27 @@ export default {
|
|
|
return ''
|
|
return ''
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从其它页返回时只同步跑腿启用状态(取消授权可能已自动禁用)
|
|
|
|
|
+ * 不整表覆盖 form,避免改动手选的算运费方式及其它未保存项
|
|
|
|
|
+ */
|
|
|
|
|
+ syncRunnerStatusFromServer() {
|
|
|
|
|
+ getPsMethodConfig({ style: 2 }).then((res) => {
|
|
|
|
|
+ if (res.code != 1 || !res.data) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Number(this.form.style) !== 2) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (res.data.status != null) {
|
|
|
|
|
+ this.form.status = Number(res.data.status)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(() => {})
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 加载当前配送方式配置
|
|
* 加载当前配送方式配置
|
|
|
|
|
+ * calcType 经 resolveCalcType:用户已手选则不被接口值覆盖
|
|
|
* @param {number} style - 配送类型 (0-4)
|
|
* @param {number} style - 配送类型 (0-4)
|
|
|
*/
|
|
*/
|
|
|
loadConfig(style) {
|
|
loadConfig(style) {
|
|
@@ -615,7 +658,10 @@ export default {
|
|
|
unMeetLockHours: this.secondsToLockHours(
|
|
unMeetLockHours: this.secondsToLockHours(
|
|
|
data.unMeetLockSeconds != null ? Number(data.unMeetLockSeconds) : 1800
|
|
data.unMeetLockSeconds != null ? Number(data.unMeetLockSeconds) : 1800
|
|
|
),
|
|
),
|
|
|
- calcType: data.calcType != null ? Number(data.calcType) : 0,
|
|
|
|
|
|
|
+ calcType: this.resolveCalcType(
|
|
|
|
|
+ style,
|
|
|
|
|
+ data.calcType != null ? Number(data.calcType) : 0
|
|
|
|
|
+ ),
|
|
|
hsFreeKm: data.hsFreeKm != null ? parseFloat(data.hsFreeKm) : 0.00,
|
|
hsFreeKm: data.hsFreeKm != null ? parseFloat(data.hsFreeKm) : 0.00,
|
|
|
hsPerKmPrice: data.hsPerKmPrice != null ? parseFloat(data.hsPerKmPrice) : 0.00,
|
|
hsPerKmPrice: data.hsPerKmPrice != null ? parseFloat(data.hsPerKmPrice) : 0.00,
|
|
|
startKm: data.startKm != null ? parseFloat(data.startKm) : 0.00,
|
|
startKm: data.startKm != null ? parseFloat(data.startKm) : 0.00,
|