index.vue 15 KB

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