Coupon_Statistics.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207
  1. <template>
  2. <div v-if="pageStatus == 0">配置加载中...</div>
  3. <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
  4. <div v-else-if="pageStatus == 2">
  5. 没有此页内容的配置权限,请检查集团上的配置
  6. </div>
  7. <div v-else-if="pageStatus == 3">加载发生错误</div>
  8. <div v-else-if="pageStatus == 4" class="app-container">
  9. <div>
  10. <el-form
  11. :model="createForm"
  12. ref="createForm"
  13. :inline="true"
  14. label-width="88px"
  15. >
  16. <!--
  17. <el-form-item label="设备类型" prop="deviceType">
  18. <el-select
  19. v-model="createForm.deviceType"
  20. clearable
  21. placeholder="请选择"
  22. >
  23. <el-option label="小票打印机" value="1"></el-option>
  24. <el-option label="POS" value="2"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="密钥" prop="deviceSerialNum">
  28. <el-input
  29. v-model="createForm.deviceSerialNum"
  30. placeholder="请输入设备密钥"
  31. clearable
  32. size="small"
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. -->
  37. <el-form-item>
  38. <!--
  39. <el-button
  40. type="cyan"
  41. icon="el-icon-search"
  42. size="mini"
  43. @click="handleQuery"
  44. >搜索</el-button
  45. >
  46. <el-button
  47. type="info"
  48. icon="el-icon-refresh"
  49. size="mini"
  50. @click="resetQuery"
  51. >重置</el-button
  52. >
  53. -->
  54. <el-button
  55. type="primary"
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="handleAdd"
  59. >新增</el-button
  60. >
  61. </el-form-item>
  62. </el-form>
  63. <el-table :data="issueList">
  64. <af-table-column type="expand">
  65. <template slot-scope="props">
  66. <el-table
  67. :data="props.row.couponList"
  68. :show-header="false"
  69. :highlight-current-row="false"
  70. style="width: 90vw"
  71. >
  72. <af-table-column label="名城" align="left">
  73. <template slot-scope="scope">
  74. {{ "优惠券:" }}<b>{{ scope.row.couponRemark }}</b>
  75. </template>
  76. </af-table-column>
  77. <af-table-column label="卡片类型" align="left">
  78. <template slot-scope="scope">
  79. {{
  80. scope.row.couponType == 1
  81. ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
  82. : ""
  83. }}
  84. {{
  85. scope.row.couponType == 2
  86. ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
  87. : ""
  88. }}
  89. {{
  90. scope.row.couponType == 3
  91. ? "兑换券" + "--商品:" + scope.row.couponName
  92. : ""
  93. }}
  94. </template>
  95. </af-table-column>
  96. <af-table-column label="状态" align="left">
  97. <template slot-scope="scope">
  98. {{ scope.row.status == "1" ? "启用状态" : "" }}
  99. {{ scope.row.status == "0" ? "停用状态" : "" }}
  100. </template>
  101. </af-table-column>
  102. </el-table>
  103. <!--
  104. <el-table :data="props.row.couponIssueRelations">
  105. <af-table-column
  106. label="优惠券标识"
  107. align="left"
  108. prop="couponRemark"
  109. disabled
  110. />
  111. <af-table-column label="状态" align="left">
  112. <template slot-scope="scope">
  113. <el-switch
  114. v-model="scope.row.status"
  115. active-value="1"
  116. inactive-value="0"
  117. @change="handleStatusChange(scope.row)"
  118. ></el-switch>
  119. </template>
  120. </af-table-column>
  121. <af-table-column label="卡片类型" align="left">
  122. <template slot-scope="scope">
  123. {{
  124. scope.row.couponType == 1
  125. ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
  126. : ""
  127. }}
  128. {{
  129. scope.row.couponType == 2
  130. ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
  131. : ""
  132. }}
  133. {{
  134. scope.row.couponType == 3
  135. ? "兑换券" + "--商品:" + scope.row.couponName
  136. : ""
  137. }}
  138. </template>
  139. </af-table-column>
  140. <af-table-column
  141. label="优惠券说明"
  142. align="left"
  143. prop="couponDetails"
  144. />
  145. <af-table-column label="使用门槛" align="left">
  146. <template slot-scope="scope">
  147. {{
  148. scope.row.couponType == 1 || scope.row.couponType == 2
  149. ? scope.row.couponThresholdAmt == 0
  150. ? "无门槛"
  151. : "满" + scope.row.couponThresholdAmt + "元可用"
  152. : ""
  153. }}
  154. {{ scope.row.couponType == 3 ? "------------" : "" }}
  155. </template>
  156. </af-table-column>
  157. <af-table-column label="适用" align="left">
  158. <template slot-scope="scope">
  159. {{
  160. scope.row.couponType == 1 || scope.row.couponType == 2
  161. ? "适用油品:" + (scope.row.oilNameList || []).toString()
  162. : ""
  163. }}
  164. {{ scope.row.couponType == 3 ? "核销机构:" : "" }}
  165. </template>
  166. </af-table-column>
  167. <af-table-column label="使用状态" align="left">
  168. <template slot-scope="scope">
  169. {{
  170. "共生成了" +
  171. scope.row.couponNum +
  172. "张,已领取" +
  173. scope.row.couponCumulativeNum +
  174. "张,已使用" +
  175. scope.row.couponUseNum +
  176. "张"
  177. }}
  178. </template>
  179. </af-table-column>
  180. <af-table-column label="有效期内使用限制" align="left">
  181. <template slot-scope="scope">
  182. {{
  183. (scope.row.effectiveTimeType == 1
  184. ? scope.row.effectiveTime[0] +
  185. "到" +
  186. scope.row.effectiveTime[1]
  187. : "用户领取" + scope.row.effectiveDayNum + "天内有效") +
  188. "内有效"
  189. }}
  190. {{ translateTime(scope.row) }}
  191. </template>
  192. </af-table-column>
  193. <af-table-column label="领取限制" align="left">
  194. <template slot-scope="scope">
  195. {{
  196. "单用户最多持有" +
  197. scope.row.couponHoldNum +
  198. "张,累计可拥有" +
  199. scope.row.couponReceiveNum +
  200. "张"
  201. }}
  202. </template>
  203. </af-table-column>
  204. <af-table-column label="优惠叠加" align="left">
  205. <template slot-scope="scope">
  206. {{
  207. scope.row.couponType == 1 || scope.row.couponType == 2
  208. ? ["不", ""][scope.row.isCardFlag] +
  209. "可用电子卡," +
  210. ["不", ""][scope.row.isGradeFlag] +
  211. "可用等级优惠," +
  212. ["不", ""][scope.row.isMarketFlag] +
  213. "可用优惠方案"
  214. : ""
  215. }}
  216. {{ scope.row.couponType == 3 ? "------------" : "" }}
  217. </template>
  218. </af-table-column>
  219. <af-table-column
  220. label="操作"
  221. align="left"
  222. class-name="small-padding fixed-width"
  223. width="120px"
  224. >
  225. <template slot-scope="scope">
  226. <el-button
  227. size="mini"
  228. type="text"
  229. icon="el-icon-edit"
  230. @click="handleUpdate(scope.row)"
  231. v-if="scope.row.editFlag"
  232. >修改</el-button
  233. >
  234. </template>
  235. </af-table-column>
  236. </el-table>
  237. -->
  238. </template>
  239. </af-table-column>
  240. <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
  241. <af-table-column label="状态" align="left">
  242. <template slot-scope="scope">
  243. <el-switch
  244. v-model="scope.row.status"
  245. active-value="1"
  246. inactive-value="0"
  247. @change="handleStatusChange(scope.row)"
  248. ></el-switch>
  249. </template>
  250. </af-table-column>
  251. <af-table-column label="活动名称" align="left" prop="issueName" />
  252. <af-table-column label="类型" align="left">
  253. <template slot-scope="scope">
  254. {{ scope.row.issueType == "1" ? "消费发放" : "" }}
  255. {{ scope.row.issueType == "2" ? "网页方式、二维码-静态码" : "" }}
  256. {{ scope.row.issueType == "3" ? "支付成功后的领取位" : "" }}
  257. </template>
  258. </af-table-column>
  259. <af-table-column label="操作" align="left">
  260. <template slot-scope="scope">
  261. {{
  262. scope.row.issueType == "1" || scope.row.issueType == "3"
  263. ? "-------"
  264. : ""
  265. }}
  266. <el-button
  267. size="mini"
  268. type="text"
  269. icon="el-icon-download"
  270. @click="handleExport(scope.row)"
  271. v-if="scope.row.issueType == '2'"
  272. >导出二维码、网址</el-button
  273. >
  274. </template>
  275. </af-table-column>
  276. <af-table-column label="发放门槛" align="left">
  277. <template slot-scope="scope">
  278. {{
  279. scope.row.issueType == "1"
  280. ? scope.row.discountThresholdAmt == "0"
  281. ? "无门槛,消费都发放"
  282. : "满" + scope.row.discountThresholdAmt + "元发放"
  283. : ""
  284. }}
  285. {{ scope.row.issueType != "1" ? "-------" : "" }}
  286. </template>
  287. </af-table-column>
  288. <af-table-column label="领取限制" align="left">
  289. <template slot-scope="scope">
  290. {{ scope.row.issueType == "1" ? "-------" : "" }}
  291. {{
  292. scope.row.issueType != "1"
  293. ? "单个用户能进入这个领取界面" +
  294. scope.row.giveCount +
  295. "次,一次可以领取" +
  296. scope.row.giveLimit +
  297. "张优惠券"
  298. : ""
  299. }}
  300. </template>
  301. </af-table-column>
  302. <af-table-column label="可领取时间段" align="left">
  303. <template slot-scope="scope">
  304. {{ translateTime(scope.row) }}
  305. </template>
  306. </af-table-column>
  307. <!-- <af-table-column label="面值" align="left" prop="gunNo" /> -->
  308. <!-- <af-table-column label="有效期" align="left" prop="deviceFactory" /> -->
  309. <!--
  310. <af-table-column
  311. label="操作"
  312. align="left"
  313. class-name="small-padding fixed-width"
  314. width="120px"
  315. >
  316. <template slot-scope="scope">
  317. <el-button
  318. size="mini"
  319. type="text"
  320. icon="el-icon-edit"
  321. @click="handleUpdate(scope.row)"
  322. >修改</el-button
  323. >
  324. </template>
  325. </af-table-column>
  326. -->
  327. </el-table>
  328. <pagination
  329. :hidden="total > 0 ? false : true"
  330. :total="total"
  331. :page.sync="queryForm.pageNum"
  332. :limit.sync="queryForm.pageSize"
  333. @pagination="getIssueList"
  334. :autoScroll="true"
  335. />
  336. </div>
  337. <!-- 添加或修改油站设备管理对话框 -->
  338. <el-dialog
  339. :title="title"
  340. :visible.sync="open"
  341. width="600px"
  342. append-to-body
  343. status-icon
  344. >
  345. <el-form
  346. ref="dialogForm"
  347. :model="createForm"
  348. :rules="rules"
  349. label-width="180px"
  350. >
  351. <el-form-item
  352. label="发放标识(给油站备注)"
  353. prop="issueRemark"
  354. :rules="{
  355. required: true,
  356. message: '请填入方案方式标识',
  357. trigger: 'blur',
  358. }"
  359. >
  360. <input
  361. type="text"
  362. class="form-control"
  363. v-model="createForm.issueRemark"
  364. style="width: 180px"
  365. />
  366. </el-form-item>
  367. <el-form-item
  368. label="活动名称(给用户展示)"
  369. prop="issueName"
  370. :rules="{
  371. required: true,
  372. message: '请填入活动名称',
  373. trigger: 'blur',
  374. }"
  375. >
  376. <input
  377. type="text"
  378. class="form-control"
  379. v-model="createForm.issueName"
  380. style="width: 180px"
  381. />
  382. </el-form-item>
  383. <el-form-item
  384. label="发放类型"
  385. prop="issueType"
  386. :rules="{
  387. required: true,
  388. message: '请选择发放类型',
  389. trigger: 'change',
  390. }"
  391. >
  392. <el-radio-group v-model="createForm.issueType">
  393. <div>
  394. <el-radio label="1">消费发放</el-radio>
  395. </div>
  396. <div>
  397. <el-radio label="2">网页方式、二维码-静态码</el-radio>
  398. </div>
  399. <div>
  400. <el-radio label="3">支付成功后的领取位(只能设置一次)</el-radio>
  401. </div>
  402. </el-radio-group>
  403. </el-form-item>
  404. <el-form-item
  405. label="能进入的次数"
  406. prop="giveCount"
  407. v-if="createForm.issueType != 1"
  408. :rules="{
  409. required: createForm.issueType != 1,
  410. message: '请填入能进入的次数',
  411. trigger: 'blur',
  412. }"
  413. >
  414. 单个用户能进入这个领取界面
  415. <input
  416. type="text"
  417. class="form-control d-inline-block"
  418. v-model.number="createForm.giveCount"
  419. style="width: 80px"
  420. />
  421. </el-form-item>
  422. <el-form-item
  423. label="一次能领取几张次数"
  424. prop="giveLimit"
  425. v-if="createForm.issueType != 1"
  426. :rules="{
  427. required: createForm.issueType != 1,
  428. message: '请填入一次能领取几张次数',
  429. trigger: 'blur',
  430. }"
  431. >
  432. 用户进入后一次能领取<input
  433. type="text"
  434. class="form-control d-inline-block"
  435. v-model.number="createForm.giveLimit"
  436. style="width: 80px"
  437. />张
  438. </el-form-item>
  439. <el-form-item
  440. label="发放门槛"
  441. prop="discountThresholdAmt"
  442. v-if="createForm.issueType == 1"
  443. >
  444. 消费达到
  445. <input
  446. type="text"
  447. class="form-control d-inline-block"
  448. v-model.number="createForm.discountThresholdAmt"
  449. style="width: 80px"
  450. />元时,系统自动发放
  451. </el-form-item>
  452. <el-form-item label="可领取时间段" prop="availableControl">
  453. <div>
  454. <el-radio-group
  455. v-model="createForm.availableControl"
  456. @change="availableControlChange"
  457. >
  458. <div>
  459. <div>
  460. <el-radio label="0">一直都可用</el-radio>
  461. <el-radio label="1">每周指定日</el-radio>
  462. </div>
  463. <div>
  464. <el-radio label="2">每月指定日</el-radio>
  465. <el-radio label="3">固定指定日</el-radio>
  466. </div>
  467. </div>
  468. </el-radio-group>
  469. </div>
  470. <div
  471. v-if="
  472. createForm.availableControl == 1 ||
  473. createForm.availableControl == 2 ||
  474. createForm.availableControl == 3
  475. "
  476. style="margin-top: 10px"
  477. >
  478. <select-day
  479. :type="createForm.availableControl"
  480. :day.sync="createForm.appointedDaysList"
  481. :cycle.sync="createForm.cycleDaysList"
  482. >
  483. </select-day>
  484. </div>
  485. </el-form-item>
  486. <el-form-item
  487. label="此领取方式下的优惠券"
  488. prop="couponIssueRelationList"
  489. >
  490. (用于用户领取)
  491. </el-form-item>
  492. <div>
  493. <el-col :span="11">
  494. <el-table
  495. :data="unselectedCouponList"
  496. border
  497. size="mini"
  498. :resizable="false"
  499. highlight-current-row
  500. height="500"
  501. @selection-change="handleLeftChange"
  502. disabled
  503. ref="leftTable"
  504. >
  505. >
  506. <el-table-column label="可选">
  507. <el-table-column
  508. prop="phone"
  509. label="姓名"
  510. type="selection"
  511. ></el-table-column>
  512. <el-table-column
  513. prop="couponRemark"
  514. label="优惠券"
  515. ></el-table-column>
  516. <el-table-column label="添加" width="60px" align="center">
  517. <template slot-scope="scope">
  518. <el-button
  519. type="text"
  520. icon="el-icon-circle-plus-outline"
  521. class="underline btn24"
  522. size="mini"
  523. @click="handleMoveLabel('right', scope.row)"
  524. >添加</el-button
  525. >
  526. </template>
  527. </el-table-column>
  528. </el-table-column>
  529. </el-table>
  530. </el-col>
  531. <el-col :span="2" style="text-align: center">
  532. <el-button
  533. type="primary"
  534. size="mini"
  535. @click="toggleLabel"
  536. style="
  537. margin-top: 200px;
  538. text-align: center;
  539. width: 30px;
  540. padding-right: 0;
  541. padding-left: 0;
  542. "
  543. :disabled="toggleable"
  544. >切换</el-button
  545. >
  546. </el-col>
  547. <el-col :span="11">
  548. <el-table
  549. :data="selectedCouponList"
  550. border
  551. size="mini"
  552. highlight-current-row
  553. :resizable="false"
  554. height="500"
  555. @selection-change="handleRightChange"
  556. :loading="true"
  557. ref="rightTable"
  558. >
  559. <el-table-column label="已选" :resizable="false">
  560. <el-table-column
  561. prop="phone"
  562. type="selection"
  563. ></el-table-column>
  564. <el-table-column
  565. prop="couponRemark"
  566. label="优惠券"
  567. ></el-table-column>
  568. <el-table-column label="移除" width="60px" align="center">
  569. <template slot-scope="scope">
  570. <el-button
  571. type="text"
  572. icon="el-icon-remove-outline"
  573. class="underline btn24"
  574. size="mini"
  575. @click="handleMoveLabel('left', scope.row)"
  576. >移除</el-button
  577. >
  578. </template>
  579. </el-table-column>
  580. </el-table-column>
  581. </el-table>
  582. </el-col>
  583. </div>
  584. </el-form>
  585. <div slot="footer" class="dialog-footer">
  586. <el-button type="primary" @click="submitForm">确 定</el-button>
  587. <el-button @click="cancel">取 消</el-button>
  588. </div>
  589. </el-dialog>
  590. <el-dialog
  591. :visible.sync="exportQrDialog"
  592. width="600px"
  593. append-to-body
  594. title="导出标签"
  595. >
  596. <div>
  597. <qr
  598. :text="currentExport.text"
  599. @downloadImg="downloadImg"
  600. :name="currentExport.name + '活动二维码'"
  601. >
  602. <div>{{ currentExport.name }} 活动二维码<b></b></div>
  603. </qr>
  604. <!--
  605. <div
  606. style="text-align: center; margin-top: 15px"
  607. v-clipboard:copy="currentExport.text"
  608. v-clipboard:error="onCopyError"
  609. v-clipboard:success="onCopySuccess"
  610. >
  611. 👇点击复制网址👇
  612. </div>
  613. -->
  614. <div
  615. style="text-align: center; margin-top: 15px"
  616. v-clipboard:copy="currentExport.text"
  617. v-clipboard:error="onCopyError"
  618. v-clipboard:success="onCopySuccess"
  619. >
  620. 活动网址:{{ currentExport.text }}
  621. </div>
  622. <div
  623. style="text-align: center"
  624. v-clipboard:copy="currentExport.text"
  625. v-clipboard:error="onCopyError"
  626. v-clipboard:success="onCopySuccess"
  627. >
  628. 👆点击复制网址👆
  629. </div>
  630. </div>
  631. </el-dialog>
  632. </div>
  633. </template>
  634. <script>
  635. import {
  636. listManage,
  637. getManage,
  638. delManage,
  639. addManage,
  640. updateManage,
  641. exportManage,
  642. changeManageStatus,
  643. } from "@/api/station/manage";
  644. import { listPrice } from "@/api/station/price";
  645. import Vue from "vue";
  646. import VueClipboard from "vue-clipboard2";
  647. import Qr from "@/components/QrCode";
  648. import Base64 from "@/utils/base64";
  649. Vue.use(VueClipboard);
  650. import {
  651. addInfo,
  652. listInfo,
  653. updateInfo,
  654. changeCouponStatus,
  655. addIssue,
  656. listIssue,
  657. upIssueStatus,
  658. } from "@/api/coupon";
  659. import SelectDay from "@/components/SelectDay";
  660. import settings from "@/settings";
  661. export default {
  662. name: "Coupon_CreateIssue",
  663. data() {
  664. let validateGunNo = (rule, value, callback) => {
  665. callback();
  666. };
  667. let validateAvailableControl = (rule, value, callback) => {
  668. if (
  669. this.createForm.availableControl == 1 ||
  670. this.createForm.availableControl == 2
  671. ) {
  672. if (this.createForm.cycleDaysList.length == 0) {
  673. callback(new Error("请选择时间"));
  674. return;
  675. }
  676. }
  677. if (this.createForm.availableControl == 3) {
  678. if (this.createForm.appointedDaysList.length == 0) {
  679. callback(new Error("请选择日期"));
  680. return;
  681. }
  682. }
  683. callback();
  684. };
  685. let validateCouponIssueRelationList = (rule, value, callback) => {
  686. if (this.createForm.couponIssueRelationList.length == 0) {
  687. callback(new Error("请选择优惠券"));
  688. }
  689. callback();
  690. };
  691. return {
  692. couponEnabledFlag: "1",
  693. exportQrDialog: false,
  694. pageStatus: 4,
  695. createForm: {
  696. issueRemark: "",
  697. issueName: "",
  698. showIdList: [],
  699. availableControl: "0",
  700. appointedDaysList: [],
  701. cycleDaysList: [],
  702. issueType: "",
  703. discountThresholdAmt: "0",
  704. couponIssueRelationList: [],
  705. giveLimit: 9,
  706. giveCount: 999999,
  707. },
  708. currentExport: {
  709. text: "error",
  710. type: "你好",
  711. name: "二维码",
  712. },
  713. couponList: [],
  714. oilNameList: [],
  715. allVerificationList: [],
  716. equipmentList: [],
  717. // 油枪复选
  718. allGunList: [],
  719. // 已选的油枪
  720. checkedGunList: [],
  721. //设备状态
  722. deviceStatusOptions: [],
  723. //设备类型
  724. deviceTypeOptions: [],
  725. stationOptions: [],
  726. // 弹出层标题
  727. title: "",
  728. // 是否显示弹出层
  729. open: false,
  730. // 总条数
  731. total: 100,
  732. leftQuery: {},
  733. rightQuery: {},
  734. leftData: [],
  735. rightData: [],
  736. moveRightData: [],
  737. moveLeftData: [],
  738. // 查询参数
  739. queryForm: {
  740. pageNum: 1,
  741. pageSize: 10, // 初始值只能比10大
  742. },
  743. // 表单校验
  744. rules: {
  745. availableControl: [
  746. {
  747. required: true,
  748. message: "请选择有效期内时间控制",
  749. trigger: "change",
  750. },
  751. { validator: validateAvailableControl, trigger: "change" },
  752. ],
  753. couponIssueRelationList: [
  754. {
  755. required: true,
  756. message: "请选择优惠券",
  757. trigger: "change",
  758. },
  759. { validator: validateCouponIssueRelationList, trigger: "change" },
  760. ],
  761. },
  762. day: [],
  763. cycle: [],
  764. issueList: [],
  765. timeSelect: [
  766. ,
  767. ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
  768. [
  769. "1号",
  770. "2号",
  771. "3号",
  772. "4号",
  773. "5号",
  774. "6号",
  775. "7号",
  776. "8号",
  777. "9号",
  778. "10号",
  779. "11号",
  780. "12号",
  781. "13号",
  782. "14号",
  783. "15号",
  784. "16号",
  785. "17号",
  786. "18号",
  787. "19号",
  788. "20号",
  789. "21号",
  790. "22号",
  791. "23号",
  792. "24号",
  793. "25号",
  794. "26号",
  795. "27号",
  796. "28号",
  797. "29号",
  798. "30号",
  799. "31号",
  800. ],
  801. ],
  802. };
  803. },
  804. components: {
  805. SelectDay: SelectDay,
  806. Qr: Qr,
  807. VueClipboard: VueClipboard,
  808. },
  809. created() {
  810. console.log("哈哈");
  811. console.log("settings", settings);
  812. // this.init();
  813. this.getCoupon();
  814. // this.setPageStatus();
  815. this.getIssueList();
  816. },
  817. computed: {
  818. toggleable() {
  819. if (this.moveRightData.length === 0 && this.moveLeftData.length === 0) {
  820. return true;
  821. }
  822. return false;
  823. },
  824. selectedCouponList() {
  825. return this.couponList.filter((ele) => {
  826. if (this.createForm.couponIssueRelationList == null) {
  827. this.createForm.couponIssueRelationList = [];
  828. }
  829. return this.createForm.couponIssueRelationList.includes(ele.id);
  830. });
  831. },
  832. unselectedCouponList() {
  833. return this.couponList.filter((ele) => {
  834. if (this.createForm.couponIssueRelationList == null) {
  835. this.createForm.couponIssueRelationList = [];
  836. }
  837. return !!!this.createForm.couponIssueRelationList.includes(ele.id);
  838. });
  839. },
  840. getTodayDateString() {
  841. const date = new Date();
  842. let y = date.getFullYear();
  843. let m = date.getMonth().toString();
  844. let s = date.getDate().toString();
  845. m = "" + (m.length == 1 ? "0" : "") + m;
  846. s = "" + (s.length == 1 ? "0" : "") + s;
  847. console.log("" + h + ":" + m + ":" + s);
  848. return "" + y + ":" + m + ":" + s;
  849. },
  850. },
  851. methods: {
  852. onCopySuccess() {
  853. this.msgSuccess("网址已经拷贝到剪切板");
  854. },
  855. onCopyError() {
  856. this.msgError("网址拷贝失败,请手动复制");
  857. },
  858. // exportUrl(url){
  859. // this.currentExport.name = emp.personnelName;
  860. // this.currentExport.type = 1;
  861. // const encodeStr = "e" + emp.personnelId + "/l" + this.currentExport.labelId + "/";
  862. // const encodedStr = this.base.encode(encodeStr);
  863. // const trimEqualStr = encodedStr.replace(/={1,}$/g, "");
  864. // this.currentExport.text = "https://goto.huijy.net/" + this.deptId + "/" + trimEqualStr;
  865. // this.exportQrDialog = true;
  866. // },
  867. handleExport(row) {
  868. this.currentExport.name = row.issueName;
  869. const base64 = Base64.getInstance();
  870. const encodeStr = "i" + row.id;
  871. const encodedStr = base64.encode(encodeStr);
  872. const trimEqualStr = encodedStr.replace(/={1,}$/g, "");
  873. this.exportQrDialog = true;
  874. this.currentExport.text =
  875. settings.baseURL + this.deptId + "/" + trimEqualStr;
  876. },
  877. downloadImg() {
  878. console.log('');
  879. },
  880. translateTime(row) {
  881. let timeString = "";
  882. const availableControleType = row.availableControl;
  883. if (availableControleType == 0) {
  884. return "用户一直都可以领取";
  885. }
  886. timeString = "用户只能在";
  887. if (availableControleType == 1) {
  888. timeString += "每周的";
  889. }
  890. if (availableControleType == 2) {
  891. timeString += "每月的";
  892. }
  893. if (availableControleType == 3) {
  894. timeString += "指定的日期 ";
  895. }
  896. if (availableControleType == 1 || availableControleType == 2) {
  897. row.cycleDaysList.forEach((ele) => {
  898. timeString += this.timeSelect[availableControleType][ele] + "、";
  899. });
  900. } else if (availableControleType == 3) {
  901. timeString += row.appointedDaysList.toString();
  902. }
  903. timeString = timeString.replace(/(、)$/g, "") + "可以领取劵";
  904. return timeString;
  905. },
  906. getIssueList() {
  907. listIssue(this.queryForm)
  908. .then((res) => {
  909. if (res.code == 200) {
  910. if (res.rows == null) {
  911. this.total = 0;
  912. this.issueList = [];
  913. } else {
  914. this.total = res.total;
  915. this.issueList = res.rows;
  916. }
  917. } else {
  918. throw new Error("");
  919. }
  920. })
  921. .catch((err) => {
  922. this.msgError("亲,拉取领取方式列表失败~");
  923. });
  924. },
  925. getCoupon() {
  926. listInfo({
  927. pageNum: 1,
  928. pageSize: 1000,
  929. status: 1,
  930. })
  931. .then((res) => {
  932. if (res.code == 200) {
  933. if (res.rows == null) {
  934. this.couponList = [];
  935. } else {
  936. this.couponList = res.rows;
  937. }
  938. } else {
  939. throw new Error("");
  940. }
  941. })
  942. .catch((err) => {
  943. this.msgError("亲,拉取优惠券列表失败~");
  944. });
  945. },
  946. availableControlChange() {
  947. this.createForm.appointedDaysList = [];
  948. this.createForm.cycleDaysList = [];
  949. this.createForm = { ...this.createForm };
  950. },
  951. handleMoveLabel(direction, row) {
  952. console.log(row);
  953. if (this.createForm.couponIssueRelationList == null) {
  954. this.createForm.couponIssueRelationList = [];
  955. }
  956. if (direction == "right") {
  957. this.createForm.couponIssueRelationList.push(row.id);
  958. } else {
  959. this.createForm.couponIssueRelationList =
  960. this.createForm.couponIssueRelationList.filter((ele) => {
  961. return ele != row.id;
  962. });
  963. }
  964. },
  965. handleFlagChange() {
  966. const that = this;
  967. let text = this.couponEnabledFlag === "1" ? "启用" : "停用";
  968. this.$confirm('确认要"' + text + '"优惠券功能吗?', "警告", {
  969. confirmButtonText: "确定",
  970. cancelButtonText: "取消",
  971. type: "warning",
  972. })
  973. .then(function () {
  974. return changeCouponStatus({
  975. deptId: that.deptId,
  976. couponEnabledFlag: that.couponEnabledFlag,
  977. });
  978. })
  979. .then(() => {
  980. that.msgSuccess(text + "成功");
  981. })
  982. .catch(function () {
  983. that.couponEnabledFlag = that.couponEnabledFlag === "0" ? "1" : "0";
  984. });
  985. },
  986. handleStatusChange(row) {
  987. let text = row.status === "1" ? "启用" : "停用";
  988. this.$confirm(
  989. '确认要"' + text + '""' + row.issueName + '"发放方式吗?',
  990. "警告",
  991. {
  992. confirmButtonText: "确定",
  993. cancelButtonText: "取消",
  994. type: "warning",
  995. }
  996. )
  997. .then(function () {
  998. return upIssueStatus({
  999. id: row.id,
  1000. status: row.status,
  1001. });
  1002. })
  1003. .then(() => {
  1004. this.msgSuccess(text + "成功");
  1005. })
  1006. .catch(function () {
  1007. row.status = row.status === "0" ? "1" : "0";
  1008. });
  1009. },
  1010. toggleLabel() {
  1011. if (this.moveLeftData.length !== 0) {
  1012. this.createForm.couponIssueRelationList =
  1013. this.createForm.couponIssueRelationList.filter((ele) => {
  1014. return ele != this.moveLeftData;
  1015. });
  1016. this.createForm = { ...this.createForm };
  1017. return;
  1018. }
  1019. if (this.moveRightData.length !== 0) {
  1020. this.createForm.couponIssueRelationList = [
  1021. ...new Set(
  1022. this.createForm.couponIssueRelationList.concat(this.moveRightData)
  1023. ),
  1024. ].filter((ele) => {
  1025. return !!ele;
  1026. });
  1027. this.createForm = { ...this.createForm };
  1028. return;
  1029. }
  1030. return;
  1031. },
  1032. handleLeftChange(val) {
  1033. let changeArr = [];
  1034. val.map((ele) => {
  1035. changeArr.push(ele.id);
  1036. });
  1037. console.log(changeArr);
  1038. this.moveLeftData = [];
  1039. this.moveRightData = changeArr;
  1040. // console.log(this.moveRightData);
  1041. this.$refs.rightTable.clearSelection();
  1042. },
  1043. handleRightChange(val) {
  1044. let changeArr = [];
  1045. val.map((ele) => {
  1046. changeArr.push(ele.id);
  1047. });
  1048. this.moveLeftData = changeArr;
  1049. this.moveRightData = [];
  1050. this.$refs.leftTable.clearSelection();
  1051. },
  1052. init() {
  1053. this.getOilList();
  1054. this.getCoupon();
  1055. this.getVerificationList();
  1056. },
  1057. setPageStatus() {
  1058. this.queryPageStatus([2]).then((res) => {
  1059. this.pageStatus = res;
  1060. });
  1061. },
  1062. // 取消按钮
  1063. cancel() {
  1064. this.open = false;
  1065. },
  1066. /** 搜索按钮操作 */
  1067. handleQuery() {
  1068. this.createForm.pageNum = 1;
  1069. this.getList();
  1070. },
  1071. deviceNoInput(value) {
  1072. this.dialogForm.posQueue = value;
  1073. },
  1074. /** 重置按钮操作 */
  1075. resetQuery() {
  1076. this.resetForm("createForm");
  1077. this.handleQuery();
  1078. },
  1079. /** 新增按钮操作 */
  1080. handleAdd() {
  1081. this.createForm = {
  1082. issueRemark: "",
  1083. issueName: "",
  1084. showIdList: [],
  1085. availableControl: "0",
  1086. appointedDaysList: [],
  1087. cycleDaysList: [],
  1088. issueType: "",
  1089. discountThresholdAmt: "0",
  1090. couponIssueRelationList: [],
  1091. giveLimit: 9,
  1092. giveCount: 999999,
  1093. }
  1094. ;
  1095. this.title = "添加优惠券";
  1096. // this.createForm = {
  1097. // couponName: "",
  1098. // couponDetails: "",
  1099. // couponThresholdAmt: 0,
  1100. // couponType: "1",
  1101. // couponAmt: 0,
  1102. // oilNameList: [],
  1103. // effectiveTimeType: "",
  1104. // effectiveTime: [],
  1105. // effectiveDayNum: 30,
  1106. // couponHoldNum: 1,
  1107. // couponReceiveNum: 100,
  1108. // couponNum: 100,
  1109. // status: "1",
  1110. // couponIssueRelationList: [],
  1111. // isCardFlag: "1",
  1112. // isGradeFlag: "1",
  1113. // isMarketFlag: "1",
  1114. // };
  1115. this.open = true;
  1116. },
  1117. /** 修改按钮操作 */
  1118. handleUpdate(row) {
  1119. // // 查找自己已经选中的枪号
  1120. this.createForm = JSON.parse(JSON.stringify(row));
  1121. this.title = "修改油站设备管理";
  1122. this.open = true;
  1123. },
  1124. /** 提交按钮 */
  1125. submitForm() {
  1126. console.log(123);
  1127. this.$refs["dialogForm"].validate((valid) => {
  1128. if (valid) {
  1129. if (!!this.createForm.id) {
  1130. updateIssue(this.createForm)
  1131. .then((res) => {
  1132. if (res.code == 200) {
  1133. this.msgSuccess("亲,修改成功了~");
  1134. this.getIssueList();
  1135. this.open = false;
  1136. } else {
  1137. throw new Error("");
  1138. }
  1139. })
  1140. .catch((err) => {
  1141. this.msgError("修改失败了呀~");
  1142. });
  1143. } else {
  1144. addIssue(this.createForm)
  1145. .then((res) => {
  1146. if (res.code == 200) {
  1147. this.msgSuccess("亲,新增成功了~");
  1148. this.getIssueList();
  1149. this.open = false;
  1150. } else {
  1151. throw new Error("");
  1152. }
  1153. })
  1154. .catch((err) => {
  1155. this.msgError("创建失败了~");
  1156. });
  1157. }
  1158. }
  1159. });
  1160. },
  1161. /** 删除按钮操作 */
  1162. handleDelete(row) {
  1163. const deviceIds = row.deviceId;
  1164. this.$confirm("是否确认删除油站设备管理", "警告", {
  1165. confirmButtonText: "确定",
  1166. cancelButtonText: "取消",
  1167. type: "warning",
  1168. })
  1169. .then(function () {
  1170. return delManage(deviceIds);
  1171. })
  1172. .then(() => {
  1173. this.getList();
  1174. this.msgSuccess("删除成功");
  1175. });
  1176. },
  1177. },
  1178. };
  1179. </script>
  1180. <style lang="scss">
  1181. .el-transfer__buttons {
  1182. }
  1183. </style>