pc.vue 15 KB

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