policy_list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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.examineStatus != 'OK'"
  207. style="margin-left: 10px"
  208. title="删除吗?"
  209. @onConfirm="hanleDelete(scope.row.id)"
  210. >
  211. <el-button type="text" slot="reference" size="small"
  212. >删除</el-button
  213. >
  214. </el-popconfirm>
  215. </template>
  216. </el-table-column>
  217. <el-table-column label="状态" width="120" align="center">
  218. <template slot-scope="scope">
  219. <el-tag v-if="scope.row.status == '1'">已生效</el-tag>
  220. <el-tag v-else-if="scope.row.status == '0'">未生效 </el-tag>
  221. </template>
  222. </el-table-column>
  223. <el-table-column label="审核状态" width="120" align="center">
  224. <template slot-scope="scope">
  225. <el-tag v-if="scope.row.examineStatus == 'SAVE'">保存</el-tag>
  226. <el-tag v-else-if="scope.row.examineStatus == 'WAIT'"
  227. >待审核
  228. </el-tag>
  229. <el-tag v-else-if="scope.row.examineStatus == 'OK'">通过 </el-tag>
  230. <el-tag v-else>不通过 </el-tag>
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. prop="code"
  235. label="销售政策编号"
  236. width="120"
  237. align="center"
  238. >
  239. </el-table-column>
  240. <el-table-column
  241. prop="title"
  242. label="销售政策说明"
  243. width="120"
  244. align="center"
  245. >
  246. </el-table-column>
  247. <!-- <el-table-column
  248. prop="mainName"
  249. label="产品品类"
  250. align="center"
  251. ></el-table-column> -->
  252. <el-table-column
  253. prop="remark"
  254. label="表头备注"
  255. width="120"
  256. align="center"
  257. >
  258. </el-table-column>
  259. <el-table-column prop="startTime" label="生效日期" align="center">
  260. </el-table-column>
  261. <el-table-column prop="endTime" label="结束日期" align="center">
  262. </el-table-column>
  263. <el-table-column
  264. prop="createBy"
  265. label="制表人"
  266. width="120"
  267. align="center"
  268. >
  269. </el-table-column>
  270. <el-table-column
  271. prop="createTime"
  272. label="制表日期"
  273. width="120"
  274. align="center"
  275. >
  276. </el-table-column>
  277. <el-table-column
  278. prop="examineBy"
  279. label="审核人"
  280. width="120"
  281. align="center"
  282. >
  283. </el-table-column>
  284. </el-table>
  285. </div>
  286. <!-- 分页 -->
  287. <div class="fr">
  288. <el-pagination
  289. @size-change="handleSizeChange"
  290. @current-change="handleCurrentChange"
  291. :current-page="currentPage"
  292. :page-sizes="[10, 20, 30, 50]"
  293. :page-size="10"
  294. layout="total, sizes, prev, pager, next, jumper"
  295. :total="listTotal"
  296. >
  297. </el-pagination>
  298. </div>
  299. </div>
  300. <AddPolicy v-else-if="isShow == 2" />
  301. <AddCondition v-else-if="isShow == 10" :id="id" :policyId="policyId" />
  302. <Examine v-else />
  303. </template>
  304. <script>
  305. import {
  306. getId,
  307. getList,
  308. getTypeList,
  309. deletePolicy,
  310. getpolicySubmit,
  311. toExamine,
  312. } from "@/api/policy_list";
  313. import Minxin from "@/mixin";
  314. import { downloadFiles, handleImport } from "@/utils/util";
  315. import AddPolicy from "./components/AddPolicy";
  316. import AddModel from "./components/AddModel";
  317. import Pagination from "./components/Pagination";
  318. import AddCondition from "./components/AddCondition";
  319. import Examine from "./components/Examine";
  320. import { mapState } from "vuex";
  321. export default {
  322. mixins: [Minxin],
  323. data() {
  324. return {
  325. id: "",
  326. code: "",
  327. codeId: "",
  328. listLoading: false,
  329. policyId: "",
  330. isShow: 1,
  331. dataList: [],
  332. screenForm: {
  333. code: "",
  334. createBy: "",
  335. endCreateTime: "",
  336. endTime1: "",
  337. endTime2: "",
  338. examineBy: "",
  339. remark: "",
  340. startCreateTime: "",
  341. startTime1: "",
  342. startTime2: "",
  343. status: "",
  344. title: "",
  345. type: "",
  346. },
  347. fileList: [],
  348. statusOptions: [
  349. {
  350. vlaue: "",
  351. label: "全部",
  352. },
  353. {
  354. value: true,
  355. label: "已生效",
  356. },
  357. {
  358. value: false,
  359. label: "未生效",
  360. },
  361. ],
  362. typeOptions: [
  363. {
  364. vlaue: "",
  365. label: "全部",
  366. },
  367. {
  368. vlaue: "PROVISION",
  369. label: "配提",
  370. },
  371. {
  372. value: "LIMIT",
  373. label: "限量",
  374. },
  375. ],
  376. typeList: [],
  377. value: "",
  378. imageUrl: "",
  379. baseURL: "",
  380. isFlag: "",
  381. };
  382. },
  383. computed: mapState({
  384. comCode: (state) => state.sales.code,
  385. }),
  386. methods: {
  387. hanlenewInfo() {
  388. console.log();
  389. getId().then((res) => {
  390. this.$store.commit("sales/setId", res.data);
  391. this.isShow = 2;
  392. });
  393. },
  394. getList() {
  395. this.listLoading = true;
  396. const params = {
  397. pageNum: this.currentPage,
  398. pageSize: this.pageSize,
  399. code: this.screenForm.code,
  400. type: this.screenForm.type,
  401. createBy: this.screenForm.createBy,
  402. endCreateTime: this.screenForm.endCreateTime,
  403. endTime1: this.screenForm.endTime1,
  404. endTime2: this.screenForm.endTime2,
  405. examineBy: this.screenForm.examineBy,
  406. remark: this.screenForm.remark,
  407. startCreateTime: this.screenForm.startCreateTime,
  408. startTime1: this.screenForm.startTime1,
  409. startTime2: this.screenForm.startTime2,
  410. status: this.screenForm.status,
  411. title: this.screenForm.title,
  412. };
  413. getList(params).then((res) => {
  414. this.dataList = res.data.records;
  415. console.log(this.dataList);
  416. this.listTotal = res.data.total;
  417. this.listLoading = false;
  418. });
  419. const paramsType = {
  420. pageNum: 1,
  421. pageSize: 10,
  422. saleCdoe: "",
  423. saleName: "",
  424. stauts: "",
  425. };
  426. getTypeList(paramsType).then((res) => {
  427. this.typeList = res.data.records;
  428. });
  429. },
  430. hanleDelete(id) {
  431. this.hanleDeleteAllPromise(id).then((ids) => {
  432. deletePolicy({
  433. id: ids[0],
  434. }).then((res) => {
  435. this.$successMsg("删除成功");
  436. this.getList();
  437. });
  438. });
  439. },
  440. // 导出文档
  441. handleExport() {
  442. let screenData = {
  443. customerTel: this.diaLogForm.customerTel,
  444. logisticsCompany: this.diaLogForm.logisticsCompany,
  445. };
  446. downloadFiles("/policy/export", screenData);
  447. },
  448. // 导入
  449. async handleImport(param) {
  450. this.importLoading = true;
  451. const file = param.file;
  452. console.log(file, 123);
  453. const formData = new FormData();
  454. formData.append("file", file);
  455. let result = await handleImport("/policy/material/import", formData);
  456. this.importLoading = false;
  457. this.importFileList = [];
  458. if (result.code == 200) {
  459. this.$alert('导入成功', "导入成功", {
  460. confirmButtonText: "确定",
  461. });
  462. this.getList();
  463. } else {
  464. this.$alert('导入失败', "导入失败", {
  465. confirmButtonText: "确定",
  466. });
  467. }
  468. },
  469. handlesubmit(e) {
  470. getpolicySubmit({ policyId: e.id }).then((res) => {
  471. this.$successMsg("已提交");
  472. this.getList();
  473. });
  474. },
  475. hanleExamine(e) {
  476. if (e.examineStatus == "WAIT") {
  477. toExamine({
  478. examineRemark: e.id,
  479. examineStatus: "WAIT",
  480. policyId: e.id,
  481. }).then((res) => {
  482. this.$successMsg("已提交");
  483. });
  484. } else {
  485. this.$errorMsg("未满足条件");
  486. }
  487. },
  488. },
  489. components: {
  490. Examine,
  491. AddModel,
  492. AddPolicy,
  493. Pagination,
  494. AddCondition,
  495. },
  496. };
  497. </script>
  498. <style lang="scss" scoped>
  499. .btn {
  500. width: 80px;
  501. }
  502. .mpd {
  503. padding: 20px 0 0 0;
  504. }
  505. .select_height {
  506. width: 100%;
  507. }
  508. .import-btn {
  509. margin: 0 10px;
  510. }
  511. </style>
  512. <style>
  513. .header {
  514. display: flex;
  515. height: 50px;
  516. align-items: center;
  517. }
  518. </style>