pc.vue 14 KB

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