pc.vue 33 KB

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