index.vue 15 KB

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