|
@@ -18,38 +18,40 @@
|
|
|
<source-report-vue :showStep="false"></source-report-vue>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <l-floating-panel :height="panelHeight" @heightChange="changePanel" :anchors="anchors" :defaultAnchor="2" :content-draggable="false">
|
|
|
+ <l-floating-panel v-model:height="panelHeight" ref="floatingPanelRef" @heightChange="changePanel" :anchors="anchors" :defaultAnchor="2" :content-draggable="false">
|
|
|
<view class="panel-content" ref="scrollViewRef">
|
|
|
<view class="panel-title">
|
|
|
<view class="title-l">
|
|
|
- <image class="garden-img" :src="`${config.BASIC_IMG}home/garden.png`" mode=""></image>
|
|
|
+ <image class="garden-img" :src="gardenDetail?.icon" mode=""></image>
|
|
|
<view class="title-info">
|
|
|
<view class="title-garden">
|
|
|
- 从化荔枝博览园
|
|
|
+ {{gardenInfo?.farmName}}
|
|
|
</view>
|
|
|
<view class="btn-second">
|
|
|
有味指数
|
|
|
- <text>4.5分</text>
|
|
|
+ <text>{{gardenInfo?.youweiIndex}}分</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="title-r">
|
|
|
+ <!-- <view class="title-r">
|
|
|
+
|
|
|
<text class="add-text">关注</text>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
<view class="garden-home" v-show="activeMenu === 0">
|
|
|
<view class="panel-video">
|
|
|
<!-- <video class="video-dom" src="https://birdseye-img.sysuimars.com/temp/5-25lby.mp4" controls></video> -->
|
|
|
|
|
|
- <video src="https://birdseye-img.sysuimars.com/temp/5-25lby.mp4" object-fit="cover" :show-fullscreen-btn="false"
|
|
|
+ <video :src="gardenDetail?.coverVideo" object-fit="cover" :show-fullscreen-btn="false"
|
|
|
:autoplay="true" class="video-dom" loop muted controls>
|
|
|
</video>
|
|
|
</view>
|
|
|
<!-- 果园热卖 -->
|
|
|
- <hot-component-vue :isGardeItem="true"></hot-component-vue>
|
|
|
+ <view class="hot-box" v-if="currentFarmId">
|
|
|
+ <hot-component-vue :isGardeItem="true" :farmId="currentFarmId"></hot-component-vue>
|
|
|
+ </view>
|
|
|
<view class="garden-detail">
|
|
|
- <view class="detial-item">
|
|
|
+ <view class="detial-item" v-if="gardenDetail?.ecology">
|
|
|
<view class="sub-title">
|
|
|
<view class="line-l"></view>
|
|
|
<view class="title-text">
|
|
@@ -58,31 +60,31 @@
|
|
|
<view class="line-r"></view>
|
|
|
</view>
|
|
|
<view class="detail-img">
|
|
|
- <up-image class="img-dom" radius="8" width="100%" :src="`${config.BASIC_IMG}home/fruit.png`" mode="widthFix"></up-image>
|
|
|
+ <up-image class="img-dom" radius="8" width="100%" :src="gardenDetail?.ecology" mode="widthFix"></up-image>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="detial-item">
|
|
|
+ <view class="detial-item" v-if="gardenDetail?.plantImage">
|
|
|
<view class="sub-title">
|
|
|
<view class="line-l"></view>
|
|
|
<view class="title-text">
|
|
|
- 果园生态
|
|
|
+ 果园种植
|
|
|
</view>
|
|
|
<view class="line-r"></view>
|
|
|
</view>
|
|
|
<view class="detail-img">
|
|
|
- <up-image class="img-dom" radius="8" width="100%" :src="`${config.BASIC_IMG}home/fruit.png`" mode="widthFix"></up-image>
|
|
|
+ <up-image class="img-dom" radius="8" width="100%" :src="gardenDetail.plantImage" mode="widthFix"></up-image>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="detial-item">
|
|
|
+ <view class="detial-item" v-if="gardenDetail?.varietyImage">
|
|
|
<view class="sub-title">
|
|
|
<view class="line-l"></view>
|
|
|
<view class="title-text">
|
|
|
- 果园生态
|
|
|
+ 果园品种
|
|
|
</view>
|
|
|
<view class="line-r"></view>
|
|
|
</view>
|
|
|
<view class="detail-img">
|
|
|
- <up-image class="img-dom" radius="8" width="100%" :src="`${config.BASIC_IMG}home/fruit.png`" mode="widthFix"></up-image>
|
|
|
+ <up-image class="img-dom" radius="8" width="100%" :src="gardenDetail.varietyImage" mode="widthFix"></up-image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -97,9 +99,19 @@
|
|
|
</view>
|
|
|
<view class="filter-item" :class="{'active': filterIndex === 1}" @click="selectFilter(1)">
|
|
|
价格
|
|
|
+ <div class="filter-icon">
|
|
|
+ <image v-show="filterIndex !== 1" style="width: 14px; height: 14px;padding-top: 2px;" :src="`${config.BASIC_IMG}home/filter-icon.png`" mode=""></image>
|
|
|
+ <image v-show="filterIndex === 1 && orderType===true" style="width: 14px; height: 14px;padding-top: 2px;" :src="`${config.BASIC_IMG}home/filter-icon-1.png`" mode=""></image>
|
|
|
+ <image v-show="filterIndex === 1 && orderType===false" style="width: 14px; height: 14px;padding-top: 2px;" :src="`${config.BASIC_IMG}home/filter-icon-2.png`" mode=""></image>
|
|
|
+ </div>
|
|
|
</view>
|
|
|
<view class="filter-item" :class="{'active': filterIndex === 2}" @click="selectFilter(2)">
|
|
|
销量
|
|
|
+ <div class="filter-icon">
|
|
|
+ <image v-show="filterIndex !== 2" style="width: 14px; height: 14px;padding-top: 2px;" :src="`${config.BASIC_IMG}home/filter-icon.png`" mode=""></image>
|
|
|
+ <image v-show="filterIndex === 2 && orderType===true" style="width: 14px; height: 14px;padding-top: 2px;" :src="`${config.BASIC_IMG}home/filter-icon-1.png`" mode=""></image>
|
|
|
+ <image v-show="filterIndex === 2 && orderType===false" style="width: 14px; height: 14px;padding-top: 2px;" :src="`${config.BASIC_IMG}home/filter-icon-2.png`" mode=""></image>
|
|
|
+ </div>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -127,6 +139,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="no-data" v-if="!discoverData || !discoverData.length">
|
|
|
+ 当前果园暂未上架商品,请耐心等候
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -151,7 +166,8 @@
|
|
|
import config from "@/api/config.js"
|
|
|
import hotComponentVue from '../hotComponent.vue'
|
|
|
import sourceReportVue from './sourceReport.vue'
|
|
|
-
|
|
|
+ import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
|
+ import HOME from '@/api/home'
|
|
|
|
|
|
const typeSearch = ref(null)
|
|
|
|
|
@@ -161,29 +177,50 @@
|
|
|
const anchors = [
|
|
|
50,
|
|
|
Math.round(0.5 * windowHeight),
|
|
|
- Math.round(0.86 * windowHeight),
|
|
|
+ Math.round(0.92 * windowHeight),
|
|
|
];
|
|
|
const panelHeight = ref(anchors[2]);
|
|
|
|
|
|
function changePanel({height}) {
|
|
|
if (height === 50) {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/tabBar/home/subPages/sourceReport"
|
|
|
+ url: `/pages/tabBar/home/subPages/sourceReport?farmId=${currentFarmId.value}`
|
|
|
})
|
|
|
}
|
|
|
- console.log('height',height)
|
|
|
}
|
|
|
|
|
|
const activeMenu = ref(0)
|
|
|
const scrollViewRef = ref(null)
|
|
|
function changeMenu(i) {
|
|
|
activeMenu.value = i
|
|
|
- nextTick(() => {
|
|
|
- scrollViewRef.value.scrollTo({
|
|
|
- top: 0,
|
|
|
- duration: 300 // 动画时间(ms)
|
|
|
- });
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
+ const currentFarmId = ref(null)
|
|
|
+ onLoad(({farmId})=>{
|
|
|
+ currentFarmId.value = farmId||766
|
|
|
+ getFarmInfo()
|
|
|
+ getFarmDetail()
|
|
|
+ getGoodsList()
|
|
|
+ })
|
|
|
+ const floatingPanelRef = ref(null)
|
|
|
+ onShow(() => {
|
|
|
+ nextTick(() => {
|
|
|
+ floatingPanelRef.value && floatingPanelRef.value.toAnchor(2)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ const gardenInfo = ref({})
|
|
|
+ function getFarmInfo() {
|
|
|
+ HOME.fetchGardenInfo({farmId: currentFarmId.value, isLighten: 1}).then(({data}) => {
|
|
|
+ gardenInfo.value = data
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const gardenDetail = ref({})
|
|
|
+ function getFarmDetail() {
|
|
|
+ HOME.fetchGardenDetail({farmId: currentFarmId.value}).then(({data}) => {
|
|
|
+ gardenDetail.value = data
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// 好味
|
|
@@ -191,35 +228,37 @@
|
|
|
const filterIndex = ref(0)
|
|
|
const activeType = ref(0)
|
|
|
|
|
|
- const discoverData = ref([
|
|
|
- {
|
|
|
- name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
|
|
|
- text: "",
|
|
|
- price: '107',
|
|
|
- sold: "1250"
|
|
|
- },
|
|
|
- {
|
|
|
- name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
|
|
|
- text: "",
|
|
|
- price: '107',
|
|
|
- sold: "1250"
|
|
|
- },
|
|
|
- {
|
|
|
- name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
|
|
|
- text: "",
|
|
|
- price: '107',
|
|
|
- sold: "1250"
|
|
|
- },
|
|
|
- {
|
|
|
- name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
|
|
|
- text: "",
|
|
|
- price: '107',
|
|
|
- sold: "1250"
|
|
|
- }
|
|
|
- ])
|
|
|
+ const discoverData = ref([])
|
|
|
+ let sortObj = {
|
|
|
+ 0: "id",
|
|
|
+ 1: "price",
|
|
|
+ 2: "salesVal"
|
|
|
+ }
|
|
|
|
|
|
+ const orderType = ref(true)
|
|
|
function selectFilter(i) {
|
|
|
+ if (filterIndex.value !== i) {
|
|
|
+ orderType.value = false
|
|
|
+ }
|
|
|
filterIndex.value = i
|
|
|
+ sort.value = sortObj[i]
|
|
|
+ orderType.value = !orderType.value
|
|
|
+ getGoodsList()
|
|
|
+ }
|
|
|
+ const sort = ref("id")
|
|
|
+ function getGoodsList() {
|
|
|
+ let params = {sort: sort.value, farmId: currentFarmId.value,}
|
|
|
+ if (filterIndex.value !== 0) {
|
|
|
+ params = {
|
|
|
+ ...params,
|
|
|
+ order: orderType.value ? "asc" : "desc"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ HOME.fetchGoodsList(params).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ discoverData.value = data
|
|
|
+ })
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -416,6 +455,7 @@
|
|
|
.discover-content {
|
|
|
|
|
|
.discover-filter {
|
|
|
+ padding-top: 30rpx;
|
|
|
color: #A6A6A6;
|
|
|
font-size: 28rpx;
|
|
|
display: flex;
|
|
@@ -423,14 +463,25 @@
|
|
|
|
|
|
.filter-item {
|
|
|
padding: 12rpx 20rpx;
|
|
|
-
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
&.active {
|
|
|
color: #000000;
|
|
|
}
|
|
|
+ .filter-icon {
|
|
|
+ padding-left: 4rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.discover-list {
|
|
|
padding-top: 20rpx;
|
|
|
+ .no-data {
|
|
|
+ padding-top: 40rpx;
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: rgba(0, 0, 0, 0.6);
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
.list-line {
|
|
|
padding-bottom: 20rpx;
|
|
|
display: flex;
|