pc.vue 14 KB

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