edit.vue 14 KB

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