index.vue 34 KB

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