flying-monkey/pagesA/project/projectList.vue

367 lines
11 KiB
Vue

<template>
<view class="content" >
<statusNav navBarTitle="项目列表" :ifReturn="false"></statusNav>
<container-subgroup-two>
<view slot="content" style="margin: -30rpx -30rpx -0rpx;">
<view class="pad-s20 bacf">
<view class="project-list-input">
<input @confirm="getData" type="text" @input="keywordInput" class="int" v-model="inputData" placeholder="请输入关键字" placeholder-style="color:#999999;" />
<view class="xian"></view>
<image @tap="getData" class="search" src="../../static/iocn/ss.png" mode="aspectFill" lazy-load></image>
</view>
</view>
<view class="screen bbot mar-sx20">
<picker class="width30 disjcac" @change="bindPickerChange" :value="index" :range="array" :range-key="'name'">
<view class="li">
<view v-if="initial_value!=''" class="text">{{initial_value}}</view>
<view v-else class="text clips1">{{array[index].name}}</view>
<image class="img" src="../../static/iocn/xla.png" mode="aspectFill" lazy-load></image>
</view>
</picker>
<picker class="width30 disjcac" mode="date" :value="date" @change="bindDateChange">
<view class="li">
<view class="text">{{completion_time || '竣工日期'}}</view>
<image class="img" src="../../static/iocn/xla.png" mode="aspectFill" lazy-load></image>
</view>
</picker>
<view class="li width30 disjcac">
<view class="text">筛选</view>
<image class="imgA" src="../../static/iocn/sx.png" mode="aspectFill" lazy-load>
</image>
</view>
</view>
<view class="project-list">
<view class="li animated fadeIn" @click="projectDetailsFun(item.project_id)" v-for="(item,index) in dataList.data" :key="index">
<view class="message">
<image class="img" :src="item.completed_img" mode="aspectFill" lazy-load></image>
<view class="text disjb fc" style="height: 180rpx;">
<view class="clips1 fon24 bold">{{item.project_name}}</view>
<view class="line-h38" style="margin-left: -20rpx;height: 80%;">
<view class="serial-number scal09" v-if="item.project_number">项目编号:{{item.project_number}}</view>
<view class="specification scal09" v-if="item.product_model">规格型号:{{item.product_model}}</view>
<view class="specification scal09" v-if="item.product_size">产品尺寸:{{item.product_size}}</view>
<view class="installation-site scal09" v-if="item.installation_location">安装位置:{{item.installation_location}}</view>
</view>
</view>
</view>
<view class="project-list-address col6 mar-s20 disjbac">
<view class="address">
<image class="img flexs" src="../../static/iocn/im.png" mode="scaleToFill" lazy-load></image>
<view class="text scal09" style="margin-left: -26rpx;">{{item.address}}</view>
</view>
<view class="date scal09 flexs" v-if="item.joint_starting_times">{{item.joint_starting_times.slice(0,10)}}</view>
</view>
<view v-if="item.warranty_time==1" class="icon iconBera">质保中</view>
<view v-else class="icon iconBer">质保到期</view>
</view>
<pitera v-if="total==dataList.data.length && dataList.data.length" textStr="暂无更多项目列表数据"></pitera>
</view>
<nothing-page v-if="dataList.data.length==0 && !ifLoading" content="暂无更多项目列表数据"></nothing-page>
</view>
</container-subgroup-two>
<footTabOne :current="1"></footTabOne>
</view>
</template>
<script>
import statusNav from '../../components/status-nav.vue';
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import pitera from '@/components/nothing/pitera.vue';
import {getProductType} from '@/jsFile/public-api.js';
export default {
components: {
footTabOne,
statusNav,
containerSubgroupTwo,
pitera
},
data() {
const currentDate = this.getDate({
format: true
})
return {
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 40,
inputData: "",//关键字
date: currentDate,
initial_value:'产品类型',
array: [],
index: 0,
statusHeight: uni.getSystemInfoSync().statusBarHeight + 40,
dataList: {
list_rows: 10,
page: 1,
data: [
]
},
productType:'',//产品类型id
completion_time:'',//竣工日期
total:'',//总数
ifLoading:true
}
},
onReachBottom() {
if(this.total!=this.dataList.data.length) {
this.dataList.page++;
this.getData();
}
},
onLoad() {
this.getData()
// 调用产品类型事件
this.getProjectType();
},
methods: {
// 关键字输入框监听事件
keywordInput(){
this.dataList.page = 1;
},
// 查询项目列表
getData() {
uni.showLoading({
mask:true,
title:'加载中...'
})
if(this.dataList.page==1) this.dataList.data = [];
this.$requst.get('/universal/api.project/project_list', {
product_type:this.productType,
completion_time:this.completion_time,
list_rows: this.dataList.list_rows,
page: this.dataList.page,
keyword:this.inputData
}).then(res => {
if (res.code) {
// 设置项目总数
this.total = res.data.total;
this.dataList.data = [...this.dataList.data,...res.data.data];
}
uni.hideLoading();
this.ifLoading = false;
})
},
projectDetailsFun(id) {
uni.navigateTo({
url: `/pagesA/project/details?id=${id}`
})
},
// 查询产品类型
getProjectType(){
getProductType().then(res=>{
if(res.code) {
this.array = res.data;
}
})
},
bindPickerChange(data) {
// console.log(data)
this.initial_value = '';
this.index = data.detail.value;
this.dataList.page = 1;
// 设置产品类型id
this.productType = this.array[this.index].id;
// 调用查询项目列表事件
this.getData();
},
bindDateChange(date) {
// console.log(date)
this.dataList.page = 1;
// 设置竣工日期
this.completion_time = date.detail.value;
// 调用查询项目列表事件
this.getData();
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
console.log(year, month, day)
return `${year}-${month}-${day}`;
}
}
}
</script>
<style scoped>
page {
background-color: #F7F7F7;
}
.project-list-input {
width: 100%;
height: 114rpx;
position: relative;
padding: 20rpx 16rpx;
box-sizing: border-box;
background-color: #FFFFFF
}
.project-list-input .int {
width: 100%;
height: 100%;
background-color: #F7F7F7;
padding: 0 25rpx;
font-size: 26rpx;
padding-right: 100rpx;
box-sizing: border-box;
border-radius: 36rpx;
}
.project-list-input .xian {
width: 3rpx;
height: 35rpx;
position: absolute;
background-color: #EAEAEA;
right: 100rpx;
top: 50%;
margin-top: -14rpx;
}
.project-list-input .search {
width: 28rpx;
height: 28rpx;
position: absolute;
right: 43rpx;
top: 50%;
margin-top: -14rpx;
}
.screen {
display: flex;
justify-content: space-around;
padding: 26rpx 20rpx;
border-top: 1rpx solid #EEEEEE;
}
.screen .li {
display: flex;
align-items: center;
}
.screen .li .text {
font-size: 26rpx;
color: #333333;
margin-right: 10rpx;
}
.screen .li .img {
width: 14rpx;
height: 8rpx;
}
.screen .li .imgA {
width: 24rpx;
height: 23rpx;
}
.project-list .li {
box-sizing: border-box;
background-color: #FFFFFF;
position: relative;
margin: 0 20rpx;
border-radius: 10rpx;
margin-bottom: 20rpx;
padding: 40rpx 20rpx 20rpx 20rpx;
}
.project-list .li .icon {
display: flex;
justify-content: center;
align-items: center;
width: 135rpx;
height: 40rpx;
position: absolute;
font-size: 22rpx;
color: #FFFFFF;
right: 23rpx;
text-align: center;
background-size: 100% 100%;
top: -10rpx;
}
.project-list .li .iconBer {
background-image: url(../../static/iocn/za.png);
}
.project-list .li .iconBera {
background-image: url(../../static/iocn/zaa.png);
}
.project-list .li .message {
display: flex;
}
.project-list .li .message .img {
width: 230rpx;
margin-right: 11rpx;
height: 180rpx;
}
.project-list .li .message .text {
flex: 1;
}
.project-list .li .message .serial-number {
color: #ff8800;
font-size: 22rpx;
/* margin-bottom: 15rpx; */
}
.project-list .li .message .specification {
color: #00b1ff;
font-size: 22rpx;
/* margin-bottom: 15rpx; */
}
.project-list .li .message .installation-site {
color: #6b6a6a;
font-size: 22rpx;
/* margin-bottom: 15rpx; */
}
.project-list-address {
display: flex;
/* justify-content: space-between; */
}
.project-list-address .text {
font-size: 22rpx;
}
.project-list-address .date {
font-size: 22rpx;
text-align: right;
/* margin-left: 20rpx; */
}
.project-list-address .img {
width: 20rpx;
height: 28rpx;
margin-right: 10rpx;
}
.project-list-address .address {
display: flex;
align-items: center;
}
.pickerDate {
width: 300rpx;
height: 300rpx;
}
</style>