lanan-repair-app/pages-home/home/home.vue

1678 lines
40 KiB
Vue
Raw Normal View History

2024-10-09 13:34:36 +08:00
<template>
2025-09-03 13:22:16 +08:00
<view class="page-container">
<view class="content_">
<view class="topt_">
<view class="db_">
<view class="ds_" @click="showUserDetail">
<view class="user_img">
<image src="/static/icons/avatar.png" v-if="''==userInfo.avatar || null == userInfo.avatar"
mode=""></image>
<image @click="showUserDetail" style="width: 104rpx;height: 104rpx;border-radius: 50%;"
v-else :src="imgUrlPrex+userInfo.avatar" mode="scaleToFill" @error="avatarErr"></image>
<view class="img_bo">{{ companyInfo.simpleName || companyInfo.corpName }}</view>
</view>
<view class="">
<view class="user_name">{{ userInfo.nickname }}</view>
<view class="user_gly">{{ userInfo.roleNames }}</view>
</view>
</view>
<view class="top_time">
<view class="time_left">{{ dateStr || '' }}</view>
<view class="time_right">{{ week || '' }}</view>
2025-08-11 17:42:50 +08:00
</view>
</view>
2025-09-03 13:22:16 +08:00
<view class="jg_">
<view class="jg_box" @click="goToPage(1)">
<image src="/static/images/j1.png" mode=""></image>
<view class="">内部管理</view>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="jg_box" v-if="checkPermi(['repair_business_show'])" @click="goToPage(2)">
<image src="/static/images/j2.png" mode=""></image>
<view class="">业务管理</view>
2025-08-11 17:42:50 +08:00
</view>
2025-10-31 11:27:50 +08:00
<view class="jg_box" v-if="checkPermi(['repair_statistics_show'])" @click="goToPage(6)">
<image src="/static/images/business.png" mode=""></image>
<view class="">业务统计</view>
</view>
<view class="jg_box" v-if="checkPermi(['repair_statistics_show'])" @click="goToPage(7)">
<image src="/static/images/accessories.png" mode=""></image>
<view class="">配件统计</view>
</view>
2025-11-03 17:56:19 +08:00
<view class="jg_box" v-if="checkPermi(['repair_statistics_show'])" @click="goToPage(8)">
<image src="/static/images/accessories.png" mode=""></image>
<view class="">班组统计</view>
</view>
2025-09-30 09:37:26 +08:00
<view class="jg_box" v-if="checkPermi(['repair_statistics_show'])" @click="goToPage(3)">
2025-09-03 13:22:16 +08:00
<image src="/static/images/j3.png" mode=""></image>
<view class="">数据统计</view>
</view>
<view class="jg_box" @click="goToPage(4)">
<view class="" style="position: relative">
<uni-badge style="position: absolute;right: 20rpx;top: -20rpx;z-index: 2;" type="error"
:text="noReadNum" size="small">
</uni-badge>
<image src="/static/images/j4.png" mode="">
</image>
</view>
<view class="">消息通知</view>
2025-08-11 17:42:50 +08:00
</view>
</view>
</view>
2025-09-03 13:22:16 +08:00
<view class="bo_">
<view class="dw">
<!-- 服务顾问角色 -->
<view class="jg_left" v-if="checkRole(['service_advisor','weixiu','general_inspection'])">
<view class="ds_" @click="serviceWork">
<image src="/static/images/r1.png" mode=""></image>
<view class="">待审批工单</view>
</view>
<view class="">{{serviceNum}}</view>
</view>
<view class="jg_right" @click="waitingWork">
<view class="ds_">
<image src="/static/images/r2.png" mode=""></image>
<view class="">待办工单</view>
</view>
<view class="">{{total}}</view>
</view>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="db_" style="margin: 30rpx auto; " @click="goDetail"
v-if="checkRole(['weixiu','general_inspection'])">
<view class="three1">
<view class="">
<view class="t_size">进厂数</view>
2025-09-30 09:37:26 +08:00
<view class="t_num">{{ bossNum.newOrderNum }}</view>
2025-09-03 13:22:16 +08:00
</view>
<image src="/static/images/t1.png" mode=""></image>
</view>
<view class="three2">
2025-09-30 09:37:26 +08:00
<view class="">
2025-09-03 13:22:16 +08:00
<view class="t_size">维修中</view>
<view class="t_num">{{ bossNum.workingNum }}</view>
</view>
<image src="/static/images/t2.png" mode=""></image>
</view>
<view class="three3">
2025-09-30 09:37:26 +08:00
<view class="">
2025-09-03 13:22:16 +08:00
<view class="t_size">已竣工</view>
<view class="t_num">{{ bossNum.overNum }}</view>
</view>
2025-09-30 09:37:26 +08:00
<image src="/static/images/t3.png" mode="">
</image>
2025-09-03 13:22:16 +08:00
</view>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="db_" style="margin: 30rpx auto; " v-if="checkRole(['repair_staff'])">
<view class="new_three1" @click="workerTodo(0)">
<view class="">
<view class="t_size">配件申请单</view>
<view class="t_num">{{ workerNumObj.submitNum }}</view>
</view>
<image src="@/pages-home/static/up.png" mode=""></image>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="new_three1" @click="workerTodo(2)">
<view class="">
<view class="t_size">待确认领料</view>
<view class="t_num">{{ workerNumObj.waitingReceiveNum }}</view>
</view>
<image src="@/pages-home/static/waitingReceiveNum.png" mode=""></image>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="new_three1" @click="workerTodo(3)">
<view class="">
<view class="t_size">待确认退料</view>
<view class="t_num">{{ workerNumObj.waitingBackNum }}</view>
</view>
<image src="@/pages-home/static/waitingBackNum.png" mode=""></image>
2025-08-11 17:42:50 +08:00
</view>
</view>
2025-09-03 13:22:16 +08:00
<!-- 服务顾问才能开单-->
<view class="db_ body-top-grid" style="margin: 30rpx auto; " v-if="checkRole(['service_advisor'])">
<view v-for="(item, index) in menuList" :key="index" class="body-top-item" @click="gotoPage(item)">
<view>
<view class="title">{{ item.title }}</view>
<view class="desc">{{ item.desc }}</view>
<image class="btn" mode="aspectFit" src="@/static/icons/homeMenuIcon/menuBtn.png">
</image>
</view>
<image :src="item.icon" class="icon" mode="aspectFit"></image>
2025-08-11 17:42:50 +08:00
</view>
</view>
2025-09-03 13:22:16 +08:00
<view class="db_c">
<view class="ds_">
<view class="gang_"></view>
<view class="title_">工单列表</view>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="ds_h" @click="goToPage(5)">查看全部 <u-icon name="arrow-right" color="#9799A1"
size="18"></u-icon></view>
2025-08-11 17:42:50 +08:00
</view>
2025-09-03 13:22:16 +08:00
<view class="todoListBox">
<view class="todoList">
<scroll-view
v-if="userInfo.roleCodes.includes('general_inspection') || userInfo.roleCodes.includes('weixiu')"
scroll-y="true" style="height:100%" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card :userInfo="userInfo" v-for="(item, index) in orderList" :key="index"
:order="item" @childEvent="onRefresherrefresh" @doVoid="doVoidReq"
@pickCar="openPickcar" @getOrder="openFile" @startWork="startWork"
@addProj="addProj"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
<scroll-view v-else scroll-y="true" style="height: 100%" class="itemContent"
@scrolltolower="onReachBottomCus" refresher-enabled @refresherrefresh="onRefresherrefresh"
:refresher-triggered="isTriggered">
<order-card :userInfo="userInfo" v-for="(item, index) in orderList" :key="index"
:order="item" @childEvent="onRefresherrefresh" @doVoid="doVoidReq"
@pickCar="openPickcar" @getOrder="openFile" @startWork="startWork"
@addProj="addProj"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
</view>
2025-08-11 17:42:50 +08:00
</view>
</view>
</view>
<project-picker ref="proj" @confirm="projConfirm"></project-picker>
<tabBarVue :title="myText" msg="1" ref="tarBar" @socketSuccess="socketSuccess"></tabBarVue>
<!-- 提示窗示例 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog type="success" cancelText="线下告知" confirmText="去签字" title="系统提示" content="客户是否在厂进行签字确认?"
@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
</uni-popup>
<!-- 提示窗示例 -->
<uni-popup ref="addProjDialog" type="dialog">
<uni-popup-dialog type="success" cancelText="修改已有项目" confirmText="新增项目" title="系统提示" content="是否需要新增项目?"
@confirm="addProjDialogConfirm" @close="cancelDialogClose"></uni-popup-dialog>
</uni-popup>
<!-- 输入框示例 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="线下告知" value="" placeholder="请填入告知方式!"
@confirm="dialogInputConfirm"></uni-popup-dialog>
</uni-popup>
<!-- 作废modal框-->
<view>
<u-modal showCancelButton @cancel="doVoidCancel" @confirm="doVoidConfirm" :show="show" :title="title">
<input type="text" v-model="voidData.remark" placeholder="请输入作废原因">
</u-modal>
</view>
<!-- 普通弹窗---拍照上传 -->
<uni-popup ref="popup" background-color="#fff">
<view class="popup-content">
<view class="dl-avatar-box">
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile"
limit="9" title="请上传诊断维修单和车辆维修前照片"></uni-file-picker>
</view>
<button type="primary" @click="receiveOrder">保存</button>
</view>
</uni-popup>
2025-08-13 17:30:12 +08:00
<!-- 接车---拍照上传 -->
<uni-popup ref="pickcarPopup" background-color="#fff">
<view class="popup-content">
<view class="dl-avatar-box">
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile"
limit="9" title="请上传车辆照片"></uni-file-picker>
</view>
<button type="primary" @click="pickCar">保存</button>
</view>
</uni-popup>
2025-08-11 17:42:50 +08:00
</view>
2024-10-09 13:34:36 +08:00
</template>
<script>
2025-08-11 17:42:50 +08:00
import tabBarVue from '@/components/tabBar/tabBar.vue'
import VNavigationBar from '@/components/VNavigationBar.vue'
import OrderCard from "@/components/orderCard.vue";
import ProjectPicker from "@/components/projectPicker.vue";
import request from '@/utils/request';
import {
formatTimestamp,
getOrderStatusText,
builderOrder,
saveTicketsRecords
} from "@/utils/utils";
import config from "@/config";
import upload from "@/utils/upload";
import {
getToken,
getUserInfo,
getStrData,
getTenantId,
setJSONData,
getJSONData,
getStorageWithExpiry,
setStorageWithExpiry
} from '@/utils/auth'
2025-09-03 13:22:16 +08:00
import {
checkRole,
checkPermi
} from '@/utils/permission.js'
2025-08-11 17:42:50 +08:00
export default {
components: {
OrderCard,
tabBarVue,
ProjectPicker,
VNavigationBar
},
data() {
return {
2025-09-03 13:22:16 +08:00
dateStr: '',
week: '',
setTime: null,
2025-08-11 17:42:50 +08:00
//上传的图片数组
fileList: [],
sizeType: ['compressed'],
show: false,
title: '作废',
voidData: {},
takeOrderId: '',
imgUrlPrex: config.baseImageUrl,
userInfo: {
avatar: undefined,
nickname: ''
},
//时间可选项
timePicker: ['当日', '累计', '自定义时间'],
//时间子可选项
timePickerSon: ['当月', '近三个月', '近六个月'],
active: 0,
activeSon: 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,
shopList: [],
bannerList: [],
richTextHtml: null,
pageNo: 1,
pageSize: 10,
total: 0,
//下来刷新状态
isTriggered: true,
orderList: [],
//维修工处理配件申请单数量
workerNumObj: {
submitNum: 0,
allowNum: 0,
noAllowNum: 0,
waitingReceiveNum: 0,
waitingBackNum: 0,
},
//服务顾问待处理数量
serviceNum: 0,
//总检查看维修中、已竣工的工单数量
bossNum: {
workingNum: 0,
workingIdList: [],
inCompanyNum: 0,
inCompanyIdList: [],
newOrderNum: 0,
newOrderIdList: [],
overNum: 0,
overIdList: [],
giveCusNum: 0,
giveCusIdList: [],
noPayNum: 0,
noPayIdList: 0
},
defaultAvatar: require('@/static/icons/avatar.png'),
//未读消息数量
noReadNum: 0,
//通知公告数量
noticeNum: 0,
//选中的维修单id
ticketId: null,
//新加的维修项目
selectedProj: [],
//告知客户的内容
tellCusText: "",
ifLeader: false,
//企业信息
companyInfo: {},
//日期默认选中范围
range: ['2021-02-01', '2021-03-28'],
//维修项目可选值
repairTypeList: ['按维修类别'],
//维修项目可选值--值
repairTypeValueList: [''],
// 维修项目选中下标
repairTypeIndex: 0,
//客户来源可选值
cusFromList: ['按客户来源'],
//客户来源可选值---值
cusFromValueList: [''],
// 客户来源选中下标
cusFromIndex: 0,
//有下角菜单显示文字
myText: "工单",
}
},
watch: {
range(newval) {
if (this.active == 2) {
this.getBossTodo()
}
console.log('范围选:', this.range);
},
},
onLoad() {
if (!getToken()) {
uni.reLaunch({
url: '/pages/login/login'
})
} else {
this.companyInfo = getJSONData("companyInfo")
//查2个数据字典备用---客户注册方式-cus_data_from、维修业务分类-repair_type
this.initDict("repair_type")
this.initDict("cus_data_from")
if (!this.$msgSocket) {
this.$startMsgSocket(getTenantId(), getStrData("userId"))
}
}
},
onShow() {
if (!getToken()) {
uni.reLaunch({
url: '/pages/login/login'
})
} else {
//直接取缓存中的用户信息
this.userInfo = getUserInfo()
this.ifLeader = getStrData('ifLeader')
this.getNoReadNum()
this.getNoticeList()
this.onRefresherrefresh()
if (this.userInfo.roleCodes.includes('repair_staff')) {
//维修工
this.getWorkerTodo()
} else if (this.userInfo.roleCodes.includes('service_advisor')) {
//服务顾问
this.getServiceTodo()
} else if (this.userInfo.roleCodes.includes('weixiu') || this.userInfo.roleCodes.includes(
'general_inspection')) {
//总检或管理员
this.setChooseDate("nowMonth")
this.getBossTodo()
// this.myText = "我的"
this.getServiceTodo()
}
}
2025-09-03 13:22:16 +08:00
this.timeWeekFormat();
},
onHide() {
// clearInterval(this.setTime);
// this.setTime = null
},
onUnload() {
// clearInterval(this.setTime);
// this.setTime = null;
2025-08-11 17:42:50 +08:00
},
methods: {
2025-09-03 13:22:16 +08:00
checkRole,
checkPermi,
goToPage(index) {
switch (index) { // 1. 补上括号和花括号
case 1: // 2. 补上冒号
uni.navigateTo({
url: '/pages-internal/internalCom' // 3. 建议使用单引号
});
break;
case 2: // 2. 补上冒号
uni.navigateTo({
url: '/pages-business/businessManage/businessManage' // 3. 建议使用单引号
});
break;
2025-09-30 09:37:26 +08:00
case 3: // 2. 补上冒号
uni.navigateTo({
url: '/pages-business/statistics/statistics' // 3. 建议使用单引号
});
break;
2025-09-03 13:22:16 +08:00
case 4:
uni.navigateTo({
url: '/pages-home/msg/message' // 3. 建议使用单引号
});
break;
case 5:
uni.navigateTo({
url: '/pages-order/orderList/orderList' // 3. 建议使用单引号
});
break;
2025-10-31 11:27:50 +08:00
case 6:
uni.navigateTo({
url: '/pages-business/businessStatistics/businessStatistics' // 3. 建议使用单引号
});
break;
case 7:
uni.navigateTo({
url: '/pages-business/accessoriesStatistics/accessoriesStatistics' // 3. 建议使用单引号
});
break;
2025-11-03 17:56:19 +08:00
case 8:
uni.navigateTo({
url: '/pages-business/staffStatistics/staffStatistics' // 3. 建议使用单引号
});
break;
2025-09-03 13:22:16 +08:00
}
},
/**
* 获取当前时间
*/
timeWeekFormat() {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, "0");
const day = String(now.getDate()).padStart(2, "0");
const hours = String(now.getHours()).padStart(2, "0");
const minutes = String(now.getMinutes()).padStart(2, "0");
const seconds = String(now.getSeconds()).padStart(2, "0");
const dayCycleArray = ["日", "一", "二", "三", "四", "五", "六"];
const dayCycle = dayCycleArray[now.getDay()];
const dateStr = `${year}${month}${day}`;
const week = `星期${dayCycle}`;
const time = `${hours}:${minutes}:${seconds}`;
this.dateStr = dateStr;
this.week = week;
this.time = time;
},
2025-08-13 17:30:12 +08:00
viewOrder(statisticsType) {
setJSONData('orderIdList', [])
uni.navigateTo({
url: `/pages-order/orderList/orderSimpleList?statisticsType=${statisticsType}`
})
2025-08-11 17:42:50 +08:00
},
/**
* 切换客户来源
*/
bindCusFromChange(e) {
this.cusFromIndex = e.detail.value
this.onRefresherrefresh()
},
/**
* 切换维修项目类型
*/
bindRepairTypeChange(e) {
this.repairTypeIndex = e.detail.value
this.onRefresherrefresh()
},
/**
* 查2个数据字典备用---客户注册方式-cus_data_from维修业务分类-repair_type
*/
initDict(dictCode) {
let dictArray = getStorageWithExpiry(dictCode);
if (null == dictArray || undefined == dictArray) {
request({
url: '/admin-api/system/dict-data/type',
method: 'get',
params: {
type: dictCode
}
}).then((res) => {
if (res.code == 200) {
setStorageWithExpiry(dictCode, res.data, 3600)
this.$nextTick(() => {
res.data.map(item => {
this.setDictItem(dictCode, item)
})
})
}
})
} else {
this.$nextTick(() => {
dictArray.map(item => {
this.setDictItem(dictCode, item)
})
})
}
},
setDictItem(dictCode, item) {
if ("repair_type" == dictCode) {
//维修项目
this.repairTypeList.push(item.label)
this.repairTypeValueList.push(item.value)
} else {
//客户来源
this.cusFromList.push(item.label)
this.cusFromValueList.push(item.value)
}
},
maskClick(e) {
console.log('maskClick事件:', e);
},
activeTab(index) {
this.active = index
this.getBossTodo()
},
activeTabSon(index) {
this.activeSon = index
//设置选中日期
if (0 == this.activeSon) {
//当月
this.setChooseDate("nowMonth")
} else if (1 == this.activeSon) {
//近3个月
this.setChooseDate("threeMonth")
} else if (2 == this.activeSon) {
//近半年
this.setChooseDate("sixMonth")
}
},
//设置选中日期
setChooseDate(type) {
var currentDate = new Date();
var year = currentDate.getFullYear();
var month = currentDate.getMonth() + 1; // 返回的月份从0开始需要加1
var startStr;
var endStr;
if ("nowMonth" == type) {
//当月
//当月第一天
startStr = year + "-" + month + "-01";
//当天
const day = currentDate.getDate();
endStr = year + "-" + month + "-" + day;
this.range = [startStr, endStr]
} else {
//近3个月或近半年
request({
url: '/admin-api/repair/tickets/getDateRange',
method: 'GET',
params: {
selectType: type
}
}).then((res) => {
if (res.code == 200) {
this.range = [res.data.startDate, res.data.endDate]
}
})
}
},
/**
* 作废
*/
doVoidReq(row) {
this.show = true
this.voidData = {
id: row.id,
remark: '',
ticketsStatus: '03'
}
},
/**
* 作废请求后台方法
*/
doVoidConfirm() {
request({
url: '/admin-api/repair/tickets/void',
method: 'POST',
data: this.voidData
}).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "操作成功",
icon: "success",
})
}
this.doVoidCancel()
this.onRefresherrefresh()
})
},
doVoidCancel() {
this.show = false
},
/**
* 接单上传附件
*/
openFile(id) {
this.takeOrderId = id
this.$refs.popup.open("bottom")
},
2025-08-13 17:30:12 +08:00
/**
* 接车上传附件
*/
openPickcar(id) {
this.takeOrderId = id
this.$refs.pickcarPopup.open("bottom")
},
/**
* 接车
*/
pickCar() {
if (this.fileList.length == 0) {
uni.showToast({
title: '请上传车辆照片',
icon: 'none'
})
return
}
this.$refs.pickcarPopup.close()
let fileStr = this.fileList.map(item => item.url.replace(config.baseImageUrl, "")).join(",")
request({
url: '/admin-api/repair/tickets/pickCar',
method: 'get',
params: {
id: this.takeOrderId,
image: fileStr
}
}).then(res => {
uni.showToast({
icon: 'none',
title: '接车成功!'
})
this.fileList = []
this.onRefresherrefresh()
})
},
2025-08-11 17:42:50 +08:00
/**
* 接单
*/
receiveOrder() {
let fileStr = this.fileList.map(item => item.url.replace(config.baseImageUrl, "")).join(",")
request({
url: '/admin-api/repair/tickets/take',
method: 'get',
params: {
id: this.takeOrderId,
image: fileStr
}
}).then((res) => {
console.log(res)
this.$refs.popup.close()
if (res.code == 200) {
uni.showToast({
icon: 'none',
title: '接单成功,请尽快处理!'
})
2025-08-13 17:30:12 +08:00
this.fileList = []
2025-08-11 17:42:50 +08:00
this.onRefresherrefresh()
} else {
uni.showToast({
icon: 'none',
title: res.message
})
}
})
},
afterRead(file) {
uni.showLoading({
title: '正在上传中...',
mask: true
});
for (let i = 0; i < file.tempFilePaths.length; i++) {
upload({
url: '/admin-api/infra/file/upload',
filePath: file.tempFilePaths[i]
}).then((res) => {
this.fileList.push({
url: config.baseImageUrl + res.data
})
if (i == file.tempFilePaths.length - 1) {
uni.hideLoading()
}
console.log(this.fileList)
})
}
},
deleteFile(file, index) {
this.fileList.splice(index, 1);
},
/**
* 保存当前项目
*/
dialogInputConfirm(val) {
// 关闭窗口后,恢复默认内容
this.$refs.inputDialog.close()
const newData = {
itemList: getJSONData("newProject"),
remark: val
}
request({
url: '/admin-api/repair/titem/addNewProj',
method: 'post',
data: newData
}).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '添加维修项目成功!',
icon: 'success'
})
uni.navigateTo({
url: `/pages-order/orderDetail/orderDetail?id=${res.data}&isDetail=0`
});
} else {
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
},
2025-09-03 13:22:16 +08:00
goDetail() {
uni.navigateTo({
url: '/pages-detail/detail/detail'
})
},
2025-08-11 17:42:50 +08:00
/**
* 去签字
*/
dialogConfirm() {
uni.navigateTo({
url: '/pages-home/service/sign-agin'
})
},
/**
* 客户不在厂手动输入
*/
dialogClose() {
this.$refs.inputDialog.open()
},
/**
* 卡片的 修改项目 按钮点击
*/
addProj(order) {
this.ticketId = order.id
this.$refs.addProjDialog.open()
},
/**
* 新增项目
*/
addProjDialogConfirm() {
this.$refs.proj.open()
},
/**
* 修改已有项目
*/
cancelDialogClose() {
this.$refs.addProjDialog.close()
uni.navigateTo({
url: `/pages-order/orderDetail/orderDetail?id=${this.ticketId}&isDetail=0`
});
},
/**
* 添加项目回调
*/
projConfirm(proj) {
this.selectedProj = proj
if (this.selectedProj.length > 0) {
setJSONData("newProject", this.formatItem(this.selectedProj))
this.$refs.alertDialog.open()
}
console.log(this.selectedProj, "selectedProj")
console.log(this.ticketId, "this.ticketId")
},
// 子表信息预处理
formatItem(list) {
if (!(list && list.length > 0)) {
return []
}
return list.map(item => {
const temp = {
...item,
ticketId: this.ticketId,
itemName: item.name,
itemCount: 1,
itemUnit: item.unit,
itemPrice: item.price,
itemDiscount: 1,
itemMoney: item.price,
itemTypeId: item.type,
remark: item.remark,
itemType: "01",
itemStatus: "01",
projectId: item.id,
id: null
}
return temp;
})
},
socketSuccess() {
this.getNoReadNum()
this.onRefresherrefresh()
console.log('通知并刷新成功')
},
gotoMsg() {
//去消息中心
uni.navigateTo({
url: '/pages-home/msg/message'
})
},
/**
* 上滑加载数据
*/
onReachBottomCus() {
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
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()
},
/**
* 开始施工
*/
startWork(id) {
let paramsObj = {
ticketId: id
}
//先查当前用户在本工单下有几个维修项目
request({
url: '/admin-api/repair/titem/listProject',
method: 'get',
params: paramsObj
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length > 0) {
if (res.data.length == 1) {
//只有1个直接开始施工
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);
}
},
/**
* 维修工的角度查提交的配件申请单 待处理数量
*/
getWorkerTodo() {
request({
url: '/admin-api/repair/tw/getWorkerTodo',
method: 'get',
}).then((res) => {
console.log(res)
if (res.code == 200) {
this.workerNumObj = res.data
}
})
},
/**
* 从总检的角度差维修中已竣工的工单数量
*/
getBossTodo() {
let params = {}
if (this.active == 0) {
//当日
params.selectType = "today"
} else if (this.active == 1) {
//累计
params.selectType = "all"
} else {
//自定义时间
params.selectType = "customer"
if (this.range.length == 2) {
params.startDate = this.range[0]
params.endDate = this.range[1]
} else {
uni.showToast({
title: '请选择查询日期范围',
icon: 'none'
})
return
}
}
request({
url: '/admin-api/repair/tickets/getBossNum',
method: 'get',
params: params
}).then((res) => {
console.log(res)
if (res.code == 200) {
this.bossNum = res.data
}
})
},
/**
* 服务顾问的角度查待处理的配件申请单数量
*/
getServiceTodo() {
let params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
type: "01",
status: "01"
}
request({
url: '/admin-api/repair/tw/page',
method: 'get',
params: params
}).then((res) => {
console.log(res)
if (res.code == 200) {
this.serviceNum = res.data.total
}
})
},
/**
* 查本人待处理工单
*/
getOrderList() {
let paramsObj = {
pageNo: this.pageNo,
pageSize: this.pageSize,
isFinish: "0",
cusFrom: this.cusFromValueList[this.cusFromIndex],
repairType: this.repairTypeValueList[this.repairTypeIndex]
}
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) {
this.orderList = this.orderList.concat(thisPageRecords)
} else {
this.orderList = thisPageRecords
}
//将获取的总条数赋值
this.total = res.data.total
this.isTriggered = false
}
})
},
gotoPage(menu) {
uni.navigateTo({
url: menu.path
})
},
avatarErr(err) {
console.log('err', err)
this.userInfo.avatar = this.defaultAvatar
},
showUserDetail() {
uni.navigateTo({
url: '/pages/my/myInfo'
})
},
2025-09-03 13:22:16 +08:00
workerTodo(activeKey) {
2025-08-11 17:42:50 +08:00
uni.navigateTo({
2025-09-03 13:22:16 +08:00
url: `/pages-repair/applyList/applyList?activeKey=${activeKey}`
2025-08-11 17:42:50 +08:00
})
},
/**
* 服务顾问待办
*/
serviceWork() {
uni.navigateTo({
url: '/pages-home/service/applyList'
})
},
/**
* 待办工单
*/
waitingWork() {
uni.navigateTo({
url: '/pages-order/orderList/orderList'
})
},
/**
* 获取未读消息数量
* @returns {Promise<void>}
*/
async getNoReadNum() {
await request({
url: "/admin-api/system/notify-message/get-unread-count",
method: "GET",
params: {
systemCode: "weixiu"
}
}).then((res) => {
if (res.code == 200) {
this.noReadNum = res.data > 99 ? 99 : res.data
}
})
},
/**
* 跳转通知公告列表页
*/
gotoNotice() {
uni.navigateTo({
url: '/pages-home/notice/notice'
})
},
/**
* 查通知公告--查数量
*/
async getNoticeList() {
const res = await request({
url: "/admin-api/base/notice/page",
method: "get",
params: {
pageNo: 1,
pageSize: 1,
type: 1,
parentServer: "weixiu",
server: "app"
},
tenantIdFlag: false
})
if (res.code == 200) {
this.noticeNum = res.data.total
}
},
}
}
2024-10-09 13:34:36 +08:00
</script>
2025-09-03 13:22:16 +08:00
<style lang="scss" scoped>
.content_ {
background: #F3F5FC;
height: 100%;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
.topt_ {
width: 100%;
height: 408rpx;
background: linear-gradient(180deg, #2D3BFF 0%, #1463FF 100%);
border-radius: 0rpx 0rpx 12rpx 12rpx;
box-sizing: border-box;
2025-08-11 17:42:50 +08:00
padding: 30rpx;
2025-09-03 13:22:16 +08:00
padding-top: var(--status-bar-height); //给组件加个上边距
position: relative;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
.db_ {
2025-08-11 17:42:50 +08:00
display: flex;
2025-09-03 13:22:16 +08:00
align-items: center;
justify-content: space-between;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
/* 使用CSS选择器实现单元素居中 */
.dw {
position: absolute;
display: flex;
align-items: center;
top: -50rpx;
width: 100%;
justify-content: space-between;
padding: 0 20rpx;
left: 0rpx;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
/* 当只有一个子元素时居中 */
.dw>view:only-child {
margin: 0 auto;
width: 80%;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
/* 或者使用Flexbox的自动调整 */
.dw {
/* 其他样式保持不变 */
justify-content: center;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.dw>view:first-child:nth-last-child(2),
.dw>view:first-child:nth-last-child(2)~view {
/* 当有两个元素时恢复空间分布 */
margin: 0 15rpx;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.db_c {
display: flex;
align-items: center;
justify-content: space-between;
margin: 30rpx auto;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.db_k {
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 20rpx 0rpx;
border-bottom: 1px dashed #686B71;
margin-bottom: 15px;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.ds_ {
display: flex;
align-items: center;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.top_time {
display: flex;
align-items: center;
justify-content: space-between;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.time_left {
width: 240rpx;
height: 52rpx;
background: rgba(255, 255, 255, 0.4);
border-radius: 36rpx 0rpx 0rpx 36rpx;
background: #7e90fe;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.time_right {
background: #fff;
color: #214FFF;
border-radius: 0rpx 36rpx 36rpx 0rpx;
width: 118rpx;
height: 52rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.user_gly {
font-weight: 400;
color: rgba(255, 255, 255, 0.83);
font-size: 24rpx;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.user_name {
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
margin-bottom: 5rpx;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.user_img {
position: relative;
text-align: center;
margin-right: 30rpx;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
image {
width: 96rpx;
height: 96rpx;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.img_bo {
position: absolute;
left: -8rpx;
bottom: -30rpx;
width: 116rpx;
height: 32rpx;
background: linear-gradient(180deg, #8DB4FF 0%, #3069FF 100%);
border-radius: 20rpx;
border: 1rpx solid rgba(255, 255, 255, 0.46);
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
margin-bottom: 30rpx;
overflow: hidden;
/* 隐藏溢出文本 */
text-overflow: ellipsis;
/* 文本溢出显示省略号 */
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.jg_ {
display: flex;
flex-wrap: nowrap;
/* 防止换行 */
justify-content: flex-start;
/* 左对齐 */
overflow-x: auto;
/* 允许横向滚动,防止溢出 */
gap: 20rpx;
/* 设置元素间距 */
padding: 10rpx 0;
/* 添加一些内边距 */
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.jg_box {
flex: 0 0 auto;
/* 不允许伸缩,保持原有大小 */
text-align: center;
font-weight: 400;
font-size: 26rpx;
color: #FFFFFF;
width: 23%;
/* 保持原有宽度比例 */
min-width: 150rpx;
/* 设置最小宽度防止过小 */
margin-top: 40rpx;
image {
width: 56rpx;
height: 56rpx;
margin-bottom: 10rpx;
}
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.bo_ {
width: 100%;
box-sizing: border-box;
padding: 30rpx;
position: relative;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.jg_left {
width: 345rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx;
color: #fff;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
// margin: 0 10rpx;
background: linear-gradient(68deg, #6CAFFF 0%, #0059FF 100%);
image {
width: 40rpx;
height: 40rpx;
margin-right: 15rpx;
}
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.jg_right {
width: 345rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx;
color: #fff;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
background: linear-gradient(68deg, #87E2FF 0%, #008BFF 100%);
image {
width: 40rpx;
height: 40rpx;
margin-right: 15rpx;
}
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.three1 {
width: 220rpx;
height: 120rpx;
background: linear-gradient(68deg, #EEF5FF 0%, #D7E0FC 100%);
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10rpx;
padding-left: 30rpx;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
image {
width: 96rpx;
height: 96rpx;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.three2 {
width: 220rpx;
height: 120rpx;
background: linear-gradient(84deg, #E3F2F5 0%, #AFEEF8 100%);
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10rpx;
padding-left: 30rpx;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
image {
width: 96rpx;
height: 96rpx;
}
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.three3 {
width: 220rpx;
height: 120rpx;
background: linear-gradient(84deg, #E8F2E1 0%, #CCEFDD 100%);
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10rpx;
padding-left: 30rpx;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
image {
width: 96rpx;
height: 96rpx;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.t_size {
font-weight: 400;
font-size: 28rpx;
color: #284F89;
margin-bottom: 10rpx;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.t_num {
font-weight: bold;
font-size: 28rpx;
color: #3E4045;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.gang_ {
width: 8rpx;
height: 40rpx;
background: #195AFF;
margin-right: 8rpx;
border-radius: 8px;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.title_ {
font-weight: 800;
font-size: 28rpx;
color: #23252B;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.ds_h {
display: flex;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #9799A1;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.c_box {
width: 100%;
// height: 300rpx;
background: #FFFFFF;
border-radius: 8rpx;
box-sizing: border-box;
padding: 30rpx;
margin: 10px auto;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.size1 {
font-weight: 600;
font-size: 28rpx;
color: #3B3D41;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.size2 {
font-weight: 400;
font-size: 24rpx;
color: #686B71;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.size3 {
font-weight: 600;
font-size: 28rpx;
color: #3B3D41;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.size4 {
font-weight: 400;
font-size: 24rpx;
color: #176C97;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.cont_title {
height: 98rpx;
background: #F7F8F9;
border-radius: 8rpx;
width: 100%;
box-sizing: border-box;
padding: 10rpx;
margin: 30rpx auto;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.c_t_title {
font-weight: 400;
font-size: 24rpx;
color: #176C97;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.c_t_size {
font-weight: 600;
font-size: 24rpx;
color: #3B3D41;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.end_ {
display: flex;
align-items: center;
justify-content: end;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.l_buttom {
width: 168rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 30rpx;
border: 2rpx solid #2E90F2;
color: #2E90F2;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
font-size: 28rpx;
color: #2E90F2;
margin-left: 10rpx;
}
.r_buttom {
width: 168rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 30rpx;
border: 2rpx solid #F2612E;
color: #F2612E;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
font-size: 28rpx;
margin-left: 10rpx;
}
.k_ {
font-weight: 400;
font-size: 28rpx;
color: #686B71;
margin-bottom: 30rpx;
}
.todoListBox {
height: calc(100vh - 500rpx);
.title {
margin-bottom: 30rpx;
font-weight: bold;
font-size: 32rpx;
color: #113A68;
.titleDesc {
margin-left: 20rpx;
font-weight: 500;
font-size: 24rpx;
color: #858BA0;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.titleCount {
color: #0174F6;
2025-08-11 17:42:50 +08:00
}
}
2025-09-03 13:22:16 +08:00
.todoList {
2025-08-11 17:42:50 +08:00
display: flex;
2025-09-03 13:22:16 +08:00
flex-direction: column;
//row-gap: 20rpx;
height: 100%;
}
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
/* 新增外层容器样式 */
.page-container {
display: flex;
flex-direction: column;
height: 100%;
/* 使用视口高度确保撑满屏幕 */
overflow: hidden;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.content_ {
flex: 1;
/* 占据剩余空间 */
overflow-y: auto;
/* 允许垂直滚动 */
background: #F3F5FC;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.new_three1 {
width: 200rpx;
height: 200rpx;
text-align: center;
border-radius: 30rpx;
background-color: white;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
image {
width: 58rpx;
height: 65rpx;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.t_size {
color: black;
margin: 15rpx 0;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.t_num {
color: black;
margin: auto;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.body-top-grid {
display: grid;
grid-template-columns: 1fr 1fr;
column-gap: 30rpx;
margin: 0 32rpx 40rpx;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.body-top-item {
position: relative;
display: flex;
align-items: center;
padding: 30rpx 0 30rpx 20rpx;
background: linear-gradient(360deg, #FFFFFF 0%, #D7EAFF 100%);
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid;
border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(202, 223, 247, 1)) 2 2;
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
&>view:first-child {
2025-08-11 17:42:50 +08:00
flex: 1;
width: 0;
2025-09-03 13:22:16 +08:00
display: flex;
flex-direction: column;
row-gap: 30rpx;
2025-08-11 17:42:50 +08:00
}
.title {
font-weight: bold;
font-size: 32rpx;
2025-09-03 13:22:16 +08:00
color: #113A68;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
.desc {
font-weight: 500;
font-size: 24rpx;
color: #858BA0;
}
2025-08-11 17:42:50 +08:00
2025-09-03 13:22:16 +08:00
.btn {
width: 40rpx;
height: 30rpx;
2025-08-11 17:42:50 +08:00
}
2025-09-03 13:22:16 +08:00
.icon {
width: 136rpx;
height: 136rpx;
}
2025-08-11 17:42:50 +08:00
}
}
</style>