details.bak.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <!-- -->
  2. <template>
  3. <view class="details">
  4. <view class="details_title">
  5. <view class="details_nav"></view>
  6. <view class="details-title_head flex">
  7. <view class="details_title_return" @click="returnTop">
  8. <image src="/static/image/publice/fanhui@2x.png" mode=""></image>
  9. </view>
  10. <view class="details_title_name">{{ boxDetail.box_name }}</view>
  11. <view class="details_title_mp3" @click="changePlay">
  12. <image :src="isPlay ? 'https://www.chaomangdao.com/image/home/bofang@2x.png' : 'https://www.chaomangdao.com/image/home/guanbiyinyue@2x.png'" mode=""></image>
  13. </view>
  14. </view>
  15. </view>
  16. <!--S 头部 -->
  17. <view class="details_head">
  18. <view class="details_head_title flex">
  19. <view class="details_head_price flexs">
  20. <view class="details_head_gold">我的余额:{{ boxDetail.mycoin }}金币</view>
  21. <view class="details_head_btn center" @click="recharge">充值</view>
  22. </view>
  23. <view class="details_head_rule flexs" @click="$refs.regulation.open()">
  24. <text>玩法规则</text>
  25. <image src="https://www.chaomangdao.com/image/home/wenhao@2x.png" mode=""></image>
  26. </view>
  27. <view class="details_head_shop center">
  28. <swiper autoplay circular class="swiper">
  29. <swiper-item v-for="(item,index) in boxDetail.box_banner" :key="index">
  30. <image :src="item.image" mode="aspectFill" @click="lookImg(item.image)"></image>
  31. <text>{{ item.desc }}</text>
  32. </swiper-item>
  33. </swiper>
  34. <!-- <image src="/static/image/home/erji@2x.png" mode=""></image> -->
  35. </view>
  36. </view>
  37. </view>
  38. <!--E 头部 -->
  39. <!--S 商品列表 -->
  40. <view class="details_shop">
  41. <view class="details_shop_head flex">
  42. <view class="details_shop_head_l">可出商品列表</view>
  43. <!-- <view class="details_shop_head_go flexs" @click="goMore">
  44. <text>更多</text>
  45. <image src="/static/image/publice/jinruer@2x.png" mode=""></image>
  46. </view> -->
  47. </view>
  48. <view class="details_shop_ul flexs">
  49. <view class="details_shop_li" v-for="(item,index) in boxDetail.goodslist" :key="index">
  50. <view class="shopList_li_tag center" :class="{orange:item.tag == '稀有',red:item.tag == '至尊'}">{{ item.tag }}</view>
  51. <view class="details_shop_li_img center">
  52. <image :src="item.image" mode="aspectFill" @click="lookImg(item.image)"></image>
  53. <view class="details_shop_li_price ">
  54. <text>¥</text>
  55. <text>{{ item.price }}</text>
  56. </view>
  57. </view>
  58. <view class="details_shop_li_name">{{ item.goods_name }}</view>
  59. </view>
  60. </view>
  61. </view>
  62. <!--E 商品列表 -->
  63. <!--S 开箱记录 -->
  64. <!--view class="details_record">
  65. <view class="details_record_head">开箱记录</view>
  66. <view class="details_record_ul">
  67. <view class="details_record_li flexs" v-for="(item,index) in boxDetail.record" :key="index">
  68. <view class="details_record_li_img">
  69. <image :src="item.goods_image" mode="aspectFill"></image>
  70. </view>
  71. <view class="details_record_li_mian">
  72. <view class="details_record_li_head flexs">
  73. <image :src="item.avatar" mode="aspectFill"></image>
  74. <view class="details_record_li_main_txt">
  75. <text>{{ item.nickname }}</text><text class="gary">开出</text><text>{{ item.goods_name }}</text>
  76. </view>
  77. </view>
  78. <view class="details_record_li_jia flexs">
  79. <view class="details_record_li_jia_txt">价值:</view>
  80. <view class="details_record_li_jia_price">
  81. <text>¥</text>
  82. <text>{{ item.goods_rmb_price }}</text>
  83. </view>
  84. </view>
  85. <view class="details_record_li_time">开盒时间:{{ item.create_time }}</view>
  86. </view>
  87. </view>
  88. </view>
  89. </view-->
  90. <!--E 开箱记录 -->
  91. <!-- S 底部 -->
  92. <view class="details_footer flex" :style="{'justify-content':type == 1 ? 'center' : ''}">
  93. <view class="details_footer_coll" @click="changeStar" v-if="type == 0">
  94. <image :src=" boxDetail.is_star == 1 ? 'https://www.chaomangdao.com/image/home/shoucangyixuanzhong@2x.png' : 'https://www.chaomangdao.com/image/home/shoucangweixuanzhong@2x.png' " mode=""></image>
  95. </view>
  96. <view class="details_footer_ul center">
  97. <view class="details_footer_li center" v-for="(item,index) in 2" :key="index" @click="changeDraw(index)">{{ index == 0 ? (type == 1 ? '试玩一发入魂' : boxDetail.coin_price + '金币一发入魂') :( type == 1 ? '试玩五连绝世' : Number(boxDetail.coin_price) * 5 + '金币五连绝世') }}</view>
  98. </view>
  99. </view>
  100. <!--E 底部 -->
  101. <!--S 玩法规则 -->
  102. <uni-popup ref="regulation" :mask-click="false">
  103. <view class="regulation">
  104. <view class="regulation_close" @click="$refs.regulation.close()">
  105. <image src="https://www.chaomangdao.com/image/home/guanbi@2x.png" mode=""></image>
  106. </view>
  107. <view class="regulation_name">玩法规则</view>
  108. <view class="regulation_main">
  109. <scroll-view scroll-y="true" class="scroll-view">
  110. <u-parse :content="message" ></u-parse>
  111. </scroll-view>
  112. </view>
  113. </view>
  114. </uni-popup>
  115. <!--E 玩法规则 -->
  116. </view>
  117. </template>
  118. <script>
  119. const innerAudioContext = uni.createInnerAudioContext();
  120. innerAudioContext.autoplay = true;
  121. innerAudioContext.loop = true;
  122. innerAudioContext.src = 'https://www.chaomangdao.com/image/home/bj.mp3';
  123. export default {
  124. data() {
  125. return {
  126. type:null,//1试玩0详情
  127. box_id:'',//盲盒ID
  128. message:'',//玩法规则
  129. boxDetail:{},//盲盒详情
  130. isPlay:true,
  131. };
  132. },
  133. methods:{
  134. lookImg (url) {
  135. uni.previewImage({
  136. urls: [url],
  137. longPressActions: {
  138. itemList: ['发送给朋友', '保存图片', '收藏'],
  139. success: function(data) {
  140. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  141. },
  142. fail: function(err) {
  143. console.log(err.errMsg);
  144. }
  145. }
  146. });
  147. },
  148. changePlay () {
  149. this.isPlay = !this.isPlay
  150. uni.setStorageSync('isPlay',this.isPlay)
  151. this.isPlay ? innerAudioContext.play() : innerAudioContext.pause()
  152. },
  153. //去充值
  154. recharge () {
  155. uni.navigateTo({url:'/pages/me/recharge'})
  156. },
  157. //去抽奖
  158. changeDraw (index) {
  159. innerAudioContext.pause()
  160. uni.navigateTo({url:'/pagesA/pages/camera?type=' + this.type + '&index=' + index + '&id=' + (this.type== 1 ? this.boxDetail.box_id : this.box_id) + '&name=' + this.boxDetail.box_name})
  161. },
  162. //是否点赞
  163. changeStar () {
  164. if (this.type == 1) return uni.showToast({title:'试玩商品不可操作',icon:'none'})
  165. this.$api.star({box_id:this.box_id}).then(res=>{
  166. if (res.code === 1) {
  167. res.data.is_star == 1 ? this.boxDetail.is_star = 1 : this.boxDetail.is_star = 0
  168. uni.showToast({title:res.msg})
  169. }
  170. })
  171. },
  172. //去更多商品
  173. goMore () {
  174. uni.navigateTo({url:'/pages/index/shopList?id=' + this.box_id + '&type=' + this.type})
  175. },
  176. returnTop () {
  177. uni.navigateBack()
  178. },
  179. //获取详情
  180. getDetails () {
  181. this.$api[this.type == 1 ? 'tryBoxDetail' : 'boxDetail' ]({box_id:this.box_id}).then(res=>{
  182. if (res.code === 1) {
  183. this.boxDetail = res.data
  184. }
  185. })
  186. },
  187. //玩法规则
  188. getMessage () {
  189. this.$api.agreement({name:'play_rule'}).then(res=>{
  190. if (res.code === 1) {
  191. this.message = res.data.content
  192. }
  193. })
  194. }
  195. },
  196. onUnload() {
  197. innerAudioContext.pause()
  198. },
  199. onLoad({id,type}) {
  200. this.type = type
  201. this.box_id = id
  202. this.getDetails()
  203. this.getMessage()
  204. },
  205. onShow() {
  206. this.isPlay = uni.getStorageSync('isPlay')
  207. this.isPlay ? innerAudioContext.play() : innerAudioContext.pause()
  208. },
  209. }
  210. </script>
  211. <style lang="scss">
  212. .scroll-view {
  213. height: 735rpx;
  214. }
  215. .details {
  216. padding-bottom: 98rpx;
  217. }
  218. .details_title {
  219. width: 100%;
  220. position: sticky;
  221. top: 0;
  222. z-index: 2021;
  223. .details_nav {width: 100%;}
  224. .details-title_head {
  225. width: 100%;
  226. height: 88rpx;
  227. padding: 0 30rpx;
  228. background: #FFFFFF;
  229. .details_title_return {
  230. width: 44rpx;
  231. height: 44rpx;
  232. }
  233. .details_title_name {
  234. width: 466rpx;
  235. text-align: center;
  236. overflow: hidden;
  237. text-overflow:ellipsis;
  238. white-space: nowrap;
  239. font-size: 36rpx;
  240. font-weight: bold;
  241. }
  242. .details_title_mp3 {
  243. width: 44rpx;
  244. height: 44rpx;
  245. }
  246. }
  247. }
  248. .details_head {
  249. height: 657rpx;
  250. position: relative;
  251. background: url(https://www.chaomangdao.com/image/home/beijing@2x.png) no-repeat;
  252. background-size: cover;
  253. .details_head_title {
  254. padding: 30rpx;
  255. .details_head_gold {
  256. color: #FFFFFF;
  257. font-size: 30rpx;
  258. font-weight: bold;
  259. }
  260. .details_head_btn {
  261. width: 120rpx;
  262. height: 50rpx;
  263. color: #FFFFFF;
  264. font-size: 28rpx;
  265. background: linear-gradient(0deg, #F6AF32 0%, #F7751F 100%);
  266. border-radius: 25rpx;
  267. margin-left: 30rpx;
  268. }
  269. .details_head_rule {
  270. image {
  271. width: 24rpx;
  272. height: 24rpx;
  273. margin-left: 10rpx;
  274. }
  275. text {
  276. color: #FFFFFF;
  277. font-size: 26rpx;
  278. }
  279. }
  280. .details_head_shop {
  281. display: flex;
  282. top: 272rpx;
  283. left: 50%;
  284. width: 100%;
  285. transform: translateX(-50%);
  286. position: absolute;
  287. flex-direction: column;
  288. .swiper {
  289. width: 200rpx;
  290. height: 270rpx;
  291. swiper-item {
  292. display: flex;
  293. align-items: center;
  294. justify-content: space-between;
  295. flex-direction: column;
  296. }
  297. }
  298. image {
  299. width: 120rpx;
  300. height: 163rpx;
  301. }
  302. text {
  303. color: #FFFFFF;
  304. font-size: 28rpx;
  305. // margin-top: 107rpx;
  306. }
  307. }
  308. }
  309. }
  310. .details_shop {
  311. position: relative;
  312. border-radius: 30rpx 30rpx 0rpx 0rpx;
  313. padding: 0 30rpx;
  314. margin-top: -30rpx;
  315. background: #FFFFFF;
  316. .details_shop_head {
  317. padding: 30rpx 0;
  318. .details_shop_head_l {
  319. font-size: 30rpx;
  320. font-weight: bold;
  321. }
  322. .details_shop_head_go {
  323. image {
  324. width: 22rpx;
  325. height: 22rpx;
  326. margin-left: 10rpx;
  327. }
  328. text {
  329. color: #999999;
  330. }
  331. }
  332. }
  333. .details_shop_ul {
  334. flex-wrap: wrap;
  335. .details_shop_li {
  336. position: relative;
  337. margin-right: 30rpx;
  338. margin-bottom: 30rpx;
  339. .shopList_li_tag {
  340. top: 0;
  341. left: 0;
  342. color: #FFFFFF;
  343. font-size: 22rpx;
  344. width: 80rpx;
  345. height: 36rpx;
  346. z-index: 20;
  347. position: absolute;
  348. background:rgba(0, 0, 0, 0.5);
  349. border-radius: 10rpx 0rpx 20rpx 0rpx;
  350. }
  351. .orange {
  352. background: #FA7E48;
  353. }
  354. .red {
  355. background: #FF413F;
  356. }
  357. &:nth-child(3n) {
  358. margin-right: 0;
  359. }
  360. .details_shop_li_name {
  361. width: 210rpx;
  362. height: 68rpx;
  363. display: -webkit-box;
  364. -webkit-box-orient: vertical;
  365. -webkit-line-clamp: 2;
  366. overflow: hidden;
  367. font-size: 26rpx;
  368. }
  369. .details_shop_li_img{
  370. width: 210rpx;
  371. height: 204rpx;
  372. flex-direction: column;
  373. margin-bottom: 20rpx;
  374. background: #FEF9E5;
  375. border-radius: 10rpx;
  376. }
  377. image {
  378. width: 135rpx;
  379. height: 135rpx;
  380. margin-bottom: 10rpx;
  381. }
  382. .details_shop_li_price {
  383. display: flex;
  384. justify-content: center;
  385. text {
  386. color: #CF271B;
  387. &:last-child {
  388. font-size: 28rpx;
  389. }
  390. }
  391. }
  392. }
  393. }
  394. }
  395. .details_record {
  396. padding: 0 30rpx;
  397. .details_record_head {
  398. padding: 30rpx 0;
  399. font-size: 30rpx;
  400. font-weight: bold;
  401. }
  402. .details_record_li {
  403. padding: 30rpx;
  404. margin-bottom: 10rpx;
  405. background: #FFFFFF;
  406. border-radius: 20rpx;
  407. .details_record_li_img {
  408. image {
  409. width: 168rpx;
  410. height: 168rpx;
  411. border-radius: 10rpx;
  412. }
  413. margin-right: 20rpx;
  414. }
  415. }
  416. .details_record_li_head {
  417. image {
  418. width: 68rpx;
  419. height: 68rpx;
  420. flex-shrink: 0;
  421. margin-right: 20rpx;
  422. border-radius: 34rpx;
  423. }
  424. .details_record_li_main_txt {
  425. text {
  426. color: #10ADEE;
  427. font-size: 26rpx;
  428. }
  429. .gary {
  430. margin: 0 10rpx;
  431. color: #333333;
  432. }
  433. }
  434. }
  435. .details_record_li_jia {
  436. margin: 20rpx 0 10rpx 0;
  437. }
  438. .details_record_li_jia_txt {
  439. font-size: 24rpx;
  440. margin-right: 14rpx;
  441. }
  442. .details_record_li_jia_price {
  443. display: flex;
  444. align-items: flex-end;
  445. text {
  446. color: #CF271B;
  447. &:last-child {
  448. font-size: 30rpx;
  449. }
  450. }
  451. }
  452. .details_record_li_time {
  453. color: #999999;
  454. }
  455. }
  456. .details_footer {
  457. width: 100%;
  458. height: 98rpx;
  459. position: fixed;
  460. bottom: 0;
  461. left: 0;
  462. z-index: 2021;
  463. padding: 0 26rpx 0 46rpx;
  464. background: #FFFFFF;
  465. .details_footer_coll {
  466. width: 54rpx;
  467. height: 54rpx;
  468. }
  469. .details_footer_li {
  470. width: 284rpx;
  471. height: 78rpx;
  472. margin-left: 15rpx;
  473. color: #FFFFFF;
  474. font-size: 26rpx;
  475. margin-left: 15rpx;
  476. padding-bottom: 10rpx;
  477. background: url(https://www.chaomangdao.com/image/home/yifaruhun@2x.png) no-repeat;
  478. background-size: cover;
  479. &:last-child {
  480. background: url(https://www.chaomangdao.com/image/home/wulianjueshi@2x.png) no-repeat;
  481. background-size: cover;
  482. }
  483. }
  484. }
  485. .regulation {
  486. width: 650rpx;
  487. height: 900rpx;
  488. padding: 0 0 0 30rpx;
  489. background: #FFFFFF;
  490. border-radius: 20rpx;
  491. position: relative;
  492. .regulation_close {
  493. position: absolute;
  494. width: 44rpx;
  495. height: 44rpx;
  496. top: 30rpx;
  497. right: 30rpx;
  498. }
  499. .regulation_name {
  500. padding: 40rpx 0;
  501. text-align: center;
  502. font-size: 30rpx;
  503. font-weight: bold;
  504. }
  505. }
  506. </style>