pc.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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.couponValue}}</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">剩余数量:2893张</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:true,
  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. res.data.forEach(element => {
  151. if(element.receivingStatus !== 3)
  152. {
  153. element.remainder = element.remainder
  154. }
  155. });
  156. this.couponsList = res.data;
  157. },
  158. async receiveCouponRewards(row)
  159. {
  160. if(!this.token)
  161. {
  162. this.login = true
  163. const _this = this
  164. // setTimeout(() => {window.location.href='http://client.phone.androidscloud.com/cloud/phone/web/#/pages/login/index';_this.login = false},1000);
  165. setTimeout(() => {window.location.href='https://prese.phone.androidscloud.com/cloud/phone/web/#/pages/index/index';_this.login = false},1000);
  166. return
  167. }
  168. if(this.loading) return
  169. this.loading = true
  170. Toast.loading({ duration: 0, forbidClick: true,});
  171. try {
  172. const data = { goodsId: row.id, };
  173. const res = await this.$axios.$get('/activity/v5/couponActivity/receiveCouponRewards',{ params: { goodsId:row.id} ,headers: { Authorization: this.token }});
  174. if(res.status === 0)
  175. {
  176. this.coupons = res.data
  177. this.show = true
  178. }
  179. else{
  180. Toast({
  181. message: res.msg,
  182. position: 'top',
  183. duration: 4000,
  184. });
  185. }
  186. await this.getCoupons()
  187. this.loading = false
  188. Toast.clear();
  189. }catch (error) {
  190. Toast.clear();
  191. this.loading = false
  192. await this.getCoupons()
  193. Toast({
  194. message: error.message,
  195. position: 'top',
  196. duration: 4000,
  197. });
  198. }
  199. }
  200. },
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. @media (min-width: 0px) {
  205. .double-eleven{
  206. width: 400px;
  207. position: relative;
  208. overflow: hidden;
  209. margin: 0 auto;
  210. }
  211. .double-eleven-body{
  212. background-image: url('../../../assets/image/activity/double-eleven/bj.png');
  213. background-size: cover;
  214. background-repeat: round;
  215. min-height: 100vh;
  216. overflow: hidden;
  217. margin: 0 auto;
  218. margin-top: -1px;
  219. }
  220. img{
  221. display: block;
  222. }
  223. .double-eleven-container{
  224. padding: 10px;
  225. img{
  226. margin-bottom: 30px;
  227. }
  228. }
  229. .coupon{
  230. width: 100%;
  231. height: 100px;
  232. background: #FDFFFD;
  233. box-shadow: 0px 11px 12px 0px rgba(255,121,168,0.46);
  234. border-radius: 12px;
  235. margin-bottom: 10px;
  236. display: flex;
  237. // padding: 18px 10px 8px 10px;
  238. .let-title{
  239. width: 100px;
  240. height: 100px;
  241. display: inline-block;
  242. background: #F6E1E1;
  243. font-size: 24px;
  244. font-family: Source Han Sans;
  245. font-weight: bold;
  246. color: #F04545;
  247. text-align: center;
  248. padding: 5px 0;
  249. border-radius: 12px 0 0 12px;
  250. vertical-align: top;
  251. span{
  252. font-size: 32px;
  253. }
  254. .maxValue{
  255. font-size: 17px;
  256. }
  257. }
  258. .content{
  259. width: calc(100% - 182px);
  260. height: 50px;
  261. display: inline-block;
  262. // margin-top: -2px;
  263. margin-left: 5px;
  264. padding: 5px 5px;
  265. .title-coupon{
  266. font-size: 24px !important;
  267. font-family: Source Han Sans CN;
  268. font-weight: 800;
  269. color: #333333;
  270. overflow: hidden;
  271. text-overflow: ellipsis;
  272. white-space: nowrap;
  273. line-height: 39px;
  274. }
  275. .tips{
  276. font-size: 10px;
  277. font-family: Source Han Sans CN;
  278. font-weight: 400;
  279. color: #333333;
  280. overflow: hidden;
  281. text-overflow: ellipsis;
  282. white-space: nowrap;
  283. // line-height: 25px;
  284. }
  285. .number{
  286. margin-top: 5px;
  287. height: 20px;
  288. line-height: 20px;
  289. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  290. font-size: 10px;
  291. font-family: Source Han Sans CN;
  292. font-weight: 400;
  293. color: #FFFFFF;
  294. padding: 0 5px;
  295. width: fit-content;
  296. // display: block;
  297. }
  298. }
  299. .btn{
  300. width: 60px;
  301. height: 60px;
  302. background: url('../../../assets/image/activity/double-eleven/btn.png') no-repeat;
  303. background-size: 100% 100%;
  304. line-height: 80px;
  305. text-align: center;
  306. font-size: 15px;
  307. font-family: Yuanti SC;
  308. font-weight: bold;
  309. color: #F0F3FC;
  310. display: inline-block;
  311. margin-left: 2px;
  312. margin-top: 19px;
  313. }
  314. .btn-collect{
  315. width: 60px;
  316. height: 60px;
  317. background: url('../../../assets/image/activity/double-eleven/collect.png') no-repeat;
  318. background-size: 100% 100%;
  319. line-height: 80px;
  320. text-align: center;
  321. font-size: 15px;
  322. font-family: Yuanti SC;
  323. font-weight: bold;
  324. color: #F0F3FC;
  325. display: inline-block;
  326. margin-left: 2px;
  327. margin-top: 19px;
  328. }
  329. .btn-nocoupon{
  330. width: 60px;
  331. height: 60px;
  332. background: url('../../../assets/image/activity/double-eleven/nocoupon.png') no-repeat;
  333. background-size: 100% 100%;
  334. line-height: 80px;
  335. text-align: center;
  336. font-size: 15px;
  337. font-family: Yuanti SC;
  338. font-weight: bold;
  339. color: #F0F3FC;
  340. display: inline-block;
  341. margin-left: 2px;
  342. margin-top: 19px;
  343. }
  344. }
  345. .popup-container{
  346. width: 295px;
  347. height: 407px;
  348. background: url('../../../assets/image/activity/double-eleven/bj2.png') no-repeat;
  349. background-size: 100% 100%;
  350. padding-top: 210px;
  351. padding-left: 20px;
  352. padding-right: 20px;
  353. .coupon{
  354. width: 255px;
  355. height: 95px;
  356. margin-bottom: 20px;
  357. .let-title{
  358. width: 90px;
  359. height: 95px;
  360. display: inline-block;
  361. background: #F6E1E1;
  362. font-size: 18px;
  363. font-family: Source Han Sans;
  364. font-weight: bold;
  365. color: #F04545;
  366. text-align: center;
  367. padding: 16px 0;
  368. border-radius: 12px 0 0 12px;
  369. vertical-align: top;
  370. span{
  371. font-size: 24px;
  372. }
  373. .maxValue{
  374. font-size: 14px;
  375. }
  376. }
  377. .content{
  378. width: calc(100% - 100px);
  379. margin-bottom: 25px;
  380. margin-right: 5px;
  381. .title-coupon{
  382. font-size: 21px !important;
  383. font-family: Source Han Sans CN;
  384. font-weight: 800;
  385. color: #333333;
  386. overflow: hidden;
  387. text-overflow: ellipsis;
  388. white-space: nowrap;
  389. line-height: 31px;
  390. }
  391. .tips{
  392. font-size: 12px;
  393. font-family: Source Han Sans CN;
  394. font-weight: 400;
  395. color: #333333;
  396. overflow: hidden;
  397. text-overflow: ellipsis;
  398. white-space: nowrap;
  399. // line-height: 20px;
  400. }
  401. .number{
  402. margin-top: 7px;
  403. height: 20px;
  404. line-height: 20px;
  405. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  406. font-size: 12px;
  407. font-family: Source Han Sans CN;
  408. font-weight: 400;
  409. color: #FFFFFF;
  410. padding: 0 5px;
  411. width: fit-content;
  412. }
  413. }
  414. }
  415. }
  416. .coupon-tips{
  417. font-size: 14px;
  418. font-family: Source Han Sans CN;
  419. font-weight: 400;
  420. color: #FFFFFF;
  421. line-height: 30px;
  422. width: 100%;
  423. text-align: center;
  424. margin-top: 5px;
  425. }
  426. .close{
  427. margin-top: 15px;
  428. margin-left: calc(50% - 22px);
  429. width: 44px;
  430. }
  431. .wrapper {
  432. display: flex;
  433. align-items: center;
  434. justify-content: center;
  435. height: 100%;
  436. }
  437. .wrapper-login{
  438. width: 150px;
  439. height: 40px;
  440. background: #000000;
  441. opacity: 0.6;
  442. border-radius: 45px;
  443. color: #ffffff;
  444. line-height: 40px;
  445. text-align:center;
  446. }
  447. .login{
  448. background-color:transparent;
  449. }
  450. .default{
  451. width:100%;
  452. position: relative;
  453. border-radius: 24px;
  454. font-size: 14px;
  455. .default-img{
  456. position: absolute;
  457. top: calc(50% - 60px);
  458. left: calc(50% - 50px);
  459. color: #333;
  460. img {
  461. width: 100px;
  462. margin-bottom: 20px;
  463. }
  464. }
  465. }
  466. }
  467. </style>