123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <view>
- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票详情"></u-navbar>
- <view class="detail">
- <view class="detail-top">
- <u-swiper :list="picUrlArr" height="320" radius="0" :indicator="true" :circular="true"></u-swiper>
- </view>
- <view class="flex detail-info">
- <view class="detail-info__left">
- <text class="title">{{ info.title }}</text>
- <view class="flex num">
- <u-icon name="gift" size="25" color="#EB7009"></u-icon>
- <text>100%抽中,奖品多多</text>
- </view>
- <view class="tip">图片仅供参考,请以实物为准</view>
- </view>
- <view class="detail-info__right">
- <text class="money">¥{{ $numberFormat(info.salePrice) }}</text>
- <text>销量 {{ info.saleQty }}</text>
- </view>
- </view>
- <view class="detail-goods">
- <view class="detail-goods-title">可获得奖品</view>
- <view class="detail-goods-list">
- <!-- <navigator :url="`/pages/prizeGoods/detail?id=${ item.prizeId }`" class="detail-goods-list-item"
- hover-class="navigator-hover" v-for="(item, index) in prizeList" :key="index"> -->
- <view class="detail-goods-list-item" v-for="(item, index) in prizeList" :key="index">
- <view class="detail-goods-list-item__value">
- <view class="flex image-wrap">
- <image :src="item.picUrl" mode="scaleToFill"></image>
- </view>
- <view class="info">
- <text class="title">{{ item.title }}</text>
- <text class="num"
- v-if="item.prizeType != 'coin'">价值:¥{{ $numberFormat(item.value) }}</text>
- <text class="num" v-else>数量:{{ item.value }}个</text>
- <text class="num">概率:{{ item.hitRate }}%</text>
- </view>
- <view class="name">{{ item.name }}</view>
- </view>
- </view>
- <!-- </navigator> -->
- </view>
- </view>
- </view>
- <view class="footer-fixed">
- <view class="flex btn">
- <button type="default" @click="exchange">{{ info.salePrice / 100 }}元 立即开刮</button>
- </view>
- </view>
- <pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="toProcess" />
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- import PayPopup from '../../components/pay-popup/pay-popup.vue'
- export default {
- components: {
- PayPopup
- },
- data() {
- return {
- boxId: '',
- picUrlArr: [],
- info: {},
- prizeList: [],
- payShow: false,
- payInfo: {}
- };
- },
- onLoad(opthios) {
- this.getDetail(opthios.id)
- },
- methods: {
- getDetail(id) {
- uni.showLoading({
- title: '加载中'
- });
- $http.post('/api/v1/mp/user/mall/ticket/detail', {
- boxId: id,
- noToken: true
- }).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- this.info = res.data
- let picUrlArr = res.data.picUrl.split(',')
- picUrlArr.forEach(item => {
- this.picUrlArr.push(env.filePublic + item)
- })
- let prizeList = res.data.prizeList
- prizeList.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0]
- })
- this.prizeList = prizeList
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- close() {
- this.payShow = false
- },
- toProcess(id) {
- this.payShow = false
- uni.navigateTo({
- url: `/pages/process/index?id=${ id }`
- })
- },
- exchange() {
- let data = {
- couponIds: [],
- autoCoupon: 1,
- boxId: this.info.boxId,
- ticketId: this.info.ticketId,
- orderNum: 1
- }
- $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
- if (res.code == 0) {
- let info = {
- ...res.data,
- ...this.info,
- picUrl: env.filePublic + res.data.picUrl,
- }
- this.payInfo = info
- this.payShow = true
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .detail {
- padding-bottom: 100rpx;
- &-top {
- margin-bottom: 20rpx;
- }
- &-info {
- justify-content: space-between;
- box-sizing: border-box;
- padding: 24rpx 16rpx;
- background-color: #fff;
- margin: 10rpx 10rpx 20rpx;
- border-radius: 10rpx;
- &__left {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- text {
- line-height: 24rpx;
- display: inline-block;
- }
- .title {
- color: rgba(16, 16, 16, 100);
- font-size: 32rpx;
- line-height: 32rpx;
- font-weight: bold;
- }
- .num {
- color: $uni-text-color;
- font-size: 28rpx;
- justify-content: flex-start;
- margin: 20rpx 0;
- }
- .tip {
- font-size: 24rpx;
- }
- }
- &__right {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- justify-content: space-between;
- height: 162rpx;
- text {
- color: rgba(157, 157, 157, 100);
- font-size: 14px;
- }
- .money {
- font-size: 40rpx;
- font-weight: bold;
- line-height: 40rpx;
- font-weight: bold;
- color: $uni-text-color;
- margin-bottom: 40rpx;
- }
- }
- }
- &-sku {
- background-color: #fff;
- border-radius: 10rpx;
- margin: 10rpx 10rpx 20rpx;
- &-title {
- padding: 24rpx 16rpx 12rpx;
- }
- &-item {
- padding-bottom: 10rpx;
- view {
- padding-left: 50rpx;
- line-height: 50rpx;
- }
- }
- }
- &-goods {
- margin: 10rpx 10rpx 20rpx;
- &-title {
- margin-bottom: 20rpx;
- }
- &-list {
- padding-bottom: 100rpx;
- &-item {
- position: relative;
- background-color: #FFFFFF;
- margin-bottom: 30rpx;
- border-radius: 10rpx;
- padding: 30rpx 20rpx;
- &__value {
- display: flex;
- }
- image {
- width: 200rpx;
- height: 200rpx;
- }
- .name {
- position: absolute;
- left: 0rpx;
- top: 0rpx;
- line-height: 28rpx;
- padding: 10rpx 40rpx;
- color: #FFFFFF;
- border-top-left-radius: 10rpx;
- border-bottom-right-radius: 40rpx;
- background-color: $uni-bg-color;
- }
- .info {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- font-size: 30rpx;
- padding-left: 50rpx;
- .title {
- font-weight: bold;
- }
- .num {
- color: #848484;
- }
- }
- }
- &-item:last-child {
- border: none;
- }
- }
- }
- }
- .footer-fixed {
- position: fixed;
- bottom: var(--window-bottom);
- left: 0;
- right: 0;
- z-index: 11;
- box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
- background: #fff;
- // 设置ios刘海屏底部横线安全区域
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- .btn {
- padding: 20rpx 0;
- /deep/ button {
- width: 640rpx;
- height: 90rpx;
- line-height: 90rpx;
- font-size: 36rpx;
- color: #fff;
- background-color: $uni-bg-color;
- border: none;
- border-radius: 20rpx;
- }
- }
- }
- </style>
|