list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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="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="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. </a-card>
  146. </template>
  147. <script>
  148. import { commonMixin } from '@/utils/mixin'
  149. import { STable, VSelect } from '@/components'
  150. import detailModal from './detailModal.vue'
  151. import rangeDate from '@/views/common/rangeDate.vue'
  152. import salesDetailModal from '@/views/salesManagement/salesQuery/detail.vue'
  153. // 同步采购退货单详情
  154. import pushOrderDetailModal from '@/views/purchasingManagement/purchaseReturn/detail.vue'
  155. // 不同步采购退货单
  156. import pushOrderOutSyncDetailModal from '@/views/purchasingManagement/purchaseReturnOutSync/detail.vue'
  157. import chainTransferOutDetailModal from '@/views/allocationManagement/chainTransferOut/detail.vue'
  158. import storeTransferOutDetailModal from '@/views/allocationManagement/storeTransferOut/detail.vue'
  159. import bulkReturnGoodsDetailModal from '@/views/bulkManagement/bulkReturnGoods/detailModal.vue'
  160. import { settleReceiptQuery, queryByTypeSum, settleReceiptMoney, settleReceiptQuerySum } from '@/api/settleReceipt'
  161. export default {
  162. name: 'FinancialCollectionList',
  163. components: { STable, VSelect, detailModal, rangeDate, pushOrderDetailModal, pushOrderOutSyncDetailModal, salesDetailModal, chainTransferOutDetailModal, bulkReturnGoodsDetailModal, storeTransferOutDetailModal },
  164. mixins: [commonMixin],
  165. data () {
  166. return {
  167. spinning: false,
  168. advanced: true, // 高级搜索 展开/关闭
  169. disabled: false, // 查询、重置按钮是否可操作
  170. openModal: false, // 详情弹框
  171. openDetailModal: false,
  172. openBulkReturnDetailModal: false,
  173. tableHeight: 0,
  174. curBizType: 'ALL',
  175. curBizTitle: '',
  176. fcBizType: '',
  177. orderSn: null,
  178. // 查询参数
  179. queryParam: {
  180. bizType: 'ALL',
  181. settleNo: '',
  182. bizNo: '',
  183. settleClientName: '',
  184. billState: '',
  185. auditBeginDate: '',
  186. auditEndDate: ''
  187. },
  188. // 总计
  189. totalData: {
  190. settledAmount: 0,
  191. totalAmount: 0,
  192. unsettleAmount: 0,
  193. count: 0
  194. },
  195. // 表头
  196. columns: [
  197. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  198. { title: '收款单号', dataIndex: 'settleNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  199. { title: '关联单号', dataIndex: 'bizNo', scopedSlots: { customRender: 'bizNo' }, width: '16%', align: 'center' },
  200. { title: '商户名称', dataIndex: 'settleClientName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  201. { title: '应收金额', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  202. { title: '已收金额', dataIndex: 'settledAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  203. { title: '待收金额', dataIndex: 'unsettleAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  204. { title: '收款类型', dataIndex: 'bizName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  205. { title: '收款方式', dataIndex: 'settleStyleName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  206. { title: '审核时间', dataIndex: 'auditTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  207. { title: '收款时间', dataIndex: 'settleTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  208. { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
  209. ],
  210. loading: false,
  211. // 加载数据方法 必须为 Promise 对象
  212. loadData: parameter => {
  213. this.disabled = true
  214. this.spinning = true
  215. return settleReceiptQuery(Object.assign(parameter, this.queryParam)).then(res => {
  216. let data
  217. if (res.status == 200) {
  218. data = res.data
  219. const no = (data.pageNo - 1) * data.pageSize
  220. for (var i = 0; i < data.list.length; i++) {
  221. data.list[i].no = no + i + 1
  222. }
  223. this.disabled = false
  224. this.totalData.count = data.count || 0
  225. // 查询总计
  226. this.settleReceiptQuerySum(Object.assign(parameter, this.queryParam))
  227. }
  228. this.spinning = false
  229. return data
  230. })
  231. },
  232. tabPaneData: [],
  233. rowSelectionInfo: null
  234. }
  235. },
  236. computed: {
  237. selectTotalAmount () {
  238. let ret = 0
  239. if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) {
  240. this.rowSelectionInfo.selectedRows.map(item => {
  241. ret = ret + item.unsettleAmount
  242. })
  243. }
  244. return ret
  245. }
  246. },
  247. methods: {
  248. handleDetailClose () {
  249. this.openDetailModal = false
  250. this.openBulkReturnDetailModal = false
  251. this.orderSn = null
  252. },
  253. // 查看关联单号
  254. handleDetail (row) {
  255. console.log(row)
  256. this.orderSn = row.bizSn
  257. this.fcBizType = row.bizType
  258. this.curBizTitle = row.bizTypeDictValue + '详情'
  259. if (row.bizType == 'SPARE_PARTS_RETURN') {
  260. this.openBulkReturnDetailModal = true
  261. } else {
  262. this.openDetailModal = true
  263. }
  264. },
  265. // 表格选中项
  266. rowSelectionFun (obj) {
  267. this.rowSelectionInfo = obj || null
  268. },
  269. // 时间 change
  270. dateChange (date) {
  271. this.queryParam.auditBeginDate = date[0]
  272. this.queryParam.auditEndDate = date[1]
  273. },
  274. // 总计
  275. settleReceiptQuerySum (params) {
  276. settleReceiptQuerySum(params).then(res => {
  277. if (res.status == 200) {
  278. this.totalData = Object.assign(this.totalData, res.data)
  279. }
  280. })
  281. },
  282. // 获取类型
  283. queryByTypeSum () {
  284. queryByTypeSum({}).then(res => {
  285. if (res.data && res.status == 200) {
  286. this.tabPaneData = res.data
  287. if (this.$route.query.pageParams) {
  288. this.queryParam.bizType = JSON.parse(this.$route.query.pageParams).bizType
  289. } else {
  290. this.queryParam.bizType = res.data[0].bizType
  291. }
  292. this.$refs.table.refresh(true)
  293. }
  294. })
  295. },
  296. // 凭证弹框
  297. handleVoucher (row) {
  298. this.$refs.detailModal.getDetail(row.id)
  299. this.openModal = true
  300. },
  301. // 收款
  302. handleCollectionSing (row) {
  303. const _this = this
  304. this.$confirm({
  305. title: '提示',
  306. content: '确认收款吗?',
  307. centered: true,
  308. closable: true,
  309. onOk () {
  310. _this.loading = true
  311. _this.spinning = true
  312. settleReceiptMoney([row.id]).then(res => {
  313. _this.loading = false
  314. if (res.status == 200) {
  315. _this.$message.success(res.message)
  316. _this.$refs.table.refresh()
  317. _this.$refs.table.clearSelected() // 清空表格选中项
  318. _this.spinning = false
  319. } else {
  320. _this.spinning = false
  321. }
  322. })
  323. }
  324. })
  325. },
  326. // 选择类型
  327. handleTabChange (key) {
  328. this.queryParam.bizType = key
  329. this.$refs.table.refresh(true)
  330. this.curBizType = key
  331. },
  332. // 批量收款
  333. handleCollection () {
  334. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  335. this.$message.warning('请在列表勾选后再进行批量操作!')
  336. return
  337. }
  338. const _this = this
  339. this.$confirm({
  340. title: '提示',
  341. content: <div><p style="margin-top:20px;">合计金额¥{ this.selectTotalAmount } </p><p>确认批量收款吗?</p></div>,
  342. centered: true,
  343. closable: true,
  344. onOk () {
  345. _this.loading = true
  346. _this.spinning = true
  347. settleReceiptMoney(_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys).then(res => {
  348. this.loading = false
  349. if (res.status == 200) {
  350. _this.$message.success(res.message)
  351. _this.$refs.table.refresh()
  352. _this.$refs.table.clearSelected() // 清空表格选中项
  353. _this.spinning = false
  354. } else {
  355. _this.spinning = false
  356. }
  357. })
  358. }
  359. })
  360. },
  361. // 重置
  362. resetSearchForm () {
  363. this.resetData()
  364. this.$refs.table.refresh(true)
  365. },
  366. // 重置数据
  367. resetData () {
  368. if (this.advanced) {
  369. this.$refs.rangeDate.resetDate()
  370. }
  371. this.queryParam = {
  372. bizType: this.curBizType,
  373. settleNo: '',
  374. bizNo: '',
  375. settleClientName: '',
  376. billState: '',
  377. auditBeginDate: '',
  378. auditEndDate: ''
  379. }
  380. },
  381. pageInit () {
  382. const _this = this
  383. this.$nextTick(() => { // 页面渲染完成后的回调
  384. _this.setTableH()
  385. })
  386. this.queryByTypeSum()
  387. },
  388. setTableH () {
  389. const tableSearchH = this.$refs.tableSearch.offsetHeight
  390. this.tableHeight = window.innerHeight - tableSearchH - 330
  391. }
  392. },
  393. watch: {
  394. advanced (newValue, oldValue) {
  395. const _this = this
  396. this.$nextTick(() => { // 页面渲染完成后的回调
  397. _this.setTableH()
  398. })
  399. },
  400. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  401. this.setTableH()
  402. }
  403. },
  404. mounted () {
  405. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  406. this.resetData()
  407. this.pageInit()
  408. }
  409. },
  410. activated () {
  411. // 如果是新页签打开,则重置当前页面
  412. if (this.$store.state.app.isNewTab || this.$route.query.pageParams) {
  413. this.resetData()
  414. if (this.$route.query.pageParams) {
  415. this.queryParam.bizType = JSON.parse(this.$route.query.pageParams).bizType
  416. this.queryParam.billState = JSON.parse(this.$route.query.pageParams).billState
  417. }
  418. this.pageInit()
  419. }
  420. },
  421. beforeRouteEnter (to, from, next) {
  422. next(vm => {})
  423. }
  424. }
  425. </script>
  426. <style lang="less">
  427. .financialCollectionList-wrap{
  428. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  429. height: 30px!important;
  430. }
  431. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  432. height: 30px!important;
  433. }
  434. .financialCollectionList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  435. line-height: 26px!important;
  436. height: 30px!important;
  437. }
  438. }
  439. </style>