issue.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div>
  3. <div>
  4. <el-form
  5. :model="queryForm"
  6. ref="queryForm"
  7. :inline="true"
  8. label-width="88px"
  9. >
  10. <el-form-item label="发放标识" prop="issueRemark">
  11. <el-input
  12. v-model="queryForm.issueRemark"
  13. placeholder="请输入标识"
  14. clearable
  15. size="small"
  16. />
  17. </el-form-item>
  18. <el-form-item label="发放类型" prop="issueType">
  19. <el-select
  20. v-model="queryForm.issueType"
  21. clearable
  22. placeholder="请选择"
  23. >
  24. <el-option label="消费发放" value="1" ></el-option>
  25. <el-option label="网页 静态二维码" value="2" ></el-option>
  26. <el-option label="支付成功后的展示位" value="3" ></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="发放名称" prop="issueName">
  30. <el-input
  31. v-model="queryForm.issueName"
  32. placeholder="请输入名称"
  33. clearable
  34. size="small"
  35. />
  36. </el-form-item>
  37. <el-form-item label="创建时间" prop="getCreateTime">
  38. <el-date-picker
  39. style="width: 350px"
  40. v-model="dateRangeCreatedDate"
  41. size="mini"
  42. value-format="yyyy-MM-dd HH:mm:ss"
  43. type="datetimerange"
  44. range-separator="至"
  45. start-placeholder="开始日期"
  46. end-placeholder="结束日期"
  47. >
  48. </el-date-picker>
  49. </el-form-item>
  50. <el-form-item label="生效状态" prop="status">
  51. <el-select
  52. v-model="queryForm.status"
  53. clearable
  54. placeholder="请选择"
  55. >
  56. <el-option label="开启" value="1" ></el-option>
  57. <el-option label="关闭" value="0" ></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item>
  61. <el-button
  62. type="cyan"
  63. icon="el-icon-search"
  64. size="mini"
  65. @click="handleQuery"
  66. >搜索</el-button
  67. >
  68. <el-button
  69. type="info"
  70. icon="el-icon-refresh"
  71. size="mini"
  72. @click="resetQuery"
  73. >重置</el-button
  74. >
  75. </el-form-item>
  76. </el-form>
  77. <el-table :data="issueList">
  78. <af-table-column type="expand">
  79. <template slot-scope="props">
  80. <el-table
  81. :data="props.row.couponList"
  82. :show-header="false"
  83. :highlight-current-row="false"
  84. style="width: 90vw"
  85. >
  86. <af-table-column label="名城" align="left">
  87. <template slot-scope="scope">
  88. {{ "优惠券:" }}<b>{{ scope.row.couponRemark }}</b>
  89. </template>
  90. </af-table-column>
  91. <af-table-column label="卡片类型" align="left">
  92. <template slot-scope="scope">
  93. {{
  94. scope.row.couponType == 1
  95. ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
  96. : ""
  97. }}
  98. {{
  99. scope.row.couponType == 2
  100. ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
  101. : ""
  102. }}
  103. {{
  104. scope.row.couponType == 3
  105. ? "兑换券" + "--商品:" + scope.row.couponName
  106. : ""
  107. }}
  108. </template>
  109. </af-table-column>
  110. <af-table-column label="状态" align="center">
  111. <template slot-scope="scope">
  112. {{ scope.row.status == "1" ? "启用状态" : "" }}
  113. {{ scope.row.status == "0" ? "停用状态" : "" }}
  114. </template>
  115. </af-table-column>
  116. </el-table>
  117. </template>
  118. </af-table-column>
  119. <af-table-column label="发放方式id" align="left" prop="id" v-if="false" />
  120. <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
  121. <af-table-column label="状态" align="left">
  122. <template slot-scope="scope">
  123. {{ scope.row.status == "1" ? "启用" : "" }}
  124. {{ scope.row.status == "0" ? "停用" : "" }}
  125. </template>
  126. </af-table-column>
  127. <af-table-column label="活动名称" align="left" prop="issueName" />
  128. <af-table-column label="类型" align="left">
  129. <template slot-scope="scope">
  130. {{ scope.row.issueType == "1" ? "消费发放" : "" }}
  131. {{ scope.row.issueType == "2" ? "网页方式、二维码-静态码" : "" }}
  132. {{ scope.row.issueType == "3" ? "支付成功后的领取位" : "" }}
  133. </template>
  134. </af-table-column>
  135. <af-table-column label="发放门槛" align="left">
  136. <template slot-scope="scope">
  137. {{
  138. scope.row.issueType == "1"
  139. ? scope.row.discountThresholdAmt == "0"
  140. ? "无门槛,消费都发放"
  141. : "满" + scope.row.discountThresholdAmt + "元发放"
  142. : ""
  143. }}
  144. {{ scope.row.issueType != "1" ? "-------" : "" }}
  145. </template>
  146. </af-table-column>
  147. <af-table-column label="领取限制" align="left">
  148. <template slot-scope="scope">
  149. {{ scope.row.issueType == "1" ? "-------" : "" }}
  150. {{
  151. scope.row.issueType != "1"
  152. ? "单个用户能进入这个领取界面" +
  153. scope.row.giveCount +
  154. "次,一次可以领取" +
  155. scope.row.giveLimit +
  156. "张优惠券"
  157. : ""
  158. }}
  159. </template>
  160. </af-table-column>
  161. <af-table-column label="可领取时间段" align="left">
  162. <template slot-scope="scope">
  163. {{ translateTime(scope.row) }}
  164. </template>
  165. </af-table-column>
  166. <af-table-column
  167. label="操作"
  168. align="left"
  169. class-name="small-padding fixed-width"
  170. width="120px"
  171. >
  172. <template slot-scope="scope">
  173. <el-button
  174. size="mini"
  175. type="text"
  176. icon="el-icon-search"
  177. @click="handlequeryCouponUserList(scope.row.id)"
  178. >查看优惠券</el-button
  179. >
  180. </template>
  181. </af-table-column>
  182. </el-table>
  183. <pagination
  184. :hidden="total > 0 ? false : true"
  185. :total="total"
  186. :page.sync="queryForm.pageNum"
  187. :limit.sync="queryForm.pageSize"
  188. @pagination="getIssueList"
  189. :autoScroll="true"
  190. />
  191. </div>
  192. <el-dialog
  193. :title="title"
  194. :visible.sync="open"
  195. width="1200px"
  196. append-to-body
  197. status-icon
  198. >
  199. <el-table :data="couponUserList">
  200. <af-table-column label="油站名" align="center" prop="id" v-if="jiBie==0||jiBie==1"/>
  201. <af-table-column
  202. v-if="false"
  203. label="优惠券id"
  204. align="center"
  205. prop="id"
  206. />
  207. <af-table-column label="用户ID" align="center" prop="unionId" v-if="false" />
  208. <af-table-column label="油站ID" align="center" prop="stationId" v-if="false" />
  209. <af-table-column label="发放方式ID" align="center" prop="issueId" v-if="false" />
  210. <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
  211. <af-table-column label="活动名称" align="left" prop="issueName" />
  212. <af-table-column label="优惠券ID" align="center" prop="couponId" v-if="false"/>
  213. <af-table-column
  214. label="优惠券标识"
  215. align="left"
  216. prop="couponRemark"
  217. fixed="left"
  218. />
  219. <af-table-column label="卡片类型" align="left">
  220. <template slot-scope="scope">
  221. {{
  222. scope.row.couponType == 1
  223. ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
  224. : ""
  225. }}
  226. {{
  227. scope.row.couponType == 2
  228. ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
  229. : ""
  230. }}
  231. {{
  232. scope.row.couponType == 3
  233. ? "兑换券" + "--商品:" + scope.row.couponName
  234. : ""
  235. }}
  236. </template>
  237. </af-table-column>
  238. <af-table-column label="是否使用"
  239. align="center"
  240. >
  241. <template slot-scope="scope">
  242. {{ scope.row.couponIsUsed == "0" ? "未使用" : "" }}
  243. {{ scope.row.couponIsUsed == "1" ? "已使用" : "" }}
  244. {{ scope.row.couponIsUsed == "2" ? "已核销" : "" }}
  245. </template>
  246. </af-table-column>
  247. <af-table-column label="是否有效"
  248. align="center"
  249. >
  250. <template slot-scope="scope">
  251. {{ scope.row.couponIsEffective == "0" ? "无效" : "" }}
  252. {{ scope.row.couponIsEffective == "1" ? "有效" : "" }}
  253. </template>
  254. </af-table-column>
  255. <af-table-column label="用户保存id" align="center" prop="userId" v-if="false" />
  256. <af-table-column label="手机号" align="center" prop="mobilePhone" />
  257. <af-table-column label="用户名" align="center" prop="blogNickName" />
  258. <af-table-column label="核销员手机号" align="center" prop="verificationUserPhone" />
  259. <af-table-column label="优惠券获取时间" align="center" prop="getCouponTime">
  260. <template slot-scope="scope">
  261. <span>{{
  262. parseTime(scope.row.getCouponTime, "{y}-{m}-{d} {h}:{i}:{s}")
  263. }}</span>
  264. </template>
  265. </af-table-column>
  266. <af-table-column label="优惠券截止时间" align="center" prop="couponEffectiveTime">
  267. <template slot-scope="scope">
  268. <span>{{
  269. parseTime(scope.row.couponEffectiveTime, "{y}-{m}-{d} {h}:{i}:{s}")
  270. }}</span>
  271. </template>
  272. </af-table-column>
  273. </el-table>
  274. <pagination
  275. v-show="userTotal > 0"
  276. :total="userTotal"
  277. :page.sync="queryCouponUserFrom.pageNum"
  278. :limit.sync="queryCouponUserFrom.pageSize"
  279. @pagination="queryCouponUserListByPage"
  280. />
  281. </el-dialog>
  282. </div>
  283. </template>
  284. <script>
  285. import {
  286. listInfo,
  287. listIssue,
  288. queryCouponUserList,
  289. } from "@/api/coupon";
  290. export default {
  291. name: "Coupon_CreateIssue",
  292. data() {
  293. return {
  294. dateRangeCreatedDate: [],
  295. createForm: {
  296. issueRemark: "",
  297. issueName: "",
  298. showIdList: [],
  299. availableControl: "0",
  300. appointedDaysList: [],
  301. cycleDaysList: [],
  302. issueType: "",
  303. discountThresholdAmt: "0",
  304. couponIssueRelationList: [],
  305. giveLimit: 9,
  306. giveCount: 999999,
  307. },
  308. couponList: [],
  309. title: "",
  310. // 是否显示弹出层
  311. open: false,
  312. // 总条数
  313. total: 100,
  314. // 优惠券总条数
  315. userTotal: 100,
  316. // 优惠券的信息
  317. couponUserList: [],
  318. // 查询参数
  319. queryForm: {
  320. pageNum: 1,
  321. pageSize: 10, // 初始值只能比10大
  322. issueName:null,
  323. issueRemark:null,
  324. issueType:null,
  325. levelId:this.levelId,
  326. CreateTime:null,
  327. status:null,
  328. },
  329. queryCouponUserFrom:{
  330. levelId:this.levelId,
  331. issueId:0,
  332. couponId: null,
  333. stationId: null,
  334. pageNum: 1,
  335. pageSize: 10,
  336. },
  337. issueList: [],
  338. timeSelect: [
  339. ,
  340. ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
  341. [
  342. "1号",
  343. "2号",
  344. "3号",
  345. "4号",
  346. "5号",
  347. "6号",
  348. "7号",
  349. "8号",
  350. "9号",
  351. "10号",
  352. "11号",
  353. "12号",
  354. "13号",
  355. "14号",
  356. "15号",
  357. "16号",
  358. "17号",
  359. "18号",
  360. "19号",
  361. "20号",
  362. "21号",
  363. "22号",
  364. "23号",
  365. "24号",
  366. "25号",
  367. "26号",
  368. "27号",
  369. "28号",
  370. "29号",
  371. "30号",
  372. "31号",
  373. ],
  374. ],
  375. };
  376. },
  377. created() {
  378. this.init();
  379. },
  380. methods: {
  381. translateTime(row) {
  382. let timeString = "";
  383. const availableControleType = row.availableControl;
  384. if (availableControleType == 0) {
  385. return "用户一直都可以领取";
  386. }
  387. timeString = "用户只能在";
  388. if (availableControleType == 1) {
  389. timeString += "每周的";
  390. }
  391. if (availableControleType == 2) {
  392. timeString += "每月的";
  393. }
  394. if (availableControleType == 3) {
  395. timeString += "指定的日期 ";
  396. }
  397. if (availableControleType == 1 || availableControleType == 2) {
  398. row.cycleDaysList.forEach((ele) => {
  399. timeString += this.timeSelect[availableControleType][ele] + "、";
  400. });
  401. } else if (availableControleType == 3) {
  402. timeString += row.appointedDaysList.toString();
  403. }
  404. timeString = timeString.replace(/(、)$/g, "") + "可以领取劵";
  405. return timeString;
  406. },
  407. getIssueList() {
  408. listIssue(this.addDateRange(this.queryForm, this.dateRangeCreatedDate))
  409. .then((res) => {
  410. if (res.code == 200) {
  411. if (res.rows == null) {
  412. this.total = 0;
  413. this.issueList = [];
  414. } else {
  415. this.total = res.total;
  416. this.issueList = res.rows;
  417. }
  418. } else {
  419. throw new Error("");
  420. }
  421. })
  422. .catch((err) => {
  423. this.msgError("亲,拉取领取方式列表失败~");
  424. });
  425. },
  426. getCoupon() {
  427. listInfo({
  428. pageNum: 1,
  429. pageSize: 1000,
  430. status: 1,
  431. })
  432. .then((res) => {
  433. if (res.code == 200) {
  434. if (res.rows == null) {
  435. this.couponList = [];
  436. } else {
  437. this.couponList = res.rows;
  438. }
  439. } else {
  440. throw new Error("");
  441. }
  442. })
  443. .catch((err) => {
  444. this.msgError("亲,拉取优惠券列表失败~");
  445. });
  446. },
  447. init() {
  448. this.getCoupon();
  449. this.getIssueList();
  450. },
  451. /** 搜索按钮操作 */
  452. handleQuery() {
  453. this.queryForm.pageNum = 1;
  454. this.queryForm.pageSize=10;
  455. this.getIssueList();
  456. },
  457. /** 重置按钮操作 */
  458. resetQuery() {
  459. this.resetForm("queryForm");
  460. this.dateRangeCreatedDate = [];
  461. this.handleQuery();
  462. },
  463. /** 查看优惠券信息 */
  464. handlequeryCouponUserList(row) {
  465. console.log(row);
  466. console.log(this.queryCouponUserFrom.issueId);
  467. this.queryCouponUserFrom.issueId=row;
  468. queryCouponUserList(
  469. this.queryCouponUserFrom
  470. ).then((response) => {
  471. this.couponUserList = response.rows;
  472. this.userTotal = response.total;
  473. this.title = "用户优惠券信息";
  474. this.open = true;
  475. });
  476. },
  477. /** 分页查看信息 */
  478. queryCouponUserListByPage() {
  479. queryCouponUserList(
  480. this.queryCouponUserFrom
  481. ).then((response) => {
  482. this.couponUserList = response.rows;
  483. this.userTotal = response.total;
  484. this.title = "用户优惠券信息";
  485. this.open = true;
  486. });
  487. },
  488. },
  489. };
  490. </script>
  491. <style lang="scss">
  492. </style>