首页订单列表
This commit is contained in:
parent
63675c5228
commit
50f9b53506
@ -2,7 +2,7 @@
|
|||||||
<view class="orderCard">
|
<view class="orderCard">
|
||||||
<view class="order-top">
|
<view class="order-top">
|
||||||
<view class="orderNo">
|
<view class="orderNo">
|
||||||
订单编号:{{ order.orderNo }}
|
工单编号:{{ order.orderNo }}
|
||||||
</view>
|
</view>
|
||||||
<view :style="{ color: getFlagColor(order.flag) }" class="flag">
|
<view :style="{ color: getFlagColor(order.flag) }" class="flag">
|
||||||
{{ order.flagStr }}
|
{{ order.flagStr }}
|
||||||
|
@ -27,12 +27,15 @@
|
|||||||
<view class="title">
|
<view class="title">
|
||||||
待办工单
|
待办工单
|
||||||
<text class="titleDesc">当前共
|
<text class="titleDesc">当前共
|
||||||
<text class="titleCount">2</text>
|
<text class="titleCount">{{total}}</text>
|
||||||
项工单需要处理
|
项工单需要处理
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="todoList">
|
<view class="todoList">
|
||||||
|
<scroll-view style="height: 100%;" scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom"
|
||||||
|
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
|
||||||
<order-card v-for="(item, index) in orderList" :key="index" :order="item"></order-card>
|
<order-card v-for="(item, index) in orderList" :key="index" :order="item"></order-card>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -45,6 +48,8 @@ import tabBarVue from '@/components/tabBar/tabBar.vue'
|
|||||||
import VNavigationBar from '@/components/VNavigationBar.vue'
|
import VNavigationBar from '@/components/VNavigationBar.vue'
|
||||||
import OrderCard from "@/components/orderCard.vue";
|
import OrderCard from "@/components/orderCard.vue";
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
|
import request from '@/utils/request';
|
||||||
|
import {formatTimestamp} from "@/utils/utils";
|
||||||
import {
|
import {
|
||||||
getToken,
|
getToken,
|
||||||
getUserInfo,
|
getUserInfo,
|
||||||
@ -78,6 +83,11 @@ export default {
|
|||||||
shopList: [],
|
shopList: [],
|
||||||
bannerList: [],
|
bannerList: [],
|
||||||
richTextHtml: null,
|
richTextHtml: null,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
//下来刷新状态
|
||||||
|
isTriggered:false,
|
||||||
orderList: [
|
orderList: [
|
||||||
{
|
{
|
||||||
orderNo: '1209840149750105501',
|
orderNo: '1209840149750105501',
|
||||||
@ -120,6 +130,8 @@ export default {
|
|||||||
if(!this.$msgSocket){
|
if(!this.$msgSocket){
|
||||||
this.$startMsgSocket(getTenantId(),getStrData("userId"))
|
this.$startMsgSocket(getTenantId(),getStrData("userId"))
|
||||||
}
|
}
|
||||||
|
this.orderList = []
|
||||||
|
this.getOrderList()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
@ -133,6 +145,88 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 上滑加载数据
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
|
||||||
|
if (this.pageNo * this.pageSize >= this.total) {
|
||||||
|
uni.$u.toast('没有更多数据了')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//页码+1,调用获取数据的方法获取第二页数据
|
||||||
|
this.pageNo++
|
||||||
|
//此处调用自己获取数据列表的方法
|
||||||
|
this.getOrderList()
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 下拉刷新数据
|
||||||
|
*/
|
||||||
|
onRefresherrefresh(){
|
||||||
|
this.isTriggered = true
|
||||||
|
this.pageNo = 1
|
||||||
|
this.total = 0
|
||||||
|
this.orderList = []
|
||||||
|
this.getOrderList()
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 查本人待处理工单
|
||||||
|
*/
|
||||||
|
getOrderList(){
|
||||||
|
this.orderList = []
|
||||||
|
request({
|
||||||
|
url: '/admin-api/repair/tickets/pageType',
|
||||||
|
method: 'get',
|
||||||
|
params:{pageNo:this.pageNo,pageSize:this.pageSize,isFinish:"0"}
|
||||||
|
}).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code == 200) {
|
||||||
|
let thisPageRecords = []
|
||||||
|
if(res.data && res.data.hasOwnProperty("records")){
|
||||||
|
for (let i = 0; i < res.data.records.length; i++) {
|
||||||
|
let order = res.data.records[i]
|
||||||
|
let viewOrder = {
|
||||||
|
id:order.id,
|
||||||
|
orderNo:order.ticketNo,
|
||||||
|
flag:1,
|
||||||
|
flagStr:"待处理",
|
||||||
|
carNum:order.carNo,
|
||||||
|
carModel:order.carBrandName,
|
||||||
|
userName:order.userName,
|
||||||
|
userPhone:order.userMobile,
|
||||||
|
counselorName:order.adviserName,
|
||||||
|
}
|
||||||
|
if(order.booking){
|
||||||
|
viewOrder['appointDate'] = formatTimestamp(order.createTime)
|
||||||
|
}
|
||||||
|
let projectList = []
|
||||||
|
if(order.itemList){
|
||||||
|
for (let j = 0; j < order.itemList.length; j++) {
|
||||||
|
let itemObj = order.itemList[j]
|
||||||
|
if("01"==itemObj.itemType){
|
||||||
|
projectList.push({
|
||||||
|
id:itemObj.id,
|
||||||
|
name:itemObj.itemName
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewOrder['projectList'] = projectList
|
||||||
|
thisPageRecords.push(viewOrder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//判断 如果获取的数据的页码不是第一页,就让之前赋值获取过的数组数据 concat连接 刚获取的第n页数据
|
||||||
|
if (this.pageNo != 1) {
|
||||||
|
this.orderList = this.orderList.concat(thisPageRecords)
|
||||||
|
} else {
|
||||||
|
this.orderList = thisPageRecords
|
||||||
|
}
|
||||||
|
//将获取的总条数赋值
|
||||||
|
this.total = res.data.total
|
||||||
|
this.isTriggered = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
gotoPage(menu) {
|
gotoPage(menu) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: menu.path
|
url: menu.path
|
||||||
|
@ -79,10 +79,6 @@ export default {
|
|||||||
//直接取缓存中的用户信息
|
//直接取缓存中的用户信息
|
||||||
this.customInfo = getUserInfo()
|
this.customInfo = getUserInfo()
|
||||||
this.staff = getJSONData("staffInfo")
|
this.staff = getJSONData("staffInfo")
|
||||||
uni.showToast({
|
|
||||||
title: this.staff.uniqueCode,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
if(this.staff.uniqueCode){
|
if(this.staff.uniqueCode){
|
||||||
this.showUniCode =true
|
this.showUniCode =true
|
||||||
this.generateUniCode(this.staff.uniqueCode)
|
this.generateUniCode(this.staff.uniqueCode)
|
||||||
|
@ -22,6 +22,20 @@ function getWXStatusHeight() {
|
|||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
function formatTimestamp(timestamp) {
|
||||||
getWXStatusHeight,
|
// 将时间戳转换为Date对象
|
||||||
|
const date = new Date(timestamp);
|
||||||
|
// 获取年月日时分秒
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const day = date.getDate().toString().padStart(2, '0');
|
||||||
|
const hours = date.getHours().toString().padStart(2, '0');
|
||||||
|
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||||||
|
const seconds = date.getSeconds().toString().padStart(2, '0');
|
||||||
|
// 组合成日期时间字符串
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
getWXStatusHeight,formatTimestamp
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user