index.vue 33 KB

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