policy_list.vue 15 KB

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