discountCardDetail.vue 14 KB

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