policy_list.vue 15 KB

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