lottery.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. <template>
  2. <div class="lucky" v-if="nextLevel">
  3. <div class="banner"></div>
  4. <div class="lottery container">
  5. <div class="level" style="margin-top: 80px;" v-if="user.itemName === '王者'">
  6. <img src="/images/lottery/level-04.png" alt=""/>
  7. <div class="high_title">联系客服直接领取</div>
  8. </div>
  9. <div class="level" v-else>
  10. <div class="low_level">
  11. <img :src="user.itemName === '青铜' ? '/images/lottery/level-01.png' : user.itemName === '黄金' ? '/images/lottery/level-02.png' : '/images/lottery/level-03.png'" alt=""/>
  12. <div class="level_title">青铜买家用户每发布十条询价便可获得一次抽奖机会</div>
  13. </div>
  14. <div class="up"><img src="/images/lottery/up.png" alt=""/><span>升级</span></div>
  15. <div class="high_level">
  16. <img :src="nextLevel.nextItem.name === '黄金' ? '/images/lottery/level-020.png' : nextLevel.nextItem.name === '钻石' ? '/images/lottery/level-030.png' : '/images/lottery/level-040.png'" alt=""/>
  17. </div>
  18. <div class="progress_bar" v-show="this.user.itemName === '青铜'">
  19. <div class="buyer_inquiry inquiry">
  20. <el-progress :text-inside="true" :stroke-width="15" :percentage="inquiryRate"></el-progress>
  21. <span class="all_count"><span v-text="buyerInquiryCount"></span>条询价</span>
  22. <div class="tip_text"><img src="/images/lottery/update.png" alt=""/>买家再增加<span v-text="activityInquiryCount"></span>条报价,便可升级{{this.nextLevel.nextItem.name}}用户</div>
  23. </div>
  24. <div class="vendor_inquiry inquiry">
  25. <el-progress :text-inside="true" :stroke-width="15" :percentage="replyRate"></el-progress>
  26. <span class="all_count"><span v-text="vendorInquiryCount"></span>条询价</span>
  27. <div class="tip_text"><img src="/images/lottery/update.png" alt=""/>卖家再增加<span v-text="activityReplyCount"></span>条报价,便可升级{{this.nextLevel.nextItem.name}}用户</div>
  28. </div>
  29. </div>
  30. <div class="progress_bar" v-show="this.user.itemName === '黄金'">
  31. <div class="buyer_inquiry inquiry" v-if="this.user.role === 'CUSTOMER'">
  32. <el-progress :text-inside="true" :stroke-width="15" :percentage="inquiryRate"></el-progress>
  33. <span class="all_count"><span v-text="buyerInquiryCount"></span>条询价</span>
  34. <div class="tip_text"><img src="/images/lottery/update.png" alt=""/>买家再增加<span v-text="activityInquiryCount"></span>条报价,便可升级{{this.nextLevel.nextItem.name}}用户</div>
  35. </div>
  36. <div class="vendor_inquiry inquiry" v-if="this.user.role === 'SELLER'">
  37. <el-progress :text-inside="true" :stroke-width="15" :percentage="replyRate"></el-progress>
  38. <span class="all_count"><span v-text="vendorInquiryCount"></span>条询价</span>
  39. <div class="tip_text"><img src="/images/lottery/update.png" alt=""/>卖家再增加<span v-text="activityReplyCount"></span>条报价,便可升级{{this.nextLevel.nextItem.name}}用户</div>
  40. </div>
  41. </div>
  42. <div class="progress_bar" v-show="this.user.itemName === '钻石' && this.user.role === 'CUSTOMER'">
  43. <div class="buyer_inquiry inquiry">
  44. <el-progress :text-inside="true" :stroke-width="15" :percentage="inquiryRate"></el-progress>
  45. <span class="all_count"><span v-text="buyerInquiryCount"></span>条询价</span>
  46. <div class="tip_text"><img src="/images/lottery/update.png" alt=""/>买家再增加<span v-text="activityInquiryCount"></span>条报价,便可升级{{this.nextLevel.nextItem.name}}用户</div>
  47. </div>
  48. <div class="buyer_trad inquiry">
  49. <el-progress :text-inside="true" :stroke-width="15" :percentage="tradeRate"></el-progress>
  50. <span class="all_count"><span v-text="buyerTradeCount"></span>元</span>
  51. <div class="tip_text"><img src="/images/lottery/update.png" alt=""/>买家再增加<span v-text="activityTradeCount"></span>元交易额,便可升级{{this.nextLevel.nextItem.name}}用户</div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="prize">
  56. <div class="press-prise">
  57. <div class="press_prise">
  58. <ul class="nineGrid">
  59. <li class="row">
  60. <div v-for="(prise, index) in currentPrizes.slice(0, 3)" :class="activeIndex === index ? `active` : ``">
  61. <div class="wrapper">
  62. <img :src="prise.img" alt="">
  63. <p v-text="prise.name"></p>
  64. </div>
  65. <div class="mask"></div>
  66. </div>
  67. </li>
  68. <li class="row">
  69. <div :class="activeIndex === 7 ? 'active': ''" class="grid_center">
  70. <div class="wrapper">
  71. <img :src="sevenPrize.img" alt="">
  72. <p v-text="sevenPrize.name"></p>
  73. </div>
  74. <div class="mask"></div>
  75. </div>
  76. <div class="getLuck" @click="startLottery">
  77. <p>立即抽奖</p>
  78. </div>
  79. <div :class="activeIndex === 3 ? 'active': ''" class="grid_center">
  80. <div class="wrapper">
  81. <img :src="thirdPrize.img" alt="">
  82. <p v-text="thirdPrize.name"></p>
  83. </div>
  84. <div class="mask"></div>
  85. </div>
  86. </li>
  87. <li class="row">
  88. <div v-for="(prise, index) in currentPrize" :class="activeIndex === 6-index ? `active` : ``">
  89. <div class="wrapper">
  90. <img :src="prise.img" alt="">
  91. <p v-text="prise.name"></p>
  92. </div>
  93. <div class="mask"></div>
  94. </div>
  95. </li>
  96. </ul>
  97. </div>
  98. <div class="lave-count">剩余<span>{{restCount}}</span>次</div>
  99. <div class="tab-prise">
  100. <span class="toggle"
  101. v-for="(item, index) in user.userDetails"
  102. :class="{'active' : index === selectLevelIndex}"
  103. @click="toggleLevel(item)">{{item.itemName}}用户</span>
  104. </div>
  105. </div>
  106. <div class="look_prise">
  107. <div class="header">
  108. <span>获奖名单</span>
  109. <span @click="lookMyPrizes(true)">查看我的奖品</span>
  110. </div>
  111. <div class="body">
  112. <div class="list_head">
  113. <span>时间</span>
  114. <span>用户</span>
  115. <span>奖品</span>
  116. </div>
  117. <ul>
  118. <li v-for="(record, index) in recordData" :key="index" :style="'top: -' + 40 * scrollTimerIndex + 'px'" :class="{'scrollTop': isTop}">
  119. <div class="time" :title="record.drawnTime" v-text="record.drawnTime">2018-08-08</div>
  120. <div class="company" :title="record.userName" v-text="record.userName">深圳市优软科技有限公司公司深圳市优软科技有限公司公司</div>
  121. <div class="prise_level" :title="record.prizeName" v-text="record.prizeName">一等奖</div>
  122. </li>
  123. </ul>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="describe">
  128. <img src="/images/lottery/describe.png" alt=""/>
  129. </div>
  130. <div class="rule">
  131. <header>活动规则</header>
  132. <div class="section">
  133. <div class="list">1、活动时间:九月起;</div>
  134. <div class="list">2、三个月内的重复型号询价,不计入抽奖机会;</div>
  135. <div class="list">3、钻石用户连续3个月内累计的数据达到抽奖资格,将于最近的一次抽奖中参与,如9-10-11月内达到抽奖资格,将在12月底的抽奖(钻石用户领奖在每个季度最后一个工作日),钻石用户奖品 将由我们电话联系用户;</div>
  136. <div class="list">4、获得实物礼品的客户,联系客服微信领取;</div>
  137. <div class="list">5、活动礼品按周发放;</div>
  138. <div class="list">6、对活动规则以及礼品发送有疑问,请联系在线客服(友情提示:客服在线时间周一至周五,早九点至晚六点,法定节假日除外);</div>
  139. <div class="list">7、领奖时,兑换码和手机号为一致,便可兑换奖品,望您妥善保管;</div>
  140. <div class="list">8、本次活动所属权归优软商城所有。</div>
  141. </div>
  142. </div>
  143. </div>
  144. <!--去登录-->
  145. <div class="no-prise login">
  146. <el-dialog
  147. :visible.sync="showLoginBox">
  148. <div class="dialog-content">
  149. <img src="/images/lottery/hua.png" class="hua" alt=""/>
  150. <p>你还未登录,请登陆后抽奖</p>
  151. </div>
  152. <span slot="footer" class="dialog-footer">
  153. <a type="button" @click="goLogin">确认</a>
  154. </span>
  155. </el-dialog>
  156. </div>
  157. <!--未获得抽奖机会-->
  158. <div class="no-prise">
  159. <el-dialog
  160. :visible.sync="showNoPriseBox">
  161. <div class="dialog-content">
  162. <img src="/images/lottery/hua.png" class="hua" alt=""/>
  163. <p>您未获得抽奖机会,请您先发布询价</p>
  164. </div>
  165. <span slot="footer" class="dialog-footer">
  166. <a type="button" @click="sureInquiry(false)">确认</a>
  167. </span>
  168. </el-dialog>
  169. </div>
  170. <!--未抽中奖品还有机会-->
  171. <div class="no-prise">
  172. <el-dialog
  173. :visible.sync="showChooseBox">
  174. <div class="dialog-content">
  175. <img src="/images/lottery/hua.png" class="hua" alt=""/>
  176. <p>很遗憾,您没有中奖,下次还有机会!</p>
  177. </div>
  178. <span slot="footer" class="dialog-footer">
  179. <a type="button" @click="showChooseBox = false">确认</a>
  180. </span>
  181. </el-dialog>
  182. </div>
  183. <!--中奖提示-->
  184. <div class="no-prise get-prise" v-if="winningInfo.data">
  185. <el-dialog
  186. :visible.sync="showGetPriseBox">
  187. <div class="dialog-content" v-if="winningInfo.data.name === ''">
  188. <!--<div class="close" @click="showGetPriseBox = false">&times;</div>-->
  189. <img src="/images/lottery/hua.png" class="hua" alt=""/>
  190. <p>很遗憾,您没有中奖,下次还有机会!</p>
  191. <span slot="footer" class="dialog-footer">
  192. <a type="button" @click="closeGotPriseInfo(false)">确认</a>
  193. </span>
  194. </div>
  195. <div class="dialog-content" v-else>
  196. <!--<div class="close" @click="showGetPriseBox = false">&times;</div>-->
  197. <img src="/images/lottery/hua.png" class="hua" alt=""/>
  198. <p>恭喜您抽中<span v-text="winningInfo.data.name"></span>,请添加客服微信使用兑换码兑换</p>
  199. <div class="qr"><p>扫描微信二维码或添加XXX微信领取奖品</p><img src="/images/lottery/qr.png" alt=""/></div>
  200. <span slot="footer" class="dialog-footer">
  201. <a type="button" @click="closeGotPriseInfo(false)">确认</a>
  202. </span>
  203. </div>
  204. </el-dialog>
  205. </div>
  206. <!--查看我的奖品-->
  207. <div class="no-prise look-prise">
  208. <el-dialog
  209. :visible.sync="lookPriseBox">
  210. <div class="dialog-content">
  211. <div class="close" @click="lookPriseBox = false">&times;</div>
  212. <img src="/images/lottery/hua.png" class="hua" alt=""/>
  213. <div class="btn-tip">奖品列表</div>
  214. <div v-if="ownRecordData.content && ownRecordData.content.length">
  215. <div style="margin: 0 auto; text-align: center; width: 700px;">
  216. <div class="prise-tab"><span>奖品</span><span>竞换码</span><span>中奖时间</span><span>竞换状态</span></div>
  217. <ul>
  218. <li v-for="item in ownRecordData.content">
  219. <div :title="item.prizeName" v-text="item.prizeName">一等奖</div>
  220. <div :title="item.code" v-text="item.code">YRQT0010</div>
  221. <div :title="item.drawnTime" v-text="item.drawnTime">2018年12月30日</div>
  222. <div v-text="item.status === 100 ? '已兑奖' : item.status === 200 ? '未兑奖' : ''">已兑换</div>
  223. </li>
  224. </ul>
  225. <div style="float: right;">
  226. <page :total="ownRecordData.totalElements" :page-size="pageParams.count"
  227. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  228. </div>
  229. </div>
  230. <div class="prise-style">兑奖方式:扫描微信二维码或添加XXXX微信领取奖品 <img src="/images/lottery/mall_qr.png" alt=""/></div>
  231. </div>
  232. <div v-else>
  233. <div class="no_prise"><i class="fa fa-smile-o fa-lg"></i>暂无中奖记录</div>
  234. </div>
  235. </div>
  236. </el-dialog>
  237. </div>
  238. <!--二维码-->
  239. <div class="qr-active">
  240. <img src="/images/lottery/qr.png" alt=""/>
  241. </div>
  242. </div>
  243. </template>
  244. <script>
  245. import Page from '~components/common/page/pageComponent.vue'
  246. export default {
  247. name: 'lottery',
  248. data () {
  249. return {
  250. pageParams: {
  251. page: 1,
  252. count: 3
  253. },
  254. activeIndex: -1, // 当前转动到哪个位置,起点位置
  255. count: 8, // 总共有多少个位置
  256. timer: 0, // 每次转动定时器
  257. speed: 200, // 初始转动速度
  258. times: 0, // 转动次数
  259. cycle: 50, // 转动基本次数:即至少需要转动多少次再进入抽奖环节
  260. prize: -1, // 中奖位置
  261. click: true,
  262. showToast: false,
  263. showLoginBox: false,
  264. showNoPriseBox: false,
  265. lookPriseBox: false,
  266. showChooseBox: false,
  267. showGetPriseBox: false,
  268. scrollTimer: {},
  269. scrollTimerIndex: 0,
  270. isTop: false,
  271. selectLevelIndex: 0,
  272. // 询价
  273. buyerInquiryCount: 0,
  274. activityInquiryCount: 0,
  275. inquiryRate: 0,
  276. // 回复
  277. vendorInquiryCount: 0,
  278. activityReplyCount: 0,
  279. replyRate: 0,
  280. thirdPrize: {},
  281. sevenPrize: {},
  282. // 钻石交易
  283. buyerTradeCount: 0,
  284. activityTradeCount: 0,
  285. tradeRate: 0,
  286. restCount: 0,
  287. pCode: '',
  288. gotIndexItem: 0
  289. }
  290. },
  291. components: {
  292. Page
  293. },
  294. fetch ({ store }) {
  295. return Promise.all([
  296. // 获取个人中奖
  297. store.dispatch('lottery/getOwnLotteryInfo', {activityCode: '11wwwwwwww',itemCode: this.user.itemCode})
  298. ])
  299. },
  300. computed: {
  301. user () {
  302. console.log(this.$store.state.lottery.lotteryInfo.userInfo.data.data, 'user')
  303. return this.$store.state.lottery.lotteryInfo.userInfo.data ? this.$store.state.lottery.lotteryInfo.userInfo.data.data : []
  304. },
  305. nextLevel () {
  306. console.log(this.$store.state.lottery.lotteryInfo.nextLevel.data.data, 'next')
  307. return this.$store.state.lottery.lotteryInfo.nextLevel.data ? this.$store.state.lottery.lotteryInfo.nextLevel.data.data : []
  308. },
  309. recordData () {
  310. return this.$store.state.lottery.lotteryInfo.record.data ? this.$store.state.lottery.lotteryInfo.record.data.data : []
  311. },
  312. ownRecordData () {
  313. return this.$store.state.lottery.lotteryInfo.ownRecord.data ? this.$store.state.lottery.lotteryInfo.ownRecord.data : []
  314. },
  315. currentPrizes () {
  316. console.log(this.$store.state.lottery.lotteryInfo.prizes.data, 'current')
  317. return this.$store.state.lottery.lotteryInfo.prizes.data ? this.$store.state.lottery.lotteryInfo.prizes.data.data : []
  318. },
  319. currentPrize () {
  320. return this.currentPrizes.slice(4,7).reverse()
  321. },
  322. winningInfo () {
  323. return this.$store.state.lottery.lotteryInfo.ownLotteryInfo.data ? this.$store.state.lottery.lotteryInfo.ownLotteryInfo.data : []
  324. }
  325. },
  326. mounted () {
  327. this.$nextTick(() => {
  328. this.scrollInterval(true)
  329. this.getDetail()
  330. this.getLevel()
  331. })
  332. },
  333. methods: {
  334. // 去询价
  335. sureInquiry (type) {
  336. this.showNoPriseBox = type
  337. this.$router.push('/applyPurchase')
  338. },
  339. // 获取第3和第7奖品详情
  340. getDetail () {
  341. this.currentPrizes.forEach((item, index) => {
  342. if (index === 3) {
  343. this.thirdPrize = item
  344. }
  345. if (index === 7) {
  346. this.sevenPrize = item
  347. }
  348. })
  349. },
  350. // 获取等级
  351. getLevel () {
  352. this.nextLevel.currentItem.activityItemDetails.forEach(item => {
  353. let percent = Number(100)
  354. if (item.type === 'CUSTOMER_UPGRADE' && this.user.itemName === '青铜') {
  355. this.buyerInquiryCount = item.amount
  356. this.activityInquiryCount = this.buyerInquiryCount - this.user.activityInquiryCount
  357. let inquiry = (percent - ((this.activityInquiryCount / this.buyerInquiryCount) * 100)).toFixed(0)
  358. this.inquiryRate = Number(inquiry)
  359. }
  360. if (item.type === 'SELLER_UPGRADE' && this.user.itemName === '青铜') {
  361. this.vendorInquiryCount = item.amount
  362. this.activityReplyCount = this.vendorInquiryCount - this.user.activityReplyCount
  363. let replay = (percent - ((this.activityReplyCount / this.vendorInquiryCount) * 100)).toFixed(0)
  364. this.replyRate = Number(replay)
  365. }
  366. if (this.user.role === 'CUSTOMER' && item.type === 'CUSTOMER_UPGRADE' && this.user.itemName === '黄金') {
  367. this.buyerInquiryCount = item.amount
  368. this.activityInquiryCount = this.buyerInquiryCount - this.user.itemCount
  369. let inquiry = (percent - ((this.activityInquiryCount / this.buyerInquiryCount) * 100)).toFixed(0)
  370. this.inquiryRate = Number(inquiry)
  371. }
  372. if (this.user.role === 'SELLER' && item.type === 'SELLER_UPGRADE' && this.user.itemName === '黄金') {
  373. this.vendorInquiryCount = item.amount
  374. this.activityReplyCount = this.vendorInquiryCount - this.user.itemCount
  375. let replay = (percent - ((this.activityReplyCount / this.vendorInquiryCount) * 100)).toFixed(0)
  376. this.replyRate = Number(replay)
  377. }
  378. if (this.user.role === 'CUSTOMER' && item.type === 'CUSTOMER_UPGRADE' && item.resource === 'INQUIRY' && this.user.itemName === '钻石') {
  379. this.buyerInquiryCount = item.amount
  380. this.activityInquiryCount = this.buyerInquiryCount - this.user.itemCount
  381. let inquiry = (percent - ((this.activityInquiryCount / this.buyerInquiryCount) * 100)).toFixed(0)
  382. this.inquiryRate = Number(inquiry)
  383. }
  384. if (this.user.role === 'CUSTOMER' && item.type === 'CUSTOMER_UPGRADE' && item.resource === 'TRADE_AMOUNT' && this.user.itemName === '钻石') {
  385. this.buyerTradeCount = item.amount
  386. this.activityTradeCount = this.buyerTradeCount - this.user.activityTradeCount
  387. let trad = (percent - ((this.activityTradeCount / this.buyerTradeCount) * 100)).toFixed(3)
  388. this.tradeRate = Number(trad)
  389. }
  390. })
  391. },
  392. getOwnWiningInfo () {
  393. this.$http.get('/lottery/user/draw', {params: {activityCode: '11wwwwwwww', itemCode: this.pCode ? this.pCode : this.user.itemCode}})
  394. .then(res => {
  395. console.log(res.data, 'res.data')
  396. let _arr = []
  397. for (let i = 0; i < this.currentPrizes.length; i++) {
  398. console.log(this.currentPrizes[i].code, 'code')
  399. if (this.currentPrizes[i].code === res.data.data.code) {
  400. _arr.push(this.currentPrizes[i])
  401. }
  402. }
  403. this.gotIndexItem = _arr.slice(0, 1)[0].$index
  404. console.log(_arr.slice(0, 1)[0], 'gotItem0')
  405. console.log(this.gotIndexItem, 'gotItem')
  406. console.log(_arr)
  407. this.$store.commit('lottery/lotteryInfo/GET_OWN_LOTTERY_INFO_SUCCESS', res.data)
  408. }, err => {
  409. this.$store.commit('lottery/lotteryInfo/GET_OWN_LOTTERY_INFO_FAILURE', err)
  410. console.log(err)
  411. })
  412. },
  413. // 切换等级
  414. toggleLevel (item) {
  415. console.log(item, 'item')
  416. if (item.itemName === '钻石') {
  417. this.$message.info('钻石等级暂不能自主抽奖')
  418. } else {
  419. this.pCode = item.itemCode
  420. this.restCount = item.lotteryCount
  421. if (this.pCode) {
  422. this.$http.get('/lottery//user/prizes', {params: {activityCode: '11wwwwwwww', itemCode: this.pCode}})
  423. .then(res => {
  424. this.$store.commit('lottery/lotteryInfo/GET_CURRENT_GRADE_PRIZES_SUCCESS', res.data)
  425. setTimeout( () => {
  426. this.getDetail()
  427. }, 0)
  428. }, err => {
  429. this.$store.commit('lottery/lotteryInfo/GET_CURRENT_GRADE_PRIZES_FAILURE', err)
  430. })
  431. }
  432. }
  433. },
  434. // 查看我的奖品
  435. lookMyPrizes (type) {
  436. this.lookPriseBox = type
  437. },
  438. // 去登录
  439. goLogin () {
  440. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  441. },
  442. // 开始抽奖
  443. startLottery () {
  444. if (this.$store.state.option.user.logged) {
  445. if (this.restCount < 1) {
  446. this.showNoPriseBox = true
  447. } else {
  448. if (!this.click) {
  449. return
  450. }
  451. this.getOwnWiningInfo()
  452. this.closeToast()
  453. this.speed = 200
  454. this.click = false
  455. this.startRoll()
  456. }
  457. } else {
  458. this.showLoginBox = true
  459. }
  460. },
  461. // 开始转动
  462. startRoll () {
  463. this.times += 1 // 转动次数
  464. this.oneRoll() // 转动过程调用的每一次转动方法,这里是第一次调用初始化
  465. // 如果当前转动次数达到要求 && 目前转到的位置是中奖位置
  466. if (this.times > this.cycle + 10 && this.prize === this.activeIndex) {
  467. clearTimeout(this.timer) // 清除转动定时器,停止转动
  468. this.prize = -1
  469. this.times = 0
  470. this.click = true
  471. this.showToast = true
  472. // console.log('你已经中奖了')
  473. this.showGetPriseBox = true
  474. } else {
  475. if (this.times < this.cycle) {
  476. this.speed -= 10 // 加快转动速度
  477. } else if (this.times === this.cycle) { // 随机获得一个中奖位置
  478. // const index = parseInt(Math.random() * 10, 0) || 0
  479. this.prize = this.gotIndexItem
  480. if (this.prize > 7) {
  481. this.prize = 7
  482. }
  483. // console.log(`中奖位置${this.prize}`)
  484. } else if (this.times > this.cycle + 10 &&
  485. ((this.prize === 0 && this.activeIndex === 7) || this.prize === this.activeIndex + 1)) {
  486. this.speed += 110
  487. } else {
  488. this.speed += 20
  489. }
  490. if (this.speed < 40) {
  491. this.speed = 40
  492. }
  493. this.timer = setTimeout(this.startRoll, this.speed)
  494. }
  495. },
  496. // 每一次转动
  497. oneRoll () {
  498. let index = this.activeIndex // 当前转动到哪个位置
  499. const count = this.count // 总共有多少个位置
  500. index += 1
  501. if (index > count - 1) {
  502. index = 0
  503. }
  504. this.activeIndex = index
  505. },
  506. // 关闭弹出框
  507. closeToast () {
  508. this.showToast = false
  509. },
  510. // 我的奖品
  511. scrollInterval (flag) {
  512. // let _arr = {}
  513. // _arr = this.recordData
  514. if (flag && this.recordData.length > 5) {
  515. this.scrollTimer = setInterval(() => {
  516. this.scrollTimerIndex ++
  517. this.isTop = (this.scrollTimerIndex % 45 === 0)
  518. if (this.isTop) {
  519. this.scrollTimerIndex = 0
  520. // for (let i = 0; i < this.recordData; i++) {
  521. // _arr.push(this.recordData.pop())
  522. // }
  523. }
  524. }, 3000)
  525. } else {
  526. clearInterval(this.scrollTimer)
  527. }
  528. },
  529. // 个人奖品分页
  530. handleCurrentChange (page) {
  531. this.pageParams.page = page
  532. this.pageCommodity(this.pageParams)
  533. },
  534. async pageCmpGoods (pageParams) {
  535. console.log(pageParams)
  536. params.page = pageParams.page
  537. params.count = pageParams.count
  538. params.activityCode = '11wwwwwwww'
  539. try {
  540. let { data } = await this.$http.get('/lottery/user/winninghistories/one', { params })
  541. this.$store.commit('lottery/lotteryInfo/GET_OWN_WIN_RECORD_SUCCESS', data)
  542. } catch (err) {
  543. this.$store.commit('lottery/lotteryInfo/GET_OWN_WIN_RECORD_FAILURE', err)
  544. }
  545. },
  546. closeGotPriseInfo (type) {
  547. this.showGetPriseBox = type
  548. this.prize = -1
  549. }
  550. }
  551. }
  552. </script>
  553. <style lang="scss" scoped>
  554. .lucky {
  555. position: relative;
  556. margin: 0 auto;
  557. width: 100%;
  558. text-align: center;
  559. background: #88dcf4;
  560. .qr-active {
  561. position: fixed;
  562. top: 300px;
  563. right: 50px;
  564. }
  565. .banner{
  566. margin: 0 auto;
  567. height: 552px;
  568. text-align: center;
  569. background: url('/images/lottery/banner.png') center center/auto 100% no-repeat #018bff;
  570. }
  571. .lottery{
  572. margin: 0 auto;
  573. padding-bottom: 100px !important;
  574. width: 1190px;
  575. text-align: center;
  576. .level{
  577. position: relative;
  578. margin-top: 140px;
  579. .low_level{
  580. width: 372px;
  581. .level_title {
  582. margin: 20px auto 0;
  583. padding: 9px 23px 10px 22px;
  584. text-align: left;
  585. font-size: 20px;
  586. font-weight: bold;
  587. color: #fff;
  588. background-color: #fcac46;
  589. border-radius: 15px;
  590. }
  591. }
  592. .high_title{
  593. width: 184px;
  594. margin: 20px auto 0;
  595. padding: 10px 12px;
  596. text-align: left;
  597. font-size: 20px;
  598. font-weight: bold;
  599. color: #fff;
  600. background-color: #fcac46;
  601. border-radius: 15px;
  602. }
  603. .up {
  604. position: absolute;
  605. top: 20px;
  606. left: 320px;
  607. span{
  608. position: absolute;
  609. top: 28px;
  610. left: 229px;
  611. font-size: 30px;
  612. font-weight: bold;
  613. color: #693100;
  614. }
  615. }
  616. .high_level {
  617. position: absolute;
  618. top: -107px;
  619. left: 803px
  620. }
  621. .progress_bar {
  622. position: absolute;
  623. top: 245px;
  624. left: 460px;
  625. width: 511px;
  626. .inquiry {
  627. position: relative;
  628. div.tip_text{
  629. padding-left: 20px;
  630. margin-top: 18px;
  631. font-size: 24px;
  632. color: #0082c4;
  633. text-align: left;
  634. img{
  635. margin: -4px 10px 0 0;
  636. }
  637. }
  638. span.all_count{
  639. position: absolute;
  640. top: -5px;
  641. left: 525px;
  642. width: 136px;
  643. font-size: 24px;
  644. color: #0083c5;
  645. text-align: left;
  646. }
  647. }
  648. .vendor_inquiry, .buyer_trad{
  649. margin-top: 60px;
  650. }
  651. }
  652. }
  653. .prize{
  654. overflow: hidden;
  655. margin: 110px auto;
  656. .press-prise {
  657. float: left;
  658. margin: 0 auto;
  659. width: 500px;
  660. text-align: center;
  661. .lave-count{
  662. margin: 22px 0;
  663. font-size: 30px;
  664. font-weight: bold;
  665. color: #ff6600;
  666. >span{
  667. font-size: 30px;
  668. font-weight: bold;
  669. color: #ff6600;
  670. }
  671. }
  672. .tab-prise{
  673. span.toggle{
  674. display: inline-block;
  675. width: 131px;
  676. height: 44px;
  677. line-height: 44px;
  678. text-align: center;
  679. font-size: 24px;
  680. font-weight: bold;
  681. color: #ffffff;
  682. background-color: #fdd557;
  683. border-radius: 15px;
  684. cursor: pointer;
  685. margin-right: 16px;
  686. &:hover, &.active{
  687. background-color: #ff9000;
  688. }
  689. }
  690. }
  691. }
  692. .press_prise{
  693. position: relative;
  694. width: 494px;
  695. height: 309px;
  696. background-color: #ffbe04;
  697. border-radius: 13px;
  698. .nineGrid {
  699. padding-right: 15px;
  700. position: absolute;
  701. top: 8px;
  702. left: 8px;
  703. width: 478px;
  704. height: 293px;
  705. background-color: #ff9000;
  706. border-radius: 13px;
  707. li {
  708. height: 86px;
  709. display: flex;
  710. > div {
  711. flex: 1;
  712. height: 100%;
  713. text-align: center;
  714. position: relative;
  715. margin-top: 10px;
  716. .wrapper {
  717. width: 148px;
  718. height: 80px;
  719. background-color: #fff2cf;
  720. border-radius: 13px;
  721. box-shadow: 0 7px 0 #ffc63c;
  722. -moz-box-shadow: 0 7px 0 #ffc63c;
  723. -o-box-shadow: 0 7px 0 #ffc63c;
  724. -webkit-box-shadow: 0 7px 0 #ffc63c;
  725. }
  726. img {
  727. /*width: 46px;*/
  728. /*height: 38px;*/
  729. vertical-align: middle;
  730. margin: 8px 0;
  731. }
  732. p{
  733. color: #ff6000;
  734. font-size: 16px;
  735. font-weight: bold;
  736. }
  737. .mask {
  738. position: absolute;
  739. top: 0;
  740. left: 0;
  741. width: 148px;
  742. height: 86px;
  743. opacity: 0.5;
  744. border-radius: 10px;
  745. background-color: #000;
  746. display: none;
  747. }
  748. }
  749. >div:nth-child(2) .wrapper {
  750. background: #fee6a7;
  751. }
  752. >div.grid_center .wrapper{
  753. background: #fee6a7;
  754. }
  755. > div.active {
  756. .mask {
  757. display: block;
  758. }
  759. }
  760. > div:first-child {
  761. margin-left: 24px;
  762. }
  763. > div.getLuck {
  764. margin-right: 6px;
  765. width: 148px;
  766. height: 80px;
  767. background-color: #fddb00;
  768. border-radius: 13px;
  769. box-shadow: 0 7px 0 #ffc63c;
  770. -moz-box-shadow: 0 7px 0 #ffc63c;
  771. -o-box-shadow: 0 7px 0 #ffc63c;
  772. -webkit-box-shadow: 0 7px 0 #ffc63c;
  773. cursor: pointer;
  774. p {
  775. font-size: 27px;
  776. font-weight: 900;
  777. color: #f91f00;
  778. line-height: 85px;
  779. }
  780. }
  781. }
  782. li:nth-child(2), li:last-child {
  783. margin-top: 8px;
  784. }
  785. }
  786. }
  787. .look_prise{
  788. float: right;
  789. width: 582px;
  790. .header {
  791. padding: 0 8px 0 28px;
  792. overflow: hidden;
  793. width: 582px;
  794. height: 50px;
  795. line-height: 50px;
  796. background-color: #fdd557;
  797. border-radius: 13px 13px 0px 0px;
  798. span{
  799. color: #846244;
  800. &:first-child {
  801. float: left;
  802. font-size: 30px;
  803. }
  804. &:last-child {
  805. display: inline-block;
  806. margin-top: 8px;
  807. float: right;
  808. width: 134px;
  809. height: 35px;
  810. line-height: 35px;
  811. font-size: 18px;
  812. border-radius: 5px;
  813. border: solid 1px #846244;
  814. cursor: pointer ;
  815. }
  816. }
  817. }
  818. .body{
  819. padding: 0 24px 29px;
  820. background: #fff;
  821. border-radius: 0px 0px 13px 13px;
  822. .list_head{
  823. width: 100%;
  824. height: 54px;
  825. line-height: 54px;
  826. border-bottom: solid 1px #846244;
  827. span{
  828. display: inline-block;
  829. text-align: center;
  830. font-size: 20px;
  831. font-weight: bold;
  832. color: #846244;
  833. &:first-child {
  834. width: 120px;
  835. }
  836. &:nth-child(2) {
  837. width: 300px;
  838. }
  839. &:last-child {
  840. width: 110px;
  841. }
  842. }
  843. }
  844. ul{
  845. width: 100%;
  846. height: 296px;
  847. overflow: hidden;
  848. li{
  849. display: inline-block;
  850. overflow: hidden;
  851. height: 40px;
  852. line-height: 40px;
  853. position: relative;
  854. top: 0;
  855. transition: top 1s;
  856. -moz-transition: top 1s;
  857. -webkit-transition: top 1s;
  858. -o-transition: top 1s;
  859. &.scrollTop {
  860. transition: top 0s;
  861. -moz-transition: top 0s;
  862. -webkit-transition: top 0s;
  863. -o-transition: top 0s;
  864. }
  865. div{
  866. float: left;
  867. font-size: 18px;
  868. color: #846244;
  869. overflow: hidden;
  870. text-overflow: ellipsis;
  871. white-space: nowrap;
  872. &:first-child {
  873. width: 120px;
  874. }
  875. &:nth-child(2) {
  876. width: 300px;
  877. }
  878. &:last-child {
  879. width: 110px;
  880. }
  881. }
  882. }
  883. }
  884. }
  885. }
  886. }
  887. .describe{
  888. margin-bottom: 88px;
  889. }
  890. .rule{
  891. margin: 0 auto;
  892. width: 1040px;
  893. text-align: center;
  894. header{
  895. padding-left: 14px;
  896. width: 100%;
  897. height: 50px;
  898. line-height: 50px;
  899. font-size: 24px;
  900. color: #846244;
  901. background-color: #fdd557;
  902. border-radius: 13px 13px 0px 0px;
  903. }
  904. .section{
  905. padding: 20px 20px 36px 14px;
  906. background-color: #ffffff;
  907. border-radius: 0px 0px 13px 13px;
  908. .list{
  909. line-height: 36px;
  910. text-align: left;
  911. font-size: 24px;
  912. color: #846244;
  913. }
  914. }
  915. }
  916. }
  917. }
  918. </style>