index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="goods-lucky">
  3. <!-- 转盘 -->
  4. <view class="spinning" :style="{backgroundImage:'url('+backImageUrl+')'}">
  5. <view class="spinning-title">
  6. <text>幸运大转盘</text>
  7. </view>
  8. <q-turntable ref="turntable" :areaNumber='9' @start="turntableStart" @success="turntableSuccess">
  9. </q-turntable>
  10. </view>
  11. <view style="background-color: #f9f9f9; padding-bottom: 136rpx;">
  12. <!-- 产品信息 -->
  13. <view class="produce">
  14. <view class="produce-title">产品信息</view>
  15. <view class="produce-main" v-for="item in 6">
  16. <image style="width: 132rpx;height: 132rpx;border-radius: 10rpx;" src="/static/icon/banner02.png"
  17. mode=""></image>
  18. <view class="produce-main-text">
  19. <text class="produce-main-text-top">一等奖</text>
  20. <text class="produce-main-text-bom">HUAWEI MateBook X Pro</text>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 活动规则 -->
  25. <view class="rule">
  26. <view class="rule-title">
  27. 活动规则
  28. </view>
  29. <view class="rule-content">
  30. <view class="introduce-top">
  31. <text class="introduce-top-rule1"></text>
  32. <text style="margin: 0 8rpx;">活动规则</text>
  33. <text class="introduce-top-rule2"></text>
  34. </view>
  35. <view class="introduce-text">
  36. <text>活动奖品分为线上和线下两种类型活动奖品分为线上和线下两种类型奖品活动奖品分为线上和线下两种类型奖品奖品,线上活动奖品分为线上和线下两种类型奖品,线上活动奖品分为线上和线下两种类型奖品,线上</text>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 我的奖品 -->
  41. <view class="prize">
  42. <view class="prize-title">
  43. 我的奖品
  44. </view>
  45. <view class="prize-main" v-for="item in 3">
  46. <view class="prize-main-left">
  47. <text class="prize-main-left-top">HUAWEI MateBook X Pro</text>
  48. <text class="prize-main-left-bom">2022-02-10</text>
  49. </view>
  50. <view :class="isexchange ? 'prize-main-rightSelect' : 'prize-main-right' ">
  51. <text v-if="isexchange">立即兑换</text>
  52. <text v-if="!isexchange">已兑换</text>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 中奖弹窗 -->
  58. <uni-popup ref="codePurchase" type="center">
  59. <view class="code-purchase">
  60. <view class="img">
  61. <image style="width: 80rpx;height: 82rpx" src="/static/icon/gift01.png"></image>
  62. <view class="text">
  63. <text>恭喜您抽中了<text>{{prizeLevel}}</text></text>
  64. <text>请尽快去奖品中心兑奖</text>
  65. </view>
  66. </view>
  67. <view class="btn">
  68. <view class="cancel" @click="dialogClose"><text>待会儿</text></view>
  69. <view class="download" @click="dialogConfirm"><text>去兑奖</text></view>
  70. </view>
  71. </view>
  72. </uni-popup>
  73. <!-- 未中奖弹窗 -->
  74. <uni-popup ref="codePurchaseNone" type="center">
  75. <view class="code-purchase">
  76. <view class="img">
  77. <image style="width: 108rpx;height: 68rpx" src="/static/icon/gift02.png"></image>
  78. <view class="text">
  79. <text>很遗憾您没有抽中奖品</text>
  80. <text>下次再来哟</text>
  81. </view>
  82. </view>
  83. <view class="btn">
  84. <view class="know" @click="dialogClose"><text>知道了</text></view>
  85. </view>
  86. </view>
  87. </uni-popup>
  88. </view>
  89. </template>
  90. <script>
  91. import QTurntable from '@/components/q-turntable/q-turntable.vue'
  92. export default {
  93. components: {
  94. QTurntable
  95. },
  96. data() {
  97. return {
  98. //中奖等级
  99. prizeLevel:'',
  100. isexchange: true,
  101. backImageUrl: 'http://t9.9026.com/imgs/banner02.png',
  102. award: 1,
  103. awardList: [{
  104. title: '一等奖'
  105. },
  106. {
  107. title: '四等奖'
  108. },
  109. {
  110. title: '谢谢参与'
  111. },
  112. {
  113. title: '一等奖'
  114. },
  115. {
  116. title: '谢谢参与'
  117. },
  118. {
  119. title: '三等奖'
  120. },
  121. {
  122. title: '三等奖'
  123. },
  124. {
  125. title: '二等奖'
  126. },
  127. {
  128. title: '一等奖'
  129. }
  130. ] // 顺时针对应每个奖项
  131. }
  132. },
  133. methods: {
  134. //中奖去兑换按钮
  135. dialogConfirm() {
  136. console.log('确认');
  137. },
  138. //中奖待会按钮
  139. dialogClose() {
  140. console.log('取消');
  141. },
  142. // 用户点击开始抽奖
  143. turntableStart() {
  144. let index = Math.floor(Math.random() * 6 + 1) //前端随机数,这里应该后台返回中奖结果
  145. // this.award = index
  146. this.award = 2
  147. this.$refs.turntable.begin(this.award);
  148. },
  149. // 抽奖完成后操作
  150. turntableSuccess() {
  151. const index = this.award - 1;
  152. console.log('bind:success', this.awardList[index]);
  153. if(this.awardList[index].title == '谢谢参与'){
  154. this.$refs.codePurchaseNone.open()
  155. }else{
  156. let o = this.awardList[index].title
  157. console.log(this.awardList[index].title);
  158. this.prizeLevel = o
  159. this.$refs.codePurchase.open()
  160. }
  161. // uni.showToast({
  162. // title: `恭喜你获得${this.awardList[index].title}`,
  163. // icon: 'none'
  164. // });
  165. },
  166. }
  167. }
  168. </script>
  169. <style lang="scss" scoped>
  170. $pageColor:#F9F9F9;
  171. $bgColor:#FFFFFF;
  172. @mixin flexlayout {
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. }
  177. page {
  178. height: 100% !important;
  179. background: #F9F9F9 !important;
  180. }
  181. .goods-lucky {
  182. height: 100%;
  183. background: #F9F9F9;
  184. }
  185. .code-purchase {
  186. width: 620rpx;
  187. // height: 357rpx;
  188. background: #fff;
  189. border-radius: 20rpx;
  190. padding-top: 44rpx;
  191. box-sizing: border-box;
  192. .img {
  193. display: flex;
  194. flex-direction: column;
  195. align-items: center;
  196. justify-content: center;
  197. }
  198. .text{
  199. margin-top: 26rpx;
  200. display: flex;
  201. flex-direction: column;
  202. align-items: center;
  203. justify-content: center;
  204. font-weight: 400;
  205. color: #333333;
  206. font-size: 32rpx;
  207. line-height: 44rpx;
  208. }
  209. .btn {
  210. margin-top: 26rpx;
  211. width: 100%;
  212. height: 90rpx;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. border-top:2rpx solid #E5E5E5;
  217. .cancel{
  218. flex: 1;
  219. display: flex;
  220. align-items: center;
  221. justify-content: center;
  222. font-weight: 400;
  223. color: #333333;
  224. font-size: 32rpx;
  225. }
  226. .download{
  227. flex: 1;
  228. height: 90rpx;
  229. display: flex;
  230. align-items: center;
  231. justify-content: center;
  232. border-left:2rpx solid #E5E5E5;
  233. font-weight: 400;
  234. color: #FF6200;
  235. font-size: 32rpx;
  236. }
  237. .know{
  238. font-weight: 400;
  239. color: #FF6200;
  240. font-size: 32rpx;
  241. }
  242. }
  243. }
  244. .prize {
  245. margin-top: 24rpx;
  246. background: #FFFFFF;
  247. border-radius: 16rpx;
  248. padding: 40rpx 30rpx 40rpx;
  249. .prize-title {
  250. font-weight: bold;
  251. color: #080F18;
  252. font-size: 30rpx;
  253. }
  254. .prize-main {
  255. margin-top: 40rpx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: space-between;
  259. border-bottom: 2rpx solid #F0F0F0;
  260. padding-bottom: 40rpx;
  261. &:last-child {
  262. border-bottom: none;
  263. padding-bottom: 0rpx;
  264. }
  265. .prize-main-left {
  266. display: flex;
  267. flex-direction: column;
  268. align-items: flex-start;
  269. justify-content: center;
  270. .prize-main-left-top {
  271. font-size: 32rpx;
  272. font-weight: bold;
  273. color: #333333;
  274. }
  275. .prize-main-left-bom {
  276. font-weight: 500;
  277. color: #999999;
  278. font-size: 24rpx;
  279. margin-top: 24rpx;
  280. }
  281. }
  282. .prize-main-right {
  283. flex: none;
  284. width: 148rpx;
  285. height: 60rpx;
  286. background: #FFFFFF;
  287. border-radius: 30rpx;
  288. border: 2rpx solid #D0D0D0;
  289. display: flex;
  290. align-items: center;
  291. justify-content: center;
  292. color: #D0D0D0;
  293. font-size: 26rpx;
  294. }
  295. .prize-main-rightSelect {
  296. flex: none;
  297. width: 148rpx;
  298. height: 60rpx;
  299. background: #FFFFFF;
  300. border-radius: 30rpx;
  301. border: 2rpx solid #FF6200;
  302. display: flex;
  303. align-items: center;
  304. justify-content: center;
  305. color: #FF6200;
  306. font-size: 26rpx;
  307. }
  308. }
  309. }
  310. .rule {
  311. margin-top: 24rpx;
  312. background: #FFFFFF;
  313. border-radius: 16rpx;
  314. padding: 40rpx 30rpx 32rpx;
  315. .rule-title {
  316. font-weight: bold;
  317. color: #080F18;
  318. font-size: 30rpx;
  319. }
  320. .rule-content {
  321. margin-top: 32rpx;
  322. background: #FFFFFF;
  323. border-radius: 4rpx;
  324. border: 2rpx solid #999999;
  325. padding: 48rpx 20rpx 34rpx;
  326. .introduce-top {
  327. height: 32rpx;
  328. display: flex;
  329. align-items: center;
  330. justify-content: center;
  331. font-size: 32rpx;
  332. font-weight: bold;
  333. letter-spacing: 2rpx;
  334. .introduce-top-rule1 {
  335. width: 56rpx;
  336. height: 4rpx;
  337. background: linear-gradient(90deg, #FFFFFF 0%, #D9A94D 100%);
  338. }
  339. .introduce-top-rule2 {
  340. width: 56rpx;
  341. height: 4rpx;
  342. background: linear-gradient(-90deg, #FFFFFF 0%, #D9A94D 100%);
  343. }
  344. }
  345. .introduce-text {
  346. margin-top: 72rpx;
  347. font-weight: bold;
  348. color: #333333;
  349. font-size: 28rpx;
  350. line-height: 56rpx;
  351. }
  352. }
  353. }
  354. .produce {
  355. position: relative;
  356. top: -10rpx;
  357. background: #FFFFFF;
  358. border-radius: 16rpx;
  359. padding: 48rpx 30rpx 0rpx;
  360. .produce-title {
  361. font-weight: bold;
  362. color: #080F18;
  363. font-size: 30rpx;
  364. margin-bottom: 40rpx;
  365. }
  366. .produce-main {
  367. display: flex;
  368. align-items: center;
  369. justify-content: space-between;
  370. border-bottom: 2rpx solid #F0F0F0;
  371. padding-bottom: 32rpx;
  372. margin-bottom: 32rpx;
  373. &:last-child {
  374. border: none;
  375. margin-bottom: 0;
  376. }
  377. .produce-main-text {
  378. margin-left: 24rpx;
  379. flex: 1;
  380. display: flex;
  381. flex-direction: column;
  382. align-items: flex-start;
  383. justify-content: center;
  384. .produce-main-text-top {
  385. font-weight: 500;
  386. color: #080F18;
  387. font-size: 28rpx;
  388. }
  389. .produce-main-text-bom {
  390. font-weight: 500;
  391. color: #666666;
  392. font-size: 24rpx;
  393. margin-top: 14rpx;
  394. }
  395. }
  396. }
  397. }
  398. .spinning {
  399. padding-top: 64rpx;
  400. width: 100%;
  401. height: 790rpx;
  402. background-repeat: no-repeat;
  403. background-size: cover;
  404. .spinning-title {
  405. margin-bottom: 40rpx;
  406. display: flex;
  407. align-items: center;
  408. justify-content: center;
  409. font-weight: bold;
  410. color: #FFFFFF;
  411. font-size: 64rpx;
  412. }
  413. }
  414. </style>