效果图和源代码:
<template>
<view class="container">
<view class="top" style="height: 8%; margin-bottom: 20rpx; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);">
<view class="box" style="flex: 1; background-color: #4CAF50; display: flex;"
@click="toUrl(`/pages/menstore/shouyin`)">
<text
style="color: white; font-size: 14px; text-align: center; line-height: 50px; font-size: 40rpx; font-weight: 600; margin-left: 30rpx;">取消Esc</text>
</view>
<view class="box" style="flex: 2; background-color: #4CAF50;">
<view class="inner-box"
style=" margin: 20rpx 20rpx 15rpx 20rpx; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<text
style="color: white; font-size: 14px; text-align: center; line-height: 50px; font-size: 50rpx; font-weight: 600; margin-right: 900rpx;">门店管理中心</text>
</view>
</view>
</view>
<view class="bottom" style="height: 92% margin-bottom: 10rpx;">
<view class="left"
style="width: 10%; margin-right: 10rpx; margin-left: 10rpx; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2); margin-bottom: 10rpx;">
<view style="background-color: white;">
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/index`)">
<image src="../../../static/shouyeye.png"
style="width: 60rpx; height: 60rpx; margin-left: -100rpx; "></image>
<view style="font-weight: 600; margin-left: 20rpx;">首页</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/employee`)">
<image src="../../../static/yuangongguanli.png"
style="width: 60rpx; height: 60rpx; margin-left: -60rpx; "></image>
<view style="font-weight: 600; margin-left: 20rpx;">员工管理</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/cashOut`)">
<image src="../../../static/tixianzhanghu.png"
style="width: 60rpx; height: 60rpx; margin-left: -60rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">提现账户</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/stock`)">
<image src="../../../static/shangpinkucun.png"
style="width: 60rpx; height: 60rpx; margin-left: -60rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">商品库存</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/deliveryUser`)">
<image src="../../../static/配送管理.png" style="width: 60rpx; height: 60rpx; margin-left: -60rpx;">
</image>
<view style="font-weight: 600; margin-left: 20rpx;">配送管理</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/deliveryRecord`)">
<image src="../../../static/tixianguan.png"
style="width: 60rpx; height: 60rpx; margin-left: -60rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">提现管理</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;"
@click="toUrl(`/pages/menstore/store/ordercenter`)">
<image src="../../../static/dingdancenter.png"
style="width: 60rpx; height: 60rpx; margin-left: -60rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">订单中心</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx; background-color: #c0f0a6;">
<image src="../../../static/tongchengpeisongding.png"
style="width: 60rpx; height: 60rpx; margin-left: -10rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">同城配送订单</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx; "
@click="toUrl(`/pages/menstore/store/finance`)">
<image src="../../../static/caiwucenter.png"
style="width: 60rpx; height: 60rpx; margin-left: -60rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">财务中心</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;">
<image src="../../../static/zitidindgan.png"
style="width: 60rpx; height: 60rpx; margin-left: -10rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">自提订单处理</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;">
<image src="../../../static/jicidingdan.png"
style="width: 60rpx; height: 60rpx; margin-left: -10rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">计次订单处理</view>
</view>
<view
style="display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 4px solid #f0f0f0; height: 100rpx;">
<image src="../../../static/erweimama.png"
style="width: 60rpx; height: 60rpx; margin-left: -40rpx;"></image>
<view style="font-weight: 600; margin-left: 20rpx;">店铺二维码</view>
</view>
</view>
</view>
<view class="right"
style="width: 90%; margin-left: 4rpx; margin-right: 15rpx; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; align-items: stretch; margin-bottom: 10rpx;">
<view style="height: 15%; margin-bottom: 10rpx; border-bottom: #4CAF50 3px solid;">
<view class="orders">
<view class="item" @click="toUrl('/pages/menstore/store/ordersGive')">
<view class="num"></view>
<view class="text">系统配单</view>
</view>
<view class="item" @click="toUrl('/pages/menstore/store/ordersQuick')">
<view class="num"></view>
<view class="text">快捷买单</view>
</view>
<view class="item" @click="toUrl('/pages/menstore/store/ordersActivity')">
<view class="num"></view>
<view class="text">店内活动</view>
</view>
<view class="item" @click="toUrl('/pages/menstore/store/ordersSelf')">
<view class="num" style="background-color: #c0f0a6; "></view>
<view class="text">到店自提</view>
</view>
</view>
</view>
<view style="height: 85%; margin-bottom: 10rpx; ">
<!--到店自提-->
<view class="store-manager-class">
<view class="navs">
<view class="navs-item" :class="activeNav==item.value?'active':''"
v-for="(item,idx) in navs" :key='idx' @click="onNavClick(item.value)">{{item.name}}
</view>
</view>
<view style="height: 1000rpx; overflow: auto;">
<view class="item" v-for="(item,idx) in listData" :key="idx">
<view class="left">到店自提</view>
<view class="right">
<view>订单编号:{{item.itemNumber}}</view>
<view>下单时间:{{item.insertTime}}</view>
<view><span class="r">商品名称:{{item.title}} </span></view>
<view>下单人:{{item.userName}}</view>
<view><span class="r">单价:{{item.unitPrice}} </span> <span class="r">
数量:{{item.number}}</span><span>
消费金额:{{item.totalPrices}}</span></view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
navs: [{
name: '待自提',
value: '201'
},
{
name: '已完成',
value: '202'
},
{
name: '已评价',
value: '203'
}
],
activeNav: "201",
listData: [{
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, ],
reload: false, //是否下拉重新加载
status: 'more',
size: 10,
current: 1,
total: 0,
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多',
},
filter: '',
};
},
onLoad(option) {
if (option.activeNav) this.activeNav = option.activeNav;
if (option.filter) this.filter = option.filter;
this.reload = true;
this.getList();
},
onShow() {
},
onPullDownRefresh() {
this.reload = true;
this.getList();
},
onReachBottom() {
this.status = this.listData.length >= this.total ? '' : 'more';
// this.status = 'more';
this.getList();
},
methods: {
getList() {
uni.stopPullDownRefresh();
if (this.listData.length != 0 && this.listData.length == this.total) return;
if (this.listData.length < this.total) {
this.current = this.reload ? 1 : this.current + 1;
}
let query = `?current=${this.current}&size=${this.size}&state=${this.activeNav}`;
this.ajax.get(this.jk.mdSelfOrders + query).then(res => {
this.total = res.data.total;
let list = res.data.records;
this.listData = this.reload ? list : this.listData.concat(list);
if (list.length < this.size) this.status = '';
this.reload = false;
})
},
toUrl(url) {
this.common.UnavigateTo(url)
},
onNavClick(value) {
this.activeNav = value;
this.reload = true;
this.listData = [];
this.getList();
}
}
}
</script>
<style lang="less">
// 刚开始基本样式
.container {
display: flex;
flex-direction: column;
height: 100vh;
/* 设置容器高度占满整个视窗 */
background-color: #f0f0f0;
}
.top {
width: 100%;
background-color: #4CAF50;
/* 顶部区域的背景颜色,可根据需求修改 */
display: flex;
/* 使用flex布局 */
justify-content: space-between;
/* 平均分布子元素 */
}
.box {
height: 100%;
/* 子盒子高度与父盒子相同 */
display: flex;
/* 使用flex布局 */
align-items: center;
/* 垂直居中子元素 */
}
/* 内部盒子样式 */
.inner-box {
background-color: #4CAF50;
margin: 10rpx;
display: flex;
justify-content: space-around;
}
.bottom {
display: flex;
flex-direction: row;
flex: 1;
}
.left {
width: 30%;
background-color: #fafafa;
}
.right {
width: 70%;
background-color: #fdfdfd;
}
// 小圆圈样式
.orders {
display: flex;
justify-content: space-around;
margin-top: 10rpx;
margin-left: -200rpx;
.item {
text-align: center;
.num {
width: 130rpx;
height: 130rpx;
line-height: 100rpx;
border: 2px solid #4CAF50;
border-radius: 100%;
text-align: center;
}
.text {
margin: 10rpx 0 30rpx 0;
}
}
}
//自提样式
.store-manager-class {
background-color: #FFFFFF;
// height: 100vh;
//导航
.navs {
display: flex;
justify-content: space-around;
background-color: #FFFFFF;
// position: fixed;
margin-top: -10rpx;
width: 86%;
z-index: 1000;
.navs-item {
padding: 20rpx 0;
}
.active {
color: #0E7519;
border-bottom: 1px solid #0E7519;
padding-bottom: 20rpx;
}
}
.item {
display: flex;
align-items: center;
margin-top: 10rpx;
padding: 20rpx 30rpx;
border-bottom: 1px solid #CCCCCC;
.left {
border: 1px solid #CCCCCC;
text-align: center;
margin-right: 20rpx;
font-weight: bold;
width: 80rpx;
padding: 20rpx 20rpx;
}
.right {
uni-view {
font-size: 24rpx;
color: #101010;
margin-bottom: 10rpx;
.r {
margin-right: 40rpx;
}
}
}
}
}
</style>
局部的一些效果和代码:
<view style="height: 85%; margin-bottom: 10rpx; ">
<!--到店自提-->
<view class="store-manager-class">
<view class="navs">
<view class="navs-item" :class="activeNav==item.value?'active':''"
v-for="(item,idx) in navs" :key='idx' @click="onNavClick(item.value)">{{item.name}}
</view>
</view>
<view style="height: 1000rpx; overflow: auto;">
<view class="item" v-for="(item,idx) in listData" :key="idx">
<view class="left">到店自提</view>
<view class="right">
<view>订单编号:{{item.itemNumber}}</view>
<view>下单时间:{{item.insertTime}}</view>
<view><span class="r">商品名称:{{item.title}} </span></view>
<view>下单人:{{item.userName}}</view>
<view><span class="r">单价:{{item.unitPrice}} </span> <span class="r">
数量:{{item.number}}</span><span>
消费金额:{{item.totalPrices}}</span></view>
</view>
</view>
</view>
</view>
</view>
<script>
export default {
data() {
return {
navs: [{
name: '待自提',
value: '201'
},
{
name: '已完成',
value: '202'
},
{
name: '已评价',
value: '203'
}
],
activeNav: "201",
listData: [{
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, {
itemNumber: 'AAAAAAAAAAAAAA',
insertTime: '1'
}, ],
reload: false, //是否下拉重新加载
status: 'more',
size: 10,
current: 1,
total: 0,
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多',
},
filter: '',
};
},
onLoad(option) {
if (option.activeNav) this.activeNav = option.activeNav;
if (option.filter) this.filter = option.filter;
this.reload = true;
this.getList();
},
onShow() {
},
onPullDownRefresh() {
this.reload = true;
this.getList();
},
onReachBottom() {
this.status = this.listData.length >= this.total ? '' : 'more';
// this.status = 'more';
this.getList();
},
methods: {
getList() {
uni.stopPullDownRefresh();
if (this.listData.length != 0 && this.listData.length == this.total) return;
if (this.listData.length < this.total) {
this.current = this.reload ? 1 : this.current + 1;
}
let query = `?current=${this.current}&size=${this.size}&state=${this.activeNav}`;
this.ajax.get(this.jk.mdSelfOrders + query).then(res => {
this.total = res.data.total;
let list = res.data.records;
this.listData = this.reload ? list : this.listData.concat(list);
if (list.length < this.size) this.status = '';
this.reload = false;
})
},
toUrl(url) {
this.common.UnavigateTo(url)
},
onNavClick(value) {
this.activeNav = value;
this.reload = true;
this.listData = [];
this.getList();
}
}
}
</script>
<style lang="less">
//自提样式
.store-manager-class {
background-color: #FFFFFF;
// height: 100vh;
//导航
.navs {
display: flex;
justify-content: space-around;
background-color: #FFFFFF;
// position: fixed;
margin-top: -10rpx;
width: 86%;
z-index: 1000;
.navs-item {
padding: 20rpx 0;
}
.active {
color: #0E7519;
border-bottom: 1px solid #0E7519;
padding-bottom: 20rpx;
}
}
.item {
display: flex;
align-items: center;
margin-top: 10rpx;
padding: 20rpx 30rpx;
border-bottom: 1px solid #CCCCCC;
.left {
border: 1px solid #CCCCCC;
text-align: center;
margin-right: 20rpx;
font-weight: bold;
width: 80rpx;
padding: 20rpx 20rpx;
}
.right {
uni-view {
font-size: 24rpx;
color: #101010;
margin-bottom: 10rpx;
.r {
margin-right: 40rpx;
}
}
}
}
}
</style>
这里涉及到的知识点:区域设置高度 并且允许滚动 。设置高度啊 你想在区域多少高度内显示就设置多少高度 然后设置一个允许滚动属性。定位 。 overflow: hidden是隐藏溢出。禁止滚动还有好几种实现的方式:js 定位 css touch-action: none