list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="经销商名称/商户别名">
  10. <a-input id="accountStatementBill-dealerName" v-model.trim="queryParam.nameLike" allowClear placeholder="请输入经销商名称/商户别名"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="区域">
  15. <subarea id="accountStatementBill-subarea" ref="subarea" @change="subareaChange"></subarea>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="商户级别">
  20. <v-select code="DEALER_LEVEL" id="accountStatementBill-dealerLevel" v-model="queryParam.dealerLevel" allowClear placeholder="请选择商户级别"></v-select>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="商户类型">
  25. <dealerType id="accountStatementBill-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="客服">
  30. <customerService ref="customerName" id="matchSendOutOrderList-bizUserSn" v-model="queryParam.bizUserSn"></customerService>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="财务编码">
  35. <a-input id="accountStatementBill-bookNo" v-model.trim="queryParam.kdMidCustomerFnumber" allowClear placeholder="请输入财务编码"/>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  39. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="accountStatementBill-refresh">查询</a-button>
  40. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="accountStatementBill-reset">重置</a-button>
  41. <a-button
  42. style="margin-left: 10px"
  43. type="primary"
  44. id="conFrontModal-export"
  45. class="button-warning"
  46. @click="handleExport"
  47. :disabled="disabled"
  48. :loading="exportLoading"
  49. >导出</a-button>
  50. </a-col>
  51. </a-row>
  52. </a-form>
  53. </div>
  54. </a-card>
  55. <a-card size="small" :bordered="false" class="accountStatementBill-wrap">
  56. <a-spin :spinning="spinning" tip="Loading...">
  57. <!-- 列表 -->
  58. <s-table
  59. class="sTable fixPagination"
  60. ref="table"
  61. :style="{ height: tableHeight+80+'px' }"
  62. size="small"
  63. :rowKey="(record) => record.id"
  64. :columns="columns"
  65. :data="loadData"
  66. :scroll="{ y: tableHeight }"
  67. :pageSize="30"
  68. :defaultLoadData="false"
  69. bordered>
  70. <template slot="totalAmount" slot-scope="text, record">
  71. <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="handleDetail(record)">{{ record.totalAmount }}</span>
  72. <span v-else>{{ record.totalAmount }}</span>
  73. </template>
  74. <template slot="dealerType" slot-scope="text, record">
  75. {{ record.dealerTypeName1 }}>{{ record.dealerTypeName2 }}
  76. </template>
  77. <!-- 操作 -->
  78. <template slot="action" slot-scope="text, record">
  79. <div>
  80. <a-button
  81. size="small"
  82. type="link"
  83. class="button-info"
  84. @click="handleAdd(record)"
  85. >
  86. 创建对账单
  87. </a-button>
  88. </div>
  89. </template>
  90. </s-table>
  91. </a-spin>
  92. </a-card>
  93. <baseModal v-drag ref="baseModal" :show="openModal" @cancel="openModal=false" @refashData="$refs.table.refresh()"></baseModal>
  94. </div>
  95. </template>
  96. <script>
  97. import { commonMixin } from '@/utils/mixin'
  98. import moment from 'moment'
  99. import { STable, VSelect } from '@/components'
  100. import { hdExportExcel } from '@/libs/exportExcel'
  101. import subarea from '@/views/common/subarea.js'
  102. import dealerType from '@/views/common/dealerType.js'
  103. import customerService from '@/views/common/customerService.vue'
  104. import baseModal from './baseModal.vue'
  105. import { verifyAccountBalanceQueryPage, verifyAccountBalanceExport } from '@/api/verifyAccountChange.js'
  106. export default {
  107. name: 'AccountStatementBillList',
  108. mixins: [commonMixin],
  109. components: { STable, VSelect, subarea, dealerType, customerService, baseModal },
  110. data () {
  111. return {
  112. spinning: false,
  113. exportLoading: false,
  114. tableHeight: 0,
  115. openModal: false,
  116. dealerType: [], // 商户类型
  117. queryParam: { // 查询条件
  118. nameLike: '', // 经销商名称/别名
  119. dealerType1: undefined, // 商户类型
  120. dealerType2: undefined, // 商户类型
  121. dealerLevel: null, // 商户级别
  122. subareaSn: undefined, // 区域
  123. subareaAreaSn: undefined, // 分区
  124. bizUserSn: undefined, // 客服
  125. kdMidCustomerFnumber: '' // 财务编码
  126. },
  127. disabled: false, // 查询、重置按钮是否可操作
  128. advanced: true,
  129. // 加载数据方法 必须为 Promise 对象
  130. loadData: parameter => {
  131. this.disabled = true
  132. this.spinning = true
  133. const params = Object.assign(parameter, this.queryParam)
  134. return verifyAccountBalanceQueryPage(params).then(res => {
  135. let data
  136. if (res.status == 200) {
  137. data = res.data
  138. const no = (data.pageNo - 1) * data.pageSize
  139. for (var i = 0; i < data.list.length; i++) {
  140. data.list[i].no = no + i + 1
  141. }
  142. this.total = data.count || 0
  143. this.disabled = false
  144. }
  145. this.spinning = false
  146. return data
  147. })
  148. },
  149. total: 0 // 合计
  150. }
  151. },
  152. // 根据权限显示列表字段
  153. computed: {
  154. columns () {
  155. const arr = [
  156. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  157. { title: '财务编码', dataIndex: 'kdMidCustomerFnumber', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  158. { title: '经销商名称', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  159. { title: '商户别名', dataIndex: 'dealerAlias', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  160. { title: '总余额', scopedSlots: { customRender: 'totalAmount' }, width: '6%', align: 'center' },
  161. { title: '待选余额', dataIndex: 'waitAmount', width: '6%', align: 'center', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  162. { title: '待选单数', dataIndex: 'waitCount', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '客服', dataIndex: 'auditDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  165. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  167. { title: '商户类型', scopedSlots: { customRender: 'dealerType' }, width: '15%', align: 'center' },
  168. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  169. ]
  170. return arr
  171. }
  172. },
  173. methods: {
  174. // 区域分区
  175. subareaChange (val) {
  176. this.queryParam.subareaSn = val[0] ? val[0] : undefined
  177. this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
  178. },
  179. // 商户类型 change
  180. getDealerType (v, o) {
  181. this.queryParam.dealerType1 = v[0]
  182. this.queryParam.dealerType2 = v[1]
  183. },
  184. // 重置
  185. resetSearchForm () {
  186. this.queryParam.beginDate = ''
  187. this.queryParam.endDate = ''
  188. this.queryParam.nameLike = ''
  189. this.queryParam.dealerType1 = undefined
  190. this.queryParam.dealerType2 = undefined
  191. this.queryParam.dealerLevel = undefined
  192. this.queryParam.subareaAreaSn = undefined
  193. this.queryParam.subareaSn = undefined
  194. this.queryParam.bizUserSn = undefined
  195. this.queryParam.kdMidCustomerFnumber = ''
  196. this.$refs.table.refresh(true)
  197. },
  198. // 导出
  199. handleExport () {
  200. const _this = this
  201. _this.exportLoading = true
  202. const timeStr = moment().format('YYYYMMDDHHmmss')
  203. hdExportExcel(verifyAccountBalanceExport, _this.queryParam, '经销商对账单据余额-' + timeStr, function () {
  204. _this.exportLoading = false
  205. })
  206. },
  207. // 新增
  208. handleAdd (row) {
  209. this.openModal = true
  210. this.$refs.baseModal.pageInit(row)
  211. },
  212. // 详情
  213. handleDetail (row) {
  214. this.$router.push({ name: 'accountStatementBillDetail', params: { sn: row.dealerSn, name: row.dealerName } })
  215. },
  216. pageInit () {
  217. const _this = this
  218. this.$nextTick(() => { // 页面渲染完成后的回调
  219. _this.setTableH()
  220. })
  221. },
  222. setTableH () {
  223. const tableSearchH = this.$refs.tableSearch.offsetHeight
  224. this.tableHeight = window.innerHeight - tableSearchH - 250
  225. }
  226. },
  227. watch: {
  228. advanced (newValue, oldValue) {
  229. const _this = this
  230. this.$nextTick(() => { // 页面渲染完成后的回调
  231. _this.setTableH()
  232. })
  233. },
  234. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  235. this.setTableH()
  236. }
  237. },
  238. mounted () {
  239. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  240. this.pageInit()
  241. this.resetSearchForm()
  242. }
  243. },
  244. activated () {
  245. // 如果是新页签打开,则重置当前页面
  246. if (this.$store.state.app.isNewTab) {
  247. this.pageInit()
  248. this.resetSearchForm()
  249. }
  250. // 仅刷新列表,不重置页面
  251. if (this.$store.state.app.updateList) {
  252. this.pageInit()
  253. this.$refs.table.refresh()
  254. }
  255. },
  256. beforeRouteEnter (to, from, next) {
  257. next(vm => {})
  258. }
  259. }
  260. </script>
  261. <style lang="less">
  262. .accountStatementBill-wrap{
  263. .active{
  264. color: #ed1c24;
  265. cursor: pointer;
  266. }
  267. .common{
  268. color: rgba(0, 0, 0);
  269. }
  270. }
  271. </style>