Files
xdd-uniapp-new/pkg_join/views/index.vue
T

173 lines
4.7 KiB
Vue

<template>
<view class="pkg-join-index">
<image
:src="images.topImage"
class="img-banner"
mode="scaleToFill"
/>
<image
v-show="partnerType === 'province_partner' || partnerType === '' || partnerType === 'county_agent'"
:src="images.goodSupplierImage"
class="img-item"
mode="widthFix"
@click="goto('goods_supplier')"
/>
<image
v-show="partnerType === 'pioneer' || partnerType === '' || partnerType === 'county_agent'"
:src="images.wenwanSupplierImage"
class="img-item"
mode="widthFix"
@click="goto('wenwan_supplier')"
/>
<image
v-show="partnerType === 'pioneer' || partnerType === '' || partnerType === 'county_agent'"
:src="images.hotelImage"
class="img-item"
mode="widthFix"
@click="goto('shop')"
/>
<image
:src="images.wholesalerImage"
class="img-item"
mode="widthFix"
@click="goto('wholesaler')"
/>
<image
:src="images.travelImage"
class="img-item"
mode="widthFix"
@click="toTravelResidence"
/>
<image
:src="images.experienceStoreImage"
class="img-item"
mode="widthFix"
@click="goto('experience_store')"
/>
</view>
</template>
<script>
import { getImages, getShopData } from '@/api/join'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'PkgJoinIndex',
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
partnerId: '',
promoterUid: '',
partnerType: '',
hotelId: null,
hasHotel: null,
hasSupplier: null,
hasWholesaler: null,
hasExperienceStore: null,
hasTravel: null,
images: null,
pageKeyId: Object.freeze('merchantApplyIndex'),
canApplyHotel: false
}
},
onLoad(options) {
this.partnerId = options.partnerId || ''
this.promoterUid = options.promoterUid || ''
getImages().then(({data}) => this.images = data)
},
onShow() {
getShopData({partnerId: this.partnerId, promoterUid: this.promoterUid}).then(({data}) => {
this.partnerType = data.partnerType
this.hotelId = data.hotelId
this.hasHotel = data.hasHotel
this.hasSupplier = data.hasSupplier
this.hasWholesaler = data.hasWholesaler
this.canApplyHotel = data.canApplyHotel
this.hasTravel = data.hasTravel
this.hasExperienceStore = data.hasExperienceStore
})
},
methods: {
/**
* 跳转旅游 residences
*/
toTravelResidence() {
if (this.hasTravel === 1) {
this.$global.goSupplierMini()
} else {
this.$yrouter.push('/pkg_join/views/travelResidence?partnerId=' + this.partnerId + '&promoterUid=' + this.promoterUid)
}
},
/**
* 跳转
* @param {string} target - 目标页面
*/
goto(target) {
switch (target) {
case 'goods_supplier':
if (this.hasSupplier === 1) {
this.$global.goSupplierMini()
} else {
this.$yrouter.push(`/pkg_join/views/supplier?type=goods_supplier&partnerId=${this.partnerId}&promoterUid=${this.promoterUid}`)
}
break
case 'wenwan_supplier':
if (this.hasSupplier === 1) {
this.$global.goSupplierMini()
} else {
this.$yrouter.push(`/pkg_join/views/supplier?type=wenwan_supplier&partnerId=${this.partnerId}&promoterUid=${this.promoterUid}`)
}
break
case 'shop':
if (!this.canApplyHotel) {
uni.showToast({ // 使用uni-app官方提示API
title: '您的店铺数量已到达上限,不能继续申请店铺',
icon: 'none'
})
return
}
this.$yrouter.push('/pkg_join/views/shop?partnerId=' + this.partnerId)
break
case 'experience_store':
if(this.hasExperienceStore === 1) {
this.$global.goSupplierMini()
return
}
this.$yrouter.push('/pkg_join/views/experienceStore?partnerId=' + this.partnerId + '&promoterUid=' + this.promoterUid)
break
case 'wholesaler':
if (this.hasWholesaler === 1) {
this.$global.goSupplierMini()
} else {
this.$yrouter.push(`/pkg_join/views/wholesaler?partnerId=${this.partnerId}&promoterUid=${this.promoterUid}`)
}
break
}
}
}
}
</script>
<style scoped lang="less">
.pkg-join-index {
padding-bottom: 46rpx;
image {
vertical-align: middle;
}
.img-banner {
width: 750rpx;
height: 378rpx;
}
.img-item {
width: 682rpx;
height: auto;
margin: 40rpx 34rpx 0;
border-radius: 20px;
}
}
</style>