detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div class="accountStateBillDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="accountStateBillDetail-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="accountStateBillDetail-btn" href="javascript:;" @click="handleBack">
  7. <a-icon type="left" />
  8. 返回列表
  9. </a>
  10. <span style="margin: 0 10px;color: #666;">客户名称:{{ $route.params.name }}</span>
  11. </template>
  12. </a-page-header>
  13. <a-card size="small" :bordered="false" class="searchBoxNormal">
  14. <!-- 搜索条件 -->
  15. <div ref="tableSearch" class="table-page-search-wrapper">
  16. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  17. <a-row :gutter="15">
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="时间">
  20. <rangeDate id="accountStateBillDetail-rangeDate" ref="rangeDate" :value="creatDate" @change="dateChange" />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="业务单号">
  25. <a-input id="accountStateBillDetail-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入业务单号"/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="对账单号">
  30. <a-input id="accountStateBillDetail-verifyAccountBillNo" v-model.trim="queryParam.verifyAccountBillNo" allowClear placeholder="请输入对账单号"/>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="借贷类型">
  35. <v-select
  36. v-model="queryParam.changeType"
  37. ref="changeType"
  38. id="accountStateBillDetail-changeType"
  39. code="VERIFY_ACCOUNT_CHANGE_TYPE"
  40. placeholder="请选择借贷类型"
  41. allowClear></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="业务类型">
  46. <v-select
  47. v-model="queryParam.bizType"
  48. ref="bizType"
  49. id="accountStateBillDetail-bizType"
  50. code="VERIFY_ACCOUNT_BIZ_TYPE"
  51. placeholder="请选择业务类型"
  52. allowClear></v-select>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="6" :sm="24">
  56. <a-form-item label="待选状态">
  57. <a-select v-model="queryParam.waitSelect" allowClear placeholder="请选择待选状态" style="width: 100%" id="accountStateBillDetail-waitSelect">
  58. <a-select-option value="1">
  59. 待选
  60. </a-select-option>
  61. <a-select-option value="0">
  62. 已选
  63. </a-select-option>
  64. </a-select>
  65. </a-form-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-item label="对单状态">
  69. <v-select
  70. v-model="queryParam.billStatus"
  71. ref="billStatus"
  72. id="accountStatement-billStatus"
  73. code="VERIFY_ACCOUNT_STATUS"
  74. placeholder="请选择对单状态"
  75. allowClear></v-select>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="accountStateBillDetail-refresh">查询</a-button>
  80. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="accountStateBillDetail-reset">重置</a-button>
  81. <a-button
  82. style="margin-left: 10px"
  83. type="primary"
  84. v-if="$hasPermissions('B_asb_detail_export')"
  85. id="accountStateBillDetail-export"
  86. class="button-warning"
  87. @click="handleExport"
  88. :disabled="disabled"
  89. :loading="exportLoading"
  90. >导出</a-button>
  91. </a-col>
  92. </a-row>
  93. </a-form>
  94. </div>
  95. </a-card>
  96. <a-card size="small" :bordered="false">
  97. <a-alert type="info" style="margin-bottom:10px">
  98. <div slot="message">
  99. 余额:<strong>{{ totalData&&(totalData.bizAmount || totalData.bizAmount==0) ? toThousands(totalData.bizAmount) : '--' }}</strong>;
  100. 借方:<strong>{{ totalData&&(totalData.borrowAmount || totalData.borrowAmount==0) ? toThousands(totalData.borrowAmount) : '--' }}</strong>;
  101. 贷方:<strong>{{ totalData&&(totalData.loanAmount || totalData.loanAmount==0) ? toThousands(totalData.loanAmount*-1) : '--' }}</strong>;
  102. </div>
  103. </a-alert>
  104. <a-spin :spinning="spinning" tip="Loading...">
  105. <!-- 列表 -->
  106. <s-table
  107. class="sTable fixPagination"
  108. ref="table"
  109. :style="{ height: tableHeight+80+'px' }"
  110. size="small"
  111. :rowKey="(record) => record.id"
  112. :scroll="{ y: tableHeight }"
  113. :columns="columns"
  114. :data="loadData"
  115. :pageSize="20"
  116. :defaultLoadData="false"
  117. bordered>
  118. </s-table>
  119. </a-spin>
  120. </a-card>
  121. </div>
  122. </template>
  123. <script>
  124. import { commonMixin } from '@/utils/mixin'
  125. import { hdExportExcel } from '@/libs/exportExcel'
  126. import { STable, VSelect } from '@/components'
  127. import rangeDate from '@/views/common/rangeDate.vue'
  128. import {
  129. verifyAccountBalanceQueryDetailPage,
  130. verifyAccountBalanceQueryDetailCount,
  131. verifyAccountBalanceDetailExport
  132. } from '@/api/verifyAccountChange'
  133. export default {
  134. name: 'AccountStatementBillDetail',
  135. mixins: [commonMixin],
  136. components: { STable, VSelect, rangeDate },
  137. data () {
  138. return {
  139. spinning: false,
  140. exportLoading: false,
  141. tableHeight: 0,
  142. queryParam: { // 查询条件
  143. beginDate: '',
  144. endDate: '',
  145. bizNo: '',
  146. verifyAccountBillNo: '',
  147. changeType: undefined,
  148. bizType: undefined,
  149. waitSelect: undefined,
  150. billStatus: undefined
  151. },
  152. disabled: false, // 查询、重置按钮是否可操作
  153. creatDate: [], // 创建时间
  154. advanced: true,
  155. // 加载数据方法 必须为 Promise 对象
  156. loadData: parameter => {
  157. this.disabled = true
  158. this.spinning = true
  159. const params = {
  160. ...parameter,
  161. dealerSn: this.dealerSn,
  162. ...this.queryParam
  163. }
  164. return verifyAccountBalanceQueryDetailPage(params).then(res => {
  165. let data
  166. if (res.status == 200) {
  167. data = res.data
  168. const no = (data.pageNo - 1) * data.pageSize
  169. for (var i = 0; i < data.list.length; i++) {
  170. data.list[i].no = no + i + 1
  171. const dates = data.list[i].bizDate.split('-')
  172. data.list[i].year = dates[0]
  173. data.list[i].month = dates[1]
  174. data.list[i].day = dates[2].split(' ')[0]
  175. // 正为借方, 负数为贷方
  176. if (data.list[i].bizAmount > 0) {
  177. data.list[i].debitAmount = data.list[i].bizAmount
  178. } else {
  179. data.list[i].creditorAmount = data.list[i].bizAmount
  180. }
  181. }
  182. this.total = data.count || 0
  183. this.disabled = false
  184. }
  185. this.spinning = false
  186. this.getCount(params)
  187. return data
  188. })
  189. },
  190. total: 0, // 合计
  191. totalData: null,
  192. dealerSn: null
  193. }
  194. },
  195. // 根据权限显示列表字段
  196. computed: {
  197. columns () {
  198. const _this = this
  199. const arr = [
  200. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  201. { title: '年', dataIndex: 'year', width: '3%', align: 'center', customRender: function (text) { return text || '--' } },
  202. { title: '月', dataIndex: 'month', width: '3%', align: 'center', customRender: function (text) { return text || '--' } },
  203. { title: '日', dataIndex: 'day', width: '3%', align: 'center', customRender: function (text) { return text || '--' } },
  204. { title: '业务单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  205. { title: '对账单号', dataIndex: 'verifyAccountBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  206. { title: '业务类型', dataIndex: 'bizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  207. { title: '业务状态', dataIndex: 'bizStatusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  208. { title: '费用/调拨类型', dataIndex: 'expenseAllocateType', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  209. { title: '摘要', dataIndex: 'digestInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  210. { title: '客诉索赔编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
  211. { title: '借方', dataIndex: 'debitAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
  212. { title: '贷方', dataIndex: 'creditorAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
  213. { title: '备注', dataIndex: 'remarks', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  214. { title: '对单状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } }
  215. ]
  216. return arr
  217. }
  218. },
  219. methods: {
  220. // 返回列表
  221. handleBack () {
  222. this.$router.push({ name: `accountStatementBillList` })
  223. },
  224. // 创建时间 change
  225. dateChange (date) {
  226. this.queryParam.beginDate = date[0] ? date[0] : ''
  227. this.queryParam.endDate = date[1] ? date[1] : ''
  228. },
  229. // 导出
  230. handleExport () {
  231. const _this = this
  232. _this.exportLoading = true
  233. hdExportExcel(verifyAccountBalanceDetailExport, { dealerSn: this.dealerSn, ..._this.queryParam }, '(' + _this.$route.params.name + ')余额-', function () {
  234. _this.exportLoading = false
  235. })
  236. },
  237. // 统计
  238. getCount (params) {
  239. verifyAccountBalanceQueryDetailCount(params).then(res => {
  240. if (res.status == 200) {
  241. this.totalData = res.data
  242. }
  243. })
  244. },
  245. // 重置
  246. resetSearchForm () {
  247. this.creatDate = []
  248. this.$refs.rangeDate.resetDate(this.creatDate)
  249. this.queryParam.beginDate = ''
  250. this.queryParam.endDate = ''
  251. this.queryParam.bizNo = ''
  252. this.queryParam.verifyAccountBillNo = ''
  253. this.queryParam.changeType = undefined
  254. this.queryParam.bizType = undefined
  255. this.queryParam.waitSelect = undefined
  256. this.queryParam.billStatus = undefined
  257. this.$refs.table.refresh(true)
  258. },
  259. pageInit () {
  260. const _this = this
  261. this.dealerSn = this.$route.params.sn
  262. this.$nextTick(() => { // 页面渲染完成后的回调
  263. _this.setTableH()
  264. })
  265. },
  266. setTableH () {
  267. const tableSearchH = this.$refs.tableSearch.offsetHeight
  268. this.tableHeight = window.innerHeight - tableSearchH - 320
  269. }
  270. },
  271. watch: {
  272. advanced (newValue, oldValue) {
  273. const _this = this
  274. this.$nextTick(() => { // 页面渲染完成后的回调
  275. _this.setTableH()
  276. })
  277. },
  278. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  279. this.setTableH()
  280. }
  281. },
  282. mounted () {
  283. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  284. this.pageInit()
  285. this.resetSearchForm()
  286. }
  287. },
  288. activated () {
  289. // 如果是新页签打开,则重置当前页面
  290. if (this.$store.state.app.isNewTab) {
  291. this.pageInit()
  292. this.resetSearchForm()
  293. }
  294. // 仅刷新列表,不重置页面
  295. if (this.$store.state.app.updateList) {
  296. this.pageInit()
  297. this.$refs.table.refresh()
  298. }
  299. },
  300. beforeRouteEnter (to, from, next) {
  301. next(vm => {})
  302. }
  303. }
  304. </script>
  305. <style lang="less">
  306. .accountStateBillDetail-wrap{
  307. .accountStateBillDetail-back{
  308. padding-top: 10px;
  309. margin-bottom: 6px;
  310. }
  311. }
  312. </style>