list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <a-card size="small" :bordered="false" class="finacialPay-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 标签页 -->
  5. <a-tabs type="card" size="small" v-model="queryParam.bizType" @change="handleTabChange" class="finacialPay-tabs">
  6. <a-tab-pane v-for="item in tabPaneData" :key="item.bizType">
  7. <span slot="tab">{{ item.bizName }}({{ item.countNum }})</span>
  8. </a-tab-pane>
  9. </a-tabs>
  10. <!-- 搜索条件 -->
  11. <div ref="tableSearch" class="table-page-search-wrapper">
  12. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="付款单号"><a-input id="finacialPay-settleNo" v-model.trim="queryParam.settleNo" allowClear placeholder="请输入付款单号" /></a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="发货单号"><a-input id="finacialPay-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入发货单号" /></a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <a-form-item label="商户名称">
  22. <a-input id="finacialPay-settleClientName" v-model.trim="queryParam.settleClientName" allowClear placeholder="请输入商户名称" />
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="advanced">
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="单据状态">
  28. <v-select
  29. v-model="queryParam.billState"
  30. ref="settleState"
  31. id="finacialPay-settleState"
  32. code="SETTLE_PAY_STATUS"
  33. placeholder="请选择单据状态"
  34. allowClear></v-select>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="审核时间">
  39. <rangeDate ref="rangeDate" @change="dateChange" />
  40. </a-form-item>
  41. </a-col>
  42. </template>
  43. <a-col :md="6" :sm="24">
  44. <span class="table-page-search-submitButtons">
  45. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="finacialPay-refresh">查询</a-button>
  46. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="finacialPay-reset">重置</a-button>
  47. <a @click="advanced = !advanced" style="margin-left: 8px">
  48. {{ advanced ? '收起' : '展开' }}
  49. <a-icon :type="advanced ? 'up' : 'down'" />
  50. </a>
  51. </span>
  52. </a-col>
  53. </a-row>
  54. </a-form>
  55. </div>
  56. <!-- alert -->
  57. <a-alert type="info" style="margin-bottom:10px">
  58. <div slot="message">
  59. <strong>{{ totalData&&(totalData.count || totalData.count==0) ? totalData.count : '--' }}</strong>
  60. 条记录,应付金额合计
  61. <strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? '¥'+totalData.totalAmount : '--' }}</strong>
  62. ,其中已付金额
  63. <strong>{{ totalData&&(totalData.settledAmount || totalData.settledAmount==0) ? '¥'+totalData.settledAmount : '--' }}</strong>
  64. ,待付金额
  65. <strong>{{ totalData&&(totalData.unsettleAmount || totalData.unsettleAmount==0) ? '¥'+totalData.unsettleAmount : '--' }}</strong>
  66. </div>
  67. </a-alert>
  68. <div v-if="$hasPermissions('B_financialPaymentPl')" style="margin-bottom: 10px">
  69. <a-button type="primary" id="finacialPay-export" :loading="loading" @click="handlePayment">批量付款</a-button>
  70. <span style="margin-left: 8px" v-if="$hasPermissions('B_financialPaymentPl')">
  71. <template v-if="hasSelected">
  72. {{ `已选 ${selectedRowKeys.length} 项` }}
  73. </template>
  74. </span>
  75. </div>
  76. <!-- 列表 -->
  77. <s-table
  78. class="sTable fixPagination"
  79. ref="table"
  80. :style="{ height: tableHeight+84.5+'px' }"
  81. size="small"
  82. :row-selection="$hasPermissions('B_financialPaymentPl') ? rowSelection : null"
  83. :rowKey="record => record.id"
  84. :columns="columns"
  85. :data="loadData"
  86. :scroll="{ y: tableHeight }"
  87. :defaultLoadData="false"
  88. bordered
  89. >
  90. <!-- 操作 -->
  91. <template slot="action" slot-scope="text, record">
  92. <a-button
  93. size="small"
  94. type="link"
  95. class="button-info"
  96. v-if="record.settleState == 'SETTLED' && $hasPermissions('B_financialPaymentDetail')"
  97. @click="handleVoucher(record)"
  98. id="finacialPay-voucher-btn">凭证</a-button>
  99. <a-button
  100. size="small"
  101. type="link"
  102. class="button-warning"
  103. :loading="loading"
  104. v-else-if="record.settleState != 'SETTLED' && $hasPermissions('B_financialPaymentSing')"
  105. @click="handlePay(record)"
  106. id="finacialPay-pay-btn">付款</a-button>
  107. <span v-else>--</span>
  108. </template>
  109. </s-table>
  110. </a-spin>
  111. <!-- 详情 -->
  112. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  113. </a-card>
  114. </template>
  115. <script>
  116. import { STable, VSelect } from '@/components'
  117. import detailModal from './detailModal.vue'
  118. import { settlePayQuery, queryByTypeSum, settlePayMoney, settlePayQuerySum } from '@/api/settlePay.js'
  119. import rangeDate from '@/views/common/rangeDate.vue'
  120. export default {
  121. components: { STable, VSelect, detailModal, rangeDate },
  122. data () {
  123. return {
  124. spinning: false,
  125. advanced: true, // 高级搜索 展开/关闭
  126. disabled: false, // 查询、重置按钮是否可操作
  127. openModal: false, // 详情弹框
  128. tableHeight: 0,
  129. curBizType: 'ALL',
  130. // 查询参数
  131. queryParam: {
  132. bizType: 'ALL',
  133. settleNo: '',
  134. bizNo: '',
  135. settleClientName: '',
  136. billState: '',
  137. auditBeginDate: '',
  138. auditEndDate: ''
  139. },
  140. // 总计
  141. totalData: {
  142. settledAmount: 0,
  143. totalAmount: 0,
  144. unsettleAmount: 0,
  145. count: 0
  146. },
  147. // 表头
  148. columns: [
  149. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  150. { title: '付款单号', dataIndex: 'settleNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '发货单号', dataIndex: 'bizNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  152. { title: '商户名称', dataIndex: 'settleClientName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  153. { title: '应付金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  154. { title: '已付金额', dataIndex: 'settledAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  155. { title: '待付金额', dataIndex: 'unsettleAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  156. { title: '单据类型', dataIndex: 'bizName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '付款方式', dataIndex: 'settleStyleName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  158. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  159. { title: '付款时间', dataIndex: 'settleTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
  161. ],
  162. selectedRowKeys: [], // Check here to configure the default column
  163. selectedRows: [],
  164. loading: false,
  165. // 加载数据方法 必须为 Promise 对象
  166. loadData: parameter => {
  167. this.disabled = true
  168. this.spinning = true
  169. return settlePayQuery(Object.assign(parameter, this.queryParam)).then(res => {
  170. let data
  171. if (res.status == 200) {
  172. data = res.data
  173. const no = (data.pageNo - 1) * data.pageSize
  174. for (var i = 0; i < data.list.length; i++) {
  175. data.list[i].no = no + i + 1
  176. }
  177. this.disabled = false
  178. this.totalData.count = data.count || 0
  179. // 查询总计
  180. this.settlePayQuerySum(Object.assign(parameter, this.queryParam))
  181. }
  182. this.spinning = false
  183. return data
  184. })
  185. },
  186. tabPaneData: []
  187. }
  188. },
  189. computed: {
  190. hasSelected () {
  191. return this.selectedRowKeys.length > 0
  192. },
  193. rowSelection () {
  194. if (this.$hasPermissions('B_financialPaymentPl')) {
  195. return {
  196. selectedRowKeys: this.selectedRowKeys,
  197. onChange: (selectedRowKeys, selectedRows) => {
  198. this.selectedRowKeys = selectedRowKeys
  199. },
  200. onSelect: (record, selected, selectedRows, nativeEvent) => {
  201. this.onSelectChange(record, selected, selectedRows, nativeEvent)
  202. },
  203. onSelectAll: (selected, selectedRows, changeRows) => {
  204. this.onSelectAllChange(selected, selectedRows, changeRows)
  205. },
  206. getCheckboxProps: record => ({
  207. props: {
  208. disabled: record.settleState == 'SETTLED'
  209. }
  210. })
  211. }
  212. } else {
  213. return null
  214. }
  215. }
  216. },
  217. methods: {
  218. // 时间 change
  219. dateChange (date) {
  220. this.queryParam.auditBeginDate = date[0]
  221. this.queryParam.auditEndDate = date[1]
  222. },
  223. // 总计
  224. settlePayQuerySum (params) {
  225. settlePayQuerySum(params).then(res => {
  226. if (res.status == 200) {
  227. this.totalData = Object.assign(this.totalData, res.data)
  228. }
  229. })
  230. },
  231. // 获取类型
  232. queryByTypeSum () {
  233. queryByTypeSum({}).then(res => {
  234. if (res.data && res.status == 200) {
  235. this.tabPaneData = res.data
  236. if (this.$route.query.pageParams) {
  237. this.queryParam.bizType = JSON.parse(this.$route.query.pageParams).bizType
  238. } else {
  239. this.queryParam.bizType = res.data[0].bizType
  240. }
  241. this.$refs.table.refresh(true)
  242. }
  243. })
  244. },
  245. // 凭证弹框
  246. handleVoucher (row) {
  247. this.$refs.detailModal.getDetail(row.id)
  248. this.openModal = true
  249. },
  250. // 付款
  251. handlePay (row) {
  252. this.loading = true
  253. this.spinning = true
  254. settlePayMoney([row.id]).then(res => {
  255. this.loading = false
  256. if (res.status == 200) {
  257. this.$message.success(res.message)
  258. this.selectedRowKeys = []
  259. this.$refs.table.refresh()
  260. this.spinning = false
  261. } else {
  262. this.spinning = false
  263. }
  264. })
  265. },
  266. // 选择类型
  267. handleTabChange (key) {
  268. this.queryParam.bizType = key
  269. this.$refs.table.refresh(true)
  270. this.curBizType = key
  271. },
  272. // 批量付款
  273. handlePayment () {
  274. if (this.selectedRowKeys.length < 1) {
  275. this.$message.warning('请在列表勾选后再进行批量操作!')
  276. return
  277. }
  278. this.loading = true
  279. this.spinning = true
  280. settlePayMoney(this.selectedRowKeys).then(res => {
  281. this.loading = false
  282. if (res.status == 200) {
  283. this.$message.success(res.message)
  284. this.selectedRowKeys = []
  285. this.$refs.table.refresh()
  286. this.spinning = false
  287. } else {
  288. this.spinning = false
  289. }
  290. })
  291. },
  292. // 重置
  293. resetSearchForm () {
  294. this.resetData()
  295. this.$refs.table.refresh(true)
  296. },
  297. // 重置数据
  298. resetData () {
  299. if (this.advanced) {
  300. this.$refs.rangeDate.resetDate()
  301. }
  302. this.queryParam = {
  303. bizType: this.curBizType,
  304. settleNo: '',
  305. bizNo: '',
  306. settleClientName: '',
  307. billState: '',
  308. auditBeginDate: '',
  309. auditEndDate: ''
  310. }
  311. },
  312. onSelectChange (record, selected, selectedRows, nativeEvent) {
  313. if (selected) { // 选择
  314. this.selectedRows.push(record)
  315. } else { // 取消
  316. this.selectedRows = selectedRows
  317. }
  318. },
  319. // 本页全选/取消全选
  320. onSelectAllChange (selected, selectedRows, changeRows) {
  321. const _this = this
  322. if (selected) { // 选择
  323. this.selectedRows = [...this.selectedRows, ...changeRows]
  324. } else { // 取消
  325. const arrId = []
  326. this.selectedRows.map((item, index) => {
  327. this.selectedRows.map((subItem, ind) => {
  328. if (item.id == subItem.id) {
  329. arrId.push(index)
  330. }
  331. })
  332. })
  333. arrId.map((item, index) => {
  334. _this.selectedRows = _this.selectedRows.slice(item, item + 1)
  335. })
  336. }
  337. },
  338. pageInit () {
  339. const _this = this
  340. this.$nextTick(() => { // 页面渲染完成后的回调
  341. _this.setTableH()
  342. })
  343. this.queryByTypeSum()
  344. },
  345. setTableH () {
  346. const tableSearchH = this.$refs.tableSearch.offsetHeight
  347. this.tableHeight = window.innerHeight - tableSearchH - 330
  348. }
  349. },
  350. watch: {
  351. advanced (newValue, oldValue) {
  352. const _this = this
  353. setTimeout(() => {
  354. _this.setTableH()
  355. }, 400)
  356. },
  357. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  358. this.setTableH()
  359. }
  360. },
  361. mounted () {
  362. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  363. this.resetData()
  364. this.pageInit()
  365. }
  366. },
  367. activated () {
  368. // 如果是新页签打开,则重置当前页面
  369. if (this.$store.state.app.isNewTab) {
  370. this.resetData()
  371. if (this.$route.query.pageParams) {
  372. this.queryParam.bizType = JSON.parse(this.$route.query.pageParams).bizType
  373. this.queryParam.billState = JSON.parse(this.$route.query.pageParams).billState
  374. }
  375. this.pageInit()
  376. }
  377. },
  378. beforeRouteEnter (to, from, next) {
  379. next(vm => {})
  380. }
  381. }
  382. </script>
  383. <style lang="less">
  384. .finacialPay-wrap{
  385. .finacialPay-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  386. height: 30px!important;
  387. }
  388. .finacialPay-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  389. height: 30px!important;
  390. }
  391. .finacialPay-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  392. line-height: 26px!important;
  393. height: 30px!important;
  394. }
  395. }
  396. </style>