pc.vue 33 KB

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