pc.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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">满{{ item.maxValue }}元减</div>
  38. <div v-else>{{ 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.couponValue}}</span>折</div>
  60. <div v-if="coupons.maxValue">满{{ coupons.maxValue }}元减</div>
  61. <div v-else>{{ 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>折扣券</div>
  73. </div>
  74. <div class="content">
  75. <div class="title">月卡套餐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. const RSA = require('../../../plugins/wx_rsa');
  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 {
  114. this.token = this.$route.query.token;
  115. }
  116. this.getCoupons()
  117. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  118. this.client = 1;
  119. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  120. this.client = 2;
  121. } else if (this.$userAgent.isMiniProgram) {
  122. this.client = 5;
  123. } else {
  124. this.client = 7;
  125. }
  126. this.visit()
  127. },
  128. head: {
  129. title: '双十一 大额优惠券免费领',
  130. },
  131. created() {
  132. const _this = this
  133. setInterval(() => {
  134. _this.getCoupons()
  135. }, 600000);
  136. },
  137. methods: {
  138. visit() {
  139. this.$axios.$post('/user/v5/userAccess/user/visit',
  140. {
  141. loginType: this.token ? 1 : 2,
  142. accessType: 13
  143. },
  144. );
  145. },
  146. goOrder()
  147. {
  148. const productId = !this.coupons.products || this.coupons.products.split(',').length > 1 ? -1 : parseInt(this.coupons.products)
  149. window.vgeminipc.startPhoneMeal(productId)
  150. },
  151. async getCoupons()
  152. {
  153. const res = await this.$axios.$post('/activity/v5/couponActivity/getCouponActivityInfo', {},
  154. { headers: { Authorization: this.token }});
  155. res.data.forEach(element => {
  156. if(element.receivingStatus !== 3)
  157. {
  158. element.remainder = element.remainder * 4
  159. }
  160. });
  161. this.couponsList = res.data;
  162. },
  163. async receiveCouponRewards(row)
  164. {
  165. if(!this.$route.query.token)
  166. {
  167. this.login = true
  168. const _this = this
  169. setTimeout(() => {window.location.href='https://client.phone.androidscloud.com/cloud/phone/web/#/pages/login/index';_this.login = false},1000);
  170. return
  171. }
  172. if(this.loading) return
  173. this.loading = true
  174. Toast.loading({ duration: 0, forbidClick: true,});
  175. try {
  176. const data = { goodsId: row.id, };
  177. const sign = this.jiaqian(JSON.stringify(data));
  178. const res = await this.$axios.$get('/activity/v5/couponActivity/receiveCouponRewards',{ params: { goodsId:row.id} ,headers: { Authorization: this.token }});
  179. if(res.status === 0)
  180. {
  181. this.coupons = res.data
  182. this.show = true
  183. }
  184. else{
  185. Toast({
  186. message: res.message,
  187. position: 'top',
  188. duration: 4000,
  189. });
  190. }
  191. // this.coupons ={"couponName":"8855","couponExplain":"双十一劵1","products":"","validityPeriod":"88天","rebate":88.00,"discount":0.0,"doorsill":0,"fullReduction":0.00}
  192. // this.show = true
  193. await this.getCoupons()
  194. this.loading = false
  195. Toast.clear();
  196. }catch (error) {
  197. Toast.clear();
  198. this.loading = false
  199. await this.getCoupons()
  200. Toast({
  201. message: error.message,
  202. position: 'top',
  203. duration: 4000,
  204. });
  205. }
  206. },
  207. jiaqian(content) {
  208. const PrivateKey =
  209. '-----BEGIN PRIVATE KEY-----MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKCIK/zTSJCP4XhNsb7Mc5lALog+oAja/spMjg8U6rAmVzRtKv8qhw1HK0CRbW/XV66uM+kY7fhjaYbjbbzu2PMMfs2GVpG15jCWLug9fn2hvPT1wkXfooJX61yHK7+inxAXPi4vPNi263mSQGbhZTeqbU5p7nLeRGbdFyBQXVKpAgMBAAECgYAu/475RxZAlI8rPHvkY1EYteypoMQTs6HSslUI31PSXHc9dxSWfenqHkLwdWM30jDuiDvUa6MIDHrRrfXr0XWcQ0IJ93jT7ABkFCdxcKEOG1WE8f1kZ5JyPDJjeQiI9R4jJCukpGU0DdzO7ORvRb4oTFQ15quM+3+SjnK5TtfUsQJBAOLLk03D2s7t2R0GPLZq+WL/ebowbRSy4VHP/IQi4K1bJrll0HLznov60m9UML1ATlS2ub98fBRFXEAaAwJE2O0CQQC1NDEWhrAPU5o3xjjcxIUbbYskskbhjaiX/1Vz0UzS4XfYek4SL68WBWPGWTrSbgbvXtaXj0gmcChF5jxOHtUtAkA4mPsqxfy99UdgYeUW1P1lgkH7gAhIyRdH1nK6+wU83el9DPaHKVrgrfiEBeuf3wNtSqhyK/u/B0wtRxCHKW1FAkAXfwcGdryJoDuVE9z3s3vXDKNIRN2wDaBY5UD9XZxqk9XoeiN5dDltz5EafSOFecLocxG8YVXntg9i0PHs506ZAkEAge9AKaXisZ4jCNHRn1LR2R82RtHTLb2mN3Cc6sGo+SnAKczwRwVg9RgnmaLG4Z/7kJpq0ALgEBlkOmy+9joxAw==-----END PRIVATE KEY-----';
  210. const signature = new RSA.KJUR.crypto.Signature({
  211. alg: 'SHA256withRSA',
  212. });
  213. signature.init(PrivateKey);
  214. signature.updateString(content);
  215. const signData = signature.sign();
  216. // 将内容转成base64
  217. return RSA.hex2b64(signData);
  218. }
  219. },
  220. };
  221. </script>
  222. <style lang="scss" scoped>
  223. @media (min-width: 0px) {
  224. .double-eleven{
  225. width: 400px;
  226. position: relative;
  227. overflow: hidden;
  228. margin: 0 auto;
  229. }
  230. .double-eleven-body{
  231. background-image: url('../../../assets/image/activity/double-eleven/bj.png');
  232. background-size: cover;
  233. background-repeat: round;
  234. min-height: 100vh;
  235. overflow: hidden;
  236. margin: 0 auto;
  237. margin-top: -1px;
  238. }
  239. img{
  240. display: block;
  241. }
  242. .double-eleven-container{
  243. padding: 10px;
  244. img{
  245. margin-bottom: 30px;
  246. }
  247. }
  248. .coupon{
  249. width: 100%;
  250. height: 100px;
  251. background: #FDFFFD;
  252. box-shadow: 0px 11px 12px 0px rgba(255,121,168,0.46);
  253. border-radius: 12px;
  254. margin-bottom: 10px;
  255. display: flex;
  256. // padding: 18px 10px 8px 10px;
  257. .let-title{
  258. width: 100px;
  259. height: 100px;
  260. display: inline-block;
  261. background: #F6E1E1;
  262. font-size: 24px;
  263. font-family: Source Han Sans;
  264. font-weight: bold;
  265. color: #F04545;
  266. text-align: center;
  267. padding: 5px 0;
  268. border-radius: 12px 0 0 12px;
  269. vertical-align: top;
  270. span{
  271. font-size: 32px;
  272. }
  273. }
  274. .content{
  275. width: calc(100% - 182px);
  276. height: 50px;
  277. display: inline-block;
  278. // margin-top: -2px;
  279. margin-left: 5px;
  280. padding: 5px 5px;
  281. .title-coupon{
  282. font-size: 24px !important;
  283. font-family: Source Han Sans CN;
  284. font-weight: 800;
  285. color: #333333;
  286. overflow: hidden;
  287. text-overflow: ellipsis;
  288. white-space: nowrap;
  289. line-height: 39px;
  290. }
  291. .tips{
  292. font-size: 10px;
  293. font-family: Source Han Sans CN;
  294. font-weight: 400;
  295. color: #333333;
  296. overflow: hidden;
  297. text-overflow: ellipsis;
  298. white-space: nowrap;
  299. // line-height: 25px;
  300. }
  301. .number{
  302. margin-top: 5px;
  303. height: 20px;
  304. line-height: 20px;
  305. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  306. font-size: 10px;
  307. font-family: Source Han Sans CN;
  308. font-weight: 400;
  309. color: #FFFFFF;
  310. padding: 0 5px;
  311. width: fit-content;
  312. // display: block;
  313. }
  314. }
  315. .btn{
  316. width: 60px;
  317. height: 60px;
  318. background: url('../../../assets/image/activity/double-eleven/btn.png') no-repeat;
  319. background-size: 100% 100%;
  320. line-height: 80px;
  321. text-align: center;
  322. font-size: 15px;
  323. font-family: Yuanti SC;
  324. font-weight: bold;
  325. color: #F0F3FC;
  326. display: inline-block;
  327. margin-left: 2px;
  328. margin-top: 19px;
  329. }
  330. .btn-collect{
  331. width: 60px;
  332. height: 60px;
  333. background: url('../../../assets/image/activity/double-eleven/collect.png') no-repeat;
  334. background-size: 100% 100%;
  335. line-height: 80px;
  336. text-align: center;
  337. font-size: 15px;
  338. font-family: Yuanti SC;
  339. font-weight: bold;
  340. color: #F0F3FC;
  341. display: inline-block;
  342. margin-left: 2px;
  343. margin-top: 19px;
  344. }
  345. .btn-nocoupon{
  346. width: 60px;
  347. height: 60px;
  348. background: url('../../../assets/image/activity/double-eleven/nocoupon.png') no-repeat;
  349. background-size: 100% 100%;
  350. line-height: 80px;
  351. text-align: center;
  352. font-size: 15px;
  353. font-family: Yuanti SC;
  354. font-weight: bold;
  355. color: #F0F3FC;
  356. display: inline-block;
  357. margin-left: 2px;
  358. margin-top: 19px;
  359. }
  360. }
  361. .popup-container{
  362. width: 295px;
  363. height: 407px;
  364. background: url('../../../assets/image/activity/double-eleven/bj2.png') no-repeat;
  365. background-size: 100% 100%;
  366. padding-top: 210px;
  367. padding-left: 20px;
  368. padding-right: 20px;
  369. .coupon{
  370. width: 255px;
  371. height: 95px;
  372. margin-bottom: 20px;
  373. .let-title{
  374. width: 90px;
  375. height: 95px;
  376. display: inline-block;
  377. background: #F6E1E1;
  378. font-size: 18px;
  379. font-family: Source Han Sans;
  380. font-weight: bold;
  381. color: #F04545;
  382. text-align: center;
  383. padding: 16px 0;
  384. border-radius: 12px 0 0 12px;
  385. vertical-align: top;
  386. span{
  387. font-size: 24px;
  388. }
  389. }
  390. .content{
  391. width: calc(100% - 100px);
  392. margin-bottom: 25px;
  393. margin-right: 5px;
  394. .title-coupon{
  395. font-size: 21px !important;
  396. font-family: Source Han Sans CN;
  397. font-weight: 800;
  398. color: #333333;
  399. overflow: hidden;
  400. text-overflow: ellipsis;
  401. white-space: nowrap;
  402. line-height: 31px;
  403. }
  404. .tips{
  405. font-size: 12px;
  406. font-family: Source Han Sans CN;
  407. font-weight: 400;
  408. color: #333333;
  409. overflow: hidden;
  410. text-overflow: ellipsis;
  411. white-space: nowrap;
  412. // line-height: 20px;
  413. }
  414. .number{
  415. margin-top: 7px;
  416. height: 20px;
  417. line-height: 20px;
  418. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  419. font-size: 12px;
  420. font-family: Source Han Sans CN;
  421. font-weight: 400;
  422. color: #FFFFFF;
  423. padding: 0 5px;
  424. width: fit-content;
  425. }
  426. }
  427. }
  428. }
  429. .coupon-tips{
  430. font-size: 14px;
  431. font-family: Source Han Sans CN;
  432. font-weight: 400;
  433. color: #FFFFFF;
  434. line-height: 30px;
  435. width: 100%;
  436. text-align: center;
  437. margin-top: 5px;
  438. }
  439. .close{
  440. margin-top: 15px;
  441. margin-left: calc(50% - 22px);
  442. width: 44px;
  443. }
  444. .wrapper {
  445. display: flex;
  446. align-items: center;
  447. justify-content: center;
  448. height: 100%;
  449. }
  450. .wrapper-login{
  451. width: 150px;
  452. height: 40px;
  453. background: #000000;
  454. opacity: 0.6;
  455. border-radius: 45px;
  456. color: #ffffff;
  457. line-height: 40px;
  458. text-align:center;
  459. }
  460. .login{
  461. background-color:transparent;
  462. }
  463. .default{
  464. width:100%;
  465. position: relative;
  466. border-radius: 24px;
  467. font-size: 14px;
  468. .default-img{
  469. position: absolute;
  470. top: calc(50% - 60px);
  471. left: calc(50% - 50px);
  472. color: #333;
  473. img {
  474. width: 100px;
  475. margin-bottom: 20px;
  476. }
  477. }
  478. }
  479. }
  480. </style>