sadjv3_user/pages/shop/index.vue

543 lines
12 KiB
Vue
Raw Normal View History

2024-07-08 17:58:49 +08:00
<!-- 自定义下拉刷新与上拉加载演示(vue) -->
<template>
<view class="content-view">
<view class="service-head-top">
<view class="service-head-top-left">
<image @click="backImg" src="../../static/fanhui.png" mode="widthFix"></image>
2024-07-10 15:32:28 +08:00
<span>{{getText}}</span>
2024-07-08 17:58:49 +08:00
</view>
<view>
2024-07-10 15:32:28 +08:00
<uni-search-bar @service="serviceTrue" :cancelext="'取消'" v-model="searchValue" @input="input"
2024-07-08 17:58:49 +08:00
@clear="clear">
</uni-search-bar>
<view class="search-btn" @click="searchBtn">
搜索
</view>
</view>
</view>
<t-refresh ref="refresh" v-if="dataList.length>0" @refresh="refresh" @loadMore="loadMore" :loadingType="loadingType" :tPadding="0">
<template slot="content">
2024-07-10 15:32:28 +08:00
<view v-if="getText=='企业'">
2024-07-08 17:58:49 +08:00
<view class="item" v-for="(item,index) in dataList" :key="index" @click="itemClick(item)">
2024-07-10 15:32:28 +08:00
<image :src="item.massageImg" mode="" class="item-img"></image>
2024-07-08 17:58:49 +08:00
<view class="item-view">
<view class="view-cata">
2024-07-19 15:13:22 +08:00
<view class="item-view-title">{{item.title}}</view>
2024-07-12 09:09:37 +08:00
<span class="xiaoer">{{item.classifyName}}</span>
2024-07-08 17:58:49 +08:00
</view>
2024-07-10 15:32:28 +08:00
<view class="item-view-bottom-qian">
2024-07-08 17:58:49 +08:00
<span></span>
<span>{{item.price}}</span>
2024-07-10 15:32:28 +08:00
<span style="color: #999;text-decoration: line-through;margin-left: 5px;">{{item.oldPrice}}</span>
2024-07-08 17:58:49 +08:00
</view>
2024-07-25 20:58:11 +08:00
<view class="shop_label" v-if="item.tagsData">
<span v-for="tag in item.tagsData" :key="tag">{{tag}}</span>
2024-07-10 15:32:28 +08:00
</view>
<view class="item-view-bottom">
2024-07-08 17:58:49 +08:00
<view class="item-view-xiangmu">
2024-07-13 10:04:42 +08:00
<span>已售</span><span>{{item.sales}}</span>
2024-07-08 17:58:49 +08:00
</view>
2024-07-10 15:32:28 +08:00
</view>
2024-07-08 17:58:49 +08:00
</view>
</view>
2024-07-10 15:32:28 +08:00
</view>
<view v-if="getText=='商家'">
<view class="item" v-for="(item,index) in dataList" :key="index" @click="itemClick(item)">
<image :src="item.logo" mode="" class="item-img"></image>
<view class="item-view">
<view class="view-cata">
<view class="item-view-title">{{item.consortiaName}}</view>
</view>
<view class="item-view-jianjie">
{{item.consortiaContent}}
</view>
2024-07-25 20:58:11 +08:00
<view class="shop_label" v-if="item.tagsData">
<span v-for="tag in item.tagsData" :key="tag">{{tag}}</span>
2024-07-10 15:32:28 +08:00
</view>
<view class="item-view-bottom">
2024-07-11 14:37:44 +08:00
<!--<view class="item-view-bottom-btn">
2024-07-10 15:32:28 +08:00
预约
2024-07-11 14:37:44 +08:00
</view>-->
2024-07-10 15:32:28 +08:00
</view>
</view>
2024-07-08 17:58:49 +08:00
</view>
</view>
2024-07-10 15:32:28 +08:00
2024-07-08 17:58:49 +08:00
<empty v-if="dataList.length==0"></empty>
</template>
</t-refresh>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
import tRefresh from "@/components/t-refresh/t-refresh.vue"
export default {
components:{tRefresh,empty},
data() {
return {
loadingType:0,
myId: '',
// v-model绑定的这个变量不要在分页请求结束中自己赋值
dataList: [],
typeData:'104',
tabIndex: 0,
searchValue:'',
serviceTrue:true,
page:1,
limit:10,
titleNmae:'',
classifyId:'',
getName:'',
2024-07-10 15:32:28 +08:00
getText:'',
tagsData:[]
2024-07-08 17:58:49 +08:00
}
},
onLoad(e){
this.typeData=e.type
this.getName=e.name;
2024-07-10 15:32:28 +08:00
this.getText=e.text
2024-07-08 17:58:49 +08:00
this.myId = uni.getStorageSync('userId')
2024-07-12 13:51:45 +08:00
this.getData();
uni.setNavigationBarTitle({
title: this.getText,
})
2024-07-08 17:58:49 +08:00
},
onPullDownRefresh: function() {
this.page = 1;
this.getData()
},
methods: {
// 加载更多
loadMore: async function() {
//loadingType: 0.数据未加载完 1.数据全部加载完了 2.数据加载中
if(this.loadingType==0){
this.loadingType=2
//模拟数据请求
setTimeout(()=>{
this.page++;
this.loadingType=0;
this.getData()
},1000)
}
},
input(res) {//搜索 输入框
this.searchValue=res;
console.log('----input:', res)
},
searchBtn(){//搜索按钮
if(this.searchValue!=""){
this.getData()
}
},
getData(){
var that=this;
2024-07-10 15:32:28 +08:00
if(that.getText=='企业'){
that.$Request.get("/app/artificer/selectMassageTypeQyPage", {
city:'长春',
2024-07-08 17:58:49 +08:00
page:that.page,
limit:that.limit,
title:that.searchValue
}).then(res => {
if (res.code == 0) {
if (res.data) {
if (this.page == 1) this.dataList = []; //如果是第一页需手动制空列表
this.dataList = [...this.dataList, ...res.data.list]; //追加新数据
2024-07-13 13:49:16 +08:00
for(var i=0;i<this.dataList.length;i++){
2024-07-25 20:58:11 +08:00
this.dataList[i].tagsData=this.dataList[i].labels.split(',');
2024-07-13 13:49:16 +08:00
}
2024-07-08 17:58:49 +08:00
uni.stopPullDownRefresh()
}
}
});
2024-07-10 15:32:28 +08:00
}else{//约到店
that.$Request.get("/app/consortia/selectConsortiaList", {
page:that.page,
limit:that.limit,
2024-07-11 16:18:37 +08:00
consortiaName:that.searchValue
2024-07-10 15:32:28 +08:00
}).then(res => {
if (res.code == 0) {
if (res.data) {
if (this.page == 1) this.dataList = []; //如果是第一页需手动制空列表
this.dataList = [...this.dataList, ...res.data.list]; //追加新数据
for(var i=0;i<this.dataList.length;i++){
this.tagsData=this.dataList[i].tags.split(',');
}
uni.stopPullDownRefresh()
}
}
});
}
2024-07-08 17:58:49 +08:00
},
backImg(){//返回上一页
uni.reLaunch({
url:'/pages/index/index'
})
},
clear(res) {
this.getData()
},
itemClick(item) {
2024-07-10 15:32:28 +08:00
if(this.getText=='企业'){
2024-07-08 17:58:49 +08:00
uni.navigateTo({
2024-07-10 15:32:28 +08:00
url:'/pages/my/fuwuDateil?id='+item.massageTypeId+'&limit='+this.limit+'&page='+this.page+'&name='+'index'+'&isCanCoupon='+item.isCanCoupon
2024-07-08 17:58:49 +08:00
})
2024-07-10 15:32:28 +08:00
}else{
2024-07-08 17:58:49 +08:00
uni.navigateTo({
2024-07-10 15:32:28 +08:00
url:'/pages/shop/yueDaoDianDrtail?id='+item.consortiaId
2024-07-08 17:58:49 +08:00
})
}
}
}
}
</script>
<style scoped>
.item-view-bottom-qian{
margin-top: 5px;
}
/deep/.refresh-body .content{
background-color: #f7f7f7;
}
/deep/.refresh-body{
height: 100% !important;
border-top: 2px solid #f7f7f7;
}
.content-view{
width: 100%;
height: 100vh;
overflow: auto;
background-color: #f7f7f7;
position: relative;
}
.item-view-bottom-btn{
text-align: center;
width: 131rpx;
height: 55rpx;
line-height: 55rpx;
background: linear-gradient(90deg, #019C88, #0FA78B, #35C495);
border-radius: 10rpx;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
}
.item-view-bottom-qian span:nth-child(4){
font-size: 28rpx;
color: #848484;
text-decoration-line: line-through;
margin-left: 5px;
}
.item-view-bottom-qian span:nth-child(5){
font-size: 28rpx;
color: #848484;
text-decoration-line: line-through;
}
.item-view-bottom-qian span:nth-child(1){
font-weight: 400;
font-size: 25rpx;
2024-07-25 20:58:11 +08:00
color: #FF1200;
2024-07-08 17:58:49 +08:00
}
.item-view-bottom-qian span:nth-child(2){
font-weight: bold;
font-size: 36.81rpx;
2024-07-25 20:58:11 +08:00
color: #FF1200;
2024-07-08 17:58:49 +08:00
}
.item-view-bottom-qian span:nth-child(3){
font-size: 25rpx;
2024-07-25 20:58:11 +08:00
color: #FF1200;
2024-07-08 17:58:49 +08:00
}
.item-view-bottom{
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.item-view-jianjie{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin:5px 0px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 显示的行数,可以根据需要修改 */
overflow: hidden;
text-overflow: ellipsis;
}
.item-view-biao{
border-radius: 15rpx 3rpx 15rpx 3rpx;
}
.tuina{
background-color:#d1f2df;
color: #17984d;
}
.xiaoer{
background-color:#f1f8d7;
color: #58b314;
2024-07-12 09:09:37 +08:00
font-size: 22rpx;
padding: 3rpx 3rpx;
border-radius: 15rpx 15rpx 2rpx 2rpx;
2024-07-08 17:58:49 +08:00
}
.taishi{
background-color:#e5d5c6;
color: #805d39;
}
.kangfu{
background-color:#fcf3da;
color: #ff8600;
}
.item-view-xiangmu span:nth-child(2){
font-weight: normal;
color: #666666;
}
.item-view-xiangmu span:nth-child(1){
font-weight: normal;
color: #999;
margin-right: 5rpx;
}
.item-view-xiangmu{
width: 100%;
display: flex;
flex-direction: row;
font-weight: 400;
font-size: 25rpx;
align-items: flex-end;
}
.item-view-title{
2024-07-12 09:09:37 +08:00
width: 75%;
2024-07-08 17:58:49 +08:00
font-weight: bold;
font-size: 32rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-view{
width: 55%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
.item-img{
width: 285rpx;
height: 120px;
border-radius: 14rpx;
position: relative;
}
.item-img img{
border-radius: 14rpx;
}
.img-span{
padding: 2px 5px;
font-weight: 400;
font-size: 8px;
color: #FFFFFF;
background: linear-gradient(-90deg, #FF6F48, #FF9E69);
border-radius: 7px 0px 7px 0px;
position: absolute;
bottom: 0px;
right: 0;
margin-bottom: 5px;
margin-right: 5px;
}
.item-img image{
width: 100%;
height: 100%;
}
.item {
width: 96%;
margin: 0 2% ;
display: flex;
flex-direction: row;
justify-content: space-between;
height: 140px;
background: #FFFFFF;
border-radius: 21rpx;
margin-top:10px;
align-items: center;
padding: 0px 10px;
}
.item-detail {
padding: 5rpx 15rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: white;
background-color: #007AFF;
}
.item-line {
position: absolute;
bottom: 0rpx;
left: 0rpx;
height: 1px;
width: 100%;
background-color: #eeeeee;
}
/deep/.zp-paging-container{
background-color: #f7f7f7;
width:100%;
}
/deep/.zp-paging-container-content{
width: 95%;
margin: 0 auto;
}
.fenlei{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.index-fenl-title{
width: 81rpx;
text-align: center;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
font-weight: bold;
font-size: 34rpx;
color:#019C88;
}
.index-fenl-title-bottom{
position: absolute;
bottom: 0;
margin-bottom: 0px;
width: 81rpx;
height: 14rpx;
border-radius: 7rpx;
background: linear-gradient(-48deg,rgba(1, 156, 136, 0.35),rgba(45, 196, 142, 0.35));
}
/deep/.uni-searchbar__cancel{
display: none;
}
.search-btn{
text-align: center;
2024-07-24 14:27:50 +08:00
line-height: 56rpx;
2024-07-08 17:58:49 +08:00
color: #fff;
position: absolute;
2024-07-24 14:27:50 +08:00
right:30rpx;
top: 22rpx;
height: 56rpx !important;
2024-07-08 17:58:49 +08:00
}
/deep/.uni-searchbar__box-icon-search,.search-btn{
2024-07-23 20:49:06 +08:00
width: 110rpx;
height: 50rpx;
2024-07-08 17:58:49 +08:00
background: #18A689;
border-radius: 31rpx;
}
/deep/.uni-searchbar__box{
2024-07-23 20:49:06 +08:00
height: 30px;
border-radius: 30px !important;
2024-07-08 17:58:49 +08:00
background-color: #fff !important;
2024-07-23 20:49:06 +08:00
border: 1px solid #09a28a;
2024-07-08 17:58:49 +08:00
display: flex;
flex-direction: row;
flex-flow: row-reverse;
position: relative;
}
/deep/.uni-searchbar{
2024-07-23 20:49:06 +08:00
width: 230px;
2024-07-08 17:58:49 +08:00
border-radius: 31rpx;
2024-07-24 14:27:50 +08:00
margin-right: 20rpx;
2024-07-08 17:58:49 +08:00
}
.service-head-top-left image{
2024-07-23 20:49:06 +08:00
width: 20px;
height: 20rpx;
margin-right:5px;
margin-left: 10rpx;
2024-07-08 17:58:49 +08:00
}
.service-head-top-left span{
2024-07-23 20:49:06 +08:00
width: 180rpx;
height: 60rpx;
background:url('../../static/images/headline.png') 0rpx 26rpx;
background-repeat: no-repeat;
2024-07-08 17:58:49 +08:00
font-weight: bold;
font-size: 34rpx;
color: #171717;
2024-07-23 20:49:06 +08:00
margin-top: 14rpx;
2024-07-08 17:58:49 +08:00
}
.service-head-top-left{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.service-head-top{
width: 100%;
2024-07-24 14:27:50 +08:00
height: 100rpx;
2024-07-08 17:58:49 +08:00
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
2024-07-24 14:27:50 +08:00
background: linear-gradient(60deg,rgba(115, 212, 183, 0.2),rgba(227, 251, 244, 0.1),rgba(193, 236, 223, 0.35));
border-bottom:1rpx solid #c4ede1;
2024-07-08 17:58:49 +08:00
}
.view-cata{
display: flex;
flex-direction: row;
align-items: center;
}
.shop_category{
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
font-size: 26rpx;
padding: 8rpx 0;
margin-top:40rpx ;
}
.shop_category_a{
color: #019c88;
}
.shop_item{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 90%;
margin: 15rpx auto;
}
.shop_color{
color:#fb672b;
font-weight: bold;
font-size: 38rpx;
}
.shop_label{
display: flex;
flex-wrap: wrap;
2024-07-24 14:27:50 +08:00
margin-top: 10rpx;
2024-07-08 17:58:49 +08:00
}
2024-07-13 14:21:23 +08:00
.shop_label span{
2024-07-25 20:58:11 +08:00
background: linear-gradient(90deg, #ffefde, #fff7ef);
2024-07-24 14:27:50 +08:00
height: 34rpx;
line-height: 34rpx;
2024-07-13 14:21:23 +08:00
border-radius: 8rpx;
2024-07-24 14:27:50 +08:00
padding: 0 10rpx;
font-size: 22rpx;
2024-07-13 14:21:23 +08:00
margin-right: 8rpx;
margin-bottom: 8rpx;
2024-07-25 20:58:11 +08:00
color: #f68607;
2024-07-13 14:21:23 +08:00
}
2024-07-08 17:58:49 +08:00
.shop-arrow{
display: inline-block;
border-top: 1px solid;
border-right: 1px solid;
width: 7px;
height: 7px;
border-color: #999;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
margin-top: 7px;
}
2024-07-13 14:21:23 +08:00
2024-07-08 17:58:49 +08:00
</style>