123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <view>
- <u-navbar leftIconSize="0" title="幸运数字" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
- <view class="lucky">
- <view class="lucky-number">
- <view class="flex lucky-number-circle">
- <view class="title">幸运数字</view>
- <view class="num" v-if="info.status == 1">?</view>
- <view class="luckyNum" v-else>{{ info.plainLuckyNum }}</view>
- </view>
- </view>
- <view class="lucky-title">
- <view class="txt">{{ info.title }}</view>
- <view class="id">盲票序列号:{{ info.serialNo }}</view>
- </view>
- <view class="flex lucky-btn">
- <view class="pay" @click="pay" v-if="info.status == 1">支付{{ info.facePrice / 100 }}元 立即查看</view>
- <view class="pay" @click="screen" v-else>保存至手机相册</view>
- </view>
- <view class="index" @click="toIndex">去首页</view>
- </view>
- <pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="getDetailInfo" />
- <u-popup :show="showNull" :round="10" mode="center">
- <view class="null-prize">
- <view class="title">该盲票已兑奖</view>
- <view class="btn" @click="toIndex">确认</view>
- </view>
- </u-popup>
- </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 {
- serialNo: '',
- info: '',
- payInfo: {},
- payShow: false,
- showNull: false
- };
- },
- onLoad(options) {
- this.serialNo = options.id
- this.getDetail()
- },
- methods: {
- getDetail() {
- uni.showLoading({
- title: '加载中'
- });
- $http.post('/api/v1/mp/user/ticket/queryLuckyNum', {
- serialNo: this.serialNo,
- noToken: true
- }).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- if (res.data.status == 1) {
- this.info = res.data
- } else if (res.data.status == 2) {
- uni.redirectTo({
- url: `/pages/choice/index?id=${ res.data.ticketId }`
- })
- } else {
- this.showNull = true
- }
- } else {
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/index/index'
- })
- }, 500)
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- getDetailInfo() {
- this.payShow = false
- uni.showLoading({
- title: '加载中'
- });
- $http.post('/api/v1/mp/user/ticket/queryLuckyNum', {
- serialNo: this.serialNo,
- noToken: true
- }).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- this.info = res.data
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- close() {
- this.payShow = false
- },
- pay() {
- let data = {
- ticketId: this.info.ticketId,
- autoCoupon: 1
- }
- $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
- console.log(res);
- if (res.code == 0) {
- let info = {
- ...res.data,
- ...this.info,
- picUrl: env.filePublic + res.data.picUrl,
- }
- this.payInfo = info
- this.payShow = true
- console.log(info);
- }
- })
- },
- screen() {
- },
- toIndex() {
- uni.switchTab({
- url: '/pages/index/index'
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .lucky {
- width: 100%;
- height: calc(100vh - 50px);
- background: url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic3.zhimg.com%2F50%2Fv2-a6f5c8b5b66fe87e4e79c1fc82a61a36_hd.jpg&refer=http%3A%2F%2Fpic3.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1649658373&t=f216ee4825d5b36e62aa3a490516bfb1) center center;
- &-number {
- padding-top: 400rpx;
- &-circle {
- box-sizing: border-box;
- flex-direction: column;
- width: 336rpx;
- height: 336rpx;
- background-color: $uni-bg-color;
- border-radius: 50%;
- margin: auto;
- .title {
- margin-bottom: 20rpx;
- }
- .num {
- font-size: 100rpx;
- }
- .luckyNum {
- font-size: 36rpx;
- }
- }
- }
- &-title {
- margin-top: 40rpx;
- margin-bottom: 70rpx;
- .txt {
- text-align: center;
- font-size: 36rpx;
- font-weight: bold;
- line-height: 50rpx;
- margin-bottom: 8rpx;
- }
- .id {
- line-height: 40rpx;
- text-align: center;
- }
- }
- &-btn {
- .pay {
- width: 400rpx;
- height: 60rpx;
- line-height: 60rpx;
- border-radius: 8rpx;
- background-color: rgba(235, 112, 9, 100);
- color: #FFFFFF;
- text-align: center;
- }
- }
- .index {
- margin: 60rpx 0;
- text-align: center;
- font-weight: bold;
- color: $uni-color-primary;
- }
- }
- .null-prize {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width: 70vw;
- height: 260rpx;
- background-color: #FFFFFF;
- border: 1px solid rgba(187, 187, 187, 100);
- .btn {
- margin-top: 50rpx;
- width: 160rpx;
- height: 60rpx;
- line-height: 60rpx;
- border-radius: 8rpx;
- background-color: rgba(235, 112, 9, 100);
- color: rgba(255, 255, 255, 100);
- font-size: 28rpx;
- text-align: center;
- }
- }
- </style>
|