index.vue 33 KB

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