123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view>
- <uni-popup ref="popup" type="center" :mask-click="false">
- <view class="giftpop y-f">
- <image class="close_icon" src="@/static/images/ad/close_icon.png" @click="closePop"></image>
- <image class="gift_img_head" src="@/static/images/ad/gift_img_head.png" mode="widthFix"></image>
- <view class="giftpop-body y-f">
- <view class="new_user_bg">
- <image style="width: 308rpx;height: auto;" src="@/static/images/ad/new_user_bg.svg"
- mode="widthFix"></image>
- </view>
- <image class="free_font_img" src="@/static/images/ad/free_font_img.svg" mode="widthFix"></image>
- <view class="y-f" :style="{display: haveGift ? 'flex':'none'}">
- <image class="gift-img" :src="giftImage" mode="aspectFill"></image>
- <text class="gift-name textOne">{{package.packageName}}</text>
- </view>
- <view class="y-f" :style="{display: !haveGift ? 'flex':'none'}">
- <image class="gift-img" src="/static/image/nodata.png" mode="aspectFill"></image>
- <text class="gift-name textOne">暂无礼品</text>
- </view>
- </view>
- <view class="giftpop-footer x-c" v-if='showBtn&&package.packageId'>
- <image class="buy_btn" src="@/static/images/ad/buy_btn.svg" mode="widthFix" @click="handClick(1)"></image>
- <image class="addfans_btn" src="@/static/images/ad/addfans_btn.svg" mode="widthFix" @click="handClick(2)"></image>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { popAd } from '@/api/user.js'
- import {getConfigByKey} from '@/api/common.js'
- import { gotoMiniProgram } from '@/utils/healthButlerPop.js'
- export default {
- data() {
- return {
- giftImage: '',
- package: {},
- showBtn: false,
- haveGift: true
- }
- },
- mounted() {
- this.getConfigByKey()
- },
- methods: {
- openPop() {
- this.$refs.popup.open('center')
- popAd().then(res=>{
- if(res.code == 200) {
- this.showBtn = true
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- })
- },
- closePop() {
- this.$refs.popup.close()
- },
- getConfigByKey(){
- let param = {key:"app.config"};
- getConfigByKey(param).then(
- res => {
- if(res.code==200){
- let data=JSON.parse(res.data);
- this.giftImage = data.giftImage
- this.package = data.fsPackage&&data.fsPackage.length > 0 ? data.fsPackage[0] : {}
- this.haveGift = this.package.packageId ? true : false
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- }
- },
- rej => {}
- )
- },
- handClick(type) {
- if(type == 1) {
- uni.navigateTo({
- url: '/pages/store/packageDetails?choose=1&packageId='+this.package.packageId || ''
- })
- } else {
- gotoMiniProgram();
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .close_icon {
- width: 64rpx;
- height: 64rpx;
- position: absolute;
- right: 0;
- top: 0;
- }
- .giftpop {
- width: 590rpx;
- min-height: 758rpx;
- margin-bottom: 100rpx;
- position: relative;
- .gift_img_head {
- width: 312rpx;
- height: auto;
- }
- .new_user_bg {
- width: 308rpx;
- margin-top: -4rpx;
- }
- .free_font_img {
- width: 520rpx;
- height: auto;
- margin-top: 16rpx;
- }
- .gift-img {
- width: 470rpx;
- height: 320rpx;
- margin-top: 24rpx;
- background: #FFFFFF;
- border-radius: 36rpx 36rpx 36rpx 36rpx;
- }
- .gift-name {
- width: 90%;
- margin-top: 26rpx;
- text-align: center;
- }
- &-footer {
- margin-top: 48rpx;
- }
- .buy_btn {
- width: 240rpx;
- height: auto;
- }
- .addfans_btn {
- width: 318rpx;
- height: auto;
- margin-left: 32rpx;
- }
- &-body {
- width: 582rpx;
- min-height: 632rpx;
- margin-top: 4rpx;
- padding-bottom: 34rpx;
- background: linear-gradient(180deg, #F7E4DE 0%, #FFEDD8 27%, #FFF7ED 100%);
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- box-sizing: border-box;
- position: relative;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #FF5C03;
- &::after {
- content: "";
- position: absolute;
- width: 590rpx;
- height: 640rpx;
- background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- top: -4rpx;
- left: -4rpx;
- z-index: -1;
- }
- }
- }
- </style>
|