From 2a68c9430e16daf0f725ed89479233334ce406d4 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 16 十月 2025 11:09:09 +0800
Subject: [PATCH] 店铺上下级

---
 manager/src/views/seller/shop/shopDetail.vue |  151 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/manager/src/views/seller/shop/shopDetail.vue b/manager/src/views/seller/shop/shopDetail.vue
index c6bccdb..85f6fda 100644
--- a/manager/src/views/seller/shop/shopDetail.vue
+++ b/manager/src/views/seller/shop/shopDetail.vue
@@ -121,6 +121,43 @@
             </span>
           </p>
           <p class="item">
+            <span class="label">搴楅摵鏍囩锛�</span>
+            <span class="info">
+              <template v-if="tagList?.length > 0">
+              <!-- 閬嶅巻鏍囩鍒楄〃 -->
+                <span v-for="(tag, index) in tagList" :key="tag.id">
+                  {{ tag.tagName }}
+                    <button
+                      style="width: 20px; height: 20px; line-height: 1; border: none; background: #f0f0f0; border-radius: 50%; cursor: pointer; margin-left: 4px; font-size: 12px; display: inline-flex; align-items: center; justify-content: center;"
+                      @click.stop="handleDeleteTag(tag.id, index)"
+                      title="鍒犻櫎鏍囩"
+                    >
+                    脳
+                  </button>
+                  <template v-if="index !== tagList.length - 1">銆�</template>
+                </span>
+              </template>
+            <template v-else>鏆傛棤鏍囩</template>
+            </span>
+          </p>
+          <p class="item">
+            <span class="label">涓婄骇搴楅摵锛�</span>
+            <span class="info">
+              {{storeRelationship.upStore ? storeRelationship.upStore.storeName:'鏆傛棤'}}
+            </span>
+          </p>
+          <p class="item">
+            <span class="label">涓嬬骇搴楅摵锛�</span>
+            <span class="info">
+              {{ storeRelationship.downStore && storeRelationship.downStore.length
+              ? storeRelationship.downStore.map(store => store.storeName).join('銆�')
+              : '鏆傛棤' }}
+            </span>
+          </p>
+          <div style="display: flex;align-items: center;justify-content: center;">
+            <Button type="primary"  @click="addStoreTag(storeInfo)">鏂板鏍囩</Button>
+          </div>
+          <p class="item">
             <span class="label">搴楅摵绠�浠嬶細</span>
             <span class="info">
               {{storeInfo.storeDesc?storeInfo.storeDesc:'鏆傛湭瀹屽杽'}}
@@ -559,6 +596,22 @@
             </Row>
           </div>
         </TabPane>
+
+        <Modal
+          v-model="showModal"
+          title="鏂板鏍囩"
+          width="800"
+          :mask-closable="false"
+        >
+          <Select v-model="tagForm.storeTagId" placeholder="璇烽�夋嫨" @on-query-change="searchChange" filterable
+                  clearable style="width: 150px">
+            <Option v-for="item in tagOptions" :value="item.id" :key="item.id">{{ item.tagName }}</Option>
+          </Select>
+          <div slot="footer">
+            <Button @click="showModal = false">鍙栨秷</Button>
+            <Button type="primary" @click="handleSubmit" :loading="submitLoading">纭畾</Button>
+          </div>
+        </Modal>
       </Tabs>
     </Card>
 
@@ -566,7 +619,8 @@
 </template>
 
 <script>
-
+  import { getStoreRelationship} from "@/api/storeRelationship"
+  import { getTag,bind,getStoreTagsById,delTagByStoreTagRefId } from "@/api/store-tag"
   import ossManage from "@/views/sys/oss-manage/ossManage";
   import * as RegExp from '@/libs/RegExp.js';
   import {getCategoryTree} from "@/api/goods";
@@ -577,15 +631,24 @@
   export default {
     name: "member",
     components: {
-
       ossManage,
     },
     data() {
       return {
+        storeRelationship:{},//搴楅摵鍏崇郴瀵硅薄
+        tagOptions:[],
+        submitLoading:false,
+        tagForm:{
+          storeId:null,
+          storeTagId:"",
+        },
+        showModal:false,
         id: "",//搴楅摵id
         categories: [], //搴楅摵闈欓煶鑼冨洿
         loading: true, // 琛ㄥ崟鍔犺浇鐘舵��
-        storeInfo: {},//搴楅摵淇℃伅
+        storeInfo: {
+        },//搴楅摵淇℃伅
+        tagList:[],
         checkAllGroup: [], //閫変腑鐨勭粡钀ュ垎绫�
         selectDate: null, // 鐢宠鏃堕棿
 
@@ -845,8 +908,89 @@
         refundOrderTotal: 0,//鍞悗鍗曟�绘潯鏁�
       };
     },
+    watch: {
+      // 鐩戝惉璺敱瀵硅薄鍙樺寲
+      $route(to, from) {
+        console.log(to.name)
+        if (to.name === 'shop-detail' && to.query.id) {
+          if (to.query.id !== from.query.id) {
+            this.id = to.query.id;
+            this.init();
+          }
+        }
+      }
+    },
     methods: {
+      getStoreRelationship(){
+        getStoreRelationship(this.id).then(res =>{
+            if (res.code === 200){
+              this.$set(this, "storeRelationship", res.data);
+            }
+          })
+      },
+      handleDeleteTag(storeTagRefId){
+        console.log(storeTagRefId)
+        delTagByStoreTagRefId(storeTagRefId).then(res=>{
+          if (res.code === 200){
+            this.$Message.success("鍒犻櫎鎴愬姛")
+          }
+          this.getStoreTags();
+        })
+
+      },
+
+      getStoreTags(){
+        getStoreTagsById(this.id).then(res =>{
+          if (res.code === 200){
+            this.$set(this, "tagList", res.data);
+          }
+        })
+
+      },
+
+      searchChange(val){
+        this.getStoreTag(val)
+      },
+      getStoreTag(val){
+        const params = {
+          tagName: ''
+        }
+        if (val) {
+          params.tagName = val;
+        } else {
+          params.tagName = ''
+        }
+        getTag(params).then(res =>{
+          if (res.code ===200){
+            this.tagOptions = res.data
+          }
+        })
+      },
+      handleSubmit(){
+        if (this.tagForm.storeTagId === null || this.tagForm.storeTagId ===""){
+          this.$Message.error("璇烽�夋嫨鏍囩")
+         return
+        }
+        this.showModal = false;
+          bind(this.tagForm).then(res =>{
+            if (res.code === 200){
+
+          }
+          this.getStoreTags();
+            this.getStoreTag();
+        })
+
+      },
+      addStoreTag(info){
+        console.log(info)
+        this.tagForm.storeId = info.storeId;
+        this.tagForm.storeTagId = "";
+        this.showModal = true;
+      },
       init() {
+        this.getStoreTags();
+        this.getStoreRelationship();
+        this.getStoreTag();
         //鏌ュ簵閾哄熀鏈俊鎭�
         this.getStoreInfo();
         //鏌ヨ搴楅摵鍒嗙被
@@ -998,6 +1142,7 @@
     mounted() {
       this.id = this.$route.query.id;
       this.init();
+      console.log("鍔犺浇椤甸潰")
     }
   };
 </script>

--
Gitblit v1.8.0