voucherModal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <a-modal
  3. centered
  4. class="collection-detail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. v-model="isShow"
  8. :title="modalTit"
  9. :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
  10. @cancel="handleCommonCancel"
  11. width="60%">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <div class="common-main" v-if="detail">
  14. <div class="toolsBar">
  15. <a-descriptions>
  16. <a-descriptions-item label="销售单号">
  17. {{ detail.bizNo || '--' }}
  18. </a-descriptions-item>
  19. <a-descriptions-item label="备货单号">
  20. {{ detail.dispatchBillNo || '--' }}
  21. </a-descriptions-item>
  22. <a-descriptions-item label="发货编号">
  23. {{ detail.sendNo || '--' }}
  24. </a-descriptions-item>
  25. <a-descriptions-item label="客户名称">
  26. {{ detail.settleClientName || '--' }}
  27. </a-descriptions-item>
  28. <a-descriptions-item label="收货客户名称">
  29. {{ detail.receiverName || '--' }}
  30. </a-descriptions-item>
  31. <a-descriptions-item label="收款方式">
  32. {{ detail.settleStyleDictValue || '--' }}
  33. </a-descriptions-item>
  34. <a-descriptions-item label="产品款数">
  35. {{ detail.totalCategory }}
  36. </a-descriptions-item>
  37. <a-descriptions-item label="产品数量">
  38. {{ detail.qty }}
  39. </a-descriptions-item>
  40. <a-descriptions-item label="总售价">
  41. {{ detail.totalAmount }}
  42. </a-descriptions-item>
  43. <a-descriptions-item label="业务状态">
  44. {{ detail.billStatusDictValue || '--' }}
  45. </a-descriptions-item>
  46. <a-descriptions-item label="财务状态">
  47. {{ detail.settleStateDictValue || '--' }}
  48. </a-descriptions-item>
  49. <a-descriptions-item label="单据状态">
  50. {{ detail.voidFlagDictValue || '--' }}
  51. </a-descriptions-item>
  52. <a-descriptions-item label="收款类型">
  53. <span>{{ detail.keepTypeDictValue || '--' }}</span>
  54. <span v-if="detail.keepTypeDictValue =='仅标记收款'" @click="handleAssociated"><a-button type="link" :loading="associatedLoading" style="margin-left:10px;" class="link-bule">
  55. 关联收款单
  56. </a-button></span>
  57. </a-descriptions-item>
  58. <a-descriptions-item label="收款时间">
  59. {{ detail.settleTime || '--' }}
  60. </a-descriptions-item>
  61. <a-descriptions-item label="收款人">
  62. {{ detail.settlePersonName || '--' }}
  63. </a-descriptions-item>
  64. <a-descriptions-item label="操作时间">
  65. {{ detail.operateTime || '--' }}
  66. </a-descriptions-item>
  67. </a-descriptions>
  68. </div>
  69. <div v-if="detail.keepType == 'RELATION_BOOK'">
  70. <a-table :columns="columns" :pagination="false" :data-source="tableData" bordered>
  71. <!-- 收款单号 -->
  72. <template slot="bookNo" slot-scope="text, record">
  73. <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="viewDetail(record)">{{ record.bookNo }}</span>
  74. <span v-else>{{ record.bookNo }}</span>
  75. </template>
  76. </a-table>
  77. </div>
  78. </div>
  79. <div class="btn-box">
  80. <a-button @click="handleCommonCancel" v-if="isCancel">{{ cancelText }}</a-button>
  81. <a-button v-if="detail&&detail.keepType =='RELATION_BOOK'" :loading="spinning" type="primary" @click="handlePlPrint()">收款打印</a-button>
  82. </div>
  83. </a-spin>
  84. <!-- 收款打印 -->
  85. <printModel ref="printModel" @cancel="canselPrintView"></printModel>
  86. <!-- 查看财务收款详情 -->
  87. <commonModal
  88. modalTit="财务收款详情"
  89. bodyPadding="10px"
  90. width="70%"
  91. :showFooter="false"
  92. :openModal="showDetailModal"
  93. @cancel="showDetailModal=false">
  94. <detailModal ref="detailModal"></detailModal>
  95. </commonModal>
  96. <!-- 关联收款单 -->
  97. <collectDetailModal
  98. v-drag
  99. ref="collectDetailModal"
  100. modalTit="关联收款单"
  101. @ok="relationSuccess"
  102. :openModal="showCollectDetail"
  103. @cancel="showCollectDetail=false"></collectDetailModal>
  104. </a-modal>
  105. </template>
  106. <script>
  107. import { STable, VSelect } from '@/components'
  108. import commonModal from '@/views/common/commonModal.vue'
  109. import printModel from '../receiptPrint/printModel.vue'
  110. import detailModal from '@/views/financialManagement/financialCollection/detail.vue'
  111. import collectDetailModal from './detailModal.vue'
  112. import { settleReceiptFindBySn } from '@/api/settleReceipt.js'
  113. import { getBatchLastProcessInstance } from '@/api/financeBook'
  114. export default {
  115. name: 'VoucherModal',
  116. components: { STable, VSelect, commonModal, printModel, detailModal, collectDetailModal },
  117. props: {
  118. openModal: { // 弹框显示状态
  119. type: Boolean,
  120. default: false
  121. },
  122. modalTit: { // 弹框标题
  123. type: String,
  124. default: null
  125. },
  126. cancelText: { // 取消 按钮文字
  127. type: String,
  128. default: '关闭'
  129. },
  130. isCancel: { // 是否显示 取消 按钮
  131. type: Boolean,
  132. default: true
  133. }
  134. },
  135. data () {
  136. return {
  137. isShow: this.openModal, // 是否打开弹框
  138. showTipModal: false,
  139. showDetailModal: false,
  140. disabled: false,
  141. spinning: false,
  142. detail: null,
  143. columns: [
  144. { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  145. { title: '收款单号', scopedSlots: { customRender: 'bookNo' }, width: '8%', align: 'center' },
  146. { title: '申请人', dataIndex: 'applyPersonName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  147. { title: '财务收款事由', dataIndex: 'bookReason', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  148. { title: '订单总金额', dataIndex: 'orderTotalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  149. { title: '收款总金额', dataIndex: 'receiptTotalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  150. { title: '使用授信总金额', dataIndex: 'useTotalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '授信还款总金额', dataIndex: 'payTotalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  152. { title: '余款抵扣总金额', dataIndex: 'balanceTotalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  153. { title: '审核时间', dataIndex: 'auditDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '状态', dataIndex: 'statusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  155. ],
  156. tableData: [],
  157. associatedLoading: false,
  158. showCollectDetail: false,
  159. handlePlData: null
  160. }
  161. },
  162. methods: {
  163. // 财务收款详情
  164. viewDetail (row) {
  165. this.showDetailModal = true
  166. this.$nextTick(() => {
  167. this.$refs.detailModal.pageInit(row.bookSn)
  168. })
  169. },
  170. getData (data) {
  171. this.handlePlData = data
  172. this.spinning = true
  173. settleReceiptFindBySn({ sn: data.accountReceiptSn }).then(res => {
  174. this.detail = res.data || null
  175. if (res.data.keepType !== 'LABEL_RECEIPT') {
  176. this.tableData = res.data && res.data.financeBookList || []
  177. const no = 1
  178. for (var i = 0; i < this.tableData.length; i++) {
  179. this.tableData[i].no = no + i
  180. }
  181. }
  182. this.spinning = false
  183. })
  184. },
  185. // 获取审核信息
  186. getAuditInfo (auditList) {
  187. let auditStr = ''
  188. if (auditList && auditList.taskVOList) {
  189. const auditLists = auditList.taskVOList.filter(item => item.userType == '审批人')
  190. auditLists.map((a, i) => {
  191. auditStr = auditStr + a.userName + '(' + a.state + ')' + (i == auditLists.length - 1 ? '。' : ';')
  192. })
  193. }
  194. return auditStr
  195. },
  196. // 批量打印
  197. async handlePlPrint () {
  198. this.spinning = true
  199. const rows = []
  200. const bookSns = []
  201. this.tableData.map(item => {
  202. if(item.financeBookDetailList){
  203. rows.push(item.financeBookDetailList[0])
  204. const booksn = item.financeBookDetailList[0].bookSn
  205. if (bookSns.indexOf(booksn) < 0) {
  206. bookSns.push(booksn)
  207. }
  208. }
  209. })
  210. const retArr = []
  211. const auditInfo = await getBatchLastProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSnList': bookSns }).then(res => res.data)
  212. console.log(bookSns,auditInfo)
  213. bookSns.map(item => {
  214. // 授信明细
  215. const rs = rows.filter(a => a.bookSn == item)
  216. let detailItemUseStr = ''
  217. rs.map(b => {
  218. if (b.detailItemUseList) {
  219. b.detailItemUseList.map((k, i) => {
  220. detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ')' + (i == b.detailItemUseList.length - 1 ? '。' : ';')
  221. })
  222. }
  223. })
  224. // 审核信息
  225. const auditStr = this.getAuditInfo(auditInfo[item])
  226. retArr.push({ audit: auditStr, detail: detailItemUseStr, subList: rs })
  227. })
  228. console.log(retArr, '------------')
  229. this.handlePrint(retArr, rows)
  230. },
  231. // 收款打印
  232. async handlePrint (row, list) {
  233. this.spinning = true
  234. this.showTipModal = true
  235. this.$nextTick(() => {
  236. // 审核信息
  237. this.$refs.printModel.getData(row, list)
  238. })
  239. },
  240. canselPrintView () {
  241. this.showTipModal = false
  242. this.spinning = false
  243. this.$refs.printModel.clearData()
  244. },
  245. // 取消
  246. handleCommonCancel () {
  247. this.$emit('cancel')
  248. this.detail = null
  249. this.tableData = []
  250. },
  251. // 打开关联收款单弹窗
  252. handleAssociated () {
  253. const snList = []
  254. snList.push(this.handlePlData.accountReceiptSn)
  255. this.showCollectDetail = true
  256. this.$nextTick(() => {
  257. this.$refs.collectDetailModal.setData([this.handlePlData], snList)
  258. })
  259. },
  260. // 关联收款成功
  261. relationSuccess () {
  262. this.handleCommonCancel()
  263. this.showCollectDetail = false
  264. }
  265. },
  266. watch: {
  267. // 父页面传过来的弹框状态
  268. openModal (newValue, oldValue) {
  269. this.isShow = newValue
  270. },
  271. // 重定义的弹框状态
  272. isShow (newValue, oldValue) {
  273. if (!newValue) {
  274. this.$emit('cancel')
  275. }
  276. }
  277. }
  278. }
  279. </script>
  280. <style lang="less">
  281. .collection-detail-modal{
  282. .common-main{
  283. min-height:20vh;
  284. .toolsBar{
  285. display: flex;
  286. align-items: center;
  287. margin-bottom: 10px;
  288. .ant-btn{
  289. margin-left: 30px;
  290. }
  291. }
  292. }
  293. .btn-box{
  294. text-align: center;
  295. margin-top: 30px;
  296. .ant-btn{
  297. margin:0 10px;
  298. }
  299. }
  300. }
  301. </style>