index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  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. methods: {
  289. async getCarouselList() {
  290. const res = await this.$axios.$post('/activity/v1/member/carousel');
  291. this.carousel = res.data;
  292. },
  293. async getMealInfo() {
  294. const res = await this.$axios.$get(
  295. '/pay/v2/meal/info?phoneType=' + this.phoneType,
  296. );
  297. this.mealList = res.data.list.filter(
  298. (item) =>
  299. (item.day === 30 || item.day === 365) && item.id !== this.mealId,
  300. );
  301. this.yearOriginalPrice = +res.data.list.filter((item) =>(item.day === 365))[0].originalPrice
  302. this.originalPrice = this.yearOriginalPrice
  303. },
  304. async createOrder() {
  305. if (!this.checked) {
  306. Toast({
  307. message: '请勾选并且阅读购买协议',
  308. position: 'top',
  309. duration: 4000
  310. });
  311. return
  312. }
  313. try {
  314. Toast.loading({
  315. duration: 0,
  316. forbidClick: true,
  317. });
  318. this.makePoint('activity_立即购买');
  319. let taocan = {
  320. buyType: 1,
  321. couponId: 0,
  322. id: this.selMealId,
  323. mealType: 0,
  324. phoneType: this.phoneType,
  325. quantity: 1,
  326. };
  327. taocan = this.sort_ASCII(taocan);
  328. const sign = this.jiaqian(JSON.stringify(taocan));
  329. const res = await this.$axios.$post('/pay/v1/order/create', taocan, {
  330. headers: { Authorization: this.token, sign }, client: this.client
  331. });
  332. Toast.clear();
  333. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  334. window.native.startPay(
  335. this.payType === 'aliPay' ? 3 : 2,
  336. res.data.myOrderNum,
  337. 1,
  338. );
  339. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  340. window.webkit.messageHandlers.startPay.postMessage({
  341. payType: this.payType === 'aliPay' ? 3 : 2,
  342. orderNum: res.data.myOrderNum,
  343. actualPrice: this.actualPrice,
  344. });
  345. } else if (this.$userAgent.isMiniProgram) {
  346. this.$wx.miniProgram.navigateTo({
  347. url:
  348. '/packageA/order/status/index?record=' +
  349. JSON.stringify({
  350. payActive: this.payType === 'wxPay' ? 1 : 0,
  351. myOrderNum: res.data.myOrderNum,
  352. }),
  353. });
  354. } else {
  355. // 使用postMessage 方法可以发送消息到应用, 消息内容需要在data 对象中,否则webview无法接收到
  356. webUni.webView.postMessage({
  357. data: {
  358. payType: this.payType === 'aliPay' ? 3 : 2,
  359. orderNum: res.data.myOrderNum,
  360. buyType: 1,
  361. price: this.actualPrice,
  362. },
  363. });
  364. }
  365. this.showPay = false;
  366. } catch (error) {
  367. Toast.clear();
  368. Toast({
  369. message: error.message,
  370. position: 'top',
  371. duration: 4000,
  372. });
  373. }
  374. },
  375. sort_ASCII(obj) {
  376. const arr = [];
  377. let num = 0;
  378. for (const i in obj) {
  379. arr[num] = i;
  380. num++;
  381. }
  382. const sortArr = arr.sort();
  383. const sortObj = {};
  384. for (const i in sortArr) {
  385. sortObj[sortArr[i]] = obj[sortArr[i]];
  386. }
  387. return sortObj;
  388. },
  389. jiaqian(content) {
  390. const PrivateKey =
  391. '-----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-----';
  392. const signature = new RSA.KJUR.crypto.Signature({
  393. alg: 'SHA256withRSA',
  394. });
  395. signature.init(PrivateKey);
  396. signature.updateString(content);
  397. const signData = signature.sign();
  398. // 将内容转成base64
  399. return RSA.hex2b64(signData);
  400. },
  401. async getLuckDrawActivity() {
  402. const res = await this.$axios.$post(
  403. '/activity/v1/member/luckDrawActivity',
  404. );
  405. this.activityId = res.data.activityId;
  406. this.status = res.data.status;
  407. this.num = res.data.count;
  408. if (this.num === 0) {
  409. this.getLuckDraw();
  410. }
  411. },
  412. // 开始抽奖
  413. startRotation() {
  414. // 如果还不可以转动
  415. if (!this.canBeRotated()) {
  416. return false;
  417. }
  418. this.makePoint('activity_立即抽奖');
  419. // 开始转动
  420. // 先上锁
  421. this.isLocking = true;
  422. this.getLuckDraw();
  423. // 成功后次数减少一次
  424. if (this.num > 1) {
  425. this.num--;
  426. }
  427. // 告诉子组件,开始转动了
  428. this.$refs.roundTurntable.rotate(this.prizeIndex);
  429. },
  430. async getLuckDraw() {
  431. // 设置在哪里停下,应该与后台交互,这里随机抽取0~5
  432. const res = await this.$axios.$post(
  433. '/activity/v1/member/luckDraw?activityId=' + this.activityId,
  434. {},
  435. { headers: { Authorization: this.token } },
  436. );
  437. if (res.status === 0) {
  438. this.actualPrice = res.data.actualPrice;
  439. this.luckDrawType = res.data.luckDrawType;
  440. if (res.data.luckDrawType === 1) {
  441. this.makePoint('activity_15.9年卡');
  442. if (Number(localStorage.getItem('year-15-9')) !== 2) {
  443. localStorage.setItem('year-15-9', 1);
  444. }
  445. }
  446. if (res.data.luckDrawType === 2) {
  447. this.makePoint('activity_9.9年卡');
  448. if (Number(localStorage.getItem('year-9-9')) !== 2) {
  449. localStorage.setItem('year-9-9', 1);
  450. }
  451. }
  452. this.mealId = res.data.mealId
  453. this.selMealId = res.data.mealId
  454. this.getMealInfo()
  455. this.paySupportType = res.data.paySupportType
  456. if (this.$userAgent.isMiniProgram) {
  457. this.paySupportType = ['wxPay']
  458. }
  459. this.payType = this.paySupportType[0]
  460. this.phoneType = res.data.phoneType
  461. this.title = res.data.title
  462. this.prizeIndex = res.data.luckDrawType === 1 ? 5 : 2;
  463. if (this.num === 0) {
  464. this.showPay = true
  465. }
  466. } else {
  467. Toast({
  468. message: res.msg,
  469. position: 'top',
  470. duration: 4000,
  471. });
  472. }
  473. },
  474. makePoint(positionButton) {
  475. const now = new Date();
  476. this.$axios.$post('/public/v5/buriedPointRecord/reportRecords', [
  477. {
  478. client: this.client,
  479. eventCode: '27_抽奖流程',
  480. userName: this.$auth.user.userName,
  481. positionButton,
  482. operationTime: now
  483. .toISOString()
  484. .replace(/T/g, ' ')
  485. .replace(/\.[\d]{3}Z/, ''),
  486. },
  487. ]);
  488. },
  489. // 已经转动完转盘触发的函数
  490. endRotation() {
  491. // 提示中奖
  492. this.showPay = true;
  493. // 解锁
  494. this.isLocking = false;
  495. },
  496. // 判断是否可以转动
  497. canBeRotated() {
  498. if (this.isLocking) {
  499. return false;
  500. }
  501. if (this.status === 0) {
  502. Toast({
  503. message: '当前活动已过期',
  504. position: 'top',
  505. duration: 4000,
  506. });
  507. return false;
  508. }
  509. if (this.status === 2) {
  510. Toast({
  511. message: '当前活动未开启',
  512. position: 'top',
  513. duration: 4000,
  514. });
  515. return false;
  516. }
  517. if (this.status === 3) {
  518. Toast({
  519. message: '当前活动已结束',
  520. position: 'top',
  521. duration: 4000,
  522. });
  523. return false;
  524. }
  525. if (this.num === 0) {
  526. this.showPay = true;
  527. return false;
  528. }
  529. return true;
  530. },
  531. closed() {
  532. this.makePoint('activity_关闭抽奖', 'eventCode传27_抽奖流程');
  533. if (+localStorage.getItem('year-15-9') !== 2) {
  534. this.show = true;
  535. localStorage.setItem('year-15-9', 2);
  536. }
  537. if (+localStorage.getItem('year-9-9') !== 2) {
  538. this.show = true;
  539. localStorage.setItem('year-9-9', 2);
  540. }
  541. this.showPay = false
  542. },
  543. },
  544. };
  545. </script>
  546. <style>
  547. .lottery-container .van-grid-item__content {
  548. padding: 0 !important;
  549. }
  550. </style>
  551. <style lang="scss" scoped>
  552. .w283h81 {
  553. width: 283px;
  554. height: 81px;
  555. display: block;
  556. margin: 0 auto;
  557. }
  558. .close {
  559. font-size: 30px;
  560. position: absolute;
  561. top: 0;
  562. right: 0;
  563. }
  564. .close1 {
  565. font-size: 30px;
  566. position: absolute;
  567. bottom: 0px;
  568. left: calc(50% - 15px);
  569. }
  570. .check {
  571. font-size: 15px;
  572. margin-right: 8.5px;
  573. line-height: 10px;
  574. }
  575. .buy-bar-btn {
  576. width: 184.5px;
  577. height: 50px;
  578. background: linear-gradient(0deg, #DF4324 0%, #FFBF96 98%);
  579. border-radius: 10px;
  580. position: absolute;
  581. right: 0;
  582. bottom: 0;
  583. & div:nth-child(1) {
  584. text-align: center;
  585. font-size: 18px;
  586. font-weight: 600;
  587. color: #FFFFFF;
  588. line-height: 50px;
  589. }
  590. }
  591. .buy-bar {
  592. width: 320px;
  593. height: 40px;
  594. line-height: 40px;
  595. background: #FFFFFF;
  596. border-radius: 10px;
  597. margin-top: 25px;
  598. position: relative;
  599. font-size: 15px;
  600. text-decoration: line-through;
  601. color: #666666;
  602. padding-left: 28px;
  603. }
  604. .van-grid-item__text {
  605. font-size: 11px;
  606. }
  607. .meal-item {
  608. margin: 10px;
  609. background: #F2F2F2;
  610. border-radius: 5px;
  611. padding: 7.5px;
  612. }
  613. .w219h26 {
  614. width: 219px;
  615. height: 26px;
  616. display: block;
  617. margin: 0 auto 26.5px;
  618. }
  619. .sl {
  620. position: absolute;
  621. text-align: center;
  622. margin-top: 64px;
  623. .slogan {
  624. width: 270px;
  625. }
  626. .bannerTitle {
  627. width: 186px;
  628. margin-top: 5px;
  629. }
  630. }
  631. .gesture {
  632. position: absolute;
  633. z-index: 22;
  634. top: 174px;
  635. left: 185px;
  636. img {
  637. width: 101px;
  638. }
  639. }
  640. .fb {
  641. display: flex;
  642. justify-content: space-between;
  643. }
  644. .fw500 {
  645. font-weight: 500;
  646. }
  647. .mt5 {
  648. margin-top: 5px;
  649. }
  650. .mt14 {
  651. margin-top: 14px;
  652. }
  653. .lottery-container {
  654. background-color: #bbe5f2;
  655. background-image: url('../../../assets/image/activity/lottery/bg.png');
  656. background-size: contain;
  657. min-height: 100vh;
  658. overflow: hidden;
  659. margin: 0 auto;
  660. }
  661. .lottery-swipe {
  662. width: 100vw;
  663. height: 25px;
  664. background: rgba($color: #000000, $alpha: 0.24);
  665. position: absolute;
  666. top: 0px;
  667. left: 0;
  668. z-index: 1;
  669. }
  670. .lottery-swipe .van-swipe-item {
  671. color: #ffffff;
  672. font-size: 13px;
  673. line-height: 25px;
  674. text-align: center;
  675. }
  676. .w51h26 {
  677. width: 51px;
  678. height: 26px;
  679. position: absolute;
  680. top: 187px;
  681. right: 0;
  682. z-index: 2;
  683. }
  684. .roulette {
  685. width: 372px;
  686. height: 442px;
  687. background-image: url('../../../assets/image/activity/lottery/roulette.png');
  688. background-size: 100% 100%;
  689. margin: 178px auto 0;
  690. position: relative;
  691. }
  692. .arrow {
  693. width: 122px;
  694. height: 135px;
  695. position: absolute;
  696. top: 110px;
  697. left: 125px;
  698. background-image: url('../../../assets/image/activity/lottery/arrow.png');
  699. background-size: 100% 100%;
  700. z-index: 1;
  701. }
  702. .turntable {
  703. position: absolute;
  704. left: calc(50% - 144px);
  705. top: 214px;
  706. width: 288px;
  707. height: 288px;
  708. }
  709. .turntable-name {
  710. position: absolute;
  711. left: 10px;
  712. top: 20px;
  713. width: calc(100% - 20px);
  714. font-size: 20px;
  715. font-weight: 600;
  716. text-align: center;
  717. color: #b8320d;
  718. }
  719. .fs15 {
  720. font-size: 15px;
  721. }
  722. .turntable-img {
  723. position: relative;
  724. /*要居中就要50% - 宽度 / 2*/
  725. left: calc(50% - 40px / 2);
  726. top: 43px;
  727. width: 52px;
  728. height: 39px;
  729. img {
  730. display: inline-block;
  731. width: 52px;
  732. height: 39px;
  733. }
  734. }
  735. .start-btn {
  736. width: 276px;
  737. height: 55px;
  738. position: absolute;
  739. bottom: 16px;
  740. left: calc(50% - 138px);
  741. }
  742. .num {
  743. margin-top: 8px;
  744. text-align: center;
  745. font-size: 14px;
  746. color: #333333;
  747. line-height: 20px;
  748. }
  749. .popup-view {
  750. overflow: hidden;
  751. width: 320px;
  752. border-radius: 10px;
  753. background: #ffffff;
  754. text-align: center;
  755. }
  756. .popup-view-rule {
  757. width: 324px;
  758. height: 452px;
  759. box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1);
  760. box-sizing: border-box;
  761. background: linear-gradient(
  762. 180deg,
  763. rgba(254, 178, 119, 1),
  764. rgba(255, 91, 46, 1)
  765. );
  766. position: relative;
  767. border-radius: 18px;
  768. padding: 6px;
  769. }
  770. .popup-view-rule-box {
  771. width: 312px;
  772. height: 440px;
  773. background: linear-gradient(181deg, #fffffe 0%, #f7f2e5 100%);
  774. border-radius: 18px;
  775. box-sizing: border-box;
  776. padding-top: 38px;
  777. }
  778. .popup-view-rule-title {
  779. width: 220px;
  780. height: 54px;
  781. background-image: url('../../../assets/image/activity/lottery/buy-rule-title.png');
  782. background-size: 100% 100%;
  783. position: absolute;
  784. top: -14px;
  785. left: 52px;
  786. font-size: 18px;
  787. font-weight: 600;
  788. color: #fffefc;
  789. line-height: 54px;
  790. text-align: center;
  791. }
  792. .h330 {
  793. height: 335px;
  794. overflow-y: auto;
  795. padding: 0 16px;
  796. }
  797. .txt1 {
  798. font-size: 30px;
  799. font-weight: 600;
  800. color: #333333;
  801. line-height: 24px;
  802. text-align: center;
  803. margin-top: 23.5px;
  804. }
  805. .coupon-1 {
  806. width: 283px;
  807. height: 81px;
  808. background: linear-gradient(0deg, #979797 0%, #C8C8C8 98%);
  809. border-radius: 6px;
  810. box-sizing: border-box;
  811. }
  812. .coupon-1.active,
  813. .coupon-2.active {
  814. background: linear-gradient(0deg, #DF4324 0%, #FFBF96 98%);
  815. }
  816. .coupon-title {
  817. color: #FFFFFF;
  818. font-weight: 600;
  819. font-size: 20px;
  820. text-align: center;
  821. z-index: 1;
  822. margin-top: 15.5px;
  823. width: 100%;
  824. }
  825. .txt2 {
  826. font-weight: 600;
  827. font-size: 34px;
  828. }
  829. .txt3 {
  830. color: #db6857;
  831. }
  832. .txt4 {
  833. text-align: center;
  834. font-size: 13px;
  835. font-weight: 600;
  836. color: #ffffff;
  837. z-index: 1;
  838. }
  839. .coupon-select-icon {
  840. width: 34px;
  841. height: 20px;
  842. position: absolute;
  843. top: 0;
  844. right: 0;
  845. z-index: 2;
  846. }
  847. .w253h73 {
  848. width: 253px;
  849. height: 73px;
  850. position: absolute;
  851. top: 15px;
  852. left: 15px;
  853. }
  854. .coupon-2 {
  855. width: 138px;
  856. height: 81px;
  857. box-sizing: border-box;
  858. margin-top: 7px;
  859. border-radius: 5px;
  860. background: linear-gradient(0deg, #979797 0%, #C8C8C8 98%);
  861. & .coupon-title {
  862. color: #FFFFFF;
  863. font-weight: 600;
  864. font-size: 15px;
  865. text-align: center;
  866. z-index: 1;
  867. margin-top: 22.5px;
  868. width: 100%;
  869. line-height: 24px;
  870. }
  871. & .txt2 {
  872. font-size: 15px;
  873. }
  874. }
  875. .w111h73 {
  876. width: 111px;
  877. height: 73px;
  878. position: absolute;
  879. top: 15px;
  880. left: 12px;
  881. }
  882. .txt5 {
  883. font-size: 16px;
  884. color: #333333;
  885. margin-left: 7px;
  886. }
  887. .icon-pay {
  888. font-size: 26px;
  889. line-height: inherit;
  890. }
  891. .fnc {
  892. display: flex;
  893. align-items: center;
  894. }
  895. .fnbc {
  896. display: flex;
  897. justify-content: space-between;
  898. align-items: center;
  899. height: 50px;
  900. padding: 0 10px;
  901. }
  902. .fnbc1 {
  903. display: flex;
  904. justify-content: space-around;
  905. align-items: center;
  906. height: 91px;
  907. border-top: 1px dashed #333;
  908. }
  909. .w304h62 {
  910. width: 304px;
  911. height: 62px;
  912. margin: 0 auto;
  913. }
  914. .txt6 {
  915. color: #666666;
  916. font-size: 12px;
  917. line-height: 16px;
  918. margin-top: 11px;
  919. text-align: center;
  920. a {
  921. color: #F5E07E;
  922. }
  923. }
  924. .txt11 {
  925. color: #666666;
  926. font-size: 15px;
  927. line-height: 2;
  928. margin-top: 8px;
  929. text-align: center;
  930. }
  931. .popup-view-leave {
  932. margin-bottom: 70px;
  933. }
  934. .btn-leave {
  935. width: 106.5px;
  936. height: 34px;
  937. background: linear-gradient(0deg, #979797 0%, #C8C8C8 98%);
  938. border-radius: 17px;
  939. font-size: 16px;
  940. font-weight: 600;
  941. color: #ffffff;
  942. text-align: center;
  943. line-height: 34px;
  944. }
  945. .btn-pay {
  946. width: 152px;
  947. height: 40px;
  948. background: linear-gradient(0deg, #DF4324 0%, #FFBF96 98%);
  949. border-radius: 20px;
  950. font-size: 20px;
  951. font-weight: 600;
  952. color: #ffffff;
  953. text-align: center;
  954. line-height: 40px;
  955. }
  956. .txt7 {
  957. font-size: 13px;
  958. line-height: 19px;
  959. color: #666666;
  960. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  961. }
  962. .txt8 {
  963. font-size: 15px;
  964. font-weight: 500;
  965. line-height: 19px;
  966. color: #333333;
  967. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  968. }
  969. .txt9 {
  970. font-size: 13px;
  971. color: #333333;
  972. line-height: 19px;
  973. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  974. }
  975. .txt10 {
  976. font-size: 13px;
  977. line-height: 19px;
  978. color: #333;
  979. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  980. }
  981. </style>