edit.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="financialCollectionAddwrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="financialCollectionAddcont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack(0)"><a-icon type="left" /> 返回列表</a>
  8. </template>
  9. </a-page-header>
  10. <a-collapse :activeKey="['1']" class="financialCollectionAddcont" v-if="detailData">
  11. <a-collapse-panel key="1" header="基础信息">
  12. <div slot="extra" style="padding: 0 20px; color: #00aaff;" @click.stop="handleEditBase" >
  13. <a-icon type="edit" /> 编辑基础信息
  14. </div>
  15. <a-descriptions :column="{ xs: 2, sm: 3, md: 3}">
  16. <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
  19. <a-descriptions-item span="2" label="收款事由">{{ detailData&&detailData.bookReason || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="状态">{{ detailData&&detailData.statusDictValue || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks||'--' }}</a-descriptions-item>
  22. <a-descriptions-item label="附件" :span="3">
  23. <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.attachmentList" :key="item.id">
  24. {{ item.fileName }}
  25. </a>
  26. </a-descriptions-item>
  27. </a-descriptions>
  28. </a-collapse-panel>
  29. </a-collapse>
  30. <!-- 财务明细 -->
  31. <a-card :bordered="false" size="small" class="financialCollectionAddcont" v-if="$route.params.sn">
  32. <div slot="title">
  33. <div style="display: flex;justify-content: space-between;align-items: center;">
  34. <div>财务明细</div>
  35. <div>
  36. <a-button size="small" class="button-error" type="primary" @click="handleEdit">新增收款明细</a-button>
  37. </div>
  38. </div>
  39. </div>
  40. <a-alert type="info" style="margin-bottom:10px" v-if="detailData">
  41. <div slot="message">
  42. 共 {{ total }} 条,
  43. 订单金额合计¥{{ detailData.orderTotalAmount }},
  44. 收款金额合计¥{{ detailData.receiptTotalAmount }},
  45. 使用授信合计¥{{ detailData.useTotalAmount }},
  46. 授信还款合计¥{{ detailData.payTotalAmount }},
  47. 余款抵扣合计¥{{ detailData.balanceTotalAmount }}
  48. </div>
  49. </a-alert>
  50. <!-- 列表 -->
  51. <s-table
  52. class="sTable fixPagination"
  53. ref="table"
  54. size="small"
  55. :rowKey="(record) => record.id"
  56. :columns="columns"
  57. :data="loadData"
  58. :defaultLoadData="false"
  59. :showPagination="false"
  60. bordered>
  61. <template slot="expandedRowRender" slot-scope="record">
  62. <div style="padding:10px;overflow: hidden;" v-if="record.detailItemUseList.length || record.detailItemPayList.length">
  63. <a-table
  64. style="width:45%;background:#fff;float:left;border-bottom: 1px solid #eee;"
  65. :bordered="false"
  66. :pagination="false"
  67. :columns="useCol"
  68. :data-source="record.detailItemUseList">
  69. </a-table>
  70. <a-table
  71. :bordered="false"
  72. style="width:45%;background:#fff;float:left;border-bottom: 1px solid #eee;margin-left:2%;"
  73. :pagination="false"
  74. :columns="payCol"
  75. :data-source="record.detailItemPayList">
  76. </a-table>
  77. </div>
  78. <div style="padding:10px;text-align:center;" v-else>暂无数据</div>
  79. </template>
  80. <!-- 付款账户(营业执照) -->
  81. <template slot="payerAccountInfo" slot-scope="record">
  82. {{ record.payerAccountInfo || '--' }}
  83. </template>
  84. <template slot="action" slot-scope="text,record">
  85. <a-button
  86. size="small"
  87. type="link"
  88. class="button-info"
  89. @click="handleEdit(record)"
  90. >编辑</a-button>
  91. <a-button
  92. size="small"
  93. type="link"
  94. class="button-error"
  95. @click="handleDel(record)"
  96. >删除</a-button>
  97. </template>
  98. </s-table>
  99. </a-card>
  100. </a-spin>
  101. <div class="affix-cont">
  102. <a-button
  103. type="primary"
  104. class="button-primary"
  105. :disabled="spinning"
  106. id="financialCollectionAddsubmit-btn"
  107. size="large"
  108. @click="beforeSubmit"
  109. style="padding: 0 60px;">提交</a-button>
  110. </div>
  111. <!-- 基础信息 -->
  112. <baseModal
  113. ref="baseModal"
  114. @refashData="refashData"
  115. :show="openBaseModal"
  116. :itemSn="$route.params.sn"
  117. @cancel="openBaseModal=false"></baseModal>
  118. <!-- 明细弹框 -->
  119. <fcDetailModal
  120. ref="fcDetailModal"
  121. @refashData="fcDetailOk"
  122. :show="openFcDetailModal"
  123. :bookSn="$route.params.sn"
  124. :bookNo="detailData?detailData.bookNo:''"
  125. @cancel="openFcDetailModal=false"></fcDetailModal>
  126. <!-- 选择审核人员 -->
  127. <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
  128. </div>
  129. </template>
  130. <script>
  131. import { commonMixin } from '@/utils/mixin'
  132. import { VSelect, STable } from '@/components'
  133. import baseModal from './baseModal.vue'
  134. import fcDetailModal from './fcDetailModal.vue'
  135. import chooseDepartUserModal from '../../expenseManagement/expenseReimbursement/chooseDepartUserModal.vue'
  136. import { financeBookFindBySn, financeBookDetailDelete, financeBookDetailQueryList, financeBookSubmit } from '@/api/financeBook.js'
  137. export default {
  138. name: 'FinancialCollectionEdit',
  139. mixins: [commonMixin],
  140. components: { VSelect, STable, baseModal, fcDetailModal, chooseDepartUserModal },
  141. data () {
  142. return {
  143. spinning: false,
  144. detailData: null,
  145. openBaseModal: false,
  146. openDepartUserModal: false,
  147. openFcDetailModal: false, // 财务明细弹框
  148. total: 0,
  149. loadData: parameter => {
  150. const params = Object.assign(parameter, { bookSn: this.$route.params.sn })
  151. return financeBookDetailQueryList(params).then(res => {
  152. let data
  153. if (res.status == 200) {
  154. data = res.data
  155. const no = 0
  156. for (var i = 0; i < data.length; i++) {
  157. data[i].no = no + i + 1
  158. // 计算使用授信和授信还款的合计
  159. data[i].useTotalAmount = this.getTotal(data[i].detailItemUseList)
  160. data[i].payTotalAmount = this.getTotal(data[i].detailItemPayList)
  161. }
  162. this.total = data.length
  163. this.disabled = false
  164. this.spinning = false
  165. }
  166. return data
  167. })
  168. },
  169. columns: [
  170. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  171. { title: '收款日期', dataIndex: 'receiptDate', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  172. { title: '付款方类型', dataIndex: 'payerTypeDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  173. { title: '付款方', dataIndex: 'payerName', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
  174. { title: '财务编码', dataIndex: 'dealerEntity.kdMidCustomerFnumber', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  175. { title: '付款账户(营业执照)', scopedSlots: { customRender: 'payerAccountInfo' }, align: 'center', width: '7%' },
  176. { title: '订单金额', dataIndex: 'orderAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  177. { title: '收款金额', dataIndex: 'receiptAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  178. { title: '使用授信', dataIndex: 'useTotalAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  179. { title: '授信还款', dataIndex: 'payTotalAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  180. { title: '余款抵扣', dataIndex: 'balanceAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  181. { title: '跨月打款', dataIndex: 'nextMonthAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  182. { title: '户名', dataIndex: 'bankAccount', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
  183. { title: '汇入银行', dataIndex: 'bankName', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
  184. { title: '足额打款', dataIndex: 'fullPaymentFlagDictValue', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  185. { title: '说明', dataIndex: 'remarks', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  186. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  187. ],
  188. useCol: [
  189. { title: '使用授信项目', dataIndex: 'itemName', width: '50%', align: 'center' },
  190. { title: '使用授信金额', dataIndex: 'itemAmount', width: '50%', align: 'center' }
  191. ],
  192. payCol: [
  193. { title: '授信还款项目', dataIndex: 'itemName', width: '50%', align: 'center' },
  194. { title: '授信还款金额', dataIndex: 'itemAmount', width: '50%', align: 'center' }
  195. ]
  196. }
  197. },
  198. methods: {
  199. getTotal (data) {
  200. let ret = 0
  201. data.map(item => {
  202. ret = ret + item.itemAmount
  203. })
  204. return ret.toFixed(2)
  205. },
  206. // 编辑基础信息
  207. handleEditBase (event) {
  208. this.openBaseModal = true
  209. this.$refs.baseModal.getDetail()
  210. },
  211. refashData () {
  212. this.getDetail(1)
  213. },
  214. // 财务单基础详情
  215. getDetail (type) {
  216. this.spinning = true
  217. this.disabled = true
  218. financeBookFindBySn({ bookSn: this.$route.params.sn }).then(res => {
  219. if (res.status == 200) {
  220. this.detailData = res.data
  221. if (!type) {
  222. // 刷新明细列表
  223. this.$refs.table.refresh()
  224. } else {
  225. this.spinning = false
  226. this.disabled = false
  227. }
  228. }
  229. })
  230. },
  231. // 新增明细成功
  232. fcDetailOk () {
  233. this.openFcDetailModal = false
  234. this.getDetail(false)
  235. },
  236. // 新增、编辑明细
  237. handleEdit (row) {
  238. this.openFcDetailModal = true
  239. if (row && row.bookDetailSn) {
  240. this.$refs.fcDetailModal.getDetail(row.bookDetailSn)
  241. }
  242. },
  243. // 删除明细
  244. handleDel (row) {
  245. const _this = this
  246. this.$confirm({
  247. title: '提示',
  248. content: '确认要删除吗?',
  249. centered: true,
  250. closable: true,
  251. onOk () {
  252. _this.spinning = true
  253. financeBookDetailDelete({ bookDetailSn: row.bookDetailSn }).then(res => {
  254. if (res.status == 200) {
  255. _this.$message.success(res.message)
  256. _this.getDetail(false)
  257. _this.spinning = false
  258. } else {
  259. _this.spinning = false
  260. }
  261. })
  262. }
  263. })
  264. },
  265. beforeSubmit () {
  266. if (this.total) {
  267. this.openDepartUserModal = true
  268. } else {
  269. this.$message.info('请新增财务明细')
  270. }
  271. },
  272. // 提交信息
  273. handleSubmit (data) {
  274. this.spinning = true
  275. financeBookSubmit({ bookSn: this.$route.params.sn, ...data }).then(res => {
  276. if (res.status == '200') {
  277. this.$message.success(res.message)
  278. this.handleBack()
  279. }
  280. this.spinning = false
  281. })
  282. },
  283. // 返回
  284. handleBack (data) {
  285. this.$router.push({ name: 'financialCollectionList' })
  286. },
  287. pageInit () {
  288. if (this.$route.params.sn) { // 编辑页
  289. this.getDetail(false)
  290. }
  291. }
  292. },
  293. mounted () {
  294. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  295. this.pageInit()
  296. }
  297. },
  298. activated () {
  299. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  300. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  301. this.pageInit()
  302. } else {
  303. // 刷新明细列表
  304. this.$refs.table.refresh()
  305. }
  306. },
  307. beforeRouteEnter (to, from, next) {
  308. next(vm => {})
  309. }
  310. }
  311. </script>
  312. <style lang="less">
  313. .financialCollectionAddwrap{
  314. position: relative;
  315. height: 100%;
  316. padding-bottom: 51px;
  317. box-sizing: border-box;
  318. >.ant-spin-nested-loading{
  319. overflow-y: scroll;
  320. height: 100%;
  321. }
  322. .financialCollectionAddcont{
  323. margin-bottom: 10px;
  324. }
  325. .affix{
  326. .ant-affix{
  327. z-index: 101;
  328. }
  329. }
  330. }
  331. </style>