policy_list.vue 13 KB

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