index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  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. this.selMealId = this.mealId;
  561. if (this.luckDrawType === 1 && +localStorage.getItem(this.$auth.user.username + 'year-15-9') !== 2) {
  562. this.show = true;
  563. localStorage.setItem(this.$auth.user.username + 'year-15-9', 2);
  564. }
  565. if (this.luckDrawType === 2 && +localStorage.getItem(this.$auth.user.username + 'year-9-9') !== 2) {
  566. this.show = true;
  567. localStorage.setItem(this.$auth.user.username + 'year-9-9', 2);
  568. }
  569. this.showPay = false
  570. },
  571. },
  572. };
  573. </script>
  574. <style>
  575. .lottery-container .van-grid-item__content {
  576. padding: 0 !important;
  577. }
  578. </style>
  579. <style lang="scss" scoped>
  580. .count-down-time {
  581. height: 46.5px;
  582. background: #333333;
  583. font-size: 12px;
  584. color: #ffffff;
  585. display: flex;
  586. justify-content: center;
  587. align-items: center;
  588. }
  589. .colon {
  590. display: inline-block;
  591. margin: 0 4.5px;
  592. color: #ffffff;
  593. }
  594. .block {
  595. display: inline-block;
  596. width: 17px;
  597. height: 17px;
  598. line-height: 17px;
  599. color: #fff;
  600. font-size: 11px;
  601. background: rgba($color: #ffffff, $alpha: 0.2);
  602. text-align: center;
  603. }
  604. .plr10 {
  605. padding: 0 10px;
  606. margin-bottom: 22px;
  607. }
  608. .dialog-view {
  609. width: 100vw;
  610. height: 100vh;
  611. background: url('../../../assets/image/activity/lottery/dialog-bg.png');
  612. background-size: 100%;
  613. background-repeat: no-repeat;
  614. position: relative;
  615. display: flex;
  616. flex-wrap: wrap;
  617. justify-content: center;
  618. align-items: flex-start;
  619. }
  620. .w283h81 {
  621. width: 283px;
  622. height: 81px;
  623. display: block;
  624. margin: 0 auto 16px;
  625. }
  626. .close {
  627. font-size: 30px;
  628. position: absolute;
  629. top: 18.5px;
  630. right: 26px;
  631. }
  632. .close1 {
  633. font-size: 30px;
  634. position: absolute;
  635. bottom: 0px;
  636. left: calc(50% - 15px);
  637. }
  638. .check {
  639. font-size: 15px;
  640. margin-right: 8.5px;
  641. line-height: 10px;
  642. }
  643. .buy-bar-btn {
  644. width: 184.5px;
  645. height: 50px;
  646. background: linear-gradient(0deg, #df4324 0%, #ffbf96 98%);
  647. border-radius: 10px;
  648. position: absolute;
  649. right: 0;
  650. bottom: 0;
  651. & div:nth-child(1) {
  652. text-align: center;
  653. font-size: 18px;
  654. font-weight: 600;
  655. color: #ffffff;
  656. line-height: 50px;
  657. }
  658. & .tip {
  659. width: 76px;
  660. height: 21px;
  661. background: url('../../../assets/image/activity/lottery/tip.png');
  662. background-size: 100% 100%;
  663. text-align: center;
  664. font-size: 12px;
  665. color: #fff;
  666. line-height: 18px;
  667. position: absolute;
  668. right: 0;
  669. top: -11px;
  670. }
  671. }
  672. .buy-bar {
  673. width: 320px;
  674. height: 40px;
  675. line-height: 40px;
  676. background: #ffffff;
  677. border-radius: 10px;
  678. margin-top: 25px;
  679. position: relative;
  680. font-size: 15px;
  681. text-decoration: line-through;
  682. color: #666666;
  683. padding-left: 28px;
  684. margin-top: 26px;
  685. }
  686. .van-grid-item__text {
  687. font-size: 11px;
  688. }
  689. .meal-item {
  690. margin: 10px;
  691. background: #f2f2f2;
  692. border-radius: 5px;
  693. padding: 7.5px;
  694. }
  695. .w219h26 {
  696. width: 219px;
  697. height: 26px;
  698. margin: 58px auto 0;
  699. display: block;
  700. }
  701. .sl {
  702. position: absolute;
  703. text-align: center;
  704. margin-top: 64px;
  705. .slogan {
  706. width: 270px;
  707. }
  708. .bannerTitle {
  709. width: 186px;
  710. margin-top: 5px;
  711. }
  712. }
  713. .gesture {
  714. position: absolute;
  715. z-index: 22;
  716. top: 174px;
  717. left: 185px;
  718. img {
  719. width: 101px;
  720. }
  721. }
  722. .fb {
  723. display: flex;
  724. justify-content: space-between;
  725. }
  726. .fw500 {
  727. font-weight: 500;
  728. }
  729. .mt5 {
  730. margin-top: 5px;
  731. }
  732. .mt14 {
  733. margin-top: 14px;
  734. }
  735. .lottery-container {
  736. background-color: #bbe5f2;
  737. background-image: url('../../../assets/image/activity/lottery/bg.png');
  738. background-size: contain;
  739. min-height: 100vh;
  740. overflow: hidden;
  741. margin: 0 auto;
  742. }
  743. .lottery-swipe {
  744. width: 100vw;
  745. height: 25px;
  746. background: rgba($color: #000000, $alpha: 0.24);
  747. position: absolute;
  748. top: 0px;
  749. left: 0;
  750. z-index: 1;
  751. }
  752. .lottery-swipe .van-swipe-item {
  753. color: #ffffff;
  754. font-size: 13px;
  755. line-height: 25px;
  756. text-align: center;
  757. }
  758. .w51h26 {
  759. width: 51px;
  760. height: 26px;
  761. position: absolute;
  762. top: 187px;
  763. right: 0;
  764. z-index: 2;
  765. }
  766. .roulette {
  767. width: 372px;
  768. height: 442px;
  769. background-image: url('../../../assets/image/activity/lottery/roulette.png');
  770. background-size: 100% 100%;
  771. margin: 178px auto 0;
  772. position: relative;
  773. }
  774. .arrow {
  775. width: 122px;
  776. height: 135px;
  777. position: absolute;
  778. top: 110px;
  779. left: 125px;
  780. background-image: url('../../../assets/image/activity/lottery/arrow.png');
  781. background-size: 100% 100%;
  782. z-index: 1;
  783. }
  784. .turntable {
  785. position: absolute;
  786. left: calc(50% - 144px);
  787. top: 214px;
  788. width: 288px;
  789. height: 288px;
  790. }
  791. .turntable-name {
  792. position: absolute;
  793. left: 10px;
  794. top: 20px;
  795. width: calc(100% - 20px);
  796. font-size: 20px;
  797. font-weight: 600;
  798. text-align: center;
  799. color: #b8320d;
  800. }
  801. .fs15 {
  802. font-size: 15px;
  803. }
  804. .turntable-img {
  805. position: relative;
  806. /*要居中就要50% - 宽度 / 2*/
  807. left: calc(50% - 40px / 2);
  808. top: 43px;
  809. width: 52px;
  810. height: 39px;
  811. img {
  812. display: inline-block;
  813. width: 52px;
  814. height: 39px;
  815. }
  816. }
  817. .start-btn {
  818. width: 276px;
  819. height: 55px;
  820. position: absolute;
  821. bottom: 16px;
  822. left: calc(50% - 138px);
  823. }
  824. .num {
  825. margin-top: 8px;
  826. text-align: center;
  827. font-size: 14px;
  828. color: #333333;
  829. line-height: 20px;
  830. }
  831. .popup-view {
  832. overflow: hidden;
  833. width: 320px;
  834. border-radius: 10px;
  835. background: #ffffff;
  836. text-align: center;
  837. margin-top: 26.5px;
  838. }
  839. .popup-view-rule {
  840. width: 324px;
  841. height: 452px;
  842. box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1);
  843. box-sizing: border-box;
  844. background: linear-gradient(
  845. 180deg,
  846. rgba(254, 178, 119, 1),
  847. rgba(255, 91, 46, 1)
  848. );
  849. position: relative;
  850. border-radius: 18px;
  851. padding: 6px;
  852. }
  853. .popup-view-rule-box {
  854. width: 312px;
  855. height: 440px;
  856. background: linear-gradient(181deg, #fffffe 0%, #f7f2e5 100%);
  857. border-radius: 18px;
  858. box-sizing: border-box;
  859. padding-top: 38px;
  860. }
  861. .popup-view-rule-title {
  862. width: 220px;
  863. height: 54px;
  864. background-image: url('../../../assets/image/activity/lottery/buy-rule-title.png');
  865. background-size: 100% 100%;
  866. position: absolute;
  867. top: -14px;
  868. left: 52px;
  869. font-size: 18px;
  870. font-weight: 600;
  871. color: #fffefc;
  872. line-height: 54px;
  873. text-align: center;
  874. }
  875. .h330 {
  876. height: 335px;
  877. overflow-y: auto;
  878. padding: 0 16px;
  879. }
  880. .txt1 {
  881. font-size: 30px;
  882. font-weight: 600;
  883. color: #333333;
  884. line-height: 24px;
  885. text-align: center;
  886. margin-top: 23.5px;
  887. }
  888. .coupon-1 {
  889. width: 283px;
  890. height: 81px;
  891. background: linear-gradient(0deg, #979797 0%, #c8c8c8 98%);
  892. border-radius: 6px;
  893. box-sizing: border-box;
  894. overflow: hidden;
  895. }
  896. .coupon-1.active,
  897. .coupon-2.active {
  898. background: linear-gradient(0deg, #df4324 0%, #ffbf96 98%);
  899. }
  900. .coupon-title {
  901. color: #ffffff;
  902. font-weight: 600;
  903. font-size: 20px;
  904. text-align: center;
  905. z-index: 1;
  906. width: 100%;
  907. }
  908. .txt2 {
  909. font-weight: 600;
  910. font-size: 34px;
  911. }
  912. .txt3 {
  913. color: #db6857;
  914. }
  915. .txt4 {
  916. text-align: center;
  917. font-size: 13px;
  918. font-weight: 600;
  919. color: #ffffff;
  920. z-index: 1;
  921. }
  922. .coupon-select-icon {
  923. width: 34px;
  924. height: 20px;
  925. position: absolute;
  926. top: 0;
  927. right: 0;
  928. z-index: 2;
  929. }
  930. .w253h73 {
  931. width: 253px;
  932. height: 73px;
  933. position: absolute;
  934. top: 15px;
  935. left: 15px;
  936. }
  937. .coupon-2 {
  938. width: 138px;
  939. height: 81px;
  940. box-sizing: border-box;
  941. margin-top: 7px;
  942. border-radius: 5px;
  943. background: linear-gradient(0deg, #979797 0%, #c8c8c8 98%);
  944. & .coupon-title {
  945. color: #ffffff;
  946. font-weight: 600;
  947. font-size: 15px;
  948. text-align: center;
  949. z-index: 1;
  950. margin-top: 22.5px;
  951. width: 100%;
  952. line-height: 24px;
  953. }
  954. & .txt2 {
  955. font-size: 15px;
  956. }
  957. }
  958. .w111h73 {
  959. width: 111px;
  960. height: 73px;
  961. position: absolute;
  962. top: 15px;
  963. left: 12px;
  964. }
  965. .txt5 {
  966. font-size: 15px;
  967. color: #333333;
  968. margin-left: 7px;
  969. font-weight: 300;
  970. }
  971. .icon-pay {
  972. font-size: 26px;
  973. line-height: inherit;
  974. }
  975. .fnc {
  976. display: flex;
  977. align-items: center;
  978. }
  979. .fnbc {
  980. display: flex;
  981. justify-content: space-between;
  982. align-items: center;
  983. height: 50px;
  984. padding: 0 21px;
  985. }
  986. .fnbc1 {
  987. display: flex;
  988. justify-content: space-between;
  989. align-items: center;
  990. height: 91px;
  991. margin: 0 22.5px;
  992. border-top: 1px dashed rgba($color: #333, $alpha: 0.3);
  993. position: relative;
  994. &::before,
  995. &::after {
  996. content: '';
  997. background: rgba($color: #000000, $alpha: 0.7);
  998. width: 28px;
  999. height: 28px;
  1000. border-radius: 50%;
  1001. }
  1002. &::before {
  1003. position: absolute;
  1004. left: -36.5px;
  1005. top: -14px;
  1006. }
  1007. &::after {
  1008. position: absolute;
  1009. right: -36.5px;
  1010. top: -14px;
  1011. }
  1012. }
  1013. .w304h62 {
  1014. width: 304px;
  1015. height: 62px;
  1016. margin: 0 auto;
  1017. }
  1018. .txt6 {
  1019. color: #ffffff;
  1020. font-size: 12px;
  1021. line-height: 16px;
  1022. height: 16px;
  1023. text-align: center;
  1024. margin-top: 10px;
  1025. a {
  1026. color: #f5e07e;
  1027. }
  1028. }
  1029. .txt11 {
  1030. color: #666666;
  1031. font-size: 15px;
  1032. line-height: 2;
  1033. margin-top: 8px;
  1034. text-align: center;
  1035. }
  1036. .popup-view-leave {
  1037. margin-bottom: 70px;
  1038. margin-top: 0 !important;
  1039. }
  1040. .btn-leave {
  1041. width: 106.5px;
  1042. height: 34px;
  1043. background: linear-gradient(0deg, #979797 0%, #c8c8c8 98%);
  1044. border-radius: 17px;
  1045. font-size: 16px;
  1046. font-weight: 600;
  1047. color: #ffffff;
  1048. text-align: center;
  1049. line-height: 34px;
  1050. }
  1051. .btn-pay {
  1052. width: 152px;
  1053. height: 40px;
  1054. background: linear-gradient(0deg, #df4324 0%, #ffbf96 98%);
  1055. border-radius: 20px;
  1056. font-size: 20px;
  1057. font-weight: 600;
  1058. color: #ffffff;
  1059. text-align: center;
  1060. line-height: 40px;
  1061. }
  1062. .txt7 {
  1063. font-size: 13px;
  1064. line-height: 19px;
  1065. color: #666666;
  1066. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1067. }
  1068. .txt8 {
  1069. font-size: 15px;
  1070. font-weight: 500;
  1071. line-height: 19px;
  1072. color: #333333;
  1073. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1074. }
  1075. .txt9 {
  1076. font-size: 13px;
  1077. color: #333333;
  1078. line-height: 19px;
  1079. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1080. }
  1081. .txt10 {
  1082. font-size: 13px;
  1083. line-height: 19px;
  1084. color: #333;
  1085. text-shadow: 0px 1px 20px rgba(0, 0, 0, 0.1);
  1086. }
  1087. </style>