voucherModal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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. {{ $hasPermissions('B_salesCollection_record_salesPrice') ? toThousands(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 class="sTable" :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. <commonModal modalTit="收款打印预览" width="700pt" :showFooter="false" :openModal="showTipModal" @cancel="canselPrintView">
  86. <printModel ref="printModel" @cancel="canselPrintView" @ok="canselPrintView"></printModel>
  87. </commonModal>
  88. <!-- 查看财务收款详情 -->
  89. <commonModal
  90. modalTit="财务收款详情"
  91. bodyPadding="10px"
  92. width="70%"
  93. :showFooter="false"
  94. :openModal="showDetailModal"
  95. @cancel="showDetailModal=false">
  96. <detailModal ref="detailModal"></detailModal>
  97. </commonModal>
  98. <!-- 关联收款单 -->
  99. <collectDetailModal
  100. v-drag
  101. ref="collectDetailModal"
  102. modalTit="关联收款单"
  103. @ok="relationSuccess"
  104. :openModal="showCollectDetail"
  105. @cancel="showCollectDetail=false"></collectDetailModal>
  106. </a-modal>
  107. </template>
  108. <script>
  109. import { commonMixin } from '@/utils/mixin'
  110. import { STable, VSelect } from '@/components'
  111. import commonModal from '@/views/common/commonModal.vue'
  112. import printModel from '../receiptPrint/printModel.vue'
  113. import detailModal from '@/views/financialManagement/financialCollection/detail.vue'
  114. import collectDetailModal from './detailModal.vue'
  115. import { settleReceiptFindBySn } from '@/api/settleReceipt.js'
  116. import { getBatchLastProcessInstance } from '@/api/financeBook'
  117. export default {
  118. name: 'VoucherModal',
  119. mixins: [commonMixin],
  120. components: { STable, VSelect, commonModal, printModel, detailModal, collectDetailModal },
  121. props: {
  122. openModal: { // 弹框显示状态
  123. type: Boolean,
  124. default: false
  125. },
  126. modalTit: { // 弹框标题
  127. type: String,
  128. default: null
  129. },
  130. cancelText: { // 取消 按钮文字
  131. type: String,
  132. default: '关闭'
  133. },
  134. isCancel: { // 是否显示 取消 按钮
  135. type: Boolean,
  136. default: true
  137. }
  138. },
  139. data () {
  140. return {
  141. isShow: this.openModal, // 是否打开弹框
  142. showTipModal: false,
  143. showDetailModal: false,
  144. disabled: false,
  145. spinning: false,
  146. detail: null,
  147. columns: [
  148. { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '收款单号', scopedSlots: { customRender: 'bookNo' }, width: '10%', align: 'center' },
  150. { title: '申请人', dataIndex: 'applyPersonName', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  151. { title: '财务收款事由', dataIndex: 'bookReason', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  152. { title: '订单总金额', dataIndex: 'orderTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  153. { title: '收款总金额', dataIndex: 'receiptTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  154. { title: '使用授信总金额', dataIndex: 'useTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  155. { title: '授信还款总金额', dataIndex: 'payTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  156. { title: '余款抵扣总金额', dataIndex: 'balanceTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  157. { title: '审核时间', dataIndex: 'auditDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  158. { title: '状态', dataIndex: 'statusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  159. ],
  160. tableData: [],
  161. associatedLoading: false,
  162. showCollectDetail: false,
  163. handlePlData: null
  164. }
  165. },
  166. methods: {
  167. // 财务收款详情
  168. viewDetail (row) {
  169. this.showDetailModal = true
  170. this.$nextTick(() => {
  171. this.$refs.detailModal.pageInit(row.bookSn)
  172. })
  173. },
  174. getData (data) {
  175. this.handlePlData = data
  176. this.spinning = true
  177. settleReceiptFindBySn({ sn: data.accountReceiptSn }).then(res => {
  178. this.detail = res.data || null
  179. if (res.data.keepType !== 'LABEL_RECEIPT') {
  180. this.tableData = res.data && res.data.financeBookList || []
  181. const no = 1
  182. for (var i = 0; i < this.tableData.length; i++) {
  183. this.tableData[i].no = no + i
  184. }
  185. }
  186. this.spinning = false
  187. })
  188. },
  189. // 获取审核信息
  190. getAuditInfo (auditList) {
  191. let auditStr = ''
  192. if (auditList && auditList.taskVOList) {
  193. const auditLists = auditList.taskVOList.filter(item => item.userType == '审批人')
  194. auditLists.map((a, i) => {
  195. auditStr = auditStr + a.userName + '(' + a.state + ')' + (i == auditLists.length - 1 ? '。' : ';')
  196. })
  197. }
  198. return auditStr
  199. },
  200. // 收款打印
  201. async handlePlPrint () {
  202. this.spinning = true
  203. let rows = []
  204. const bookSns = []
  205. this.tableData.map(item => {
  206. if (item.financeBookDetailList) {
  207. rows = rows.concat(item.financeBookDetailList)
  208. }
  209. })
  210. rows.map(item => {
  211. if (bookSns.indexOf(item.bookSn) < 0) {
  212. bookSns.push(item.bookSn)
  213. }
  214. })
  215. const retArr = []
  216. const auditInfo = await getBatchLastProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSnList': bookSns }).then(res => res.data)
  217. console.log(bookSns, auditInfo)
  218. bookSns.map(item => {
  219. // 授信明细
  220. const rs = rows.filter(a => a.bookSn == item)
  221. let detailItemUseStr = ''
  222. rs.map(b => {
  223. if (b.detailItemUseList) {
  224. b.detailItemUseList.map((k, i) => {
  225. detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ')' + (i == b.detailItemUseList.length - 1 ? '。' : ';')
  226. })
  227. }
  228. })
  229. // 审核信息
  230. const auditStr = this.getAuditInfo(auditInfo[item])
  231. retArr.push({ audit: auditStr, detail: detailItemUseStr, subList: rs })
  232. })
  233. console.log(retArr, '------------')
  234. if(retArr.length){
  235. this.handlePrint(retArr, rows)
  236. }else{
  237. this.$message.info("此收款单明细为空或没有相关数据权限")
  238. this.spinning = false
  239. }
  240. },
  241. // 收款打印
  242. handlePrint (row, list) {
  243. this.spinning = true
  244. this.showTipModal = true
  245. this.$nextTick(() => {
  246. // 审核信息
  247. this.$refs.printModel.getData(row, list)
  248. })
  249. },
  250. canselPrintView () {
  251. this.spinning = false
  252. this.showTipModal = false
  253. this.$refs.printModel.clearData()
  254. },
  255. // 取消
  256. handleCommonCancel () {
  257. this.$emit('cancel')
  258. this.detail = null
  259. this.tableData = []
  260. },
  261. // 打开关联收款单弹窗
  262. handleAssociated () {
  263. const snList = []
  264. snList.push(this.handlePlData.accountReceiptSn)
  265. this.showCollectDetail = true
  266. this.$nextTick(() => {
  267. this.$refs.collectDetailModal.setData([this.handlePlData], snList)
  268. })
  269. },
  270. // 关联收款成功
  271. relationSuccess () {
  272. this.handleCommonCancel()
  273. this.showCollectDetail = false
  274. }
  275. },
  276. watch: {
  277. // 父页面传过来的弹框状态
  278. openModal (newValue, oldValue) {
  279. this.isShow = newValue
  280. },
  281. // 重定义的弹框状态
  282. isShow (newValue, oldValue) {
  283. if (!newValue) {
  284. this.$emit('cancel')
  285. }
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang="less">
  291. .collection-detail-modal{
  292. .common-main{
  293. min-height:20vh;
  294. .toolsBar{
  295. display: flex;
  296. align-items: center;
  297. margin-bottom: 10px;
  298. .ant-btn{
  299. margin-left: 30px;
  300. }
  301. }
  302. }
  303. .btn-box{
  304. text-align: center;
  305. margin-top: 30px;
  306. .ant-btn{
  307. margin:0 10px;
  308. }
  309. }
  310. }
  311. </style>