123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <template>
- <view class='app-container'>
- <img :src="pic" />
- <button class="submit" type="submit" circle @click="getSubmit">立即兑换</button>
- <!-- 弹窗 -->
- <uni-popup ref="popup" type="center" :is-mask-click="false">
- <view class="popup">
- <h3>{{ isShow ? '兑换成功' : '抱歉' }}</h3>
- <view class="center">{{ content }}</view>
- <view class="submit-btn">
- <button type="submit" circle @click="getClose">确定</button>
- <span>{{ isShow ? '该套餐内容仅可在WIFI/移动数据模式下收听' : '' }}</span>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { detail, submit } from '@/api/activity.js'
- export default {
- data() {
- return {
- pic: '',
- form: {
- activityId: '',
- clientType: getApp().globalData.userInfo.deviceClientType,
- deviceMac: getApp().globalData.userInfo.deviceMac,
- type: getApp().globalData.deviceInfo.deviceMode
- },
- // 弹窗内容
- content: '',
- // 兑换成功
- isShow: false
- }
- },
- onLoad(e) {
- this.form.activityId = e.activityId
- this.getDetail()
- },
- methods: {
- getDetail() {
- detail({
- activityId: this.form.activityId
- }).then(res => {
- if (res.data.code === 0) {
- this.pic = res.data.data.pic
- } else {
- uni.showToast({
- title: res.data.message,
- icon: 'error',
- duration: 2000
- })
- }
- })
- },
- // 立即领取
- getSubmit() {
- this.$refs.popup.open()
- if (this.form.type == 2 || this.form.type == 4) {
- submit(this.form).then(res => {
- if (res.data.code === 0) {
- this.content = res.data.data
- this.isShow = true
- } else {
- this.content = res.data.message
- this.isShow = false
- }
- })
- } else {
- this.content = '请在WIFI/4G模式下连接设备'
- this.isShow = false
- }
- },
- // 关闭弹窗
- getClose() {
- this.$refs.popup.close()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .app-container {
- padding: 0;
- overflow: hidden;
- position: relative;
- }
- img {
- width: 100%;
- height: 100%;
- display: block;
- }
- .submit {
- position: absolute;
- bottom: 20rpx;
- left: 50%;
- transform: translate(-50%);
- width: calc(100% - 120rpx);
- }
- .popup {
- width: 576rpx;
- height: 600rpx;
- background: #fff;
- border-radius: 32rpx;
- color: #000;
- font-weight: bold;
- text-align: center;
- padding: 48rpx 0;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- align-items: center;
- .center {
- font-size: 32rpx;
- }
- .submit-btn {
- button {
- width: 320rpx;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 32rpx;
- }
- span {
- font-size: 24rpx;
- }
- }
- }
- </style>
|