This commit is contained in:
PQZ 2024-10-22 18:32:32 +08:00
parent 8ae8ea78b8
commit 6141b7de1b
2 changed files with 99 additions and 150 deletions

View File

@ -22,7 +22,7 @@
<text>搜索</text> <text>搜索</text>
</view> </view>
<view class="body-top-tab"> <view class="body-top-tab">
<view v-for="(item, index) in tabList" :key="index" :class="{ active: active === index }" <view v-for="(item, index) in tabList" @click="activeTab(index)" :key="index" :class="{ active: active === index }"
class="body-top-tab-item"> class="body-top-tab-item">
{{ item.name }} {{ item.name }}
<view v-if="index === active" class="activeLine"></view> <view v-if="index === active" class="activeLine"></view>
@ -34,28 +34,23 @@
<scroll-view :refresher-triggered="isTriggered" @scrolltolower="onReachBottomCus" class="itemContent" <scroll-view :refresher-triggered="isTriggered" @scrolltolower="onReachBottomCus" class="itemContent"
refresher-enabled refresher-enabled
scroll-y="true" style="height: 100%" @refresherrefresh="onRefresherrefresh"> scroll-y="true" style="height: 100%" @refresherrefresh="onRefresherrefresh">
<view v-for="(item, index) in orderList" :key="index" class="orderItem"> <view v-for="(item, index) in ticketWares" :key="index" class="orderItem">
<view class="order-top"> <view class="order-top">
<view class="order-top-left"> <view class="order-top-left">
<text class="order-top-name">{{ '牟科宇的配件审批单' }}</text> <text class="order-top-name">{{ item.repairName+'的配件申请单' }}</text>
<text class="order-top-date">{{ '2024-10-20 12:00' }}</text> <text class="order-top-date">{{ item.createTimeStr }}</text>
</view> </view>
<text class="order-status">{{ '待审批' }}</text> <text class="order-status">{{ item.statusStr }}</text>
</view> </view>
<view class="order-content"> <view class="order-content">
<view> <view>
客户信息{{ '张三' }} {{ '157****6879' }} 申请人{{ item.repairName }}
</view> </view>
<view> <view>
车牌号{{ '川A 184AO1' }} 服务顾问{{ item.adviserName }}
</view>
<view>
车辆信息{{ '一汽奥迪 2024款 A6L' }}
</view> </view>
</view> </view>
<view class="order-remark">
原因当前库存炫驰全合成机油S7 4L/ALL数量不足
</view>
<view class="order-footer"> <view class="order-footer">
<template> <template>
<view class="order-btn no">拒绝审批</view> <view class="order-btn no">拒绝审批</view>
@ -67,9 +62,7 @@
</template> </template>
</view> </view>
</view> </view>
<!--<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"--> <view v-if="ticketWares.length==0" style="text-align: center">
<!-- @startWork="startWork"></order-card>-->
<view v-if="orderList.length==0" style="text-align: center">
<image class="" src="@/static/images/nothing.png"></image> <image class="" src="@/static/images/nothing.png"></image>
</view> </view>
</scroll-view> </scroll-view>
@ -86,7 +79,13 @@ import OrderCard from "@/components/orderCard.vue";
import config from '@/config' import config from '@/config'
import request from '@/utils/request'; import request from '@/utils/request';
import {builderOrder, formatTimestamp, saveTicketsRecords} from "@/utils/utils"; import {builderOrder, formatTimestamp, saveTicketsRecords} from "@/utils/utils";
import {getToken, getUserInfo} from '@/utils/auth' import {
getToken,
getUserInfo,
getStrData,
getTenantId
} from '@/utils/auth'
import {getDictTextByCodeAndValue,formatDate} from "@/utils/utils";
export default { export default {
components: { components: {
@ -96,46 +95,44 @@ export default {
}, },
data() { data() {
return { return {
tabList: [
{
name: '领配件'
},
{
name: '退配件'
},
],
//
queryParams:{
pageNo: 1,
pageSize: 10,
query: null,
type: "01",
},
//
ticketWares:[],
//
total: 0,
//
isTriggered: false,
imgUrlPrex: config.baseImageUrl, imgUrlPrex: config.baseImageUrl,
userInfo: { userInfo: {
avatar: undefined, avatar: undefined,
nickname: '' nickname: ''
}, },
tabList: [
{
name: '待审批'
},
{
name: '未通过'
},
{
name: '已审批'
}
],
active: 0, active: 0,
menuList: [
{
title: '新建工单',
desc: '直接添加客户订单',
icon: require('@/static/icons/homeMenuIcon/menu1.png'),
path: '/pages-order/addOrder/addOrder'
},
{
title: '预约开单',
desc: '查询预约记录',
icon: require('@/static/icons/homeMenuIcon/menu1.png'),
path: '/pages-order/appointOrder/appointOrder'
}
],
bannerIndex: 0, bannerIndex: 0,
shopList: [], shopList: [],
bannerList: [], bannerList: [],
richTextHtml: null, richTextHtml: null,
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
total: 0,
//
isTriggered: false,
orderList: [ orderList: [
{ {
orderNo: '1209840149750105501', orderNo: '1209840149750105501',
@ -162,9 +159,10 @@ export default {
}) })
} else { } else {
if (!this.$msgSocket) { if (!this.$msgSocket) {
// this.$startMsgSocket(getTenantId(), getStrData("userId")) this.$startMsgSocket(getTenantId(), getStrData("userId"))
} }
} }
this.onRefresherrefresh()
}, },
onShow() { onShow() {
if (!getToken()) { if (!getToken()) {
@ -177,128 +175,71 @@ export default {
nickname: '用户', nickname: '用户',
roleNames: '角色' roleNames: '角色'
} }
// this.onRefresherrefresh() this.onRefresherrefresh()
} }
}, },
methods: { methods: {
/** activeTab(index){
* 上滑加载数据 this.active = index
*/ this.queryParams.type = 1==index?'01':'02'
onReachBottomCus() { this.onRefresherrefresh()
// *
if (this.pageNo * this.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//+1,
this.pageNo++
//
this.getOrderList()
}, },
/** /**
* 下拉刷新数据 * 下拉刷新数据
*/ */
onRefresherrefresh() { onRefresherrefresh() {
this.isTriggered = true this.isTriggered = true
this.pageNo = 1 this.queryParams.pageNo = 1
this.total = 0 this.total = 0
this.orderList = [] this.ticketWares = []
this.getOrderList() this.getTicketWares()
}, },
/** /**
* 开始施工 * 配件单查询
*/ */
startWork(id) { getTicketWares(){
let paramsObj = {ticketId: id}
//
request({ request({
url: '/admin-api/repair/titem/listProject', url: '/admin-api/repair/tw/page',
method: 'get', method: 'get',
params: paramsObj params: this.queryParams
}).then((res) => { }).then((res)=>{
console.log(res) console.log(res,187)
if (res.code == 200 && res.data.length > 0) { if (res.code == 200){
if (res.data.length == 1) { this.ticketWares = res.rows
//1 this.total = res.total
this.startWorkRequest(id, "02", res.data[0].id, "02", "kssg", "开始施工")
} else {
uni.showActionSheet({
itemList: res.data.map(m => m.itemName),
success: ({
tapIndex
}) => {
this.startWorkRequest(id, "02", res.data[tapIndex].id, "02", "kssg", "开始施工")
}
})
}
} else {
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
},
/**
* 开始施工请求后台
*/
async startWorkRequest(id, ticketsWorkStatus, itemId, itemStatus, recordType, remark) {
try {
const result = await saveTicketsRecords(id, ticketsWorkStatus, itemId, itemStatus, recordType, remark, null);
console.error("result", result);
this.onRefresherrefresh()
} catch (error) {
console.error(error);
}
},
/**
* 查本人待处理工单
*/
getOrderList() {
let paramsObj = {pageNo: this.pageNo, pageSize: this.pageSize, isFinish: "0"}
request({
url: '/admin-api/repair/tickets/pageType',
method: 'get',
params: paramsObj
}).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 = builderOrder(order)
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) { if (this.pageNo != 1) {
this.orderList = this.orderList.concat(thisPageRecords) this.ticketWares = this.ticketWares.concat(res.rows)
} else { } else {
this.orderList = thisPageRecords this.ticketWares = res.rows
} }
// this.ticketWares.map((item) => {
this.total = res.data.total item.statusStr = getDictTextByCodeAndValue('ticket_wares_status', item.status)
item.createTimeStr = formatDate(item.createTime)
})
this.isTriggered = false this.isTriggered = false
} }
}) })
}, },
/**
* 上滑加载数据
*/
onReachBottomCus() {
// *
if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//+1,
this.queryParams.pageNo++
//
this.getTicketWares()
},
gotoPage(menu) { gotoPage(menu) {
uni.navigateTo({ uni.navigateTo({
url: menu.path url: menu.path

View File

@ -162,10 +162,18 @@
this.getIdLeader() this.getIdLeader()
} }
this.getStaffInfo(res.data.userinfo.id) this.getStaffInfo(res.data.userinfo.id)
// if (res.data.userinfo.roleCodes.includes("repair_warehouse")){
uni.navigateTo({ //
url: '/pages-home/home/home' uni.navigateTo({
}) url: '/pages-warehouse/home/home'
})
} else {
//
uni.navigateTo({
url: '/pages-home/home/home'
})
}
}else{ }else{
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,