This commit is contained in:
魏啾
2024-04-08 13:50:05 +08:00
parent 2b723694fa
commit d844832aad
13 changed files with 1309 additions and 124 deletions

View File

@@ -8,4 +8,10 @@ export default {
phoneValidateCode(data) { //验证码
return uni.api.get("/phoneValidateCode", data);
},
homehomePageUp(data) { //首页上半部分
return uni.api.post("/home/homePageUp", data);
},
home(data) { //首页上半部分
return uni.api.post("/home", data);
},
}

176
components/nav.vue Normal file
View File

@@ -0,0 +1,176 @@
<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="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">
<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>
</view>
</template>
<script>
export default {
data() {
return {
keyword: '',
opacity: false,
};
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
this.opacity = false
} else {
this.opacity = true
}
},
computed: {
HeighT() { //手机类型的尺寸
return this.$store.getters.is_BarHeight
},
},
methods: {}
};
</script>
<style scoped lang="scss">
page {
background: #F9F9F9;
}
.content {
position: -webkit-sticky;
position: sticky;
top: 0;
.active {
background: rgba(249, 249, 249, 1);
}
.status-bar {
// #ifdef APP-PLUS
height: calc(var(--status-bar-height) / 2);
// #endif
// #ifdef MP-WEIXIN
height: var(--status-bar-height);
// #endif
}
// #ifdef APP-PLUS
.statusbarmargin {
margin-top: var(--status-bar-height);
}
// #endif
.navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 99;
.navbar_tow {
width: 100%;
position: relative;
font-size: 36rpx;
.flex-between {
// #ifdef APP-PLUS || H5
margin: 28rpx;
// #endif
// #ifdef MP-WEIXIN
margin-left: 28rpx;
// #endif
width: 100%;
flex-wrap: nowrap;
height: 100%;
line-height: 100%;
.navbar_tow_one {
height: 100%;
line-height: 100%;
text:nth-child(1) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
text:nth-child(2) {
margin-left: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.navbar_tow_tow {
position: relative;
height: 100%;
line-height: 100%;
flex: 1;
margin-left: 10rpx;
.navbar_tow_towview {
position: absolute;
right: 4rpx;
top: 50%;
transform: translate(0, -50%);
text-align: center;
background: #FEE06A;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
width: 116rpx;
height: 56rpx;
line-height: 56rpx;
border-radius: 34rpx 34rpx 34rpx 34rpx;
}
.navbar_tow_towinput {
padding-left: 32rpx;
padding-right: 116rpx;
height: 100%;
flex: auto;
background: #FFFFFF;
border-radius: 34rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #999999;
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
}
}
}
}
}
}
</style>

View File

@@ -3,7 +3,7 @@ const debug = process.env.NODE_ENV == 'development' ? true : false;
const proxyApi = "/api"
// #endif
// #ifdef MP-WEIXIN || APP
const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
const proxyApi = 'http://101.37.12.135:9889/cashierService' // 线上
// #endif
// #ifdef H5

View File

@@ -202,7 +202,8 @@ function get(url, data, toast = true, type = 1) {
return request({
url,
data,
toast
toast,
type
})
}
@@ -221,7 +222,8 @@ function post(url, data, toast = true, method = 'POST', type = 1) {
url,
method,
data,
toast
toast,
type
})
}

View File

@@ -15,8 +15,7 @@
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
"navigationBarTitleText": "登录"
}
},
{
@@ -155,12 +154,6 @@
"pagePath": "pages/order/order",
"text": "订单"
},
{
"iconPath": "static/tabbar/3.png",
"selectedIconPath": "static/tabbar/3-1.png",
"pagePath": "pages/make/make",
"text": "预约"
},
{
"iconPath": "static/tabbar/4.png",
"selectedIconPath": "static/tabbar/4-1.png",

View File

@@ -8,7 +8,9 @@
<u-swiper class="onecontentrightswiper" circular style="width: 100%;" nextMargin="50" :list="list1"
height='28'></u-swiper>
</view>
<view class="onecontentrighttext">购买了10面值优惠券</view>
<view class="onecontentrighttext">
text1
</view>
</view>
<!-- 小内切圆 -->
<view class="after"></view>
@@ -18,7 +20,15 @@
<script>
export default {
data() {
return {};
return {
list1: [
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
],
text1:'开箱即用',
};
},
};
</script>

View File

@@ -1,8 +1,8 @@
<template>
<view class="towcontent flex-between">
<view class="towcontent_item flex-colum" v-for="(item,index) in 5" :key="index">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<text>扫码点餐</text>
<view class="towcontent_item flex-colum" v-for="(item,index) in district" :key="index">
<image :src="item.coverImg" mode="aspectFill"></image>
<text>{{item.name}}</text>
</view>
</view>
</template>
@@ -12,6 +12,22 @@
data() {
return {};
},
props: {
district: {
type: Array,
default () {
return []
}
},
title: {
type: String,
default: '每日特价'
},
img: {
type: String,
default: ''
},
},
};
</script>
@@ -23,6 +39,8 @@
width: 100%;
background: #F9F9F9;
border-radius: 48rpx 48rpx 0rpx 0rpx;
overflow-x: auto;
flex-wrap: nowrap;
.towcontent_item {
image {

View File

@@ -71,8 +71,58 @@
</view>
</view>
</template>
<script>
export default {
data() {
return {
isFixedTop: false, //吸顶是否显示
Topdistance: 3000, //吸顶初始距离
keyword: '',
current: 0,
opacity: false,
};
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
this.opacity = false
} else {
this.opacity = true
}
if (e.scrollTop >= this.Topdistance) { //类别导航栏
this.isFixedTop = true
} else {
this.isFixedTop = false
}
},
computed: {
HeighT() { //手机类型的尺寸
return this.$store.getters.is_BarHeight
},
},
onLoad() {
setTimeout(() => {
this.GetTop()
}, 1000)
},
onShow() {},
methods: {
GetTop() {
//获取元素距离顶部的距离
this.$u.getRect('.fourcontent').then(res => {
this.Topdistance = res.top - this.HeighT.heightBar
})
},
viewHistory() {
//移动高度=滚动高度 + 距离上面的位置 - 导航条 - 状态栏高度
uni.pageScrollTo({
scrollTop: this.Topdistance + 1,
duration: 300
});
},
}
};
</script>
<style scoped lang="scss">

View File

@@ -1,8 +1,8 @@
<template>
<view class="viewswiper">
<u-swiper :list="list1" @change="e => current = e.current" indicatorStyle="right: 20px" height='484'>
<u-swiper :list="carousel" keyName="coverImg" @change="e => current = e.current" indicatorStyle="right: 20px" height='484'>
<view slot="indicator" class="indicator">
<view class="indicator__dot" v-for="(item, index) in list1" :key="index"
<view class="indicator__dot" v-for="(item, index) in carousel" :key="index"
:class="[index === current && 'indicator__dot--active']"
:style="[index === current && {'width':16+'px'}]">
</view>
@@ -15,14 +15,25 @@
export default {
data() {
return {
current: 0,
list1: [
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
]
current: 0
};
},
props: {
carousel: {
type: Array,
default () {
return []
}
},
title: {
type: String,
default: '每日特价'
},
img: {
type: String,
default: ''
},
},
};
</script>

View File

@@ -1,34 +1,73 @@
<template>
<view class="therecontent flex-between">
<view class="therecontent_box_item" v-for="item in 2" :key="item">
<view class="therecontent_box_imge flex-between" :style="item&&item">
<view class="therecontent_box_item">
<view class="therecontent_box_imge flex-between">
<view class="therecontent_box_imge_text">
今日上新
{{todayList.name}}
</view>
<view class="therecontent_box_imge_right flex-start">
<view>
10点更新
{{todayList.date}}
</view>
<u-icon name="arrow-right" color="#666666" size="16"></u-icon>
</view>
</view>
<view class="therecontent_box_itembox">
<view class="therecontent_box_itembox_item flex-between" v-for="item in 2" :key="item">
<view class="therecontent_box_itembox_item flex-between" v-for="(item,index) in todayList.todayList"
:key="item">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<view class="therecontent_box_itembox_itemview">
<view class="therecontent_box_itembox_itemviewone">
书亦烧仙草新品书亦烧仙草新品亦烧仙草新品
{{item.productName}}
</view>
<view class="therecontent_box_itembox_itemviewtow flex-start">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/xia.png"
mode="widthFix"></image>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/xia.png" mode="widthFix">
</image>
<view>
8
</view>
</view>
<view class="therecontent_box_itembox_itemviewthere flex-start">
<text>15.00</text>
<text>18.00</text>
<text>{{item.salePrice}}</text>
<text>{{item.originPrice}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="therecontent_box_item">
<view class="therecontent_box_imge flex-between"
style="background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box2.png) no-repeat;">
<view class="therecontent_box_imge_text">
{{salesList.name}}
</view>
<view class="therecontent_box_imge_right flex-start">
<view>
{{salesList.date}}
</view>
<u-icon name="arrow-right" color="#666666" size="16"></u-icon>
</view>
</view>
<view class="therecontent_box_itembox">
<view class="therecontent_box_itembox_item flex-between" v-for="(item,index) in salesList.hotList" :key="item">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<view class="therecontent_box_itembox_itemview">
<view class="therecontent_box_itembox_itemviewone flex-start">
<view class="therecontent_box_itembox_itemviewoneafter">
TOP.{{index + 1}}
</view>
<text>{{item.productName}}</text>
</view>
<view class="therecontent_box_itembox_itemviewtow flex-start">
<image :src="item.image">
</image>
<view>
8
</view>
</view>
<view class="therecontent_box_itembox_itemviewthere flex-start">
<text>{{item.salePrice}}</text>
<text>{{item.originPrice}}</text>
</view>
</view>
</view>
@@ -42,6 +81,24 @@
data() {
return {};
},
props: {
salesList: {
type: Object,
default () {
return {}
}
},
todayList: {
type: Object,
default () {
return {}
}
},
title: {
type: String,
default: '每日特价'
}
},
};
</script>
@@ -49,41 +106,54 @@
.therecontent {
padding: 0 28rpx;
background: #F9F9F9;
.therecontent_box_item {
width: 336rpx;
border-radius: 18rpx;
background: #FFFFFF;
.therecontent_box_itembox {
padding: 10rpx 18rpx 24rpx 24rpx;
.therecontent_box_itembox_item {
margin-top: 20rpx;
image {
width: 114rpx;
height: 136rpx;
border-radius: 10rpx;
}
.therecontent_box_itembox_itemview {
margin-left: 12rpx;
.therecontent_box_itembox_itemviewone {
width: 168rpx;
height: 68rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
text{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.therecontent_box_itembox_itemviewoneafter{
width: 48rpx;
height: 24rpx;
line-height: 24rpx;
text-align: center;
background: linear-gradient( 116deg, #FF9D2B 0%, #FF4805 100%);
border-radius: 4rpx 4rpx 4rpx 4rpx;
font-family: Roboto, Roboto;
font-weight: 500;
font-size: 16rpx;
color: #FFFFFF;
}
}
.therecontent_box_itembox_itemviewtow {
margin-top: 8rpx;
width: 60rpx;
@@ -91,12 +161,12 @@
background: #FFFFFF;
border-radius: 4rpx;
border: 2rpx solid #FF7127;
image {
width: 9.74rpx;
height: 13.51rpx;
}
view {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
@@ -104,17 +174,17 @@
color: #FF7127;
}
}
.therecontent_box_itembox_itemviewthere {
margin-top: 4rpx;
text:nth-child(1) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 24rpx;
color: #FF7127;
}
text:nth-child(2) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
@@ -125,26 +195,26 @@
}
}
}
.therecontent_box_itembox_item:nth-child(1) {
margin-top: 0;
}
}
.therecontent_box_imge {
padding: 24rpx 16rpx 6rpx 24rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box1.png) no-repeat;
width: 100%;
height: 70rpx;
background-size: cover;
.therecontent_box_imge_text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.therecontent_box_imge_right {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
@@ -152,12 +222,6 @@
color: #666666;
}
}
.therecontent_box_imge:nth-child(2) {
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box2.png) no-repeat;
}
}
}
</style>

View File

@@ -23,15 +23,16 @@
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
<view class="navbar_tow_tow">
<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" style="padding: 28rpx 0 28rpx 28rpx">
<view class="fourcontent_item flex-start" v-for="(item,index) in 10" :key="index">
<text>西安</text>
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index">
<text>{{item.name}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
@@ -40,23 +41,145 @@
<!-- 以上都是导航栏处理 -->
<!-- 轮播图 -->
<swipers></swipers>
<swipers :carousel='hometoplist.carousel'></swipers>
<!-- 广告 -->
<advertisement></advertisement>
<!-- 金刚区 -->
<diamond></diamond>
<diamond :district='hometoplist.district'></diamond>
<!-- 今日上线 -->
<todaylist></todaylist>
<todaylist :todayList='hometoplist.todayList' :salesList='hometoplist.salesList'></todaylist>
<!-- 类目 -->
<view class="fourcontent flex-between" @click="viewHistory">
<view class="fourcontent_item flex-start" v-for="(item,index) in 10" :key="index">
<text>西安</text>
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index">
<text>{{item.name}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333" size="16"></u-icon>
</view>
</view>
<!-- 盒子撑开 -->
<!-- #ifdef MP-WEIXIN -->
<view v-if="isFixedTop" :style="isFixedTop?`height:${fourcontentHeighT}px`:''"></view>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view v-if="isFixedTop" :style="isFixedTop?`height:${fourcontentHeighT + 22}px`:''"></view>
<!-- #endif -->
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
<view v-if="isFixedTop"></view>
<!-- #endif -->
<!-- 产品 -->
<productlist></productlist>
<view class="fivecontent">
<view class="fivecontent_item" v-for="(item,index) in homelist" :key="index">
<view class="fivecontent_item_nav flex-start">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
{{item.shopName}}
</view>
<view>
龙首.{{item.distances}}m
</view>
</view>
<view class="flex-start">
<view class="fivecontent_item_nav_leftlang flex-start" v-for="(s,index1) in 2"
:key="index1">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
mode="aspectFill"></image>
<text>{{item.shopTag}}</text>
</view>
</view>
</view>
</view>
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image src="@/static/avatar.png" mode=""></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between">
<view>全场饮品任选</view>
<text>已抢15789份</text>
</view>
<view class="fivecontent_item_boxitemlefttow flex-start">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
mode="aspectFill"></image>
<text>人气连锁品牌</text>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="indexboxitemlefttheretextone">
<text>¥</text>
<text>1444</text>
</view>
<view class="indexboxitemlefttheretexttow">
¥111
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省4元</text>
<view class="indexboxitemleftthere_countdowntexts">
<uni-countdown :show-day="false" :day="1" :hour="1" :minute="12"
:second="40" color="#FFFFFF" border-color="#00B26A"
splitorColor="#FFFFFF" :font-size="8"></uni-countdown>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
<!-- 弹出层 -->
<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>八点八零</text>
<text>西安</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" style="padding: 28rpx 0 28rpx 28rpx">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index">
<text>{{item.name}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
</view>
</view>
</u-popup>
</view>
</template>
@@ -78,20 +201,33 @@
return {
isFixedTop: false, //吸顶是否显示
Topdistance: 3000, //吸顶初始距离
fourcontentHeighT: 0, //高度
keyword: '',
current: 0,
opacity: false,
list1: [
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
]
showproductlist: false, //弹成
hometoplist: { //上面数据
carousel: [],
district: []
},
homelist: [], //下面数据
form: {
address: '', //地址
type: '', //品类
orderBy: '', //1.理我最近 2.销量优先 3.价格优先
distance: '', //附近1KM 1选中 0不选中
page: 1, //页数
size: 10, //页容量
status: 'loadmore'
}
};
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
this.opacity = false
this.showproductlist = false
} else {
this.opacity = true
}
@@ -111,8 +247,21 @@
this.GetTop()
}, 1000)
},
onShow() {},
onReachBottom() {
this.onLoadhome()
},
onShow() {
this.hometop()
this.onLoadhome()
},
methods: {
closeproductlist() {
this.showproductlist = false
// console.log('close');
},
openproductlist() {
// console.log('open');
},
uindexlist() {
uni.pro.navigateTo('index/uindexlist')
},
@@ -123,11 +272,51 @@
GetTop() {
//获取元素距离顶部的距离
this.$u.getRect('.fourcontent').then(res => {
this.Topdistance = res.top - this.HeighT.heightBar
this.Topdistance = res.top - this.HeighT.heightBar //滚动距离
this.fourcontentHeighT = res.height //高度
})
},
viewHistory() {
//移动高度=滚动高度 + 距离上面的位置 - 导航条 - 状态栏高度
// 首页上面数据
async hometop() {
try {
let res = await this.apix.homehomePageUp()
this.hometoplist = res.data
} catch (e) {
//TODO handle the exception
}
},
// 下面初始数据
init_fn() {
this.homelist = []
this.form.page = 1
this.form.status = 'loadmore'
this.onLoadhome()
},
async onLoadhome() {
try {
let res = await this.apix.home(this.form)
if (res.data.length == 0) {
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.homelist = [...this.homelist, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.form.status = 'nomore';
}
}, 500)
}
} catch (e) {
//TODO handle the exception
}
},
async viewHistory() {
this.showproductlist = true
uni.pageScrollTo({
scrollTop: this.Topdistance + 1,
duration: 300
@@ -163,7 +352,7 @@
// #ifdef APP-PLUS
.statusbarmargin {
margin-top: calc(var(--status-bar-height) / 2);
margin-top: var(--status-bar-height);
}
// #endif
@@ -217,20 +406,46 @@
flex: 1;
margin-left: 10rpx;
.navbar_tow_towview {
position: absolute;
right: 4rpx;
top: 50%;
transform: translate(0, -50%);
text-align: center;
background: #FEE06A;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
width: 116rpx;
height: 56rpx;
line-height: 56rpx;
border-radius: 34rpx 34rpx 34rpx 34rpx;
}
.navbar_tow_towinput {
padding-left: 32rpx;
padding-right: 116rpx;
height: 100%;
width: auto;
flex: auto;
background: #FFFFFF;
border-radius: 34rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #999999;
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
}
}
}
}
}
.fourcontent {
padding: 32rpx 0 0 28rpx;
padding: 32rpx 28rpx 0 28rpx;
overflow-x: auto;
flex-wrap: nowrap;
@@ -251,5 +466,190 @@
}
}
.fivecontent {
padding: 0 28rpx;
.fivecontent_item {
margin-top: 32rpx;
padding: 24rpx 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.fivecontent_item_nav {
image {
width: 60rpx;
height: 60rpx;
border-radius: 8rpx;
}
.fivecontent_item_nav_left {
flex: auto;
margin-left: 12rpx;
.fivecontent_item_nav_lefttop {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
.fivecontent_item_nav_leftlang {
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
}
image {
width: 10.82rpx;
height: 14.06rpx;
}
}
.fivecontent_item_nav_leftlang:nth-child(2) {
margin-left: 12rpx;
background: #FEE9DF;
}
}
}
.fivecontent_item_box {
margin-top: 20rpx;
border-top: 2rpx solid #E5E5E5;
padding-top: 14rpx;
.fivecontent_item_boxitem {
image {
width: 192rpx;
height: 192rpx;
border-radius: 12rpx;
}
.fivecontent_item_boxitemleft {
margin-left: 24rpx;
flex: auto;
.fivecontent_item_boxitemleftone {
width: 100%;
text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
view {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.fivecontent_item_boxitemlefttow {
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
}
image {
width: 10.82rpx;
height: 14.06rpx;
}
}
.indexboxitemleftthere {
position: relative;
margin-top: 30rpx;
padding-left: 16rpx;
width: 100%;
height: 88rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
background-size: 100% 100%;
.indexboxitemleftthereabsolute {
position: absolute;
top: 14rpx;
right: 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 24rpx;
color: #FFFFFF;
}
.indexboxitemlefttheretext {
.indexboxitemlefttheretextone {
text {
font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
font-weight: normal;
color: #FF5053;
}
text:nth-child(2) {
font-weight: bold;
font-size: 34rpx;
}
text:nth-child(1) {
font-size: 24rpx;
}
}
.indexboxitemlefttheretexttow {
margin-left: 12rpx;
font-size: 20rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
color: #999999;
text-decoration: line-through;
}
}
.indexboxitemleftthere_countdown {
width: 100%;
.indexboxitemleftthere_countdowntext {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.indexboxitemleftthere_countdowntexts {
font-family: Roboto, Roboto;
font-weight: 400;
color: #333333;
margin-left: 16rpx;
font-size: 22rpx;
}
}
}
}
}
}
}
}
}
</style>

View File

@@ -1,16 +1,15 @@
<template>
<view class="container">
<view class="box flex-colum-start">
<text>您好</text>
<text>欢迎使用银收客</text>
<view class="box flex-center">
<!-- <text>欢迎登录零点八零</text> -->
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/login/czgqrlogin.png" mode=""></image>
</view>
<view class="top_box" :style="h">
<view class="top_box_one">
<view class="top_box">
<view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">手机号码</text>
<input type="text" v-model="form.loginName" :adjust-position="false" placeholder="请输入手机号码"
maxlength="-1" data-key="mobile" />
<input type="text" v-model="form.loginName" :adjust-position="false" placeholder="请输入手机号码" />
</view>
<view class="top_box_one">
<!-- <view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">密码</text>
<input type="mobile" v-model="form.password" :adjust-position="false" placeholder="8-16位密码"
maxlength="16" :password="!showPassword" />
@@ -18,22 +17,42 @@
<u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon>
</view>
</view> -->
<view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">验证码</text>
<input type="mobile" v-model="form.code" placeholder="请输入短信验证码" maxlength="6" />
<view class="repeats">
<view v-if="showText == true" class="yzm"
style="padding: 8rpx 16rpx 6rpx 16rpx; background: #288efb; border-radius: 15rpx"
@click="CodeRegister">
{{ Recapture }}
</view>
<view v-else
style="color: #ccc; background-color: #f9f9f9; padding: 8rpx 16rpx 6rpx 16rpx; border-radius: 15rpx">
{{ second }}s重新发送
</view>
</view>
</view>
<view class="top_box_tow flex-between">
<view class="top_box_tow flex-between" v-if="showbox">
<text @click="register">注册账号</text>
<text @click="passwords">忘记密码</text>
</view>
<view class="toLogin" @click="toLogin">登录</view>
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!showbox">手机号快速登录
</button>
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
<view class="agreement flex-start">
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
size="12"></u-checkbox></u-checkbox-group>
size="24"></u-checkbox></u-checkbox-group>
<text>阅读并同意银收客</text>
<view class="agreement-Item" @click="Privacy(1)">用户协议</view>
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view>
<!-- #endif -->
<u-overlay :show="agreeShow">
<view class="warp">
<view class="rect">
@@ -41,7 +60,7 @@
<view class="rect_text flex-colum">
<view class="rect_text_one">用户须知</view>
<view class="rect_text_tow">
感谢您使用银收客我们非常重视您的个 人信息和隐私保护在您使用服务前请仔 细阅读
感谢您使用银收客,我们非常重视您的个 人信息和隐私保护在您使用服务前请仔 细阅读
<text @click="Privacy(1)">用户协议</text>
<text @click="Privacy(2)">隐私协议</text>
@@ -73,6 +92,7 @@
showpicker: false,
showpopup: false,
valueinput: '',
showbox: false,
columns: [
['http://admintestapi.sxczgkj.cn/', 'https://ky.sxczgkj.cn', 'http://192.168.2.22:7004',
'http://admintestapi.sxczgkj.cn/', '自定义输入'
@@ -84,10 +104,16 @@
showPassword: false, //是否显示密码
debug: uni.conf.debug,
baseUrl: uni.conf.baseUrl,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码',
form: {
//密码
loginName: '',
password: ''
password: '',
code: '',
inviteCode: ''
}
};
},
@@ -135,6 +161,39 @@
// 切换图片显示隐藏
this.showPassword = !this.showPassword;
},
async CodeRegister() {
//发起验证码
if (this.form.telephone == null || this.form.telephone == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.apix.phoneValidateCode({
// post 手机验证码
phone: this.form.telephone
});
console.log(res);
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
async Privacy(e) {
if (e == 1) {
//用户协议
@@ -244,7 +303,32 @@
} else {
this.$api.msg(res.message);
}
}
},
async getPhoneNumber(res) { // 获取手机号
var resdataa = res
console.log(res)
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let resdata = await this.api.logingetPhoneNumber({
code: data.code,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
console.log(resdata)
if (resdata.data) {
this.phone = resdata.data
this.userlogin()
}
// this.userlogin()
}
});
// #endif
// #ifdef MP-WEIXIN
// #endif
},
}
};
</script>
@@ -253,7 +337,7 @@
page {
width: 100%;
height: 100%;
background: linear-gradient(104deg, #4679ff 0%, #2868e8 47%, #2a94fc 100%);
background: #FFFFFF;
}
.container {
@@ -269,16 +353,11 @@
}
.box {
padding-top: 228rpx;
padding-left: 64rpx;
padding-bottom: 144rpx;
box-sizing: border-box;
padding-top: 110rpx;
text {
font-size: 40rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #ffffff;
image {
width: 128rpx;
height: 128rpx;
}
}
@@ -363,8 +442,8 @@
.box_conf {
position: fixed;
top: 10%;
color: #fff;
top: 0;
color: #000;
padding: 20rpx;
right: 2%;
}
@@ -385,7 +464,6 @@
box-sizing: border-box;
width: 100%;
position: fixed;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
@@ -417,6 +495,18 @@
width: 25rpx;
height: 17rpx;
}
.repeats {
position: absolute;
bottom: 26rpx;
right: 0;
font-size: 24rpx;
z-index: 9;
font-family: $uni_family;
font-weight: 400;
color: #ffffff;
border-radius: 12rpx;
}
}
.top_box_tow {
@@ -432,27 +522,50 @@
}
.toLogin {
width: 570rpx;
margin-top: 112rpx;
padding: 10rpx 0;
margin-top: 212rpx;
width: 100%;
background: #F1CB66;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #333333;
height: 84rpx;
line-height: 84rpx;
text-align: center;
background: #288efb;
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 36rpx;
font-family: $uni_family;
border: none;
}
.toLogin::after {
background: none;
border: none;
}
.toLogins {
margin-top: 32rpx;
width: 100%;
line-height: 84rpx;
height: 84rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #333333;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
font-size: 32rpx;
color: #333333;
text-align: center;
}
.agreement {
margin-top: 14rpx;
font-size: 20rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
width: 100%;
margin-top: 40rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
font-size: 20rpx;
color: #999999;
text-align: left;
.agreement-Item {
color: #4ca1fc;
color: #333333;
}
}
}

342
pages/order/orders.vue Normal file
View File

@@ -0,0 +1,342 @@
<template>
<view>
<u-sticky bgColor="#fff">
<view class="tab-wrap">
<view class="item" v-for="(item, index) in tabs" :key="index" @click="orderswitch(item,index)">
<text>{{ item.name }}</text>
</view>
<view class="line-wrap"
:style="{ left: `${(100 / tabs.length) * active}%`, width: `${100 / tabs.length}%` }">
<view class="line"></view>
</view>
</view>
</u-sticky>
<view class="list-wrap">
<view class="item" v-for="(item,index) in list" :key="index" @click="orderinfo(item)">
<view class="header-wrap">
<text v-if="item.sendType == 'post'">快递</text>
<text v-if="item.sendType == 'takeaway'">外卖</text>
<text v-if="item.sendType == 'takeself'">自提</text>
<text v-if="item.sendType == 'table'">堂食</text>
<text class="status" v-if="item.status == 'unpaid' || item.status == 'paying'">
<text>待支付</text>
</text>
<text class="status" v-if="item.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="item.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="item.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="item.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="item.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="item.status == 'cancelled'">
<text>取消订单</text>
</text>
<text class="status" v-if="item.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="content">
<view class="shop-info">
<view class="shop-item">
<view class="cover flex-start" v-for="(item1,index1) in item.detailList"
:key="index1">
<!-- <image :src="item1.productImg" style="width: 200rpx;height: 200rpx; border-radius: 20rpx;" mode="widthFix"></image> -->
<c-image width="200" height="200" radius="20" :src="item1.productImg"></c-image>
</view>
<!-- <view class="info">
<text class="name">美味大宅蟹</text>
<text class="num">数量1</text>
</view> -->
</view>
</view>
<view class="total">
<text class="t">需付款</text>
<text class="i"></text>
<text class="num">{{item.orderAmount}}</text>
</view>
<view class="intro-wrap">
<text class="time">下单日期{{$u.timeFormat(item.createdAt, 'yyyy-mm-dd hh:MM')}}</text>
<text class="intro num">{{item.totalNumber}}件商品 合计{{item.orderAmount}}</text>
</view>
</view>
<view class="footer-wrap">
<view class="btn">
<text>查看详情</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="form.status" fontSize="28" color="#999" iconSize="28" />
</view>
</template>
<script>
import list from '../../uni_modules/uview-ui/libs/config/props/list';
export default {
data() {
return {
active: 0,
tabs: [{
name: '全部',
type: 1,
status: ''
},
{
name: '待支付',
type: 2,
status: 'unpaid'
},
{
name: '待发货',
type: 3,
status: 'unsend'
},
{
name: '已完成',
type: 4,
status: 'closed'
},
{
name: '退款',
type: 5,
status: 'refund'
}
],
list: [],
is_end: false,
swiperCurrent: '',
form: {
page: 1,
size: 10,
status: 'loadmore',
},
};
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}
if (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')) == -1) {
this.active = 0
} else {
this.active = (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')));
}
this.init_fn()
},
onReachBottom() {
this.orderorderList()
},
methods: {
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopUser').shopId
})
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')
}
},
orderinfo(e) {
uni.pro.navigateTo('order/order_detail', {
orderId: e.id
})
},
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.orderorderList()
},
orderswitch(e, a) {
this.active = a
if (e.type == 1) {
this.swiperCurrent = ''
} else {
this.swiperCurrent = e.status
}
this.init_fn()
},
async orderorderList() {
let res = await this.api.orderorderList({
page: this.form.page,
size: this.form.size,
userId: uni.cache.get('userInfo').id, //userId
status: this.swiperCurrent
})
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
};
</script>
<style scoped lang="scss">
$tabH: 80upx;
$color: #ff411d;
.tab-wrap {
display: flex;
height: $tabH;
position: relative;
.item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 2;
}
.line-wrap {
position: absolute;
bottom: 0;
display: flex;
justify-content: center;
padding-bottom: 8upx;
transition: all 0.3s ease-in-out;
.line {
$h: 6upx;
width: 30%;
height: $h;
border-radius: $h;
background-color: $color;
}
}
}
.list-wrap {
padding: $paddingSize;
.item {
border-radius: 20upx;
background-color: #fff;
&:not(:first-child) {
margin-top: $paddingSize;
}
.header-wrap {
padding: $paddingSize;
border-bottom: 1upx solid #ececec;
display: flex;
justify-content: space-between;
.status {
color: $color;
}
}
.content {
padding: $paddingSize;
.shop-info {
.shop-item {
display: flex;
overflow: hidden;
overflow-x: scroll;
.cover:nth-child(1) {
margin-left: 0rpx;
}
.cover {
// white-space: nowrap;
margin-left: 10rpx;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
padding-left: 20upx;
}
}
}
.total {
display: flex;
align-items: flex-end;
justify-content: flex-end;
.t {
font-weight: bold;
font-size: 32upx;
}
.i {
font-size: 24upx;
}
.num {
font-size: 38upx;
position: relative;
top: 8upx;
}
}
.intro-wrap {
display: flex;
justify-content: space-between;
padding-top: $paddingSize;
.time {
color: #999;
font-size: 24upx;
}
.intro {
font-size: 24upx;
}
}
}
.footer-wrap {
display: flex;
justify-content: flex-end;
border-top: 1upx solid #ececec;
padding: $paddingSize;
.btn {
padding: 8upx 24upx;
border-radius: 100upx;
border: 1px solid #333;
display: flex;
align-items: center;
}
}
}
}
</style>