policy_list.vue 13 KB

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