list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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 { STable, VSelect } from '@/components'
  99. import { hdExportExcel } from '@/libs/exportExcel'
  100. import subarea from '@/views/common/subarea.js'
  101. import dealerType from '@/views/common/dealerType.js'
  102. import customerService from '@/views/common/customerService.vue'
  103. import baseModal from './baseModal.vue'
  104. import { verifyAccountBalanceQueryPage, verifyAccountBalanceExport } from '@/api/verifyAccountChange.js'
  105. export default {
  106. name: 'AccountStatementBillList',
  107. mixins: [commonMixin],
  108. components: { STable, VSelect, subarea, dealerType, customerService, baseModal },
  109. data () {
  110. return {
  111. spinning: false,
  112. exportLoading: false,
  113. tableHeight: 0,
  114. openModal: false,
  115. dealerType: [], // 商户类型
  116. queryParam: { // 查询条件
  117. nameLike: '', // 经销商名称/别名
  118. dealerType1: undefined, // 商户类型
  119. dealerType2: undefined, // 商户类型
  120. dealerLevel: null, // 商户级别
  121. subareaSn: undefined, // 区域
  122. subareaAreaSn: undefined, // 分区
  123. bizUserSn: undefined, // 客服
  124. kdMidCustomerFnumber: '' // 财务编码
  125. },
  126. disabled: false, // 查询、重置按钮是否可操作
  127. advanced: true,
  128. // 加载数据方法 必须为 Promise 对象
  129. loadData: parameter => {
  130. this.disabled = true
  131. this.spinning = true
  132. const params = Object.assign(parameter, this.queryParam)
  133. return verifyAccountBalanceQueryPage(params).then(res => {
  134. let data
  135. if (res.status == 200) {
  136. data = res.data
  137. const no = (data.pageNo - 1) * data.pageSize
  138. for (var i = 0; i < data.list.length; i++) {
  139. data.list[i].no = no + i + 1
  140. }
  141. this.total = data.count || 0
  142. this.disabled = false
  143. }
  144. this.spinning = false
  145. return data
  146. })
  147. },
  148. total: 0 // 合计
  149. }
  150. },
  151. // 根据权限显示列表字段
  152. computed: {
  153. columns () {
  154. const arr = [
  155. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  156. { title: '财务编码', dataIndex: 'kdMidCustomerFnumber', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '经销商名称', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  158. { title: '商户别名', dataIndex: 'dealerAlias', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  159. { title: '总余额', scopedSlots: { customRender: 'totalAmount' }, width: '6%', align: 'center' },
  160. { title: '待选余额', dataIndex: 'waitAmount', width: '6%', align: 'center', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  161. { title: '待选单数', dataIndex: 'waitCount', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '客服', dataIndex: 'auditDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  165. { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '商户类型', scopedSlots: { customRender: 'dealerType' }, width: '15%', align: 'center' },
  167. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  168. ]
  169. return arr
  170. }
  171. },
  172. methods: {
  173. // 区域分区
  174. subareaChange (val) {
  175. this.queryParam.subareaSn = val[0] ? val[0] : undefined
  176. this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
  177. },
  178. // 商户类型 change
  179. getDealerType (v, o) {
  180. this.queryParam.dealerType1 = v[0]
  181. this.queryParam.dealerType2 = v[1]
  182. },
  183. // 重置
  184. resetSearchForm () {
  185. this.queryParam.beginDate = ''
  186. this.queryParam.endDate = ''
  187. this.queryParam.nameLike = ''
  188. this.queryParam.dealerType1 = undefined
  189. this.queryParam.dealerType2 = undefined
  190. this.queryParam.dealerLevel = undefined
  191. this.queryParam.subareaAreaSn = undefined
  192. this.queryParam.subareaSn = undefined
  193. this.queryParam.bizUserSn = undefined
  194. this.queryParam.kdMidCustomerFnumber = ''
  195. this.$refs.table.refresh(true)
  196. },
  197. // 导出
  198. handleExport () {
  199. const _this = this
  200. _this.exportLoading = true
  201. hdExportExcel(verifyAccountBalanceExport, _this.queryParam, '经销商对账单据余额-', function () {
  202. _this.exportLoading = false
  203. })
  204. },
  205. // 新增
  206. handleAdd (row) {
  207. this.openModal = true
  208. this.$refs.baseModal.pageInit(row)
  209. },
  210. // 详情
  211. handleDetail (row) {
  212. this.$router.push({ name: 'accountStatementBillDetail', params: { sn: row.dealerSn, name: row.dealerName } })
  213. },
  214. pageInit () {
  215. const _this = this
  216. this.$nextTick(() => { // 页面渲染完成后的回调
  217. _this.setTableH()
  218. })
  219. },
  220. setTableH () {
  221. const tableSearchH = this.$refs.tableSearch.offsetHeight
  222. this.tableHeight = window.innerHeight - tableSearchH - 250
  223. }
  224. },
  225. watch: {
  226. advanced (newValue, oldValue) {
  227. const _this = this
  228. this.$nextTick(() => { // 页面渲染完成后的回调
  229. _this.setTableH()
  230. })
  231. },
  232. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  233. this.setTableH()
  234. }
  235. },
  236. mounted () {
  237. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  238. this.pageInit()
  239. this.resetSearchForm()
  240. }
  241. },
  242. activated () {
  243. // 如果是新页签打开,则重置当前页面
  244. if (this.$store.state.app.isNewTab) {
  245. this.pageInit()
  246. this.resetSearchForm()
  247. }
  248. // 仅刷新列表,不重置页面
  249. if (this.$store.state.app.updateList) {
  250. this.pageInit()
  251. this.$refs.table.refresh()
  252. }
  253. },
  254. beforeRouteEnter (to, from, next) {
  255. next(vm => {})
  256. }
  257. }
  258. </script>
  259. <style lang="less">
  260. .accountStatementBill-wrap{
  261. .active{
  262. color: #ed1c24;
  263. cursor: pointer;
  264. }
  265. .common{
  266. color: rgba(0, 0, 0);
  267. }
  268. }
  269. </style>