123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <template>
- <view>
- <!-- 非H5撑高元素 -->
- <!-- <view class="status_bar"></view> -->
- <view class="box">
- <view class="box-top">
- <view class="box-top-action">
- <!-- <view class="box-top-action-item">
- <view class="flex box-top-action-item-cir">
- <u-icon name="scan" color="#fff" size="45"></u-icon>
- </view>
- <view class="box-top-action-item-txt">扫一扫</view>
- </view> -->
- <view class="box-top-action-item" @click="toPrize">
- <view class="flex box-top-action-item-cir">
- <u-icon name="gift" color="#fff" size="45"></u-icon>
- </view>
- <view class="box-top-action-item-txt">奖品库</view>
- </view>
- </view>
- <view class="box-top-tip" @click="toRule">
- <view class="flex box-top-tip-txt">
- <u-icon name="file-text" color="#5F5F5F" size="20"></u-icon>
- <text>规则说明</text>
- </view>
- </view>
- </view>
- <view class="box-ticket">
- <carousel :img-list="imgList" url-key="picUrl" @selected="selectedBanner" @changeTicket="getTicket" />
- </view>
- <view class="box-ticket-tip">超值保底100%中奖</view>
- <view class="box-start flex">
- <view class="flex box-start-action" @click="exchange">
- <text>立即</text>
- <text>开刮</text>
- </view>
- <view class="box-start-all" @click="toTicket">
- <view class="flex icon">
- <image class="icon-image" src="../../static/icon/index_all.png" mode="aspectFill"></image>
- </view>
- <view class="title">更多盲票</view>
- </view>
- </view>
- </view>
- <custom-tab-bar :activeValue="'index'" />
- <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 CustomTabBar from '../../components/custom-tab-bar/custom-tab-bar.vue'
- import Carousel from '../../components/vear-carousel/vear-carousel'
- import PayPopup from '../../components/pay-popup/pay-popup.vue'
- export default {
- components: {
- CustomTabBar,
- Carousel,
- PayPopup
- },
- data() {
- return {
- imgList: [],
- value: 1,
- payShow: false,
- checked: false,
- pageNum: 1,
- total: 100,
- list: [],
- currentIndex: 0,
- payInfo: {}
- };
- },
- onShow(opthios) {
- this.loginState = uni.getStorageSync('token') ? true : false
- this.getList()
- },
- methods: {
- getList() {
- uni.showLoading({
- title: '加载中'
- });
- let data = {
- categoryId: '',
- tagId: '',
- type: 'online',
- noToken: true
- }
- $http.post(`/api/v1/mp/user/mall/ticket/list?pageNum=${this.pageNum}&pageSize=100`, data).then(
- res => {
- uni.hideLoading();
- if (res.code == 0) {
- res.rows.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0]
- })
- this.total = res.total
- this.imgList = res.rows
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- selectedBanner(item, index) {
- uni.navigateTo({
- url: `/pages/ticketBox/detail?id=${ item.boxId }`
- })
- },
- getTicket(index) {
- this.currentIndex = index
- },
- close() {
- this.payShow = false
- },
- toProcess(id) {
- this.payShow = false
- uni.navigateTo({
- url: `/pages/process/index?id=${ id }`
- })
- },
- exchange() {
- this.payInfo = this.imgList[this.currentIndex]
- let data = {
- couponIds: [],
- autoCoupon: 1,
- boxId: this.payInfo.boxId,
- orderNum: 1
- }
- $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
- if (res.code == 0) {
- let info = {
- ...res.data,
- ...this.payInfo
- }
- this.payInfo = info
- this.payShow = true
- }
- }).catch(() => {
- uni.$u.toast('开刮失败,请重试!');
- })
- },
- toTicket() {
- uni.navigateTo({
- url: '/pages/ticketBox/index'
- })
- },
- toPrize() {
- if (!this.loginState) {
- uni.navigateTo({
- url: "/pages/login/index"
- })
- return
- }
- uni.navigateTo({
- url: '/pages/prize/index'
- })
- },
-
- toRule(){
- uni.navigateTo({
- url: '/pages/about/rule'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .status_bar {
- width: 100%;
- height: var(--status-bar-height);
- }
- /deep/ .u-tabbar__placeholder {
- display: none;
- }
- </style>
- <style lang="scss" scoped>
- .box {
- width: 100%;
- min-height: calc(100vh - 50px);
- background: url(https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/background.png) center center;
- &-top {
- display: flex;
- justify-content: space-between;
- padding: 100rpx 40rpx 0;
- &-action {
- display: flex;
- &-item {
- margin-right: 76rpx;
- &-cir {
- width: 104rpx;
- height: 104rpx;
- background-color: #FE5924;
- border-radius: 50%;
- margin-bottom: 14rpx;
- }
- &-txt {
- text-align: center;
- color: #5F5F5F;
- }
- }
- }
- &-tip {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- justify-content: flex-end;
- color: #5F5F5F;
- }
- }
- &-ticket {
- margin: 100rpx 0 0;
- height: 580rpx;
- }
- &-ticket-tip {
- margin-top: 20rpx;
- line-height: 40rpx;
- text-align: center;
- font-size: 40rpx;
- color: #FE5924;
- }
- &-start {
- align-items: flex-end;
- position: relative;
- margin-top: 60rpx;
- &-action {
- flex-direction: column;
- width: 220rpx;
- height: 220rpx;
- font-size: 36rpx;
- border-radius: 50%;
- background-color: #FE5924;
- border: 4rpx solid #FFFFFF;
- text {
- display: inline-block;
- padding-left: 8rpx;
- text-align: center;
- color: #FFFFFF;
- line-height: 50rpx;
- letter-spacing: 8rpx;
- }
- }
- &-all {
- position: absolute;
- right: 70rpx;
- .icon{
- width: 120rpx;
- height: 120rpx;
- border-radius: 50%;
- background-color: #FE5924;
-
- .icon-image{
- width: 80rpx;
- height: 80rpx;
- }
- }
-
- .title{
- margin-top: 8rpx;
- font-size: 34rpx;
- color: #EA350A;
- text-align: center;
- }
- }
- }
- }
- </style>
|