list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <template>
  2. <div class="receiptPrint-wrap">
  3. <a-card size="small" class="searchBoxNormal" :bordered="false">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="允许打印时间">
  10. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="收款单号">
  15. <a-input id="salesCollectionList-bookNo" v-model.trim="queryParam.bookNo" allowClear placeholder="请输入备货单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="客户名称">
  20. <dealerSearchList ref="payerName" id="alesCollectionList-payerName" @change="custChange" />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  24. <a-form-model-item label="仓库">
  25. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24" v-if="currentTab == 1">
  29. <a-form-item label="收款打印状态">
  30. <v-select
  31. v-model="queryParam.printStatus"
  32. ref="printStatus"
  33. id="salesCollectionList-printStatus"
  34. code="PRINT_STATUS"
  35. placeholder="请选择打印状态"
  36. allowClear
  37. ></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="足额打款">
  42. <v-select
  43. v-model="queryParam.fullPaymentFlag"
  44. ref="fullPaymentFlag"
  45. id="salesCollectionList-fullPaymentFlag"
  46. code="FLAG"
  47. placeholder="请选择是否足额打款"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  52. <a-form-item label="客服">
  53. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-item label="收款金额">
  58. <a-select allowClear placeholder="请选择" id="salesCollectionList-receiptAmount" v-model="queryParam.receiptAmountZeroFlag">
  59. <a-select-option value="1">等于0</a-select-option>
  60. <a-select-option value="0">不等于0</a-select-option>
  61. </a-select>
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="isShowCustomerSearch&&currentTab==1?24:6" :sm="24" :style="{textAlign:isShowCustomerSearch&&currentTab==1?'center':''}">
  65. <span class="table-page-search-submitButtons">
  66. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  67. <a-button style="margin-left: 8px;margin-bottom:10px;" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  68. <!-- <a @click="advanced=!advanced" style="margin-left: 8px">
  69. {{ advanced ? '收起' : '展开' }}
  70. <a-icon :type="advanced ? 'up' : 'down'"/>
  71. </a> -->
  72. </span>
  73. </a-col>
  74. </a-row>
  75. </a-form>
  76. </div>
  77. </a-card>
  78. <a-card class="receiptPrint-body" size="small" :bordered="false">
  79. <a-spin :spinning="spinning" tip="Loading...">
  80. <div>
  81. <a-tabs v-model="currentTab" @change="changeTab">
  82. <a-tab-pane :key="1" tab="全部">
  83. </a-tab-pane>
  84. <a-tab-pane :key="2" tab="待打印">
  85. </a-tab-pane>
  86. </a-tabs>
  87. </div>
  88. <!-- 操作按钮 -->
  89. <div class="table-operator" v-if="$hasPermissions('B_SkPrint')">
  90. <a-button type="primary" :loading="spinning" @click="handlePlPrint()">批量打印</a-button>
  91. <span style="margin:0 10px">
  92. <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  93. </span>
  94. </div>
  95. <!-- 列表 -->
  96. <s-table
  97. class="sTable fixPagination"
  98. ref="table"
  99. :style="{ height: tableHeight+85+'px' }"
  100. :row-selection="$hasPermissions('B_SkPrint')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: (record.printStatus !== 'NO_PRINT'&&record.printStatus !== 'PRINT') } })}:null"
  101. @rowSelection="rowSelectionFun"
  102. size="small"
  103. :rowKey="(record) => record.id"
  104. :columns="columns"
  105. :data="loadData"
  106. :scroll="{ y:tableHeight }"
  107. :defaultLoadData="false"
  108. bordered>
  109. <!-- 打印状态 -->
  110. <template slot="printStatus" slot-scope="text, record">
  111. <span v-if="record.printStatus=='NO_PRINT'" class="link-bule" @click="handlePrintStatus(record)">{{ record.printStatusDictValue }}</span>
  112. <span v-else>{{ record.printStatusDictValue }}</span>
  113. </template>
  114. <!-- 操作 -->
  115. <template slot="action" slot-scope="text, record">
  116. <div>
  117. <a-button
  118. size="small"
  119. type="link"
  120. v-if="(record.printStatus == 'NO_PRINT'||record.printStatus == 'PRINT')&&$hasPermissions('B_SkPrint')"
  121. class="button-warning"
  122. @click="handlePrint(record,0,record)"
  123. >收款打印</a-button>
  124. <a-button
  125. size="small"
  126. type="link"
  127. class="button-success"
  128. v-if="record.printStatus == 'PRINT'&&$hasPermissions('B_SKPrintRecord')"
  129. @click="viewPrint(record)"
  130. >打印记录</a-button>
  131. </div>
  132. </template>
  133. </s-table>
  134. <!-- 收款打印 -->
  135. <commonModal modalTit="收款打印预览" width="700pt" :showFooter="false" :openModal="showTipModal" @cancel="closeTipModal">
  136. <printModel ref="printModel" @cancel="closeTipModal" @printOk="printOk"></printModel>
  137. </commonModal>
  138. <!-- 打印记录 -->
  139. <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
  140. <!-- 操作提示 -->
  141. <commonModal modalTit="操作提示" okText="暂不打印" :openModal="showPrintModal" @cancel="canselModal" @ok="updatePrintStatus">
  142. <div style="display:flex;flex-direction: column;align-items: center;">
  143. <div style="margin-bottom: 15px;font-size: 14px;">如需将打印状态回退至<strong>【暂不打印】</strong>,请点击下方按钮</div>
  144. <div style="line-height: 24px;">
  145. <div>收款单号:{{ tipData&&tipData.bookNo }}</div>
  146. <div>客户名称:{{ tipData&&tipData.payerName }}</div>
  147. </div>
  148. </div>
  149. </commonModal>
  150. </a-spin>
  151. </a-card>
  152. </div>
  153. </template>
  154. <script>
  155. import { commonMixin } from '@/utils/mixin'
  156. import rangeDate from '@/views/common/rangeDate.vue'
  157. import { STable, VSelect } from '@/components'
  158. import dealerSearchList from '@/views/common/dealerSearchList.vue'
  159. import commonModal from '@/views/common/commonModal.vue'
  160. import recordModal from './recordModal.vue'
  161. import printModel from './printModel.vue'
  162. import chooseWarehouse from '@/views/common/chooseWarehouse'
  163. import customerService from '@/views/common/customerService'
  164. import { financeBookDetailList, updateFinanceBookDetail, checkPrintStatus } from '@/api/financeBook'
  165. import { getProcessInstance } from '@/api/expenseManagement'
  166. export default {
  167. name: 'ReceiptPrintList',
  168. mixins: [commonMixin],
  169. components: { STable, VSelect, dealerSearchList, rangeDate, commonModal, recordModal, printModel, chooseWarehouse, customerService },
  170. data () {
  171. return {
  172. spinning: false,
  173. advanced: true, // 高级搜索 展开/关闭
  174. disabled: false, // 查询、重置按钮是否可操作
  175. tableHeight: 0,
  176. time: [],
  177. currentTab: 2,
  178. // 查询参数
  179. queryParam: {
  180. beginDate: '',
  181. endDate: '',
  182. bookNo: '',
  183. payerName: '',
  184. dealerSn: undefined,
  185. subareaSn: undefined,
  186. billStatus: undefined,
  187. dealerProvinceSn: undefined,
  188. fullPaymentFlag: undefined,
  189. warehouseSn: undefined,
  190. printStatus: 'NO_PRINT',
  191. bizUserSn: undefined,
  192. receiptAmountZeroFlag: undefined
  193. },
  194. totalData: {
  195. totalAmount: 0,
  196. totalQty: 0,
  197. totalRecord: 0
  198. },
  199. showTipModal: false,
  200. showRecordModal: false,
  201. showPrintModal: false,
  202. showViewModal: false,
  203. tipData: null,
  204. // 加载数据方法 必须为 Promise 对象
  205. loadData: parameter => {
  206. this.disabled = true
  207. this.spinning = true
  208. if (this.currentTab == 1) {
  209. this.queryParam.isAll = '1'
  210. this.queryParam.status = 'AUDIT_PASS'
  211. }
  212. return financeBookDetailList(Object.assign(parameter, this.queryParam)).then(res => {
  213. let data
  214. if (res.status == 200) {
  215. data = res.data
  216. const no = (data.pageNo - 1) * data.pageSize
  217. for (var i = 0; i < data.list.length; i++) {
  218. data.list[i].no = no + i + 1
  219. }
  220. this.disabled = false
  221. }
  222. this.spinning = false
  223. return data
  224. })
  225. },
  226. rowSelectionInfo: null // 批量选择的数据
  227. }
  228. },
  229. computed: {
  230. columns () {
  231. const arr = [
  232. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  233. { title: '允许打印时间', dataIndex: 'allowPrintTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  234. { title: '收款单号', dataIndex: 'bookNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  235. { title: '收款日期', dataIndex: 'receiptDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  236. { title: '客户名称', dataIndex: 'payerName', align: 'left', width: '20%', customRender: function (text) { return text || '--' }, ellipsis: true },
  237. { title: '财务编码', dataIndex: 'dealerEntity.kdMidCustomerFnumber', align: 'center', width: '10%', customRender: function (text) { return text || '--' }, ellipsis: true },
  238. { title: '订单金额', dataIndex: 'orderAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  239. { title: '收款金额', dataIndex: 'receiptAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  240. { title: '使用授信', dataIndex: 'useCreditAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  241. { title: '授信还款', dataIndex: 'payCreditAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  242. { title: '余款抵扣', dataIndex: 'balanceAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  243. { title: '跨月打款', dataIndex: 'nextMonthAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  244. { title: '特殊申请发货', dataIndex: 'specialSendAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  245. { title: '户名', dataIndex: 'bankAccount', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  246. { title: '汇入银行', dataIndex: 'bankName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  247. { title: '足额打款', dataIndex: 'fullPaymentFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  248. { title: '说明', dataIndex: 'explainInfo', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  249. { title: '收款打印状态', dataIndex: 'printStatusDictValue', width: '6%', align: 'center', scopedSlots: { customRender: 'printStatus' } },
  250. { title: '打印次数', dataIndex: 'printNum', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  251. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  252. ]
  253. if (this.isShowWarehouse) {
  254. arr.splice(5, 0, { title: '仓库', dataIndex: 'warehouseName', align: 'center', width: '10%', customRender: function (text) { return text || '--' }, ellipsis: true })
  255. }
  256. return arr
  257. }
  258. },
  259. watch: {
  260. advanced (newValue, oldValue) {
  261. const _this = this
  262. this.$nextTick(() => { // 页面渲染完成后的回调
  263. _this.setTableH()
  264. })
  265. },
  266. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  267. this.setTableH()
  268. }
  269. },
  270. methods: {
  271. changeTab (v) {
  272. this.currentTab = v
  273. this.pageInit()
  274. this.resetSearchForm()
  275. },
  276. // 表格选中项
  277. rowSelectionFun (obj) {
  278. this.rowSelectionInfo = obj || null
  279. },
  280. // 批量打印
  281. async handlePlPrint () {
  282. const _this = this
  283. const rows = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows || []
  284. const slen = rows.length
  285. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && slen < 1)) {
  286. _this.$message.warning('请在列表勾选后再进行批量操作!')
  287. return false
  288. }
  289. this.spinning = true
  290. const bookSns = []
  291. const bookDetailSn = []
  292. rows.map(item => {
  293. if (bookSns.indexOf(item.bookSn) < 0) {
  294. bookSns.push(item.bookSn)
  295. }
  296. bookDetailSn.push(item.bookDetailSn)
  297. })
  298. // 检查是否有已打印数据
  299. if (this.currentTab == 2) {
  300. const hasPrintData = await checkPrintStatus(bookDetailSn).then(res => res.data)
  301. if (!hasPrintData) {
  302. _this.$info({
  303. title: '操作提示',
  304. centered: true,
  305. content: '您所选择的收款单,存在已打印的单子,请重新选择。',
  306. onOk () {
  307. _this.resetSearchForm()
  308. }
  309. })
  310. return
  311. }
  312. }
  313. const retArr = []
  314. for (let i = 0; i < bookSns.length; i++) {
  315. const item = bookSns[i]
  316. // 授信明细,还款明细
  317. const rs = rows.filter(a => a.bookSn == item)
  318. let detailItemUseStr = ''
  319. let detailPayUseStr = ''
  320. rs.map(b => {
  321. if (b.detailItemUseList) {
  322. detailItemUseStr += this.getUseDetailInfo(b.detailItemUseList)
  323. }
  324. if (b.detailItemPayList) {
  325. detailPayUseStr += this.getUseDetailInfo(b.detailItemPayList)
  326. }
  327. })
  328. const auditInfo = await getProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSn': item }).then(res => (res.data[0] && res.data[0].opinionList) ? res.data[0].opinionList : [])
  329. // 审核信息
  330. const auditStr = auditInfo ? this.getAuditInfo(auditInfo) : ''
  331. retArr.push({ audit: auditStr, detail: detailItemUseStr, payDetail: detailPayUseStr, subList: rs })
  332. }
  333. this.handlePrint(retArr, 1, rows, bookSns)
  334. },
  335. // 获取授信西悉尼
  336. getUseDetailInfo (list) {
  337. let ret = ''
  338. list.map((k, i) => {
  339. ret = ret + k.itemName + '(' + k.itemAmount + ')' + (i == list.length - 1 ? ';' : ',')
  340. })
  341. return ret
  342. },
  343. // 获取审核信息
  344. getAuditInfo (auditList) {
  345. let auditStr = ''
  346. if (auditList && auditList.length) {
  347. const auditLists = auditList.filter(item => item.processTaskType == '审批人')
  348. auditLists.map((a, i) => {
  349. auditStr = auditStr + a.approvalName + '(' + a.approvalStateDictValue + ')' + (i == auditLists.length - 1 ? ';' : ',')
  350. })
  351. }
  352. return auditStr
  353. },
  354. // 收款打印
  355. async handlePrint (row, type, list, bookSns) {
  356. const _this = this
  357. let auditInfo = null
  358. if (type == 0) {
  359. // 是否已打印
  360. if (this.currentTab == 2) {
  361. const hasPrintData = await checkPrintStatus([list.bookDetailSn]).then(res => res.data)
  362. if (!hasPrintData) {
  363. _this.$info({
  364. title: '操作提示',
  365. centered: true,
  366. content: '您所选择的收款单已打印,请重新选择。',
  367. onOk () {
  368. _this.resetSearchForm()
  369. }
  370. })
  371. return
  372. }
  373. }
  374. auditInfo = await getProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSn': list.bookSn }).then(res => (res.data[0] && res.data[0].opinionList) ? res.data[0].opinionList : [])
  375. }
  376. this.spinning = true
  377. this.showTipModal = true
  378. let detailItemUseStr = ''
  379. let detailPayUseStr = ''
  380. this.$nextTick(() => {
  381. // type == 0 单个打印时
  382. if (type == 0 && row.detailItemUseList) {
  383. detailItemUseStr = this.getUseDetailInfo(row.detailItemUseList)
  384. }
  385. if (type == 0 && row.detailItemPayList) {
  386. detailPayUseStr = this.getUseDetailInfo(row.detailItemPayList)
  387. }
  388. // 审核信息
  389. const auditStr = auditInfo ? this.getAuditInfo(auditInfo) : ''
  390. this.$refs.printModel.getData(type ? row : [{ audit: auditStr, detail: detailItemUseStr, payDetail: detailPayUseStr, subList: [row] }], type ? list : [list])
  391. })
  392. },
  393. printOk (res) {
  394. if (res) {
  395. this.spinning = false
  396. this.$refs.table.refresh()
  397. this.$refs.table.clearSelected()
  398. }
  399. },
  400. // 时间 change
  401. dateChange (date) {
  402. this.queryParam.beginDate = date[0] ? date[0] : ''
  403. this.queryParam.endDate = date[1] ? date[1] : ''
  404. },
  405. custChange (val) {
  406. console.log(val)
  407. if (val.row) {
  408. this.queryParam.dealerSn = val.row.dealerSn
  409. this.queryParam.payerName = undefined
  410. } else {
  411. this.queryParam.dealerSn = undefined
  412. this.queryParam.payerName = val.key
  413. }
  414. },
  415. handlePrintStatus (row) {
  416. this.tipData = row
  417. this.showPrintModal = true
  418. },
  419. canselModal () {
  420. this.tipData = null
  421. this.showPrintModal = false
  422. },
  423. updatePrintStatus () {
  424. updateFinanceBookDetail({ id: this.tipData.id, printStatus: 'UNABLE_PRINT' }, 1).then(res => {
  425. if (res.status == 200) {
  426. this.canselModal()
  427. this.$message.info(res.message)
  428. this.$refs.table.refresh()
  429. }
  430. })
  431. },
  432. // 关闭打印预览
  433. closeTipModal () {
  434. this.showTipModal = false
  435. this.spinning = false
  436. this.$refs.printModel.clearData()
  437. },
  438. // 打印记录
  439. viewPrint (row) {
  440. this.showRecordModal = true
  441. this.$refs.recordModal.setData(row, {
  442. billType: 'FINANCE_BOOK_DETAIL',
  443. billSn: row.bookDetailSn,
  444. billNo: row.bookNo
  445. })
  446. },
  447. // 重置
  448. resetSearchForm () {
  449. this.time = []
  450. this.$refs.rangeDate.resetDate(this.time)
  451. this.$refs.payerName.resetForm()
  452. this.queryParam = {
  453. beginDate: '',
  454. endDate: '',
  455. bookNo: '',
  456. payerName: '',
  457. dealerSn: undefined,
  458. subareaSn: undefined,
  459. billStatus: undefined,
  460. dealerProvinceSn: undefined,
  461. fullPaymentFlag: undefined,
  462. warehouseSn: undefined,
  463. bizUserSn: undefined,
  464. printStatus: this.currentTab == 2 ? 'NO_PRINT' : undefined,
  465. receiptAmountZeroFlag: undefined
  466. }
  467. this.$refs.table.refresh(true)
  468. this.$refs.table.clearSelected()
  469. },
  470. pageInit () {
  471. const _this = this
  472. this.$nextTick(() => { // 页面渲染完成后的回调
  473. _this.setTableH()
  474. })
  475. },
  476. setTableH () {
  477. const tableSearchH = this.$refs.tableSearch.offsetHeight
  478. this.tableHeight = window.innerHeight - tableSearchH - 295
  479. }
  480. },
  481. watch: {
  482. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  483. this.setTableH()
  484. }
  485. },
  486. mounted () {
  487. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  488. this.pageInit()
  489. this.resetSearchForm()
  490. }
  491. },
  492. activated () {
  493. // 如果是新页签打开,则重置当前页面
  494. if (this.$store.state.app.isNewTab) {
  495. this.pageInit()
  496. this.resetSearchForm()
  497. }
  498. // 仅刷新列表,不重置页面
  499. if (this.$store.state.app.updateList) {
  500. this.pageInit()
  501. this.$refs.table.refresh()
  502. }
  503. },
  504. beforeRouteEnter (to, from, next) {
  505. next(vm => {})
  506. }
  507. }
  508. </script>
  509. <style lang="less">
  510. .receiptPrint-wrap{
  511. .ant-tabs-bar{
  512. margin-bottom: 10px;
  513. }
  514. .receiptPrint-body{
  515. .ant-card-body{
  516. padding-top:0;
  517. }
  518. }
  519. }
  520. </style>