rebate_list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <template>
  2. <div style="width: 100%; height: 100%">
  3. <template-page
  4. v-show="showPage == 1"
  5. ref="pageRef"
  6. :operation="operation()"
  7. :optionsEvensGroup="optionsEvensGroup"
  8. :getList="getList"
  9. :exportList="exportList"
  10. :tableAttributes="tableAttributes"
  11. :tableEvents="tableEvents"
  12. :columnParsing="columnParsing"
  13. :replaceOrNotMap="false"
  14. :fieldBeansHook="fieldBeansHook"
  15. >
  16. <div slot="moreSearch">
  17. <div class="worker">
  18. <div class="worker_left">工单状态</div>
  19. <div class="worker_right">
  20. <el-button
  21. v-for="(item, index) in workerState"
  22. :key="index"
  23. :type="orderStatusParam == item.value ? 'primary' : null"
  24. @click="handleOrderStatusParam(item.value, index)"
  25. size="mini"
  26. >{{ item.label }}</el-button
  27. >
  28. </div>
  29. </div>
  30. </div>
  31. </template-page>
  32. <div class="app-container" v-if="showPage == 2">
  33. <RebateListApply
  34. :detailId="detailId"
  35. @setShowPage="
  36. val => {
  37. $refs.pageRef.refreshList()
  38. showPage = val
  39. }
  40. "
  41. />
  42. </div>
  43. <div class="app-container" v-if="showPage == 3">
  44. <RebateListExamine
  45. :detailId="detailId"
  46. @setShowPage="
  47. val => {
  48. $refs.pageRef.refreshList()
  49. showPage = val
  50. }
  51. "
  52. />
  53. </div>
  54. <div class="app-container" v-if="showPage == 4">
  55. <RebateListReview
  56. :detailId="detailId"
  57. @setShowPage="
  58. val => {
  59. $refs.pageRef.refreshList()
  60. showPage = val
  61. }
  62. "
  63. />
  64. </div>
  65. <div class="app-container" v-if="showPage == 5">
  66. <RebateListDetail
  67. :detailId="detailId"
  68. @setShowPage="
  69. val => {
  70. $refs.pageRef.refreshList()
  71. showPage = val
  72. }
  73. "
  74. />
  75. </div>
  76. <div class="app-container" v-if="showPage == 6">
  77. <RebateListConfirm
  78. :detailId="detailId"
  79. :isShow="isShow"
  80. @setShowPage="
  81. val => {
  82. $refs.pageRef.refreshList()
  83. showPage = val
  84. }
  85. "
  86. />
  87. </div>
  88. <div class="app-container" v-if="showPage == 7">
  89. <RebateListEdit
  90. :detailId="detailId"
  91. @setShowPage="
  92. val => {
  93. $refs.pageRef.refreshList()
  94. showPage = val
  95. }
  96. "
  97. />
  98. </div>
  99. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" @submit="submitExamineForm" />
  100. </div>
  101. </template>
  102. <script>
  103. import {
  104. getRebateOrderList,
  105. getRebateOrderApply,
  106. getRebateOrderBatchDel,
  107. getRebateOrderApplyBatch,
  108. getRebateOrderExamineBatch,
  109. getRebateOrderExamine2Batch
  110. } from '@/api/finance/rebate_list'
  111. import { rebateOrderList, rebateOrderListExport } from '@/api/finance/rebate_list_v2'
  112. import RebateListApply from './components/rebate_list-apply.vue'
  113. import RebateListExamine from './components/rebate_list-examine.vue'
  114. import RebateListReview from './components/rebate_list-review.vue'
  115. import RebateListDetail from './components/rebate_list-detail'
  116. import RebateListConfirm from './components/rebate_list-confirm'
  117. import RebateListEdit from './components/rebate_list-edit.vue'
  118. import ExamineDialog from '@/components/Common/examine-dialog'
  119. import TemplatePage from '@/components/template/template-page-1.vue'
  120. export default {
  121. name: 'rebate_list',
  122. components: {
  123. RebateListDetail,
  124. RebateListApply,
  125. RebateListExamine,
  126. RebateListReview,
  127. RebateListConfirm,
  128. RebateListEdit,
  129. ExamineDialog,
  130. TemplatePage
  131. },
  132. data() {
  133. return {
  134. orderStatusParam: '',
  135. workerState: [
  136. {
  137. label: '全部',
  138. value: ''
  139. },
  140. {
  141. label: '初审不通过',
  142. value: 'FAIL_ONE'
  143. },
  144. {
  145. label: '驳回',
  146. value: 'REJECT'
  147. },
  148. {
  149. label: '已确认未复核',
  150. value: 'OK_ONE_AND_CONFIRM'
  151. },
  152. {
  153. label: '弃审',
  154. value: 'ABANDON'
  155. },
  156. {
  157. label: '保存',
  158. value: 'SAVE'
  159. },
  160. {
  161. label: '关闭',
  162. value: 'CLOSE'
  163. },
  164. {
  165. label: '待审核',
  166. value: 'WAIT'
  167. },
  168. {
  169. label: '审核通过',
  170. value: 'OK'
  171. },
  172. {
  173. label: '初审不通过',
  174. value: 'FAIL'
  175. },
  176. {
  177. label: '初审通过',
  178. value: 'OK_ONE'
  179. }
  180. ],
  181. deleList: [],
  182. currentPage: 1, // 当前页码
  183. pageSize: 10, // 每页数量
  184. listTotal: 0, // 列表总数
  185. dataList: [], // 列表数据
  186. searchForm: {
  187. id: '',
  188. customerName: '',
  189. walletName: '',
  190. customerNumber: '',
  191. startTime: '',
  192. endTime: '',
  193. examineStatus: '',
  194. isConfirm: '',
  195. remark1: '',
  196. examineBy: '',
  197. createBy: ''
  198. }, //搜索表单
  199. listLoading: false, // 列表加载loading
  200. showPage: 1,
  201. detailId: null,
  202. isCustomer: null,
  203. secondId: null,
  204. isShow: false,
  205. isCollapse: true,
  206. isShowExamineDialog: false,
  207. examineForm: {
  208. status: '',
  209. remark: ''
  210. },
  211. state: '',
  212. // 表格属性
  213. tableAttributes: {
  214. // 启用勾选列
  215. selectColumn: true
  216. },
  217. // 表格事件
  218. tableEvents: {
  219. 'selection-change': this.selectionChange
  220. },
  221. recordSelected: [],
  222. examineStatus: '',
  223. customerIsConfirm: ''
  224. }
  225. },
  226. computed: {
  227. optionsEvensGroup() {
  228. return [
  229. [
  230. [
  231. {
  232. isRole: this.$checkBtnRole('del', this.$route.meta.roles),
  233. name: '批量删除',
  234. click: () => {
  235. if (!this.deleList.length) {
  236. this.$message.info('请选择数据!')
  237. return
  238. }
  239. this.$confirm('确定删除吗?', '提示', {
  240. confirmButtonText: '确定',
  241. cancelButtonText: '取消',
  242. type: 'warning'
  243. })
  244. .then(() => {
  245. this.deleFn()
  246. })
  247. .catch(() => {})
  248. }
  249. }
  250. ]
  251. ],
  252. [
  253. [
  254. {
  255. isRole: this.$checkBtnRole('apply', this.$route.meta.roles) && this.examineStatus === 'SAVE',
  256. name: '批量申请',
  257. click: () => {
  258. if (!this.deleList.length) {
  259. this.$message.info('请选择数据!')
  260. return
  261. }
  262. this.$confirm('确定执行批量申请吗?', '提示', {
  263. confirmButtonText: '确定',
  264. cancelButtonText: '取消',
  265. type: 'warning'
  266. })
  267. .then(() => {
  268. this.batchApplication()
  269. })
  270. .catch(() => {})
  271. }
  272. }
  273. ]
  274. ],
  275. [
  276. [
  277. {
  278. isRole: this.$checkBtnRole('examine', this.$route.meta.roles) && this.examineStatus === 'WAIT',
  279. name: '批量审核',
  280. click: () => {
  281. if (!this.deleList.length) {
  282. this.$message.info('请选择数据!')
  283. return
  284. }
  285. this.$confirm('确定执行批量审核吗?', '提示', {
  286. confirmButtonText: '确定',
  287. cancelButtonText: '取消',
  288. type: 'warning'
  289. })
  290. .then(() => {
  291. this.batchAudit('audit')
  292. })
  293. .catch(() => {})
  294. }
  295. }
  296. ]
  297. ],
  298. [
  299. [
  300. {
  301. isRole:
  302. this.$checkBtnRole('examine', this.$route.meta.roles) &&
  303. (this.examineStatus === 'OK_ONE_AND_CONFIRM' || this.customerIsConfirm === 'true'),
  304. name: '批量复核',
  305. click: () => {
  306. if (!this.deleList.length) {
  307. this.$message.info('请选择数据!')
  308. return
  309. }
  310. this.$confirm('确定执行批量复核吗?', '提示', {
  311. confirmButtonText: '确定',
  312. cancelButtonText: '取消',
  313. type: 'warning'
  314. })
  315. .then(() => {
  316. this.batchReview('review')
  317. })
  318. .catch(() => {})
  319. }
  320. }
  321. ]
  322. ]
  323. ]
  324. }
  325. // isCustomer() {
  326. // return this.$store.getters.customerId && this.$store.getters.customerNumber
  327. // }
  328. },
  329. watch: {
  330. $route() {
  331. if (this.$route.path === '/finance/rebate_list' && this.$route.query?.refreshList == 'true') {
  332. this.$refs.pageRef.refreshList()
  333. }
  334. }
  335. },
  336. created() {
  337. const res = JSON.parse(localStorage.getItem('supply_user'))
  338. this.isCustomer = res.isCustomer
  339. if (this.$route.query.id) {
  340. if (this.isCustomer) {
  341. this.confirmFn(this.$route.query.id, false)
  342. } else {
  343. this.examineFn(this.$route.query.id)
  344. }
  345. }
  346. },
  347. methods: {
  348. handleOrderStatusParam(value, index) {
  349. this.orderStatusParam = value
  350. this.$refs.pageRef.refreshList()
  351. },
  352. // 列表请求函数
  353. getList(p) {
  354. var item = p.params.find(item => item.param === 'a.examine_status')
  355. this.examineStatus = item?.value || ''
  356. var item2 = p.params.find(item => item.param === 'a.customer_is_confirm')
  357. this.customerIsConfirm = item2?.value || ''
  358. console.log(p)
  359. let params = {
  360. moduleId: p.moduleId,
  361. orderBy: p.orderBy,
  362. pageNum: p.pageNum,
  363. pageSize: p.pageSize,
  364. examineStatus: this.orderStatusParam,
  365. params: [...p.params]
  366. }
  367. return rebateOrderList(params)
  368. },
  369. // 列表导出函数
  370. exportList: rebateOrderListExport,
  371. // 表格列解析渲染数据更改
  372. columnParsing(item, defaultData) {
  373. return defaultData
  374. },
  375. // 监听勾选变化
  376. selectionChange(data) {
  377. const res = data.map(v => v.rebateOrderId)
  378. this.deleList = res
  379. },
  380. fieldBeansHook(val) {
  381. val.map(item => {
  382. if (~['examine_status'].indexOf(item.colName)) {
  383. item.isQuery = false
  384. }
  385. })
  386. return val
  387. },
  388. operation() {
  389. return (h, { row, index, column }) => {
  390. return (
  391. <div class="operation-btns">
  392. {!this.isCustomer &&
  393. this.$checkBtnRole('edit', this.$route.meta.roles) &&
  394. row.examineStatus != 'FAIL_ONE' ? (
  395. <el-button
  396. type="text"
  397. class="textColor"
  398. onClick={() => {
  399. this.editFn(row.rebateOrderId)
  400. }}
  401. >
  402. 编辑
  403. </el-button>
  404. ) : null}
  405. {row.examineStatus == 'SAVE' && !this.isCustomer && this.$checkBtnRole('apply', this.$route.meta.roles) ? (
  406. <el-button
  407. type="text"
  408. class="textColor"
  409. onClick={() => {
  410. this.applyFn(row.rebateOrderId)
  411. }}
  412. >
  413. 申请
  414. </el-button>
  415. ) : null}
  416. {row.examineStatus == 'WAIT' &&
  417. !this.isCustomer &&
  418. this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  419. <el-button
  420. type="text"
  421. class="textColor"
  422. onClick={() => {
  423. this.examineFn(row.rebateOrderId)
  424. }}
  425. >
  426. 审核
  427. </el-button>
  428. ) : null}
  429. {(row.examineStatus == 'OK_ONE' || row.examineStatus == 'OK' || row.examineStatus == 'FAIL') &&
  430. !this.isCustomer &&
  431. this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  432. <el-button
  433. type="text"
  434. class="textColor"
  435. onClick={() => {
  436. this.reviewFn(row.rebateOrderId)
  437. }}
  438. >
  439. {row.examineStatus == 'OK' ? '取消复核' : '复核'}
  440. </el-button>
  441. ) : null}
  442. {(row.examineStatus == 'WAIT' || row.examineStatus == 'SAVE') && !this.isCustomer ? (
  443. <el-button
  444. type="text"
  445. class="textColor"
  446. onClick={() => {
  447. this.infoFn(row.rebateOrderId)
  448. }}
  449. >
  450. 详情
  451. </el-button>
  452. ) : null}
  453. {(row.examineStatus == 'OK_ONE' ||
  454. row.examineStatus == 'FAIL_ONE' ||
  455. row.examineStatus == 'FAIL' ||
  456. row.examineStatus == 'OK') &&
  457. !this.isCustomer ? (
  458. <el-button
  459. type="text"
  460. class="textColor"
  461. onClick={() => {
  462. this.detail2(row.rebateOrderId)
  463. }}
  464. >
  465. 详情
  466. </el-button>
  467. ) : null}
  468. {this.isCustomer &&
  469. row.withholdAmount == 0 &&
  470. (row.examineStatus == 'OK_ONE' || row.examineStatus == 'OK' || row.examineStatus == 'FAIL') ? (
  471. <el-button
  472. type="text"
  473. class="textColor"
  474. onClick={() => {
  475. this.confirmFn(row.rebateOrderId, row.customerIsConfirm)
  476. }}
  477. >
  478. {row.customerIsConfirm == false ? '确定' : '详情'}
  479. </el-button>
  480. ) : null}
  481. </div>
  482. )
  483. }
  484. },
  485. // ------------------------------------
  486. //批量复核
  487. batchReview(value) {
  488. this.state = value
  489. this.isShowExamineDialog = true
  490. },
  491. //批量审核
  492. batchAudit(value) {
  493. this.state = value
  494. this.isShowExamineDialog = true
  495. },
  496. //提交批量审核
  497. async submitExamineForm() {
  498. let res = this.deleList.toString()
  499. if (this.state === 'audit') {
  500. await getRebateOrderExamineBatch({
  501. ids: res,
  502. examineStatus: this.examineForm.status,
  503. examineRemark: this.examineForm.remark
  504. })
  505. this.$message.success('批量审核成功')
  506. } else {
  507. await getRebateOrderExamine2Batch({
  508. ids: res,
  509. examineStatus: this.examineForm.status,
  510. examineRemark: this.examineForm.remark
  511. })
  512. this.$message.success('批量复核成功')
  513. }
  514. this.deleList = []
  515. this.isShowExamineDialog = false
  516. this.getDataList()
  517. },
  518. //批量申请
  519. async batchApplication() {
  520. let res = this.deleList.toString()
  521. await getRebateOrderApplyBatch({ ids: res })
  522. this.getDataList()
  523. this.$message.success('批量申请成功')
  524. this.deleList = []
  525. },
  526. //删除
  527. async deleFn() {
  528. let res = this.deleList.toString()
  529. await getRebateOrderBatchDel({ ids: res })
  530. this.getDataList()
  531. this.$message.success('删除成功')
  532. this.deleList = []
  533. },
  534. //获取列表数据
  535. async getDataList() {
  536. this.$refs.pageRef.refreshList()
  537. },
  538. //确认
  539. confirmFn(id, isShow) {
  540. this.isShow = isShow
  541. this.detailId = id
  542. this.showPage = 6
  543. },
  544. //复核
  545. reviewFn(id) {
  546. this.detailId = id
  547. this.showPage = 4
  548. },
  549. //审核
  550. examineFn(id) {
  551. this.detailId = id
  552. this.showPage = 3
  553. },
  554. //申请
  555. async applyFn(id) {
  556. await getRebateOrderApply({ id })
  557. this.getDataList()
  558. this.$message.success('申请成功')
  559. },
  560. //详情2
  561. detail2(id) {
  562. this.detailId = id
  563. this.showPage = 2
  564. },
  565. //详情
  566. infoFn(id) {
  567. this.detailId = id
  568. this.showPage = 5
  569. },
  570. //编辑
  571. editFn(id) {
  572. this.detailId = id
  573. this.showPage = 7
  574. }
  575. }
  576. }
  577. </script>
  578. <style lang="scss" scoped>
  579. .worker {
  580. display: flex;
  581. justify-content: space-between;
  582. .worker_left {
  583. font-size: 12px;
  584. font-weight: 400;
  585. text-align: left;
  586. color: #666;
  587. line-height: 28px;
  588. margin-right: 10px;
  589. }
  590. .worker_right {
  591. flex: 1;
  592. ::v-deep .el-button {
  593. margin: 0 10px 10px 0px;
  594. }
  595. }
  596. }
  597. .selectStyle {
  598. width: 100%;
  599. }
  600. </style>