list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <a-card size="small" :bordered="false" class="financialCollectionList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 标签页 -->
  5. <a-tabs type="card" v-model="queryParam.bizType" @change="handleTabChange" class="financialCollectionList-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="searchForm">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="收款单号"><a-input id="financialCollectionList-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="financialCollectionList-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="financialCollectionList-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="financialCollectionList-settleState"
  32. code="SETTLE_RECEIVE_STATUS"
  33. placeholder="请选择单据状态"
  34. allowClear
  35. ></v-select>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="创建时间">
  40. <rangeDate ref="createDate" @change="createDateChange" />
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24">
  44. <a-form-item label="审核时间">
  45. <rangeDate ref="rangeDate" @change="dateChange" />
  46. </a-form-item>
  47. </a-col>
  48. </template>
  49. <a-col :md="6" :sm="24">
  50. <span class="table-page-search-submitButtons">
  51. <a-button type="primary" @click="searchForm()" :disabled="disabled" id="financialCollectionList-refresh">查询</a-button>
  52. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="financialCollectionList-reset">重置</a-button>
  53. <a @click="advanced = !advanced" style="margin-left: 5px">
  54. {{ advanced ? '收起' : '展开' }}
  55. <a-icon :type="advanced ? 'up' : 'down'" />
  56. </a>
  57. </span>
  58. </a-col>
  59. </a-row>
  60. </a-form>
  61. </div>
  62. <!-- alert -->
  63. <a-alert type="info" style="margin-bottom:10px">
  64. <div slot="message">
  65. <strong>{{ totalData&&(totalData.count || totalData.count==0) ? totalData.count : '--' }}</strong>
  66. 条记录,应收金额合计
  67. <strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? '¥'+totalData.totalAmount : '--' }}</strong>
  68. ,其中已收金额
  69. <strong>{{ totalData&&(totalData.settledAmount || totalData.settledAmount==0) ? '¥'+totalData.settledAmount : '--' }}</strong>
  70. ,待收金额
  71. <strong>{{ totalData&&(totalData.unsettleAmount || totalData.unsettleAmount==0) ? '¥'+totalData.unsettleAmount : '--' }}</strong>
  72. </div>
  73. </a-alert>
  74. <div v-if="$hasPermissions('B_financialCollectionPl')" style="margin-bottom: 10px">
  75. <a-button type="primary" id="financialCollectionList-export" :loading="loading" @click="enableFundAccount ? handleSettleAcountPay(null,1) : handleCollection()">批量收款</a-button>
  76. <span style="margin-left: 8px" v-if="$hasPermissions('B_financialCollectionPl')">
  77. <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  78. <template v-if="selectTotalAmount">,合计¥{{ selectTotalAmount }}</template>
  79. </span>
  80. </div>
  81. <!-- 列表 -->
  82. <s-table
  83. class="sTable fixPagination"
  84. ref="table"
  85. :style="{ height: tableHeight+84.5+'px' }"
  86. size="small"
  87. :rowKey="record => record.id"
  88. :row-selection="$hasPermissions('B_financialCollectionPl') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.settleState == 'SETTLED' } }) } : null"
  89. @rowSelection="rowSelectionFun"
  90. :columns="columns"
  91. :data="loadData"
  92. :scroll="{ y: tableHeight }"
  93. :defaultLoadData="false"
  94. bordered
  95. >
  96. <!-- 关联单号 -->
  97. <template slot="bizNo" slot-scope="text, record">
  98. <span class="table-td-link" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record)">{{ record.bizNo }}</span>
  99. </template>
  100. <!-- 操作 -->
  101. <template slot="action" slot-scope="text, record">
  102. <a-button
  103. size="small"
  104. type="link"
  105. class="button-primary"
  106. v-if="record.settleState == 'SETTLED' && $hasPermissions('B_financialCollectionDetail')"
  107. @click="handleVoucher(record)"
  108. id="financialCollectionList-voucher-btn">凭证</a-button>
  109. <a-button
  110. size="small"
  111. type="link"
  112. :loading="loading"
  113. class="button-error"
  114. v-if="(record.settleState == 'UNSETTLE' || record.settleState == 'PART_SETTLED')&&record.satelliteFlag!=1 && $hasPermissions('B_financialCollectionSing')"
  115. @click="enableFundAccount ? handleSettleAcountPay(record,0) : handleCollectionSing(record)"
  116. id="financialCollectionList-pay-btn">收款</a-button>
  117. <span v-if="!(record.settleState == 'SETTLED' && $hasPermissions('B_financialCollectionDetail')) && !((record.settleState == 'UNSETTLE' || record.settleState == 'PART_SETTLED')&&record.satelliteFlag!=1 && $hasPermissions('B_financialCollectionSing'))">--</span>
  118. <!-- satelliteFlag为1,是卫星仓 -->
  119. </template>
  120. </s-table>
  121. </a-spin>
  122. <!-- 详情 -->
  123. <detail-modal :openModal="openModal" ref="detailModal" @close="openModal = false" />
  124. <!-- 关联单号详情 -->
  125. <a-modal
  126. centered
  127. class="outboundOrderDetail-modal"
  128. :footer="null"
  129. :maskClosable="false"
  130. :bodyStyle="{padding:'12px'}"
  131. :title="curBizTitle"
  132. v-model="openDetailModal"
  133. v-if="openDetailModal&&fcBizType!='SPARE_PARTS_RETURN'"
  134. @cancel="handleDetailClose"
  135. width="80%">
  136. <div style="max-height: 700px;overflow-y: auto;">
  137. <!-- 销售单 -->
  138. <salesDetailModal v-if="fcBizType=='SELL'" :outBizSn="orderSn" />
  139. <!-- 采购退货 -->
  140. <pushOrderDetailModal v-if="fcBizType=='PURCHASE_RETURN'&&!$hasPermissions('M_purchaseReturn_outSnycList')" :outBizSn="orderSn" />
  141. <pushOrderOutSyncDetailModal v-if="fcBizType=='PURCHASE_RETURN'&&$hasPermissions('M_purchaseReturn_outSnycList')" :outBizSn="orderSn"></pushOrderOutSyncDetailModal>
  142. <!-- 店内调出 -->
  143. <storeTransferOutDetailModal v-if="fcBizType=='STORE_CALL_OUT'" :outBizSn="orderSn"></storeTransferOutDetailModal>
  144. <!-- 连锁调出 -->
  145. <chainTransferOutDetailModal v-if="fcBizType=='LINKAGE_CALL_OUT'" :outBizSn="orderSn" />
  146. </div>
  147. </a-modal>
  148. <!-- 散件退货 -->
  149. <bulkReturnGoods-detail-modal :openModal="openBulkReturnDetailModal" :itemSn="orderSn" @close="handleDetailClose" />
  150. <!-- 收付款弹框 -->
  151. <settleModal ref="settleModal" @ok="settleAcountPay" :openModal="openSettleModal" @close="openSettleModal=false"></settleModal>
  152. </a-card>
  153. </template>
  154. <script>
  155. import { commonMixin } from '@/utils/mixin'
  156. import { mapActions } from 'vuex'
  157. import { STable, VSelect } from '@/components'
  158. import detailModal from './detailModal.vue'
  159. import settleModal from '../settleModal/settleModal.vue'
  160. import rangeDate from '@/views/common/rangeDate.vue'
  161. import salesDetailModal from '@/views/salesManagement/salesQuery/detail.vue'
  162. // 同步采购退货单详情
  163. import pushOrderDetailModal from '@/views/purchasingManagement/purchaseReturn/detail.vue'
  164. // 不同步采购退货单
  165. import pushOrderOutSyncDetailModal from '@/views/purchasingManagement/purchaseReturnOutSync/detail.vue'
  166. import chainTransferOutDetailModal from '@/views/allocationManagement/chainTransferOut/detail.vue'
  167. import storeTransferOutDetailModal from '@/views/allocationManagement/storeTransferOut/detail.vue'
  168. import bulkReturnGoodsDetailModal from '@/views/bulkManagement/bulkReturnGoods/detailModal.vue'
  169. import { settleReceiptQuery, queryByTypeSum, settleReceiptMoney, settleReceiptQuerySum } from '@/api/settleReceipt'
  170. export default {
  171. name: 'FinancialCollectionList',
  172. components: { STable, VSelect, detailModal, rangeDate, settleModal, pushOrderDetailModal, pushOrderOutSyncDetailModal, salesDetailModal, chainTransferOutDetailModal, bulkReturnGoodsDetailModal, storeTransferOutDetailModal },
  173. mixins: [commonMixin],
  174. data () {
  175. return {
  176. spinning: false,
  177. advanced: true, // 高级搜索 展开/关闭
  178. disabled: false, // 查询、重置按钮是否可操作
  179. openModal: false, // 详情弹框
  180. openDetailModal: false,
  181. openSettleModal: false, // 打开收款弹框
  182. openBulkReturnDetailModal: false,
  183. enableFundAccount: false, // 是否开启资金账户管理
  184. tableHeight: 0,
  185. curBizType: 'ALL',
  186. curBizTitle: '',
  187. fcBizType: '',
  188. orderSn: null,
  189. // 查询参数
  190. queryParam: {
  191. bizType: 'ALL',
  192. settleNo: '',
  193. bizNo: '',
  194. settleClientName: '',
  195. billState: '',
  196. auditBeginDate: '',
  197. auditEndDate: ''
  198. },
  199. // 总计
  200. totalData: {
  201. settledAmount: 0,
  202. totalAmount: 0,
  203. unsettleAmount: 0,
  204. count: 0
  205. },
  206. // 表头
  207. columns: [
  208. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  209. { title: '收款单号', dataIndex: 'settleNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  210. { title: '关联单号', dataIndex: 'bizNo', scopedSlots: { customRender: 'bizNo' }, width: '16%', align: 'center' },
  211. { title: '商户名称', dataIndex: 'settleClientName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  212. { title: '应收金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  213. { title: '已收金额', dataIndex: 'settledAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  214. { title: '待收金额', dataIndex: 'unsettleAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  215. { title: '收款类型', dataIndex: 'bizName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  216. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  217. // { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  218. { title: '审核时间', dataIndex: 'auditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  219. { title: '收款时间', dataIndex: 'settleTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  220. { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
  221. ],
  222. loading: false,
  223. // 加载数据方法 必须为 Promise 对象
  224. loadData: parameter => {
  225. this.disabled = true
  226. this.spinning = true
  227. return settleReceiptQuery(Object.assign(parameter, this.queryParam)).then(res => {
  228. let data
  229. if (res.status == 200) {
  230. data = res.data
  231. const no = (data.pageNo - 1) * data.pageSize
  232. for (var i = 0; i < data.list.length; i++) {
  233. data.list[i].no = no + i + 1
  234. }
  235. this.disabled = false
  236. this.totalData.count = data.count || 0
  237. // 查询总计
  238. this.settleReceiptQuerySum(Object.assign(parameter, this.queryParam))
  239. }
  240. this.spinning = false
  241. return data
  242. })
  243. },
  244. tabPaneData: [],
  245. rowSelectionInfo: null
  246. }
  247. },
  248. computed: {
  249. selectTotalAmount () {
  250. let ret = 0
  251. if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) {
  252. this.rowSelectionInfo.selectedRows.map(item => {
  253. ret = ret + item.unsettleAmount
  254. })
  255. }
  256. return ret
  257. }
  258. },
  259. methods: {
  260. ...mapActions(['GetSettleAccountState']),
  261. handleDetailClose () {
  262. this.openDetailModal = false
  263. this.openBulkReturnDetailModal = false
  264. this.orderSn = null
  265. },
  266. // 查看关联单号
  267. handleDetail (row) {
  268. console.log(row)
  269. this.orderSn = row.bizSn
  270. this.fcBizType = row.bizType
  271. this.curBizTitle = row.bizTypeDictValue + '详情'
  272. if (row.bizType == 'SPARE_PARTS_RETURN') {
  273. this.openBulkReturnDetailModal = true
  274. } else {
  275. this.openDetailModal = true
  276. }
  277. },
  278. // 表格选中项
  279. rowSelectionFun (obj) {
  280. this.rowSelectionInfo = obj || null
  281. },
  282. // 时间 change
  283. dateChange (date) {
  284. this.queryParam.auditBeginDate = date[0]
  285. this.queryParam.auditEndDate = date[1]
  286. },
  287. createDateChange (date) {
  288. this.queryParam.beginDate = date[0]
  289. this.queryParam.endDate = date[1]
  290. },
  291. // 总计
  292. settleReceiptQuerySum (params) {
  293. settleReceiptQuerySum(params).then(res => {
  294. if (res.status == 200) {
  295. this.totalData = Object.assign(this.totalData, res.data)
  296. const tab = this.tabPaneData.find(item => item.bizType == this.queryParam.bizType)
  297. tab.countNum = this.totalData.count || 0
  298. }
  299. })
  300. },
  301. // 获取类型
  302. queryByTypeSum () {
  303. queryByTypeSum({}).then(res => {
  304. if (res.data && res.status == 200) {
  305. this.tabPaneData = res.data
  306. if (this.curBizType == 'ALL') {
  307. this.queryParam.bizType = res.data[0].bizType
  308. }
  309. this.$refs.table.refresh(true)
  310. }
  311. })
  312. },
  313. // 凭证弹框
  314. handleVoucher (row) {
  315. this.$refs.detailModal.getDetail(row.id)
  316. this.openModal = true
  317. },
  318. // 开启结算账户功能收款, type:0 单条收款,1 批量收款
  319. handleSettleAcountPay (row, type) {
  320. this.openSettleModal = true
  321. const data = {
  322. totalAmount: type ? this.selectTotalAmount : row && row.unsettleAmount || 0,
  323. settleClientName: type ? '' : row && row.settleClientName || '',
  324. title: '收款',
  325. type,
  326. row
  327. }
  328. this.$nextTick(() => {
  329. this.$refs.settleModal.setData(data)
  330. })
  331. },
  332. // 去收款
  333. settleAcountPay (form, data) {
  334. const _this = this
  335. const params =
  336. {
  337. 'settleIds': data.type ? _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys : [data.row.id]
  338. }
  339. // 资金管理开启
  340. if (this.enableFundAccount) {
  341. params.settleStyleSn = form.settleStyleSn
  342. params.settleAccountSn = form.settleAccountSn
  343. }
  344. _this.loading = true
  345. _this.spinning = true
  346. settleReceiptMoney(params).then(res => {
  347. _this.loading = false
  348. if (res.status == 200) {
  349. _this.$message.success(res.message)
  350. _this.$refs.table.refresh()
  351. _this.$refs.table.clearSelected() // 清空表格选中项
  352. _this.spinning = false
  353. } else {
  354. _this.spinning = false
  355. }
  356. })
  357. },
  358. // 收款
  359. handleCollectionSing (row) {
  360. const _this = this
  361. this.$confirm({
  362. title: '提示',
  363. content: '确认收款吗?',
  364. centered: true,
  365. closable: true,
  366. onOk () {
  367. _this.settleAcountPay(null, { type: 0, row: row })
  368. }
  369. })
  370. },
  371. // 选择类型
  372. handleTabChange (key) {
  373. this.queryParam.bizType = key
  374. this.$refs.table.refresh(true)
  375. this.curBizType = key
  376. },
  377. // 批量收款
  378. handleCollection () {
  379. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  380. this.$message.warning('请在列表勾选后再进行批量操作!')
  381. return
  382. }
  383. const _this = this
  384. this.$confirm({
  385. title: '提示',
  386. content: <div><p style="margin-top:20px;">合计金额¥{ this.selectTotalAmount } </p><p>确认批量收款吗?</p></div>,
  387. centered: true,
  388. closable: true,
  389. onOk () {
  390. _this.settleAcountPay(null, { type: 1, row: null })
  391. }
  392. })
  393. },
  394. // 重置
  395. resetSearchForm () {
  396. this.resetData()
  397. this.$refs.table.refresh(true)
  398. },
  399. // 查询
  400. searchForm () {
  401. this.$refs.table.clearSelected() // 清空表格选中项
  402. this.$refs.table.refresh(true)
  403. },
  404. // 重置查询条件数据
  405. resetData () {
  406. if (this.advanced) {
  407. this.$refs.rangeDate.resetDate()
  408. this.$refs.createDate.resetDate()
  409. }
  410. this.$refs.table.clearSelected() // 清空表格选中项
  411. this.queryParam = {
  412. bizType: this.curBizType,
  413. settleNo: '',
  414. bizNo: '',
  415. settleClientName: '',
  416. billState: '',
  417. beginDate: '',
  418. endDate: '',
  419. auditBeginDate: '',
  420. auditEndDate: ''
  421. }
  422. },
  423. pageInit () {
  424. const _this = this
  425. this.$nextTick(() => { // 页面渲染完成后的回调
  426. _this.setTableH()
  427. })
  428. this.queryByTypeSum()
  429. },
  430. setTableH () {
  431. const tableSearchH = this.$refs.tableSearch.offsetHeight
  432. this.tableHeight = window.innerHeight - tableSearchH - 330
  433. }
  434. },
  435. watch: {
  436. advanced (newValue, oldValue) {
  437. const _this = this
  438. this.$nextTick(() => { // 页面渲染完成后的回调
  439. _this.setTableH()
  440. })
  441. },
  442. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  443. this.setTableH()
  444. }
  445. },
  446. mounted () {
  447. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  448. this.resetData()
  449. this.pageInit()
  450. }
  451. },
  452. activated () {
  453. // 是否从首页点击进入
  454. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  455. console.log(this.getIsHomeNav(), isHomeNav, this.$route.name)
  456. // 待办查询
  457. if (isHomeNav && isHomeNav.type == 'todo') {
  458. this.curBizType = isHomeNav.pageParams.bizType
  459. this.resetData()
  460. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  461. this.$refs.createDate.resetDate([this.queryParam.beginDate, this.queryParam.endDate])
  462. this.pageInit()
  463. } else {
  464. // 如果是新页签打开,则重置当前页面
  465. if (this.$store.state.app.isNewTab) {
  466. this.curBizType = 'ALL'
  467. this.resetData()
  468. this.pageInit()
  469. }
  470. }
  471. // 结算账户状态查询
  472. if (this.$hasPermissions('M_fundAccountList') && this.$hasPermissions('B_fundAccountEnable')) {
  473. this.GetSettleAccountState().then(res => {
  474. if (res.status == 200) {
  475. this.enableFundAccount = res.data.functionEnableFlag == 1
  476. }
  477. })
  478. }
  479. },
  480. beforeRouteEnter (to, from, next) {
  481. next(vm => {})
  482. }
  483. }
  484. </script>
  485. <style lang="less">
  486. .financialCollectionList-wrap{
  487. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  488. height: 30px!important;
  489. }
  490. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  491. height: 30px!important;
  492. }
  493. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  494. line-height: 26px!important;
  495. height: 30px!important;
  496. }
  497. }
  498. </style>