index.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  1. <template>
  2. <div class="lottery-container">
  3. <van-swipe
  4. v-if="carousel.length"
  5. :autoplay="3000"
  6. class="lottery-swipe"
  7. vertical
  8. :show-indicators="false"
  9. >
  10. <van-swipe-item v-for="item in carousel" :key="item.mealId"
  11. >有{{ item.count }}个用户 {{ ['', '抽奖', '购买'][item.type]
  12. }}{{ item.title }}</van-swipe-item
  13. >
  14. </van-swipe>
  15. <img
  16. class="w51h26"
  17. src="~/assets/image/activity/lottery/rule.png"
  18. alt=""
  19. @click="
  20. showRule = true;
  21. makePoint('activity_购买协议');
  22. "
  23. />
  24. <div class="sl">
  25. <img
  26. src="~/assets/image/activity/lottery/solgan.png"
  27. alt=""
  28. class="slogan"
  29. />
  30. <img
  31. src="~/assets/image/activity/lottery/bannerTitle.png"
  32. alt=""
  33. class="bannerTitle"
  34. />
  35. </div>
  36. <div class="roulette">
  37. <div class="arrow" @click="startRotation"></div>
  38. <div class="gesture">
  39. <img src="~/assets/image/activity/lottery/gesture.gif" />
  40. </div>
  41. <img
  42. class="start-btn"
  43. src="~/assets/image/activity/lottery/start-btn.png"
  44. alt=""
  45. @click="startRotation"
  46. />
  47. </div>
  48. <RoundTurntable
  49. ref="roundTurntable"
  50. :prize-data="prizeData"
  51. :rotate-circle="rotateCircle"
  52. :during-time="duringTime"
  53. :turntable-style-option="turntableStyleOption"
  54. class="turntable"
  55. @endRotation="endRotation"
  56. >
  57. <template slot="item" slot-scope="scope">
  58. <div class="turntable-name">
  59. <span class="fs15">¥</span>{{ scope.item.level }}
  60. </div>
  61. <div class="turntable-img">
  62. <img src="~/assets/image/activity/lottery/yearCard.png" />
  63. </div>
  64. </template>
  65. </RoundTurntable>
  66. <div class="num">剩余机会{{ num }}次</div>
  67. <van-popup
  68. v-model="showPay"
  69. closeable
  70. close-icon-position="top-right"
  71. round
  72. :close-on-click-overlay="false"
  73. @closed="closed"
  74. >
  75. <div class="popup-view">
  76. <div class="txt1">恭喜你获得{{ actualPrice }}年卡</div>
  77. <div
  78. :class="selMealId === mealId ? 'coupon-1 active' : 'coupon-1'"
  79. @click="selMealId = mealId"
  80. >
  81. <img
  82. v-if="selMealId === mealId"
  83. class="coupon-select-icon"
  84. src="~/assets/image/activity/lottery/select-icon.png"
  85. alt=""
  86. />
  87. <img
  88. v-else
  89. class="coupon-select-icon"
  90. src="~/assets/image/activity/lottery/unselect-icon.png"
  91. alt=""
  92. />
  93. <div class="coupon-title">
  94. <span class="txt2">{{ actualPrice }}</span
  95. ><span>年卡会员</span>
  96. </div>
  97. <div class="txt4">12个月 30H/月 不使用不计时</div>
  98. <img
  99. class="w253h73"
  100. src="~/assets/image/activity/lottery/coupon-1.png"
  101. alt=""
  102. />
  103. </div>
  104. <div class="fb">
  105. <div
  106. v-for="item in mealList"
  107. :key="item.id"
  108. :class="selMealId === item.id ? 'coupon-2 active' : 'coupon-2'"
  109. @click="
  110. selMealId = item.id;
  111. makePoint(
  112. item.day === 30 ? 'activity_38月卡' : 'activity_268年卡',
  113. );
  114. "
  115. >
  116. <img
  117. v-if="selMealId === item.id"
  118. class="coupon-select-icon"
  119. src="~/assets/image/activity/lottery/select-icon.png"
  120. alt=""
  121. />
  122. <img
  123. v-else
  124. class="coupon-select-icon"
  125. src="~/assets/image/activity/lottery/unselect-icon.png"
  126. alt=""
  127. />
  128. <div class="coupon-title">
  129. <span class="txt2">{{
  130. item.originalPrice ? item.originalPrice : item.actualPrice
  131. }}</span
  132. ><span>元</span>
  133. </div>
  134. <div class="txt4">{{ item.day === 30 ? '月卡' : '年卡' }}</div>
  135. <img
  136. class="w111h73"
  137. src="~/assets/image/activity/lottery/coupon-2.png"
  138. alt=""
  139. />
  140. </div>
  141. </div>
  142. <div
  143. v-for="item in paySupportType"
  144. :key="item"
  145. class="fnbc"
  146. @click="
  147. payType = item;
  148. makePoint(item === 'aliPay' ? 'activity_支付宝' : 'activity_微信');
  149. "
  150. >
  151. <div v-if="item === 'aliPay'" class="fnc">
  152. <van-icon
  153. class="icon-pay"
  154. :name="require('~/assets/image/activity/lottery/alipay.png')"
  155. />
  156. <span class="txt5">支付宝支付</span>
  157. </div>
  158. <div v-else class="fnc">
  159. <van-icon
  160. class="icon-pay"
  161. :name="require('~/assets/image/activity/lottery/wx.png')"
  162. />
  163. <span class="txt5">微信支付</span>
  164. </div>
  165. <van-icon
  166. :name="
  167. payType === item
  168. ? require('~/assets/image/activity/lottery/select-round-icon.png')
  169. : require('~/assets/image/activity/lottery/unselect-round-icon.png')
  170. "
  171. size="24"
  172. />
  173. </div>
  174. <img
  175. class="w304h62"
  176. src="~/assets/image/activity/lottery/pay-btn.png"
  177. alt=""
  178. @click="createOrder"
  179. />
  180. <div class="txt6">
  181. 开通前阅读并同意<a
  182. @click="
  183. showRule = true;
  184. makePoint('activity_购买协议');
  185. "
  186. >购买协议</a
  187. >
  188. </div>
  189. </div>
  190. </van-popup>
  191. <van-popup
  192. v-model="show"
  193. closeable
  194. close-icon-position="top-right"
  195. round
  196. @closed="makePoint('activity_关闭弹窗')"
  197. >
  198. <div class="popup-view popup-view-leave">
  199. <div class="txt1">确定离开吗</div>
  200. <div class="txt6">
  201. 离开后您将失去{{ actualPrice }}年卡,24小时付款有效
  202. </div>
  203. <div
  204. :class="selMealId === mealId ? 'coupon-1 active' : 'coupon-1'"
  205. @click="selMealId = mealId"
  206. >
  207. <img
  208. v-if="selMealId === mealId"
  209. class="coupon-select-icon"
  210. src="~/assets/image/activity/lottery/select-icon.png"
  211. alt=""
  212. />
  213. <img
  214. v-else
  215. class="coupon-select-icon"
  216. src="~/assets/image/activity/lottery/unselect-icon.png"
  217. alt=""
  218. />
  219. <div class="coupon-title">
  220. <span class="txt2">{{ actualPrice }}</span
  221. ><span>年卡会员</span>
  222. </div>
  223. <div class="txt4">12个月 30H/月 不使用不计时</div>
  224. <img
  225. class="w253h73"
  226. src="~/assets/image/activity/lottery/coupon-1.png"
  227. alt=""
  228. />
  229. </div>
  230. <div class="fb">
  231. <div
  232. v-for="item in mealList"
  233. :key="item.id"
  234. :class="selMealId === item.id ? 'coupon-2 active' : 'coupon-2'"
  235. @click="
  236. selMealId = item.id;
  237. makePoint(
  238. item.day === 30 ? 'activity_38月卡' : 'activity_268年卡',
  239. );
  240. "
  241. >
  242. <img
  243. v-if="selMealId === item.id"
  244. class="coupon-select-icon"
  245. src="~/assets/image/activity/lottery/select-icon.png"
  246. alt=""
  247. />
  248. <img
  249. v-else
  250. class="coupon-select-icon"
  251. src="~/assets/image/activity/lottery/unselect-icon.png"
  252. alt=""
  253. />
  254. <div class="coupon-title">
  255. <span class="txt2">{{
  256. item.originalPrice ? item.originalPrice : item.actualPrice
  257. }}</span
  258. ><span>元</span>
  259. </div>
  260. <div class="txt4">{{ item.day === 30 ? '月卡' : '年卡' }}</div>
  261. <img
  262. class="w111h73"
  263. src="~/assets/image/activity/lottery/coupon-2.png"
  264. alt=""
  265. />
  266. </div>
  267. </div>
  268. <div
  269. v-for="item in paySupportType"
  270. :key="item"
  271. class="fnbc"
  272. @click="
  273. payType = item;
  274. makePoint(item === 'aliPay' ? 'activity_支付宝' : 'activity_微信');
  275. "
  276. >
  277. <div v-if="item === 'aliPay'" class="fnc">
  278. <van-icon
  279. class="icon-pay"
  280. :name="require('~/assets/image/activity/lottery/alipay.png')"
  281. />
  282. <span class="txt5">支付宝支付</span>
  283. </div>
  284. <div v-else class="fnc">
  285. <van-icon
  286. class="icon-pay"
  287. :name="require('~/assets/image/activity/lottery/wx.png')"
  288. />
  289. <span class="txt5">微信支付</span>
  290. </div>
  291. <van-icon
  292. :name="
  293. payType === item
  294. ? require('~/assets/image/activity/lottery/select-round-icon.png')
  295. : require('~/assets/image/activity/lottery/unselect-round-icon.png')
  296. "
  297. size="24"
  298. />
  299. </div>
  300. <div class="fnbc">
  301. <div
  302. class="btn-leave"
  303. @click="
  304. show = false;
  305. makePoint('activity_狠心离开');
  306. "
  307. >
  308. 狠心离开
  309. </div>
  310. <div class="btn-pay" @click="createOrder">立即购买</div>
  311. </div>
  312. </div>
  313. </van-popup>
  314. <van-popup
  315. v-model="showRule"
  316. style="background: transparent; padding-top: 14px"
  317. >
  318. <div class="popup-view-rule">
  319. <div class="popup-view-rule-box">
  320. <div class="popup-view-rule-title">购买协议</div>
  321. <div class="h330">
  322. <div class="txt7">
  323. 参与活动前,请仔细阅读购买协议,特别是产品说明和注意事项。用户参与本活动即视为已充分阅读、理解本活动规则,并自愿受活动规则约束。
  324. </div>
  325. <div class="txt8 mt14 fw500">年卡特惠包</div>
  326. <div class="txt9 mt5">每月自动续,时长不用愁</div>
  327. <div class="txt8 mt5 fw500">1年使用权 每月30小时</div>
  328. <div class="txt9 mt5">按实际使用计时,星曜机型可用,立即生效</div>
  329. <div class="txt9 mt14">
  330. <span class="txt7">有效时间:</span
  331. >按实际使用云手机的时间计时,不使用不计时;每月30H,当月时长不跨月;
  332. </div>
  333. <div class="txt9"><span class="txt7">可用范围:</span>星曜机型</div>
  334. <div class="txt9"><span class="txt7">生效方式:</span>立即生效</div>
  335. <div class="txt9">
  336. <span class="txt7">订购次数:</span>不可重复订购
  337. </div>
  338. <div class="txt9">
  339. <span class="txt7">退订说明:</span>特惠产品,不支持退订
  340. </div>
  341. <div class="txt9 mt14">产品说明:</div>
  342. <div class="txt7">
  343. 1、产品内容:本产品为臂云科技旗下双子星云手机星曜机型新人特惠年包,包含星曜机型云手机1年使用权,连续12个月每月发放30H时长;进入云手机开始计时,下机后不计时。
  344. </div>
  345. <div class="txt7">2、生效时间:订购扣费后立即生效。</div>
  346. <div class="txt7">3、注意事项:</div>
  347. <div class="txt7">
  348. (1)本产品合约期12个月,自生效当月起每月发放30H时长;
  349. </div>
  350. <div class="txt7">(2)合约到期后需用户另外购买时长;</div>
  351. <div class="txt7">
  352. (3)合约到期后,年卡特惠包剩余时长自动失效;
  353. </div>
  354. <div class="txt7">
  355. (4)合约到期后,另外续费时长包所得的时长仍有效,云机可继续使用;
  356. </div>
  357. <div class="txt7">
  358. (5)年卡特惠包云手机与普通包月云手机计时逻辑不同,两种云手机时长不可叠加,若另外订购普通包月云手机将获得一台新云手机。
  359. </div>
  360. <div class="txt8 mt14">温馨提示:</div>
  361. <div class="txt7">
  362. 1、请您理解:通过任何不正当手段参与活动,如借助非自然流量或外挂工具;利用技术漏洞,恶意退款,批量注册账号、买号等搅乱平台管理秩序的行为,臂云科技有权限制或取消用户的活动资格,不予发放或撤销相关交易及福利内容。
  363. </div>
  364. <div class="txt7">2、如有疑问请联系双子星APP客服咨询</div>
  365. <div class="txt8 mt5 fw500" style="color: #ec6250">
  366. 时长包使用规则
  367. </div>
  368. <div class="txt7 mt5">年卡特惠云手机,按需补充时长包</div>
  369. <div class="txt7">
  370. 有效时间:<span class="txt10">时长用完前一直有效,支持跨月</span>
  371. </div>
  372. <div class="txt7">
  373. 可用范围:<span class="txt10">可续时长的机型</span>
  374. </div>
  375. <div class="txt7">
  376. 生效方式:<span class="txt10">立即生效</span>
  377. </div>
  378. <div class="txt7">
  379. 退订说明:<span class="txt10">立即生效产品,不支持退订</span>
  380. </div>
  381. <div class="txt7 mt14">
  382. 产品说明<br />1、生效方式:时长补充包订购后立即生效,直至时长用完则失效,用户可重复订购。<br />
  383. 2、时长使用顺序:优先使用年卡特惠包时长,年卡特惠包时长耗尽,自动使用时长包时长。<br />3、年卡特惠包合约到期后,如时长补充包仍有时长,年卡特惠包所属云手机可继续使用至时长用尽。
  384. </div>
  385. </div>
  386. <img
  387. class="w304h62"
  388. src="~/assets/image/activity/lottery/buy-rule-icon.png"
  389. alt=""
  390. @click="showRule = false"
  391. />
  392. </div>
  393. </div>
  394. </van-popup>
  395. </div>
  396. </template>
  397. <script>
  398. import { Toast } from 'vant';
  399. import RoundTurntable from './component/roundTurntable.vue';
  400. const RSA = require('../../../plugins/wx_rsa');
  401. const webUni = require('../../../plugins/uni');
  402. export default {
  403. name: 'Lottery',
  404. auth: false,
  405. components: {
  406. RoundTurntable,
  407. },
  408. data() {
  409. return {
  410. showRule: false,
  411. show: false,
  412. showPay: false,
  413. // 转盘上的奖品数据
  414. prizeData: [
  415. {
  416. id: 6,
  417. level: 29.9,
  418. },
  419. {
  420. id: 3,
  421. level: 58,
  422. },
  423. {
  424. id: 2,
  425. level: 9.9,
  426. },
  427. {
  428. id: 4,
  429. level: 39.9,
  430. },
  431. {
  432. id: 5,
  433. level: 378,
  434. },
  435. {
  436. id: 1,
  437. level: 15.9,
  438. },
  439. ],
  440. // 转动的圈数
  441. rotateCircle: 6,
  442. // 转动需要持续的时间(s)
  443. duringTime: 4.5,
  444. // 转盘样式的选项
  445. turntableStyleOption: {
  446. // 背景色
  447. prizeBgColors: [
  448. '#FFF9F8',
  449. '#FFECC9',
  450. '#FFF9F8',
  451. '#FFECC9',
  452. '#FFF9F8',
  453. '#FFECC9',
  454. ],
  455. // 转盘的外边框颜色
  456. borderColor: '#FFD790',
  457. },
  458. // 中奖的奖品的index
  459. prizeIndex: -1,
  460. // 用来锁定转盘,避免同时多次点击转动
  461. isLocking: false,
  462. // 剩余抽奖次数
  463. num: 2,
  464. token: '',
  465. activityId: '',
  466. actualPrice: 0,
  467. mealId: '',
  468. selMealId: '',
  469. paySupportType: [],
  470. title: '',
  471. payType: '',
  472. mealList: [],
  473. status: 0,
  474. carousel: [],
  475. phoneType: 'SVIP',
  476. client: 0,
  477. };
  478. },
  479. async fetch() {
  480. if (this.$userAgent.isAndroid) {
  481. this.token = await window.native.getToken();
  482. } else {
  483. this.token = this.$route.query.token;
  484. }
  485. },
  486. head: {
  487. title: '年卡抽奖活动',
  488. },
  489. created() {
  490. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  491. this.client = 1;
  492. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  493. this.client = 2;
  494. } else if (this.$userAgent.isMiniProgram) {
  495. this.client = 5;
  496. } else {
  497. this.client = 7;
  498. }
  499. this.getLuckDrawActivity();
  500. this.getCarouselList();
  501. },
  502. methods: {
  503. async getCarouselList() {
  504. const res = await this.$axios.$post('/activity/v1/member/carousel');
  505. this.carousel = res.data;
  506. },
  507. async getMealInfo() {
  508. const res = await this.$axios.$get(
  509. '/pay/v2/meal/info?phoneType=' + this.phoneType,
  510. );
  511. this.mealList = res.data.list.filter(
  512. (item) =>
  513. (item.day === 30 || item.day === 365) && item.id !== this.mealId,
  514. );
  515. },
  516. async createOrder() {
  517. try {
  518. Toast.loading({
  519. duration: 0,
  520. forbidClick: true,
  521. });
  522. this.makePoint('activity_立即购买');
  523. let taocan = {
  524. buyType: 1,
  525. couponId: 0,
  526. id: this.selMealId,
  527. mealType: 0,
  528. phoneType: this.phoneType,
  529. quantity: 1,
  530. };
  531. taocan = this.sort_ASCII(taocan);
  532. const sign = this.jiaqian(JSON.stringify(taocan));
  533. const res = await this.$axios.$post('/pay/v1/order/create', taocan, {
  534. headers: { Authorization: this.token, sign },
  535. });
  536. Toast.clear();
  537. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  538. window.native.startPay(
  539. this.payType === 'aliPay' ? 3 : 2,
  540. res.data.myOrderNum,
  541. 1,
  542. );
  543. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  544. window.webkit.messageHandlers.startPay.postMessage({
  545. payType: this.payType === 'aliPay' ? 3 : 2,
  546. orderNum: res.data.myOrderNum,
  547. actualPrice: this.actualPrice,
  548. });
  549. } else if (this.$userAgent.isMiniProgram) {
  550. this.$wx.miniProgram.navigateTo({
  551. url:
  552. '/packageA/order/status/index?record=' +
  553. JSON.stringify({
  554. payActive: this.payType === 'wxPay' ? 1 : 0,
  555. myOrderNum: res.data.myOrderNum,
  556. }),
  557. });
  558. } else {
  559. // 使用postMessage 方法可以发送消息到应用, 消息内容需要在data 对象中,否则webview无法接收到
  560. webUni.webView.postMessage({
  561. data: {
  562. payType: this.payType === 'aliPay' ? 3 : 2,
  563. orderNum: res.data.myOrderNum,
  564. buyType: 1,
  565. price: this.actualPrice,
  566. },
  567. });
  568. }
  569. this.showPay = false;
  570. } catch (error) {
  571. Toast.clear();
  572. Toast({
  573. message: error.message,
  574. position: 'top',
  575. duration: 4000,
  576. });
  577. }
  578. },
  579. sort_ASCII(obj) {
  580. const arr = [];
  581. let num = 0;
  582. for (const i in obj) {
  583. arr[num] = i;
  584. num++;
  585. }
  586. const sortArr = arr.sort();
  587. const sortObj = {};
  588. for (const i in sortArr) {
  589. sortObj[sortArr[i]] = obj[sortArr[i]];
  590. }
  591. return sortObj;
  592. },
  593. jiaqian(content) {
  594. const PrivateKey =
  595. '-----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-----';
  596. const signature = new RSA.KJUR.crypto.Signature({
  597. alg: 'SHA256withRSA',
  598. });
  599. signature.init(PrivateKey);
  600. signature.updateString(content);
  601. const signData = signature.sign();
  602. // 将内容转成base64
  603. return RSA.hex2b64(signData);
  604. },
  605. async getLuckDrawActivity() {
  606. const res = await this.$axios.$post(
  607. '/activity/v1/member/luckDrawActivity',
  608. );
  609. this.activityId = res.data.activityId;
  610. this.status = res.data.status;
  611. this.num = res.data.count;
  612. if (this.num === 0) {
  613. this.getLuckDraw();
  614. }
  615. },
  616. // 开始抽奖
  617. startRotation() {
  618. // 如果还不可以转动
  619. if (!this.canBeRotated()) {
  620. return false;
  621. }
  622. this.makePoint('activity_立即抽奖');
  623. // 开始转动
  624. // 先上锁
  625. this.isLocking = true;
  626. this.getLuckDraw();
  627. // 成功后次数减少一次
  628. if (this.num > 1) {
  629. this.num--;
  630. }
  631. // 告诉子组件,开始转动了
  632. this.$refs.roundTurntable.rotate(this.prizeIndex);
  633. },
  634. async getLuckDraw() {
  635. // 设置在哪里停下,应该与后台交互,这里随机抽取0~5
  636. const res = await this.$axios.$post(
  637. '/activity/v1/member/luckDraw?activityId=' + this.activityId,
  638. {},
  639. { headers: { Authorization: this.token } },
  640. );
  641. if (res.status === 0) {
  642. this.actualPrice = res.data.actualPrice;
  643. if (res.data.luckDrawType === 1) {
  644. this.makePoint('activity_15.9年卡');
  645. if (Number(localStorage.getItem('year-15-9')) !== 2)
  646. localStorage.setItem('year-15-9', 1);
  647. }
  648. if (res.data.luckDrawType === 2) {
  649. if (Number(localStorage.getItem('year-9-9')) !== 2)
  650. this.makePoint('activity_9.9年卡');
  651. localStorage.setItem('year-9-9', 1);
  652. }
  653. this.mealId = res.data.mealId
  654. this.selMealId = res.data.mealId
  655. this.getMealInfo()
  656. this.paySupportType = res.data.paySupportType
  657. if (this.$userAgent.isMiniProgram) {
  658. this.paySupportType = ['wxPay']
  659. }
  660. this.payType = this.paySupportType[0]
  661. this.phoneType = res.data.phoneType
  662. this.title = res.data.title
  663. this.prizeIndex = res.data.luckDrawType;
  664. } else {
  665. Toast({
  666. message: res.msg,
  667. position: 'top',
  668. duration: 4000,
  669. });
  670. }
  671. },
  672. makePoint(positionButton) {
  673. const now = new Date();
  674. this.$axios.$post('/public/v5/buriedPointRecord/reportRecords', [
  675. {
  676. client: this.client,
  677. eventCode: '27_抽奖流程',
  678. userName: this.$auth.user.userName,
  679. positionButton,
  680. operationTime: now
  681. .toISOString()
  682. .replace(/T/g, ' ')
  683. .replace(/\.[\d]{3}Z/, ''),
  684. },
  685. ]);
  686. },
  687. // 已经转动完转盘触发的函数
  688. endRotation() {
  689. // 提示中奖
  690. this.showPay = true;
  691. // 解锁
  692. this.isLocking = false;
  693. },
  694. // 判断是否可以转动
  695. canBeRotated() {
  696. if (this.isLocking) {
  697. return false;
  698. }
  699. if (this.status === 0) {
  700. Toast({
  701. message: '当前活动已过期',
  702. position: 'top',
  703. duration: 4000,
  704. });
  705. return false;
  706. }
  707. if (this.status === 2) {
  708. Toast({
  709. message: '当前活动未开启',
  710. position: 'top',
  711. duration: 4000,
  712. });
  713. return false;
  714. }
  715. if (this.status === 3) {
  716. Toast({
  717. message: '当前活动已结束',
  718. position: 'top',
  719. duration: 4000,
  720. });
  721. return false;
  722. }
  723. if (this.num === 0) {
  724. this.showPay = true;
  725. return false;
  726. }
  727. return true;
  728. },
  729. closed() {
  730. this.makePoint('activity_关闭抽奖', 'eventCode传27_抽奖流程');
  731. if (Number(localStorage.getItem('year-15-9')) !== 2) {
  732. this.show = true;
  733. localStorage.setItem('year-15-9', 2);
  734. }
  735. if (Number(localStorage.getItem('year-9-9')) !== 2) {
  736. this.show = true;
  737. localStorage.setItem('year-9-9', 2);
  738. }
  739. },
  740. },
  741. };
  742. </script>
  743. <style lang="scss" scoped>
  744. .sl {
  745. position: absolute;
  746. text-align: center;
  747. margin-top: 64px;
  748. .slogan {
  749. width: 270px;
  750. }
  751. .bannerTitle {
  752. width: 186px;
  753. margin-top: 5px;
  754. }
  755. }
  756. .gesture {
  757. position: absolute;
  758. z-index: 22;
  759. top: 174px;
  760. left: 185px;
  761. img {
  762. width: 101px;
  763. }
  764. }
  765. .fb {
  766. display: flex;
  767. justify-content: space-between;
  768. width: 286px;
  769. margin: 0 auto;
  770. }
  771. .fw500 {
  772. font-weight: 500;
  773. }
  774. .mt5 {
  775. margin-top: 5px;
  776. }
  777. .mt14 {
  778. margin-top: 14px;
  779. }
  780. .lottery-container {
  781. background-color: #bbe5f2;
  782. background-image: url('../../../assets/image/activity/lottery/bg.png');
  783. background-size: contain;
  784. min-height: 100vh;
  785. overflow: hidden;
  786. margin: 0 auto;
  787. }
  788. .lottery-swipe {
  789. width: 188px;
  790. height: 25px;
  791. background: rgba($color: #000000, $alpha: 0.24);
  792. border-radius: 0px 16px 16px 0px;
  793. position: absolute;
  794. top: 134px;
  795. left: 0;
  796. z-index: 1;
  797. }
  798. .lottery-swipe .van-swipe-item {
  799. color: #ffffff;
  800. font-size: 13px;
  801. line-height: 25px;
  802. text-align: center;
  803. }
  804. .w51h26 {
  805. width: 51px;
  806. height: 26px;
  807. position: absolute;
  808. top: 187px;
  809. right: 0;
  810. z-index: 2;
  811. }
  812. .roulette {
  813. width: 372px;
  814. height: 442px;
  815. background-image: url('../../../assets/image/activity/lottery/roulette.png');
  816. background-size: 100% 100%;
  817. margin: 178px auto 0;
  818. position: relative;
  819. }
  820. .arrow {
  821. width: 122px;
  822. height: 135px;
  823. position: absolute;
  824. top: 110px;
  825. left: 125px;
  826. background-image: url('../../../assets/image/activity/lottery/arrow.png');
  827. background-size: 100% 100%;
  828. z-index: 1;
  829. }
  830. .turntable {
  831. position: absolute;
  832. left: calc(50% - 144px);
  833. top: 214px;
  834. width: 288px;
  835. height: 288px;
  836. }
  837. .turntable-name {
  838. position: absolute;
  839. left: 10px;
  840. top: 20px;
  841. width: calc(100% - 20px);
  842. font-size: 20px;
  843. font-weight: 600;
  844. text-align: center;
  845. color: #b8320d;
  846. }
  847. .fs15 {
  848. font-size: 15px;
  849. }
  850. .turntable-img {
  851. position: relative;
  852. /*要居中就要50% - 宽度 / 2*/
  853. left: calc(50% - 40px / 2);
  854. top: 43px;
  855. width: 52px;
  856. height: 39px;
  857. img {
  858. display: inline-block;
  859. width: 52px;
  860. height: 39px;
  861. }
  862. }
  863. .start-btn {
  864. width: 276px;
  865. height: 55px;
  866. position: absolute;
  867. bottom: 16px;
  868. left: calc(50% - 138px);
  869. }
  870. .num {
  871. margin-top: 8px;
  872. text-align: center;
  873. font-size: 14px;
  874. color: #333333;
  875. line-height: 20px;
  876. }
  877. .popup-view {
  878. width: 324px;
  879. padding: 20px 10px;
  880. box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1);
  881. background: #ffffff;
  882. text-align: center;
  883. }
  884. .popup-view-rule {
  885. width: 324px;
  886. height: 452px;
  887. box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1);
  888. box-sizing: border-box;
  889. background: linear-gradient(
  890. 180deg,
  891. rgba(254, 178, 119, 1),
  892. rgba(255, 91, 46, 1)
  893. );
  894. position: relative;
  895. border-radius: 18px;
  896. padding: 6px;
  897. }
  898. .popup-view-rule-box {
  899. width: 312px;
  900. height: 440px;
  901. background: linear-gradient(181deg, #fffffe 0%, #f7f2e5 100%);
  902. border-radius: 18px;
  903. box-sizing: border-box;
  904. padding-top: 38px;
  905. }
  906. .popup-view-rule-title {
  907. width: 220px;
  908. height: 54px;
  909. background-image: url('../../../assets/image/activity/lottery/buy-rule-title.png');
  910. background-size: 100% 100%;
  911. position: absolute;
  912. top: -14px;
  913. left: 52px;
  914. font-size: 18px;
  915. font-weight: 600;
  916. color: #fffefc;
  917. line-height: 54px;
  918. text-align: center;
  919. }
  920. .h330 {
  921. height: 335px;
  922. overflow-y: auto;
  923. padding: 0 16px;
  924. }
  925. .txt1 {
  926. font-size: 18px;
  927. font-weight: 600;
  928. color: #333333;
  929. line-height: 25px;
  930. text-align: center;
  931. }
  932. .coupon-1 {
  933. width: 286px;
  934. height: 106px;
  935. box-sizing: border-box;
  936. margin: 11px auto 0;
  937. position: relative;
  938. border-radius: 13px;
  939. border: 2px solid;
  940. border-color: #e8e8e8;
  941. box-sizing: border-box;
  942. &::before,
  943. &::after {
  944. background-color: white;
  945. border-radius: 50%;
  946. content: '';
  947. width: 20px;
  948. height: 20px;
  949. position: absolute;
  950. top: 43px;
  951. z-index: 1;
  952. }
  953. &::before {
  954. border-right: 2px solid;
  955. border-color: #e8e8e8;
  956. left: -12px;
  957. border-radius: 0 10px 10px 0;
  958. }
  959. &::after {
  960. border-left: 2px solid;
  961. border-color: #e8e8e8;
  962. right: -12px;
  963. border-radius: 10px 0 0 10px;
  964. }
  965. }
  966. .coupon-1.active,
  967. .coupon-2.active {
  968. border-left: 2px solid;
  969. border-color: #d96a57 !important;
  970. &::before {
  971. border-right: 2px solid;
  972. border-color: #d96a57;
  973. }
  974. &::after {
  975. border-left: 2px solid;
  976. border-color: #d96a57;
  977. }
  978. }
  979. .coupon-title {
  980. color: #362113;
  981. font-size: 12px;
  982. text-align: center;
  983. z-index: 1;
  984. position: absolute;
  985. top: 23px;
  986. width: 100%;
  987. }
  988. .txt2 {
  989. font-weight: 600;
  990. font-size: 24px;
  991. }
  992. .txt3 {
  993. color: #db6857;
  994. }
  995. .txt4 {
  996. position: absolute;
  997. top: 68px;
  998. width: 100%;
  999. text-align: center;
  1000. font-size: 14px;
  1001. font-weight: 600;
  1002. color: #ffffff;
  1003. line-height: 20px;
  1004. z-index: 1;
  1005. }
  1006. .coupon-select-icon {
  1007. width: 34px;
  1008. height: 20px;
  1009. position: absolute;
  1010. top: 0;
  1011. right: 0;
  1012. z-index: 2;
  1013. }
  1014. .w253h73 {
  1015. width: 253px;
  1016. height: 73px;
  1017. position: absolute;
  1018. top: 15px;
  1019. left: 15px;
  1020. }
  1021. .coupon-2 {
  1022. width: 137px;
  1023. height: 106px;
  1024. box-sizing: border-box;
  1025. margin-top: 11px;
  1026. position: relative;
  1027. border-radius: 13px;
  1028. box-sizing: border-box;
  1029. border: 2px solid;
  1030. border-color: #e8e8e8;
  1031. &::before,
  1032. &::after {
  1033. background-color: white;
  1034. border-radius: 50%;
  1035. content: '';
  1036. width: 20px;
  1037. height: 20px;
  1038. position: absolute;
  1039. top: 43px;
  1040. z-index: 1;
  1041. }
  1042. &::before {
  1043. border-right: 2px solid;
  1044. border-color: #e8e8e8;
  1045. left: -12px;
  1046. border-radius: 0 10px 10px 0;
  1047. }
  1048. &::after {
  1049. border-left: 2px solid;
  1050. border-color: #e8e8e8;
  1051. right: -12px;
  1052. border-radius: 10px 0 0 10px;
  1053. }
  1054. }
  1055. .w111h73 {
  1056. width: 111px;
  1057. height: 73px;
  1058. position: absolute;
  1059. top: 15px;
  1060. left: 12px;
  1061. }
  1062. .txt5 {
  1063. font-size: 16px;
  1064. color: #333333;
  1065. margin-left: 7px;
  1066. }
  1067. .icon-pay {
  1068. font-size: 26px;
  1069. line-height: inherit;
  1070. }
  1071. .fnc {
  1072. display: flex;
  1073. align-items: center;
  1074. }
  1075. .fnbc {
  1076. display: flex;
  1077. justify-content: space-between;
  1078. align-items: center;
  1079. height: 50px;
  1080. padding: 0 10px;
  1081. }
  1082. .w304h62 {
  1083. width: 304px;
  1084. height: 62px;
  1085. margin: 0 auto;
  1086. }
  1087. .txt6 {
  1088. color: #333333;
  1089. font-size: 11px;
  1090. line-height: 16px;
  1091. a {
  1092. color: #ff7656;
  1093. text-decoration: underline;
  1094. }
  1095. }
  1096. .popup-view-leave {
  1097. background: linear-gradient(180deg, #ffffff 0%, #f7f1e3 100%);
  1098. }
  1099. .btn-leave {
  1100. width: 140px;
  1101. height: 48px;
  1102. background: linear-gradient(180deg, #ffdb94 0%, #ff9539 100%);
  1103. box-shadow: 0px 2px 7px 0px rgba(237, 76, 0, 0.17),
  1104. inset 0px -5px 0px 0px #ff7700;
  1105. border-radius: 24px;
  1106. font-size: 18px;
  1107. font-weight: 600;
  1108. color: #ffffff;
  1109. text-align: center;
  1110. line-height: 43px;
  1111. margin-top: 15px;
  1112. }
  1113. .btn-pay {
  1114. width: 140px;
  1115. height: 48px;
  1116. background: linear-gradient(180deg, #ff9278 0%, #ff562f 100%);
  1117. box-shadow: 0px 2px 7px 0px rgba(237, 76, 0, 0.17),
  1118. inset 0px -5px 0px 0px #f62e00;
  1119. border-radius: 24px;
  1120. border-radius: 24px;
  1121. font-size: 18px;
  1122. font-weight: 600;
  1123. color: #ffffff;
  1124. text-align: center;
  1125. line-height: 43px;
  1126. margin-top: 15px;
  1127. }
  1128. .txt7 {
  1129. font-size: 13px;
  1130. line-height: 19px;
  1131. color: #666666;
  1132. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1133. }
  1134. .txt8 {
  1135. font-size: 15px;
  1136. font-weight: 500;
  1137. line-height: 19px;
  1138. color: #333333;
  1139. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1140. }
  1141. .txt9 {
  1142. font-size: 13px;
  1143. color: #333333;
  1144. line-height: 19px;
  1145. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1146. }
  1147. .txt10 {
  1148. font-size: 13px;
  1149. line-height: 19px;
  1150. color: #333;
  1151. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1152. }
  1153. </style>