更改首页

This commit is contained in:
魏啾
2024-07-05 18:26:46 +08:00
parent a40cfd9c5f
commit 380a6312f8
19 changed files with 3841 additions and 1179 deletions

View File

@@ -1,223 +1,232 @@
<template>
<view class="content">
<!-- 导航栏 -->
<view class="navbar" :class="{active:opacity}">
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
<view class="status-bar"></view>
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="navbar_tow flex-between" :style="{'marginTop':HeighT.heightBar /2+'px'}">
<view v-if="showindex">
<!-- 导航栏 -->
<view class="navbar" :class="{active:opacity}">
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
<view class="status-bar"></view>
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','marginTop':HeighT.heightBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #ifdef APP-PLUS -->
<view class="navbar_tow flex-between" :style="{'marginTop':HeighT.heightBar /2+'px'}">
<!-- #endif -->
<!-- 标题搜索框 -->
<view class="flex-between">
<view class="navbar_tow_one flex-start" @click="uindexlist">
<text class="textnth-childone">{{NAME}}</text>
<text class="textnth-childtow">{{form.address}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
<view class="navbar_tow_tow flex-start">
<input type="text" class="navbar_tow_towinput" v-model="keyword" placeholder="请输入关键字" />
<view class="navbar_tow_towview">搜索</view>
</view>
</view>
</view>
<!-- 吸顶 -->
<view v-if="isFixedTop" class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 8rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
</view>
</view>
<!-- 以上都是导航栏处理 -->
<!-- 轮播图 -->
<swipers :carousel='hometoplist.carousel'></swipers>
<!-- 广告 -->
<advertisement :bannervo='hometoplist.bannerVO' :itemStyle='itemStyle'
:timersetnteritem='timersetInterval' @changeValue="changeParentValue"></advertisement>
<!-- 金刚区 -->
<diamond :district='hometoplist.district'></diamond>
<!-- 今日上线 -->
<todaylist :todayList='hometoplist.todayList' :salesList='hometoplist.salesList'></todaylist>
<!-- 类目 -->
<view class="fourcontent">
<!-- 用于防止榻卸 -->
<view class="flex-between" style="flex-wrap: inherit;" v-if="!isFixedTop">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text style="margin-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
</view>
</view>
<view class="fivecontent">
<!-- <view class="fivecontent" :style="{'height':seighT + 'px'}"> -->
<!-- <scroll-view :style="{'height':seighT + 'px'}" scroll-y @scrolltolower="loadMore"
scroll-with-animation> -->
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index"
@click="fivecontentclick(item)">
<view class="fivecontent_item_nav flex-start">
<image :src="item.shopImage" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
{{item.shopName}}
</view>
<view>
{{item.districts}}&nbsp;{{item.distances}}
</view>
</view>
<view class="fivecontent_item_nav_lefttopstart flex-start">
<view class="fivecontent_item_nav_leftlang flex-start"
v-for="(s,index1) in item.shopTag" :key="index1"
:style="{'background':s.backColor,'color':s.backColor}">
<image class="fivecontent_item_nav_leftlangimage" v-if="s.shareImg"
:src="s.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_nav_leftlangtext">{{s.name}}</text>
</view>
</view>
</view>
</view>
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_192,h_192`"
mode="aspectFill"></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between"
style="display: flex;justify-content: space-between;align-items: center;">
<view>
{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}
</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="flex-start flexstartboxfttow">
<view class="fivecontent_item_boxitemlefttow flex-start"
v-for="(c,index2) in item.proTag" :key="index2"
:style="{'background':c.backColor,'color':c.backColor}">
<image class="fivecontent_item_boxitemlefttowimage" v-if="c.shareImg"
:src="c.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_boxitemlefttowtext">{{c.name}}</text>
</view>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="fivecontent_item_boxitemlefthere_one flex-start">
<text class="flex_startone">到手</text>
<text class="flex_starttow">¥{{item.salePrice}}</text>
</view>
<view class="fivecontent_item_boxitemlefthere_tow">
{{item.discount || ''}}
</view>
<view class="fivecontent_item_boxitemlefthere_there">
¥{{item.originPrice}}
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<view class="indexboxitemleftthere_countdowntexts">
<uni-countdown @timeup="updateCity" :show-day="false"
:day="item.end_times.d" :hour="item.end_times.h"
:minute="item.end_times.m" :second="item.end_times.s"
:indexs='index' color="#FFFFFF" border-color="#00B26A"
splitorColor="#FFFFFF" :font-size="10"></uni-countdown>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
<!-- </scroll-view> -->
</view>
<!-- 弹出层 -->
<u-popup mode="top" :show="showproductlist" @close="closeproductlist" @open="openproductlist">
<!-- 导航栏 -->
<view class="navbar" :class="{active:opacity}">
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
<view class="status-bar"></view>
<!-- #ifdef MP-WEIXIN -->
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','padding-right':HeighT.custwidth + 'px'}">
:style="{'height':HeighT.customBar+'px','marginTop':HeighT.heightBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="status-bar"></view>
<view class="navbar_tow flex-between">
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','marginTop':HeighT.heightBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- 标题搜索框 -->
<view class="flex-between">
<view class="navbar_tow_one flex-start" @click="uindexlist">
<text class="textnth-childone">{{NAME}}</text>
<text class="textnth-childtow">{{form.address}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
<!-- 标题搜索框 -->
<view class="flex-between">
<view class="navbar_tow_one flex-start" @click="uindexlist">
<text class="textnth-childone">{{NAME}}</text>
<text class="textnth-childtow">{{form.address}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
<view class="navbar_tow_tow flex-start">
<input type="text" class="navbar_tow_towinput" v-model="keyword"
placeholder="请输入关键字" />
<view class="navbar_tow_towview">搜索</view>
</view>
</view>
</view>
<!-- 吸顶 -->
<view v-if="isFixedTop" class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 8rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
</view>
</view>
<!-- 以上都是导航栏处理 -->
<!-- 轮播图 -->
<swipers :carousel='hometoplist.carousel'></swipers>
<!-- 广告 -->
<advertisement :bannervo='hometoplist.bannerVO' :itemStyle='itemStyle'
:timersetnteritem='timersetInterval' @changeValue="changeParentValue"></advertisement>
<!-- 金刚区 -->
<diamond :district='hometoplist.district'></diamond>
<!-- 今日上线 -->
<todaylist :todayList='hometoplist.todayList' :salesList='hometoplist.salesList'></todaylist>
<!-- 类目 -->
<view class="fourcontent">
<!-- 用于防止榻卸 -->
<view class="flex-between" style="flex-wrap: inherit;" v-if="!isFixedTop">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text style="margin-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
</view>
</view>
<view class="fivecontent">
<!-- <view class="fivecontent" :style="{'height':seighT + 'px'}"> -->
<!-- <scroll-view :style="{'height':seighT + 'px'}" scroll-y @scrolltolower="loadMore"
scroll-with-animation> -->
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index"
@click="fivecontentclick(item)">
<view class="fivecontent_item_nav flex-start">
<image :src="item.shopImage" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
{{item.shopName}}
</view>
<view class="navbar_tow_tow flex-start">
<input type="text" class="navbar_tow_towinput" v-model="keyword"
placeholder="请输入关键字" />
<view class="navbar_tow_towview">搜索</view>
<view>
{{item.districts}}&nbsp;{{item.distances}}
</view>
</view>
</view>
<!-- 吸顶 -->
<view class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
</view>
<!-- 显示下拉字段 -->
<view class="sixcontent" v-if="clickhometoplistmenulist.quilt == '1' ">
<view class="sixcontentitemP flex-start" style="padding-bottom:0 ;">
<category style="width: 100%;" :categoryList="clickhometoplistmenulist.detail"
:subCategoryList="subCategoryList" @categoryMainClick="categoryMainClick"
@categorySubClick="categorySubClick">
</category>
</view>
</view>
<view class="sixcontent" v-else>
<view class="sixcontentitemP flex-colum-start">
<view class="sixcontentitemP_item"
:class="index == clickdetailindex ?'sixcontentitemP_itemactive':''"
v-for="(item,index) in clickhometoplistmenulist.detail" :key="index"
@click="clickdetail(item,index)">
{{item.name}}
<view class="fivecontent_item_nav_lefttopstart flex-start">
<view class="fivecontent_item_nav_leftlang flex-start"
v-for="(s,index1) in item.shopTag" :key="index1"
:style="{'background':s.backColor,'color':s.backColor}">
<image class="fivecontent_item_nav_leftlangimage" v-if="s.shareImg"
:src="s.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_nav_leftlangtext">{{s.name}}</text>
</view>
</view>
</view>
</view>
</u-popup>
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_192,h_192`"
mode="aspectFill"></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between"
style="display: flex;justify-content: space-between;align-items: center;">
<view>
{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}
</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="flex-start flexstartboxfttow">
<view class="fivecontent_item_boxitemlefttow flex-start"
v-for="(c,index2) in item.proTag" :key="index2"
:style="{'background':c.backColor,'color':c.backColor}">
<image class="fivecontent_item_boxitemlefttowimage" v-if="c.shareImg"
:src="c.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_boxitemlefttowtext">{{c.name}}</text>
</view>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="fivecontent_item_boxitemlefthere_one flex-start">
<text class="flex_startone">到手</text>
<text class="flex_starttow">¥{{item.salePrice}}</text>
</view>
<view class="fivecontent_item_boxitemlefthere_tow">
{{item.discount || ''}}
</view>
<view class="fivecontent_item_boxitemlefthere_there">
¥{{item.originPrice}}
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text
class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<view class="indexboxitemleftthere_countdowntexts">
<uni-countdown @timeup="updateCity" :show-day="false"
:day="item.end_times.d" :hour="item.end_times.h"
:minute="item.end_times.m" :second="item.end_times.s"
:indexs='index' color="#FFFFFF" border-color="#00B26A"
splitorColor="#FFFFFF" :font-size="10"></uni-countdown>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
<!-- </scroll-view> -->
</view>
<!-- 弹出层 -->
<u-popup mode="top" :show="showproductlist" @close="closeproductlist" @open="openproductlist">
<!-- 导航栏 -->
<view class="navbar" :class="{active:opacity}">
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
<view class="status-bar"></view>
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="status-bar"></view>
<view class="navbar_tow flex-between">
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','marginTop':HeighT.heightBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- 标题搜索框 -->
<view class="flex-between">
<view class="navbar_tow_one flex-start" @click="uindexlist">
<text class="textnth-childone">{{NAME}}</text>
<text class="textnth-childtow">{{form.address}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
<view class="navbar_tow_tow flex-start">
<input type="text" class="navbar_tow_towinput" v-model="keyword"
placeholder="请输入关键字" />
<view class="navbar_tow_towview">搜索</view>
</view>
</view>
</view>
<!-- 吸顶 -->
<view class="fourcontent flex-between">
<view class="fourcontent_item flex-start"
v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;"
name="arrow-down-fill" color="#333333" size="16"></u-icon>
</view>
</view>
<!-- 显示下拉字段 -->
<view class="sixcontent" v-if="clickhometoplistmenulist.quilt == '1' ">
<view class="sixcontentitemP flex-start" style="padding-bottom:0 ;">
<category style="width: 100%;"
:categoryList="clickhometoplistmenulist.detail"
:subCategoryList="subCategoryList"
@categoryMainClick="categoryMainClick"
@categorySubClick="categorySubClick">
</category>
</view>
</view>
<view class="sixcontent" v-else>
<view class="sixcontentitemP flex-colum-start">
<view class="sixcontentitemP_item"
:class="index == clickdetailindex ?'sixcontentitemP_itemactive':''"
v-for="(item,index) in clickhometoplistmenulist.detail" :key="index"
@click="clickdetail(item,index)">
{{item.name}}
</view>
</view>
</view>
</view>
</u-popup>
</view>
<indexs v-if="!showindex" :usershopUserinfo='usershopUserinfo'></indexs>
</view>
</template>
<script>
@@ -228,6 +237,7 @@
import advertisement from './components/advertisement.vue'
import customSwiper from '@/components/blackmonth-swiper/index'
import category from '@/components/qiyue-category/qiyue-category.vue';
import indexs from './indexs.vue';
export default {
components: {
swipers,
@@ -236,10 +246,12 @@
productlist,
advertisement,
category,
customSwiper
customSwiper,
indexs
},
data() {
return {
showindex: false,
NAME: uni.cache.get('NAME'),
timersetInterval: '0', //定时器
isFixedTop: false, //吸顶是否显示
@@ -276,10 +288,12 @@
clickdetailtowlist: [],
// 二级菜单
categoryList: [],
subCategoryList: [] //二级菜单数据
subCategoryList: [], //二级菜单数据
// 登录后店铺信息
usershopUserinfo:{}
};
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
this.opacity = false
@@ -314,56 +328,67 @@
onReachBottom() {
this.onLoadhome()
},
onShow() {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await this.api.geocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
async onShow() {
// 判断显示那个页面
if (uni.cache.get('shopUser') && uni.cache.get('token')) {
this.showindex = false
uni.cache.set('types', 'index');
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.usershopUserinfo = res.data
}
} else {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await this.api.geocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
this.hometop()
this.init_fn()
this.timersetInterval = '0'
}
uni.cache.set('getLocationstorage', datastorage);
this.hometop()
this.init_fn()
this.timersetInterval = '0'
}
},
fail: async (err) => {
console.log(err, '获取错误')
let successres = await this.api.geocodelocation({
lng: '',
lat: '',
})
if (successres.code == 0) {
console.log(successres.data.addressComponent.streetNumber.location.split(','))
let res = successres.data.addressComponent.streetNumber.location.split(',')
// this.form.lng = res[0]
// this.form.lat = res[1]
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res[0],
lat: res[1],
},
fail: async (err) => {
console.log(err, '获取错误') //测试用于app
let successres = await this.api.geocodelocation({
lng: '',
lat: '',
})
if (successres.code == 0) {
console.log(successres.data.addressComponent.streetNumber.location.split(','))
let res = successres.data.addressComponent.streetNumber.location.split(',')
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res[0],
lat: res[1],
}
uni.cache.set('getLocationstorage', datastorage);
this.hometop()
this.init_fn()
this.timersetInterval = '0'
}
uni.cache.set('getLocationstorage', datastorage);
this.hometop()
this.init_fn()
this.timersetInterval = '0'
}
}
});
});
this.showindex = true
}
},
methods: {
closeproductlist() {