pc.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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="coupon" >
  14. <div class="let-title">
  15. <div><span>7</span>折</div>
  16. <div>折扣券</div>
  17. </div>
  18. <div class="content">
  19. <div class="title">月卡套餐7折优惠券</div>
  20. <div class="tips">满90元可用,优惠券有效期<span style="color:#D358A8">3</span>天</div>
  21. <div class="number">剩余数量:2893张</div>
  22. </div>
  23. <div class="btn" @click="receiveCouponRewards({id:11})"></div>
  24. </div> -->
  25. <div class="coupon" v-for="item in couponsList" :key="item.id">
  26. <!-- <div class="icon">{{item.couponName}}</div> -->
  27. <div class="let-title">
  28. <div><span>7</span>折</div>
  29. <div>折扣券</div>
  30. </div>
  31. <div class="content">
  32. <div class="title-coupon">{{item.couponName}}</div>
  33. <div class="tips">{{item.couponExplain}}</div>
  34. <div class="number">剩余数量:{{item.remainder}}张</div>
  35. </div>
  36. <div v-if="item.receivingStatus===1" class="btn" @click="receiveCouponRewards(item)"></div>
  37. <div v-else-if="item.receivingStatus===2" class="btn-collect"></div>
  38. <div v-else-if="item.receivingStatus===3" class="btn-nocoupon"></div>
  39. </div>
  40. <img src="~/assets/image/activity/double-eleven/game.png" width="100%" style="margin-top:30px">
  41. <img src="~/assets/image/activity/double-eleven/blacktechnology.png" width="100%">
  42. <img src="~/assets/image/activity/double-eleven/advantage.png" width="100%">
  43. </div>
  44. </div>
  45. <van-popup v-model="show" style="background: transparent;" :close-on-click-overlay="false">
  46. <div class="popup-container">
  47. <div class="coupon">
  48. <div class="let-title">
  49. <div><span>7</span>折</div>
  50. <div>折扣券</div>
  51. </div>
  52. <div class="content">
  53. <div class="title-coupon">{{coupons.couponName}}</div>
  54. <div class="tips">{{coupons.couponExplain}}</div>
  55. <div class="number">有效期:{{coupons.validityPeriod}}</div>
  56. </div>
  57. </div>
  58. <!-- <div class="coupon" >
  59. <div class="let-title">
  60. <div><span>7</span>折</div>
  61. <div>折扣券</div>
  62. </div>
  63. <div class="content">
  64. <div class="title">月卡套餐7折优惠券</div>
  65. <div class="tips">满90元可用,优惠券有效期<span style="color:#D358A8">3</span>天</div>
  66. <div class="number">剩余数量:2893张</div>
  67. </div>
  68. </div> -->
  69. <img src="~/assets/image/activity/double-eleven/btn2.png" width="100%" @click="goOrder">
  70. </div>
  71. <div class="coupon-tips">优惠券可在【我的】-【卡券】内查看</div>
  72. <img src="~/assets/image/activity/double-eleven/close.png" class="close" @click="show=false"/>
  73. </van-popup>
  74. </div>
  75. </template>
  76. <script>
  77. import { Toast } from 'vant';
  78. const RSA = require('../../../plugins/wx_rsa');
  79. const webUni = require('../../../plugins/uni');
  80. export default {
  81. name: 'doubleEleven',
  82. auth: false,
  83. components: {
  84. },
  85. data() {
  86. return {
  87. show:false,
  88. coupons:{},
  89. login:false,
  90. loading:false,
  91. couponsList:[],
  92. token:'',
  93. client:''
  94. };
  95. },
  96. async fetch() {
  97. if (this.$route.query.type === 'pc') {
  98. this.$router.push({ path: '/activity/doubleEleven/pc', query: { token: this.$route.query.token, type: 'pc' } })
  99. }
  100. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  101. this.token = await window.native.getToken();
  102. } else {
  103. this.token = this.$route.query.token;
  104. }
  105. this.getCoupons()
  106. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  107. this.client = 1;
  108. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  109. this.client = 2;
  110. } else if (this.$userAgent.isMiniProgram) {
  111. this.client = 5;
  112. } else {
  113. this.client = 7;
  114. }
  115. this.visit()
  116. },
  117. head: {
  118. title: '双十一 大额优惠券免费领',
  119. },
  120. created() {
  121. const _this = this
  122. setInterval(() => {
  123. _this.getCoupons()
  124. }, 600000);
  125. },
  126. methods: {
  127. visit() {
  128. this.$axios.$post('/user/v5/userAccess/user/visit',
  129. {
  130. loginType: this.token ? 1 : 2,
  131. accessType: 13
  132. },
  133. );
  134. },
  135. goOrder()
  136. {
  137. const productId = !this.coupons.products || this.coupons.products.split(',').length > 1 ? -1 : parseInt(this.coupons.products)
  138. window.vgeminipc.startPhoneMeal(productId)
  139. },
  140. async getCoupons()
  141. {
  142. const res = await this.$axios.$post('/activity/v5/couponActivity/getCouponActivityInfo', {},
  143. { headers: { Authorization: this.token }});
  144. res.data.forEach(element => {
  145. if(element.receivingStatus !== 3)
  146. {
  147. element.remainder = element.remainder * 4
  148. }
  149. });
  150. this.couponsList = res.data;
  151. },
  152. async receiveCouponRewards(row)
  153. {
  154. if(!this.$route.query.token)
  155. {
  156. this.login = true
  157. const _this = this
  158. setTimeout(() => {window.location.href='https://client.phone.androidscloud.com/cloud/phone/web/#/pages/login/index';_this.login = false},1000);
  159. return
  160. }
  161. if(this.loading) return
  162. this.loading = true
  163. Toast.loading({ duration: 0, forbidClick: true,});
  164. try {
  165. const data = { goodsId: row.id, };
  166. const sign = this.jiaqian(JSON.stringify(data));
  167. const res = await this.$axios.$get('/activity/v5/couponActivity/receiveCouponRewards',{ params: { goodsId:row.id} ,headers: { Authorization: this.token }});
  168. if(res.status === 0)
  169. {
  170. this.coupons = res.data
  171. this.show = true
  172. }
  173. else{
  174. Toast({
  175. message: res.message,
  176. position: 'top',
  177. duration: 4000,
  178. });
  179. }
  180. // this.coupons ={"couponName":"8855","couponExplain":"双十一劵1","products":"","validityPeriod":"88天","rebate":88.00,"discount":0.0,"doorsill":0,"fullReduction":0.00}
  181. // this.show = true
  182. await this.getCoupons()
  183. this.loading = false
  184. Toast.clear();
  185. }catch (error) {
  186. Toast.clear();
  187. this.loading = false
  188. await this.getCoupons()
  189. Toast({
  190. message: error.message,
  191. position: 'top',
  192. duration: 4000,
  193. });
  194. }
  195. },
  196. jiaqian(content) {
  197. const PrivateKey =
  198. '-----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-----';
  199. const signature = new RSA.KJUR.crypto.Signature({
  200. alg: 'SHA256withRSA',
  201. });
  202. signature.init(PrivateKey);
  203. signature.updateString(content);
  204. const signData = signature.sign();
  205. // 将内容转成base64
  206. return RSA.hex2b64(signData);
  207. }
  208. },
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. @media (min-width: 0px) {
  213. .double-eleven{
  214. width: 400px;
  215. position: relative;
  216. overflow: hidden;
  217. margin: 0 auto;
  218. }
  219. .double-eleven-body{
  220. background-image: url('../../../assets/image/activity/double-eleven/bj.png');
  221. background-size: cover;
  222. background-repeat: round;
  223. min-height: 100vh;
  224. overflow: hidden;
  225. margin: 0 auto;
  226. margin-top: -1px;
  227. }
  228. img{
  229. display: block;
  230. }
  231. .double-eleven-container{
  232. padding: 10px;
  233. img{
  234. margin-bottom: 30px;
  235. }
  236. }
  237. .coupon{
  238. width: 100%;
  239. height: 100px;
  240. background: #FDFFFD;
  241. box-shadow: 0px 11px 12px 0px rgba(255,121,168,0.46);
  242. border-radius: 12px;
  243. margin-bottom: 10px;
  244. display: flex;
  245. // padding: 18px 10px 8px 10px;
  246. .let-title{
  247. width: 100px;
  248. height: 100px;
  249. display: inline-block;
  250. background: #F6E1E1;
  251. font-size: 24px;
  252. font-family: Source Han Sans;
  253. font-weight: bold;
  254. color: #F04545;
  255. text-align: center;
  256. padding: 5px 0;
  257. border-radius: 12px 0 0 12px;
  258. vertical-align: top;
  259. span{
  260. font-size: 32px;
  261. }
  262. }
  263. .content{
  264. width: calc(100% - 182px);
  265. height: 50px;
  266. display: inline-block;
  267. // margin-top: -2px;
  268. margin-left: 5px;
  269. padding: 5px 5px;
  270. .title-coupon{
  271. font-size: 24px !important;
  272. font-family: Source Han Sans CN;
  273. font-weight: 800;
  274. color: #333333;
  275. overflow: hidden;
  276. text-overflow: ellipsis;
  277. white-space: nowrap;
  278. line-height: 39px;
  279. }
  280. .tips{
  281. font-size: 10px;
  282. font-family: Source Han Sans CN;
  283. font-weight: 400;
  284. color: #333333;
  285. overflow: hidden;
  286. text-overflow: ellipsis;
  287. white-space: nowrap;
  288. // line-height: 25px;
  289. }
  290. .number{
  291. margin-top: 5px;
  292. height: 20px;
  293. line-height: 20px;
  294. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  295. font-size: 10px;
  296. font-family: Source Han Sans CN;
  297. font-weight: 400;
  298. color: #FFFFFF;
  299. padding: 0 5px;
  300. width: fit-content;
  301. // display: block;
  302. }
  303. }
  304. .btn{
  305. width: 60px;
  306. height: 60px;
  307. background: url('../../../assets/image/activity/double-eleven/btn.png') no-repeat;
  308. background-size: 100% 100%;
  309. line-height: 80px;
  310. text-align: center;
  311. font-size: 15px;
  312. font-family: Yuanti SC;
  313. font-weight: bold;
  314. color: #F0F3FC;
  315. display: inline-block;
  316. margin-left: 2px;
  317. margin-top: 19px;
  318. // vertical-align: initial;
  319. // display: inline-block;
  320. // vertical-align:text-bottom;
  321. // float:right;
  322. }
  323. .btn-collect{
  324. width: 60px;
  325. height: 60px;
  326. background: url('../../../assets/image/activity/double-eleven/collect.png') no-repeat;
  327. background-size: 100% 100%;
  328. line-height: 80px;
  329. text-align: center;
  330. font-size: 15px;
  331. font-family: Yuanti SC;
  332. font-weight: bold;
  333. color: #F0F3FC;
  334. display: inline-block;
  335. margin-left: 2px;
  336. vertical-align: initial;
  337. }
  338. .btn-nocoupon{
  339. width: 60px;
  340. height: 60px;
  341. background: url('../../../assets/image/activity/double-eleven/nocoupon.png') no-repeat;
  342. background-size: 100% 100%;
  343. line-height: 80px;
  344. text-align: center;
  345. font-size: 15px;
  346. font-family: Yuanti SC;
  347. font-weight: bold;
  348. color: #F0F3FC;
  349. display: inline-block;
  350. margin-left: 2px;
  351. vertical-align: initial;
  352. }
  353. }
  354. .popup-container{
  355. width: 295px;
  356. height: 407px;
  357. background: url('../../../assets/image/activity/double-eleven/bj2.png') no-repeat;
  358. background-size: 100% 100%;
  359. padding-top: 210px;
  360. padding-left: 20px;
  361. padding-right: 20px;
  362. .coupon{
  363. width: 255px;
  364. height: 95px;
  365. margin-bottom: 20px;
  366. .let-title{
  367. width: 90px;
  368. height: 95px;
  369. display: inline-block;
  370. background: #F6E1E1;
  371. font-size: 18px;
  372. font-family: Source Han Sans;
  373. font-weight: bold;
  374. color: #F04545;
  375. text-align: center;
  376. padding: 16px 0;
  377. border-radius: 12px 0 0 12px;
  378. vertical-align: top;
  379. span{
  380. font-size: 24px;
  381. }
  382. }
  383. .content{
  384. width: calc(100% - 100px);
  385. margin-bottom: 25px;
  386. margin-right: 5px;
  387. .title-coupon{
  388. font-size: 21px !important;
  389. font-family: Source Han Sans CN;
  390. font-weight: 800;
  391. color: #333333;
  392. overflow: hidden;
  393. text-overflow: ellipsis;
  394. white-space: nowrap;
  395. line-height: 31px;
  396. }
  397. .tips{
  398. font-size: 12px;
  399. font-family: Source Han Sans CN;
  400. font-weight: 400;
  401. color: #333333;
  402. overflow: hidden;
  403. text-overflow: ellipsis;
  404. white-space: nowrap;
  405. // line-height: 20px;
  406. }
  407. .number{
  408. margin-top: 7px;
  409. height: 20px;
  410. line-height: 20px;
  411. background: linear-gradient(90deg, #FF4BD3, #7492FE);
  412. font-size: 12px;
  413. font-family: Source Han Sans CN;
  414. font-weight: 400;
  415. color: #FFFFFF;
  416. padding: 0 5px;
  417. width: fit-content;
  418. }
  419. }
  420. }
  421. }
  422. .coupon-tips{
  423. font-size: 14px;
  424. font-family: Source Han Sans CN;
  425. font-weight: 400;
  426. color: #FFFFFF;
  427. line-height: 30px;
  428. width: 100%;
  429. text-align: center;
  430. margin-top: 5px;
  431. }
  432. .close{
  433. margin-top: 15px;
  434. margin-left: calc(50% - 22px);
  435. width: 44px;
  436. }
  437. .wrapper {
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. height: 100%;
  442. }
  443. .wrapper-login{
  444. width: 150px;
  445. height: 40px;
  446. background: #000000;
  447. opacity: 0.6;
  448. border-radius: 45px;
  449. color: #ffffff;
  450. line-height: 40px;
  451. text-align:center;
  452. }
  453. .login{
  454. background-color:transparent;
  455. }
  456. }
  457. </style>