Browse Source

供应商

chenrui 2 years ago
parent
commit
025a4c5856

+ 61 - 12
src/api/bizuser.js

@@ -71,9 +71,20 @@ export const saveProductTypeList = params => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+// 设置管辖区域
+export const queryDealerScopePage = params => {
+  const url = `/bizuser/scope/queryDealerScopePage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
 // 设置管辖品类
 // 设置管辖品类
-export const bizuserScopeQueryPage = params => {
-  const url = `/bizuser/scope/queryPage/${params.pageNo}/${params.pageSize}`
+export const queryProductScopePage = params => {
+  const url = `/bizuser/scope/queryProductScopePage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageNo
   delete params.pageSize
   delete params.pageSize
   return axios({
   return axios({
@@ -82,6 +93,7 @@ export const bizuserScopeQueryPage = params => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+
 // 设置管辖品类  删除整列
 // 设置管辖品类  删除整列
 export const bizuserScopeDelete = params => {
 export const bizuserScopeDelete = params => {
   return axios({
   return axios({
@@ -119,7 +131,7 @@ export const findById = params => {
 // 查询区域回显列表
 // 查询区域回显列表
 export const queryAreaScope = params => {
 export const queryAreaScope = params => {
   return axios({
   return axios({
-    url: '/bizuser/scope/queryAreaScope',
+    url: '/bizuser/scope/queryAreaScopeList',
     data: params,
     data: params,
     method: 'post'
     method: 'post'
   })
   })
@@ -137,7 +149,7 @@ export const saveAreaScope = params => {
 // 查询经销商回显列表
 // 查询经销商回显列表
 export const queryDealerScope = params => {
 export const queryDealerScope = params => {
   return axios({
   return axios({
-    url: '/bizuser/scope/queryDealerScope',
+    url: '/bizuser/scope/queryDealerScopeList',
     data: params,
     data: params,
     method: 'post'
     method: 'post'
   })
   })
@@ -153,7 +165,7 @@ export const saveDealerScope = params => {
 
 
 // 经销商列表  (选择过的优先显示)
 // 经销商列表  (选择过的优先显示)
 export const bizuserScopeQueryDealer = (params) => {
 export const bizuserScopeQueryDealer = (params) => {
-  const url = `/bizuser/scope/queryDealer/${params.pageNo}/${params.pageSize}`
+  const url = `/bizuser/scope/queryDealerPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageNo
   delete params.pageSize
   delete params.pageSize
   return axios({
   return axios({
@@ -165,10 +177,47 @@ export const bizuserScopeQueryDealer = (params) => {
 
 
 /* 供应商 */
 /* 供应商 */
 // 供应商显示列表
 // 供应商显示列表
-// export const queryDealerScope = params => {
-//   return axios({
-//     url: '/bizuser/scope/querySupplierScope',
-//     data: params,
-//     method: 'post'
-//   })
-// }
+export const querySupplierScopePage = (params) => {
+  const url = `/bizuser/scope/querySupplierScopePage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 供应商列表  (选择过的优先显示)
+export const querySupplierPage = (params) => {
+  const url = `/bizuser/scope/querySupplierPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 保存供应商
+export const saveSupplierList = params => {
+  return axios({
+    url: '/bizuser/scope/saveSupplierList',
+    data: params,
+    method: 'post'
+  })
+}
+export const deleteSupplier = params => {
+  return axios({
+    url: `/bizuser/detail/deleteSupplier/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+
+export const querySupplierScope = params => {
+  return axios({
+    url: '/bizuser/scope/querySupplierScopeList',
+    data: params,
+    method: 'post'
+  })
+}

+ 5 - 4
src/views/dealerManagement/businessOwnerSettings/categorySet.vue

@@ -90,7 +90,7 @@ import { commonMixin } from '@/utils/mixin'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
 import { STable } from '@/components'
 import { STable } from '@/components'
-import { getNewScopeSn, bizuserScopeQueryPage, saveProductBrandList, saveProductTypeList, bizuserScopeDelete, deleteProductBrand, deleteProductType } from '@/api/bizuser'
+import { getNewScopeSn, queryProductScopePage, saveProductBrandList, saveProductTypeList, bizuserScopeDelete, deleteProductBrand, deleteProductType } from '@/api/bizuser'
 export default {
 export default {
   name: 'CategorySet',
   name: 'CategorySet',
   mixins: [commonMixin],
   mixins: [commonMixin],
@@ -129,15 +129,16 @@ export default {
         this.spinning = true
         this.spinning = true
         this.queryParam.userSn = this.$route.query.sn
         this.queryParam.userSn = this.$route.query.sn
         this.queryParam.bizUserSn = this.bizUserSn
         this.queryParam.bizUserSn = this.bizUserSn
-        return bizuserScopeQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          data = res.data
+        return queryProductScopePage(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
           this.total = data.count || 0
           this.total = data.count || 0
+
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].no = no + i + 1
           }
           }
           this.dataSource = data.list
           this.dataSource = data.list
+
           this.disabled = false
           this.disabled = false
           this.spinning = false
           this.spinning = false
           return data
           return data

+ 219 - 0
src/views/dealerManagement/businessOwnerSettings/chooseSupplier.vue

@@ -0,0 +1,219 @@
+<template>
+  <a-spin :spinning="spinning" tip="Loading...">
+    <!-- 搜索条件 -->
+    <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="8" :sm="24">
+            <a-form-item label="供应商名称">
+              <a-input id="chooseSupplier-nameLike" v-model.trim="queryParam.name" allowClear placeholder="请输入供应商名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="pageType!='viewDealers'?8:6" :sm="24" style="margin-bottom: 10px;">
+            <a-button type="primary" @click="searchForm(true)" :disabled="disabled" id="chooseSupplier-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseSupplier-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+      <!-- 列表 -->
+      <div style="margin-bottom: 10px">
+        <a-button type="primary" ghost :loading="loading" @click="handleBatchAudit">批量添加</a-button>
+        <span style="margin-left: 5px">
+          <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
+        </span>
+      </div>
+    </div>
+    <s-table
+      class="sTable"
+      ref="table"
+      size="small"
+      :rowKey="(record) => record.supplierSn"
+      rowKeyName="supplierSn"
+      :row-selection="{ columnWidth: 40}"
+      @rowSelection="rowSelectionFun"
+      :columns="columns"
+      :data="loadData"
+      :style="{ height:pageType=='viewDealers'? tableHeight+84.5+'px':tableHeight-15+'px' }"
+      :scroll="{ y: pageType=='viewDealers'?tableHeight:tableHeight+80 }"
+      :defaultLoadData="false"
+      bordered>
+      <template slot="areas" slot-scope="text, record">
+        <span v-if="record.subareaArea">{{ record.subareaArea.subareaName }}>{{ record.subareaArea.subareaAreaName }}</span>
+        <span v-else>--</span>
+      </template>
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          class="button-error"
+          @click="handleAdd(record)"
+          v-if="record.subareaAreaSn != parentData.subareaAreaSn"
+          id="marketingDivisionSetNew-del-btn">添加</a-button>
+        <span style="color:#666" v-else>已添加</span>
+      </template>
+    </s-table>
+  </a-spin>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import AreaList from '@/views/common/areaList.js'
+import { querySupplierPage } from '@/api/bizuser'
+import subarea from '@/views/common/subarea.js'
+export default {
+  name: 'ChooseSupplier',
+  mixins: [commonMixin],
+  components: { STable, VSelect, subarea, AreaList },
+  props: {
+    pageType: {
+      type: String,
+      default: ''
+    },
+    parentData: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      queryParam: { //  查询条件
+        supplierName: ''
+      },
+      userSn: '',
+      pageFlag: false,
+      chooseInfo: [],
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      loading: false, // 批量添加loading
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.spinning = true
+        this.queryParam.userSn = this.userSn
+        return querySupplierPage(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          const _this = this
+          if (res.status == 200) {
+            data = res.data
+            const no = 0
+            const chooseData = []
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+              data.list[i].supplierSn = data.list[i].supplier.supplierSn
+              if (_this.chooseInfo && _this.chooseInfo.length > 0) {
+                // 回显选中数据
+                const flag = _this.chooseInfo.includes(data.list[i].supplier.supplierSn)
+                if (flag) {
+                  chooseData.push(data.list[i])
+                }
+              }
+            }
+            if (!this.pageFlag) {
+              this.pageFlag = true
+              _this.$refs.table.setTableSelected(_this.chooseInfo, chooseData) // 设置表格选中项
+            }
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      rowSelectionInfo: null
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '供应商名称', dataIndex: 'supplier.supplierName', width: '50%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '联系人', dataIndex: 'supplier.contact', align: 'left', width: '26%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '联系电话', dataIndex: 'supplier.contactMobile', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+      return arr
+    },
+    selectCount () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
+    }
+  },
+  methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
+    },
+    searchForm (flag) {
+      this.$refs.table.refresh(flag)
+      this.spinning = false
+    },
+    subareaChange (val) {
+      this.queryParam.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = {
+        supplierName: ''
+      }
+      this.$refs.table.clearSelected()
+      this.$refs.table.refresh(true)
+    },
+    clearTable () {
+      this.rowSelectionInfo = null
+      this.$refs.table.clearTable()
+    },
+    // 批量添加
+    handleBatchAudit () {
+      const _this = this
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        _this.$message.warning('请在列表勾选后再进行批量操作!')
+        return
+      }
+      const supplierSnList = _this.rowSelectionInfo.selectedRowKeys
+      this.spinning = false
+      this.$emit('plAdd', supplierSnList)
+    },
+    handleAdd (row) {
+      if (row.subareaArea) {
+        const _this = this
+        this.$confirm({
+          title: '提示',
+          content: '当前经销商已被其他区域分区绑定,确定要更新绑定关系吗?',
+          centered: true,
+          onOk () {
+            _this.spinning = true
+            _this.$emit('add', row)
+          }
+        })
+      } else {
+        this.spinning = true
+        this.$emit('add', row)
+      }
+    },
+    pageInit (data) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.chooseInfo = data.list ? data.list : []
+      this.userSn = data.sn
+      this.resetSearchForm()
+      this.pageFlag = false
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 285
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  }
+}
+</script>

+ 4 - 2
src/views/dealerManagement/businessOwnerSettings/settingsIndex.vue

@@ -109,7 +109,7 @@ import categorySet from './categorySet'
 import supplierSet from './supplierSet'
 import supplierSet from './supplierSet'
 import chooseAreaModal from './chooseAreaModal'
 import chooseAreaModal from './chooseAreaModal'
 import chooseDealer from './chooseDealer.vue'
 import chooseDealer from './chooseDealer.vue'
-import { bizuserScopeQueryPage, bizuserScopeDelete, findById, queryAreaScope, queryDealerScope, saveAreaScope, saveDealerScope } from '@/api/bizuser'
+import { queryDealerScopePage, bizuserScopeDelete, findById, queryAreaScope, queryDealerScope, saveAreaScope, saveDealerScope } from '@/api/bizuser'
 import subarea from '@/views/common/subarea.js'
 import subarea from '@/views/common/subarea.js'
 export default {
 export default {
   name: 'SettingsIndex',
   name: 'SettingsIndex',
@@ -147,7 +147,7 @@ export default {
         this.disabled = true
         this.disabled = true
         this.spinning = true
         this.spinning = true
         this.queryParam.userSn = this.$route.query.sn
         this.queryParam.userSn = this.$route.query.sn
-        return bizuserScopeQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
+        return queryDealerScopePage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           let data
           if (res.status == 200) {
           if (res.status == 200) {
             data = res.data
             data = res.data
@@ -221,6 +221,8 @@ export default {
       this.activeKeyVal = val
       this.activeKeyVal = val
       if (val == 2) {
       if (val == 2) {
         this.$refs.setCategory.pageInit()
         this.$refs.setCategory.pageInit()
+      } else if (val == 3) {
+        this.$refs.setSupplier.pageInit()
       }
       }
     },
     },
     // 所在区域分区查询
     // 所在区域分区查询

+ 201 - 271
src/views/dealerManagement/businessOwnerSettings/supplierSet.vue

@@ -1,254 +1,179 @@
-<template>
-  <div class="categorySet-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-card size="small" :bordered="false" class="categorySet-cont">
-        <div :style="{ height: tableHeight+84.5+'px' }">
-          <div class="areaSet-wrap">
-            <div class="table-page-search-wrapper newTableSearchName" >
-              <div class="areaSet-btnGroup" style="margin-bottom:20px;">
-                <a-button type="primary" class="button-error" @click="openDealerModal">新增</a-button>
-              </div>
-              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-                <a-row :gutter="15">
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="供应商名称">
-                      <a-input id="areaSet-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入供应商名称"/>
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="areaSet-refresh">查询</a-button>
-                    <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="areaSet-reset">重置</a-button>
-                  </a-col>
-                </a-row>
-              </a-form>
-            </div>
-            <a-spin :spinning="spinning" tip="Loading...">
-              <!-- 列表 -->
-              <s-table
-                class="sTable fixPagination"
-                ref="table"
-                size="small"
-                :rowKey="(record) => record.no"
-                rowKeyName="no"
-                :columns="columns"
-                :data="loadData"
-                :defaultLoadData="false"
-                :style="{ height: tableHeight-100+'px' }"
-                :scroll="{ y: tableHeight-180 }"
-                bordered>
-                <!-- 操作 -->
-                <template slot="action" slot-scope="text, record">
-                  <a-button
-                    size="small"
-                    type="link"
-                    class="button-error"
-                    @click="handleDel(record)"
-                  >
-                    删除
-                  </a-button>
-                </template>
-              </s-table>
-            </a-spin>
-          </div>
-        </div>
-      </a-card>
-    </a-spin>
-    <!-- 选择产品品牌 -->
-    <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
-    <!-- 选择产品分类 -->
-    <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
-  </div>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
-import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import { STable } from '@/components'
-import { getNewScopeSn, bizuserScopeQueryPage, saveProductBrandList, saveProductTypeList, bizuserScopeDelete, deleteProductBrand, deleteProductType } from '@/api/bizuser'
-export default {
-  name: 'CategorySet',
-  mixins: [commonMixin],
-  components: { ChooseBrandModal, ChooseTypeModal, STable },
-  props: {
-    bizUserSn: {
-      type: String,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      spinning: false,
-      tableHeight: 0,
-      disabled: false, //  查询、重置按钮是否可操作
-      columns: [
-        { title: '分类', dataIndex: 'no', width: '42%', align: 'center', scopedSlots: { customRender: 'classify' } },
-        { title: '品牌', dataIndex: 'name', width: '42%', align: 'center', scopedSlots: { customRender: 'brand' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '16%', align: 'center' }
+<template>
+  <div class="categorySet-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-card size="small" :bordered="false" class="categorySet-cont">
+        <div class="areaSet-wrap">
+          <div class="table-page-search-wrapper newTableSearchName" >
+            <div class="areaSet-btnGroup" style="margin-bottom:20px;">
+              <a-button type="primary" class="button-error" @click="openSupplierModal">新增</a-button>
+            </div>
+            <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="供应商名称">
+                    <a-input id="areaSet-dealerName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="areaSet-refresh">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="areaSet-reset">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form>
+          </div>
+          <a-spin :spinning="spinning" tip="Loading...">
+            <!-- 列表 -->
+            <s-table
+              class="sTable fixPagination"
+              ref="table"
+              size="small"
+              :rowKey="(record) => record.no"
+              rowKeyName="no"
+              :columns="columns"
+              :data="loadData"
+              :defaultLoadData="false"
+              :style="{ height: 1000+'px' }"
+              :scroll="{ y: tableHeight-180 }"
+              bordered>
+              <!-- 操作 -->
+              <template slot="action" slot-scope="text, record">
+                <a-button
+                  size="small"
+                  type="link"
+                  class="button-error"
+                  @click="handleDel(record)"
+                >
+                  删除
+                </a-button>
+              </template>
+            </s-table>
+          </a-spin>
+        </div>
+      </a-card>
+    </a-spin>
+    <!-- 选择供应商 -->
+    <a-drawer
+      title="选择供应商"
+      width="80%"
+      :zIndex="100"
+      :visible="openChooseSupplier"
+      :get-container="false"
+      :wrap-style="{ position: 'absolute' }"
+      @close="openChooseSupplier = false">
+      <div class="dealerModalCon">
+        <chooseSupplier ref="supplierChoose" @plAdd="handleAddSupplier"></chooseSupplier>
+      </div>
+    </a-drawer>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import chooseSupplier from './chooseSupplier.vue'
+import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
+import { STable } from '@/components'
+import { querySupplierScopePage, querySupplierScope, saveSupplierList, deleteSupplier } from '@/api/bizuser'
+export default {
+  name: 'CategorySet',
+  mixins: [commonMixin],
+  components: { chooseSupplier, ChooseTypeModal, STable },
+  props: {
+    bizUserSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '添加时间', dataIndex: 'createDate', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '供应商名称', dataIndex: 'supplier.supplierName', width: '60%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        // { title: '联系人', dataIndex: 'subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '联系手机', dataIndex: 'subareaAreaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
       ],
-      queryParam: {
-        hasDetail: 1
-      },
-      dataSource: [],
-      openModal: false, //  新增编辑产品品牌  弹框
-      itemSn: '', //  当前sn
+      openChooseSupplier: false,
+      queryParam: {
+        supplierName: ''
+      },
+      dataSource: [],
+      openModal: false, //  新增编辑产品品牌  弹框
+      itemSn: '', //  当前sn
       nowData: null, //  当前记录数据
       nowData: null, //  当前记录数据
       openBrandModal: false,
       openBrandModal: false,
-      openTypeModal: false,
-      chooseBrand: [],
-      chooseType: [],
-      chooseObj: null, // 选择品牌 内容
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        this.spinning = true
-        this.queryParam.userSn = this.$route.query.sn
-        this.queryParam.bizUserSn = this.bizUserSn
-        return bizuserScopeQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          data = res.data
-          const no = (data.pageNo - 1) * data.pageSize
-          this.total = data.count || 0
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = no + i + 1
-          }
-          this.dataSource = data.list
-          this.disabled = false
-          this.spinning = false
-          return data
-        })
-      }
-    }
-  },
+      openChooseDealer: true,
+      openTypeModal: false,
+      chooseBrand: [],
+      chooseType: [],
+      chooseObj: null, // 选择品牌 内容
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        // this.spinning = true
+        this.queryParam.userSn = this.$route.query.sn
+        this.queryParam.bizUserSn = this.bizUserSn
+        return querySupplierScopePage(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          this.total = data.count || 0
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.dataSource = data.list
+          this.disabled = false
+          // this.spinning = false
+          return data
+        })
+      }
+    }
+  },
   methods: {
   methods: {
-    //  返回
-    handleBack () {
-      this.$router.push({ name: 'powerUserList' })
-    },
-    // 新增管辖品类
-    addCategory () {
-      const _this = this
-      _this.spinning = true
-      _this.disabled = true
-      getNewScopeSn({}).then(res => {
-        if (res.status == 200) {
-          const newData = {
-            bizUserScopeSn: res.data,
-            productTypeList: [],
-            productBrandList: []
-          }
-          _this.dataSource.unshift(newData)
-        }
-        _this.spinning = false
-        _this.disabled = false
-      })
-    },
-    // 删除分类、品牌标签
-    delLabel (bigRow, row, type) {
+    // 打开供应商弹窗
+    async openSupplierModal () {
       const _this = this
       const _this = this
-      const bigPos = _this.dataSource.findIndex(con => { return bigRow == con.bizUserScopeSn })
-      if (type == 'typeList') {
-        const typePos = _this.dataSource[bigPos].productTypeList.findIndex(item => { return item.id == row.id })
-        deleteProductType({ id: _this.dataSource[bigPos].productTypeList[typePos].id }).then(res => {
-          if (res.status == 200) {
-            _this.dataSource[bigPos].productTypeList.splice(typePos, 1)
-          }
+      const arr = []
+      const dataList = await querySupplierScope({ userSn: this.$route.query.sn })
+      if (dataList.data && dataList.data.length > 0) {
+        dataList.data.forEach(con => {
+          arr.push(con.bizSn)
         })
         })
+        _this.chooseInfo = [...new Set(arr)]
       } else {
       } else {
-        const brandPos = _this.dataSource[bigPos].productBrandList.findIndex(obj => { return obj.id == row.id })
-        deleteProductBrand({ id: _this.dataSource[bigPos].productBrandList[brandPos].id }).then(res => {
-          if (res.status == 200) {
-            _this.dataSource[bigPos].productBrandList.splice(brandPos, 1)
-          }
-        })
+        _this.chooseInfo = []
       }
       }
-    },
-    // 添加分类标签
-    addClassifyTag (pos, row) {
-      const newData = []
-      row.productTypeList.forEach(item => {
-        const obj = {}
-        obj.productTypeSn = item.dataSn
-        obj.goodsSn = item.dataSn
-        obj.productTypeName = item.dataName
-        newData.push(obj)
-      })
-      this.chooseType = newData
-      this.chooseObj = row
-      this.openTypeModal = true
-    },
-    handleClassifyModal (con) {
-      const chooseList = con
-      this.openTypeModal = false
-      this.dataSource[this.ChooseClassifyPos].productTypeList = [...this.dataSource[this.ChooseClassifyPos].productTypeList, ...chooseList]
-    },
-    // 分类
-    handleTypeOk (obj) {
-      this.chooseType = obj
-      this.saveChangeData('CATEGORY')
-    },
-    // 添加品牌标签
-    addBrandTag (pos, row) {
-      const newData = []
-      row.productBrandList.forEach(item => {
-        const obj = {}
-        obj.goodsSn = item.dataSn
-        newData.push(obj)
+      const dataInfo = {
+        list: _this.chooseInfo,
+        sn: _this.$route.query.sn
+      }
+      this.openChooseSupplier = true
+      this.$nextTick(() => {
+        _this.$refs.supplierChoose.pageInit(dataInfo)
       })
       })
-      this.chooseBrand = newData
-      this.chooseObj = row
-      this.openBrandModal = true
     },
     },
-    // 品牌
-    handleBrandOk (obj) {
-      this.chooseBrand = obj
-      this.saveChangeData('BRAND')
+    // 选择供应商
+    handleAddSupplier (list) {
+      const newData = []
      list.forEach(con => {
        const obj = {}
+        obj.userSn = this.$route.query.sn
+        obj.bizUserSn = this.bizUserSn
        obj.bizType = 'supplier'
        obj.bizSn = con
        newData.push(obj)
      })
      this.saveChooseDealer(newData)
     },
     },
-    saveChangeData (type) {
+    saveChooseDealer (list) {
       const _this = this
       const _this = this
-      if (type == 'BRAND') { //  选择品牌
-        if (_this.chooseBrand.length > 0) {
-          const snList = []
-          _this.chooseBrand.map(item => {
-            const newObj = {}
-            newObj.dataSn = item.brandSn
-            snList.push(newObj)
-          })
-          this.save(snList, type)
-        }
-      } else if (type == 'CATEGORY') { //  选择分类
-        if (_this.chooseType.length > 0) {
-          const snList = []
-          _this.chooseType.map(item => {
-            const newObj = {}
-            newObj.dataSn = item.productTypeSn
-            snList.push(newObj)
-          })
-          this.save(snList, type)
+      const ajaxData = {}
+      ajaxData.userSn = _this.$route.query.sn
+      ajaxData.bizUserScopeList = list
+      saveSupplierList(ajaxData).then(res => {
+        if (res.status == 200) {
+          _this.openChooseSupplier = false
+          _this.resetSearchForm()
         }
         }
-      }
-    },
-    save (list, type) {
-      const ajaxdata = { userSn: this.$route.query.sn, bizUserScopeSn: this.chooseObj.bizUserScopeSn, bizUserSn: this.bizUserSn }
-      if (type == 'BRAND') {
-        ajaxdata.productBrandList = list
-        saveProductBrandList(ajaxdata).then(res => {
-          if (res.status == 200) {
-            this.openBrandModal = false
-            this.$refs.table.refresh()
-          }
-        })
-      } else if (type == 'CATEGORY') {
-        ajaxdata.productTypeList = list
-        saveProductTypeList(ajaxdata).then(res => {
-          if (res.status == 200) {
-            this.openTypeModal = false
-            this.$refs.table.refresh()
-          }
-        })
-      }
+      })
     },
     },
-    // 整行删除 删除
+    // 删除供应商
     handleDel (row) {
     handleDel (row) {
       const _this = this
       const _this = this
       this.$confirm({
       this.$confirm({
@@ -256,42 +181,47 @@ export default {
         content: '确认要删除吗?删除后当前用户权限以最新权限为准',
         content: '确认要删除吗?删除后当前用户权限以最新权限为准',
         centered: true,
         centered: true,
         onOk () {
         onOk () {
-          bizuserScopeDelete({ id: row.bizUserScopeSn }).then(res => {
+          deleteSupplier({ id: row.id }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
-              const pos = _this.dataSource.findIndex(item => { return item.bizUserScopeSn == row.bizUserScopeSn })
-              _this.dataSource.splice(pos, 1)
+              _this.resetSearchForm()
             }
             }
           })
           })
         }
         }
-      })
+      })
     },
     },
-    pageInit () {
-      const _this = this
-      this.$nextTick(() => { // 页面渲染完成后的回调
-        _this.setTableH()
-      })
-      this.$refs.table.refresh()
-    },
-    setTableH () {
-      const addBtnHeight = this.$refs.categorySetAddBtn.offsetHeight
-      this.tableHeight = window.innerHeight - addBtnHeight - 385
-    }
-  },
-  watch: {
-    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
-      this.setTableH()
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {})
-  }
-}
-</script>
-
-<style lang="less">
-  .categorySet-wrap{
-    .table-operator{
-    text-align:right;
-    }
-  }
-</style>
+    resetSearchForm () {
+      this.queryParam = {
+        supplierName: ''
+      }
+      this.$refs.table.refresh(true)
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.$refs.table.refresh()
+    },
+    setTableH () {
+      const addBtnHeight = this.$refs.categorySetAddBtn.offsetHeight
+      this.tableHeight = window.innerHeight - addBtnHeight - 385
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .categorySet-wrap{
+    .table-operator{
+    text-align:right;
+    }
+  }
+</style>