瀏覽代碼

对接连锁组

chenrui 4 年之前
父節點
當前提交
faffbc4065

+ 3 - 11
src/api/dealer.js

@@ -1,15 +1,7 @@
 import { axios } from '@/utils/request'
-// 根据sn查找修改过后的经销商信息
-export const dealerFindUpdateInfoBySn = (params) => {
-  return axios({
-    url: `/dealer/findUpdateInfoBySn/${params.sn}`,
-    data: params,
-    method: 'get'
-  })
-}
-//  经销商列表有分页
-export const dealerQueryList = (params) => {
-  const url = `/dealer/queryPage/${params.pageNo}/${params.pageSize}`
+//  经销商 列表 有分页
+export const dealerList = (params) => {
+  const url = `/dealer/queryLike/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({

+ 5 - 6
src/views/chainGroupManagement/chainGroupSetting/associateModal.vue

@@ -34,12 +34,11 @@
       </template>
     </a-table>
     <!-- 新增关联分店 -->
-    <chain-group-store-modal :openModal="openStoreModal" @close="openStoreModal=false" />
+    <chain-group-store-modal :openModal="openStoreModal" :itemSn="itemSn" @close="openStoreModal=false" @ok="$refs.table.refresh(true)" />
   </a-modal>
 </template>
 
 <script>
-// import { bindRelation } from '@/api/dealerRelation'
 import chainGroupStoreModal from './storeModal.vue'
 export default {
   name: 'ChainGroupAssociateModal',
@@ -93,6 +92,10 @@ export default {
     }
   },
   methods: {
+    // 取消关联
+    handleDisassociate () {
+
+    }
   },
   watch: {
     //  父页面传过来的弹框状态
@@ -106,10 +109,6 @@ export default {
       } else {
         console.log(this.nowData, '-------------nowData')
       }
-    },
-    itemSn (newValue, oldValue) {
-      if (this.isShow && newValue) {
-      }
     }
   }
 }

+ 1 - 2
src/views/chainGroupManagement/chainGroupSetting/list.vue

@@ -94,8 +94,7 @@ export default {
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
-        { title: '序号', dataIndex: 'no' },
-        { title: '连锁组名称', dataIndex: 'linkageGroupName' },
+        { title: '连锁组名称', dataIndex: 'linkageGroupName', align: 'left' },
         { title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' }
       ],
       expandedRowKeys: [],

+ 26 - 23
src/views/chainGroupManagement/chainGroupSetting/storeModal.vue

@@ -18,13 +18,13 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="商户名称" prop="linkageGroupName">
-          <custList ref="custList" id="chainGroupStore-linkageGroupName" @change="custChange"></custList>
+        <a-form-model-item label="商户名称" prop="dealerSn">
+          <custList ref="custList" id="chainGroupStore-dealerSn" @change="custChange"></custList>
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
         <a-button type="primary" id="chainGroupStore-save" @click="handleSave">确认关联</a-button>
-        <a-button id="chainGroupStore-back" @click="isShow = false" style="margin-left: 15px;">关闭</a-button>
+        <a-button id="chainGroupStore-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
       </div>
     </div>
   </a-modal>
@@ -40,17 +40,20 @@ export default {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
     }
   },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
       form: {
-        dealerSn: '',
-        linkageGroupSn: ''
+        dealerSn: ''
       },
       rules: {
-        linkageGroupName: [
+        dealerSn: [
           { required: true, message: '请输入商户名称', trigger: 'blur' }
         ]
       },
@@ -63,26 +66,26 @@ export default {
   methods: {
     custChange (val) {
       console.log('选中', val)
-      this.form.linkageGroupName = val.key
+      this.form.dealerSn = val.key
     },
     //  保存
     handleSave () {
-      // const _this = this
-      // _this.$refs.ruleForm.validate(valid => {
-      //   if (valid) {
-      //     const form = JSON.parse(JSON.stringify(_this.form))
-      //     form.id = _this.itemId ? _this.itemId : null
-      //     linkageGroupSave(form).then(res => {
-      //       if (res.status == 200) {
-      //         _this.$message.success(res.message)
-      //         _this.$emit('ok')
-      //         _this.isShow = false
-      //       }
-      //     })
-      //   } else {
-      //     return false
-      //   }
-      // })
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = JSON.parse(JSON.stringify(_this.form))
+          form.linkageGroupSn = _this.itemSn
+          linkageGroupSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+              _this.isShow = false
+            }
+          })
+        } else {
+          return false
+        }
+      })
     }
   },
   watch: {

+ 7 - 9
src/views/common/custList.vue

@@ -11,14 +11,14 @@
     @change="handleChange"
   >
     <a-spin v-if="fetching" slot="notFoundContent" size="small" />
-    <a-select-option v-for="item in data" :key="item.dealerSn" :value="item.dealerSn">
-      {{ item.dealerName }}
+    <a-select-option v-for="item in data" :key="item.sn" :value="item.sn">
+      {{ item.name }}
     </a-select-option>
   </a-select>
 </template>
 <script>
 import debounce from 'lodash/debounce'
-import { dealerQueryList, dealerFindUpdateInfoBySn } from '@/api/dealer'
+import { dealerList } from '@/api/dealer'
 export default {
   props: {
   },
@@ -39,13 +39,11 @@ export default {
       const fetchId = this.lastFetchId
       this.data = []
       this.fetching = true
-      console.log('------请求前')
-      dealerQueryList({ 'nameLike': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
+      dealerList({ 'nameLike': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
         if (fetchId !== this.lastFetchId) {
           return
         }
         this.data = res.data.list || []
-        console.log('------请求后')
         this.fetching = false
       })
     },
@@ -62,9 +60,9 @@ export default {
     },
     // 查询详细
     getDetail (sn) {
-      dealerFindUpdateInfoBySn({ sn: sn }).then(res => {
-        this.$emit('dealerDetail', res.data || null)
-      })
+      // dealerFindUpdateInfoBySn({ sn: sn }).then(res => {
+      //   this.$emit('dealerDetail', res.data || null)
+      // })
     }
   }
 }