camera.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  1. <template>
  2. <view class="camera">
  3. <!-- <audio id="audio" src="/h5/pagesA/static/bj1.mp3" loop></audio> -->
  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"><image src="https://www.chaomangdao.com/image/publice/fanhui@2x.png" mode=""></image></view>
  8. <view class="details_title_name">{{ name }}</view>
  9. <view class="details_title_mp3" @click="changePlay">
  10. <image :src="isPlay ? 'https://www.chaomangdao.com/image/home/bofang@2x.png' : 'https://www.chaomangdao.com/image/home/guanbiyinyue@2x.png'" mode=""></image>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="camera_main">
  15. <!-- <view class="camera_main_head flex">
  16. <view class="details_head_price flexs">
  17. <view class="details_head_gold">我的余额:{{ info.coin }}金币</view>
  18. <view class="details_head_btn center" @click="recharge">充值</view>
  19. </view>
  20. <view class="details_head_rule flexs" @click="$refs.regulation.open()">
  21. <text>玩法规则</text>
  22. <image src="/static/image/home/wenhao@2x.png" mode=""></image>
  23. </view>
  24. </view> -->
  25. <view class="camera_main_box">
  26. <view class="camera_main_box_name">{{ name }}</view>
  27. <view class="camera_main_box_ul flexs">
  28. <view class="camera_main_box_li center" @click="changeBox(item, index)" v-for="(item, index) in 9" :key="index">
  29. <!-- <image src="/pagesA/static/hezi@2x.png" mode="aspectFill"></image> -->
  30. <image :src="getIcon(item, index)" mode="aspectFill"></image>
  31. </view>
  32. </view>
  33. <!-- <view class="camera_footer_li center" @click="unpack(index)" v-for="(item,index) in 2" :key="index">
  34. {{ index == 0 ? ( i == 0 ? '随机一个' : '随机五个') : '开箱' }}
  35. </view> -->
  36. <view class="mybtn">
  37. <image :src="getNumBtn()" @click="unpack(0)"></image>
  38. <image src="../static/openx.png" @click="unpack(1)"></image>
  39. </view>
  40. </view>
  41. <view class="camera_footer">
  42. <view class="xz">开盲盒细则</view>
  43. <!-- <view class="sj">【随机一个】</view> -->
  44. <view class="nr" v-html="notice_to_buyers"></view>
  45. <!-- <view class="sj">【开箱】</view>
  46. <view class="nr" v-html="notice_to_buyers"> -->
  47. <!-- </view> -->
  48. </view>
  49. </view>
  50. <uni-popup ref="popup" type="bottom" :mask-click="false">
  51. <view class="pay">
  52. <view class="pay_close" @click="$refs.popup.close()"><image src="https://www.chaomangdao.com/image/home/guanbi@2x.png" mode=""></image></view>
  53. <view class="pay_head">支付</view>
  54. <view class="pay_shop flexs">
  55. <view class="pay_shop_img">
  56. <view class="pay_shop_img_top">
  57. <view class="pay_shop_img_left"><image :src="boxMessage.image" mode="aspectFill"></image></view>
  58. <view class="pay_shop_img_right"><image :src="item" mode="aspectFill" v-for="(item, index) in boxMessage.right" :key="index"></image></view>
  59. </view>
  60. <view class="pay_shop_img_bot"><image :src="item" mode="aspectFill" v-for="(item, index) in boxMessage.bot" :key="index"></image></view>
  61. </view>
  62. <view class="pay_shop_main">
  63. <view class="pay_shop_name">{{ boxMessage.box_name }}</view>
  64. <view class="pay_shop_price flex">
  65. <view class="pay_shop_price_l">{{ boxMessage.coin_amount }}金币</view>
  66. <view class="pay_shop_price_btn center" v-if="boxMessage.coin_not_enough">金额不足</view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="pay_attention">{{ boxMessage.notice }}</view>
  71. <view class="pay_contant flexs">
  72. <image
  73. @click="isConsent = !isConsent"
  74. :src="isConsent ? '/static/image/publice/xuanzhong1@2x.png' : '/static/image/publice/weixuanzhong1@2x.png'"
  75. mode=""
  76. ></image>
  77. <text @click="goBuyer">我已阅读并同意《喵喵开盒买家须知》</text>
  78. </view>
  79. <button class="pay_gold" @click="goldPay" v-if="!boxMessage.coin_not_enough" hover-class="hover-view">金币支付</button>
  80. <view class="pay_ul flex" v-else>
  81. <button class="pay_ul_btn" @click="recharge()" hover-class="hover-view">立即充值</button>
  82. <!--button class="pay_ul_btn" @click="patternIndex(index)" hover-class="hover-view" v-for="(item,index) in 2" :key="index">{{ index == 0 ? '微信支付'+ boxMessage.rmb_amount +'金币' : '支付宝支付'+ boxMessage.rmb_amount +'金币' }}</button-->
  83. </view>
  84. </view>
  85. </uni-popup>
  86. <!--S 玩法规则 -->
  87. <uni-popup ref="regulation" :mask-click="false">
  88. <view class="regulation">
  89. <view class="regulation_close" @click="$refs.regulation.close()"><image src="https://www.chaomangdao.com/image/home/guanbi@2x.png" mode=""></image></view>
  90. <view class="regulation_name">玩法规则</view>
  91. <view class="regulation_main">
  92. <scroll-view scroll-y="true" class="scroll-view"><u-parse :content="message"></u-parse></scroll-view>
  93. </view>
  94. </view>
  95. </uni-popup>
  96. <!--E 玩法规则 -->
  97. <!-- S 奖品弹框 -->
  98. <uni-popup ref="prize" :mask-click="false">
  99. <view class="prize ">
  100. <view class="prize_box">
  101. <view class="prize_close" @click="$refs.prize.close()"><image src="../static/guanbi@2x.png" mode=""></image></view>
  102. <view class="prize-top" :class="'prize-top-' + i"><image src="../static/gaizi@2x.png" mode="aspectFit"></image></view>
  103. <!-- 1开 -->
  104. <view :class="['prize_shop', 'center', 'onebox', 'tag-' + tag, scale && 'prize_shop_scale']" v-if="i == 0">
  105. <view class="left-top-tag">
  106. <image class="tag-img" :src="tagImg" mode="aspectFit"></image>
  107. <text class="tag-text">{{ tagText }}</text>
  108. </view>
  109. <image class="one" v-if="prizedata && prizedata.prizeInfo" :src="prizedata.prizeInfo[0].image" mode="widthFix"></image>
  110. <text class="colorblack" v-if="prizedata && prizedata.prizeInfo">{{ prizedata.prizeInfo[0].goods_name }}</text>
  111. </view>
  112. <!-- 5开or10开 -->
  113. <view class="prize_ul" :class="'prize_ul-' + i" v-else>
  114. <!-- <scroll-view scroll-x="true" class="scroll-view"> -->
  115. <view :class="['prize_ul_li', 'twobox', 'flex', 'tag-' + tagFun(item)]" v-for="(item, index) in prizedata.prizeInfo" :key="index">
  116. <view class="left-top-tag">
  117. <image class="tag-img" :src="tagImgFun(item)" mode="aspectFit"></image>
  118. <text class="tag-text">{{ tagTextFun(item) }}</text>
  119. </view>
  120. <image class="two" :src="item.image" mode="widthFix"></image>
  121. <text class="a">{{ item.goods_name }}</text>
  122. </view>
  123. <!-- </scroll-view> -->
  124. </view>
  125. <view class="prize_footer" :class="'prize_footer-' + mode" v-if="type == 0">
  126. <!-- 立即收下 -->
  127. <view class="btn btn-1" @click="recycle(1)"></view>
  128. <!-- 一键回收 -->
  129. <view class="btn btn-0" @click="recycle(0)"></view>
  130. </view>
  131. <view class="shiwan center" v-else>试玩结果仅供展示哦~</view>
  132. </view>
  133. </view>
  134. </uni-popup>
  135. <!-- E 奖品弹框 -->
  136. <!-- 收回弹框 -->
  137. <uni-popup ref="recycle" :mask-click="false">
  138. <view class="recycle">
  139. <view class="recycle_close" @click="$refs.recycle.close()"><image src="/static/image/publice/guanbi@2x.png" mode=""></image></view>
  140. <view class="recycle_head">提示</view>
  141. <view class="recycle_price center">
  142. <text>¥{{ recycleMessage.amount }}</text>
  143. <text>回收金币</text>
  144. </view>
  145. <view class="recycle_ul">
  146. <view class="recycle_ul_li flex" v-for="(item, index) in recycleMessage.goods_info" :key="index">
  147. <view class="recycle_ul_li_txt">{{ item.name }}</view>
  148. <view class="recycle_ul_li_r flexs">
  149. <text>¥{{ item.price }}</text>
  150. <text>x{{ item.num }}</text>
  151. </view>
  152. </view>
  153. </view>
  154. <view class="recycle_txt">{{ recycleMessage.notice }}</view>
  155. <view class="sure" @click="$refs.recycle.close()">确定</view>
  156. </view>
  157. </uni-popup>
  158. <view v-show="openLoading" class="loading-mask"><image class="loading-gif" src="/h5/pagesA/static/kh.gif" mode="aspectFit"></image></view>
  159. </view>
  160. </template>
  161. <script>
  162. // var jweixin = require('@/js_sdk');
  163. const innerAudioContexts = uni.createInnerAudioContext();
  164. // innerAudioContexts.autoplay = true;
  165. innerAudioContexts.loop = true;
  166. // innerAudioContexts.src = '/static/image/home/bj.mp3';
  167. const innerAudioContext = uni.createInnerAudioContext();
  168. innerAudioContext.obeyMuteSwitch = false;
  169. export default {
  170. data() {
  171. return {
  172. name: '',
  173. box_id: '', //盒子ID
  174. prizeList: [], //奖品列表
  175. indexs: -1, // 当前转动到哪个位置,起点位置
  176. count: 9, // 总共有多少个位置
  177. timer: 0, // 每次转动定时器
  178. speed: 200, // 初始转动速度
  179. times: 0, // 转动次数
  180. cycle: 30, // 转动基本次数:即至少需要转动多少次再进入抽奖环节
  181. prize: -1, // 中奖位置
  182. click: true, //标识是否处于抽奖状态
  183. showToast: false, //显示中奖弹窗
  184. indexList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
  185. type: null, //1试玩0详情
  186. i: '', //一发还是五发
  187. message: '', //玩法规则
  188. boxMessage: {}, //盒子详情
  189. goldFlag: true,
  190. prizedata: {}, //奖品列表
  191. isConsent: false, //是否同意
  192. isHand: false,
  193. info: {}, //个人信息
  194. recovery_rule: '',
  195. recycleMessage: {}, //回收信息
  196. out_trade_no: '', //微信支付宝支付订单号
  197. isPlay: true,
  198. openLoading: false, //打开盒子加载状态
  199. notice_to_buyers: '',
  200. scale: false
  201. };
  202. },
  203. computed: {
  204. //当前单抽商品
  205. currPrizedata() {
  206. if (!this.prizedata) {
  207. return null;
  208. }
  209. if (!this.prizedata.prizeInfo || this.prizedata.length < 1) {
  210. return null;
  211. }
  212. return this.prizedata.prizeInfo[0];
  213. },
  214. //单抽商品品质
  215. tag() {
  216. return this.tagFun(this.currPrizedata);
  217. },
  218. //单抽品质文本
  219. tagText() {
  220. return this.tagTextFun(this.currPrizedata);
  221. },
  222. //单抽品质角标
  223. tagImg() {
  224. return this.tagImgFun(this.currPrizedata);
  225. }
  226. },
  227. mounted() {
  228. let audio = document.getElementById('audio').querySelector('audio');
  229. audio.play();
  230. },
  231. methods: {
  232. getNumBtn() {
  233. if (this.i == 0) {
  234. return '../static/round.png';
  235. } else if (this.i == 1) {
  236. return '../static/round.png';
  237. } else {
  238. return '../static/round.png';
  239. }
  240. },
  241. getIcon(item, index) {
  242. if (this.prizeList.indexOf(index) != -1 || this.indexs == index) {
  243. console.log(1);
  244. return '../static/in.png';
  245. } else {
  246. return '../static/un.png';
  247. }
  248. },
  249. changePlay() {
  250. this.isPlay = !this.isPlay;
  251. uni.setStorageSync('isPlay', this.isPlay);
  252. this.isPlay ? innerAudioContexts.play() : innerAudioContexts.pause();
  253. },
  254. //一键回收
  255. recycle(index) {
  256. let ids = [];
  257. this.prizedata.prizeInfo.forEach(item => {
  258. ids.push(item.prize_id);
  259. });
  260. this.$refs.prize.close();
  261. if (index == 0) {
  262. this.$api.exchange({ record_ids: ids.join(',') }).then(res => {
  263. if (res.code === 1) {
  264. this.recycleMessage = res.data;
  265. this.$refs.recycle.open();
  266. }
  267. });
  268. } else {
  269. //进入发货
  270. // uni.redirectTo({url:'/pages/me/applyFaHuo?id=' + ids.join(',')})
  271. //进入鞋柜
  272. uni.navigateTo({ url: '/pages/me/myBox' });
  273. }
  274. },
  275. //买家须知
  276. goBuyer() {
  277. uni.navigateTo({ url: '/pagesA/pages/buyer' });
  278. },
  279. //金币支付
  280. goldPay() {
  281. if (!this.isConsent) return uni.showToast({ title: '请阅读并勾选买家须知', icon: 'none' });
  282. if (!this.goldFlag) return;
  283. this.goldFlag = false;
  284. this.$api.coinPay({ order_id: this.boxMessage.order_id }).then(res => {
  285. if (res.code === 1) {
  286. this.prizedata = res.data.prize;
  287. this.$refs.popup.close();
  288. if (!this.isHand) {
  289. this.getInfo();
  290. this.startRoll();
  291. //开启动画
  292. this.openLoading = true;
  293. this.playMp3();
  294. } else {
  295. this.openResult();
  296. // this.$refs.prize.open()
  297. }
  298. this.goldFlag = true;
  299. } else {
  300. this.goldFlag = true;
  301. }
  302. });
  303. },
  304. //支付宝微信支付
  305. patternIndex(index) {
  306. if (!this.isConsent) return uni.showToast({ title: '请阅读并勾选买家须知', icon: 'none' });
  307. if (!this.goldFlag) return;
  308. this.goldFlag = false;
  309. let that = this;
  310. this.$http.post(this.boxMessage.wechat).then(res => {
  311. if (res.code === 1) {
  312. WeixinJSBridge.invoke(
  313. 'getBrandWCPayRequest',
  314. {
  315. appId: res.data.appId, //公众号ID,由商户传入
  316. timeStamp: res.data.timeStamp, //时间戳,自1970年以来的秒数
  317. nonceStr: res.data.nonceStr, //随机串
  318. package: res.data.package,
  319. signType: res.data.signType, //微信签名方式:
  320. paySign: res.data.paySign //微信签名
  321. },
  322. function(res) {
  323. if (res.err_msg == 'get_brand_wcpay_request:ok') {
  324. that.type = 0;
  325. that.getOpenByOrderTrade(0);
  326. // 使用以上方式判断前端返回,微信团队郑重提示:
  327. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  328. }
  329. }
  330. );
  331. } else if (res.code === 403) {
  332. }
  333. });
  334. if (index == 0) {
  335. // this.$api.
  336. } else {
  337. location.href =
  338. this.boxMessage[index == 0 ? 'wechat' : 'alipay'] +
  339. '?type=' +
  340. this.type +
  341. '&index=' +
  342. this.i +
  343. '&id=' +
  344. this.box_id +
  345. '&name=' +
  346. this.name +
  347. '&token=' +
  348. uni.getStorageSync('token');
  349. }
  350. },
  351. //去充值
  352. recharge() {
  353. uni.navigateTo({ url: '/pages/me/recharge' });
  354. },
  355. //播放音频
  356. playMp3() {
  357. innerAudioContext.src = '/pagesA/static/jhr.mp3';
  358. innerAudioContext.loop = true;
  359. innerAudioContext.play();
  360. },
  361. //开奖
  362. unpack(index) {
  363. this.isHand = index == 0 ? false : true;
  364. if (index == 1) {
  365. if (this.i == 0) {
  366. if (this.prizeList.length == 0) return uni.showToast({ title: '请选择一个盒子', icon: 'none' });
  367. } else if (this.i == 1) {
  368. if (this.prizeList.length < 5) return uni.showToast({ title: '请选择五个盒子', icon: 'none' });
  369. } else {
  370. if (this.prizeList.length < 9) return uni.showToast({ title: '请选择九个盒子', icon: 'none' });
  371. }
  372. } else {
  373. this.prizeList = [];
  374. }
  375. this.createOrder(index);
  376. //
  377. },
  378. startRoll() {
  379. this.times += 1; // 转动次数
  380. this.oneRoll(); // 转动过程调用的每一次转动方法,这里是第一次调用初始化
  381. // 如果当前转动次数达到要求 && 目前转到的位置是中奖位置
  382. if (this.times > this.cycle + 10 && this.prize === this.indexs) {
  383. clearTimeout(this.timer); // 清除转动定时器,停止转动
  384. this.openResult();
  385. // this.$refs.prize.open()
  386. //关闭加载动画
  387. this.openLoading = false;
  388. innerAudioContext.stop();
  389. innerAudioContext.loop = false;
  390. innerAudioContext.src = '/pagesA/static/hjo.mp3';
  391. innerAudioContext.play();
  392. this.prize = -1;
  393. // if (this.isDemo) {
  394. // this.$refs.single_prize.open()
  395. // } else {
  396. // this.num == 1 ? this.setlottery(true,this.$store.state.prizedata.type-1+2) : this.setlottery(true,9)
  397. // }
  398. // this.prizeList.push(this.indexs)
  399. // this.getBoxMessage()
  400. this.indexs = -1;
  401. //
  402. this.times = 0;
  403. this.speed = 46;
  404. this.click = true;
  405. this.pretreasurerunging = false;
  406. var that = this;
  407. setTimeout(res => {
  408. that.showToast = true;
  409. // this.index = -1
  410. }, 500);
  411. } else {
  412. if (this.times < this.cycle) {
  413. this.speed -= 10; // 加快转动速度
  414. } else if (this.times === this.cycle) {
  415. const index = parseInt(Math.random() * 10, 0) || 0; // 随机获得一个中奖位置
  416. // this.prize = this.lotteryList.indexOf(this.prizeMessage.id); //中奖位置,可由后台返回
  417. this.prize = this.indexs;
  418. } else if (this.times > this.cycle + 10 && ((this.prize === 0 && this.indexs === 7) || this.prize === this.indexs + 1)) {
  419. this.speed += 110;
  420. } else {
  421. this.speed += 20;
  422. }
  423. if (this.speed < 40) {
  424. this.speed = 46;
  425. }
  426. this.timer = setTimeout(this.startRoll, 46);
  427. }
  428. },
  429. // 每一次转动
  430. oneRoll() {
  431. let index = this.indexs; // 当前转动到哪个位置
  432. const count = this.count; // 总共有多少个位置
  433. index += 1;
  434. if (index > count - 1) {
  435. index = 0;
  436. }
  437. let num = parseInt(Math.random() * this.indexList.length);
  438. this.indexs = this.indexList[num];
  439. },
  440. //选择奖品
  441. changeBox(item, index) {
  442. var indexs = this.prizeList.indexOf(index);
  443. if (indexs > -1) {
  444. //大于0 代表存在,
  445. this.prizeList.splice(indexs, 1); //存在就删除
  446. } else {
  447. if (this.i == 1) {
  448. if (this.prizeList.length == 5) {
  449. this.prizeList.shift();
  450. }
  451. } else if (this.i == 0) {
  452. if (this.prizeList.length == 1) {
  453. this.prizeList = [];
  454. }
  455. } else {
  456. if (this.prizeList.length == 9) {
  457. this.prizeList.shift();
  458. }
  459. }
  460. this.prizeList.push(index);
  461. }
  462. },
  463. returnTop() {
  464. uni.navigateBack();
  465. },
  466. //玩法规则
  467. getMessage() {
  468. this.$api.agreement({ name: 'play_rule' }).then(res => {
  469. if (res.code === 1) {
  470. this.message = res.data.content;
  471. }
  472. });
  473. this.$api.agreement({ name: 'recovery_rule' }).then(res => {
  474. if (res.code === 1) {
  475. this.recovery_rule = res.data.content;
  476. }
  477. });
  478. this.$api.agreement({ name: 'notice_to_buyers' }).then(res => {
  479. if (res.code === 1) {
  480. this.notice_to_buyers = res.data.content;
  481. }
  482. });
  483. },
  484. //创建订单
  485. createOrder(index) {
  486. var n = 1;
  487. if (this.i == 1) n = 5;
  488. if (this.i == 2) n = 9;
  489. this.$api[this.type == 1 ? 'haveATry' : 'createOrder']({
  490. box_id: this.box_id,
  491. num: n,
  492. msg: this.type == 1 ? '试玩' : '创建订单中',
  493. select: this.prizeList.join(',')
  494. }).then(res => {
  495. if (res.code === 1) {
  496. if (this.type == 1) {
  497. this.prizedata = { prizeInfo: res.data.goodsInfo };
  498. this.$refs.popup.close();
  499. if (!this.isHand) {
  500. this.startRoll();
  501. this.playMp3();
  502. } else {
  503. this.openResult();
  504. // this.$refs.prize.open()
  505. }
  506. } else {
  507. res.data.right = [];
  508. res.data.bot = [];
  509. res.data.image = res.data.images[0];
  510. res.data.images.forEach((item, index) => {
  511. if (index > 0 && index < 3) {
  512. res.data.right.push(item);
  513. }
  514. if (index > 2) {
  515. res.data.bot.push(item);
  516. }
  517. });
  518. this.boxMessage = res.data;
  519. this.$refs.popup.open();
  520. }
  521. }
  522. });
  523. },
  524. //获取个人信息
  525. getInfo() {
  526. this.$api.userinfo().then(res => {
  527. if (res.code === 1) {
  528. this.info = res.data;
  529. }
  530. });
  531. },
  532. getOpenByOrderTrade(type) {
  533. this.$api.openByOrderTrade(type == 0 ? { order_id: this.boxMessage.order_id } : { out_trade_no: this.out_trade_no }).then(res => {
  534. if (res.code === 1) {
  535. this.prizedata = res.data.prize;
  536. this.$refs.popup.close();
  537. this.startRoll();
  538. this.playMp3();
  539. this.goldFlag = true;
  540. }
  541. });
  542. },
  543. //打开结果页面
  544. openResult() {
  545. //品质不等于普通
  546. if (this.tag != 'normal') {
  547. //开启震动
  548. try {
  549. uni.vibrate({
  550. success: function() {
  551. console.log('震动');
  552. }
  553. });
  554. } catch (e) {
  555. console.log(e);
  556. }
  557. //开启效果
  558. this.scale = true;
  559. setTimeout(() => {
  560. this.scale = false;
  561. }, 1000);
  562. }
  563. //打开结果
  564. this.$refs.prize.open();
  565. },
  566. //商品品质
  567. tagFun(prizeInfo) {
  568. if (!prizeInfo) return null;
  569. return prizeInfo.tag;
  570. },
  571. //品质文本
  572. tagTextFun(prizeInfo) {
  573. if (!prizeInfo) return null;
  574. if (prizeInfo.tag == 'normal') {
  575. return '普通';
  576. }
  577. if (prizeInfo.tag == 'rare') {
  578. return '稀有';
  579. }
  580. if (prizeInfo.tag == 'supreme') {
  581. return '史诗';
  582. }
  583. if (prizeInfo.tag == 'legend') {
  584. return '传说';
  585. }
  586. },
  587. //品质角标
  588. tagImgFun(prizeInfo) {
  589. if (!prizeInfo) return null;
  590. if (prizeInfo.tag == 'normal') {
  591. return '/h5/pagesA/static/tag-1.png';
  592. }
  593. if (prizeInfo.tag == 'rare') {
  594. return '/h5/pagesA/static/tag-2.png';
  595. }
  596. if (prizeInfo.tag == 'supreme') {
  597. return '/h5/pagesA/static/tag-3.png';
  598. }
  599. if (prizeInfo.tag == 'legend') {
  600. return '/h5/pagesA/static/tag-4.png';
  601. }
  602. }
  603. },
  604. onUnload() {
  605. innerAudioContexts.pause();
  606. },
  607. onLoad({ type, index, id, name, status, out_trade_no, token }) {
  608. this.isPlay = uni.getStorageSync('isPlay');
  609. this.isPlay ? innerAudioContexts.play() : innerAudioContexts.pause();
  610. if (token) {
  611. uni.setStorageSync('token', token);
  612. }
  613. if (out_trade_no) {
  614. this.out_trade_no = out_trade_no;
  615. }
  616. if (status == 0 || status) {
  617. status == 0 ? uni.showToast({ title: '取消支付', icon: 'none' }) : this.getOpenByOrderTrade(1);
  618. }
  619. this.name = name;
  620. this.box_id = id;
  621. this.i = index;
  622. this.type = type;
  623. this.getMessage();
  624. this.getInfo();
  625. }
  626. };
  627. </script>
  628. <style lang="scss">
  629. page {
  630. min-height: 100%;
  631. background-color: #693bec;
  632. }
  633. .sure {
  634. padding: 10rpx 20rpx;
  635. border-radius: 30rpx;
  636. font-size: 26rpx;
  637. background: -webkit-linear-gradient(0deg, #89f7fe 0%, #66a6ff 100%);
  638. color: #fff;
  639. width: 200rpx;
  640. text-align: center;
  641. margin: 0 auto;
  642. margin-top: 40rpx;
  643. }
  644. .one {
  645. height: 252rpx;
  646. width: 252rpx;
  647. }
  648. .two {
  649. height: 126rpx;
  650. width: 126rpx;
  651. }
  652. .onebox {
  653. height: 372rpx;
  654. width: 352rpx;
  655. border-radius: 26rpx;
  656. background-color: #fff;
  657. }
  658. .twobox {
  659. height: 186rpx;
  660. width: 176rpx;
  661. border-radius: 13rpx;
  662. background-color: #fff;
  663. }
  664. .sj {
  665. font-size: 28rpx;
  666. font-family: PingFangSC-Medium, PingFang SC;
  667. font-weight: 500;
  668. color: #ac3800;
  669. line-height: 40rpx;
  670. padding-left: 36rpx;
  671. }
  672. .nr {
  673. padding: 0 55rpx;
  674. font-size: 24rpx;
  675. font-family: PingFangSC-Regular, PingFang SC;
  676. font-weight: 400;
  677. color: #ac3800;
  678. line-height: 40rpx;
  679. }
  680. .xz {
  681. text-align: center;
  682. height: 48rpx;
  683. font-size: 34rpx !important;
  684. font-family: PingFangSC-Medium, PingFang SC;
  685. font-weight: 500;
  686. color: #ac3800;
  687. line-height: 48rpx;
  688. }
  689. .mybtn {
  690. display: flex;
  691. width: 100%;
  692. justify-content: space-between;
  693. padding: 20rpx 32rpx 36rpx 32rpx;
  694. image {
  695. width: 308rpx;
  696. height: 84rpx;
  697. }
  698. }
  699. .camera_head {
  700. height: 88rpx;
  701. }
  702. .details_title {
  703. width: 100%;
  704. position: sticky;
  705. top: 0;
  706. z-index: 2021;
  707. .details_nav {
  708. width: 100%;
  709. }
  710. .details-title_head {
  711. width: 100%;
  712. height: 88rpx;
  713. padding: 0 30rpx;
  714. background: #ffffff;
  715. .details_title_return {
  716. width: 44rpx;
  717. height: 44rpx;
  718. }
  719. .details_title_name {
  720. width: 466rpx;
  721. text-align: center;
  722. overflow: hidden;
  723. text-overflow: ellipsis;
  724. white-space: nowrap;
  725. font-size: 36rpx;
  726. font-weight: bold;
  727. }
  728. .details_title_mp3 {
  729. width: 44rpx;
  730. height: 44rpx;
  731. }
  732. }
  733. }
  734. .camera_main {
  735. // height: calc(100vh - 88rpx);
  736. height: 793px;
  737. padding-top: 58rpx;
  738. background: url(../static/choubg@2x.png) no-repeat;
  739. background-color: #693bec;
  740. background-size: 100% 100%;
  741. background-position: center;
  742. background-repeat: no-repeat;
  743. .camera_main_head {
  744. padding: 30rpx 30rpx 80rpx 30rpx;
  745. .details_head_gold {
  746. color: #ffffff;
  747. font-size: 30rpx;
  748. font-weight: bold;
  749. }
  750. .details_head_btn {
  751. width: 120rpx;
  752. height: 50rpx;
  753. color: #ffffff;
  754. font-size: 28rpx;
  755. background: linear-gradient(0deg, #f6af32 0%, #f7751f 100%);
  756. border-radius: 25rpx;
  757. margin-left: 30rpx;
  758. }
  759. .details_head_rule {
  760. image {
  761. width: 24rpx;
  762. height: 24rpx;
  763. margin-left: 10rpx;
  764. }
  765. text {
  766. color: #ffffff;
  767. font-size: 26rpx;
  768. }
  769. }
  770. }
  771. .camera_main_box {
  772. width: 680rpx;
  773. height: 1000rpx;
  774. margin: 0 auto;
  775. // background: url(../static/xuanzehezi@2x.png) no-repeat;
  776. background-size: 100% 100%;
  777. .camera_main_box_name {
  778. line-height: 132rpx;
  779. text-align: center;
  780. padding-top: 50rpx;
  781. height: 60rpx;
  782. font-size: 44rpx;
  783. font-family: PingFangSC-Medium, PingFang SC;
  784. font-weight: 500;
  785. color: #edec6f;
  786. }
  787. .camera_main_box_ul {
  788. width: 100%;
  789. padding: 0 118rpx;
  790. margin: 0 auto;
  791. margin-top: 140rpx;
  792. flex-wrap: wrap;
  793. justify-content: space-between;
  794. .camera_main_box_li {
  795. width: 140rpx;
  796. height: 164rpx;
  797. margin-bottom: 42rpx;
  798. &:nth-child(4n) {
  799. margin-right: 0;
  800. }
  801. // background: url(../static/hezibeijing@2x.png) no-repeat;
  802. background-size: cover;
  803. // border-image: linear-gradient(164deg, #FFA800, #FF3904, #FF8A00) 2 2;
  804. border-radius: 8rpx;
  805. image {
  806. width: 100%;
  807. height: 100%;
  808. }
  809. }
  810. .active {
  811. background: url(../static/xuanzhongbeijing@2x.png) no-repeat;
  812. background-size: cover;
  813. }
  814. }
  815. }
  816. }
  817. .camera_footer {
  818. width: 722rpx;
  819. // background: linear-gradient(180deg, #F3E163 0%, #F5E76B 100%);
  820. margin: 0 auto;
  821. background-color: #f4e569;
  822. border: 4rpx solid;
  823. border-top: 0;
  824. border-bottom: 0;
  825. padding: 20rpx;
  826. // border: 4rpx solid #000000;
  827. // margin-top: 190rpx;
  828. .camera_footer_li {
  829. width: 330rpx;
  830. height: 88rpx;
  831. font-size: 30rpx;
  832. font-family: PingFang SC;
  833. font-weight: 500;
  834. color: #ffffff;
  835. text-shadow: 0rpx 2rpx 1rpx #fc985c;
  836. &:first-child {
  837. background: linear-gradient(145deg, #fb986e, #fa7e48);
  838. box-shadow: 0rpx 5rpx 5rpx 0rpx rgba(138, 56, 6, 0.44);
  839. }
  840. &:last-child {
  841. background: linear-gradient(145deg, #ff6666, #ff413f);
  842. box-shadow: 0rpx 5rpx 5rpx 0rpx rgba(138, 56, 6, 0.44);
  843. border-radius: 44rpx;
  844. }
  845. border-radius: 44rpx;
  846. }
  847. }
  848. .pay {
  849. background: #ffffff;
  850. border-radius: 20rpx 20rpx 0rpx 0rpx;
  851. padding: 0 50rpx 32rpx 50rpx;
  852. position: relative;
  853. .pay_close {
  854. top: 30rpx;
  855. right: 30rpx;
  856. width: 44rpx;
  857. height: 44rpx;
  858. position: absolute;
  859. }
  860. .pay_head {
  861. text-align: center;
  862. font-size: 30rpx;
  863. font-weight: bold;
  864. padding: 40rpx 0 50rpx 0;
  865. }
  866. .pay_shop {
  867. margin-bottom: 40rpx;
  868. .pay_shop_main {
  869. display: flex;
  870. flex: 1;
  871. height: 200rpx;
  872. flex-direction: column;
  873. justify-content: space-around;
  874. }
  875. .pay_shop_img {
  876. width: 200rpx;
  877. height: 200rpx;
  878. padding: 12rpx;
  879. .pay_shop_img_top {
  880. display: flex;
  881. margin-bottom: 12rpx;
  882. .pay_shop_img_left {
  883. image {
  884. width: 114rpx;
  885. height: 114rpx;
  886. border-radius: 6rpx;
  887. }
  888. margin-right: 12rpx;
  889. }
  890. .pay_shop_img_right {
  891. image {
  892. width: 51rpx;
  893. height: 51rpx;
  894. &:first-child {
  895. margin-bottom: 12rpx;
  896. }
  897. border-radius: 6rpx;
  898. }
  899. }
  900. }
  901. .pay_shop_img_bot {
  902. display: flex;
  903. justify-content: flex-end;
  904. image {
  905. width: 51rpx;
  906. height: 51rpx;
  907. margin-left: 12rpx;
  908. &:first-child {
  909. margin-left: 0;
  910. }
  911. border-radius: 6rpx;
  912. }
  913. }
  914. margin-right: 30rpx;
  915. }
  916. .pay_shop_name {
  917. font-size: 28rpx;
  918. }
  919. .pay_shop_price_l {
  920. color: #cf271b;
  921. font-size: 30rpx;
  922. }
  923. .pay_shop_price_btn {
  924. width: 183rpx;
  925. height: 50rpx;
  926. color: #fa7e48;
  927. font-size: 30rpx;
  928. font-weight: bold;
  929. background: rgba(246, 175, 50, 0.5);
  930. border-radius: 25rpx;
  931. }
  932. }
  933. .pay_attention {
  934. color: #666666;
  935. }
  936. .pay_contant {
  937. margin: 24rpx 0 59rpx 0;
  938. image {
  939. width: 32rpx;
  940. height: 32rpx;
  941. margin-right: 10rpx;
  942. }
  943. text {
  944. font-size: 26rpx;
  945. }
  946. }
  947. .pay_gold {
  948. height: 78rpx;
  949. font-size: 26rpx;
  950. background: #ff6666;
  951. border-radius: 39rpx;
  952. }
  953. .pay_ul_btn {
  954. width: 310rpx;
  955. height: 78rpx;
  956. font-size: 26rpx;
  957. background: #fa7e48;
  958. border-radius: 39rpx;
  959. &:last-child {
  960. background: #ff6666;
  961. }
  962. }
  963. }
  964. .regulation {
  965. width: 650rpx;
  966. .scroll-view {
  967. height: 735rpx;
  968. }
  969. padding: 0 0 0 30rpx;
  970. background: #ffffff;
  971. border-radius: 20rpx;
  972. position: relative;
  973. .regulation_close {
  974. position: absolute;
  975. width: 44rpx;
  976. height: 44rpx;
  977. top: 30rpx;
  978. right: 30rpx;
  979. }
  980. .regulation_name {
  981. padding: 40rpx 0;
  982. padding-right: 30rpx;
  983. text-align: center;
  984. font-size: 30rpx;
  985. font-weight: bold;
  986. }
  987. }
  988. .prize {
  989. width: 750rpx;
  990. display: flex;
  991. justify-content: center;
  992. .prize_box {
  993. width: 100%;
  994. height: 1120rpx;
  995. position: relative;
  996. flex-direction: column;
  997. background: url(../static/guang@2x.png) no-repeat;
  998. background-size: 100% auto;
  999. background-position: top;
  1000. background-repeat: no-repeat;
  1001. .prize_close {
  1002. width: 64rpx;
  1003. height: 64rpx;
  1004. top: 64rpx;
  1005. right: 30rpx;
  1006. position: absolute;
  1007. }
  1008. .prize-top {
  1009. width: 528rpx;
  1010. height: 170rpx;
  1011. position: absolute;
  1012. top: 120rpx;
  1013. left: 118rpx;
  1014. &-2 {
  1015. top: 40rpx;
  1016. }
  1017. }
  1018. .prize_footer {
  1019. width: 100%;
  1020. height: 472rpx;
  1021. background-image: url(../static/btns@2x.png);
  1022. background-position: center;
  1023. background-repeat: no-repeat;
  1024. background-size: 100% 100%;
  1025. position: absolute;
  1026. left: 0;
  1027. bottom: -34rpx;
  1028. &-2 {
  1029. bottom: -114rpx;
  1030. }
  1031. .btn {
  1032. width: 310rpx;
  1033. height: 84rpx;
  1034. border-radius: 16rpx;
  1035. position: absolute;
  1036. left: 220rpx;
  1037. }
  1038. .btn-1 {
  1039. top: 210rpx;
  1040. }
  1041. .btn-0 {
  1042. top: 316rpx;
  1043. }
  1044. }
  1045. }
  1046. .shiwan {
  1047. background: url(https://www.chaomangdao.com/image/open/tanchuangbeijing@2x.png) no-repeat;
  1048. background-size: cover;
  1049. }
  1050. .prize_ul {
  1051. width: 566rpx;
  1052. // padding: 0 92rpx;
  1053. display: flex;
  1054. flex-wrap: wrap;
  1055. justify-content: space-between;
  1056. position: absolute;
  1057. top: 336rpx;
  1058. left: 92rpx;
  1059. &-2 {
  1060. top: 226rpx;
  1061. }
  1062. &::after {
  1063. content: '';
  1064. width: 176rpx;
  1065. }
  1066. }
  1067. // .scroll-view {
  1068. // width: 522rpx;
  1069. // white-space:nowrap;
  1070. .prize_ul_li {
  1071. margin-bottom: 16rpx;
  1072. position: relative;
  1073. width: 176rpx;
  1074. height: 186rpx;
  1075. display: flex;
  1076. flex-direction: column;
  1077. align-items: center;
  1078. justify-content: center;
  1079. display: flex;
  1080. padding: 8rpx 0;
  1081. // margin-right: 20rpx;
  1082. box-sizing: border-box;
  1083. image {
  1084. margin: 0 auto;
  1085. }
  1086. text {
  1087. font-size: 24rpx;
  1088. // font-family: PingFangSC-Medium, PingFang SC;
  1089. font-weight: 500;
  1090. color: #171a20;
  1091. width: 146rpx;
  1092. overflow: hidden;
  1093. white-space: nowrap;
  1094. text-overflow: ellipsis;
  1095. }
  1096. .left-top-tag {
  1097. width: 3rem;
  1098. height: 3rem;
  1099. .tag-text {
  1100. font-size: 0.6rem !important;
  1101. }
  1102. }
  1103. }
  1104. // }
  1105. .prize_shop {
  1106. transition: 1s;
  1107. position: absolute;
  1108. top: 336rpx;
  1109. left: 198rpx;
  1110. display: flex;
  1111. flex-direction: column;
  1112. image {
  1113. width: 174rpx;
  1114. height: 235rpx;
  1115. margin-bottom: 20rpx;
  1116. }
  1117. text {
  1118. width: 70%;
  1119. font-size: 16rpx;
  1120. font-family: PingFangSC-Medium, PingFang SC;
  1121. font-weight: 500;
  1122. color: #171a20;
  1123. overflow: hidden;
  1124. white-space: nowrap;
  1125. text-overflow: ellipsis;
  1126. text-align: center;
  1127. }
  1128. .colorblack {
  1129. font-size: 32rpx !important;
  1130. font-family: PingFangSC-Medium, PingFang SC;
  1131. font-weight: 500;
  1132. color: #171a20;
  1133. }
  1134. .left-top-tag {
  1135. width: 5rem;
  1136. height: 5rem;
  1137. .tag-text {
  1138. font-size: 1rem;
  1139. }
  1140. }
  1141. }
  1142. .tag-normal {
  1143. box-shadow: 0 0 40rpx 18rpx #9d85ff;
  1144. }
  1145. .tag-rare {
  1146. box-shadow: 0 0 40rpx 18rpx #47a8ff;
  1147. }
  1148. .tag-supreme {
  1149. box-shadow: 0 0 40rpx 32rpx #feb337;
  1150. }
  1151. .tag-legend {
  1152. box-shadow: 0 0 40rpx 32rpx #fe615e;
  1153. }
  1154. .shiwan {
  1155. width: 399rpx;
  1156. height: 48rpx;
  1157. color: #ffffff;
  1158. font-size: 30rpx;
  1159. margin-top: 40rpx;
  1160. background: #000000;
  1161. border-radius: 27rpx 27rpx 27rpx 27rpx;
  1162. }
  1163. }
  1164. .left-top-tag {
  1165. z-index: 999999;
  1166. position: absolute;
  1167. left: -2px;
  1168. top: -3px;
  1169. .tag-img {
  1170. height: 100% !important;
  1171. width: 100% !important;
  1172. }
  1173. .tag-text {
  1174. position: absolute;
  1175. top: 30%;
  1176. left: 30%;
  1177. color: #fff !important;
  1178. width: auto !important;
  1179. transform: translateX(-50%) translateY(-50%) rotate(-45deg);
  1180. }
  1181. }
  1182. .prize_shop_scale {
  1183. transform: scale(1.3);
  1184. }
  1185. .recycle {
  1186. width: 640rpx;
  1187. padding-bottom: 95rpx;
  1188. position: relative;
  1189. background: #ffffff;
  1190. box-shadow: 0rpx -5rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
  1191. border-radius: 30rpx;
  1192. .recycle_close {
  1193. top: 20rpx;
  1194. right: 30rpx;
  1195. width: 44rpx;
  1196. height: 44rpx;
  1197. position: absolute;
  1198. }
  1199. .recycle_head {
  1200. height: 100rpx;
  1201. text-align: center;
  1202. line-height: 100rpx;
  1203. font-size: 32rpx;
  1204. font-weight: bold;
  1205. border-bottom: 2rpx solid #e9e9e9;
  1206. }
  1207. .recycle_price {
  1208. margin: 40rpx 0 0rpx 0;
  1209. flex-direction: column;
  1210. text {
  1211. color: #fa7e48;
  1212. font-size: 36rpx;
  1213. font-weight: bold;
  1214. &:last-child {
  1215. color: #333333;
  1216. margin-top: 10rpx;
  1217. font-size: 26rpx;
  1218. }
  1219. }
  1220. }
  1221. .recycle_ul {
  1222. padding: 0 30rpx;
  1223. margin: 50rpx 0;
  1224. }
  1225. .recycle_ul_li {
  1226. margin-bottom: 30rpx;
  1227. &:last-child {
  1228. margin-bottom: 0;
  1229. }
  1230. .recycle_ul_li_txt {
  1231. color: #999999;
  1232. font-size: 26rpx;
  1233. }
  1234. .recycle_ul_li_r {
  1235. text {
  1236. color: #999999;
  1237. font-size: 26rpx;
  1238. &:last-child {
  1239. width: 80rpx;
  1240. text-align: right;
  1241. color: #fa7e48;
  1242. font-size: 30rpx;
  1243. }
  1244. }
  1245. }
  1246. }
  1247. .recycle_txt {
  1248. padding: 0 30rpx;
  1249. color: #999999;
  1250. font-size: 26rpx;
  1251. }
  1252. }
  1253. .loading-mask {
  1254. position: fixed;
  1255. height: 100vh;
  1256. width: 100vw;
  1257. top: 0;
  1258. display: flex;
  1259. align-items: center;
  1260. justify-content: center;
  1261. background-color: #76767652;
  1262. .loading-gif {
  1263. width: 60%;
  1264. }
  1265. }
  1266. </style>