policy_list.vue 15 KB

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