123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <a-card size="small" :bordered="false" class="merchantInfoManagementList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <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-item label="区域">
- <subarea id="merchantInfoManagementList-subarea" v-model="queryParam.subareaSn"></subarea>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="商户名称/别名">
- <a-input id="merchantInfoManagementList-nameLike" v-model.trim="queryParam.nameLike" allowClear placeholder="请输入商户名称/别名"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="商户类型">
- <v-select code="DEALER_TYPE" id="merchantInfoManagementList-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择商户类型"></v-select>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="审核状态">
- <v-select code="AUDIT_STATE" id="merchantInfoManagementList-auditState" v-model="queryParam.auditState" allowClear placeholder="请选择审核状态"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="合作状态">
- <v-select code="DEALER_COOPERATE_FLAG" id="merchantInfoManagementList-cooperateFlag" v-model="queryParam.cooperateFlag" allowClear placeholder="请选择合作状态"></v-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="merchantInfoManagementList-refresh">查询</a-button>
- <a-button style="margin: 0 0 18px 5px" @click="resetSearchForm" :disabled="disabled" id="merchantInfoManagementList-reset">重置</a-button>
- <a-button
- style="margin-left: 5px"
- type="primary"
- v-if="$hasPermissions('B_merchantInfo_export')"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="merchantInfoManagementList-export">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button id="merchantInfoManagementList-add" type="primary" v-if="$hasPermissions('B_merchantInfo_add')" class="button-error" @click="handleAdd">新增</a-button>
- </div>
- <!-- 总计 -->
- <a-alert type="info" showIcon style="margin-bottom:15px">
- <div slot="message">合计:<strong>{{ total }}</strong>条</div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 2240, y: tableHeight }"
- bordered>
- <!-- 经销商 -->
- <template slot="dealerName" slot-scope="text, record">
- <span v-if="$hasPermissions('B_merchantInfo_detail')" style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.dealerName }}</span>
- <span v-else>{{ record.dealerName }}</span>
- </template>
- <!-- 区域 -->
- <template slot="area" slot-scope="text, record">
- <div v-if="record.subareaNameSet&&record.subareaNameSet.length!=0">
- <span v-for="(item, index) in record.subareaNameSet" :key="index">{{ item }}{{ index+1 == record.subareaNameSet.length ? '' : ',' }}</span>
- </div>
- <span v-else>--</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="link" class="button-warning" v-if="record.auditState == 'WAIT' && $hasPermissions('B_merchantInfo_audit')" @click="handleAudit(record)" >审核</a-button>
- <a-button size="small" type="link" class="button-success" v-if="$hasPermissions('B_merchantInfo_cooperation')" @click="handleCooperation(record)" >合作设置</a-button>
- <a-button size="small" type="link" class="button-error" v-if="record.auditState != 'WAIT' && $hasPermissions('B_merchantInfo_distribution')" @click="handleDistribution(record)">经销权</a-button>
- <a-button size="small" type="link" class="button-primary" v-if="$hasPermissions('B_merchantInfo_level')" @click="handleLevel(record)">级别设置</a-button>
- <a-button size="small" type="link" class="button-info" v-if="$hasPermissions('B_merchantInfo_edit')" @click="handleEdit(record)">编辑</a-button>
- <span v-if="!(record.auditState == 'WAIT' && $hasPermissions('B_merchantInfo_audit')) && !$hasPermissions('B_merchantInfo_cooperation') && !(record.auditState != 'WAIT' && $hasPermissions('B_merchantInfo_distribution')) && !$hasPermissions('B_merchantInfo_level') && !$hasPermissions('B_merchantInfo_edit')">--</span>
- </template>
- </s-table>
- </a-spin>
- <!-- 产品详情 -->
- <merchant-info-management-detail-modal :openModal="openModal" :isAudit="isAudit" :itemId="itemId" @ok="resetForm" @close="closeModal" />
- <!-- 合作设置 -->
- <UpdateCooperate ref="updateCooperate" :openUcModal="openUcModal" @ok="resetForm" @close="openUcModal=false"></UpdateCooperate>
- <!-- 级别设置 -->
- <UpdateDealerLeve ref="updateDealerLevel" :openUdModal="openUdModal" @ok="resetForm" @close="openUdModal=false"></UpdateDealerLeve>
- </a-card>
- </template>
- <script>
- import moment from 'moment'
- import { dealerQueryList, dealerExport } from '@/api/dealer'
- import { STable, VSelect } from '@/components'
- import subarea from '@/views/common/subarea.js'
- import merchantInfoManagementDetailModal from './detailModal.vue'
- import UpdateCooperate from './updateCooperate.vue'
- import UpdateDealerLeve from './updateDealerLevel.vue'
- export default {
- components: { STable, VSelect, merchantInfoManagementDetailModal, subarea, UpdateCooperate, UpdateDealerLeve },
- data () {
- return {
- spinning: false,
- advanced: false, // 高级搜索 展开/关闭
- tableHeight: 0,
- queryParam: { // 查询条件
- nameLike: '', // 商户名称、别名
- dealerType: undefined, // 商户类型
- subareaSn: undefined, // 区域
- auditState: undefined, // 审核状态
- cooperateFlag: undefined // 合作状态
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false, // 导出loading
- dateFormat: 'YYYY-MM-DD',
- total: 0,
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
- { title: '区域', scopedSlots: { customRender: 'area' }, width: 200, align: 'center' },
- { title: '商户名称', scopedSlots: { customRender: 'dealerName' }, align: 'center', ellipsis: true },
- { title: '商户别名', dataIndex: 'dealerAlias', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '联系人', dataIndex: 'contact', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '联系电话', dataIndex: 'dealerTelephone', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '绑定手机号码', dataIndex: 'managerMobile', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '审核状态', dataIndex: 'auditStateDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '合作状态', dataIndex: 'cooperateFlagDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '生效时间', dataIndex: 'cooperateEffectiveTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center', fixed: 'right' }
- ],
- loading: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- if (this.tableHeight == 0) {
- this.tableHeight = window.innerHeight - 440
- }
- return dealerQueryList(Object.assign(parameter, this.queryParam)).then(res => {
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- this.total = data.count
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- return data
- })
- },
- openModal: false, // 查看详情 弹框
- openUcModal: false, // 合作设置 弹框
- openUdModal: false, // 级别设置 弹框
- itemId: '', // 当前商户sn
- isAudit: false
- }
- },
- methods: {
- // 重置列表
- resetSearchForm () {
- this.queryParam = {
- nameLike: '', // 商户名称、别名
- dealerType: undefined, // 商户类型
- subareaSn: undefined, // 区域
- auditState: undefined, // 审核状态
- cooperateFlag: undefined // 合作状态
- }
- this.$refs.table.refresh(true)
- },
- // 刷新当前列表
- resetForm () {
- this.$refs.table.refresh()
- this.openModal = false
- this.isAudit = false
- this.openUcModal = false
- this.openUdModal = false
- },
- // 新增
- handleAdd () {
- this.$router.push({ name: `merchantInfoManagementAdd` })
- },
- // 编辑
- handleEdit (row) {
- this.$router.push({ name: `merchantInfoManagementEdit`, params: { id: row.dealerSn } })
- },
- // 合作设置
- handleCooperation (row) {
- this.$refs.updateCooperate.setData(row)
- this.openUcModal = true
- },
- // 价格级别
- handleLevel (row) {
- this.$refs.updateDealerLevel.setData(row)
- this.openUdModal = true
- },
- // 经销权
- handleDistribution (row) {
- this.$router.push({ name: `merchantInfoManagementSet`, params: { sn: row.dealerSn } })
- },
- // 审核
- handleAudit (row) {
- this.itemId = row.dealerSn
- this.openModal = true
- this.isAudit = true
- },
- // 详情
- handleDetail (row) {
- this.itemId = row.dealerSn
- this.openModal = true
- this.isAudit = false
- },
- // 关闭弹框
- closeModal () {
- this.itemId = ''
- this.openModal = false
- },
- // 导出
- handleExport () {
- const _this = this
- const params = this.queryParam
- this.exportLoading = true
- _this.spinning = true
- dealerExport(params).then(res => {
- this.exportLoading = false
- _this.spinning = false
- if (res.type == 'application/json') {
- var reader = new FileReader()
- reader.addEventListener('loadend', function () {
- const obj = JSON.parse(reader.result)
- _this.$notification.error({
- message: '提示',
- description: obj.message
- })
- })
- reader.readAsText(res)
- } else {
- this.download(res)
- }
- })
- },
- download (data) {
- if (!data) { return }
- const url = window.URL.createObjectURL(new Blob([data]))
- const link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- const a = moment().format('YYYYMMDDHHmmss')
- const fname = '经销商资料' + a
- link.setAttribute('download', fname + '.xlsx')
- document.body.appendChild(link)
- link.click()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- })
- }
- }
- </script>
- <style lang="less">
- .merchantInfoManagementList-wrap{
- .productPic{
- cursor: pointer;
- }
- }
- </style>
|