소스 검색

省仓关系

chenrui 1 년 전
부모
커밋
139c35bb9f

+ 39 - 0
src/api/serviceCenter.js

@@ -0,0 +1,39 @@
+import { axios } from '@/utils/request'
+
+//  仓库列表  有分页
+export const serviceCenterList = (params) => {
+  const url = `/serviceCenter/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 省仓新增
+export const serviceCenterAdd = (params) => {
+  const url = '/serviceCenter/insert'
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('新增')
+    }
+  })
+}
+
+// 启用禁用
+export const provincialWarehouseEnable = (params) => {
+  const url = '/serviceCenter/enableflag'
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 25 - 0
src/config/router.config.js

@@ -3058,6 +3058,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/dealerManagement/provincialWarehouseManagement',
+            redirect: '/dealerManagement/provincialWarehouseManagement/list',
+            name: 'provincialWarehouse',
+            component: BlankLayout,
+            meta: {
+              title: '省仓管理',
+              icon: 'share-alt'
+              // permission: 'M_provincialWarehouseList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'provincialWarehouseList',
+                component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/provincialWarehouseManagement/list.vue'),
+                meta: {
+                  title: '省仓管理列表',
+                  icon: 'share-alt',
+                  hidden: true
+                  // permission: 'M_provincialWarehouseList'
+                }
+              }
+            ]
+          },
           {
             path: '/dealerManagement/rebateSettings',
             redirect: '/dealerManagement/rebateSettings/list',

+ 8 - 1
src/views/common/custList.vue

@@ -40,7 +40,11 @@ export default {
       type: String,
       default: '请输入名称搜索'
     },
-    cooperateFlag: {
+    cooperateFlag: { // 合作关系
+      type: String,
+      default: undefined
+    },
+    dealerLevel: { // 商户级别
       type: String,
       default: undefined
     }
@@ -70,6 +74,9 @@ export default {
         if (this.cooperateFlag) {
           params.cooperateFlag = this.cooperateFlag
         }
+        if (this.dealerLevel) {
+          params.dealerLevel = this.dealerLevel
+        }
       }
       dealerQueryList(params).then(res => {
         if (fetchId !== this.lastFetchId) {

+ 2 - 2
src/views/dealerManagement/dealerRelationshipBinding/list.vue

@@ -149,7 +149,7 @@ export default {
     getSubItem (record) {
       this.innerData = []
       this.spinning = true
-      querySubList({ parentDealerSn: record.dealerSn }).then(res => {
+      querySubList({ parentDealerSn: record.dealerSn, relationType: 'PARENT' }).then(res => {
         if (res.status == 200 && res.data && res.data.length) {
           this.innerData = res.data
         } else {
@@ -251,7 +251,7 @@ export default {
         }
       })
     },
-    setHtable(){
+    setHtable () {
       this.tableHeight = window.innerHeight - 346
     }
   },

+ 1 - 1
src/views/dealerManagement/merchantInfoManagement/updateDealerLevel.vue

@@ -81,7 +81,7 @@ export default {
           if (_this.dealerLevelBak && _this.form.dealerLevel != _this.dealerLevelBak) {
             this.$confirm({
               title: '提示',
-              content: '商户价格级别变更后,该商户关联的经销商关系绑定将同步解除,确定变更该商户级别吗?',
+              content: '商户价格级别变更后,该商户关联的经销商关系绑定、省仓关系绑定将同步解除,确定变更该商户级别吗?',
               centered: true,
               onOk () {
                 _this.submitForm()

+ 168 - 0
src/views/dealerManagement/provincialWarehouseManagement/addModal.vue

@@ -0,0 +1,168 @@
+<template>
+  <a-modal
+    centered
+    class="addProvincialWarehouse-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="modalTit"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="500">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 表单 -->
+      <a-form-model
+        ref="ruleForm"
+        :model="form"
+        :rules="zoneRules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="设为省仓" prop="serviceCenterName">
+          <custList
+            id="dealerZoneSearch-dealerName"
+            cooperateFlag="1"
+            dealerLevel="PROVINCE"
+            placeholder="请输入经销商名称搜索"
+            ref="indirectDealer"
+            @change="dealerChange" />
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button id="addProvincialWarehouse-modal-back" @click="isShow = false" >取消</a-button>
+        <a-button type="primary" style="margin-left: 15px;" id="addProvincialWarehouse-modal-save" @click="handleSave">保存</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import custList from '@/views/common/custList.vue'
+import { serviceCenterAdd } from '@/api/serviceCenter'
+export default {
+  name: 'AddProvincialWarehouseModal',
+  components: { custList },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    parentData: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    }
+  },
+  computed: {
+    modalTit () {
+      return (this.parentData && this.parentData.subareaAreaSn ? '编辑' : '新增') + '省仓'
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      form: {
+        serviceCenterSn: undefined, // 经销商sn
+        serviceCenterName: undefined// 经销商名称
+      },
+      zoneRules: {
+        serviceCenterName: [
+          { required: true, message: '请输入经销商名称', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  methods: {
+    // 选择经销商
+    dealerChange (val) {
+      this.form.serviceCenterSn = val.key
+      this.form.serviceCenterName = val.key ? (val.label.replace('\n', '')).trim() : ''
+    },
+    //  保存
+    handleSave () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(_this.form))
+          _this.spinning = true
+          serviceCenterAdd(formData).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+              _this.isShow = false
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.indirectDealer.resetForm()
+        this.form.serviceCenterSn = undefined
+        this.form.serviceCenterName = undefined
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .addProvincialWarehouse-modal{
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+    .tree-node{
+      height: 300px;
+      overflow: auto;
+      .tree-box{
+        .tree-parent{
+          display: flex;
+          align-items: center;
+          border-bottom: 1px solid #eee;
+          padding: 0 10px;
+          > span{
+            margin:0 5px;
+            &:first-child{
+              flex-grow: 1;
+            }
+            &:last-child{
+              cursor: pointer;
+            }
+          }
+        }
+        .tree-child{
+          padding: 10px 10px 10px 35px;
+          display: flex;
+          align-items: center;
+          flex-wrap:wrap ;
+          > div{
+            margin:0 5px;
+          }
+        }
+      }
+
+    }
+  }
+</style>

+ 237 - 0
src/views/dealerManagement/provincialWarehouseManagement/chooseDealer.vue

@@ -0,0 +1,237 @@
+<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-model-item label="地区">
+              <AreaList id="viewDealers-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-item label="经销商名称/别名">
+              <a-input id="chooseDealer-nameLike" v-model.trim="queryParam.nameLike" allowClear placeholder="请输入经销商名称/别名"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-item label="商户类型">
+              <v-select code="DEALER_TYPE" id="chooseDealer-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择商户类型"></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-model-item label="商户级别" prop="dealerLevel">
+              <v-select code="DEALER_LEVEL" id="ucModal-dealerLevel" v-model="queryParam.dealerLevel" allowClear placeholder="请选择商户级别"></v-select>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-item label="所在区域/分区">
+              <subarea id="chooseDealer-subarea" ref="subarea" @change="subareaChange"></subarea>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
+            <a-button type="primary" @click="searchForm(true)" :disabled="disabled" id="chooseDealer-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseDealer-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>
+    <a-table
+      style="height: 320px;"
+      :scroll="{ y: 230 }"
+      :bordered="true"
+      :pagination="pagination"
+      :row-key="record => record.dealerSn"
+      :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+      :columns="columns"
+      :data-source="dealerList"
+      @change="handlePage"
+    >
+      <template slot="addressInfo" slot-scope="text, record">
+        {{ record.provinceName }}{{ '-'+ record.cityName }}{{ '-'+ record.districtName }}
+      </template>
+    </a-table>
+  </a-spin>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import AreaList from '@/views/common/areaList.js'
+import subarea from '@/views/common/subarea.js'
+import { queryDealerPage } from '@/api/promotion'
+import { getDealerListInfo } from '@/api/dealer'
+export default {
+  name: 'ChooseDealer',
+  mixins: [commonMixin],
+  components: { STable, VSelect, subarea, AreaList },
+  props: {
+    parentData: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    },
+    promotionSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      queryParam: { //  查询条件
+        nameLike: '',
+        dealerType: null,
+        dealerLevel: null,
+        subareaArea: {
+          subareaSn: undefined, //  区域
+          subareaAreaSn: undefined // 分区
+        },
+        auditState: undefined,
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined
+      },
+      pagination: {
+        pageSize: 20,
+        showSizeChanger: true,
+        pageSizeOptions: ['20', '50', '100', '200', '500']
+      },
+      pageFlag: false,
+      chooseInfo: [],
+      selectedRowKeys: [],
+      dealerList: [],
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      loading: false, // 批量添加loading,
+      columns: [
+        { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '30%', align: 'center', ellipsis: true },
+        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+    }
+  },
+  computed: {
+    selectCount () {
+      return this.selectedRowKeys && this.selectedRowKeys.length
+    }
+  },
+  methods: {
+    onSelectChange (selectedRowKeys) {
+      this.selectedRowKeys = selectedRowKeys
+    },
+    handlePage (pagination, filters, sorter) {
+      const pager = { ...this.pagination }
+      pager.pageNo = pagination.pageSize != pager.pageSize ? 1 : pagination.current
+      pager.pageSize = pagination.pageSize
+      pager.current = pager.pageNo
+      this.pagination = pager
+      this.loadData()
+    },
+    loadData () {
+      this.spinning = true
+      const params = { pageSize: 20, pageNo: 1, ...this.pagination, promotionSn: this.promotionSn }
+
+      queryDealerPage(Object.assign(params, this.queryParam)).then(res => {
+        let data
+        if (res.status == 200) {
+          data = res.data
+          const pagination = { ...this.pagination }
+          pagination.total = Number(data.count)
+          const no = 0
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.dealerList = data.list
+          this.pagination = pagination
+          if (this.chooseInfo.length > 0 && !this.pageFlag) {
+            this.pageFlag = true
+            this.selectedRowKeys = this.chooseInfo
+          }
+        }
+        this.spinning = false
+      })
+    },
+    // 表格选中项
+    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 () {
+      this.loadData()
+      this.spinning = false
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = {
+        nameLike: '',
+        dealerType: null,
+        dealerLevel: null,
+        subareaArea: {
+          subareaSn: undefined, //  区域
+          subareaAreaSn: undefined // 分区
+        },
+        auditState: undefined,
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined
+      }
+      this.$refs.subarea.clearData()
+      this.$refs.areaList.clearData()
+      this.pagination.pageNo = 1
+      this.pagination.current = 1
+      this.loadData()
+      this.pageFlag = false
+    },
+    // 批量添加
+    async handleBatchAudit () {
+      const _this = this
+      if (_this.selectedRowKeys && _this.selectedRowKeys.length < 1) {
+        _this.$message.warning('请在列表勾选后再进行批量操作!')
+        return
+      }
+      const dealerInfoList = await getDealerListInfo({ dealerSnList: _this.selectedRowKeys })
+      this.spinning = false
+      this.$emit('plAdd', dealerInfoList.data)
+    },
+    pageInit (data) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.selectedRowKeys = []
+      this.chooseInfo = data || []
+      this.resetSearchForm()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 285
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  }
+}
+</script>

+ 292 - 0
src/views/dealerManagement/provincialWarehouseManagement/list.vue

@@ -0,0 +1,292 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="provincialWarehouse-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <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="provincialWarehouse-name" v-model.trim="queryParam.serviceCenterName" allowClear placeholder="请输入省仓名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="省仓客户">
+                <a-input id="provincialWarehouse-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入省仓客户"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="省仓状态">
+                <v-select code="ENABLE_FLAG" id="provincialWarehouse-enableFlag" v-model="queryParam.enableFlag" allowClear placeholder="请选择省仓状态"></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="provincialWarehouse-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="provincialWarehouse-reset">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 操作按钮 -->
+        <div class="table-operator">
+          <a-button id="provincialWarehouse-add" type="primary" v-if="$hasPermissions('B_dealerAccount_add')" @click="handleEdit()">新增</a-button>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+70+'px' }"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :pageSize="30"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 省仓客户 -->
+          <template slot="customNum" slot-scope="text, record" @click="openCustomerModal = true">
+            共有<span style="color:#39f;vertical-align:top;">{{ record.customerNum }}</span>个客户
+          </template>
+          <!-- 省仓状态 -->
+          <template slot="loginFlag" slot-scope="text, record">
+            <a-switch
+              id="provincialWarehouse-enableFlag"
+              v-if="$hasPermissions('B_dealerAccount_enable')"
+              checkedChildren="启用"
+              unCheckedChildren="禁用"
+              @change="changeStatus(record)"
+              :checked="record.enableFlag == 1 ? true : false" />
+            <span v-else :style="{color:(record.enableFlag==1?'#00aa00':'#999')}"> {{ record.enableFlag==1? '已启用': '已禁用' }} </span>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button
+              size="small"
+              type="link"
+              v-if="$hasPermissions('B_dealerAccount_edit')"
+              class="button-info"
+              @click="handleDealer(record)"
+              id="provincialWarehouse-edit-btn">关联经销商</a-button>
+            <span v-else>--</span>
+          </template>
+        </s-table>
+      </a-spin>
+      <!-- 新增/编辑 -->
+      <provincial-warehouse-add-modal
+        v-drag
+        :openModal="openModal"
+        :nowData="nowData"
+        :itemId="itemId"
+        @ok="$refs.table.refresh(true)"
+        @close="closeModal" />
+      <!-- 省仓客户 -->
+      <lookUp-customers-modal
+        :itemSn="itemPromotionSn"
+        :showType="itemStatusType"
+        ref="lookUpCustomers"
+        :openModal="openCustomerModal"
+        :chooseDealerList="chooseDealerArr"
+        @submitAudit="editCustomerOk"
+        @handleAudit="auditCustomerOk"
+        @close="closeCustomer"></lookUp-customers-modal>
+      <!-- 关联经销商 -->
+      <a-modal
+        title="选择经销商"
+        :visible="openDealerModal"
+        :footer="null"
+        centered
+        class="lookUpCustomers-modal"
+        @cancel="openDealerModal = false"
+        width="60%"
+      >
+        <div class="dealerModalCon">
+          <chooseDealer ref="dealerChoose" pageType="dealerPromotion" :itemSn="notDealerSn" @plAdd="handleAddDealer"></chooseDealer>
+        </div>
+      </a-modal>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import provincialWarehouseAddModal from './addModal.vue'
+import lookUpCustomersModal from './lookUpCustomersModal.vue'
+import chooseDealer from '../../promotionRulesManagement/promotionManagement/chooseDealer.vue'
+import { dealerUserEnable, dealerUserResetP } from '@/api/dealer'
+import { serviceCenterList, provincialWarehouseEnable } from '@/api/serviceCenter'
+export default {
+  name: 'DealerAccountManagementList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, provincialWarehouseAddModal, lookUpCustomersModal, chooseDealer },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        serviceCenterName: '',
+        dealerName: '',
+        enableFlag: undefined
+      },
+      openDealerModal: false,
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center' },
+        { title: '区域', dataIndex: 'subareaName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaAreaName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省仓名称', dataIndex: 'serviceCenterName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '省仓客户', dataIndex: 'customerNum', width: '12%', align: 'center', scopedSlots: { customRender: 'customNum' } },
+        { title: '省仓状态', scopedSlots: { customRender: 'loginFlag' }, width: '9%', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return serviceCenterList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+              data.list[i].loginFlag = Number(data.list[i].loginFlag)
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      openModal: false, //  新增编辑  弹框
+      openDetailModal: false, // 详情  弹框
+      itemId: '', //  当前id
+      nowData: null, //  当前记录数据
+      productBrandList: [],
+      openCustomerModal: false,
+      notDealerSn: null
+    }
+  },
+  methods: {
+    editCustomerOk () {
+
+    },
+    auditCustomerOk () {
+
+    },
+    closeCustomer () {
+
+    },
+    // 关联经销商
+    handleDealer (row) {
+      this.notDealerSn = row.serviceCenterSn
+      this.$nextTick(() => {
+        this.openDealerModal = true
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.serviceCenterName = ''
+      this.queryParam.dealerName = ''
+      this.queryParam.enableFlag = undefined
+      this.$refs.table.refresh(true)
+    },
+    //  新增/编辑
+    handleEdit (row) {
+      // this.itemId = row ? row.id : ''
+      // this.nowData = row || null
+      this.openModal = true
+    },
+    // 详情
+    handleDetail (row) {
+      this.itemId = row ? row.id : ''
+      this.openDetailModal = true
+    },
+    //  关闭弹框
+    closeModal () {
+      this.itemId = ''
+      this.nowData = null
+      this.openModal = false
+    },
+    // 关闭详情弹框
+    closeDetailModal () {
+      this.itemId = ''
+      this.openDetailModal = false
+    },
+    // 重置密码
+    handleReset (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '重置密码后,新的密码会以短信形式发送到【管理员手机】,确定要重置吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          dealerUserResetP({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 启用 禁用
+    changeStatus (record) {
+      const params = {
+        serviceCenterSn: record.serviceCenterSn,
+        enableFlag: record.enableFlag == 1 ? '0' : '1'
+      }
+      this.spinning = true
+      provincialWarehouseEnable(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+        }
+        this.spinning = false
+        this.$refs.table.refresh()
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 240
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.$refs.table.refresh()
+      this.pageInit()
+    }
+  }
+}
+</script>

+ 354 - 0
src/views/dealerManagement/provincialWarehouseManagement/lookUpCustomersModal.vue

@@ -0,0 +1,354 @@
+<template>
+  <a-modal
+    centered
+    class="lookUpCustomers-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="参与客户"
+    v-model="isShow"
+    @cancel="isShow = false"
+    width="60%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-card size="small" :bordered="false">
+        <!-- 筛选条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="地区">
+                  <AreaList id="lookUpCustomers-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="区域/分区">
+                  <subarea ref="subarea" id="lookUpCustomers-subarea" @change="subareaChange"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="经销商名称">
+                  <a-input id="lookUpCustomers-purchaseBillNo" v-model="queryParam.dealerName" placeholder="请输入经销商名称" allowClear/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户状态">
+                  <v-select
+                    v-model="queryParam.state"
+                    ref="state"
+                    id="lookUpCustomers-state"
+                    code="PROMOTION_STATE"
+                    placeholder="请选择客户状态"
+                    allowClear
+                  ></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckMakeInventoryList-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckMakeInventoryList-reset">重置</a-button>
+                <a-button
+                  style="margin-left: 10px"
+                  type="primary"
+                  class="button-warning"
+                  @click="handleExport"
+                  :disabled="disabled"
+                  :loading="exportLoading"
+                >导出</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.dealerSn"
+          rowKeyName="dealerSn"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :scroll="{ y: 450 }"
+          :rowClassName="(record, index) => record.dataActType ==='CREATE'? 'fontRed':record.dataActType ==='DELETE'?'fontGreen':''"
+          bordered>
+          <!-- 地区 -->
+          <template slot="address" slot-scope="text, record">
+            {{ record.provinceName }}/{{ record.cityName }}/{{ record.districtName }}
+          </template>
+          <!-- 经销商名称 -->
+          <template slot="dealerName" slot-scope="text, record">
+            <span>{{ record.dealerName ||'--' }}</span>
+            <a-badge count="未" :number-style="{ zoom:'80%' }"></a-badge>
+          </template>
+          <!-- 客户状态 -->
+          <template slot="dealerState" slot-scope="text, record">
+            <a-switch checkedChildren="启用" unCheckedChildren="禁用" :checked="record.isEnable" @change="changeStatus"/>
+          </template>
+        </s-table>
+      </a-card>
+      <div style="text-align:right;color:#666;" v-if="showType ==='isEdit' || showType === 'isAudit'"><span v-if="showType === 'isAudit'">待审核,</span>增加的客户显示红色,删除的客户显示绿色</div>
+      <div class="btn-cont" v-if="showType ==='isEdit'">
+        <a-button type="primary" class="button-warning" @click="editDealerModal">修改</a-button>
+        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="submitAudit">提交审核</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isAudit'&& $hasPermissions('B_dealerAudit')">
+        <a-button @click="handleAudit('AUDIT_REJECT')">审核不通过</a-button>
+        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="handleAudit('AUDIT_PASS')">审核通过</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isAudit' && !$hasPermissions('B_dealerAudit')">
+        <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isClose'">
+        <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
+      </div>
+    </a-spin>
+    <!-- 选择参与客户 -->
+    <a-modal
+      title="选择经销商"
+      :visible="openDealerModal"
+      :footer="null"
+      centered
+      class="lookUpCustomers-modal"
+      @cancel="openDealerModal = false"
+      width="60%"
+    >
+      <div class="dealerModalCon">
+        <chooseDealer ref="dealerChoose" :promotionSn="itemSn" @plAdd="handleAddDealer"></chooseDealer>
+      </div>
+    </a-modal>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import subarea from '@/views/common/subarea.js'
+import AreaList from '@/views/common/areaList.js'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { dealerExport } from '@/api/promoTerminal'
+import { queryAuditPageList, dealerMidwayUpdate } from '@/api/promotion'
+import chooseDealer from './chooseDealer'
+
+export default {
+  name: 'LookUpCustomersModal',
+  components: { STable, subarea, AreaList, chooseDealer },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {// 促销sn
+      type: String,
+      default: ''
+    },
+    showType: {
+      type: String,
+      default: ''
+    },
+    chooseDealerList: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      exportLoading: false,
+      queryParam: {
+        subareaArea: {
+          subareaSn: undefined,
+          subareaAreaSn: undefined
+        },
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined,
+        dealerName: '',
+        state: undefined
+      },
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        this.queryParam.promotionSn = this.itemSn
+        const params = Object.assign(parameter, this.queryParam)
+        return queryAuditPageList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '地区', scopedSlots: { customRender: 'address' }, width: '20%', align: 'center', ellipsis: true },
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '经销商名称', dataIndex: 'dealerName', scopedSlots: { customRender: 'dealerName' }, width: '20%', align: 'center', ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户状态', scopedSlots: { customRender: 'dealerState' }, width: '10%', align: 'center' }
+      ],
+      openDealerModal: false, // 修改弹窗
+      updateFlag: false
+    }
+  },
+  methods: {
+    // 客户状态
+    changeStatus (e) {
+
+    },
+    // 修改参与客户
+    editDealerModal () {
+      const _this = this
+      _this.openDealerModal = true
+      const arr = _this.chooseDealerList
+      // 选择参与客户回显
+      _this.$nextTick(() => {
+        _this.$refs.dealerChoose.pageInit(arr)
+      })
+    },
+    // 添加经销商
+    handleAddDealer (list) {
+      const newArr = []
+      const dealerSnArr = []
+      list.forEach(item => {
+        const obj = {
+          dealerScope: this.itemSn ? 'SOME_DEALER' : 'ALL_DEALER',
+          dealerSn: item.dealerSn
+        }
+        newArr.push(obj)
+        dealerSnArr.push(item.dealerSn)
+      })
+      this.openDealerModal = false
+      this.chooseDealerList = dealerSnArr
+      this.updateDataList(newArr)
+    },
+    // 更新列表显示状态
+    updateDataList (list) {
+      const ajaxData = {
+        promotionSn: this.itemSn ? this.itemSn : undefined,
+        promotionDealerList: list
+      }
+      dealerMidwayUpdate(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+        }
+      })
+    },
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = Object.assign({
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined,
+        subareaArea: {
+          subareaSn: undefined,
+          subareaAreaSn: undefined
+        },
+        dealerName: '',
+        state: undefined
+      }, this.snObj)
+      this.updateFlag = false
+      this.$refs.areaList.clearData()
+      this.$refs.subarea.clearData()
+      this.$refs.table.refresh(true)
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      _this.exportLoading = true
+      _this.spinning = true
+      _this.queryParam.dealerSnList = this.chooseDealerList
+      const paramsData = _this.queryParam
+      hdExportExcel(dealerExport, paramsData, '促销经销商列表导出', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+        _this.showExport = true
+      })
+    },
+    // 提交审核
+    submitAudit () {
+      this.$emit('submitAudit')
+      this.isShow = false
+    },
+    handleAudit (statusInfo) {
+      this.$emit('handleAudit', statusInfo)
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        this.$nextTick(() => {
+          this.resetSearchForm()
+        })
+      }
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .lookUpCustomers-modal{
+    .ant-modal-body{
+      padding: 0 24px 24px;
+    }
+    .redBg-row{
+      background-color: #f5cdc8;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 5px 0 10px;
+    }
+    .table-page-search-wrapper{
+      margin-bottom:6px;
+      /deep/.ant-select-selection{
+        border:0 !important;
+        box-shadow: none !important;
+      }
+      .ant-form.ant-form-inline .ant-form-item{
+        border:1px solid #dadada;
+        border-radius: 3px;
+        overflow: hidden;
+        margin-bottom: 10px!important;
+        /deep/.ant-form-item-label{
+          padding-left: 11px !important;
+          padding-right: 0!important;
+        }
+      }
+    }
+   /deep/.fontRed{
+     color:red;
+   }
+   /deep/.fontGreen{
+     color:green;
+   }
+  }
+
+</style>

+ 35 - 7
src/views/promotionRulesManagement/dealerPromotions/lookUpCustomersModal.vue

@@ -16,17 +16,29 @@
             <a-row :gutter="15">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="地区">
-                  <AreaList id="actualSalesReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                  <AreaList id="lookUpCustomers-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="区域/分区">
-                  <subarea ref="subarea" id="salesManagementList-subarea" @change="subareaChange"></subarea>
+                  <subarea ref="subarea" id="lookUpCustomers-subarea" @change="subareaChange"></subarea>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="经销商名称">
-                  <a-input id="salesManagementList-purchaseBillNo" v-model="queryParam.dealerName" placeholder="请输入经销商名称" allowClear/>
+                  <a-input id="lookUpCustomers-purchaseBillNo" v-model="queryParam.dealerName" placeholder="请输入经销商名称" allowClear/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户状态">
+                  <v-select
+                    v-model="queryParam.state"
+                    ref="state"
+                    id="lookUpCustomers-state"
+                    code="PROMOTION_STATE"
+                    placeholder="请选择客户状态"
+                    allowClear
+                  ></v-select>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
@@ -61,6 +73,15 @@
           <template slot="address" slot-scope="text, record">
             {{ record.provinceName }}/{{ record.cityName }}/{{ record.districtName }}
           </template>
+          <!-- 经销商名称 -->
+          <template slot="dealerName" slot-scope="text, record">
+            <span>{{ record.dealerName ||'--' }}</span>
+            <a-badge count="未" :number-style="{ zoom:'80%' }"></a-badge>
+          </template>
+          <!-- 客户状态 -->
+          <template slot="dealerState" slot-scope="text, record">
+            <a-switch checkedChildren="启用" unCheckedChildren="禁用" :checked="record.isEnable" @change="changeStatus"/>
+          </template>
         </s-table>
       </a-card>
       <div style="text-align:right;color:#666;" v-if="showType ==='isEdit' || showType === 'isAudit'"><span v-if="showType === 'isAudit'">待审核,</span>增加的客户显示红色,删除的客户显示绿色</div>
@@ -144,7 +165,8 @@ export default {
         provinceSn: undefined,
         citySn: undefined,
         districtSn: undefined,
-        dealerName: ''
+        dealerName: '',
+        state: undefined
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -171,15 +193,20 @@ export default {
         { title: '地区', scopedSlots: { customRender: 'address' }, width: '20%', align: 'center', ellipsis: true },
         { title: '区域', dataIndex: 'subareaArea.subareaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '经销商名称', dataIndex: 'dealerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '经销商名称', dataIndex: 'dealerName', scopedSlots: { customRender: 'dealerName' }, width: '20%', align: 'center', ellipsis: true },
         { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户级别', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '商户级别', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户状态', scopedSlots: { customRender: 'dealerState' }, width: '10%', align: 'center' }
       ],
       openDealerModal: false, // 修改弹窗
       updateFlag: false
     }
   },
   methods: {
+    // 客户状态
+    changeStatus (e) {
+
+    },
     // 修改参与客户
     editDealerModal () {
       const _this = this
@@ -238,7 +265,8 @@ export default {
           subareaSn: undefined,
           subareaAreaSn: undefined
         },
-        dealerName: ''
+        dealerName: '',
+        state: undefined
       }, this.snObj)
       this.updateFlag = false
       this.$refs.areaList.clearData()

+ 5 - 0
src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue

@@ -93,6 +93,10 @@ export default {
       default: function () {
         return null
       }
+    },
+    itemSn: {
+      type: String,
+      default: ''
     }
   },
   data () {
@@ -159,6 +163,7 @@ export default {
     loadData () {
       this.spinning = true
       const params = { pageSize: 20, pageNo: 1, ...this.pagination }
+      this.queryParam.notDealerSn = this.itemSn ? this.itemSn : undefined
       dealerQueryList(Object.assign(params, this.queryParam)).then(res => {
         let data
         if (res.status == 200) {