index.vue 29 KB

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