Commit 1b14d129 by 杨北旺

修改服务列表Bug和上传资料loading滞后问题

1 parent cb0401d7
......@@ -11,7 +11,35 @@
</div>
<div style="height: 100px"></div>
<div v-if="!isNoResult" class="list_widget">
<scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" :immediate-check="false" offset="300" @load="onLoad">
<template v-for="(item, index) in serviceList">
<div :key="index" class="box_wrapper" @click="jumpPage(item)">
<div class="header_pannel flex_scb">
<span class="title text_hide">{{ item.customerName }}</span>
<p class="status" :class="{ other_color: item.dataPerfection == 1 }">
<span class="point" :style="{ background: item.dataPerfection == 1 ? '#3975C6' : '' }"></span>
{{ item.dataPerfection == 1 ? '已完成' : '待上传' }}
</p>
</div>
<div class="main_pannel">
<img v-if="item.packageName == '优享版'" class="iconCover" :src="imgBase + 'version_2.png'" />
<img v-else-if="item.packageName == '舒享版'" class="iconCover" :src="imgBase + 'version_3.png'" />
<img v-else class="iconCover" :src="imgBase + 'active_v.png'" />
<div class="info_wrap">
<p>联系方式:{{ item.customerPhone }}</p>
<p>车辆品牌:{{ item.vehicleBrandName }}</p>
<p>车辆型号:{{ item.vehicleShapeName }}</p>
<p>车架号码:{{ item.vin }}</p>
</div>
</div>
<div class="footer_pannel flex_scb">
<span>时间:{{ item.successDate }}</span>
<span>{{ item.dataPerfection == 1 ? '查看详情' : '去上传' }}>></span>
</div>
</div>
</template>
</van-list>
<!-- <scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<template v-for="(item, index) in serviceList">
<div :key="index" class="box_wrapper" @click="jumpPage(item)">
<div class="header_pannel flex_scb">
......@@ -38,7 +66,7 @@
</div>
</div>
</template>
</scroll-view>
</scroll-view> -->
</div>
<div v-if="isNoResult">
<van-empty description="暂无数据" />
......@@ -48,7 +76,7 @@
<script>
import ScrollView from '../../components/ScrollView.vue'
// import make from './make.vue'
import { upload} from '@/api'
import { upload } from '@/api'
// import { Toast } from 'vant'
const baseImg = 'https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/'
export default {
......@@ -75,11 +103,13 @@ export default {
currentTabIndex: 0,
imgBase: baseImg,
serviceList: [],
paramForm:{
pageSize:10,
pageNum:1,
paramForm: {
pageSize: 10,
pageNum: 1
},
isNoResult:false
isNoResult: false,
loading: false,
finished: false
}
},
created() {},
......@@ -89,50 +119,42 @@ export default {
},
methods: {
// 获取列表总数
getOrderCount(queryText){
getOrderCount(queryText) {
let para = {}
if(queryText){
if (queryText) {
para.queryText = queryText
}else{
} else {
para = {}
}
upload.orderCountApi(para).then(res=>{
const {finished,total,unfinished} = res.data
upload.orderCountApi(para).then(res => {
const { finished, total, unfinished } = res.data
this.tabs[0].num = total
this.tabs[1].num = unfinished
this.tabs[2].num = finished
})
},
// 获取列表数据
getServicesList(){
upload.orderListApi(this.paramForm).then(res=>{
let {code,data} = res
if(code!=0){
getServicesList() {
upload.orderListApi(this.paramForm).then(res => {
let { code, data } = res
if (code != 0) {
return
}
data.list.map(item=>{
data.list.map(item => {
item.successDate = new Date(item.successDate).format('yyyy/MM/dd')
return item
})
if(this.paramForm.pageNum==1){
this.serviceList = data.list
}else{
data.list.forEach(item=>{
this.serviceList.push(item)
})
}
this.isNoResult = this.serviceList.length?false:true
if((data.list.length<this.paramForm.pageSize)&&this.serviceList.length){
this.$refs.scrollView.finished = true
}
if(!this.isNoResult){
this.$refs.scrollView.loading = false
this.serviceList = this.paramForm.pageNum == 1 ? data.list : this.serviceList.concat(data.list)
this.loading = false
if (this.serviceList.length % this.paramForm.pageSize != 0 || (data.list.length == 0 && this.serviceList.length != 0)){
this.finished = true
}
this.isNoResult = this.serviceList.length ? false : true
})
},
search(e) {
this.paramForm.queryText = e
if(!e){
if (!e) {
delete this.paramForm.queryText
}
this.getServicesList()
......@@ -140,27 +162,30 @@ export default {
},
changeTab(e) {
this.currentTabIndex = e
let dataPerfection = e==2?1:e==1?0:3
let dataPerfection = e == 2 ? 1 : e == 1 ? 0 : 3
this.paramForm.dataPerfection = dataPerfection
if(dataPerfection==3){
if (dataPerfection == 3) {
delete this.paramForm.dataPerfection
}
this.serviceList = []
this.isNoResult = false
this.loading = false
this.finished = false
this.paramForm.pageNum = 1
this.getServicesList()
},
onReachBottom() {
this.paramForm.pageNum++
this.getServicesList()
// this.$refs.scrollView.loading = false
// this.$refs.scrollView.finished = true
onLoad() {
if (this.serviceList.length != 0 && this.serviceList.length % this.paramForm.pageSize == 0) {
this.paramForm.pageNum = this.paramForm.pageNum + 1
this.getServicesList()
}
},
jumpPage(item) {
this.$router.push({
name: 'upload',
params: {
packageCode:item.packageCode,
contractNo:item.contractNo,
packageCode: item.packageCode,
contractNo: item.contractNo
}
})
}
......@@ -234,10 +259,10 @@ export default {
}
.list_widget {
padding: 10px 16px;
.content{
.content {
height: calc(100vh - 134px);
/deep/ .van-list{
background: #F7F7F7;
/deep/ .van-list {
background: #f7f7f7;
}
}
.box_wrapper {
......
......@@ -7,7 +7,7 @@
<span>{{ item.attachmentName }}</span>
</div>
<div class="main_pannel" @click="toClickUpoload(item)">
<van-uploader v-if="loadingFinish" :before-delete="beforeDelete" :after-read="afterRread" :preview-size="size" v-model="fileURL[item.attachmentCode]" max-count="4">
<van-uploader v-if="loadingFinish" :before-delete="beforeDelete" v-on:click-upload="beforeRead" :before-read="checkRead" :after-read="afterRread" :preview-size="size" v-model="fileURL[item.attachmentCode]" max-count="4">
<div class="box_wrap flex_ccc" :style="{width:size,height:size}">
<van-icon name="add-o" size="20px" color="#999999" />
<p>添加</p>
......@@ -38,7 +38,6 @@ export default {
}
},
created() {
// console.log(window.screen.width);
this.computedWidth()
},
mounted() {
......@@ -94,8 +93,20 @@ export default {
toClickUpoload(item) {
this.currentItem = item
},
beforeRead(e){
// this.showLoading()
// setTimeout(()=>{
// this.hideLoading()
// },3000)
},
checkRead(file){
if (file.size>1024) {
this.showLoading()
return true;
}
return true;
},
afterRread(file, e) {
console.log(file,e);
this.uploadImage(file)
},
beforeDelete(file, e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!