rebate_list.vue 14 KB

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