policy_list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :exportList="exportList"
  6. :operation="operation()"
  7. :optionsEvensGroup="optionsEvensGroup"
  8. :columnParsing="columnParsing"
  9. :tableEvents="tableEvents"
  10. :tableAttributes="tableAttributes"
  11. >
  12. <Popu v-if="isShowDetail || isShowForm || isShowExamine || isShowReturn">
  13. <RetailDetail v-if="isShowDetail" :list-item="queryItem" @backListFormDetail="backList" />
  14. <RetailForm v-if="isShowForm" :list-item="queryItem" @backListFormDetail="backList" />
  15. <RetailExamine v-if="isShowExamine" :list-item="queryItem" @backListFormDetail="backList" />
  16. <RetailReturn v-if="isShowReturn" :list-item="queryItem" @backListFormDetail="backList" />
  17. <EditDateDialog :is-show.sync="isShowEditDateDialog" :date-form.sync="dateForm" />
  18. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  19. </Popu>
  20. </template-page>
  21. </template>
  22. <script>
  23. import TemplatePage from '@/components/template/template-page-1.vue'
  24. import import_mixin from '@/components/template/import_mixin.js'
  25. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  26. import Popu from '@/components/template/popu.vue'
  27. import {
  28. abandonData,
  29. closeData,
  30. deleteList,
  31. editData,
  32. examineData,
  33. getList,
  34. submitCancel,
  35. submitData,
  36. getRetailListV2,
  37. exportRetailListV2
  38. } from '@/api/supply/policy'
  39. import RetailDetail from './components/retail_detail'
  40. import RetailForm from './components/retail_form'
  41. import RetailExamine from './components/retail_examine'
  42. import RetailReturn from './components/retail_return'
  43. import EditDateDialog from '@/components/Common/edit-date-dialog'
  44. import ExamineDialog from '@/components/Common/examine-dialog'
  45. import { getSalesmanList, getCategoryList, getTypeList } from '@/api/common'
  46. import { getNoRebateWalletList } from '@/api/policy_list'
  47. export default {
  48. components: {
  49. TemplatePage,
  50. Popu,
  51. RetailDetail,
  52. RetailForm,
  53. RetailExamine,
  54. RetailReturn,
  55. EditDateDialog,
  56. ExamineDialog
  57. },
  58. mixins: [import_mixin, add_callback_mixin],
  59. data() {
  60. return {
  61. visible: false,
  62. // 事件组合
  63. optionsEvensGroup: [
  64. [
  65. [
  66. {
  67. name: '新增',
  68. click: this.addOn(() => {
  69. this.toForm()
  70. }),
  71. isRole: this.$checkBtnRole('add', this.$route.meta.roles)
  72. }
  73. ]
  74. ],
  75. [
  76. [
  77. {
  78. name: '批量审批',
  79. click: ()=>{
  80. this.batchExamine()
  81. },
  82. isRole: this.$checkBtnRole('examine', this.$route.meta.roles)
  83. }
  84. ]
  85. ]
  86. ],
  87. // 表格属性
  88. tableAttributes: {
  89. // 启用勾选列
  90. selectColumn: true
  91. }, // 关闭新增弹窗
  92. // 表格事件
  93. tableEvents: {
  94. 'selection-change': this.selectionChange
  95. },
  96. recordSelected: [],
  97. currentPage: 1, // 当前页码
  98. pageSize: 10, // 每页数量
  99. listTotal: 0, // 列表总数
  100. dataList: null, // 列表数据
  101. listLoading: false, // 列表加载loading
  102. screenForm: {
  103. // 筛选表单数据
  104. orderNum: '',
  105. policyCode: '',
  106. policyRemark: '',
  107. jxsName: '',
  108. date: [],
  109. zbMan: '',
  110. shMan: '',
  111. status: '',
  112. salesMan: '',
  113. isDirectTransfer: null,
  114. specification: '',
  115. k3ServiceId: '',
  116. serviceId: '',
  117. categoryNumber: '',
  118. saleTypeId: '',
  119. customerWalletId: ''
  120. },
  121. transfer: [
  122. { label: '是', value: true },
  123. { label: '否', value: false }
  124. ],
  125. statusList: [
  126. { label: '已保存', value: 'SAVE' },
  127. { label: '待审核', value: 'WAIT' },
  128. { label: '审核通过', value: 'OK' }
  129. // { label: '审核驳回', value: 'FAIL' },
  130. ],
  131. queryItem: {},
  132. isShowDetail: false,
  133. isShowForm: false,
  134. isShowExamine: false,
  135. isShowReturn: false,
  136. isShowEditDateDialog: false,
  137. dateForm: {
  138. date: ''
  139. },
  140. salesmanList: [],
  141. selectRow: [],
  142. recordSelected: [],
  143. isShowExamineDialog: false,
  144. examineForm: {
  145. status: 'OK',
  146. remark: ''
  147. },
  148. categoryList: [],
  149. isCollapse: true,
  150. NoRebateWalletList: [],
  151. typeList: []
  152. }
  153. },
  154. watch: {
  155. recordSelected(data) {
  156. // 监听选中状态
  157. this.selectRow = []
  158. if (data.length > 0) {
  159. data.forEach((item, index) => {
  160. this.selectRow.push(item.id)
  161. })
  162. }
  163. }
  164. },
  165. methods: {
  166. // 列表请求函数
  167. getList(...p) {
  168. this.recordSelected = []
  169. return getRetailListV2(...p)
  170. },
  171. // 列表导出函数
  172. exportList: exportRetailListV2,
  173. // 表格列解析渲染数据更改
  174. columnParsing(item, defaultData) {
  175. return defaultData
  176. },
  177. // 监听勾选变化
  178. selectionChange(data) {
  179. this.recordSelected = data
  180. },
  181. operation() {
  182. return (h, { row, index, column }) => {
  183. const statusData = JSON.parse("{\"FAIL_ONE\":\"初审不通过\",\"REJECT\":\"驳回\",\"OK_ONE_AND_CONFIRM\":\"已确认未复核\",\"ABANDON\":\"弃审\",\"SAVE\":\"保存\",\"CLOSE\":\"关闭\",\"OK\":\"审核通过\",\"WAIT\":\"待审核\",\"FAIL\":\"审核不通过\",\"OK_ONE\":\"初审通过\"}")
  184. return (
  185. <div class="operation-btns">
  186. {row.examineStatus === statusData['SAVE'] ? (
  187. <el-popconfirm style="margin-left: 10px" title="确定提审?" onOnConfirm={() => this.handleSubmit(row.id)}>
  188. <el-button slot="reference" type="text">
  189. 提审
  190. </el-button>
  191. </el-popconfirm>
  192. ) : null}
  193. {row.examineStatus ==statusData['WAIT'] && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  194. <el-button style="margin-left: 10px" type="text" onClick={() => this.toExamine(row)}>
  195. 审核
  196. </el-button>
  197. ) : null}
  198. {this.$checkBtnRole('del', this.$route.meta.roles) && row.examineStatus === statusData['SAVE'] ? (
  199. <el-popconfirm
  200. style="margin-left: 10px"
  201. title="确定删除吗?"
  202. onOnConfirm={() => this.handleDelete(row.id)}
  203. >
  204. <el-button slot="reference" type="text">
  205. 删除
  206. </el-button>
  207. </el-popconfirm>
  208. ) : null}
  209. {row.examineStatus === statusData['SAVE'] && this.$checkBtnRole('edit', this.$route.meta.roles) ? (
  210. <el-button style="margin-left: 10px" type="text" onClick="toForm(row)">
  211. 编辑
  212. </el-button>
  213. ) : null}
  214. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === statusData['OK'] ? (
  215. <el-popconfirm
  216. style="margin-left: 10px"
  217. title="确定弃审吗?"
  218. onOnConfirm={() => this.handleAbandon(row.id)}
  219. >
  220. <el-button slot="reference" type="text">
  221. 弃审
  222. </el-button>
  223. </el-popconfirm>
  224. ) : null}
  225. {row.examineStatus == statusData['WAIT'] && this.$checkBtnRole('apply', this.$route.meta.roles) ? (
  226. <el-popconfirm style="margin-left: 10px" title="确定撤回?" onOnConfirm={() => this.handleCancel(row.id)}>
  227. <el-button slot="reference" type="text">
  228. 撤回
  229. </el-button>
  230. </el-popconfirm>
  231. ) : null}
  232. <el-button style="margin-left: 10px" type="text" onClick={() => this.toDetail(row)}>
  233. 详情
  234. </el-button>
  235. {row.examineStatus === statusData['OK'] && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  236. <el-button style="margin-left: 10px" type="text" onClick={() => this.toReturn(row)}>
  237. 退订
  238. </el-button>
  239. ) : null}
  240. {row.examineStatus === statusData['SAVE'] && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  241. <el-popconfirm
  242. style="margin-left: 10px"
  243. title="确定关闭吗?"
  244. onOnConfirm={() => this.handleClose(row.id)}
  245. >
  246. <el-button slot="reference" type="text">
  247. 关闭
  248. </el-button>
  249. </el-popconfirm>
  250. ) : null}
  251. </div>
  252. )
  253. }
  254. },
  255. // 获取业务员列表
  256. getSalesmanList() {
  257. getSalesmanList({
  258. pageNum: 1,
  259. pageSize: -1,
  260. isCustomer: 0,
  261. status: true
  262. }).then(res => {
  263. this.salesmanList = res.data.records
  264. })
  265. getNoRebateWalletList({
  266. walletName: ''
  267. }).then(res => {
  268. console.log(res)
  269. this.NoRebateWalletList = res.data
  270. console.log(this.NoRebateWalletList)
  271. })
  272. getTypeList({ pageNum: 1, pageSize: -1 }).then(res => {
  273. this.typeList = res.data.records
  274. console.log(this.typeList)
  275. })
  276. },
  277. handleSelectionAllChange(e) {
  278. this.recordSelected = e
  279. if (e) {
  280. this.selections = e
  281. } else {
  282. this.selections = []
  283. }
  284. },
  285. rowClass({ row, rowIndex }) {
  286. if (this.selectRow.includes(row.id)) {
  287. return { 'background-color': '#ecf5ff' }
  288. }
  289. },
  290. // 打开 批量审批
  291. batchExamine() {
  292. if (this.recordSelected.length) {
  293. this.isShowExamineDialog = true
  294. return
  295. }
  296. this.$errorMsg('请选择审核项')
  297. },
  298. // 提交 批量审批
  299. submitExamineForm() {
  300. let ids = this.recordSelected.map(item => {
  301. return item.id
  302. })
  303. ids = [...new Set(ids)]
  304. examineData({
  305. id: ids.join(','),
  306. examineStatus: this.examineForm.status,
  307. examineRemark: this.examineForm.remark,
  308. serviceId: ''
  309. }).then(res => {
  310. this.isShowExamineDialog = false
  311. this.$successMsg('修改成功')
  312. this.$refs.pageRef.refreshList()
  313. })
  314. },
  315. // 查询按钮权限
  316. checkBtnRole(value) {
  317. // let btnRole = this.$route.meta.roles;
  318. // if(!btnRole) {return true}
  319. // let index = btnRole.indexOf(value);
  320. // return index >= 0;
  321. return true
  322. },
  323. handleDelete(id) {
  324. deleteList({ id }).then(res => {
  325. this.$successMsg('删除成功')
  326. this.$refs.pageRef.refreshList()
  327. })
  328. },
  329. // 提交筛选表单
  330. submitScreenForm() {
  331. this.currentPage = 1
  332. this.$refs.pageRef.refreshList()
  333. },
  334. // 重置筛选表单
  335. resetScreenForm() {
  336. this.$refs.screenForm.resetFields()
  337. this.currentPage = 1
  338. this.$refs.pageRef.refreshList()
  339. },
  340. // 更改每页数量
  341. handleSizeChange(val) {
  342. this.pageSize = val
  343. this.currentPage = 1
  344. this.$refs.pageRef.refreshList()
  345. },
  346. // 更改当前页
  347. handleCurrentChange(val) {
  348. this.currentPage = val
  349. this.$refs.pageRef.refreshList()
  350. },
  351. // 进入表单
  352. toForm(item) {
  353. this.queryItem = item
  354. this.isShowForm = true
  355. },
  356. // 进入详情
  357. toDetail(item) {
  358. this.queryItem = item
  359. this.isShowDetail = true
  360. },
  361. // 进入审批
  362. toExamine(item) {
  363. this.queryItem = item
  364. this.isShowExamine = true
  365. },
  366. // 进入退订
  367. toReturn(item) {
  368. this.queryItem = item
  369. this.isShowReturn = true
  370. },
  371. // 弃审
  372. handleAbandon(id) {
  373. abandonData({ id }).then(res => {
  374. this.$successMsg()
  375. this.$refs.pageRef.refreshList()
  376. })
  377. },
  378. backList() {
  379. this.queryItem = {}
  380. this.addOff(() => {
  381. this.isShowDetail = false
  382. this.isShowForm = false
  383. this.isShowExamine = false
  384. this.isShowReturn = false
  385. })()
  386. this.$refs.pageRef.refreshList()
  387. },
  388. // 关闭
  389. handleClose(id) {
  390. closeData({ id }).then(res => {
  391. this.$successMsg()
  392. this.$refs.pageRef.refreshList()
  393. })
  394. },
  395. // 提审
  396. handleSubmit(id) {
  397. submitData({ id }).then(res => {
  398. this.$successMsg()
  399. this.$refs.pageRef.refreshList()
  400. })
  401. },
  402. // 撤回
  403. handleCancel(id) {
  404. submitCancel({ id }).then(res => {
  405. this.$successMsg()
  406. this.$refs.pageRef.refreshList()
  407. })
  408. },
  409. // 打开 修改订单日期
  410. editDate(item) {
  411. this.editId = item.id
  412. this.dateForm.date = item.theTime.slice(0, 10)
  413. this.isShowEditDateDialog = true
  414. },
  415. // 提交 修改订单日期
  416. submitDateForm() {
  417. editData({
  418. id: this.editId,
  419. theTime: this.dateForm.date + ' 00:00:00'
  420. }).then(res => {
  421. this.isShowEditDateDialog = false
  422. this.$refs.pageRef.refreshList()
  423. this.$successMsg('修改成功')
  424. })
  425. },
  426. // 获取存货类别列表
  427. getCategoryList() {
  428. getCategoryList({
  429. pageNum: 1,
  430. pageSize: -1
  431. }).then(res => {
  432. this.categoryList = res.data.records
  433. })
  434. }
  435. }
  436. }
  437. </script>
  438. <style lang="scss" scoped></style>