policy_list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" @submit="submitExamineForm" />
  13. <EditDateDialog :is-show.sync="isShowEditDateDialog" :date-form.sync="dateForm" @submit="submitDateForm" />
  14. <Popu v-if="isShowDetail || isShowForm || isShowExamine || isShowReturn">
  15. <RetailDetail v-if="isShowDetail" :list-item="queryItem" @backListFormDetail="backList" />
  16. <RetailForm v-if="isShowForm" :list-item="queryItem" @backListFormDetail="backList" />
  17. <RetailExamine v-if="isShowExamine" :list-item="queryItem" @backListFormDetail="backList" />
  18. <RetailReturn v-if="isShowReturn" :list-item="queryItem" @backListFormDetail="backList" />
  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. if (item.colName === 'the_time') {
  176. defaultData.render = (h, { row, index, column }) => {
  177. return (
  178. <div class="dateClass">
  179. <span>{row.theTime}</span>
  180. {this.$checkBtnRole('date', this.$route.meta.roles) ? (
  181. <el-button
  182. type="text"
  183. icon="el-icon-edit"
  184. style="padding: 0; margin-left: 6px"
  185. onClick={() => this.editDate(row)}
  186. />
  187. ) : (
  188. ''
  189. )}
  190. </div>
  191. )
  192. }
  193. }
  194. return defaultData
  195. },
  196. // 监听勾选变化
  197. selectionChange(data) {
  198. this.recordSelected = data
  199. },
  200. operation() {
  201. return (h, { row, index, column }) => {
  202. const statusData = row.selectMapData.examineStatus
  203. return (
  204. <div class="operation-btns">
  205. {row.examineStatus === statusData['SAVE'] ? (
  206. <el-popconfirm title="确定提审?" onOnConfirm={() => this.handleSubmit(row.id)}>
  207. <el-button slot="reference" type="text">
  208. 提审
  209. </el-button>
  210. </el-popconfirm>
  211. ) : null}
  212. {row.examineStatus == statusData['WAIT'] && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  213. <el-button type="text" onClick={() => this.toExamine(row)}>
  214. 审核
  215. </el-button>
  216. ) : null}
  217. {this.$checkBtnRole('del', this.$route.meta.roles) && row.examineStatus === statusData['SAVE'] ? (
  218. <el-popconfirm title="确定删除吗?" onOnConfirm={() => this.handleDelete(row.id)}>
  219. <el-button slot="reference" type="text">
  220. 删除
  221. </el-button>
  222. </el-popconfirm>
  223. ) : null}
  224. {row.examineStatus === statusData['SAVE'] && this.$checkBtnRole('edit', this.$route.meta.roles) ? (
  225. <el-button type="text" onClick={() => this.toForm(row)}>
  226. 编辑
  227. </el-button>
  228. ) : null}
  229. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === statusData['OK'] ? (
  230. <el-popconfirm title="确定弃审吗?" onOnConfirm={() => this.handleAbandon(row.id)}>
  231. <el-button slot="reference" type="text">
  232. 弃审
  233. </el-button>
  234. </el-popconfirm>
  235. ) : null}
  236. {row.examineStatus == statusData['WAIT'] && this.$checkBtnRole('apply', this.$route.meta.roles) ? (
  237. <el-popconfirm title="确定撤回?" onOnConfirm={() => this.handleCancel(row.id)}>
  238. <el-button slot="reference" type="text">
  239. 撤回
  240. </el-button>
  241. </el-popconfirm>
  242. ) : null}
  243. <el-button type="text" onClick={() => this.toDetail(row)}>
  244. 详情
  245. </el-button>
  246. {row.examineStatus === statusData['OK'] && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  247. <el-button type="text" onClick={() => this.toReturn(row)}>
  248. 退订
  249. </el-button>
  250. ) : null}
  251. {row.examineStatus === statusData['SAVE'] && this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  252. <el-popconfirm title="确定关闭吗?" onOnConfirm={() => this.handleClose(row.id)}>
  253. <el-button slot="reference" type="text">
  254. 关闭
  255. </el-button>
  256. </el-popconfirm>
  257. ) : null}
  258. </div>
  259. )
  260. }
  261. },
  262. // 获取业务员列表
  263. getSalesmanList() {
  264. getSalesmanList({
  265. pageNum: 1,
  266. pageSize: -1,
  267. isCustomer: 0,
  268. status: true
  269. }).then(res => {
  270. this.salesmanList = res.data.records
  271. })
  272. getNoRebateWalletList({
  273. walletName: ''
  274. }).then(res => {
  275. console.log(res)
  276. this.NoRebateWalletList = res.data
  277. console.log(this.NoRebateWalletList)
  278. })
  279. getTypeList({ pageNum: 1, pageSize: -1 }).then(res => {
  280. this.typeList = res.data.records
  281. console.log(this.typeList)
  282. })
  283. },
  284. handleSelectionAllChange(e) {
  285. this.recordSelected = e
  286. if (e) {
  287. this.selections = e
  288. } else {
  289. this.selections = []
  290. }
  291. },
  292. rowClass({ row, rowIndex }) {
  293. if (this.selectRow.includes(row.id)) {
  294. return { 'background-color': '#ecf5ff' }
  295. }
  296. },
  297. // 打开 批量审批
  298. batchExamine() {
  299. if (this.recordSelected.length) {
  300. this.isShowExamineDialog = true
  301. return
  302. }
  303. this.$errorMsg('请选择审核项')
  304. },
  305. // 提交 批量审批
  306. submitExamineForm() {
  307. let ids = this.recordSelected.map(item => {
  308. return item.id
  309. })
  310. ids = [...new Set(ids)]
  311. examineData({
  312. id: ids.join(','),
  313. examineStatus: this.examineForm.status,
  314. examineRemark: this.examineForm.remark,
  315. serviceId: ''
  316. }).then(res => {
  317. this.isShowExamineDialog = false
  318. this.$successMsg('修改成功')
  319. this.$refs.pageRef.refreshList()
  320. })
  321. },
  322. // 查询按钮权限
  323. checkBtnRole(value) {
  324. // let btnRole = this.$route.meta.roles;
  325. // if(!btnRole) {return true}
  326. // let index = btnRole.indexOf(value);
  327. // return index >= 0;
  328. return true
  329. },
  330. handleDelete(id) {
  331. deleteList({ id }).then(res => {
  332. this.$successMsg('删除成功')
  333. this.$refs.pageRef.refreshList()
  334. })
  335. },
  336. // 提交筛选表单
  337. submitScreenForm() {
  338. this.currentPage = 1
  339. this.$refs.pageRef.refreshList()
  340. },
  341. // 重置筛选表单
  342. resetScreenForm() {
  343. this.$refs.screenForm.resetFields()
  344. this.currentPage = 1
  345. this.$refs.pageRef.refreshList()
  346. },
  347. // 更改每页数量
  348. handleSizeChange(val) {
  349. this.pageSize = val
  350. this.currentPage = 1
  351. this.$refs.pageRef.refreshList()
  352. },
  353. // 更改当前页
  354. handleCurrentChange(val) {
  355. this.currentPage = val
  356. this.$refs.pageRef.refreshList()
  357. },
  358. // 进入表单
  359. toForm(item) {
  360. this.queryItem = item
  361. this.isShowForm = true
  362. },
  363. // 进入详情
  364. toDetail(item) {
  365. this.queryItem = item
  366. this.isShowDetail = true
  367. },
  368. // 进入审批
  369. toExamine(item) {
  370. this.queryItem = item
  371. this.isShowExamine = true
  372. },
  373. // 进入退订
  374. toReturn(item) {
  375. this.queryItem = item
  376. this.isShowReturn = true
  377. },
  378. // 弃审
  379. handleAbandon(id) {
  380. abandonData({ id }).then(res => {
  381. this.$successMsg()
  382. this.$refs.pageRef.refreshList()
  383. })
  384. },
  385. backList() {
  386. this.queryItem = {}
  387. this.addOff(() => {
  388. this.isShowDetail = false
  389. this.isShowForm = false
  390. this.isShowExamine = false
  391. this.isShowReturn = false
  392. })()
  393. this.$refs.pageRef.refreshList()
  394. },
  395. // 关闭
  396. handleClose(id) {
  397. closeData({ id }).then(res => {
  398. this.$successMsg()
  399. this.$refs.pageRef.refreshList()
  400. })
  401. },
  402. // 提审
  403. handleSubmit(id) {
  404. submitData({ id }).then(res => {
  405. this.$successMsg()
  406. this.$refs.pageRef.refreshList()
  407. })
  408. },
  409. // 撤回
  410. handleCancel(id) {
  411. submitCancel({ id }).then(res => {
  412. this.$successMsg()
  413. this.$refs.pageRef.refreshList()
  414. })
  415. },
  416. // 打开 修改订单日期
  417. editDate(item) {
  418. this.editId = item.id
  419. this.dateForm.date = item.theTime.slice(0, 10)
  420. this.isShowEditDateDialog = true
  421. },
  422. // 提交 修改订单日期
  423. submitDateForm() {
  424. editData({
  425. id: this.editId,
  426. theTime: this.dateForm.date + ' 00:00:00'
  427. }).then(res => {
  428. this.isShowEditDateDialog = false
  429. this.$refs.pageRef.refreshList()
  430. this.$successMsg('修改成功')
  431. })
  432. },
  433. // 获取存货类别列表
  434. getCategoryList() {
  435. getCategoryList({
  436. pageNum: 1,
  437. pageSize: -1
  438. }).then(res => {
  439. this.categoryList = res.data.records
  440. })
  441. }
  442. }
  443. }
  444. </script>
  445. <style lang="scss" scoped></style>