sadjv3_user/pages/shop/index.vue

626 lines
13 KiB
Vue
Raw Normal View History

2024-07-08 17:58:49 +08:00
<!-- 自定义下拉刷新与上拉加载演示(vue) -->
<template>
<view class="content-view">
2024-08-01 14:29:43 +08:00
<z-paging ref="paging" v-model="dataList" @query="queryList">
<template #top>
2024-07-30 14:17:50 +08:00
<view class="service-head-top">
<view class="service-head-top-left">
<image @click="backImg" src="../../static/fanhui.png" mode="widthFix"></image>
<span>{{getText}}</span>
</view>
<view>
2024-08-07 09:27:45 +08:00
<uni-search-bar @service="serviceTrue" @confirm="search" :cancelext="'取消'" v-model="searchValue"
@input="input" @clear="clear">
2024-07-30 14:17:50 +08:00
</uni-search-bar>
<view class="search-btn" @click="searchBtn">
2024-08-01 14:29:43 +08:00
<image style="width:30rpx; height:30rpx; margin-right: 10rpx;"
src="../../static/search.png"></image>
2024-07-30 14:17:50 +08:00
搜索
</view>
</view>
</view>
2024-08-07 09:27:45 +08:00
<view v-if="getText=='企业'" class="fenlei">
<z-tabs class="z-tabs-fenlei" :list="tabList" @change="tabChange" @changeClick="changeClick" />
</view>
2024-08-01 14:29:43 +08:00
</template>
<template #loadingMoreNoMore>
<custom-nomore />
</template>
2024-08-07 09:27:45 +08:00
<view v-if="getText=='企业'" class="item" v-for="(item,index) in dataList" :key="index" @click="itemClick(item)">
<image :src="item.packageImg" mode="" class="item-img"></image>
<view class="item-view">
<view class="view-cata">
<view class="item-view-title">{{item.title}}</view>
<span class="xiaoer item-view-biao">{{item.levelName}}</span>
</view>
<view class="item-view-bottom-qian">
<span></span>
2024-08-15 16:39:48 +08:00
<span>{{item.price}}</span>
2024-08-07 09:27:45 +08:00
<span></span>
2024-08-08 14:53:16 +08:00
<span>{{item.oldPrice}}</span>
2024-08-07 09:27:45 +08:00
</view>
<view class="flex" style="margin-top: 10rpx;">
<view class="shop_label" v-if="item.tagsData!=''">
<span v-for="tag in item.tagsData" :key="tag">{{tag}}</span>
2024-07-30 14:17:50 +08:00
</view>
2024-08-07 09:27:45 +08:00
<view class="shop_label" v-else>
<span>助眠解压</span>
2024-07-30 14:17:50 +08:00
</view>
2024-08-07 09:27:45 +08:00
</view>
<view class="item-view-bottom">
<view class="item-view-xiangmu">
<span>已售</span><span>{{item.sales}}</span><!-- | 好评{{item.esteemRate}}% -->
2024-07-30 14:17:50 +08:00
</view>
2024-08-07 09:27:45 +08:00
<view class="item-view-bottom-btn">
查看
2024-07-30 14:17:50 +08:00
</view>
</view>
</view>
</view>
2024-08-01 14:29:43 +08:00
<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>
2024-07-30 14:17:50 +08:00
</view>
2024-08-01 14:29:43 +08:00
<view class="item-view-jianjie">
{{item.consortiaContent}}
2024-07-30 14:17:50 +08:00
</view>
2024-08-01 14:29:43 +08:00
<view class="flex" style="margin-top: 10rpx;">
<view class="shop_label" v-if="item.tagsData!=''">
<span v-for="tag in item.tagsData" :key="tag">{{tag}}</span>
</view>
<view class="shop_label" v-else>
<span>助眠解压</span>
</view>
2024-07-30 14:17:50 +08:00
</view>
2024-08-01 14:29:43 +08:00
<view class="item-view-bottom">
<view class="item-view-xiangmu">
<span></span>
</view>
<view class="item-view-bottom-btn">
查看
</view>
2024-07-30 14:17:50 +08:00
</view>
</view>
</view>
</view>
2024-08-01 14:29:43 +08:00
</z-paging>
2024-07-08 17:58:49 +08:00
</view>
</template>
<script>
export default {
data() {
return {
2024-08-01 14:29:43 +08:00
loadingType: 0,
2024-07-08 17:58:49 +08:00
myId: '',
// v-model绑定的这个变量不要在分页请求结束中自己赋值
dataList: [],
2024-08-07 09:27:45 +08:00
typeData: '114',
2024-07-08 17:58:49 +08:00
tabIndex: 0,
2024-08-01 14:29:43 +08:00
searchValue: '',
serviceTrue: true,
page: 1,
limit: 10,
titleNmae: '',
classifyId: '',
getName: '',
2024-08-07 09:27:45 +08:00
tabList: [],
2024-08-01 14:29:43 +08:00
getText: '',
2024-07-08 17:58:49 +08:00
}
},
2024-08-01 14:29:43 +08:00
onLoad(e) {
this.getText = e.text
2024-08-07 09:27:45 +08:00
this.getName = e.name;
2024-07-08 17:58:49 +08:00
this.myId = uni.getStorageSync('userId')
2024-07-25 22:31:49 +08:00
// this.getData();
2024-08-01 14:29:43 +08:00
uni.setNavigationBarTitle({
title: this.getText,
})
2024-08-07 09:27:45 +08:00
this.tabNav()
2024-07-08 17:58:49 +08:00
},
2024-07-25 22:31:49 +08:00
// onPullDownRefresh: function() {
// this.page = 1;
// this.getData()
// },
2024-07-08 17:58:49 +08:00
methods: {
2024-08-07 09:27:45 +08:00
tabNav() {
let data = {
type: "服务类型",
}
this.$Request.get('/app/dict/list', data).then(res => {
if (res.code == 0) {
this.tabList = res.data;
this.classifyId = res.data[0].id;
this.page = 1;
this.dataList = []
this.getData()
}
})
},
2024-08-01 14:29:43 +08:00
input(res) { //搜索 输入框
this.searchValue = res;
2024-07-08 17:58:49 +08:00
},
2024-08-01 14:29:43 +08:00
searchBtn() { //搜索按钮
if (this.searchValue != "") {
2024-08-07 09:27:45 +08:00
this.page = 1;
2024-07-08 17:58:49 +08:00
this.getData()
}
},
2024-08-01 14:29:43 +08:00
getData() {
this.$refs.paging.reload(true);
},
queryList(pageNo, pageSize) {
if (this.getText == '企业') {
var params = {
page: pageNo,
limit: pageSize,
2024-08-07 09:27:45 +08:00
type: this.typeData,
title: this.searchValue,
classifyId: this.classifyId
2024-08-01 14:29:43 +08:00
}
2024-08-07 09:27:45 +08:00
this.$Request.get('/app/massage/package/findPage', params).then(res => {
2024-08-01 14:29:43 +08:00
for (var i = 0; i < res.data.list.length; i++) {
res.data.list[i].tagsData = res.data.list[i].labels.split(',');
2024-08-07 09:27:45 +08:00
if (res.data.list[i].level == 3) {
2024-08-14 16:40:16 +08:00
res.data.list[i].levelName = "资深"
2024-08-07 09:27:45 +08:00
}
if (res.data.list[i].level == 4) {
2024-08-14 16:40:16 +08:00
res.data.list[i].levelName = "金牌"
2024-08-07 09:27:45 +08:00
}
if (res.data.list[i].level == 5) {
2024-08-14 16:40:16 +08:00
res.data.list[i].levelName = "专家"
2024-08-07 09:27:45 +08:00
}
2024-08-01 14:29:43 +08:00
}
this.$refs.paging.complete(res.data.list);
}).catch(res => {
this.$refs.paging.complete(false);
})
2024-08-07 09:27:45 +08:00
}else{
2024-08-01 14:29:43 +08:00
var params = {
page: pageNo,
limit: pageSize,
title: this.searchValue
}
this.$Request.get('/app/consortia/selectConsortiaList', params).then(res => {
for (var i = 0; i < res.data.list.length; i++) {
res.data.list[i].tagsData = res.data.list[i].tags.split(',');
}
console.log("res.data.list",params)
this.$refs.paging.complete(res.data.list);
}).catch(res => {
this.$refs.paging.complete(false);
})
}
2024-08-15 16:39:48 +08:00
2024-08-07 09:27:45 +08:00
},
changeClick(index, item) {
this.classifyId = item.id
this.searchValue = ''
this.page = 1;
this.dataList = []
this.getData()
2024-07-08 17:58:49 +08:00
},
2024-08-01 14:29:43 +08:00
backImg() { //返回上一页
2024-07-08 17:58:49 +08:00
uni.reLaunch({
2024-08-01 14:29:43 +08:00
url: '/pages/index/index'
2024-07-08 17:58:49 +08:00
})
2024-07-25 22:31:49 +08:00
},
2024-07-08 17:58:49 +08:00
clear(res) {
this.getData()
},
itemClick(item) {
2024-08-01 14:29:43 +08:00
if (this.getText == '企业') {
2024-07-08 17:58:49 +08:00
uni.navigateTo({
2024-08-07 09:27:45 +08:00
url: '/pages/shop/qiyeDatail?id=' + item.id+'&name='+'index'
2024-07-08 17:58:49 +08:00
})
2024-08-01 14:29:43 +08:00
} else {
2024-07-08 17:58:49 +08:00
uni.navigateTo({
2024-08-01 14:29:43 +08:00
url: '/pages/shop/yueDaoDianDrtail?id=' + item.consortiaId
2024-07-08 17:58:49 +08:00
})
}
}
}
}
</script>
<style scoped>
2024-08-07 09:27:45 +08:00
/deep/.z-tabs-item-title /deep/span {
white-space: nowrap;
}
.fenlei {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.tab-view {
width: 100%;
display: flex;
flex-direction: column;
position: fixed;
z-index: 999;
/*background:#fff 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;*/
padding-top: 6rpx;
}
.shop_label {
display: flex;
flex-wrap: wrap;
margin-top: 4rpx;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
2024-08-07 09:27:45 +08:00
.shop_label span {
background: linear-gradient(90deg, #ffefde, #fff7ef);
height: 34rpx;
line-height: 34rpx;
border-radius: 8rpx;
padding: 0 10rpx;
font-size: 22rpx;
margin-right: 8rpx;
margin-bottom: 8rpx;
color: #f68607;
}
/deep/.refresh-body .content {}
2024-08-01 14:29:43 +08:00
/deep/.refresh-body {
2024-07-08 17:58:49 +08:00
height: 100% !important;
border-top: 2px solid #f7f7f7;
2024-08-07 09:27:45 +08:00
margin: 80px 0px;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
.content-view {
2024-07-08 17:58:49 +08:00
width: 100%;
height: 100vh;
2024-08-07 09:27:45 +08:00
overflow: hidden;
2024-07-08 17:58:49 +08:00
background-color: #f7f7f7;
2024-08-07 09:27:45 +08:00
/*position: relative;*/
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
.item-view-bottom-btn {
2024-07-08 17:58:49 +08:00
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;
}
2024-08-01 14:29:43 +08:00
.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(4) {
font-size: 26rpx;
color: #848484;
text-decoration-line: line-through;
margin-left: 5px;
}
.item-view-bottom-qian span:nth-child(3) {
2024-08-07 09:27:45 +08:00
font-size: 28rpx;
color: #FF6000;
2024-08-01 14:29:43 +08:00
}
.item-view-bottom-qian span:nth-child(2) {
font-weight: bold;
font-size: 36.81rpx;
color: #FF6000;
}
.item-view-bottom-qian span:nth-child(1) {
font-weight: 400;
font-size: 26rpx;
color: #FF6000;
}
.item-view-bottom-qian {
margin-top: 2px;
}
.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 {
2024-08-07 09:27:45 +08:00
padding: 1px 5px;
2024-07-08 17:58:49 +08:00
border-radius: 15rpx 3rpx 15rpx 3rpx;
2024-08-07 09:27:45 +08:00
width: 50px;
text-align: center;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
.tuina {
background-color: #d1f2df;
2024-07-08 17:58:49 +08:00
color: #17984d;
}
2024-08-01 14:29:43 +08:00
.xiaoer {
background-color: #f1f8d7;
2024-07-08 17:58:49 +08:00
color: #58b314;
}
2024-08-01 14:29:43 +08:00
.taishi {
background-color: #e5d5c6;
2024-07-08 17:58:49 +08:00
color: #805d39;
}
2024-08-01 14:29:43 +08:00
.kangfu {
background-color: #fcf3da;
2024-07-08 17:58:49 +08:00
color: #ff8600;
}
2024-08-01 14:29:43 +08:00
.item-view-xiangmu span:nth-child(2) {
font-weight: normal;
color: #333333;
font-size: 30rpx;
}
.item-view-xiangmu span:nth-child(1) {
font-weight: normal;
color: #666666;
margin-right: 5rpx;
font-size: 30rpx;
}
.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-08 17:58:49 +08:00
font-weight: bold;
font-size: 32rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
2024-08-01 14:29:43 +08:00
.item-view {
2024-08-15 10:36:13 +08:00
width: 59%;
2024-08-01 14:29:43 +08:00
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
justify-content: space-between;
padding: 5rpx 0;
}
.item-img {
width: 240rpx;
height: 200rpx;
2024-07-25 22:31:49 +08:00
border-radius: 14rpx;
2024-08-01 14:29:43 +08:00
position: relative;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
.item-img img {
border-radius: 14rpx;
}
.img-span {
2024-07-08 17:58:49 +08:00
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;
}
2024-08-01 14:29:43 +08:00
.item-img image {
2024-07-08 17:58:49 +08:00
width: 100%;
height: 100%;
}
2024-08-01 14:29:43 +08:00
2024-07-30 14:17:50 +08:00
.item {
width: 100%;
2024-08-01 14:29:43 +08:00
margin: 0 auto;
2024-07-30 14:17:50 +08:00
display: flex;
flex-direction: row;
justify-content: space-between;
/*height: 140px;*/
background: #FFFFFF;
border-radius: 21rpx;
2024-08-07 09:27:45 +08:00
margin-bottom: 10px;
2024-07-30 14:17:50 +08:00
align-items: center;
2024-08-01 14:29:43 +08:00
padding: 20rpx;
2024-08-15 10:36:13 +08:00
align-items:flex-start;
2024-07-30 14:17:50 +08:00
}
2024-08-01 14:29:43 +08:00
2024-07-08 17:58:49 +08:00
.item-detail {
padding: 5rpx 15rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: white;
background-color: #007AFF;
}
2024-07-25 22:31:49 +08:00
2024-07-08 17:58:49 +08:00
.item-line {
position: absolute;
bottom: 0rpx;
left: 0rpx;
height: 1px;
width: 100%;
background-color: #eeeeee;
}
2024-08-01 14:29:43 +08:00
/deep/.zp-paging-container {
2024-07-08 17:58:49 +08:00
background-color: #f7f7f7;
2024-08-01 14:29:43 +08:00
width: 100%;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
/deep/.zp-paging-container-content {
2024-07-30 14:17:50 +08:00
width: 95%;
2024-07-08 17:58:49 +08:00
margin: 0 auto;
}
2024-08-01 14:29:43 +08:00
.index-fenl-title {
2024-07-08 17:58:49 +08:00
width: 81rpx;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
font-weight: bold;
font-size: 34rpx;
2024-08-01 14:29:43 +08:00
color: #019C88;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
.index-fenl-title-bottom {
2024-07-08 17:58:49 +08:00
position: absolute;
bottom: 0;
margin-bottom: 0px;
width: 81rpx;
height: 14rpx;
border-radius: 7rpx;
2024-08-01 14:29:43 +08:00
background: linear-gradient(-48deg, rgba(1, 156, 136, 0.35), rgba(45, 196, 142, 0.35));
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
/deep/.uni-searchbar__cancel {
2024-07-08 17:58:49 +08:00
display: none;
}
2024-08-01 14:29:43 +08:00
/deep/.uni-searchbar__box-icon-search,
.search-btn {
2024-07-23 20:49:06 +08:00
width: 110rpx;
height: 50rpx;
2024-08-07 09:27:45 +08:00
/* background: #18A689;
border-radius: 31rpx; */
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
/deep/.uni-searchbar__box {
height: 34px;
2024-07-23 20:49:06 +08:00
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;
}
2024-08-01 14:29:43 +08:00
/deep/.uni-searchbar {
width: 250px;
2024-07-08 17:58:49 +08:00
border-radius: 31rpx;
2024-07-30 14:17:50 +08:00
padding-right: 24rpx;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
2024-08-07 09:27:45 +08:00
.search-btn {
text-align: center;
color: #019c88;
font-weight: bold;
position: absolute;
right: 40rpx;
top: 20rpx;
font-size: 30rpx;
display: flex;
align-items: center;
}
/deep/.uni-input-input {
display: block;
height: 100%;
background: none;
color: inherit;
opacity: 1;
font: inherit;
line-height: inherit;
letter-spacing: inherit;
text-align: inherit;
text-indent: 10px;
text-transform: inherit;
text-shadow: inherit;
}
/deep/uni-input-form {
display: -webkit-box;
display: -webkit-flex;
display: flex;
position: relative;
width: 100%;
height: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-webkit-justify-content: center;
justify-content: center;
}
2024-08-01 14:29:43 +08:00
.service-head-top-left image {
2024-07-23 20:49:06 +08:00
width: 20px;
height: 20rpx;
2024-08-01 14:29:43 +08:00
margin-right: 5px;
2024-07-23 20:49:06 +08:00
margin-left: 10rpx;
2024-07-08 17:58:49 +08:00
}
2024-08-01 14:29:43 +08:00
.service-head-top-left span {
2024-07-23 20:49:06 +08:00
width: 180rpx;
height: 60rpx;
2024-08-01 14:29:43 +08:00
background: url('../../static/images/headline.png') 0rpx 26rpx;
2024-07-23 20:49:06 +08:00
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
}
2024-08-01 14:29:43 +08:00
.service-head-top-left {
2024-07-08 17:58:49 +08:00
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
2024-08-01 14:29:43 +08:00
.service-head-top {
height: 90rpx;
2024-07-08 17:58:49 +08:00
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
2024-08-01 14:29:43 +08:00
.view-cata {
2024-07-08 17:58:49 +08:00
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
2024-08-01 14:29:43 +08:00
}
2024-08-15 16:39:48 +08:00
</style>