Преглед изворни кода

花店配送方式,改为自己独立的表

ouyang пре 2 недеља
родитељ
комит
491812a7a2

+ 1 - 1
hdApp/src/admin/home/homeMenus.js

@@ -57,7 +57,7 @@ export const APPLY_MENU_GROUPS = [
       { name: '收款码', icon: homeIcon('pay-code'), url: '/admin/cg/code', pf: 1 },
       { name: '收款流水', icon: homeIcon('pay-code-flow'), url: '/admin/order/scanPay', pf: 1 },
       { name: '绑定跑腿', icon: homeIcon('delivery'), url: '/admin/delivery/deliveryManage', pf: 1 },
-      { name: '配送方式', icon: homeIcon('delivery-outline'), url: '/admin/home/shMethod', pf: 1 },
+      { name: '配送方式', icon: homeIcon('delivery-outline'), url: '/admin/home/psMethod', pf: 1 },
       { name: '配置范围', icon: homeIcon('send_area'), url: '/admin/shop/sk', pf: 1 }
     ]
   },

+ 76 - 12
hdApp/src/admin/home/shMethod.vue → hdApp/src/admin/home/psMethod.vue

@@ -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;

+ 20 - 0
hdApp/src/api/ps-method/index.js

@@ -0,0 +1,20 @@
+/**
+ * 花店配送方式配置 API(xhPsMethod / xhPsExplain / xhPsReduceRule)
+ * 用途:花店应用-门店设置-配送方式设置页,与供货商 xhSh* 表分离
+ */
+import https from '@/plugins/luch-request_0.0.7/request'
+
+/** 获取指定 style 的配送配置 */
+export const getPsMethodConfig = data => {
+  return https.get('/ps-method/get-config', data)
+}
+
+/** 获取各配送方式排序与别名 */
+export const getPsMethodSorts = () => {
+  return https.get('/ps-method/get-sorts')
+}
+
+/** 保存配送配置 */
+export const savePsMethodConfig = data => {
+  return https.post('/ps-method/save-config', data)
+}

+ 0 - 20
hdApp/src/api/sh-method/index.js

@@ -1,20 +0,0 @@
-/**
- * 配送方式配置 API
- * 用途:花店应用-门店设置-配送方式设置页
- */
-import https from '@/plugins/luch-request_0.0.7/request'
-
-/** 获取指定 style 的配送配置 */
-export const getShMethodConfig = data => {
-  return https.get('/sh-method/get-config', data)
-}
-
-/** 获取各配送方式排序与别名 */
-export const getShMethodSorts = () => {
-  return https.get('/sh-method/get-sorts')
-}
-
-/** 保存配送配置 */
-export const saveShMethodConfig = data => {
-  return https.post('/sh-method/save-config', data)
-}

+ 1 - 1
hdApp/src/pages.json

@@ -14,7 +14,7 @@
 		{ "path": "admin/home/order", "style": { "navigationBarTitleText": "订单", "enablePullDownRefresh": true, "navigationStyle": "custom" } },
 		{ "path": "admin/home/member", "style": { "navigationBarTitleText": "客户", "enablePullDownRefresh": true, "navigationStyle": "custom" } },
 		{ "path": "admin/home/apply", "style": { "navigationBarTitleText": "应用", "enablePullDownRefresh": true } },
-		{ "path": "admin/home/shMethod", "style": { "navigationBarTitleText": "配送方式" } },
+		{ "path": "admin/home/psMethod", "style": { "navigationBarTitleText": "配送方式" } },
 		{ "path": "admin/home/close","style": {"navigationBarTitleText": "申请注销账号"}},
 		{"path": "admin/home/register","style": {"navigationBarTitleText": "服务协议"}},
 		{"path": "admin/home/privacy","style": {"navigationBarTitleText": "隐私政策"}},