list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <a-card size="small" :bordered="false" class="merchantInfoManagementList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="区域">
  9. <subarea id="merchantInfoManagementList-subarea" v-model="queryParam.subareaSn"></subarea>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="商户名称/别名">
  14. <a-input id="merchantInfoManagementList-nameLike" v-model.trim="queryParam.nameLike" allowClear placeholder="请输入商户名称/别名"/>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="商户类型">
  19. <v-select code="DEALER_TYPE" id="merchantInfoManagementList-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择商户类型"></v-select>
  20. </a-form-item>
  21. </a-col>
  22. <template v-if="advanced">
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="审核状态">
  25. <v-select code="AUDIT_STATE" id="merchantInfoManagementList-auditState" v-model="queryParam.auditState" allowClear placeholder="请选择审核状态"></v-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="合作状态">
  30. <v-select code="DEALER_COOPERATE_FLAG" id="merchantInfoManagementList-cooperateFlag" v-model="queryParam.cooperateFlag" allowClear placeholder="请选择合作状态"></v-select>
  31. </a-form-item>
  32. </a-col>
  33. </template>
  34. <a-col :md="6" :sm="24">
  35. <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="merchantInfoManagementList-refresh">查询</a-button>
  36. <a-button style="margin: 0 0 18px 5px" @click="resetSearchForm" :disabled="disabled" id="merchantInfoManagementList-reset">重置</a-button>
  37. <a-button
  38. style="margin-left: 5px"
  39. type="primary"
  40. class="button-warning"
  41. @click="handleExport"
  42. :disabled="disabled"
  43. :loading="exportLoading"
  44. id="merchantInfoManagementList-export">导出</a-button>
  45. <a @click="advanced=!advanced" style="margin-left: 8px">
  46. {{ advanced ? '收起' : '展开' }}
  47. <a-icon :type="advanced ? 'up' : 'down'"/>
  48. </a>
  49. </a-col>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. <!-- 操作按钮 -->
  54. <div class="table-operator">
  55. <a-button id="merchantInfoManagementList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
  56. </div>
  57. <!-- 总计 -->
  58. <a-alert type="info" showIcon style="margin-bottom:15px">
  59. <div slot="message">合计:<strong>{{ total }}</strong>条</div>
  60. </a-alert>
  61. <!-- 列表 -->
  62. <s-table
  63. class="sTable"
  64. ref="table"
  65. size="default"
  66. :rowKey="(record) => record.id"
  67. :columns="columns"
  68. :data="loadData"
  69. :scroll="{ x: 2240, y: tableHeight }"
  70. bordered>
  71. <!-- 经销商 -->
  72. <template slot="dealerName" slot-scope="text, record">
  73. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.dealerName }}</span>
  74. </template>
  75. <!-- 区域 -->
  76. <template slot="area" slot-scope="text, record">
  77. <div v-if="record.subareaNameSet&&record.subareaNameSet.length!=0">
  78. <span v-for="(item, index) in record.subareaNameSet" :key="index">{{ item }}{{ index+1 == record.subareaNameSet.length ? '' : ',' }}</span>
  79. </div>
  80. <span v-else>--</span>
  81. </template>
  82. <!-- 操作 -->
  83. <template slot="action" slot-scope="text, record">
  84. <a-button size="small" type="link" class="button-warning" v-if="record.auditState == 'WAIT'" @click="handleAudit(record)" >审核</a-button>
  85. <a-button size="small" type="link" class="button-success" @click="handleCooperation(record)" >合作设置</a-button>
  86. <a-button size="small" type="link" class="button-error" v-if="record.auditState != 'WAIT'" @click="handleDistribution(record)">经销权</a-button>
  87. <a-button size="small" type="link" class="button-primary" @click="handleLevel(record)">级别设置</a-button>
  88. <a-button size="small" type="link" class="button-info" @click="handleEdit(record)">编辑</a-button>
  89. </template>
  90. </s-table>
  91. <!-- 产品详情 -->
  92. <merchant-info-management-detail-modal :openModal="openModal" :isAudit="isAudit" :itemId="itemId" @ok="resetForm" @close="closeModal" />
  93. <!-- 合作设置 -->
  94. <UpdateCooperate ref="updateCooperate" :openUcModal="openUcModal" @ok="resetForm" @close="openUcModal=false"></UpdateCooperate>
  95. <!-- 级别设置 -->
  96. <UpdateDealerLeve ref="updateDealerLevel" :openUdModal="openUdModal" @ok="resetForm" @close="openUdModal=false"></UpdateDealerLeve>
  97. </a-card>
  98. </template>
  99. <script>
  100. import moment from 'moment'
  101. import { dealerQueryList, dealerExport } from '@/api/dealer'
  102. import { STable, VSelect } from '@/components'
  103. import subarea from '@/views/common/subarea.js'
  104. import merchantInfoManagementDetailModal from './detailModal.vue'
  105. import UpdateCooperate from './updateCooperate.vue'
  106. import UpdateDealerLeve from './updateDealerLevel.vue'
  107. export default {
  108. components: { STable, VSelect, merchantInfoManagementDetailModal, subarea, UpdateCooperate, UpdateDealerLeve },
  109. data () {
  110. return {
  111. advanced: false, // 高级搜索 展开/关闭
  112. tableHeight: 0,
  113. queryParam: { // 查询条件
  114. nameLike: '', // 商户名称、别名
  115. dealerType: undefined, // 商户类型
  116. subareaSn: undefined, // 区域
  117. auditState: undefined, // 审核状态
  118. cooperateFlag: undefined // 合作状态
  119. },
  120. disabled: false, // 查询、重置按钮是否可操作
  121. exportLoading: false, // 导出loading
  122. dateFormat: 'YYYY-MM-DD',
  123. total: 0,
  124. columns: [
  125. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  126. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  127. { title: '区域', scopedSlots: { customRender: 'area' }, width: 200, align: 'center' },
  128. { title: '商户名称', scopedSlots: { customRender: 'dealerName' }, align: 'center', ellipsis: true },
  129. { title: '商户别名', dataIndex: 'dealerAlias', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  130. { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '联系人', dataIndex: 'contact', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  133. { title: '联系电话', dataIndex: 'dealerTelephone', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  134. { title: '绑定手机号码', dataIndex: 'managerMobile', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '审核状态', dataIndex: 'auditStateDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  136. { title: '合作状态', dataIndex: 'cooperateFlagDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  137. { title: '生效时间', dataIndex: 'cooperateEffectiveTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  138. { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center', fixed: 'right' }
  139. ],
  140. loading: false,
  141. // 加载数据方法 必须为 Promise 对象
  142. loadData: parameter => {
  143. this.disabled = true
  144. if (this.tableHeight == 0) {
  145. this.tableHeight = window.innerHeight - 440
  146. }
  147. return dealerQueryList(Object.assign(parameter, this.queryParam)).then(res => {
  148. const data = res.data
  149. const no = (data.pageNo - 1) * data.pageSize
  150. this.total = data.count
  151. for (var i = 0; i < data.list.length; i++) {
  152. data.list[i].no = no + i + 1
  153. }
  154. this.disabled = false
  155. return data
  156. })
  157. },
  158. openModal: false, // 查看详情 弹框
  159. openUcModal: false, // 合作设置 弹框
  160. openUdModal: false, // 级别设置 弹框
  161. itemId: '', // 当前商户sn
  162. isAudit: false
  163. }
  164. },
  165. methods: {
  166. // 重置列表
  167. resetSearchForm () {
  168. this.queryParam = {
  169. nameLike: '', // 商户名称、别名
  170. dealerType: undefined, // 商户类型
  171. subareaSn: undefined, // 区域
  172. auditState: undefined, // 审核状态
  173. cooperateFlag: undefined // 合作状态
  174. }
  175. this.$refs.table.refresh(true)
  176. },
  177. // 刷新当前列表
  178. resetForm () {
  179. this.$refs.table.refresh()
  180. this.openModal = false
  181. this.isAudit = false
  182. this.openUcModal = false
  183. this.openUdModal = false
  184. },
  185. // 新增
  186. handleAdd () {
  187. this.$router.push({ name: `merchantInfoManagementAdd` })
  188. },
  189. // 编辑
  190. handleEdit (row) {
  191. this.$router.push({ name: `merchantInfoManagementEdit`, params: { id: row.dealerSn } })
  192. },
  193. // 合作设置
  194. handleCooperation (row) {
  195. this.openUcModal = true
  196. this.$refs.updateCooperate.setData(row)
  197. },
  198. // 价格级别
  199. handleLevel (row) {
  200. this.openUdModal = true
  201. this.$refs.updateDealerLevel.setData(row)
  202. },
  203. // 经销权
  204. handleDistribution (row) {
  205. this.$router.push({ name: `merchantInfoManagementSet`, params: { sn: row.dealerSn } })
  206. },
  207. // 审核
  208. handleAudit (row) {
  209. this.itemId = row.dealerSn
  210. this.openModal = true
  211. this.isAudit = true
  212. },
  213. // 详情
  214. handleDetail (row) {
  215. this.itemId = row.dealerSn
  216. this.openModal = true
  217. this.isAudit = false
  218. },
  219. // 关闭弹框
  220. closeModal () {
  221. this.itemId = ''
  222. this.openModal = false
  223. },
  224. // 导出
  225. handleExport () {
  226. const params = this.queryParam
  227. this.exportLoading = true
  228. dealerExport(params).then(res => {
  229. this.exportLoading = false
  230. this.download(res)
  231. })
  232. },
  233. download (data) {
  234. if (!data) { return }
  235. const url = window.URL.createObjectURL(new Blob([data]))
  236. const link = document.createElement('a')
  237. link.style.display = 'none'
  238. link.href = url
  239. const a = moment().format('YYYYMMDDHHmmss')
  240. const fname = '经销商资料' + a
  241. link.setAttribute('download', fname + '.xlsx')
  242. document.body.appendChild(link)
  243. link.click()
  244. }
  245. },
  246. beforeRouteEnter (to, from, next) {
  247. next(vm => {
  248. })
  249. }
  250. }
  251. </script>
  252. <style lang="less">
  253. .merchantInfoManagementList-wrap{
  254. .productPic{
  255. cursor: pointer;
  256. }
  257. }
  258. </style>