edit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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. <template slot="action" slot-scope="text,record">
  81. <a-button
  82. size="small"
  83. type="link"
  84. class="button-info"
  85. @click="handleEdit(record)"
  86. >编辑</a-button>
  87. <a-button
  88. size="small"
  89. type="link"
  90. class="button-error"
  91. @click="handleDel(record)"
  92. >删除</a-button>
  93. </template>
  94. </s-table>
  95. </a-card>
  96. </a-spin>
  97. <div class="affix-cont">
  98. <a-button
  99. type="primary"
  100. class="button-primary"
  101. :disabled="spinning"
  102. id="financialCollectionAddsubmit-btn"
  103. size="large"
  104. @click="beforeSubmit"
  105. style="padding: 0 60px;">提交</a-button>
  106. </div>
  107. <!-- 基础信息 -->
  108. <baseModal
  109. ref="baseModal"
  110. @refashData="refashData"
  111. :show="openBaseModal"
  112. :itemSn="$route.params.sn"
  113. @cancel="openBaseModal=false"></baseModal>
  114. <!-- 明细弹框 -->
  115. <fcDetailModal
  116. ref="fcDetailModal"
  117. @refashData="fcDetailOk"
  118. :show="openFcDetailModal"
  119. :bookSn="$route.params.sn"
  120. :bookNo="detailData?detailData.bookNo:''"
  121. @cancel="openFcDetailModal=false"></fcDetailModal>
  122. <!-- 选择审核人员 -->
  123. <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
  124. </div>
  125. </template>
  126. <script>
  127. import { commonMixin } from '@/utils/mixin'
  128. import { VSelect, STable } from '@/components'
  129. import baseModal from './baseModal.vue'
  130. import fcDetailModal from './fcDetailModal.vue'
  131. import chooseDepartUserModal from '../../expenseManagement/expenseReimbursement/chooseDepartUserModal.vue'
  132. import { financeBookFindBySn, financeBookDetailDelete, financeBookDetailQueryList, financeBookSubmit } from '@/api/financeBook.js'
  133. export default {
  134. name: 'FinancialCollectionEdit',
  135. mixins: [commonMixin],
  136. components: { VSelect, STable, baseModal, fcDetailModal, chooseDepartUserModal },
  137. data () {
  138. return {
  139. spinning: false,
  140. detailData: null,
  141. openBaseModal: false,
  142. openDepartUserModal: false,
  143. openFcDetailModal: false, // 财务明细弹框
  144. total: 0,
  145. loadData: parameter => {
  146. const params = Object.assign(parameter, { bookSn: this.$route.params.sn })
  147. return financeBookDetailQueryList(params).then(res => {
  148. let data
  149. if (res.status == 200) {
  150. data = res.data
  151. const no = 0
  152. for (var i = 0; i < data.length; i++) {
  153. data[i].no = no + i + 1
  154. // 计算使用授信和授信还款的合计
  155. data[i].useTotalAmount = this.getTotal(data[i].detailItemUseList)
  156. data[i].payTotalAmount = this.getTotal(data[i].detailItemPayList)
  157. }
  158. this.total = data.length
  159. this.disabled = false
  160. this.spinning = false
  161. }
  162. return data
  163. })
  164. },
  165. columns: [
  166. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  167. { title: '收款日期', dataIndex: 'receiptDate', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  168. { title: '客户名称', dataIndex: 'dealerEntity.dealerName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  169. { title: '客户编码', dataIndex: 'dealerEntity.kdMidCustomerFnumber', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  170. { title: '营业执照名称', dataIndex: 'dealerEntity.licenseName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  171. { title: '订单金额', dataIndex: 'orderAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  172. { title: '收款金额', dataIndex: 'receiptAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  173. { title: '使用授信', dataIndex: 'useTotalAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  174. { title: '授信还款', dataIndex: 'payTotalAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  175. { title: '跨月打款', dataIndex: 'nextMonthAmount', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  176. { title: '户名', dataIndex: 'bankAccount', align: 'center', width: '5%', customRender: function (text) { return text || '--' } },
  177. { title: '汇入银行', dataIndex: 'bankName', align: 'center', width: '5%', customRender: function (text) { return text || '--' } },
  178. { title: '足额打款', dataIndex: 'fullPaymentFlagDictValue', align: 'center', width: '5%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
  179. { title: '备注', dataIndex: 'remarks', align: 'center', width: '13%', customRender: function (text) { return text || '--' } },
  180. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  181. ],
  182. useCol: [
  183. { title: '使用授信项目', dataIndex: 'itemName', width: '50%', align: 'center' },
  184. { title: '使用授信金额', dataIndex: 'itemAmount', width: '50%', align: 'center' }
  185. ],
  186. payCol: [
  187. { title: '授信还款项目', dataIndex: 'itemName', width: '50%', align: 'center' },
  188. { title: '授信还款金额', dataIndex: 'itemAmount', width: '50%', align: 'center' }
  189. ]
  190. }
  191. },
  192. methods: {
  193. getTotal (data) {
  194. let ret = 0
  195. data.map(item => {
  196. ret = ret + item.itemAmount
  197. })
  198. return ret.toFixed(2)
  199. },
  200. // 编辑基础信息
  201. handleEditBase (event) {
  202. this.openBaseModal = true
  203. this.$refs.baseModal.getDetail()
  204. },
  205. refashData () {
  206. this.getDetail(1)
  207. },
  208. // 财务单基础详情
  209. getDetail (type) {
  210. this.spinning = true
  211. this.disabled = true
  212. financeBookFindBySn({ bookSn: this.$route.params.sn }).then(res => {
  213. if (res.status == 200) {
  214. this.detailData = res.data
  215. if (!type) {
  216. // 刷新明细列表
  217. this.$refs.table.refresh()
  218. } else {
  219. this.spinning = false
  220. this.disabled = false
  221. }
  222. }
  223. })
  224. },
  225. // 新增明细成功
  226. fcDetailOk () {
  227. this.openFcDetailModal = false
  228. this.getDetail(false)
  229. },
  230. // 新增、编辑明细
  231. handleEdit (row) {
  232. this.openFcDetailModal = true
  233. if (row && row.bookDetailSn) {
  234. this.$refs.fcDetailModal.getDetail(row.bookDetailSn)
  235. }
  236. },
  237. // 删除明细
  238. handleDel (row) {
  239. const _this = this
  240. this.$confirm({
  241. title: '提示',
  242. content: '确认要删除吗?',
  243. centered: true,
  244. closable: true,
  245. onOk () {
  246. _this.spinning = true
  247. financeBookDetailDelete({ bookDetailSn: row.bookDetailSn }).then(res => {
  248. if (res.status == 200) {
  249. _this.$message.success(res.message)
  250. _this.getDetail(false)
  251. _this.spinning = false
  252. } else {
  253. _this.spinning = false
  254. }
  255. })
  256. }
  257. })
  258. },
  259. beforeSubmit () {
  260. if (this.total) {
  261. this.openDepartUserModal = true
  262. } else {
  263. this.$message.info('请新增财务明细')
  264. }
  265. },
  266. // 提交信息
  267. handleSubmit (data) {
  268. this.spinning = true
  269. financeBookSubmit({ bookSn: this.$route.params.sn, ...data }).then(res => {
  270. if (res.status == '200') {
  271. this.$message.success(res.message)
  272. this.handleBack()
  273. }
  274. this.spinning = false
  275. })
  276. },
  277. // 返回
  278. handleBack (data) {
  279. this.$router.push({ name: 'financialCollectionList' })
  280. },
  281. pageInit () {
  282. if (this.$route.params.sn) { // 编辑页
  283. this.getDetail()
  284. }
  285. }
  286. },
  287. mounted () {
  288. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  289. this.pageInit()
  290. }
  291. },
  292. activated () {
  293. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  294. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  295. this.pageInit()
  296. }
  297. },
  298. beforeRouteEnter (to, from, next) {
  299. next(vm => {})
  300. }
  301. }
  302. </script>
  303. <style lang="less">
  304. .financialCollectionAddwrap{
  305. position: relative;
  306. height: 100%;
  307. padding-bottom: 51px;
  308. box-sizing: border-box;
  309. >.ant-spin-nested-loading{
  310. overflow-y: scroll;
  311. height: 100%;
  312. }
  313. .financialCollectionAddcont{
  314. margin-bottom: 10px;
  315. }
  316. .affix{
  317. .ant-affix{
  318. z-index: 101;
  319. }
  320. }
  321. }
  322. </style>