discountCardDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <view class="box">
  3. <view style="width: 750rpx;height: 172rpx;" class="boxtop" :style="{background:'#'+themeColor}"></view>
  4. <view class="detailBg">
  5. <view class="detailTop">
  6. <view class="leftB">
  7. <view class="use">¥<span class="use2">{{detail.actMoney}}</span></view>
  8. <!-- <view class="used" v-else>¥<span class="used2">{{detail.actMoney}}</span></view> -->
  9. <view class="tiaojian">{{detail.whereMoney!==0?'满'+detail.whereMoney+'元可用':'满任意金额可用'}}</view>
  10. </view>
  11. <view class="centerB">
  12. <view class="name">
  13. <span class="djq" v-if="detail.discountType==1">代金券</span>
  14. <span class="djq" v-if="detail.discountType==2">商品券</span>
  15. <span class="djq" v-if="detail.discountType==3">服务券</span>
  16. <span>{{detail.actName}}</span>
  17. </view>
  18. <view class="time" v-if="detail.startTime">
  19. 有效期:{{detail.startTime.slice(0,10)}}至{{detail.endTime.slice(0,10)}}</view>
  20. <view class="time" v-else>有效期:领取后{{detail.endOffsetDays}}天</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="comtentBox">
  25. <view style="margin-bottom: 30rpx;">
  26. <view style="display: flex;justify-content: space-between;">
  27. <view class="titleBox">
  28. <image src="../../static/img/icon_youhui_red.png" mode="" class="redPoint"></image>
  29. <view class="title">适用门店</view>
  30. </view>
  31. <view @click="spShopS" style="color: #666666;font-size: 24rpx;line-height: 24rpx;display: flex;">
  32. {{detail.shopNames.split(',').length}}家门店通用
  33. <image src="../../static/img/little_rightArrow.png" mode="" style="width: 24rpx;height: 24rpx;"></image>
  34. </view>
  35. </view>
  36. <view v-for="(v,index) in detail.shopNames.split(',')" v-if="index<5">
  37. <view class="content">{{v}}</view>
  38. </view>
  39. </view>
  40. <view>
  41. <view class="titleBox">
  42. <image src="../../static/img/icon_youhui_red.png" mode="" class="redPoint"></image>
  43. <view class="title">使用说明</view>
  44. </view>
  45. <view style="font-size: 20rpx;" v-if="detail.couContent" v-html="detail.couContent"></view>
  46. <view v-else class="content">暂无</view>
  47. </view>
  48. </view>
  49. <view class="comtentBox" v-if="detail.usedState==1">
  50. <view class="titleBox">
  51. <image src="../../static/img/icon_youhui_red.png" mode="" class="redPoint"></image>
  52. <view class="title">使用记录</view>
  53. </view>
  54. <view class="couponCodeBox">
  55. <view class="couponCodeYd"></view>
  56. <view class="ouponCode">{{detail.couponCode}}</view>
  57. <view class="couponCodeUse">已使用</view>
  58. </view>
  59. <view class="couponCodeLine">
  60. <view class="couponCodeLeft">核销时间:</view>
  61. <view class="couponCodeLineRight">{{detail.usedTime}}</view>
  62. </view>
  63. <view class="couponCodeLine">
  64. <view class="couponCodeLeft">核销门店:</view>
  65. <view class="couponCodeLineRight">{{detail.usedShopName}}</view>
  66. </view>
  67. </view>
  68. <view style="height: 120rpx;"></view>
  69. <view class="useBox" v-if="detail.usedState==0">
  70. <view class="useBtn" @click="hxHide">去使用</view>
  71. </view>
  72. <!-- 核销码 -->
  73. <view class="authorizBox" v-if="hxShow" @click="hxclose">
  74. <view class="hxBox" @click.stop="">
  75. <view class="chBox">
  76. <img src="../../static/timg/chahao.png" alt="" class="chahaoImg" @click="hxclose"/>
  77. </view>
  78. <view class="hxName">{{detail.actName}}</view>
  79. <view class="hxTime" v-if="detail.startTime">
  80. 有效期:{{detail.startTime.slice(0,10)}}至{{detail.endTime.slice(0,10)}}</view>
  81. <view class="hxTime" v-else>有效期:领取后{{detail.endOffsetDays}}天</view>
  82. <view style="display: flex;justify-content: center;padding-top:50rpx;">
  83. <tki-qrcode cid="qrcode1" ref="qrcode" :val="detail.couponCode" :size="400" :unit="unit"
  84. :pdground="pdground" :icon="icon" :iconSize="iconsize" :lv="lv" :onval="onval"
  85. :loadMake="loadMake" :usingComponents="true" @result="qrR" />
  86. </view>
  87. <view class="couponCode">{{detail.couponCode}}</view>
  88. <view class="couponCodeTs">请到店出示券码即可开始服务</view>
  89. </view>
  90. </view>
  91. <!-- 适用门店 -->
  92. <view class="authorizBox" v-if="spShopShow" @click="spShopHide">
  93. <view class="syShopBox" @click.stop="">
  94. <view class="chBox2">
  95. <view class="syShopTitle">适用门店</view>
  96. <img src="../../static/timg/chahao.png" alt="" class="chahaoImg" @click="spShopHide"/>
  97. </view>
  98. <view class="spShopLineBox">
  99. <view class="spShopLine" v-for="(item,index) in detail.shopNames.split(',')">{{item}}</view>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- 手机号授权 -->
  104. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  105. <view class="authorizCont" @click.stop="">
  106. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  107. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  108. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  109. </view>
  110. <view style="text-align: center;padding-top: 56rpx;">
  111. <image src="../../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
  118. export default {
  119. components: {
  120. tkiQrcode,
  121. },
  122. data() {
  123. return {
  124. id: '',
  125. detail: {},
  126. themeColor:'',
  127. type:'',
  128. userInfo:'',
  129. ext:'',
  130. wxOpenData:'',
  131. authorizShow:false,
  132. onval: true, // val值变化时自动重新生成二维码
  133. loadMake: true, // 组件加载完成后自动生成二维码
  134. val: '二维码', // 要生成的二维码值
  135. unit: 'upx', // 单位
  136. background: '#b4e9e2', // 背景色
  137. foreground: '#309286', // 前景色
  138. pdground: '#262637', // 角标色
  139. icon: '', // 二维码图标
  140. iconsize: 40, // 二维码图标大小
  141. lv: 3, // 二维码容错级别 , 一般不用设置,默认就行
  142. src: '', // 二维码生成后的图片地址或base64
  143. hxShow:false,
  144. spShopShow:false,
  145. }
  146. },
  147. onLoad(opt) {
  148. this.themeColor = uni.getStorageSync("themeColor");
  149. this.id = opt.id;
  150. this.type=opt.type;
  151. this.userInfo=this.$store.state.userInfo;
  152. this.ext=this.$common.getExtStoreId();
  153. if(this.userInfo){
  154. if (this.id) {
  155. this.getData();
  156. }
  157. }else{
  158. this.$common.automaticlogin().then(val => {
  159. this.userInfo=this.$store.state.userInfo;
  160. this.wxOpenData=this.$store.state.wxOpenData;
  161. this.themeColor = uni.getStorageSync("themeColor");
  162. if (this.id) {
  163. this.getData();
  164. }
  165. if(!this.userInfo){
  166. this.authorizShow=true
  167. }
  168. })
  169. }
  170. //this.getData();
  171. },
  172. methods: {
  173. spShopHide(){
  174. this.spShopShow=false;
  175. },
  176. spShopS(){
  177. this.spShopShow=true;
  178. },
  179. hxHide(){
  180. this.hxShow=true;
  181. },
  182. hxclose(){
  183. this.hxShow=false;
  184. },
  185. getData() {
  186. uni.showLoading({
  187. title: '加载中'
  188. });
  189. if(this.type==2){
  190. var url='opencoupon/detailsCouponDetails';
  191. var params={
  192. id: this.id,
  193. custId:this.$store.state.wxOpenData.loginInfo.customerInfo.id
  194. }
  195. }else{
  196. var url='opencoupon/detailsCoupon'
  197. var params={
  198. id: this.id,
  199. }
  200. }
  201. this.$http(url, params, 'GET').then(res => {
  202. uni.hideLoading();
  203. res.data.couContent=res.data.couContent.replaceAll('font-size:15px', 'font-size:12px');
  204. res.data.couContent=res.data.couContent.replaceAll('font-size: 15px', 'font-size:12px');
  205. res.data.couContent=res.data.couContent.replaceAll('font-size:14px', 'font-size:12px');
  206. this.detail = res.data;
  207. })
  208. },
  209. }
  210. }
  211. </script>
  212. <style scoped>
  213. .djq{
  214. background: linear-gradient(128deg, #FFE4C5 0%, #FDC692 100%);
  215. border-radius: 4rpx;
  216. height: 34rpx;
  217. width: 76rpx;
  218. line-height: 34rpx;
  219. text-align: center;
  220. color: #2B2219;
  221. font-size: 20rpx;
  222. margin-top: 4rpx;
  223. margin-right: 10rpx;
  224. }
  225. .titleBox span{
  226. font-size: 12px;
  227. }
  228. .syShopBox{
  229. background: #FFFFFF;
  230. border-radius: 32rpx 32rpx 0rpx 0rpx;
  231. width: 750rpx;
  232. height: 80vh;
  233. margin-top: 20vh;
  234. }
  235. .spShopLineBox{
  236. height: calc(80vh - 90rpx);
  237. overflow-y: scroll;
  238. }
  239. .spShopLine{
  240. color: #333333;font-size: 26rpx;
  241. padding: 26rpx 30rpx;
  242. border-bottom: 1px solid #EEEEEE;
  243. }
  244. .chBox2{
  245. display: flex;justify-content: space-between;
  246. padding-left: 30rpx;
  247. padding-top: 30rpx;
  248. padding-right: 24rpx;
  249. padding-bottom: 10rpx;
  250. }
  251. .syShopTitle{
  252. font-weight: 500;
  253. color: #333333;
  254. font-size: 30rpx;
  255. line-height: 42rpx;
  256. }
  257. .hxBox{
  258. width: 750rpx;
  259. height: 70vh;
  260. margin-top: 30vh;
  261. background: #FFFFFF;
  262. border-radius: 32rpx 32rpx 0rpx 0rpx;
  263. }
  264. .couponCode{
  265. font-weight: 500;
  266. color: #333333;
  267. font-size: 30rpx;
  268. padding-top: 40rpx;
  269. text-align: center;
  270. }
  271. .couponCodeTs{
  272. color: #666666;font-size: 24rpx;
  273. text-align: center;padding-top: 10rpx;
  274. }
  275. .hxName{
  276. font-weight: 500;
  277. color: #333333;
  278. line-height: 42rpx;
  279. font-size: 30rpx;
  280. text-align: center;
  281. padding-top: 26rpx;
  282. }
  283. .hxTime{
  284. color: #3C3C3C;font-size: 24rpx; text-align: center;padding-top: 16rpx;
  285. padding-bottom: 50rpx;
  286. border-bottom: 1px dashed #C3C3C3;
  287. }
  288. .chahaoImg{
  289. width: 36rpx;height: 36rpx;
  290. }
  291. .chBox{
  292. text-align: right;
  293. padding-top: 33rpx;
  294. padding-right: 24rpx;
  295. }
  296. .couponCodeBox{
  297. display: flex;
  298. padding-top: 15rpx;
  299. }
  300. .useBox{
  301. height: 120rpx;
  302. width: 750rpx;
  303. position: fixed;
  304. left: 0;
  305. bottom: 0;
  306. background: #FFFFFF;
  307. box-shadow: 0rpx -2rpx 10rpx 0rpx rgba(153,153,153,0.2);
  308. }
  309. .useBtn{
  310. width: 690rpx;
  311. height: 74rpx;
  312. background: #D53533;
  313. border-radius: 37rpx;
  314. font-weight: 500;
  315. color: #FFFFFF;
  316. font-size: 30rpx;
  317. text-align: center;
  318. line-height: 74rpx;
  319. margin-top: 23rpx;
  320. margin-left: 30rpx;
  321. }
  322. .couponCodeYd{
  323. width: 10rpx;
  324. height: 10rpx;
  325. background: #FF0000;
  326. border-radius: 50%;
  327. margin-top: 10rpx;
  328. margin-right: 12rpx;
  329. }
  330. .ouponCode{
  331. color: #666666;
  332. line-height: 33rpx;
  333. font-size: 24rpx;
  334. text-decoration: line-through;
  335. }
  336. .couponCodeUse{
  337. width: 86rpx;
  338. height: 32rpx;
  339. border-radius: 4rpx;
  340. border: 1rpx solid #DDDDDD;
  341. color: #999999;
  342. line-height: 32rpx;
  343. text-align: center;
  344. font-size: 22rpx;
  345. margin-left: 12rpx;
  346. }
  347. .couponCodeLine{
  348. padding-left: 20rpx;display: flex;
  349. color: #999999;font-size: 24rpx;
  350. line-height: 33rpx;padding-top: 8rpx;
  351. }
  352. .boxtop{
  353. background: #FF0000;
  354. }
  355. .box {
  356. min-height: 100vh;
  357. background: #F4F5F7;
  358. }
  359. .detailBg {
  360. margin: -100rpx 24rpx 0rpx;
  361. background-color: #FFFFFF;
  362. border-radius: 10rpx;
  363. padding: 40rpx 20rpx;
  364. }
  365. .detailTop {
  366. display: flex;
  367. justify-content: flex-start;
  368. }
  369. .use {
  370. text-align: center;
  371. font-size: 26rpx;
  372. color: #FF0000;
  373. }
  374. .use2 {
  375. font-size: 40rpx;
  376. font-weight: 500;
  377. color: #FF0000;
  378. line-height: 56rpx;
  379. }
  380. .used {
  381. font-size: 26rpx;
  382. color: #666666;
  383. }
  384. .used2 {
  385. font-size: 40rpx;
  386. font-weight: 500;
  387. color: #666666;
  388. line-height: 56rpx;
  389. }
  390. .tiaojian {
  391. font-size: 24rpx;
  392. color: #666666;
  393. }
  394. .name {
  395. line-height: 42rpx;
  396. font-size: 30rpx;
  397. display: flex;
  398. font-weight: 500;
  399. color: #333333;
  400. }
  401. .time {
  402. font-size: 24rpx;
  403. color: #666666;
  404. }
  405. .leftB {
  406. margin-right: 15rpx;
  407. }
  408. .comtentBox {
  409. margin: 20rpx 24rpx;
  410. background-color: #FFFFFF;
  411. border-radius: 10rpx;
  412. padding: 20rpx;
  413. }
  414. .titleBox {
  415. display: flex;
  416. align-items: center;
  417. }
  418. .redPoint {
  419. width: 18rpx;
  420. height: 18rpx;
  421. margin-right: 10rpx;
  422. }
  423. .title {
  424. font-size: 30rpx;
  425. color: #333333;
  426. font-weight: bold;
  427. }
  428. .content {
  429. font-size: 26rpx;
  430. color: #666666;
  431. margin-top: 16rpx;
  432. margin-left: 28rpx;
  433. }
  434. .authorizBox{
  435. width: 100vw;
  436. height: 100vh;
  437. background: rgba(0, 0, 0, 0.5);
  438. position: fixed;
  439. top: 0;
  440. left: 0;
  441. }
  442. .authorizCont{
  443. margin-top: 30vh;
  444. width: 564rpx;
  445. height: 408rpx;
  446. background: #FFFFFF;
  447. border-radius: 24rpx;
  448. margin-left: 93rpx;
  449. position: relative;
  450. }
  451. .authorizCloseImg{
  452. width: 62rpx;
  453. height: 62rpx;
  454. }
  455. .sqLogoBox{
  456. width: 180rpx;
  457. height: 180rpx;
  458. background: #FFFFFF;
  459. border-radius: 90rpx;
  460. text-align: center;
  461. position: absolute;
  462. top: -50rpx;
  463. left: 192rpx;
  464. }
  465. .authorizName{
  466. color: #333333;
  467. line-height: 42rpx;
  468. font-size: 30rpx;
  469. text-align: center;
  470. padding-top: 58rpx;
  471. }
  472. .authorizMs{
  473. color: #999999;
  474. line-height: 36rpx;
  475. font-size: 26rpx;
  476. width: 452rpx;
  477. padding-top: 24rpx;
  478. text-align: center;
  479. margin-left: 56rpx;
  480. }
  481. .authorizContbutton{
  482. width: 422rpx;
  483. height: 88rpx;
  484. background: #D53533;
  485. border-radius: 44rpx;
  486. line-height: 88rpx;
  487. text-align: center;
  488. font-size:30rpx;
  489. color: #FFFFFF;
  490. margin-top: 62rpx;
  491. margin-left:71rpx;
  492. }
  493. .shopBoxpt{
  494. margin-top: 20rpx;
  495. }
  496. button::after{
  497. border: none;
  498. }
  499. button{
  500. position: relative;
  501. display: block;
  502. margin-left: 0;
  503. margin-right: 0;
  504. padding-left: 0px;
  505. padding-right: 0px;
  506. box-sizing: border-box;
  507. // font-size: 18px;
  508. text-align: center;
  509. text-decoration: none;
  510. // line-height: 1;
  511. line-height: 1.35;
  512. // border-radius: 5px;
  513. -webkit-tap-highlight-color: transparent;
  514. overflow: hidden;
  515. color: #000000;
  516. background-color: #fff;
  517. height: 100%;
  518. }
  519. </style>