receivable_list-detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <div>
  3. <div class="sty">
  4. <el-page-header @back="goBack"> </el-page-header>
  5. </div>
  6. <br />
  7. <span>基本信息</span>
  8. <el-divider></el-divider>
  9. <!-- 表头 -->
  10. <div>
  11. <el-form ref="searchForm" :model="searchForm" label-width="100px" size="small" label-position="left">
  12. <el-row :gutter="20">
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="单据类型" prop="">
  15. <el-input disabled v-model="searchForm.billType" placeholder=""></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :xs="24" :sm="12" :lg="6">
  19. <el-form-item label="单据编号" prop="">
  20. <el-input disabled v-model="searchForm.code" placeholder=""></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :xs="24" :sm="12" :lg="6">
  24. <el-form-item label="单据来源" prop="">
  25. <el-input disabled v-model="searchForm.source" placeholder=""></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :xs="24" :sm="12" :lg="6">
  29. <el-form-item label="单据状态" prop="">
  30. <el-input disabled v-model="searchForm.examineStatus" placeholder=""></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :xs="24" :sm="12" :lg="6">
  34. <el-form-item label="业务日期" prop="">
  35. <el-input disabled v-model="searchForm.theTime" placeholder=""></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :xs="24" :sm="12" :lg="6">
  39. <el-form-item label="到期日" prop="">
  40. <el-input disabled v-model="searchForm.endTime" placeholder=""></el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :xs="24" :sm="12" :lg="6">
  44. <el-form-item label="总金额" prop="">
  45. <el-input disabled v-model="searchForm.totalAmount" placeholder=""></el-input>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :xs="24" :sm="12" :lg="6">
  49. <el-form-item label="备注" prop="">
  50. <el-input disabled v-model="searchForm.remark" placeholder=""></el-input>
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. </el-form>
  55. </div>
  56. <span>明细</span>
  57. <el-divider></el-divider>
  58. <!-- 列表 -->
  59. <div class="mymain-container">
  60. <div class="table" v-if="czType === 'detail'">
  61. <el-table
  62. v-loading="listLoading"
  63. :data="dataList"
  64. element-loading-text="Loading"
  65. border
  66. fit
  67. highlight-current-row
  68. stripe
  69. >
  70. <el-table-column label="序号" align="left" type="index" width="100" show-overflow-tooltip></el-table-column>
  71. <el-table-column align="left" label="经销商编号" prop="customerNumber" min-width="160" show-overflow-tooltip>
  72. <template slot-scope="scope">
  73. <CopyButton :copyText="scope.row.customerNumber" />
  74. <span>{{ scope.row.customerNumber }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="260" show-overflow-tooltip>
  78. <template slot-scope="scope">
  79. <CopyButton :copyText="scope.row.customerName" />
  80. <span>{{ scope.row.customerName }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column
  84. align="left"
  85. label="*费用项目编码"
  86. prop="projectCode"
  87. min-width="160"
  88. show-overflow-tooltip
  89. ></el-table-column>
  90. <el-table-column
  91. align="left"
  92. label="项目费用名称"
  93. prop="projectName"
  94. min-width="160"
  95. show-overflow-tooltip
  96. ></el-table-column>
  97. <el-table-column
  98. align="left"
  99. label="*费用承担部门"
  100. prop="departmentId"
  101. min-width="160"
  102. show-overflow-tooltip
  103. ></el-table-column>
  104. <el-table-column
  105. align="left"
  106. label="*收入部门"
  107. prop="incomeDept"
  108. min-width="160"
  109. show-overflow-tooltip
  110. ></el-table-column>
  111. <el-table-column
  112. align="left"
  113. label="现金钱包"
  114. prop="customerWalletName"
  115. min-width="160"
  116. show-overflow-tooltip
  117. ></el-table-column>
  118. <el-table-column align="left" label="*发票类型" prop="invoiceType" min-width="160" show-overflow-tooltip>
  119. <template slot-scope="scope">
  120. <el-select disabled filterable v-model="scope.row.invoiceType" placeholder="请选择">
  121. <el-option label="普通发票" value=""> </el-option>
  122. <el-option label="增值税发票" value="1"> </el-option>
  123. <el-option label="机票" value="P"> </el-option>
  124. <el-option label="火车票" value="R"> </el-option>
  125. <el-option label="其他运输票" value="O"> </el-option>
  126. <el-option label="其他" value="E"> </el-option>
  127. </el-select>
  128. </template>
  129. </el-table-column>
  130. <!-- <el-table-column
  131. align="left"
  132. label="不含税金额"
  133. prop="afterTaxAmount"
  134. min-width="160"
  135. show-overflow-tooltip
  136. ></el-table-column>
  137. <el-table-column
  138. align="left"
  139. label="税额"
  140. prop="tax"
  141. min-width="160"
  142. show-overflow-tooltip
  143. ></el-table-column> -->
  144. <el-table-column
  145. align="right"
  146. label="总金额"
  147. prop="totalAmount"
  148. min-width="160"
  149. show-overflow-tooltip
  150. ></el-table-column>
  151. <el-table-column
  152. align="left"
  153. label="备注"
  154. prop="remark"
  155. min-width="160"
  156. show-overflow-tooltip
  157. ></el-table-column>
  158. </el-table>
  159. </div>
  160. <div class="table" v-if="czType === 'edit'">
  161. <el-table
  162. v-loading="listLoading"
  163. :data="dataList"
  164. element-loading-text="Loading"
  165. border
  166. fit
  167. highlight-current-row
  168. stripe
  169. :row-class-name="rouClassNameFn"
  170. @row-click="onRowClick"
  171. >
  172. <el-table-column align="left" label="序号">
  173. <template slot-scope="scope">
  174. {{ scope.$index + 1 }}
  175. </template>
  176. </el-table-column>
  177. <el-table-column align="left" label="*经销商名称" prop="customerName" min-width="300" show-overflow-tooltip>
  178. <template slot-scope="scope">
  179. <el-select
  180. class="selectClass"
  181. @change="changeCustomerFn($event, scope.$index)"
  182. v-model="scope.row.customerId"
  183. placeholder="请选择"
  184. filterable
  185. >
  186. <el-option v-for="(item, i) in customerList" :key="i" :label="item.name" :value="item.id"> </el-option>
  187. </el-select>
  188. </template>
  189. </el-table-column>
  190. <el-table-column align="left" label="费用项目编码" prop="projectCode" min-width="160" show-overflow-tooltip>
  191. <template slot-scope="scope">
  192. <el-input v-model="scope.row.projectCode"></el-input>
  193. </template>
  194. </el-table-column>
  195. <el-table-column align="left" label="*项目费用名称" prop="projectName" min-width="160" show-overflow-tooltip>
  196. <template slot-scope="scope">
  197. <el-input v-model="scope.row.projectName"></el-input>
  198. </template>
  199. </el-table-column>
  200. <el-table-column align="left" label="*费用承担部门" prop="departmentId" min-width="160" show-overflow-tooltip>
  201. <template slot-scope="scope">
  202. <el-input v-model="scope.row.departmentId"></el-input>
  203. </template>
  204. </el-table-column>
  205. <el-table-column align="left" label="*收入部门" prop="incomeDept" min-width="160" show-overflow-tooltip>
  206. <template slot-scope="scope">
  207. <el-input v-model="scope.row.incomeDept"></el-input>
  208. </template>
  209. </el-table-column>
  210. <el-table-column align="left" label="现金钱包" prop="walletId" min-width="160" show-overflow-tooltip>
  211. <template slot-scope="scope">
  212. <el-select filterable v-model="scope.row.customerWalletId" placeholder="请选择">
  213. <el-option
  214. v-for="item in scope.row.walletList"
  215. :key="item.customerWalletId"
  216. :label="item.customerWalletName"
  217. :value="item.customerWalletId"
  218. >
  219. </el-option>
  220. </el-select>
  221. </template>
  222. </el-table-column>
  223. <el-table-column align="left" label="*发票类型" prop="invoiceType" min-width="160" show-overflow-tooltip>
  224. <template slot-scope="scope">
  225. <!-- <el-input v-model="scope.row.invoiceType"></el-input> -->
  226. <el-select filterable v-model="scope.row.invoiceType" placeholder="请选择">
  227. <el-option label="普通发票" value=""> </el-option>
  228. <el-option label="增值税发票" value="1"> </el-option>
  229. <el-option label="机票" value="P"> </el-option>
  230. <el-option label="火车票" value="R"> </el-option>
  231. <el-option label="其他运输票" value="O"> </el-option>
  232. <el-option label="其他" value="E"> </el-option>
  233. </el-select>
  234. </template>
  235. </el-table-column>
  236. <!-- <el-table-column
  237. align="center"
  238. label="不含税金额"
  239. prop="afterTaxAmount"
  240. min-width="160"
  241. show-overflow-tooltip
  242. >
  243. <template slot-scope="scope">
  244. <el-input
  245. v-model="scope.row.afterTaxAmount"
  246. type="number" @mousewheel.native.prevent
  247. ></el-input>
  248. </template>
  249. </el-table-column>
  250. <el-table-column
  251. align="center"
  252. label="税额"
  253. prop="tax"
  254. min-width="160"
  255. show-overflow-tooltip
  256. >
  257. <template slot-scope="scope">
  258. <el-input type="number" @mousewheel.native.prevent v-model="scope.row.tax"></el-input>
  259. </template>
  260. </el-table-column> -->
  261. <el-table-column align="right" label="*总金额" prop="tax" min-width="160" show-overflow-tooltip>
  262. <template slot-scope="scope">
  263. <el-input
  264. class="mountclass"
  265. type="number"
  266. @mousewheel.native.prevent
  267. v-model="scope.row.totalAmount"
  268. ></el-input>
  269. </template>
  270. </el-table-column>
  271. <el-table-column align="left" label="税率%" prop="" min-width="160" show-overflow-tooltip>
  272. <template slot-scope="scope">
  273. <el-input
  274. type="number"
  275. @mousewheel.native.prevent
  276. :min="0"
  277. oninput="if(value>100)value=100;if(value<0)value=0"
  278. v-model="scope.row.taxRate"
  279. ></el-input>
  280. </template>
  281. </el-table-column>
  282. <el-table-column align="left" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  283. <template slot-scope="scope">
  284. <el-input v-model="scope.row.remark"></el-input>
  285. </template>
  286. </el-table-column>
  287. </el-table>
  288. </div>
  289. </div>
  290. <div v-if="examineStatus === 'FAIL' || examineStatus === 'OK'">
  291. <span>审批记录</span>
  292. <el-divider></el-divider>
  293. <div class="diy-table-1">
  294. <el-row :gutter="0">
  295. <el-col :span="8" class="item">
  296. <div class="label">审批人</div>
  297. <div class="value">{{ this.examineBy }}</div>
  298. </el-col>
  299. <el-col :span="8" class="item">
  300. <div class="label">审批结果</div>
  301. <div class="value">
  302. <el-radio-group v-model="examineStatus">
  303. <el-radio disabled label="OK">通过</el-radio>
  304. <el-radio disabled label="FAIL">驳回</el-radio>
  305. </el-radio-group>
  306. </div>
  307. </el-col>
  308. <el-col :span="8" class="item">
  309. <div class="label">审批时间</div>
  310. <div class="value">{{ this.examineTime }}</div>
  311. </el-col>
  312. <el-col :span="24" class="item">
  313. <div class="label">审批说明</div>
  314. <div class="value">
  315. {{ this.examineRemark }}
  316. </div>
  317. </el-col>
  318. </el-row>
  319. </div>
  320. </div>
  321. <!-- 按钮 -->
  322. <div class="btn-group clearfix">
  323. <div class="fl">
  324. <el-button v-if="czType == 'edit'" size="mini" type="primary" @click="saveFn">保存</el-button>
  325. </div>
  326. <div class="fr">
  327. <el-button type="primary" size="small" @click="addRowFn">添加行</el-button>
  328. <el-button type="primary" size="small" @click="delRowFn">删除行</el-button>
  329. </div>
  330. </div>
  331. <br />
  332. </div>
  333. </template>
  334. <script>
  335. import {
  336. getFinanceOtherReceDetail,
  337. getCustomerList,
  338. getFinanceCustomerList,
  339. getFinanceOtherReceUpdate
  340. } from '@/api/finance/receivable_list'
  341. export default {
  342. props: {
  343. approvalId: {
  344. type: String,
  345. required: true
  346. },
  347. czType: {
  348. type: String,
  349. required: true
  350. }
  351. },
  352. data() {
  353. return {
  354. customerList: [], //经销商数据
  355. dataList: [],
  356. listLoading: false, // 列表加载loading
  357. examineBy: '', //审核人
  358. examineTime: '', //审核时间
  359. examineStatus: null, //审核状态
  360. examineRemark: '', //审核备注
  361. searchForm: {
  362. billType: '',
  363. code: '',
  364. source: '',
  365. theTime: '',
  366. endTime: '',
  367. totalAmount: '',
  368. examineStatus: '',
  369. remark: ''
  370. }
  371. }
  372. },
  373. created() {
  374. this.getDataList()
  375. this.getCustomerList()
  376. },
  377. methods: {
  378. //保存
  379. async saveFn() {
  380. await getFinanceOtherReceUpdate({
  381. id: this.approvalId,
  382. items: this.dataList,
  383. examineStatus: this.examineStatus,
  384. code: this.searchForm.code
  385. })
  386. this.$message.success('编辑成功')
  387. this.$parent.showPage = 1
  388. },
  389. //选择经销商名称事件
  390. async changeCustomerFn(v, index) {
  391. // console.log(v, 322311);
  392. this.dataList[index].customerWalletId = ''
  393. const res = await getFinanceCustomerList({
  394. customerId: v,
  395. type: 'COMMONLY'
  396. })
  397. this.$set(this.dataList[index], 'walletList', res.data)
  398. console.log(this.dataList, 'kkk')
  399. // this.walletList = res.data;
  400. },
  401. //获取经销商数据
  402. async getCustomerList() {
  403. const res = await getCustomerList({ pageNum: 1, pageSize: -1 })
  404. this.customerList = res.data.records
  405. },
  406. rouClassNameFn({ row, rowIndex }) {
  407. //把每一行的索引放进row
  408. row.index = rowIndex
  409. },
  410. onRowClick(row, event, column) {
  411. this.delIndex = row.index
  412. },
  413. //删除行
  414. delRowFn() {
  415. this.dataList.splice(this.delIndex, 1)
  416. },
  417. //添加行数据
  418. addRowFn() {
  419. this.dataList.push({
  420. customerId: '',
  421. projectCode: 'FYXM01_SYS',
  422. projectName: '材料成本',
  423. departmentId: '',
  424. customerWalletId: '',
  425. invoiceType: '',
  426. incomeDept: '',
  427. // afterTaxAmount: "",
  428. // tax: "",
  429. totalAmount: '',
  430. taxRate: 13
  431. })
  432. },
  433. async getDataList() {
  434. const res = await getFinanceOtherReceDetail({ id: this.approvalId })
  435. // console.log(res, 123456);
  436. this.examineBy = res.data.examineBy
  437. this.examineTime = res.data.examineTime
  438. this.examineStatus = res.data.examineStatus
  439. this.examineRemark = res.data.examineRemark
  440. this.searchForm = {
  441. billType: res.data.billType,
  442. code: res.data.code,
  443. source: res.data.source,
  444. theTime: res.data.theTime,
  445. endTime: res.data.endTime,
  446. totalAmount: res.data.totalAmount,
  447. examineStatus:
  448. res.data.examineStatus == 'OK'
  449. ? '已通过'
  450. : res.data.examineStatus == 'FAIL'
  451. ? '不通过'
  452. : res.data.examineStatus == 'SAVE'
  453. ? '保存'
  454. : '待审核',
  455. remark: res.data.remark
  456. }
  457. // res.data.items.forEach((v) => {
  458. // this.changeCustomerFn(v.customerId, v.index);
  459. // });
  460. for (let index = 0; index < res.data.items.length; index++) {
  461. const a = await getFinanceCustomerList({
  462. customerId: res.data.items[index].customerId,
  463. type: 'COMMONLY'
  464. })
  465. res.data.items[index]['walletList'] = a.data
  466. // this.$set(this.dataList[index], "walletList", a.data);
  467. }
  468. this.dataList = res.data.items
  469. },
  470. goBack() {
  471. this.$parent.showPage = 1
  472. }
  473. }
  474. }
  475. </script>
  476. <style lang="scss" scoped>
  477. .selectClass {
  478. width: 100%;
  479. }
  480. </style>