voucherModal.vue 12 KB

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