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