更改首页

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,266 +0,0 @@
<template>
<view>
<view class="banner-wrap">
<u-swiper :list="banners" height="440" radius="0" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper>
</view>
<view class="container">
<view class="user-info">
<view class="top">
<view class="col">
<view style="width: 36px; height: 36px;border-radius: 10rpx;">
<button open-type="chooseAvatar" @chooseavatar='onChooseAvatar'
style="padding: 0;margin: 0; width: 36px; height: 36px;border-radius: 10rpx;">
<image style="width: 36px; height: 36px;" v-if="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill">
</image>
<image style="width: 36px; height: 36px;" v-else src="@/static/avatar.png" mode="aspectFill">
</image>
</button>
</view>
<text class="t">{{userInfo.nickName}}</text>
</view>
<navigator class="ewm-wrap" url="/pages/pay_code/pay_code" hover-class="none">
<image class="ewm" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/ewm.png" mode="aspectFit"></image>
<text class="t">会员码</text>
</navigator>
</view>
<view class="bottom">
<view class="col">
<text class="t1 num">{{shopUser.amount || '0'}}</text>
<text class="t2">余额</text>
</view>
<view class="col">
<text class="t1 num">{{shopUser.levelConsume || '0'}}</text>
<text class="t2">积分</text>
</view>
</view>
</view>
<view class="menu-wrap">
<view class="top-wrap">
<view class="item" @click="scanCodehandle">
<image class="bg" src="../../static/index_m2.png" mode="widthFix"></image>
<view class="btn">
<text class="t">扫码点餐</text>
</view>
</view>
<view class="item" @click="memberindex">
<image class="bg" src="../../static/index_m1.png" mode="widthFix"></image>
<view class="btn">
<text class="t">会员充值</text>
</view>
</view>
</view>
</view>
<view class="footer-banner">
<u-swiper :list="footerBanners" radius="20" height="160" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper>
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
banners: [require('@/static/banner1.png')],
footerBanners: [require('@/static/footer_banner1.png')],
userInfo: {},
shopInfo:{}
};
},
onLoad() {
// #ifdef MP-WEIXIN
if (!uni.cache.get('token')) {
uni.reLaunch({
url: '/pages/login/login'
})
}
// #endif
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}else{
uni.reLaunch({
url: '/pages/login/login'
})
}
},
methods: {
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopUser')
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser);
uni.cache.set('shopInfo', res.data.shopInfo);
this.shopUser = uni.cache.get('shopUser')
this.userInfo = uni.cache.get('userInfo')
this.shopInfo = uni.cache.get('shopInfo')
}
},
scanCodehandle() {
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
}
})
},
memberindex() {
uni.pro.navigateTo('member/index')
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, 'avatar',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.userInfo.avatar = result
console.log(this.userInfo.avatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
}
};
</script>
<style scoped lang="scss">
.container {
padding: 40upx;
}
.user-info {
background-color: #fff;
padding: 40upx;
border-radius: 20upx;
.top {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1upx solid #ececec;
padding-bottom: 42upx;
.col {
display: flex;
align-items: center;
.t {
margin-left: 20upx;
}
}
.ewm-wrap {
display: flex;
flex-direction: column;
align-items: center;
.ewm {
$size: 50upx;
width: $size;
height: $size;
}
.t {
font-size: 20upx;
padding-top: 8upx;
}
}
}
.bottom {
padding-top: 40upx;
display: flex;
.col {
flex: 1;
display: flex;
align-items: center;
flex-direction: column;
.t1 {
font-size: 38upx;
}
}
}
}
.menu-wrap {
padding: 40upx 0 0 0;
$gap: 20upx;
.top-wrap {
display: flex;
gap: $gap;
.item {
flex: auto;
display: flex;
align-items: center;
flex-direction: column;
background-color: #fff;
border-radius: 20upx;
position: relative;
.bg {
width: 100%;
height: auto;
border-radius: $gap;
}
.btn {
margin-top: $gap;
padding: $gap $gap * 2;
border-radius: 100upx;
display: flex;
justify-content: center;
font-size: 32upx;
background-color: #fff;
box-shadow: 0 12upx 12upx rgba(0, 0, 0, 0.05);
position: absolute;
bottom: $gap * 2;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
}
}
}
}
.footer-banner {
padding-top: 20upx;
}
</style>

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() {

273
pages/index/indexs.vue Normal file
View File

@@ -0,0 +1,273 @@
<template>
<view>
<u-swiper :list="banners" height="460" radius="0" :indicator="banners.length > 1" imgMode="widthFix"></u-swiper>
<view class="container">
<view class="after"></view>
<view class="onecontent flex-between">
<view class="onecontentone flex-start">
<image :src="userInfo.headImg" mode="aspectFill">
<text>{{userInfo.nickName || '无'}}</text>
</view>
<view class="onecontenttow flex-start">
<view class="onecontenttowring flex-colum" @click="memberindex(0)">
<text class="onecontenttowringone">{{usershopUserinfo.amount || '0.00'}}</text>
<text class="onecontenttowringtow">余额</text>
</view>
<!-- <view class="onecontenttowring flex-colum">
<text class="onecontenttowringone">282</text>
<text class="onecontenttowringtow">积分</text>
</view> -->
<view class="onecontenttowring flex-colum" @click="memberindex(1)">
<image class="onecontenttowringone image"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/rwm.png" mode="aspectFill">
</image>
<text class="onecontenttowringtow">会员码</text>
</view>
</view>
</view>
<view class="towcontent flex-between">
<view class="towcontentitem flex-colum" @click="scanCodehandle(0)">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/Instore.png" mode="widthFix"
style="width: 86.88rpx; height: 140.94rpx;"></image>
<text class="towcontentitemtext">店内就餐</text>
</view>
<view class="towcontentitem flex-colum" @click="scanCodehandle(1)">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/takeaway.png" mode="widthFix"
style="width: 128.05rpx; height: 120.41rpx;"></image>
<text class="towcontentitemtext">点个外卖</text>
</view>
</view>
<view class="footer-banner">
<!-- <u-swiper :list="footerBanners" radius="20" height="274" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper> -->
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
banners: ['https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/banner1.png'],
footerBanners: ['https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/footer_banner1.png'],
userInfo: uni.cache.get('userInfo'),
};
},
props: {
usershopUserinfo: {
type: Object,
default () {
return {
amount:'',
shopName: ""
}
}
},
},
methods: {
scanCodehandle(i) {
if (i == 0) {
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food')
}
// let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
// if (tableCode) {
// uni.pro.navigateTo('order_food/order_food', {
// tableCode: tableCode,
// })
// }
}
})
// uni.navigateTo({
// url:'/pages/order_food/order_food'
// })
} else {
uni.showToast({
title: '此店铺暂未开通外卖',
icon: 'none'
})
}
},
memberindex(i) {
if (i == 0) {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: uni.cache.get('shopUser'),
})
} else {
// uni.pro.navigateTo('pay_code/pay_code?shopInfo=', {
// shopName: this.usershopUserinfo.shopName,
// amount: this.usershopUserinfo.amount,
// shopId: uni.cache.get('shopUser')
// })
let data = {
shopName: this.usershopUserinfo.shopName,
amount: this.usershopUserinfo.amount,
shopId: uni.cache.get('shopUser')
}
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(data)
})
}
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, 'avatar',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.userInfo.avatar = result
console.log(this.userInfo.avatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
}
};
</script>
<style scoped lang="scss">
page {
background: #F6F8FA;
}
.container {
border-radius: 0 0 0 40rpx;
position: relative;
padding: 0 28rpx;
.after {
position: absolute;
top:46rpx;
right: 0;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
background-image: radial-gradient(160rpx at 0px 0px, rgba(0, 0, 0, 0) 40rpx, #f9f9f9 40rpx);
}
.onecontent {
width: 100%;
margin-top: -86rpx;
position: relative;
height: 172rpx;
background: #FFFFFF;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 14rpx;
padding: 0 30rpx;
.onecontentone {
image {
width: 108rpx;
height: 108rpx;
background: #FFFFFF;
border: 2rpx solid #707070;
border-radius: 50%;
}
text {
margin-left: 12rpx;
width: 146rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.onecontenttow {
.onecontenttowring {
margin-left: 32rpx;
height: 110rpx;
justify-content: flex-end;
.onecontenttowringone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.image {
width: 42rpx;
height: 42rpx;
}
.onecontenttowringtow {
margin-top: 20rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
}
.towcontent {
margin-top: 48rpx;
position: relative;
width: 100%;
background: #FFFFFF;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 14rpx 14rpx 14rpx 14rpx;
height: 314rpx;
padding: 0 90rpx 0 120rpx;
&::after {
position: absolute;
content: '';
display: inline-block;
height: 188rpx;
width: 2rpx;
left: 50%;
margin-left: -1rpx;
background: #D8D8D8;
}
.towcontentitem {
.towcontentitemtext {
margin-top: 26rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
}
}
.footer-banner {
margin-top: 48upx;
}
}
</style>