|
|
@@ -1,9 +1,9 @@
|
|
|
<!--
|
|
|
- 配送方式设置页
|
|
|
- 用途:花店应用-门店设置-配送方式,维护送货/自取/跑腿/快递/物流配置
|
|
|
- 来源:与 ghsApp/pagesOrder/shMethod.vue 同源能力
|
|
|
+ 花店配送方式设置页
|
|
|
+ 用途:hdApp 门店设置-配送方式,读写 xhPsMethod / xhPsExplain / xhPsReduceRule
|
|
|
+ 说明:与供货商 xhSh* 表分离,结算页等仍走 /sh-method/get-all-method
|
|
|
-->
|
|
|
-<template> <view class="sh-method-page app-content">
|
|
|
+<template> <view class="ps-method-page app-content">
|
|
|
<!-- 顶部 Tab 切换 -->
|
|
|
<view class="tab-bar">
|
|
|
<view
|
|
|
@@ -100,6 +100,13 @@
|
|
|
|
|
|
<!-- 跑腿 特有字段 -->
|
|
|
<block v-if="form.style === 2">
|
|
|
+ <!-- 跑腿商户绑定:跳转跑腿管理页授权/绑定门店 -->
|
|
|
+ <tui-list-cell class="line-cell delivery-bind-cell" :hover="false">
|
|
|
+ <view class="tui-title">跑腿商户绑定</view>
|
|
|
+ <text class="delivery-bind-status">{{ deliveryBindText }}</text>
|
|
|
+ <button class="admin-button-com middle blue delivery-bind-btn" @click="goDeliveryManage">绑定设置</button>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
<!-- 满减规则圈起来 -->
|
|
|
<view class="rule-section-wrapper">
|
|
|
<view class="section-header no-margin">
|
|
|
@@ -257,12 +264,13 @@
|
|
|
<script>
|
|
|
/**
|
|
|
* 花店配送方式设置
|
|
|
- * 路由:admin/home/shMethod
|
|
|
+ * 路由:admin/home/psMethod
|
|
|
*/
|
|
|
import TuiListCell from '@/components/plugin/list-cell'
|
|
|
-import { getShMethodConfig, saveShMethodConfig, getShMethodSorts } from '@/api/sh-method'
|
|
|
+import { getPsMethodConfig, savePsMethodConfig, getPsMethodSorts } from '@/api/ps-method'
|
|
|
+import { getPlatformList } from '@/api/express/delivery'
|
|
|
export default {
|
|
|
- name: "shMethod",
|
|
|
+ name: "psMethod",
|
|
|
components: {
|
|
|
TuiListCell
|
|
|
},
|
|
|
@@ -277,6 +285,8 @@ export default {
|
|
|
],
|
|
|
tabIndex: 0,
|
|
|
sortsList: [], // 存储所有配送方式的排序和别名信息
|
|
|
+ /** 是否已绑定跑腿商户(至少一个平台已授权) */
|
|
|
+ deliveryMerchantBound: false,
|
|
|
form: {
|
|
|
id: 0,
|
|
|
style: 0,
|
|
|
@@ -315,19 +325,28 @@ export default {
|
|
|
});
|
|
|
// 拼接成 "送货 > 自取 > 跑腿..." 的格式
|
|
|
return sorted.map(item => item.name).join(" - ");
|
|
|
+ },
|
|
|
+ /** 跑腿商户绑定状态文案 */
|
|
|
+ deliveryBindText() {
|
|
|
+ return this.deliveryMerchantBound ? '已绑定' : '未绑定'
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.loadConfig(0);
|
|
|
this.loadSorts();
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ if (Number(this.form.style) === 2) {
|
|
|
+ this.loadDeliveryBindStatus()
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
init(){},
|
|
|
/**
|
|
|
* 加载所有配送方式的排序和别名信息
|
|
|
*/
|
|
|
loadSorts() {
|
|
|
- getShMethodSorts()
|
|
|
+ getPsMethodSorts()
|
|
|
.then(res => {
|
|
|
if (res.code == 1 && res.data) {
|
|
|
this.sortsList = res.data;
|
|
|
@@ -344,7 +363,30 @@ export default {
|
|
|
changeTab(index) {
|
|
|
if (this.tabIndex === index) return;
|
|
|
this.tabIndex = index;
|
|
|
- this.loadConfig(this.tabs[index].value);
|
|
|
+ const style = this.tabs[index].value
|
|
|
+ this.loadConfig(style)
|
|
|
+ if (style === 2) {
|
|
|
+ this.loadDeliveryBindStatus()
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 查询跑腿平台授权状态,用于展示「已绑定/未绑定」 */
|
|
|
+ loadDeliveryBindStatus() {
|
|
|
+ return getPlatformList().then((res) => {
|
|
|
+ if (res.code !== 1 || !res.data) {
|
|
|
+ this.deliveryMerchantBound = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const list = res.data.platformList || []
|
|
|
+ this.deliveryMerchantBound = list.some((item) => !!item.is_authorized)
|
|
|
+ }).catch(() => {
|
|
|
+ this.deliveryMerchantBound = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 跳转跑腿管理(授权与门店绑定) */
|
|
|
+ goDeliveryManage() {
|
|
|
+ this.$util.pageTo({ url: '/admin/delivery/deliveryManage' })
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -352,7 +394,7 @@ export default {
|
|
|
* @param {number} style - 配送类型 (0-4)
|
|
|
*/
|
|
|
loadConfig(style) {
|
|
|
- getShMethodConfig({ style }).then(res => {
|
|
|
+ getPsMethodConfig({ style }).then(res => {
|
|
|
if (res.code == 1 && res.data) {
|
|
|
const data = res.data;
|
|
|
this.form = {
|
|
|
@@ -386,6 +428,9 @@ export default {
|
|
|
} else {
|
|
|
this.$msg(res.msg || "加载失败")
|
|
|
}
|
|
|
+ if (style === 2) {
|
|
|
+ this.loadDeliveryBindStatus()
|
|
|
+ }
|
|
|
}).catch(err => {
|
|
|
this.$msg("加载失败,请重试");
|
|
|
})
|
|
|
@@ -523,7 +568,7 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- saveShMethodConfig(this.form).then(res => {
|
|
|
+ savePsMethodConfig(this.form).then(res => {
|
|
|
if (res.code == 1) {
|
|
|
this.$msg("保存成功");
|
|
|
// 重新加载配置刷新数据
|
|
|
@@ -540,7 +585,7 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.sh-method-page {
|
|
|
+.ps-method-page {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
height: 100vh;
|
|
|
@@ -622,6 +667,25 @@ export default {
|
|
|
margin-left: auto;
|
|
|
}
|
|
|
|
|
|
+/* 跑腿商户绑定行 */
|
|
|
+.delivery-bind-cell {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.delivery-bind-status {
|
|
|
+ flex: 1;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #999999;
|
|
|
+}
|
|
|
+
|
|
|
+.delivery-bind-btn {
|
|
|
+ margin-left: auto;
|
|
|
+ flex-shrink: 0;
|
|
|
+}
|
|
|
+
|
|
|
/* 跑腿自定义计费输入行 */
|
|
|
.input-row {
|
|
|
display: flex;
|