首页订单列表

This commit is contained in:
Vinjor 2024-10-17 18:05:11 +08:00
parent 63675c5228
commit 50f9b53506
4 changed files with 113 additions and 9 deletions

View File

@ -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 }}

View File

@ -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

View File

@ -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)

View File

@ -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
} }