pc.vue 33 KB

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