Coupon_Statistics1.vue 37 KB

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