policy_list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <div v-if="isShow === 1" class="app-container">
  3. <div class="screen-container">
  4. <el-form ref="screenForm" :model="screenForm" :inline="false">
  5. <el-row>
  6. <el-row :gutter="20">
  7. <el-col :xs="24" :ms="6" :lg="6">
  8. <el-form-item label="" prop="code">
  9. <el-input
  10. v-model="screenForm.code"
  11. placeholder="销售政策编号"
  12. size="small"
  13. />
  14. </el-form-item>
  15. </el-col>
  16. <el-col :xs="24" :ms="6" :lg="6">
  17. <el-form-item label="" prop="title">
  18. <el-input
  19. v-model="screenForm.title"
  20. placeholder="销售政策说明"
  21. size="small"
  22. />
  23. </el-form-item>
  24. </el-col>
  25. <el-col :xs="24" :ms="6" :lg="6">
  26. <el-form-item label="" prop="remark">
  27. <el-input
  28. v-model="screenForm.remark"
  29. placeholder="表头备注"
  30. size="small"
  31. />
  32. </el-form-item>
  33. </el-col>
  34. <el-col :xs="24" :ms="6" :lg="6">
  35. <el-form-item label="" prop="startTime1">
  36. <el-date-picker
  37. v-model="screenForm.startTime1"
  38. type="datetime"
  39. size="small"
  40. placeholder="生效日期"
  41. value-format="yyyy-MM-dd HH:mm:ss"
  42. />
  43. </el-form-item>
  44. </el-col>
  45. </el-row>
  46. <el-row :gutter="20">
  47. <el-col :xs="24" :ms="6" :lg="6">
  48. <el-form-item label="" prop="endTime1">
  49. <el-date-picker
  50. v-model="screenForm.endTime1"
  51. type="datetime"
  52. size="small"
  53. placeholder="结束日期"
  54. value-format="yyyy-MM-dd HH:mm:ss"
  55. />
  56. </el-form-item>
  57. </el-col>
  58. <el-col :xs="24" :ms="6" :lg="6">
  59. <el-form-item label="" prop="startCreateTime">
  60. <el-date-picker
  61. v-model="screenForm.startCreateTime"
  62. type="datetime"
  63. size="small"
  64. placeholder="制表日期"
  65. value-format="yyyy-MM-dd HH:mm:ss"
  66. />
  67. </el-form-item>
  68. </el-col>
  69. <el-col :xs="24" :ms="6" :lg="6">
  70. <el-form-item label="" prop="createBy">
  71. <el-input
  72. v-model="screenForm.createBy"
  73. placeholder="制表人"
  74. size="small"
  75. />
  76. </el-form-item>
  77. </el-col>
  78. <el-col :xs="24" :ms="6" :lg="6">
  79. <el-form-item label="" prop="examineBy">
  80. <el-input
  81. v-model="screenForm.examineBy"
  82. placeholder="审核人"
  83. size="small"
  84. />
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. <el-row :gutter="20">
  89. <el-col :xs="24" :ms="6" :lg="6">
  90. <el-form-item label="" prop="status">
  91. <el-select
  92. v-model="screenForm.status"
  93. size="small"
  94. placeholder="状态"
  95. class="select_height"
  96. >
  97. <el-option
  98. v-for="(item, index) in statusOptions"
  99. :key="index"
  100. :label="item.label"
  101. :value="item.value"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :xs="24" :ms="6" :lg="6">
  107. <el-form-item label="" prop="type">
  108. <el-select
  109. v-model="screenForm.type"
  110. size="small"
  111. placeholder="销售政策类型"
  112. class="select_height"
  113. >
  114. <el-option
  115. v-for="item in typeOptions"
  116. :key="item.value"
  117. :label="item.label"
  118. :value="item.value"
  119. />
  120. </el-select>
  121. </el-form-item>
  122. </el-col>
  123. <el-col :xs="24" :ms="6" :lg="6" />
  124. <el-col :xs="24" :ms="6" :lg="12" class="tr">
  125. <el-form-item>
  126. <el-button
  127. type="primary"
  128. size="small"
  129. @click="submitScreenForm"
  130. >查询</el-button>
  131. <el-button
  132. size="small"
  133. @click="resetScreenForm"
  134. >重置</el-button>
  135. </el-form-item>
  136. </el-col>
  137. </el-row>
  138. </el-row>
  139. </el-form>
  140. </div>
  141. <div class="btn-group">
  142. <el-row type="flex">
  143. <el-button
  144. v-if="$checkBtnRole('add', $route.meta.roles)"
  145. size="small"
  146. type="primary"
  147. icon="el-icon-plus"
  148. @click="hanlenewInfo"
  149. >新增</el-button>
  150. </el-row>
  151. </div>
  152. <div class="mymain-container">
  153. <el-table :data="dataList" border style="width: 100%">
  154. <el-table-column
  155. fixed="left"
  156. label="操作"
  157. min-width="150"
  158. align="center"
  159. >
  160. <template slot-scope="scope">
  161. <el-button
  162. v-if="scope.row.examineStatus == 'SAVE'"
  163. type="text"
  164. size="small"
  165. @click="(isShow = 5), (id = scope.row.id)"
  166. >编辑</el-button>
  167. <el-button
  168. type="text"
  169. size="small"
  170. @click="
  171. (isShow = 4), (id = scope.row.id), (code = scope.row.code)
  172. "
  173. >详情</el-button>
  174. <el-button
  175. v-if="
  176. scope.row.examineStatus == 'WAIT' &&
  177. $checkBtnRole('examine', $route.meta.roles)
  178. "
  179. type="text"
  180. size="small"
  181. @click="
  182. (isShow = 8),
  183. (id = scope.row.id),
  184. (policyId = scope.row.policyId),
  185. (code = scope.row.code)
  186. "
  187. >审核</el-button>
  188. <!-- </el-popconfirm> -->
  189. <el-popconfirm
  190. v-if="scope.row.examineStatus == 'SAVE'"
  191. style="margin-left: 10px"
  192. title="提审?"
  193. @onConfirm="handlesubmit(scope.row)"
  194. >
  195. <el-button
  196. slot="reference"
  197. type="text"
  198. size="small"
  199. >提审</el-button>
  200. </el-popconfirm>
  201. <el-popconfirm
  202. v-if="scope.row.endTime || (scope.row.endTime && scope.row.startTime) && scope.row.examineStatus === 'OK' "
  203. style="margin-left: 10px"
  204. title="作废?"
  205. @onConfirm="handleNullify(scope.row)"
  206. >
  207. <el-button
  208. slot="reference"
  209. type="text"
  210. size="small"
  211. >作废</el-button>
  212. </el-popconfirm>
  213. <el-popconfirm
  214. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK' "
  215. style="margin-left: 10px"
  216. title="克隆?"
  217. @onConfirm="handleClone(scope.row)"
  218. >
  219. <!-- -->
  220. <el-button
  221. slot="reference"
  222. type="text"
  223. size="small"
  224. >克隆</el-button>
  225. </el-popconfirm>
  226. <el-popconfirm
  227. v-if="scope.row.examineStatus != 'OK' "
  228. style="margin-left: 10px"
  229. title="删除吗?"
  230. @onConfirm="hanleDelete(scope.row.id)"
  231. >
  232. <el-button
  233. slot="reference"
  234. type="text"
  235. size="small"
  236. >删除</el-button>
  237. </el-popconfirm>
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="状态" width="120" align="left">
  241. <template slot-scope="scope">
  242. <el-tag v-if="scope.row.status == '1'">已生效</el-tag>
  243. <el-tag v-else-if="scope.row.status == '0'">未生效 </el-tag>
  244. </template>
  245. </el-table-column>
  246. <el-table-column label="审核状态" width="120" align="left">
  247. <template slot-scope="scope">
  248. <el-tag v-if="scope.row.examineStatus == 'SAVE'">保存</el-tag>
  249. <el-tag
  250. v-else-if="scope.row.examineStatus == 'WAIT'"
  251. >待审核
  252. </el-tag>
  253. <el-tag v-else-if="scope.row.examineStatus == 'OK'">通过 </el-tag>
  254. <el-tag v-else>不通过 </el-tag>
  255. </template>
  256. </el-table-column>
  257. <el-table-column
  258. prop="code"
  259. label="销售政策编号"
  260. show-overflow-tooltip
  261. min-width="200"
  262. align="left"
  263. />
  264. <el-table-column
  265. show-overflow-tooltip
  266. prop="title"
  267. label="销售政策说明"
  268. min-width="150"
  269. align="left"
  270. />
  271. <!-- <el-table-column
  272. prop="mainName"
  273. label="产品品类"
  274. align="left"
  275. ></el-table-column> -->
  276. <el-table-column
  277. show-overflow-tooltip
  278. prop="remark"
  279. label="表头备注"
  280. min-width="150"
  281. align="left"
  282. />
  283. <el-table-column min-width="200" show-overflow-tooltip prop="startTime" label="生效日期" align="left" />
  284. <el-table-column min-width="200" show-overflow-tooltip prop="endTime" label="结束日期" align="left" />
  285. <el-table-column
  286. show-overflow-tooltip
  287. prop="createBy"
  288. label="制表人"
  289. min-width="200"
  290. align="left"
  291. />
  292. <el-table-column
  293. show-overflow-tooltip
  294. prop="createTime"
  295. label="制表日期"
  296. min-width="200"
  297. align="left"
  298. />
  299. <el-table-column
  300. show-overflow-tooltip
  301. prop="examineBy"
  302. label="审核人"
  303. min-width="200"
  304. align="left"
  305. />
  306. </el-table>
  307. <!-- 分页 -->
  308. <div class="fr">
  309. <el-pagination
  310. :current-page="currentPage"
  311. :page-sizes="[10, 20, 30, 50]"
  312. :page-size="10"
  313. layout="total, sizes, prev, pager, next, jumper"
  314. :total="listTotal"
  315. @size-change="handleSizeChange"
  316. @current-change="handleCurrentChange"
  317. />
  318. </div>
  319. </div>
  320. </div>
  321. <AddPolicy v-else-if="isShow === 2" />
  322. <AddCondition v-else-if="isShow === 10" :id="id" :policy-id="policyId" />
  323. <EditPolicy v-else-if="isShow===5" />
  324. <Examine v-else />
  325. </template>
  326. <script>
  327. import {
  328. cancelPolicy,
  329. cloneList,
  330. deletePolicy,
  331. getId,
  332. getList,
  333. getpolicySubmit,
  334. getTypeList,
  335. toExamine
  336. } from '@/api/policy_list'
  337. import Minxin from '@/mixin'
  338. import { downloadFiles, handleImport } from '@/utils/util'
  339. import AddPolicy from './components/AddPolicy'
  340. import EditPolicy from './components/editPolicy'
  341. import AddModel from './components/AddModel'
  342. import Pagination from './components/Pagination'
  343. import AddCondition from './components/AddCondition'
  344. import Examine from './components/Examine'
  345. import { mapState } from 'vuex'
  346. export default {
  347. mixins: [Minxin],
  348. data() {
  349. return {
  350. id: '',
  351. code: '',
  352. codeId: '',
  353. listLoading: false,
  354. policyId: '',
  355. isShow: 1,
  356. dataList: [],
  357. screenForm: {
  358. code: '',
  359. createBy: '',
  360. endCreateTime: '',
  361. endTime1: '',
  362. endTime2: '',
  363. examineBy: '',
  364. remark: '',
  365. startCreateTime: '',
  366. startTime1: '',
  367. startTime2: '',
  368. status: '',
  369. title: '',
  370. type: ''
  371. },
  372. fileList: [],
  373. statusOptions: [
  374. {
  375. vlaue: '',
  376. label: '全部'
  377. },
  378. {
  379. value: true,
  380. label: '已生效'
  381. },
  382. {
  383. value: false,
  384. label: '未生效'
  385. }
  386. ],
  387. typeOptions: [
  388. {
  389. vlaue: '',
  390. label: '全部'
  391. },
  392. {
  393. vlaue: 'PROVISION',
  394. label: '配提'
  395. },
  396. {
  397. value: 'LIMIT',
  398. label: '限量'
  399. }
  400. ],
  401. typeList: [],
  402. value: '',
  403. imageUrl: '',
  404. baseURL: '',
  405. isFlag: ''
  406. }
  407. },
  408. computed: mapState({
  409. comCode: (state) => state.sales.code
  410. }),
  411. methods: {
  412. hanlenewInfo() {
  413. console.log()
  414. getId().then((res) => {
  415. this.$store.commit('sales/setId', res.data)
  416. this.isShow = 2
  417. })
  418. },
  419. handleClone(row) {
  420. cloneList({ policyId: row.id }).then(res => {
  421. this.$successMsg('克隆成功')
  422. this.getList()
  423. })
  424. },
  425. getList() {
  426. this.listLoading = true
  427. const params = {
  428. pageNum: this.currentPage,
  429. pageSize: this.pageSize,
  430. code: this.screenForm.code,
  431. type: this.screenForm.type,
  432. createBy: this.screenForm.createBy,
  433. endCreateTime: this.screenForm.endCreateTime,
  434. endTime1: this.screenForm.endTime1,
  435. endTime2: this.screenForm.endTime2,
  436. examineBy: this.screenForm.examineBy,
  437. remark: this.screenForm.remark,
  438. startCreateTime: this.screenForm.startCreateTime,
  439. startTime1: this.screenForm.startTime1,
  440. startTime2: this.screenForm.startTime2,
  441. status: this.screenForm.status,
  442. title: this.screenForm.title
  443. }
  444. getList(params).then((res) => {
  445. this.dataList = res.data.records
  446. console.log(this.dataList)
  447. this.listTotal = res.data.total
  448. this.listLoading = false
  449. })
  450. const paramsType = {
  451. pageNum: 1,
  452. pageSize: 10,
  453. saleCdoe: '',
  454. saleName: '',
  455. stauts: ''
  456. }
  457. getTypeList(paramsType).then((res) => {
  458. this.typeList = res.data.records
  459. })
  460. },
  461. hanleDelete(id) {
  462. this.hanleDeleteAllPromise(id).then((ids) => {
  463. deletePolicy({
  464. id: ids[0]
  465. }).then((res) => {
  466. this.$successMsg('删除成功')
  467. this.getList()
  468. })
  469. })
  470. },
  471. // 作废
  472. handleNullify(row) {
  473. cancelPolicy({ id: row.id }).then(res => {
  474. this.$successMsg('已作废')
  475. this.getList()
  476. })
  477. },
  478. // 导出文档
  479. handleExport() {
  480. const screenData = {
  481. customerTel: this.diaLogForm.customerTel,
  482. logisticsCompany: this.diaLogForm.logisticsCompany
  483. }
  484. downloadFiles('/policy/export', screenData)
  485. },
  486. // 导入
  487. async handleImport(param) {
  488. this.importLoading = true
  489. const file = param.file
  490. console.log(file, 123)
  491. const formData = new FormData()
  492. formData.append('file', file)
  493. const result = await handleImport('/policy/material/import', formData)
  494. this.importLoading = false
  495. this.importFileList = []
  496. if (result.code == 200) {
  497. this.$alert('导入成功', '导入成功', {
  498. confirmButtonText: '确定'
  499. })
  500. this.getList()
  501. } else {
  502. this.$alert('导入失败', '导入失败', {
  503. confirmButtonText: '确定'
  504. })
  505. }
  506. },
  507. handlesubmit(e) {
  508. getpolicySubmit({ policyId: e.id }).then((res) => {
  509. this.$successMsg('已提交')
  510. this.getList()
  511. })
  512. },
  513. hanleExamine(e) {
  514. if (e.examineStatus == 'WAIT') {
  515. toExamine({
  516. examineRemark: e.id,
  517. examineStatus: 'WAIT',
  518. policyId: e.id
  519. }).then((res) => {
  520. this.$successMsg('已提交')
  521. })
  522. } else {
  523. this.$errorMsg('未满足条件')
  524. }
  525. }
  526. },
  527. components: {
  528. Examine,
  529. AddModel,
  530. AddPolicy,
  531. EditPolicy,
  532. Pagination,
  533. AddCondition
  534. }
  535. }
  536. </script>
  537. <style lang="scss" scoped>
  538. .btn {
  539. width: 80px;
  540. }
  541. .mpd {
  542. padding: 20px 0 0 0;
  543. }
  544. .select_height {
  545. width: 100%;
  546. }
  547. .import-btn {
  548. margin: 0 10px;
  549. }
  550. .header {
  551. display: flex;
  552. height: 50px;
  553. align-items: center;
  554. }
  555. .fr{
  556. margin: 20px 0;
  557. }
  558. </style>