list.vue 19 KB

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