index.vue 15 KB

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