123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <template>
- <view>
- <u-navbar title="详情" :border="true" :placeholder="true" :autoBack="true" leftIconColor="#fff"
- bgColor="#E96737" />
- <view class="detail">
- <view class="detail-top">
- <u-swiper :list="picUrlArr" height="320" :indicator="true" :circular="true"></u-swiper>
- </view>
- <view class="flex detail-info">
- <view class="detail-info__left">
- <text class="title">{{ info.title }}</text>
- <text class="num">销售分佣比{{ info.saleCommRate }}%</text>
- </view>
- <view class="detail-info__right">
- <text class="money">¥{{ $numberFormat(info.pkgSalePrice) }}</text>
- <text>销量 {{ info.saleQty }}</text>
- </view>
- </view>
- <view class="detail-sku">
- <view class="detail-sku-title">参数</view>
- <view class="detail-sku-item">
- <view>规格:{{ info.pkgUnit }}张/包</view>
- <view>面值:{{ $numberFormat(info.facePrice) }}元</view>
- </view>
- </view>
- <view class="detail-goods">
- <view class="detail-goods-title">可获得商品</view>
- <view class="detail-goods-list">
- <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>{{ item.title }}</text>
- <text>价值:¥{{ $numberFormat(item.value) }}</text>
- <text>概率:{{ item.hitRate }}%</text>
- </view>
- <view class="name">{{ item.name }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="footer-fixed">
- <view class="flex btn">
- <view class="btn-left" @click="toCart">
- <u-icon name="shopping-cart" color="#808080" size="20"></u-icon>
- <view>购物车</view>
- </view>
- <view class="btn-right">
- <text @click="addCart">加入购物车</text>
- <text @click="toSettlement">立即购票</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- boxId: '',
- picUrlArr: [],
- info: {},
- prizeList: [],
- };
- },
- onLoad(opthios) {
- this.getDetail(opthios.boxId)
- },
- methods: {
- getDetail(id) {
- $http.post('/api/v1/mp/channel/mall/ticket/detail', {
- boxId: id
- }).then(res => {
- if (res.code == 0) {
- this.info = res.data
- console.log(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=>{
- item.picUrl = env.filePublic + item.picUrl
- })
-
- console.log(prizeList);
- this.prizeList = prizeList
- }
- })
- },
- addCart(id) {
- let data = {
- boxId: this.info.boxId,
- orderNum: 1
- }
- $http.post(`/api/v1/mp/channel/mall/cart/add`, data).then(res => {
- console.log(res);
- if (res.code == 0) {
- uni.$u.toast('加入购物车成功');
- }
- })
- },
- toCart() {
- uni.switchTab({
- url: "/pages/index/cart"
- })
- },
- toSettlement() {
- uni.navigateTo({
- url: `/pages/order/settlement?boxId=${ this.info.boxId }`
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/ .u-navbar__content__title.u-navbar__content__title {
- color: #FFFFFF;
- }
- </style>
- <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 {
- font-size: 24rpx;
- line-height: 24rpx;
- display: inline-block;
- }
- .title {
- color: rgba(16, 16, 16, 100);
- font-size: 32rpx;
- line-height: 32rpx;
- font-weight: bold;
- margin-bottom: 40rpx;
- }
- .num {
- width: 220rpx;
- height: 34rpx;
- color: $uni-text-color;
- text-align: center;
- line-height: 34rpx;
- border: 1px solid $uni-bg-color;
- border-radius: 6rpx;
- }
- }
- &__right {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- justify-content: space-between;
- 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 {
- background-color: #FFFFFF;
- &-item {
- position: relative;
- margin: 16rpx 0;
- border-bottom: 1px solid rgba(236, 236, 236, 100);
- &__value {
- display: flex;
- }
- .image-wrap {
- width: 250rpx;
- height: 250rpx;
- margin-right: 30rpx;
- image {
- width: 180rpx;
- height: 120rpx;
- }
- }
-
- .name{
- position: absolute;
- line-height: 28rpx;
- padding: 6rpx 20rpx;
- background-color: $uni-bg-color;
- }
- .info {
- display: flex;
- flex-direction: column;
- font-size: 24rpx;
- text {
- margin-bottom: 10rpx;
- }
- text:first-child {
- font-size: 28rpx;
- margin-top: 24rpx;
- margin-bottom: 30rpx;
- font-weight: bold;
- }
- }
- }
- &-item:last-child {
- border: none;
- }
- }
- }
- }
- .footer-fixed {
- position: fixed;
- bottom: var(--window-bottom);
- left: 0;
- right: 0;
- // min-height: 120rpx;
- z-index: 11;
- box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
- background: #fff;
- // margin-bottom: 40rpx;
- // 设置ios刘海屏底部横线安全区域
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- .btn {
- justify-content: space-between;
- padding: 10rpx 40rpx;
- &-left {
- display: flex;
- line-height: 28rpx;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: #808080;
- }
- &-right {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- text {
- width: 190rpx;
- height: 60rpx;
- line-height: 60rpx;
- border-radius: 8rpx;
- text-align: center;
- margin-left: 40rpx;
- }
- text:first-child {
- background-color: rgba(236, 153, 84, 100);
- color: rgba(255, 255, 255, 100);
- }
- text:last-child {
- background-color: rgba(235, 112, 9, 100);
- color: rgba(255, 255, 255, 100);
- }
- }
- }
- }
- </style>
|