Files
xdd-uniapp-new/pkg_product/views/famousQianxianShop.vue
T

1968 lines
55 KiB
Vue

<template>
<view class="container">
<hx-navbar
:fixed="true"
:background-color="[[13,197,197],[13,197,197]]"
:pageScroll.sync="scrollData"
statusBarFontColor="#ffffff"
barPlaceholder="hidden"
transparent="auto"
color='#ffffff'
/>
<view v-if="isLoad">
<view class="cover-box">
<image
v-if="inn.coverType === 1"
:src="inn.cover"
class="full-img"
mode="widthFix"
/>
<view
v-if="inn.coverType === 2"
:style="{
'width': videoStyle.width,
'height': videoStyle.height
}"
class="video-box"
>
<video
:src="inn.cover"
:autoplay="true"
:controls="true"
:loop="false"
object-fit="contain"
play-btn-position="center"
class="video"
id="coverVideo"
@play="coverPlay"
/>
</view>
</view>
<view class="innInfoWrap">
<view class="bg-color">
<view class="box-mask flex jc-between ai-end">
<view
v-if="inn.cityName"
class="city-section flex jc-end ai-center"
>
<image
:src="webUrl + '/page/qianxian/icon-09.png'"
style="width: 28rpx;height: 28rpx;margin-right: 8rpx;"
/>
<text class="one-t" style="font-size: 24rpx;color: #fff;">{{ inn.cityName }}</text>
</view>
</view>
</view>
<view class="body-cont flex ai-end">
<view class="inn-logo flex-0">
<image :src="inn.logo" v-if="inn.logo"></image>
<image :src="webUrl + '/20230609145651814148.png'" v-else/>
</view>
<view class="a3 flex jc-between ai-end" style="width: 100%">
<view class="inn-owner v12-font-36 v12-dark-text one-t v12-font-bold" style="flex-grow: 1;width: 80rpx">{{ inn.name }}</view>
<view class="flex ai-center zan-favorite-wrap">
<view class="zan-box flex flex-0 ai-end" @click="zanInn">
<template v-if="isLike">
<image :src="webUrl + '/icon/icon-like.png'" class="img" />
<text class="on">{{ inn.zan }}</text>
</template>
<template v-else>
<image :src="webUrl + '/icon/icon-like.png'" class="img" />
<text>{{ inn.zan }}</text>
</template>
</view>
<view class="flex flex-0 ai-end favorite-box" @click="doneFavorite">
<image
v-if="isFavorite"
:src="webUrl + '/icon/icon-star-on.png'"
mode="scaleToFill"
class="icon"
/>
<image
v-else
:src="webUrl + '/icon/icon-star-off.png'"
mode="scaleToFill"
class="icon"
/>
<text>{{ favoriteCount }}</text>
</view>
</view>
</view>
</view>
</view>
<view class="inn-signature-wrap">
<view class="triangle"></view>
<view class="inn-signature">
{{ inn.shopIntro }}
</view>
<view class="share-btn" @click="changeShare">
<image :src="webUrl + '/page/hotel/share.png'" class="img" />
</view>
</view>
<view v-if="inn.name" class="map-wrapper">
<view class="map-cont">
<map
:longitude="inn.longitude"
:latitude="inn.latitude"
style="width: 750rpx;height: 300rpx;"
/>
</view>
<view class="bg"></view>
<view class="map-info">
<view class="map-info-hd">
<image :src="webUrl + '/page/qianxian/icon-location.png'" class="icon" />
</view>
<view class="map-info-bd more-t">
{{ inn.address }}
</view>
<view class="map-info-ft flex">
<view class="item" @click="showLocation">
<image :src="webUrl + '/page/qianxian/icon-addr.png'" class="img" />
<view>导航</view>
</view>
<view class="item" @click="call">
<image :src="webUrl + '/page/qianxian/icon-phone.png'" class="img" />
<view>客服</view>
</view>
</view>
</view>
</view>
<view class="top-tab acea-row row-middle row-center">
<view
v-for="(item, index) in tabList"
:key="index"
class="tab"
@click="changeTab(item.value)"
>
<view
:class="activeIndex === index ? 'active' : ''"
class="tab-item"
>
{{ item.text }}
</view>
</view>
</view>
<view>
<!-- 资讯 -->
<view
v-if="activeIndex === 3"
class="info-section"
>
<view>
<view v-if="infoArray.length > 0" class="info-wrapper">
<view class="info-list">
<view
v-for="(item, index) in infoArray"
:key="index"
class="info-item"
>
<view
:class="item.isTop === 1 ? 'info-item-top' : ''"
:style="{
'background-image': item.isTop ? ('url(' + webUrl + '/page/hotel/info-top-bg.png)') : 'none'
}"
class="info-item-header"
@click="infoClick(item)"
>
<view class="name">
{{ item.title }}
</view>
<view class="intro">
{{ item.content }}
</view>
</view>
<view class="info-item-body">
<img-box
v-if="item.type === 1"
:imgList="item.images"
:num="item.images.length"
:img-radius="10"
style="width: 100%;"
@click="infoItemViewClick(item)"
/>
<video
v-else
@play="infoItemViewClick(item, index)"
play-btn-position="center"
:show-fullscreen-btn="false"
class="video-item v12-mt-0"
:src="item.video"
objectFit
controls
:id="'video-item' + index"
:poster="item.video + '?vframe/jpg/offset/1'"></video>
</view>
<view class="info-item-bottom">
<view class="time">
{{ item.createTime ? item.createTime.replace(/-/g, '.').substr(0, 10) : '' }}
</view>
<view class="btns">
<view class="flex">
<image
:src="webUrl + '/20230803152147141807.png'"
class="icon"
/>
<text class="seeNum-txt">{{ item.pv }}</text>
</view>
<view class="flex">
<image
v-if="!item.hasZan"
:src="webUrl + '/page/hotel/zan-off-2.png'"
class="zan-off-icon"
@click="likeInfoItemHandle(item, index, item.zan + 1, true)"
/>
<image
v-else
:src="webUrl + '/page/hotel/zan-on-2.png'"
class="zan-on-icon"
@click="likeInfoItemHandle(item, index, item.zan - 1, false)"
/>
<text
v-show="item.zan > 0"
:class="item.hasZan ? 'on' : ''"
class="seeNum-txt"
>{{ item.zan }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="v12-px-6" >
<u-divider :text="infoArray.length === 0 ? ' · 暂无资讯 · ' : ' · 已经到底啦 · '" textPosition="center"></u-divider>
</view>
</view>
</view>
<!-- 文化 -->
<view
v-if="activeIndex === 1"
class="info-section county-section"
>
<view class="county-intro-wrap">
<view class="title">
县城介绍
<!-- <view class="btn" @click="toggleCountyIntro">
{{ toggleCountyIntroStatus ? '收起' : '展开' }}
<image :src="webUrl + '/page/qianxian/icon-arrow.png'" class="icon" />
</view> -->
</view>
<!-- <view
:class="toggleCountyIntroStatus ? 'show-more' : ''"
class="intro-main"
>
<rich-text :nodes="inn.countyIntro" />
<view v-if="!toggleCountyIntroStatus" class="layer" />
</view> -->
<view class="v12-py-3">
<u-read-more ref="uReadMore" showHeight="200">
<u-parse :content="inn.countyIntro" @load="load"></u-parse>
</u-read-more>
</view>
<view class="title">
图片
</view>
<view class="pic-list v12-d-grid-columns-2">
<view
v-for="(item, index) in inn.countyImages"
:key="index"
class="item"
>
<image
:src="item"
class="img"
@click="showPic(index)"
/>
</view>
</view>
</view>
</view>
<!-- 攻略 -->
<view
v-if="activeIndex === 2"
class="guide-section"
>
<view v-if="isLoadInfoListSuccess">
<view class="guide-list">
<view
v-for="(item, index) in guideList"
:key="index"
class="guide-item"
@click="guideItemClickHandle(item)"
>
<image
:src="item.image"
mode="widthFix"
class="img"
/>
<view class="info-wrap">
<view class="time">
{{ item.createTime }}
</view>
<view class="title">
{{ item.title }}
</view>
</view>
</view>
</view>
<!-- <image
:src="webUrl + '/home/no-data-bg.png'"
mode="widthFix"
class="no-data-loadend"
/> -->
<view class="v12-px-6" >
<u-divider :text="guideList.length === 0 ? ' · 暂无攻略 · ' : ' · 已经到底啦 · '" textPosition="center"></u-divider>
</view>
</view>
<goo-skeleton v-else />
</view>
<!-- 产业 -->
<view
v-if="activeIndex === 0"
class="industry-section"
>
<view v-if="industryTabIndex === 0">
<view class="card-wrap">
<image
:src="webUrl + '/page/qianxian/card-bg1.png'"
class="bg"
/>
<view class="card-cont">
<view class="tab-wrap">
<view
v-for="(tab, tabIndex) in industryTab"
:key="tabIndex"
:class="industryTabIndex === tabIndex ? 'active' : ''"
class="item"
@click="industryTabItemClick(tabIndex)"
>
<image
:src="webUrl + tab.icon"
class="icon"
/>
{{ tab.name }}
</view>
</view>
<view class="file-wrap">
<view class="title">
<image
:src="webUrl + '/page/qianxian/icon-02.png'"
class="icon"
/>
重点项目
</view>
<view v-if="industryList.length > 0" class="file-list">
<view class="list-cont">
<view
v-for="(file, fileIndex) in industryList"
:key="fileIndex"
class="file-item"
@click="fileItemClick(file)"
>
<view class="name one-t">
·&nbsp;&nbsp;{{ file.title }}
</view>
<image
:src="webUrl + '/page/qianxian/icon-05.png'"
class="icon"
/>
</view>
</view>
</view>
<view v-else class="no-data">暂无重点项目</view>
</view>
</view>
</view>
<view class="project-wrap">
<view class="title">
<image
:src="webUrl + '/page/qianxian/icon-01.png'"
class="icon"
/>
产业项目
</view>
<view v-if="industryProjectList.length > 0" class="list">
<view
v-for="(item, index) in industryProjectList"
:key="index"
class="item"
>
<image
:src="item.image"
class="img"
@click="gotoInvestment(item.title, 'project', item.id)"
/>
</view>
</view>
<view v-else class="no-data">暂无产业项目</view>
</view>
</view>
<view v-if="industryTabIndex === 1">
<view class="card-wrap">
<image
:src="webUrl + '/page/qianxian/card-bg2.png'"
class="bg"
/>
<view class="card-cont">
<view class="tab-wrap">
<view
v-for="(tab, tabIndex) in industryTab"
:key="tabIndex"
:class="industryTabIndex === tabIndex ? 'active' : ''"
class="item"
@click="industryTabItemClick(tabIndex)"
>
<image
:src="webUrl + tab.icon"
class="icon"
/>
{{ tab.name }}
</view>
</view>
<view class="file-wrap" :class="[{'v12-align-center': investmentFileList.length === 0}, {'v12-justify-center': investmentFileList.length === 0}]">
<view v-if="investmentFileList.length > 0" class="file-list">
<view class="list-cont">
<view
v-for="(file, fileIndex) in investmentFileList"
:key="fileIndex"
class="file-item file-item2"
@click="fileItemClick(file)"
>
<view class="name more-t">
·&nbsp;&nbsp;{{ file.title }}
</view>
<image
:src="webUrl + '/page/qianxian/icon-05.png'"
class="icon"
/>
</view>
</view>
</view>
<view v-else class="no-data">暂无招商政策</view>
</view>
</view>
</view>
<view v-if="investmentFileList.length > 0" class="more-btn-wrap">
<view class="more-btn" @click="gotoInvestment('', 'investment')">
更多政策
</view>
</view>
</view>
<view v-if="industryTabIndex === 2">
<view class="card-wrap">
<image
:src="webUrl + '/page/qianxian/card-bg3.png'"
class="bg bg3"
/>
<view class="card-cont">
<view class="tab-wrap">
<view
v-for="(tab, tabIndex) in industryTab"
:key="tabIndex"
:class="industryTabIndex === tabIndex ? 'active' : ''"
class="item"
@click="industryTabItemClick(tabIndex)"
>
<image
:src="webUrl + tab.icon"
class="icon"
/>
{{ tab.name }}
</view>
</view>
<view class="village-wrap">
<view v-if="villageList.length > 0" class="village-list">
<view
v-for="(village, villageIndex) in villageList"
:key="villageIndex"
class="village-item v12-white"
@click="villageItemClick(village)"
>
<view class="img-wrap">
<image
:src="village.cover + (village.coverType === 2 ? '?vframe/jpg/offset/1' : '')"
class="img"
/>
<view class="location">
<image
:src="webUrl + '/page/qianxian/icon-08.png'"
class="icon"
/>
<view class="addr one-t">
{{ village.address }}
</view>
</view>
</view>
<view class="info">
<view class="intro more-t">
{{ village.intro }}
</view>
<view class="name-wrap">
<image
:src="village.logo"
class="logo"
/>
<view class="name one-t">
{{ village.name }}
</view>
</view>
</view>
</view>
</view>
<view v-else class="no-data">暂无租售资讯</view>
</view>
</view>
</view>
</view>
</view>
<!-- 产品 -->
<view
v-if="activeIndex === 4"
class="good-list-wrap"
>
<view class="good-list-cont v12-d-grid-columns-2">
<!-- <view class="list-cont-left">
<view
v-for="(item, index) in leftList"
:key="index"
class="item flex"
>
<xdd-product-item
:item="item"
:show-coupon="false"
name-key="productName"
image-key="productImage"
price-key="productPrice"
@view="goGoodsCon(item)"
/>
</view>
</view>
<view class="list-cont-right">
<view
v-for="(item, index) in rightList"
:key="index"
class="item flex"
>
<xdd-product-item
:item="item"
:show-coupon="false"
name-key="productName"
image-key="productImage"
price-key="productPrice"
@view="goGoodsCon(item)"
/>
</view>
</view> -->
<view v-for="(item, index) in leftList" :key="index">
<view v-if="item.productId" class="v12-white v12-radius-20 f-wrap" @click="goGoodsCon(item)" style="height: 516rpx">
<view class="">
<view class="focus-img">
<image :src="item.productImage" class="img"></image>
</view>
<view class="more-t v12-pt-2 v12-font-bold v12-font-28 v12-px-2">{{ item.productName }}</view>
</view>
<view class="v12-justify-between v12-algin-center v12-pa-2">
<view>
<text class="v12-font-bold v12-primary-text v12-font-24"></text>
<text class="v12-font-bold v12-primary-text v12-font-28">{{ item.productPrice }}</text>
</view>
<view class="btn">
<image
:src="webUrl + '/home/icon-cart.png'"
class="img"
/>
</view>
</view>
</view>
<view v-if="!item.productId" class="v12-white v12-radius-20 f-wrap" @click="goStore(item)" style="height: 516rpx">
<view>
<view class="focus-img">
<image :src="item.cover" v-if="item.coverType === 1" class="img" mode="heightFix|widthFix"></image>
<video :src="item.cover" v-else :show-center-play-btn="false" :show-fullscreen-btn="false" :show-play-btn="false" class="img" :poster="item.cover + '?vframe/jpg/offset/1'"></video>
<image
:src="webUrl + '/orderIcon/nm.png'"
class="mark-img"
/>
</view>
<view class="more-t v12-pt-2 v12-font-bold v12-font-28 v12-px-2" >{{ item.content }}</view>
</view>
<view class="v12-justify-start v12-align-center v12-pt-2 v12-px-2 v12-pb-2">
<view class="btn v12-mr-2">
<image :src="item.logo" class="img v12-radius-100"></image>
</view>
<view class="one-t v12-font-24 v12-dark1-text" style="width:230rpx">{{ item.name }}/{{ inn.name }}</view>
</view>
</view>
</view>
</view>
<image
:src="webUrl + '/home/no-data-bg.png'"
mode="widthFix"
class="loadend"
/>
</view>
</view>
</view>
<goo-skeleton v-else />
<!-- 分享 -->
<u-popup
:show="showShare"
mode="center"
bgColor="transparent"
>
<view class="box-share">
<view class="box-img">
<image
:src="webUrl + '/20230608112219219303.png'"
class="icon"
@click="closeShare"
/>
<image :src="posterUrl" class="main-img" mode="widthFix" />
</view>
<image
:src="webUrl + '/20230608112210135038.png'"
mode="widthFix"
class="btn"
@click="saveImg"
/>
</view>
</u-popup>
</view>
</template>
<script>
import {
getCountyFamousCityShop,
getCountyFamousCityNews,
getCountyFamousCityGuide,
postCountyFamousShopZan,
postCountyFamousShopAddFavorite,
postCountyFamousShopRemoveFavorite,
postCountyFamousNewsZan,
postCountyFamousNewsView,
getCountyFamousIndustry,
getCountyFamousIndustryProject,
getCountyFamousInvestmentFile,
getCountyFamousVillage,
getCountyFamousCityDetail,
getShareImg
} from '@/api/qianxian'
import {formatDateTime} from '@/utils'
import {getUrlParam} from '@/utils/common.js'
import imgBox from '@/components/imageTypeSet/imagebox.vue'
import XddProductItem from '@/components/xdd-product-item'
import cookie from '@/utils/store/cookie'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
components: {
imgBox,
XddProductItem
},
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
isLoad: false,
activeIndex: 0,
loading: false,
scrollData: {},
inn: {
cityName: '',
pics: [],
desc: '',
latitude: '',
longitude: ''
},
showShare: false,
posterUrl: '', // 分享海报
id: null,
partnerId: null,
isLike: false, //点赞
isFavorite: false,
favoriteCount: 0,
videoStyle: {
width: '750rpx',
height: '500rpx'
},
tabList: [
{ text: '产业', value: 0, isShow: true },
{ text: '文化', value: 1, isShow: true },
{ text: '攻略', value: 2, isShow: true },
{ text: '资讯', value: 3, isShow: true },
{ text: '产品', value: 4, isShow: true }
],
// 资讯
infoArray: [],
// 攻略
guideList: [],
isLoadGuideListoSuccess: false,
isLoadInfoListSuccess: false,
pageKeyId: '',
shareImg: '',
// 县城介绍展开收起
toggleCountyIntroStatus: false,
// 重点产业列表
industryList: [],
// 产业项目列表
industryProjectList: [],
// 招商政策文件列表
investmentFileList: [],
// 村屋列表
villageList: [],
industryTab: [
{ name: '产业项目', icon: '/page/qianxian/icon-04.png' },
{ name: '招商政策', icon: '/page/qianxian/icon-03.png' },
{ name: '租售资讯', icon: '/page/qianxian/icon-07.png' }
],
industryTabIndex: 0,
// 产品
leftList: [],
rightList: [],
videoPlayers:[]
}
},
// 必须在页面加 onPageScroll(e){} ,才能滑动显示背景
onPageScroll(e) {
this.scrollData = e
},
onLoad(options) {
const id = options.id || ''
this.id = id
if (id) {
this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync()
if (options.scene || obj.query.scene) {
const query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene)
this.partnerId = getUrlParam(query, 'partnerId') || null
this.id = getUrlParam(query, 'id') || null
}
}
if (this.partnerId) cookie.set('spread', this.partnerId)
this.getShopDetailReq()
this.getInfoReq()
this.getGuideReq()
// this.initPoster()
this.getListReq()
},
methods: {
goStore(item) {
if (item.farmerShopId === 0) {
uni.showToast({
title: '店铺装修中~',
icon: 'none',
duration: 3000
})
return
}
uni.navigateTo({
url: '/pagesInn/inn/farmerStore?id=' + item.farmerShopId + '&isQianxian=1&from=famous&isFarmer=1'
})
},
load() {
this.$refs.uReadMore.init();
},
goGoodsCon(item) {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: item.productId
}
})
},
getListReq() {
// getPoster(this.id).then(({data}) => this.posterUrl = data)
getCountyFamousIndustry({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.industryList = data.records || []
}
})
getCountyFamousIndustryProject({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.industryProjectList = data.records || []
}
})
getCountyFamousInvestmentFile({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.investmentFileList = data.records || []
}
})
getCountyFamousVillage({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.villageList = data.records || []
}
})
getCountyFamousCityDetail(this.id).then(res => {
const { success, data } = res
if (success) {
const products = data.products || []
const farmerShops = data.farmerShops || []
this.leftList = this.newSort(products, farmerShops)
}
})
},
newSort(a, b) {
const minLen = Math.min(a.length, b.length)
const megerMap = []
for (let i = 0; i < minLen; i ++) {
if(i % 2 === 0) {
megerMap.push(a[i], b[i])
} else {
megerMap.push(b[i], a[i])
}
}
if(a.length > minLen) {
megerMap.push(...a.slice(minLen))
}
if(b.length > minLen) {
megerMap.push(...b.slice(minLen))
}
return megerMap
},
shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
},
sortProductsAndStores(products, stores) {
const randomMap = []
const randomProduct = products.length === 0 ? null : products.length === 1 ? products[0] : products[Math.floor(Math.random() * products.length)]
const store = stores.length === 0 ? null : stores.length === 1 ? stores[0] : stores[Math.floor(Math.random() * stores.length)]
if(!randomProduct && !store) {
return []
}
if(!randomProduct && store) {
return stores
}
if(randomProduct && !store) {
return products
}
if(randomProduct && store) {
randomMap[0] = randomProduct
randomMap[1] = store
const _p = products.filter(e => e !== randomProduct)
const _s = stores.filter(e => e !== store)
const concatArr = this.shuffleArray(_p.concat(_s))
return randomMap.concat(concatArr);
}
},
getShopDetailReq() {
const _this = this
getCountyFamousCityShop({ countyFamousDataId: _this.id }).then((res) => {
const { success, data } = res
if (success) {
_this.inn = data
_this.isLike = data.hasZan
_this.isFavorite = data.hasFavorite
_this.favoriteCount = data.favoriteCount
_this.inn.latitude = _this.inn.latitude > 0 ? _this.inn.latitude : 24.993587
_this.inn.longitude = _this.inn.longitude > 0 ? _this.inn.longitude : 102.779656
// coverType: 1-图片,2-视频
if (data.coverType === 2) {
uni.getSystemInfo({
success: info => {
const screenWidth = info.windowWidth
_this.videoStyle.width = screenWidth + 'px'
_this.videoStyle.height = screenWidth * 500 / 750 + 'px'
}
})
}
_this.isLoad = true
}
}).finally(() => {
uni.stopPullDownRefresh()
})
},
// 资讯
getInfoReq() {
const _this = this
if (_this.loading) {
return
}
_this.isLoadInfoListSuccess = false
_this.loading = true
_this.infoArray = []
getCountyFamousCityNews({
page: 1,
limit: 9999,
countyFamousDataId: _this.id
}).then(res => {
const { data } = res
_this.loading = false
_this.infoArray.push.apply(_this.infoArray, _this.toTop(data.records).map((info) => {
var pt = info.createTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
info.showMore = false
return info
}))
// console.log(this.toTop(_this.infoArray));
}).finally(() => {
_this.loading = false
_this.isLoadInfoListSuccess = true
uni.stopPullDownRefresh()
})
},
toTop(arr) {
return arr.sort((a, b) => {
return b.isTop - a.isTop
})
},
// 攻略
getGuideReq() {
const _this = this
if (_this.loading) {
return
}
_this.isLoadGuideListoSuccess = false
_this.loading = true
_this.guideList = []
getCountyFamousCityGuide({
page: 1,
limit: 9999,
countyFamousDataId: _this.id
}).then(res => {
const { data } = res
_this.loading = false
_this.guideList.push.apply(_this.guideList, data.records.map((info) => {
var pt = info.createTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
return info
}))
}).finally(() => {
_this.loading = false
_this.isLoadGuideListoSuccess = true
uni.stopPullDownRefresh()
})
},
changeTab(index) {
this.activeIndex = index
this.loading = false
// 刷新数据
switch (this.activeIndex) {
case 3:
this.getInfoReq()
break
case 2:
this.getGuideReq()
break
default:
break
}
},
changeShare() {
uni.showLoading()
getShareImg(this.id).then(res => {
this.posterUrl = res.data
this.showShare = !this.showShare
}).finally(() => {
uni.hideLoading()
})
},
closeShare() {
this.showShare = false
},
saveImg() {
const _this = this
uni.getSetting({
success: getRes => {
if (getRes.authSetting["scope.writePhotosAlbum"]) {
_this.downloadImage()
} else {
uni.authorize({
scope: "scope.writePhotosAlbum",
success: () => {
_this.downloadImage()
},
fail: () => {
uni.openSetting({
success: openRes => {
console.log(typeof openRes, openRes)
},
fail: () => {
uni.showToast({
title: "请在设置中打开对应权限",
icon: "none"
})
}
})
}
})
}
},
fail: (err) => {
console.log(err, 2)
}
})
},
downloadImage() {
const _this = this
const randomID = () => Math.random().toString(36).substring(2)
uni.downloadFile({
url: this.posterUrl, // 网络图片的地址
filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", // 指定的本地文件路径
success: downRes => {
uni.saveImageToPhotosAlbum({
filePath: downRes.filePath, // 临时文件地址
success: function () {
uni.showToast({
title: "保存成功",
icon: "success",
success() {
_this.showShare = false
}
})
},
fail: function (err) {
uni.showToast({
title: err,
icon: "none"
})
}
})
},
fail: function (err) {
uni.showToast({
title: err.errMsg,
icon: "error"
})
}
})
},
zanInn() {
postCountyFamousShopZan({ countyFamousDataId: this.id }).then(() => {
this.isLike = !this.isLike
this.getShopDetailReq()
}).catch((err) => {
uni.showToast({
title: err.msg + '',
icon: 'none',
mask: false,
duration: 1500
})
})
},
infoClick(info) {
// this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id)
},
coverPlay(){
this.videoPlayers.forEach(player => {
const playerCtx = uni.createVideoContext(player, this)
playerCtx.pause()
})
},
infoItemViewClick(item, index) {
if(item.type === 2) {
const coverCtx = uni.createVideoContext('coverVideo', this)
coverCtx.pause()
const playerId = 'video-item' + index
if(this.videoPlayers.includes(playerId)) {
this.videoPlayers.forEach(player => {
if(player === playerId) return
const playerCtx = uni.createVideoContext(player, this)
playerCtx.pause()
})
} {
this.videoPlayers.push(playerId)
this.videoPlayers.forEach(player => {
if(player === playerId) return
const playerCtx = uni.createVideoContext(player, this)
playerCtx.pause()
})
}
this.$emit('video')
}
uni.$u.debounce(() => {
postCountyFamousNewsView({ countyFamousNewsId: item.id }).finally(() => {
this.infoArray.map(info => {
if (info.id === item.id) {
info.pv += 1
}
})
})
}, 500)
},
// 定位
showLocation() {
if (!this.inn.latitude || !this.inn.longitude) {
this.$dialog.error('暂无位置信息')
} else {
uni.openLocation({
latitude: this.inn.latitude,
longitude: this.inn.longitude
})
}
},
async doneFavorite() {
if (this.isFavorite) {
const res = await postCountyFamousShopRemoveFavorite({ countyFamousDataId: this.id })
if (res.success) {
this.isFavorite = false
this.favoriteCount = res.data.favoriteCount
}
} else {
const res = await postCountyFamousShopAddFavorite({ countyFamousDataId: this.id })
if (res.success) {
this.isFavorite = true
this.favoriteCount = res.data.favoriteCount
}
}
},
call() {
if (this.inn.tel) {
uni.makePhoneCall({
phoneNumber: this.inn.tel
})
} else {
this.$dialog.error('电话为空')
}
},
// 展开收起
toggleCountyIntro() {
this.toggleCountyIntroStatus = !this.toggleCountyIntroStatus
},
showPic(index) {
uni.previewImage({
current: index,
urls: this.inn.countyImages
})
},
likeInfoItemHandle(item, index, value, voValue) {
postCountyFamousNewsZan({ countyFamousNewsId: item.id }).then(res => {
const { success } = res
if (success) {
this.$dialog.toast({
mes: '操作成功!'
})
this.$set(this.infoArray[index], 'zan', value)
this.$set(this.infoArray[index], 'hasZan', voValue)
}
})
},
guideItemClickHandle(item) {
// 如果没有开启专题页,则不进入
if (!item.isContentPage) return
uni.navigateTo({ url: `/pkg_product/views/famousQianxianTheme?id=${item.id}` })
},
industryTabItemClick(index) {
if (index === this.industryTabIndex) return
this.industryTabIndex = index
},
fileItemClick(file) {
const url = file.attachment || ''
if (!url) return
uni.downloadFile({
url,
success: res => {
const filePath = res.tempFilePath
wx.openDocument({
filePath,
fail: (err) => {
console.log(err)
}
})
}
})
},
gotoInvestment(title = '', type = 'investment', id = '') {
uni.navigateTo({ url: `/pkg_product/views/famousQianxianInvestment?id=${id || this.id}&title=${title}&type=${type}` })
},
villageItemClick(item) {
uni.navigateTo({ url: `/pkg_product/views/famousQianxianVillageShop?id=${item.id}` })
}
}
}
</script>
<style scoped lang="less">
@import "@/assets/css/store.less";
.video-item {
width: 100%;
height: 400rpx;
border-radius: 10rpx;
}
.focus-img {
position: relative;
.img {
position: relative;
z-index: 2;
display: block;
width: 100%;
height: 345rpx;
border-radius: 20rpx;
}
.mark-img {
position: absolute;
top: 0;
right: 0;
z-index: 3;
display: block;
width: 100%;
height: 100%;
border-radius: 0 25rpx 0 0;
}
}
.btn {
.img {
display: block;
width: 48rpx;
height: 48rpx;
}
}
.my-inn-page {
padding: 0 0 100rpx 0;
background-color: #f6f6f6;
}
.cover-box {
position: relative;
.full-img {
width: 750rpx;
}
.video {
display: block;
width: 100%;
height: 100%;
}
}
.guarantee {
margin-right: 16rpx;
padding: 8rpx 16rpx;
border-radius: 8rpx;
background: #0DC5C5;
color: #fff;
font-size: 22rpx;
line-height: 1;
}
.zan-favorite-wrap {
font-size: 32rpx;
color: #333;
.on {
color: #FF564A;
}
}
.zan-box {
.img {
width: 36rpx;
height: 36rpx;
margin: 0 8rpx 0 0;
vertical-align: middle;
}
}
.favorite-box {
.icon {
width: 36rpx;
height: 36rpx;
margin: 0 8rpx 0 30rpx;
}
}
.store-img {
width: 686rpx;
margin-bottom: 20rpx;
vertical-align: middle;
}
.container {
position: relative;
background: #FFFFFF;
}
.innInfoWrap {
position: relative;
margin-top: -76rpx;
padding: 20rpx 36rpx;
line-height: 1;
z-index: 1;
.bg-color {
position: absolute;
top: -5px;
left: 0;
right: 0;
z-index: 1;
height: 50%;
background: linear-gradient(-180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);
.box-mask {
position: absolute;
bottom: 0;
right: 0;
left: 166rpx;
box-sizing: border-box;
padding: 0 32rpx 12rpx 0;
.city-section {
width: 100%;
}
}
}
.body-cont {
position: relative;
z-index: 2;
}
}
.inn-logo {
flex-shrink: 0;
width: 56*2rpx;
height: 56*2rpx;
margin-right: 18rpx;
}
.inn-logo image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.inn-name {
width: 280rpx;
font-size: 32rpx;
color: #FFFFFF;
line-height: 48rpx;
}
.inn-owner {
font-size: 24rpx;
color: #8B8F99;
}
.inn-tag-wrap {
margin-top: 10rpx;
}
.inn-signature-wrap {
position: relative;
z-index: 5;
padding: 0 32rpx;
margin: 20rpx 0 0 0;
.triangle {
position: absolute;
top: -20rpx;
left: 72rpx;
width: 0;
height: 0;
border-left: 20rpx solid transparent;
border-right: 20rpx solid transparent;
border-bottom: 24rpx solid rgba(243,243,246,0.39);
}
.inn-signature {
position: relative;
padding: 20rpx;
border-radius: 8rpx;
font-size: 24rpx;
color: #080F1A;
background: rgba(243,243,246,0.39);
box-shadow: 0px 6px 12px rgba(0,0,0,0.12);
}
.share-btn {
position: absolute;
right: 0;
bottom: -68rpx;
.img {
width: 212rpx;
height: 60rpx;
}
}
}
.btLine {
width: 100%;
height: 6rpx;
margin-top: 18rpx;
background: #0DC5C5;
}
.tab-item-active {
color:#080F1A;
font-size:32rpx;
}
.tab-item-no-active {
color:#A6AAB3;
font-size:28rpx;
}
.map-wrapper {
position: relative;
z-index: 2;
height: 200rpx;
margin: 40rpx 0 0 0;
overflow: hidden;
.map-cont {
position: absolute;
top: 0;
left: 0;
z-index: 2;
width: 100%;
opacity: 0.3;
transform: translateY(-50rpx);
}
.bg {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 3;
height: 60rpx;
background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}
.map-info {
position: relative;
z-index: 5;
display: flex;
align-items: center;
padding: 40rpx 10rpx 40rpx 32rpx;
color: #333;
font-size: 14px;
.map-info-hd {
.icon {
display: block;
width: 34rpx;
height: 42rpx;
}
}
.map-info-bd {
flex: 1;
padding: 0 60rpx 0 20rpx;
line-height: 60rpx;
}
.map-info-ft {
.item + .item {
margin: 0 0 0 6rpx;
}
.item {
text-align: center;
font-weight: 500;
.img {
display: block;
width: 64rpx;
height: 64rpx;
margin: 0 0 16rpx 16rpx;
}
}
}
}
}
.top-tab {
padding: 40rpx 20rpx 20rpx 20rpx;
.tab {
width: 20%;
.tab-item {
height: 52rpx;
padding: 0 30rpx;
border-radius: 26rpx 0 0 26rpx;
font-size: 32rpx;
line-height: 52rpx;
font-weight: bold;
&.active {
color: #fff;
background: linear-gradient(90deg, #C52733 0%, rgba(211,92,101,0.91) 54%, rgba(255,255,255,0.62) 100%);
}
}
}
}
.info-section,
.guide-section {
position: relative;
background-color: #f6f6f6;
}
.info-section,
.guide-section {
padding: 22rpx;
}
.info-section {
.info-item + .info-item {
margin: 22rpx 0 0 0;
}
.info-item {
border-radius: 10rpx;
background-color: #fff;
.info-item-header {
position: relative;
padding: 20rpx 20rpx 0 20rpx;
&.info-item-top {
padding-top: 60rpx;
background-size: 100% 80rpx;
background-repeat: no-repeat;
background-image: url();
}
.name {
font-size: 16px;
color: #333;
font-weight: bold;
}
.intro {
margin: 10rpx 0 0 0;
color: #666;
font-size: 14px;
}
}
.info-item-body {
padding: 0 20rpx 20rpx 20rpx;
.video {
padding: 20rpx 0 0 0;
.video-item {
width: 100%;
height: 400rpx;
border-radius: 10rpx;
}
}
}
.info-item-bottom {
display: flex;
align-items: center;
padding: 20rpx;
border-top: 1px solid #f1f1f1;
font-size: 16px;
.time {
flex: 1;
color: #333;
}
.btns {
display: flex;
color: #999;
.flex + .flex {
margin: 0 0 0 32rpx;
}
.flex {
align-items: center;
}
.icon {
width: 32rpx;
height: 32rpx;
margin: 0 8rpx 0 0;
}
.zan-off-icon {
width: 40rpx;
height: 40rpx;
}
.zan-on-icon {
width: 40rpx;
height: 40rpx;
}
.seeNum-txt {
&.on {
color: #D81E06;
}
}
.more-btn {
position: relative;
.more-wrapper {
position: absolute;
right: -20rpx;
top: -150rpx;
z-index: 5;
width: 200rpx;
border-radius: 12rpx;
background-color: #fff;
box-shadow: 0px 1px 6px rgba(0,0,0,0.16);
.more-item + .more-item {
border-top: 1px solid #d5d5d5;
}
.more-item {
display: flex;
align-items: center;
justify-content: center;
height: 70rpx;
font-size: 14px;
color: #333;
.more-icon {
width: 36rpx;
height: 36rpx;
margin: 0 10rpx 0 0;
}
}
}
}
}
}
}
}
.county-section {
padding: 22rpx;
}
.county-intro-wrap {
padding: 22rpx;
border-radius: 16rpx;
background-color: #fff;
.title {
display: flex;
justify-content: space-between;
font-size: 36rpx;
line-height: 40rpx;
font-weight: bold;
color: #333;
.btn {
display: flex;
align-items: center;
color: #999;
font-size: 24rpx;
font-weight: normal;
.icon {
display: block;
width: 32rpx;
height: 32rpx;
}
}
}
.intro-main {
position: relative;
height: 400rpx;
min-height: 400rpx;
margin: 30rpx 0 50rpx 0;
overflow: hidden;
&.show-more {
height: auto;
}
.layer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 144rpx;
background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #FFFFFF 51%, #FFFFFF 100%);
}
}
.pic-list {
width: 660rpx;
padding: 30rpx 0 0 0;
margin: 0 auto;
.item {
margin: 0 20rpx 20rpx 0;
.img {
display: block;
width: 320rpx;
height: 320rpx;
border-radius: 16rpx;
}
&:nth-child(2n) {
margin-right: 0;
}
}
}
}
.guide-section {
.guide-item + .guide-item {
margin: 20rpx 0 0 0;
}
.guide-item {
border-radius: 16rpx;
background-color: #fff;
.img {
display: block;
width: 100%;
border-radius: 16rpx;
}
.info-wrap {
padding: 16rpx 16rpx 20rpx 16rpx;
.time {
font-size: 24rpx;
color: #ACACAC;
}
.title {
padding: 10rpx 0 0 0;
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
}
}
}
.industry-section {
background-color: #F0F0F0;
.card-wrap {
position: relative;
.bg {
position: relative;
z-index: 2;
display: block;
width: 750rpx;
height: 518rpx;
}
.bg3 {
height: 1159rpx;
}
.card-cont {
position: absolute;
z-index: 5;
top: 20rpx;
left: 30rpx;
right: 30rpx;
.tab-wrap {
display: flex;
.item {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
height: 80rpx;
font-size: 32rpx;
line-height: 36rpx;
font-weight: bold;
.icon {
display: block;
width: 24rpx;
height: 26rpx;
margin: 0 12rpx 0 0;
}
&:nth-child(2) {
.icon {
width: 26rpx;
height: 22rpx;
}
}
}
}
.file-wrap {
width: 630rpx;
height: 360rpx;
padding: 20rpx;
margin: 10rpx auto;
border-radius: 20rpx;
box-sizing: border-box;
background: rgba(240,240,240,0.39);
.title {
display: flex;
align-items: center;
font-weight: bold;
font-size: 28rpx;
line-height: 36rpx;
.icon {
display: block;
width: 20rpx;
height: 20rpx;
margin: 0 8rpx 0 0;
}
}
.file-list {
height: 300rpx;
overflow-y: auto;
.list-cont {
padding: 20rpx 0 0 0;
.file-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 60rpx;
width: 100%;
padding: 0 20rpx;
margin: 0 0 20rpx 0;
border-radius: 20rpx;
box-sizing: border-box;
line-height: 36rpx;
background-color: #fff;
.name {
width: calc(100% - 40rpx);
font-size: 24rpx;
}
.icon {
display: block;
width: 26rpx;
height: 26rpx;
}
}
.file-item2 {
height: 100rpx;
}
}
}
}
.village-wrap {
height: 980rpx;
padding: 16rpx 0 0 0;
overflow-y: auto;
}
.village-list {
display: flex;
flex-wrap: wrap;
width: 660rpx;
margin: 0 auto;
.village-item {
width: 320rpx;
height: 480rpx;
margin: 0 20rpx 20rpx 0;
border-radius: 16rpx;
background-color: #f0f0f0;
&:nth-child(2n) {
margin-right: 0;
}
.img-wrap {
position: relative;
.img {
display: block;
width: 320rpx;
height: 320rpx;
border-radius: 16rpx;
}
.location {
position: absolute;
bottom: 0;
left: 0;
right: 0;
z-index: 5;
display: flex;
align-items: center;
height: 60rpx;
padding: 0 20rpx;
border-radius: 0 0 16rpx 16rpx;
font-size: 28rpx;
line-height: 36rpx;
color: #fff;
background: linear-gradient(180deg, rgba(0,0,0,0) 0%, #000000 100%);
.icon {
display: block;
width: 28rpx;
height: 28rpx;
margin: 0 8rpx 0 0;
}
.addr {
width: calc(100% - 40rpx);
}
}
}
.info {
padding: 6rpx 8rpx 16rpx 8rpx;
.intro {
height: 80rpx;
line-height: 40rpx;
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-top: 8rpx;
}
.name-wrap {
display: flex;
align-items: center;
.logo {
display: block;
width: 48rpx;
height: 48rpx;
margin: 0 8rpx 0 0;
border-radius: 50%;
}
.name {
width: calc(100% - 60rpx);
padding: 10rpx 0 0 0;
font-size: 28rpx;
line-height: 48rpx;
color: #999;
}
}
}
}
}
}
}
.project-wrap {
padding: 30rpx;
.title {
display: flex;
align-items: center;
font-weight: bold;
font-size: 28rpx;
line-height: 36rpx;
.icon {
display: block;
width: 20rpx;
height: 20rpx;
margin: 0 8rpx 0 0;
}
}
.list {
display: flex;
flex-wrap: wrap;
width: 100%;
padding: 20rpx 0 0 0;
.item {
width: calc(50% - 20rpx);
margin: 0 26rpx 26rpx 0;
&:nth-child(2n) {
margin-right: 0;
}
.img {
display: block;
width: 332rpx;
height: 98rpx;
}
}
}
}
.no-data {
text-align: center;
line-height: 200rpx;
font-size: 32rpx;
color: #999;
}
.more-btn-wrap {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 0 60rpx 0;
.more-btn {
width: 212rpx;
height: 62rpx;
border-radius: 32rpx;
text-align: center;
font-size: 32rpx;
line-height: 62rpx;
color: #fff;
background: #C52733;
}
}
}
.good-list-wrap {
background-color: #f6f6f6;
.loadend {
width: 100%;
}
}
.good-list-cont {
position: relative;
z-index: 2;
// display: flex;
// justify-content: space-between;
padding: 20rpx;
grid-column-gap: 10px;
grid-row-gap: 10px;
.list-cont-left,
.list-cont-right {
width: calc(50% - 11rpx);
}
.item {
position: relative;
margin: 21rpx 0 0 0;
}
}
.tab-no-data {
text-align: center;
font-size: 32rpx;
color: #999;
line-height: 200rpx;
}
.no-data-loadend {
width: 100%;
}
.f-wrap{
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
}
</style>