show-result.bak.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <uni-popup ref="prize" mode="top" :mask-click="false">
  3. <view v-show="!openLoading" class="prize ">
  4. <view class="prize_box">
  5. <view class="bj"></view>
  6. <view class="prize_close" @click="$refs.prize.close()"><image src="https://www.chaomangdao.com/image/home/guanbi@2x.png" mode=""></image></view>
  7. <view class="prize-top" :class="'prize-top-' + mode"><image src="https://www.chaomangdao.com/image/result/gaizi@2x.png" mode="aspectFit"></image></view>
  8. <!-- 1开 -->
  9. <view :class="['prize_shop', 'center', 'onebox', 'tag-' + tag, scale && 'prize_shop_scale']" v-if="mode == 0">
  10. <view class="left-top-tag">
  11. <image class="tag-img" :src="tagImg" mode="aspectFit"></image>
  12. <text class="tag-text">{{ tagText }}</text>
  13. </view>
  14. <image class="one" v-if="prizedata && prizedata.prizeInfo" :src="prizedata.prizeInfo[0].image" mode="widthFix"></image>
  15. <text class="colorblack" v-if="prizedata && prizedata.prizeInfo">{{ prizedata.prizeInfo[0].goods_name }}</text>
  16. </view>
  17. <!-- 5开or10开 -->
  18. <view class="prize_ul" :class="'prize_ul-' + mode" v-else>
  19. <!-- <scroll-view scroll-x="true" class="scroll-view"> -->
  20. <view :class="['prize_ul_li', 'twobox', 'flex', 'tag-' + tagFun(item)]" v-for="(item, index) in prizedata.prizeInfo" :key="index">
  21. <view class="left-top-tag">
  22. <image class="tag-img" :src="tagImgFun(item)" mode="aspectFit"></image>
  23. <text class="tag-text">{{ tagTextFun(item) }}</text>
  24. </view>
  25. <image class="two" :src="item.image" mode="widthFix"></image>
  26. <text class="a">{{ item.goods_name }}</text>
  27. </view>
  28. <!-- </scroll-view> -->
  29. </view>
  30. <view class="prize_footer" :class="'prize_footer-' + mode" v-if="type == 0">
  31. <!-- 立即收下 -->
  32. <view class="btn btn-1" @click="$emit('accept')"></view>
  33. <!-- 一键回收 -->
  34. <view class="btn btn-0" @click="$emit('recycle', prizedata)"></view>
  35. </view>
  36. <view class="shiwan center" v-else>试玩结果仅供展示哦~</view>
  37. </view>
  38. </view>
  39. <view v-show="openLoading" class="loading-mask"><image class="loading-gif" src="https://www.chaomangdao.com/image/result/kh.gif" mode="aspectFit"></image></view>
  40. </uni-popup>
  41. </template>
  42. <script>
  43. export default {
  44. name: 'show-result',
  45. props: {
  46. //数量
  47. num: Number,
  48. /**
  49. * 类型 0:正式开盒 1:试玩
  50. */
  51. type: {
  52. type: Number,
  53. default: 0
  54. }
  55. },
  56. data() {
  57. return {
  58. //奖品列表
  59. prizedata: [],
  60. //特效
  61. scale: false,
  62. //开盒动画
  63. openLoading: true
  64. };
  65. },
  66. computed: {
  67. //开盒模式 0:1抽 1:5抽 2:9抽
  68. mode() {
  69. switch (this.num) {
  70. case 5:
  71. return 1;
  72. case 9:
  73. return 2;
  74. }
  75. return 0;
  76. },
  77. //当前单抽商品
  78. currPrizedata() {
  79. if (!this.prizedata) {
  80. return null;
  81. }
  82. if (!this.prizedata.prizeInfo || this.prizedata.length < 1) {
  83. return null;
  84. }
  85. return this.prizedata.prizeInfo[0];
  86. },
  87. //单抽商品品质
  88. tag() {
  89. return this.tagFun(this.currPrizedata);
  90. },
  91. //单抽品质文本
  92. tagText() {
  93. return this.tagTextFun(this.currPrizedata);
  94. },
  95. //单抽品质角标
  96. tagImg() {
  97. return this.tagImgFun(this.currPrizedata);
  98. }
  99. },
  100. methods: {
  101. open(prizedata) {
  102. //打开结果
  103. this.$refs.prize.open();
  104. //加载动画
  105. this.openLoading = true;
  106. this.prizedata = prizedata;
  107. setTimeout(() => {
  108. //关闭加载
  109. this.openLoading = false;
  110. //品质不等于普通
  111. if (this.tag != 'normal') {
  112. //开启震动
  113. try {
  114. uni.vibrate({
  115. success: function() {
  116. console.log('震动');
  117. }
  118. });
  119. } catch (e) {
  120. console.log(e);
  121. }
  122. //开启效果
  123. this.scale = true;
  124. setTimeout(() => {
  125. this.scale = false;
  126. }, 1000);
  127. }
  128. }, 3000);
  129. },
  130. //关闭
  131. close() {
  132. this.$refs.prize.close();
  133. },
  134. //商品品质
  135. tagFun(prizeInfo) {
  136. if (!prizeInfo) return null;
  137. return prizeInfo.tag;
  138. },
  139. //品质文本
  140. tagTextFun(prizeInfo) {
  141. if (!prizeInfo) return null;
  142. if (prizeInfo.tag == 'normal') {
  143. return '普通';
  144. }
  145. if (prizeInfo.tag == 'rare') {
  146. return '稀有';
  147. }
  148. if (prizeInfo.tag == 'supreme') {
  149. return '史诗';
  150. }
  151. if (prizeInfo.tag == 'legend') {
  152. return '传说';
  153. }
  154. },
  155. //品质角标
  156. tagImgFun(prizeInfo) {
  157. if (!prizeInfo) return null;
  158. if (prizeInfo.tag == 'normal') {
  159. return '/h5/pagesA/static/tag-1.png';
  160. }
  161. if (prizeInfo.tag == 'rare') {
  162. return '/h5/pagesA/static/tag-2.png';
  163. }
  164. if (prizeInfo.tag == 'supreme') {
  165. return '/h5/pagesA/static/tag-3.png';
  166. }
  167. if (prizeInfo.tag == 'legend') {
  168. return '/h5/pagesA/static/tag-3.png';
  169. }
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss">
  175. .bj {
  176. // background: url(../static/image/result/guang@2x.png) no-repeat;
  177. width: 100%;
  178. margin-top: 0rpx;
  179. height: 1000rpx;
  180. position: relative;
  181. flex-direction: column;
  182. background-size: 100% 100%;
  183. background-position: top;
  184. background-repeat: no-repeat;
  185. animation: donut-spin 2.2s linear infinite;
  186. }
  187. .onebox {
  188. height: 372rpx;
  189. width: 352rpx;
  190. border-radius: 26rpx;
  191. background-color: #fff;
  192. }
  193. .twobox {
  194. height: 186rpx;
  195. width: 176rpx;
  196. border-radius: 13rpx;
  197. background-color: #fff;
  198. }
  199. .prize {
  200. width: 750rpx;
  201. height: 100vh;
  202. display: flex;
  203. justify-content: center;
  204. .prize_box {
  205. width: 100%;
  206. margin-top: 00rpx;
  207. height: 1120rpx;
  208. position: relative;
  209. flex-direction: column;
  210. background: url(https://www.chaomangdao.com/image/bj.jpg);
  211. background-size: 100% 100%;
  212. background-position: top;
  213. background-repeat: no-repeat;
  214. .prize_close {
  215. width: 64rpx;
  216. height: 64rpx;
  217. top: 64rpx;
  218. right: 30rpx;
  219. position: absolute;
  220. }
  221. .prize-top {
  222. width: 528rpx;
  223. height: 170rpx;
  224. position: absolute;
  225. top: 120rpx;
  226. left: 118rpx;
  227. &-2 {
  228. top: 40rpx;
  229. }
  230. }
  231. .prize_footer {
  232. width: 100%;
  233. height: 472rpx;
  234. background-image: url(https://www.chaomangdao.com/image/btns@2x.png);
  235. background-position: center;
  236. background-repeat: no-repeat;
  237. background-size: 100% 100%;
  238. position: absolute;
  239. left: 0;
  240. bottom: -34rpx;
  241. &-2 {
  242. bottom: -114rpx;
  243. }
  244. .btn {
  245. width: 310rpx;
  246. height: 84rpx;
  247. border-radius: 16rpx;
  248. position: absolute;
  249. left: 220rpx;
  250. }
  251. .btn-1 {
  252. top: 210rpx;
  253. }
  254. .btn-0 {
  255. top: 316rpx;
  256. }
  257. }
  258. }
  259. .shiwan {
  260. background: url(https://www.chaomangdao.com/image/tanchuangbeijing@2x.png) no-repeat;
  261. background-size: cover;
  262. }
  263. .prize_ul {
  264. width: 566rpx;
  265. // padding: 0 92rpx;
  266. display: flex;
  267. flex-wrap: wrap;
  268. justify-content: space-between;
  269. position: absolute;
  270. top: 336rpx;
  271. left: 92rpx;
  272. &-2 {
  273. top: 226rpx;
  274. }
  275. &::after {
  276. content: '';
  277. width: 176rpx;
  278. }
  279. }
  280. // .scroll-view {
  281. // width: 522rpx;
  282. // white-space:nowrap;
  283. .prize_ul_li {
  284. margin-bottom: 16rpx;
  285. position: relative;
  286. width: 176rpx;
  287. height: 186rpx;
  288. display: flex;
  289. flex-direction: column;
  290. align-items: center;
  291. justify-content: center;
  292. display: flex;
  293. padding: 8rpx 0;
  294. // margin-right: 20rpx;
  295. box-sizing: border-box;
  296. image {
  297. margin: 0 auto;
  298. }
  299. text {
  300. font-size: 24rpx;
  301. // font-family: PingFangSC-Medium, PingFang SC;
  302. font-weight: 500;
  303. color: #171a20;
  304. width: 146rpx;
  305. overflow: hidden;
  306. white-space: nowrap;
  307. text-overflow: ellipsis;
  308. }
  309. .left-top-tag {
  310. width: 3rem;
  311. height: 3rem;
  312. .tag-text {
  313. font-size: 0.6rem !important;
  314. }
  315. }
  316. }
  317. // }
  318. .prize_shop {
  319. transition: 1s;
  320. position: absolute;
  321. top: 336rpx;
  322. left: 198rpx;
  323. display: flex;
  324. flex-direction: column;
  325. image {
  326. width: 174rpx;
  327. height: 235rpx;
  328. margin-bottom: 20rpx;
  329. }
  330. text {
  331. width: 70%;
  332. font-size: 16rpx;
  333. font-family: PingFangSC-Medium, PingFang SC;
  334. font-weight: 500;
  335. color: #171a20;
  336. overflow: hidden;
  337. white-space: nowrap;
  338. text-overflow: ellipsis;
  339. text-align: center;
  340. }
  341. .colorblack {
  342. font-size: 32rpx !important;
  343. font-family: PingFangSC-Medium, PingFang SC;
  344. font-weight: 500;
  345. color: #171a20;
  346. }
  347. .left-top-tag {
  348. width: 5rem;
  349. height: 5rem;
  350. .tag-text {
  351. font-size: 1rem;
  352. }
  353. }
  354. }
  355. .tag-normal {
  356. box-shadow: 0 0 40rpx 18rpx #9d85ff;
  357. }
  358. .tag-rare {
  359. box-shadow: 0 0 40rpx 18rpx #47a8ff;
  360. }
  361. .tag-supreme {
  362. box-shadow: 0 0 40rpx 32rpx #feb337;
  363. }
  364. .tag-legend {
  365. box-shadow: 0 0 40rpx 32rpx #fe615e;
  366. }
  367. .shiwan {
  368. width: 399rpx;
  369. height: 48rpx;
  370. color: #ffffff;
  371. font-size: 30rpx;
  372. margin-top: 40rpx;
  373. background: #000000;
  374. border-radius: 27rpx 27rpx 27rpx 27rpx;
  375. }
  376. }
  377. .left-top-tag {
  378. z-index: 999999;
  379. position: absolute;
  380. left: -2px;
  381. top: -3px;
  382. .tag-img {
  383. height: 100% !important;
  384. width: 100% !important;
  385. }
  386. .tag-text {
  387. position: absolute;
  388. top: 30%;
  389. left: 30%;
  390. color: #fff !important;
  391. width: auto !important;
  392. transform: translateX(-50%) translateY(-50%) rotate(-45deg);
  393. }
  394. }
  395. .prize_shop_scale {
  396. transform: scale(1.3);
  397. }
  398. .loading-mask {
  399. position: fixed;
  400. height: 100vh;
  401. width: 100vw;
  402. bottom: 0;
  403. left: 0;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. background-color: #76767652;
  408. .loading-gif {
  409. width: 60%;
  410. }
  411. }
  412. //音乐背景旋转
  413. @keyframes donut-spin {
  414. 0% {
  415. transform: rotate(0deg);
  416. }
  417. 100% {
  418. transform: rotate(360deg);
  419. }
  420. }
  421. </style>