pc.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div class="double-eleven">
  3. <img src="~/assets/image/activity/double-eleven/head.png" width="100%">
  4. <div class="double-eleven-body">
  5. <van-overlay :show="login" style="background: transparent;">
  6. <div class="wrapper">
  7. <div class="wrapper-login">
  8. 请先登录
  9. </div>
  10. </div>
  11. </van-overlay>
  12. <div class="double-eleven-container">
  13. <div class="default" v-if="!couponsList.length">
  14. <img src="~/assets/image/activity/double-eleven/couponbj.png" width="100%" >
  15. <div class="default-img" >
  16. <img src="~/assets/image/activity/double-eleven/default.png" >
  17. 暂无优惠券哦~
  18. </div>
  19. </div>
  20. <!-- <div class="coupon" >
  21. <div class="let-title">
  22. <div><span>7</span>折</div>
  23. <div>折扣券</div>
  24. </div>
  25. <div class="content">
  26. <div class="title">月卡套餐7折优惠券</div>
  27. <div class="tips">满90元可用,优惠券有效期<span style="color:#D358A8">3</span>天</div>
  28. <div class="number">剩余数量:2893张</div>
  29. </div>
  30. <div class="btn" @click="receiveCouponRewards({id:11})"></div>
  31. </div> -->
  32. <div class="coupon" v-for="item in couponsList" :key="item.id">
  33. <!-- <div class="icon">{{item.couponName}}</div> -->
  34. <div class="let-title">
  35. <div v-if="item.couponType===1">¥<span>{{item.couponValue}}</span></div>
  36. <div v-else><span>{{item.deductionPrice}}</span>折</div>
  37. <div v-if="item.maxValue" class="maxValue">满{{ item.maxValue }}元减</div>
  38. <div v-else class="maxValue">{{ item.useThreshold }}</div>
  39. </div>
  40. <div class="content">
  41. <div class="title-coupon">{{item.couponName}}</div>
  42. <div class="tips">{{item.couponExplain}}</div>
  43. <div class="number">剩余数量:{{item.remainder}}张</div>
  44. </div>
  45. <div v-if="item.receivingStatus===1" class="btn" @click="receiveCouponRewards(item)"></div>
  46. <div v-else-if="item.receivingStatus===2" class="btn-collect"></div>
  47. <div v-else-if="item.receivingStatus===3" class="btn-nocoupon"></div>
  48. </div>
  49. <img src="~/assets/image/activity/double-eleven/game.png" width="100%" style="margin-top:30px">
  50. <img src="~/assets/image/activity/double-eleven/blacktechnology.png" width="100%">
  51. <img src="~/assets/image/activity/double-eleven/advantage.png" width="100%">
  52. </div>
  53. </div>
  54. <van-popup v-model="show" style="background: transparent;" :close-on-click-overlay="false">
  55. <div class="popup-container">
  56. <div class="coupon">
  57. <div class="let-title">
  58. <div v-if="coupons.couponType===1">¥<span>{{coupons.couponValue}}</span></div>
  59. <div v-else><span>{{coupons.deductionPrice}}</span>折</div>
  60. <div v-if="coupons.maxValue" class="maxValue">满{{ coupons.maxValue }}元减</div>
  61. <div v-else class="maxValue">{{ coupons.useThreshold }}</div>
  62. </div>
  63. <div class="content">
  64. <div class="title-coupon">{{coupons.couponName}}</div>
  65. <div class="tips">{{coupons.couponExplain}}</div>
  66. <div class="number">有效期至 {{coupons.validityPeriod}}</div>
  67. </div>
  68. </div>
  69. <!-- <div class="coupon" >
  70. <div class="let-title">
  71. <div><span>7</span>折</div>
  72. <div class="maxValue">折扣券</div>
  73. </div>
  74. <div class="content">
  75. <div class="title-coupon">月卡套餐7折优惠券</div>
  76. <div class="tips">满90元可用,优惠券有效期<span style="color:#D358A8">3</span>天</div>
  77. <div class="number">有效期至 2022.11.10 16:28</div>
  78. </div>
  79. </div> -->
  80. <img src="~/assets/image/activity/double-eleven/btn2.png" width="100%" @click="goOrder">
  81. </div>
  82. <div class="coupon-tips">优惠券可在【我的】-【卡券】内查看</div>
  83. <img src="~/assets/image/activity/double-eleven/close.png" class="close" @click="show=false"/>
  84. </van-popup>
  85. </div>
  86. </template>
  87. <script>
  88. import { Toast } from 'vant';
  89. export default {
  90. name: 'doubleEleven',
  91. auth: false,
  92. components: {
  93. },
  94. data() {
  95. return {
  96. show:false,
  97. coupons:{},
  98. login:false,
  99. loading:false,
  100. couponsList:[],
  101. token:'',
  102. client:''
  103. };
  104. },
  105. async fetch() {
  106. if (this.$route.query.type === 'pc') {
  107. this.token = window.vgeminipc.getToken()
  108. } else if(this.$route.query.token && this.$route.query.token != 'needToken'){
  109. this.token = this.$route.query.token;
  110. }
  111. this.getCoupons()
  112. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  113. this.client = 1;
  114. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  115. this.client = 2;
  116. } else if (this.$userAgent.isMiniProgram) {
  117. this.client = 5;
  118. } else {
  119. this.client = 7;
  120. }
  121. this.visit()
  122. },
  123. head: {
  124. title: '双十一 大额优惠券免费领',
  125. },
  126. created() {
  127. // const _this = this
  128. // setInterval(() => {
  129. // _this.getCoupons()
  130. // }, 600000);
  131. },
  132. methods: {
  133. visit() {
  134. this.$axios.$post('/user/v5/userAccess/user/visit',
  135. {
  136. loginType: this.token ? 1 : 2,
  137. accessType: 13
  138. },
  139. );
  140. },
  141. goOrder()
  142. {
  143. const productId = !this.coupons.products || this.coupons.products.split(',').length > 1 ? -1 : parseInt(this.coupons.products)
  144. window.vgeminipc.startPhoneMeal(productId)
  145. },
  146. async getCoupons()
  147. {
  148. const res = await this.$axios.$post('/activity/v5/couponActivity/getCouponActivityInfo', {},
  149. { headers: { Authorization: this.token }});
  150. if(res.status === 0)
  151. {
  152. res.data.forEach(element => {
  153. if(element.receivingStatus !== 3)
  154. {
  155. element.remainder = element.remainder
  156. }
  157. });
  158. this.couponsList = res.data;
  159. }
  160. },
  161. async receiveCouponRewards(row)
  162. {
  163. if(!this.token)
  164. {
  165. this.login = true
  166. const _this = this
  167. setTimeout(() => {window.location.href='https://client.phone.androidscloud.com/cloud/phone/web/#/pages/login/index';_this.login = false},1000);
  168. // setTimeout(() => {window.location.href='https://prese.phone.androidscloud.com/cloud/phone/web/#/pages/index/index';_this.login = false},1000);
  169. return
  170. }
  171. if(this.loading) return
  172. this.loading = true
  173. Toast.loading({ duration: 0, forbidClick: true,});
  174. try {
  175. const data = { goodsId: row.id, };
  176. const res = await this.$axios.$get('/activity/v5/couponActivity/receiveCouponRewards',{ params: { goodsId:row.id} ,headers: { Authorization: this.token }});
  177. if(res.status === 0)
  178. {
  179. this.coupons = res.data
  180. this.show = true
  181. }
  182. else{
  183. Toast({
  184. message: res.msg,
  185. position: 'top',
  186. duration: 4000,
  187. });
  188. }
  189. await this.getCoupons()
  190. this.loading = false
  191. Toast.clear();
  192. }catch (error) {
  193. Toast.clear();
  194. this.loading = false
  195. // await this.getCoupons()
  196. Toast({
  197. message: error.message,
  198. position: 'top',
  199. duration: 4000,
  200. });
  201. }
  202. }
  203. },
  204. };
  205. </script>
  206. <style lang="scss" scoped>
  207. @media (min-width: 0px) {
  208. .double-eleven{
  209. width: 400px;
  210. position: relative;
  211. overflow: hidden;
  212. margin: 0 auto;
  213. }
  214. .double-eleven-body{
  215. background-image: url('../../../assets/image/activity/double-eleven/bj.png');
  216. background-size: cover;
  217. background-repeat: round;
  218. min-height: 100vh;
  219. overflow: hidden;
  220. margin: 0 auto;
  221. margin-top: -1px;
  222. }
  223. img{
  224. display: block;
  225. }
  226. .double-eleven-container{
  227. padding: 10px;
  228. img{
  229. margin-bottom: 30px;
  230. }
  231. }
  232. .coupon{
  233. width: 100%;
  234. height: 100px;
  235. background: #FDFFFD;
  236. box-shadow: 0px 11px 12px 0px rgba(255,121,168,0.46);
  237. border-radius: 12px;
  238. margin-bottom: 10px;
  239. display: flex;
  240. // padding: 18px 10px 8px 10px;
  241. .let-title{
  242. width: 100px;
  243. height: 100px;
  244. display: inline-block;
  245. background: #F6E1E1;
  246. font-size: 24px;
  247. font-family: Source Han Sans;
  248. font-weight: bold;
  249. color: #F04545;
  250. text-align: center;
  251. padding: 5px 0;
  252. border-radius: 12px 0 0 12px;
  253. vertical-align: top;
  254. span{
  255. font-size: 32px;
  256. }
  257. .maxValue{
  258. font-size: 17px;
  259. }
  260. }
  261. .content{
  262. width: calc(100% - 182px);
  263. height: 50px;
  264. display: inline-block;
  265. // margin-top: -2px;
  266. margin-left: 5px;
  267. padding: 5px 5px;
  268. .title-coupon{
  269. font-size: 24px !important;
  270. font-family: Source Han Sans CN;
  271. font-weight: 800;
  272. color: #333333;
  273. overflow: hidden;
  274. text-overflow: ellipsis;
  275. white-space: nowrap;
  276. line-height: 39px;
  277. }
  278. .tips{
  279. font-size: 10px;
  280. font-family: Source Han Sans CN;
  281. font-weight: 400;
  282. color: #333333;
  283. overflow: hidden;
  284. text-overflow: ellipsis;
  285. white-space: nowrap;
  286. // line-height: 25px;
  287. }
  288. .number{
  289. margin-top: 5px;
  290. height: 20px;
  291. line-height: 20px;
  292. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  293. font-size: 10px;
  294. font-family: Source Han Sans CN;
  295. font-weight: 400;
  296. color: #FFFFFF;
  297. padding: 0 5px;
  298. width: fit-content;
  299. // display: block;
  300. }
  301. }
  302. .btn{
  303. width: 60px;
  304. height: 60px;
  305. background: url('../../../assets/image/activity/double-eleven/btn.png') no-repeat;
  306. background-size: 100% 100%;
  307. line-height: 80px;
  308. text-align: center;
  309. font-size: 15px;
  310. font-family: Yuanti SC;
  311. font-weight: bold;
  312. color: #F0F3FC;
  313. display: inline-block;
  314. margin-left: 2px;
  315. margin-top: 19px;
  316. }
  317. .btn-collect{
  318. width: 60px;
  319. height: 60px;
  320. background: url('../../../assets/image/activity/double-eleven/collect.png') no-repeat;
  321. background-size: 100% 100%;
  322. line-height: 80px;
  323. text-align: center;
  324. font-size: 15px;
  325. font-family: Yuanti SC;
  326. font-weight: bold;
  327. color: #F0F3FC;
  328. display: inline-block;
  329. margin-left: 2px;
  330. margin-top: 19px;
  331. }
  332. .btn-nocoupon{
  333. width: 60px;
  334. height: 60px;
  335. background: url('../../../assets/image/activity/double-eleven/nocoupon.png') no-repeat;
  336. background-size: 100% 100%;
  337. line-height: 80px;
  338. text-align: center;
  339. font-size: 15px;
  340. font-family: Yuanti SC;
  341. font-weight: bold;
  342. color: #F0F3FC;
  343. display: inline-block;
  344. margin-left: 2px;
  345. margin-top: 19px;
  346. }
  347. }
  348. .popup-container{
  349. width: 325px;
  350. height: 407px;
  351. background: url('../../../assets/image/activity/double-eleven/bj2.png') no-repeat;
  352. background-size: 100% 100%;
  353. padding-top: 210px;
  354. padding-left: 15px;
  355. padding-right: 15px;
  356. .coupon{
  357. width: 295px;
  358. height: 95px;
  359. margin-bottom: 20px;
  360. .let-title{
  361. width: 90px;
  362. height: 95px;
  363. display: inline-block;
  364. background: #F6E1E1;
  365. font-size: 18px;
  366. font-family: Source Han Sans;
  367. font-weight: bold;
  368. color: #F04545;
  369. text-align: center;
  370. padding: 16px 0;
  371. border-radius: 12px 0 0 12px;
  372. vertical-align: top;
  373. span{
  374. font-size: 24px;
  375. }
  376. .maxValue{
  377. font-size: 14px;
  378. }
  379. }
  380. .content{
  381. width: calc(100% - 100px);
  382. margin-bottom: 25px;
  383. // margin-right: 5px;
  384. // padding: 10px 2px;
  385. .title-coupon{
  386. font-size: 21px !important;
  387. font-family: Source Han Sans CN;
  388. font-weight: 800;
  389. color: #333333;
  390. overflow: hidden;
  391. text-overflow: ellipsis;
  392. white-space: nowrap;
  393. line-height: 31px;
  394. }
  395. .tips{
  396. font-size: 12px;
  397. font-family: Source Han Sans CN;
  398. font-weight: 400;
  399. color: #333333;
  400. overflow: hidden;
  401. text-overflow: ellipsis;
  402. white-space: nowrap;
  403. // line-height: 20px;
  404. }
  405. .number{
  406. margin-top: 7px;
  407. height: 20px;
  408. line-height: 20px;
  409. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  410. font-size: 10px;
  411. font-family: Source Han Sans CN;
  412. font-weight: 400;
  413. color: #FFFFFF;
  414. padding: 0 5px;
  415. width: fit-content;
  416. }
  417. }
  418. }
  419. }
  420. .coupon-tips{
  421. font-size: 14px;
  422. font-family: Source Han Sans CN;
  423. font-weight: 400;
  424. color: #FFFFFF;
  425. line-height: 30px;
  426. width: 100%;
  427. text-align: center;
  428. margin-top: 5px;
  429. }
  430. .close{
  431. margin-top: 15px;
  432. margin-left: calc(50% - 22px);
  433. width: 44px;
  434. }
  435. .wrapper {
  436. display: flex;
  437. align-items: center;
  438. justify-content: center;
  439. height: 100%;
  440. }
  441. .wrapper-login{
  442. width: 150px;
  443. height: 40px;
  444. background: #000000;
  445. opacity: 0.6;
  446. border-radius: 45px;
  447. color: #ffffff;
  448. line-height: 40px;
  449. text-align:center;
  450. }
  451. .login{
  452. background-color:transparent;
  453. }
  454. .default{
  455. width:100%;
  456. position: relative;
  457. border-radius: 24px;
  458. font-size: 14px;
  459. .default-img{
  460. position: absolute;
  461. top: calc(50% - 60px);
  462. left: calc(50% - 50px);
  463. color: #333;
  464. img {
  465. width: 100px;
  466. margin-bottom: 20px;
  467. }
  468. }
  469. }
  470. }
  471. </style>