sadjv3_user/pages/my/cika.vue

472 lines
12 KiB
Vue
Raw Normal View History

2024-06-24 11:29:11 +08:00
<!-- 自定义下拉刷新与上拉加载演示(vue) -->
<template>
<view class="content">
2024-07-04 10:52:50 +08:00
<z-paging ref="paging" v-model="dataList" @query="queryList" >
2024-06-24 11:29:11 +08:00
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中如果需要跟着滚动则不要设置slot="top" -->
<!-- 注意此处的z-tabs为独立的组件可替换为第三方的tabs若需要使用z-tabs请在插件市场搜索z-tabs并引入否则会报插件找不到的错误 -->
<template #top>
2024-07-04 10:52:50 +08:00
<view class="service-head-top">
2024-06-24 11:29:11 +08:00
<view class="service-head-top-left">
<image @click="backImg" src="../../static/fanhui.png" mode="widthFix"></image>
<span>项目次卡</span>
</view>
<view>
<uni-search-bar @service="serviceTrue" @confirm="search" :cancelext="'取消'" v-model="searchValue" @input="input"
@clear="clear">
</uni-search-bar>
<view class="search-btn" @click="searchBtn">
搜索
</view>
</view>
</view>
<!-- <view class="fenlei">
<z-tabs class="z-tabs-fenlei" :list="tabList" @change="tabChange" @changeClick="changeClick"/>
</view> -->
</template>
2024-07-26 14:50:20 +08:00
2024-06-24 11:29:11 +08:00
<!-- 自定义下拉刷新view(如果use-custom-refresher为true且不设置下面的slot="refresher"此时不用获取refresherStatus会自动使用z-paging自带的下拉刷新view) -->
<!-- 注意注意注意字节跳动小程序中自定义下拉刷新不支持slot-scope将导致custom-refresher无法显示 -->
<!-- 如果是字节跳动小程序请参照sticky-demo.vue中的写法此处使用slot-scope是为了减少data中无关变量声明降低依赖 -->
2024-07-26 14:50:20 +08:00
<!-- <template #refresher="{refresherStatus}" >-->
2024-06-24 11:29:11 +08:00
<!-- 此处的custom-refresh为demo中自定义的组件非z-paging的内置组件请在实际项目中自行创建这里插入什么view下拉刷新就显示什么view -->
2024-07-26 14:50:20 +08:00
<!-- <custom-refresher :status="refresherStatus" />-->
<!-- </template>-->
2024-06-24 11:29:11 +08:00
<!-- 自定义没有更多数据view -->
2024-07-04 10:33:39 +08:00
<template #loadingMoreNoMore >
2024-06-24 11:29:11 +08:00
<!-- 此处的custom-nomore为demo中自定义的组件非z-paging的内置组件请在实际项目中自行创建这里插入什么view没有更多数据就显示什么view -->
<custom-nomore />
</template>
2024-07-26 14:50:20 +08:00
2024-06-24 11:29:11 +08:00
<!-- 如果希望其他view跟着页面滚动可以放在z-paging标签内 -->
2024-07-04 10:52:50 +08:00
<view class="item" v-for="(item,index) in dataList" :key="index" @click="itemClick(item)" >
2024-06-24 11:29:11 +08:00
<!-- <view class="item-title">{{item.title}}</view>
<view class="item-detail">{{item.detail}}</view> -->
<!-- <view class="item-line"></view> -->
<view class="item-img">
<image :src="item.packageImg" mode=""></image>
<span class="img-span">{{item.status=='1'?'未用完':item.status=='2'?'退款':'已用完'}}</span>
</view>
<view class="item-view">
2024-07-04 10:33:39 +08:00
<view class="view-cata">
<view class="item-view-title">{{item.title}}</view>
<span class="xiaoer item-view-biao">{{item.classifyName}}</span>
2024-06-24 11:29:11 +08:00
</view>
2024-07-03 09:57:08 +08:00
<view class="item-view-bottom-qian">
<span></span>
<span>{{item.price}}</span>
<span>/{{item.serviceCount}}</span>
<span></span>
<span>{{item.oldPrice}}/{{item.serviceCount}}</span>
2024-06-24 11:29:11 +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>
</view>
<view class="shop_label" v-else>
<span>助眠解压</span>
2024-06-24 11:29:11 +08:00
</view>
<view class="item-view-bottom">
2024-07-03 09:57:08 +08:00
<view class="item-view-xiangmu">
2024-07-13 10:04:42 +08:00
<span>已售</span><span>{{item.sales}} <!-- | 好评{{item.esteemRate}}% --></span>
2024-06-24 11:29:11 +08:00
</view>
<view class="item-view-bottom-btn">
查看
</view>
</view>
2024-07-26 14:50:20 +08:00
</view>
2024-06-24 11:29:11 +08:00
</view>
</z-paging>
2024-07-26 14:50:20 +08:00
2024-06-24 11:29:11 +08:00
</view>
</template>
<script>
export default {
data() {
return {
myId: '',
// v-model绑定的这个变量不要在分页请求结束中自己赋值
dataList: [],
tabList: [],
typeData:'105',
tabIndex: 0,
searchValue:'',
serviceTrue:true,
page:1,
limit:10,
2024-07-13 14:21:23 +08:00
titleNmae:'',
tagsData:[]
2024-06-24 11:29:11 +08:00
}
},
onLoad(){
this.myId = uni.getStorageSync('userId')
2024-07-26 14:50:20 +08:00
// this.getData()
2024-06-24 11:29:11 +08:00
},
methods: {
input(res) {//搜索 输入框
this.searchValue=res;
},
searchBtn(){//搜索按钮
if(this.searchValue!=""){
this.getData()
}
},
getData(){
2024-07-26 14:50:20 +08:00
// let data = {
// userId: this.myId,
// type: this.typeData,
// page: this.page,
// limit: this.limit,
// title:this.searchValue,
// }
// this.$Request.get('/app/user/package/findMyPackageList', data).then(res => {
// if (res.code == 0) {
// this.dataList=res.data.records;
// for(var i=0;i<this.dataList.length;i++){
// this.dataList[i].tagsData=this.dataList[i].labels.split(',');
// }
// }
// })
this.$refs.paging.reload(true);
2024-06-24 11:29:11 +08:00
},
tabChange(index) {
this.tabIndex = index;
//当切换tab或搜索时请调用组件的reload方法请勿直接调用queryList方法
//调用reload时参数传true则代表reload时触发下拉刷新效果不传或false则代表取消此效果
this.$refs.paging.reload(true);
},
queryList(pageNo, pageSize) {
// console.log(pageNo,pageSize,this.tabIndex)
// 组件加载时会自动触发此方法,因此默认页面加载时会自动触发,无需手动调用
// 这里的pageNo和pageSize会自动计算好直接传给服务器即可
// 模拟请求服务器获取分页数据,请替换成自己的网络请求
const params = {
userId: this.myId,
page: pageNo,
limit: pageSize,
type: this.typeData,
2024-07-26 14:50:20 +08:00
title:this.searchValue,
2024-06-24 11:29:11 +08:00
}
this.$Request.get('/app/user/package/findMyPackageList',params).then(res => {
// 将请求的结果数组传递给z-paging
2024-07-26 14:50:20 +08:00
for(var i=0;i<res.data.records.length;i++){
res.data.records[i].tagsData=res.data.records[i].labels.split(',');
}
2024-06-24 11:29:11 +08:00
this.$refs.paging.complete(res.data.records);
}).catch(res => {
// 如果请求失败写this.$refs.paging.complete(false);
// 注意每次都需要在catch中写这句话很麻烦z-paging提供了方案可以全局统一处理
// 在底层的网络请求抛出异常时写uni.$emit('z-paging-error-emit');即可
this.$refs.paging.complete(false);
})
},
backImg(){//返回上一页
uni.reLaunch({
url:'/pages/my/index'
})
2024-07-26 14:50:20 +08:00
},
2024-06-24 11:29:11 +08:00
clear(res) {
this.getData()
},
itemClick(item) {
uni.navigateTo({
url:'/pages/my/cikarDrtail?id='+item.id+'&limit='+this.limit+'&page='+this.page+'&name='+'my'
})
}
}
}
</script>
<style scoped>
2024-07-13 14:21:23 +08:00
.shop_label{
display: flex;
flex-wrap: wrap;
2024-07-24 10:54:23 +08:00
margin-top: 10rpx;
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 10:54:23 +08:00
height: 34rpx;
line-height: 34rpx;
2024-07-13 14:21:23 +08:00
border-radius: 8rpx;
2024-07-24 10:54:23 +08:00
padding: 0 10rpx;
2024-07-22 15:28:47 +08:00
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-03 09:57:08 +08:00
.item-view-bottom-qian{
margin-top: 5px;
}
2024-06-24 11:29:11 +08:00
.item-view-bottom-btn{
text-align: center;
width: 131rpx;
2024-07-04 10:33:39 +08:00
height: 55rpx;
line-height: 55rpx;
2024-06-24 11:29:11 +08:00
background: linear-gradient(90deg, #019C88, #0FA78B, #35C495);
border-radius: 10rpx;
font-weight: bold;
2024-07-04 10:33:39 +08:00
font-size: 28rpx;
2024-06-24 11:29:11 +08:00
color: #FFFFFF;
}
.item-view-bottom-qian span:nth-child(4){
2024-07-22 15:28:47 +08:00
font-size: 26rpx;
2024-06-24 11:29:11 +08:00
color: #848484;
text-decoration-line: line-through;
margin-left: 5px;
}
2024-07-22 15:28:47 +08:00
.item-view-bottom-qian span:nth-child(5){
font-size: 26rpx;
color: #848484;
text-decoration-line: line-through;
}
2024-06-24 11:29:11 +08:00
.item-view-bottom-qian span:nth-child(1){
font-weight: 400;
2024-07-22 15:28:47 +08:00
font-size: 26rpx;
2024-06-24 11:29:11 +08:00
color: #F95900;
}
.item-view-bottom-qian span:nth-child(2){
font-weight: bold;
font-size: 36.81rpx;
color: #F95900;
}
.item-view-bottom-qian span:nth-child(3){
2024-07-22 15:28:47 +08:00
font-size: 26rpx;
2024-06-24 11:29:11 +08:00
color: #F95900;
}
.item-view-bottom{
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.item-view-jianjie{
font-weight: 400;
2024-06-28 17:27:48 +08:00
font-size: 24rpx;
color: #999;
2024-06-24 11:29:11 +08:00
margin:5px 0px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 显示的行数,可以根据需要修改 */
overflow: hidden;
text-overflow: ellipsis;
}
.item-view-biao{
2024-07-04 10:33:39 +08:00
padding: 1px 5px;
border-radius: 15rpx 3rpx 15rpx 3rpx;
}
2024-06-24 11:29:11 +08:00
.tuina{
background-color:#d1f2df;
color: #17984d;
}
.xiaoer{
background-color:#f1f8d7;
color: #58b314;
}
.taishi{
background-color:#e5d5c6;
color: #805d39;
}
.kangfu{
background-color:#fcf3da;
color: #ff8600;
}
.item-view-xiangmu span:nth-child(2){
font-weight: normal;
color: #666666;
2024-07-04 10:33:39 +08:00
}
.item-view-xiangmu span:nth-child(1){
font-weight: normal;
color: #999;
margin-right: 5rpx;
2024-06-24 11:29:11 +08:00
}
.item-view-xiangmu{
width: 100%;
display: flex;
flex-direction: row;
font-weight: 400;
2024-07-04 10:33:39 +08:00
font-size: 25rpx;
align-items: flex-end;
2024-06-24 11:29:11 +08:00
}
.item-view-title{
2024-07-04 10:33:39 +08:00
width: 76%;
2024-06-24 11:29:11 +08:00
font-weight: bold;
2024-07-22 15:28:47 +08:00
font-size: 31rpx;
2024-06-24 11:29:11 +08:00
color: #333333;
2024-07-04 10:33:39 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2024-06-24 11:29:11 +08:00
}
.item-view{
width: 55%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
2024-07-22 15:28:47 +08:00
justify-content: space-between;
2024-07-22 16:40:23 +08:00
padding: 10rpx 0;
2024-06-24 11:29:11 +08:00
}
.item-img{
width: 285rpx;
height: 120px;
border-radius: 14rpx;
position: relative;
}
2024-07-22 15:28:47 +08:00
.item-img img{
2024-07-26 14:50:20 +08:00
border-radius: 14rpx;
2024-07-22 15:28:47 +08:00
}
2024-06-24 11:29:11 +08:00
.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%;
2024-06-28 17:27:48 +08:00
border-radius: 14rpx;
2024-06-24 11:29:11 +08:00
}
.item {
2024-07-22 16:40:23 +08:00
width:96%;
margin:0 auto ;
2024-06-24 11:29:11 +08:00
display: flex;
flex-direction: row;
justify-content: space-between;
height: 140px;
background: #FFFFFF;
border-radius: 21rpx;
2024-07-04 10:33:39 +08:00
margin-top:10px;
2024-06-24 11:29:11 +08:00
align-items: center;
2024-07-22 16:40:23 +08:00
padding:12px;
2024-06-24 11:29:11 +08:00
}
2024-07-26 14:50:20 +08:00
2024-06-24 11:29:11 +08:00
.item-detail {
padding: 5rpx 15rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: white;
background-color: #007AFF;
}
2024-07-26 14:50:20 +08:00
2024-06-24 11:29:11 +08:00
.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{
2024-07-22 15:28:47 +08:00
width: 100%;
2024-07-24 10:54:23 +08:00
margin: 0 auto;
2024-06-24 11:29:11 +08:00
}
.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;
}
2024-07-26 14:50:20 +08:00
2024-07-24 10:54:23 +08:00
/deep/.uni-searchbar__box-icon-search,.search-btn{
2024-07-22 15:28:47 +08:00
width: 110rpx;
height: 50rpx;
2024-06-24 11:29:11 +08:00
background: #18A689;
border-radius: 31rpx;
2024-07-26 14:50:20 +08:00
2024-06-24 11:29:11 +08:00
}
/deep/.uni-searchbar__box{
2024-07-22 15:28:47 +08:00
height: 30px;
border-radius: 30px !important;
2024-06-24 11:29:11 +08:00
background-color: #fff !important;
2024-07-22 15:28:47 +08:00
border: 1px solid #09a28a;
2024-06-24 11:29:11 +08:00
display: flex;
flex-direction: row;
flex-flow: row-reverse;
position: relative;
2024-07-24 10:54:23 +08:00
}
/deep/.uni-searchbar{
width: 230px;
border-radius: 31rpx;
margin-right: 20rpx;
2024-07-22 15:28:47 +08:00
}
.search-btn{
text-align: center;
2024-07-24 10:54:23 +08:00
line-height: 56rpx;
2024-07-22 15:28:47 +08:00
color: #fff;
position: absolute;
2024-07-24 10:54:23 +08:00
right:30rpx;
top: 22rpx;
height: 56rpx !important;
2024-06-24 11:29:11 +08:00
}
.service-head-top-left image{
2024-07-22 15:28:47 +08:00
width: 20px;
height: 20rpx;
margin-right:5px;
margin-left: 10rpx;
2024-06-24 11:29:11 +08:00
}
.service-head-top-left span{
2024-07-24 10:54:23 +08:00
height:100rpx;
background:url('../../static/images/headline.png') 0rpx 50rpx;
2024-07-22 15:28:47 +08:00
background-repeat: no-repeat;
2024-06-24 11:29:11 +08:00
font-weight: bold;
2024-07-04 10:33:39 +08:00
font-size: 34rpx;
2024-06-24 11:29:11 +08:00
color: #171717;
2024-07-24 10:54:23 +08:00
display: flex;
align-items: center;
2024-06-24 11:29:11 +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 10:54:23 +08:00
height: 100rpx;
2024-06-24 11:29:11 +08:00
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
2024-07-22 15:28:47 +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-04 10:33:39 +08:00
}
.view-cata{
display: flex;
flex-direction: row;
align-items: center;
2024-06-24 11:29:11 +08:00
}
</style>