Browse Source

售后工单报工 评价 验收功能完成

jingshuyong 1 năm trước cách đây
mục cha
commit
395f2cff09

+ 26 - 0
api/salesServiceManagement/workOrder/index.js

@@ -35,6 +35,14 @@ export async function updateScheme(data) {
 	return Promise.reject(new Error(res.message));
 }
 
+//报工
+export async function reportWorkingSalesWorkOrder(data) {
+	const res = await putJ(Vue.prototype.apiUrl + `/eom/afterSalesWorkOrder/reportWorking`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
 /**
  * 查询库存可用数
  */
@@ -80,4 +88,22 @@ export async function getWarehouseList(data) {
 		return res.data;
 	}
 	return Promise.reject(new Error(res.message));
+}
+
+//验收
+export async function checkAndAccept(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/eom/afterSalesWorkOrder/checkAndAccept`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+//保存
+export async function evaluateSave(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/eom/afterSalesEvaluation/save`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
 }

+ 3 - 2
pages/salesServiceManagement/demandList/components/AfterSales.vue

@@ -162,7 +162,7 @@
 				data,
 				index
 			}) => {
-				if (type == 'add') {
+				if (type == 'add' || type == 'report') {
 					if (this.isReport) {
 						data.customize = '5'
 					}
@@ -209,9 +209,10 @@
 			},
 			// 现在只针对做 一 对 多 的 故障数据
 			goProblem(type, index, obj) {
+				let str = this.type == 'report' ? 'report' : '';
 				let data = obj ? JSON.stringify(obj) : '';
 				uni.navigateTo({
-					url: `/pages/salesServiceManagement/demandList/components/faultAdd?type=${type}&index=${index}&data=${data}`
+					url: `/pages/salesServiceManagement/demandList/components/faultAdd?type=${type}&index=${index}&data=${data}&str=${str}`
 				})
 			},
 			addFault() {

+ 20 - 2
pages/salesServiceManagement/demandList/components/faultAdd.vue

@@ -42,6 +42,7 @@
 				},
 				type: '',
 				infoIdx:'',
+				str:"",
 				typeOptions: [{
 						text: '维修',
 						value: '1'
@@ -60,6 +61,7 @@
 
 		async onLoad(data) {
 			this.infoIdx = data.index;
+			this.str = data.str;
 			this.type = data.type
 			if (data.data) {
 				this.form = JSON.parse(data.data)
@@ -72,14 +74,30 @@
 						type: "warning",
 						message: "故障类型不能为空",
 					})
-					return
+					return;
 				}
 				if (!this.form.faultPhenomenon) {
 					this.$refs.uToast.show({
 						type: "warning",
 						message: "故障现象不能为空",
 					})
-					return
+					return;
+				}
+				if(this.str == 'report'){
+					if (!this.form.faultReason) {
+						this.$refs.uToast.show({
+							type: "warning",
+							message: "故障原因不能为空",
+						})
+						return
+					}
+					if (!this.form.maintenanceProcess) {
+						this.$refs.uToast.show({
+							type: "warning",
+							message: "维修过程不能为空",
+						})
+						return
+					}
 				}
 				uni.$emit('updateFaultList', {
 				data: this.form,

+ 5 - 4
pages/salesServiceManagement/workOrder/components/accessoryAdd.vue

@@ -195,8 +195,8 @@
 				accessoriesList: [], // 配件列表
 				addList: [], // 添加列表
 				classificationList: [],
-				categoryLevelId: 1, // 分类id(默认6 查询备品备件)
-				selectedData: ['1'],
+				categoryLevelId: 6, // 分类id(默认6 查询备品备件)
+				selectedData: ['6'],
 				isEnd: false,
 				pageNum: 1,
 				dimensionList: [{
@@ -259,8 +259,9 @@
 				if (this.dataSources == '0') {
 					this.changeDimension(this.dimension, data);
 				} else {
+					let obj = this.$refs.screen.mainForm;
 					// 查询主数据
-					this.warehouseData(data);
+					this.warehouseData(obj);
 				}
 			},
 			// 主数据
@@ -352,7 +353,7 @@
 			// 查部门
 			getTreeList() {
 				treeByPid({
-					ids: [1]
+					ids: [6]
 				}).then(res => {
 					this.classificationList = res;
 					this.confirm(res[0].id, res[0].name);

+ 3 - 1
pages/salesServiceManagement/workOrder/components/accessoryList.vue

@@ -121,7 +121,9 @@
 			uni.$off('updateAddessory');
 			uni.$on('updateAddessory', (data) => {
 				let obj = {}
-				this.tableList.map((el) => obj[el] = true);
+				this.tableList.map((el) => {
+					obj[el.id] = true
+				});
 				data.map((el) => {
 					if (!obj[el.id]) {
 						this.tableList.push(el);

+ 107 - 9
pages/salesServiceManagement/workOrder/components/editPlan.vue

@@ -14,10 +14,10 @@
 		<ContactList ref="contactRef" :type="type" v-show="currentValue == 6" :itemList="contactInfoVOS"
 			:isReport="isReport" />
 		<SchemeList ref="schemeRef" v-show="currentValue == 7" :type='type' :itemList="costListVOS" />
-		<ReportInfo v-show="currentValue == 1" />
-		<view class="footerButton" v-if="isDisable">
+		<ReportInfo ref="reportInfoRef" :form="reportForm" v-show="currentValue == 1" />
+		<view :class=" type == 'report' ? 'footerButton footer_button':'footerButton'" v-if="isDisable">
 			<u-button type="default" text="返回" @click="back"></u-button>
-			<u-button type="primary" text="报工" @click="back"></u-button>
+			<u-button type="primary" text="报工" v-if="type == 'report'" @click="save('report')"></u-button>
 			<u-button type="primary" @click="save" text="保存"></u-button>
 		</view>
 		<!-- 	<ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
@@ -29,7 +29,8 @@
 <script>
 	import {
 		getSalesWorkOrderById,
-		updateScheme
+		updateScheme,
+		reportWorkingSalesWorkOrder
 	} from '@/api/salesServiceManagement/workOrder/index.js';
 	import {
 		contactDetail
@@ -105,6 +106,11 @@
 				costListVOS: [], // 方案
 				currentValue: 5,
 				accessList: [], // 配件回收
+				reportForm: {
+					acceptTime: '',
+					finishTime: '',
+					inFactDuration: ''
+				}
 			}
 		},
 		onLoad(params) {
@@ -130,6 +136,11 @@
 				// this.getDept();
 				const res = await getSalesWorkOrderById(id);
 				console.log(res, 'res ----')
+				this.reportForm = {
+					acceptTime: res.acceptTime,
+					finishTime: res.finishTime,
+					inFactDuration: res.inFactDuration
+				}
 				this.accessList = res.accessoryApply?.detailList || []
 				this.contactData(res.afterSalesDemandVO.contactId, 'init');
 				resData = res;
@@ -193,8 +204,47 @@
 					this.listData = data;
 				})
 			},
-			save() {
+			clistData(arrList) {
+				let list = JSON.parse(JSON.stringify(arrList));
+				let arr = [];
+				if (list.length == 0) return list;
+				list.map((item) => {
+					this.addData(item, arr);
+				});
+				return arr;
+			},
+			addData(item, arr) {
+				let totalCount = item.totalCount ? item.totalCount - 0 : '';
+				if (!totalCount || totalCount == 1) {
+					arr.push(item);
+					return;
+				}
+				for (let i = 0; i < totalCount; i++) {
+					item.totalPrice = item.singlePrice || 0;
+					item.totalCount = 1;
+					arr.push(item);
+				}
+			},
+			process(type) {
 				let productDetail = this.$refs.salesRef.getTabData();
+				// 点击报工 逻辑
+				if (type == 'report') {
+					let flag = true;
+					productDetail[0].faultDetails.forEach((el) => {
+						if (!el.faultReason || !el.maintenanceProcess) {
+							this.$refs.uToast.show({
+								type: "warning",
+								message: "故障原因跟维修过程不能为空",
+							})
+							this.currentValue = 5;
+							flag = false;
+							return;
+						}
+					})
+					if (!flag) {
+						return flag;
+					}
+				}
 				let contactInfoVOS = this.$refs.contactRef.getTabData();
 				let costListVOS = this.$refs.schemeRef.getTabData();
 				let obj = resData.afterSalesDemandVO;
@@ -223,10 +273,52 @@
 				data.salesDemandUpdatePO.productDetail = productDetail;
 				data.salesDemandUpdatePO.contractInfo = contractInfo;
 				data.salesDemandUpdatePO.contactInfoVOS = contactInfoVOS;
+				// 处理报工信息的数据
+				let reportForm = this.$refs.reportInfoRef.getReportForm();
+				if (!reportForm.acceptTime || !reportForm.finishTime) {
+					this.currentValue = 1;
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择开始时间跟结束时间",
+					})
+					return false;
+				}
+				data = {
+					...data,
+					...reportForm
+				}
+				// 报工进来 保存或者报工 数据
+				if (this.type == 'report' && productDetail[0].faultDetails.length > 0) {
+					let list = this.$refs.accessoryRef.getTabData() || [];
+					if (list.length > 0) {
+						let detailList = this.clistData(list);
+						// 指定绑定第一条设备信息
+						let item = data.salesDemandUpdatePO.productDetail[0];
+						let accessoryApply = {
+							demandDetailId: item.id,
+							categoryCode: item.categoryCode,
+							categoryName: item.categoryName,
+							contactName: data.salesDemandUpdatePO.contractInfo.name,
+							contactCode: data.salesDemandUpdatePO.contractInfo.code,
+							detailList
+						};
+						data.accessoryApply = accessoryApply;
+					}
+				}
+				return data;
+			},
+			save(type) {
+				// 获取 报工信息以外的数据
+				let data = this.process(type);
+				if (!data) {
+					return
+				}
+				console.log(data, 'data')
 				uni.showLoading({
 					title: '加载中'
-				})
-				updateScheme(data).then(res => {
+				});
+				let api = type != 'report' ? updateScheme : reportWorkingSalesWorkOrder;
+				api(data).then(res => {
 					this.$refs.uToast.show({
 						type: "success",
 						message: "操作成功",
@@ -236,7 +328,6 @@
 				}).catch(e => {
 					uni.hideLoading();
 				})
-
 			},
 			// confirm(data, name) {
 			// 	this.form.executeGroupName = name
@@ -294,7 +385,7 @@
 
 		/deep/.u-button {
 			height: 100%;
-			width: 30%;
+			width: 50%;
 		}
 
 		>view {
@@ -303,6 +394,13 @@
 		}
 	}
 
+	.footer_button {
+		/deep/.u-button {
+			height: 100%;
+			width: 30%;
+		}
+	}
+
 	.scrollable-tabs {
 		white-space: nowrap;
 		/* 防止选项卡换行 */

+ 104 - 0
pages/salesServiceManagement/workOrder/components/forWork/RatingComponent.vue

@@ -0,0 +1,104 @@
+<template>
+	<view class="rating-single">
+		<text class="rating-label" v-if="label">{{ label }}</text>
+
+		<view class="stars" @click.stop="handleClick">
+			<!-- 修复:v-for 循环从 0 到 maxScore,共显示 maxScore 个星星 -->
+			<text class="star" :class="{ active: currentScore >= index }" v-for="index in maxScore" :key="index"
+				:data-index="index">★</text>
+		</view>
+
+		<text class="rating-text" v-if="showText">{{ getRatingText(currentScore) }}</text>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: "RatingSingle",
+		model: {
+			prop: "value",
+			event: "change"
+		},
+		props: {
+			label: {
+				type: String,
+				default: ""
+			},
+			value: {
+				type: Number,
+				default: 0
+			},
+			maxScore: {
+				type: Number,
+				default: 5
+			},
+			showText: {
+				type: Boolean,
+				default: false
+			},
+			textMap: {
+				type: Array,
+				default () {
+					return ['非常不满意', '不满意', '一般', '满意', '非常满意'];
+				}
+			}
+		},
+		computed: {
+			currentScore() {
+				return Math.min(Math.max(this.value, 0), this.maxScore);
+			}
+		},
+		methods: {
+			getRatingText(score) {
+				console.log(score, 'score')
+				const index = Math.floor(score) - 1;
+				return this.textMap[index] || "";
+			},
+			handleClick(e) {
+				const target = e.target;
+				const score = parseInt(target.dataset.index);
+
+				if (!isNaN(score) && score >= 1 && score <= this.maxScore) {
+					this.$emit("change", score);
+				}
+			}
+		}
+	};
+</script>
+
+<style scoped>
+	.rating-single {
+		display: flex;
+		align-items: center;
+		margin: 10px 0;
+	}
+
+	.rating-label {
+		width: 80px;
+		text-align: right;
+		margin-right: 10px;
+		color: #333;
+	}
+
+	.stars {
+		display: flex;
+		cursor: pointer;
+	}
+
+	.star {
+		font-size: 20px;
+		color: #e6e6e6;
+		margin-right: 3px;
+		transition: color 0.2s;
+	}
+
+	.star.active {
+		/* color: #ffd700; */
+		color: rgb(255, 202, 62);
+	}
+
+	.rating-text {
+		margin-left: 8px;
+		color: #666;
+	}
+</style>

+ 160 - 0
pages/salesServiceManagement/workOrder/components/forWork/checkAndAccept.vue

@@ -0,0 +1,160 @@
+<template>
+	<view class="">
+		<uni-popup ref="popup" type="share" backgroundColor="#fff">
+			<view class="select-container">
+				<view class="title">
+					<text class="btn cancel" @tap="close">取消</text>
+					验收
+					<text class="btn confirm" @tap="submit">确定</text>
+				</view>
+				<uni-forms :modelValue="formData" class="form" label-width='75px'>
+					<uni-forms-item label="验收人" name="accepterUserId">
+						<uni-data-select v-model="formData.accepterUserId" @change="handleChange" :clear="false"
+							:localdata="contactInfoVOS"></uni-data-select>
+					</uni-forms-item>
+					<uni-forms-item label="验收状态" name="accepterStatus">
+						<uni-data-select v-model="formData.accepterStatus" :clear="false"
+							:localdata="stateLiist"></uni-data-select>
+					</uni-forms-item>
+					<uni-forms-item label="验收意见" name="accepterRemark">
+						<textarea class="textarea" type="text" v-model="formData.accepterRemark" placeholder="验收意见" />
+					</uni-forms-item>
+				</uni-forms>
+			</view>
+			<u-toast ref="uToast"></u-toast>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	import {
+		getSalesWorkOrderById,
+		checkAndAccept
+	} from '@/api/salesServiceManagement/workOrder/index.js'
+	export default {
+		data() {
+			return {
+				acceptShow: false,
+				formData: {
+					accepterUserId: '',
+					accepterUserName: '',
+					accepterRemark: '',
+					accepterStatus: '',
+					id: ''
+				},
+				contactInfoVOS: [],
+				stateLiist: [{
+						value: 1,
+						text: '通过'
+					},
+					{
+						value: 0,
+						text: '不通过'
+					}
+				],
+			}
+		},
+		methods: {
+			open(id) {
+				this.acceptShow = true;
+				this.$refs.popup.open()
+				this.formData = {
+					accepterUserId: '',
+					accepterUserName: '',
+					accepterRemark: '',
+					accepterStatus: '',
+					id,
+				}
+				this.getDadaList(id);
+				console.log(this.formData, 'fffffm')
+			},
+			async getDadaList(id) {
+				const {
+					afterSalesDemandVO
+				} = await getSalesWorkOrderById(id);
+				this.contactInfoVOS = afterSalesDemandVO.contactInfoVOS || [];
+				this.contactInfoVOS.map((el) => {
+					el.value = el.id;
+					el.text = el.contactName;
+				})
+				console.log(this.contactInfoVOS, 'contactInfoVOS')
+			},
+			handleChange(e) {
+				this.accepterUserName = this.contactInfoVOS.find(el => el.id == e).contactName
+			},
+			submit() {
+				if (!this.formData.accepterUserId) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择验收人",
+					})
+					return;
+				}
+				if (!this.formData.accepterStatus) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择验收状态",
+					})
+					return;
+				}
+				uni.showLoading({
+					title: '加载中'
+				})
+				checkAndAccept(this.formData).then((res) => {
+					this.$emit('getList');
+					this.close();
+					uni.hideLoading();
+				}).then((err) => {
+					uni.hideLoading();
+				})
+			},
+			close() {
+				this.$refs.popup.close()
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.select-container {
+		min-height: 50vh;
+
+		.title {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			height: 100rpx;
+			line-height: 100rpx;
+			text-align: center;
+			background-color: $j-primary-border-green;
+			font-weight: bold;
+			padding: 0 20rpx;
+			position: relative;
+			font-size: 32rpx;
+			color: #fff;
+
+			.btn {
+				width: 80rpx;
+				height: 32rpx;
+				display: inline-block;
+				font-size: 30rpx;
+				border: 1px solid #fff;
+				text-align: center;
+				line-height: 30rpx;
+				margin: 0;
+			}
+		}
+
+		.form {
+			padding: 20rpx 14rpx 0;
+
+			/deep/ .uni-forms-item__label {
+				font-size: 28rpx;
+			}
+
+			.textarea {
+				border: 1px solid #ddd;
+			}
+		}
+	}
+</style>

+ 170 - 0
pages/salesServiceManagement/workOrder/components/forWork/evaluate.vue

@@ -0,0 +1,170 @@
+<template>
+	<view class="">
+		<uni-popup ref="popup" type="share" backgroundColor="#fff">
+			<view class="select-container">
+				<view class="title">
+					<text class="btn cancel" @tap="close">取消</text>
+					评价 ★
+					<text class="btn confirm" @tap="submit">确定</text>
+				</view>
+				<uni-forms :modelValue="formData" class="form" label-width='170rpx'>
+					<uni-forms-item label="服务态度" name="attitudeRating">
+						<uni-rate v-model="formData.attitudeRating" showText />
+					</uni-forms-item>
+					<uni-forms-item label="响应速度" name="responseSpeed">
+						<uni-rate v-model="formData.responseSpeed" showText />
+					</uni-forms-item>
+					<uni-forms-item label="整体满意度" name="serviceRating">
+						<uni-rate v-model="formData.serviceRating" showText />
+					</uni-forms-item>
+					<uni-forms-item label="评价" name="comment" class="pingjia">
+						<textarea class="textarea" type="text" v-model="formData.comment" placeholder="验收意见" />
+					</uni-forms-item>
+				</uni-forms>
+			</view>
+			<u-toast ref="uToast"></u-toast>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	import uniRate from './RatingComponent.vue'
+	import {
+		evaluateSave
+	} from '@/api/salesServiceManagement/workOrder/index.js'
+	export default {
+		components: {
+			uniRate
+		},
+		data() {
+			return {
+				acceptShow: false,
+				formData: {
+					attitudeRating: '',
+					responseSpeed: '',
+					serviceRating: '',
+					comment: '',
+					workId: ''
+				},
+				contactInfoVOS: [],
+				stateLiist: [{
+						value: 1,
+						text: '通过'
+					},
+					{
+						value: 0,
+						text: '不通过'
+					}
+				],
+			}
+		},
+		methods: {
+			open(id) {
+				this.acceptShow = true;
+				this.$refs.popup.open()
+				this.formData = {
+					attitudeRating: '',
+					responseSpeed: '',
+					serviceRating: '',
+					comment: '',
+					workId: id,
+				}
+				console.log(this.formData, 'fffffm')
+			},
+			submit() {
+				if (!this.formData.attitudeRating) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择服务态度",
+					})
+					return;
+				}
+				if (!this.formData.responseSpeed) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择响应速度",
+					})
+					return;
+				}
+				if (!this.formData.serviceRating) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择整体满意度",
+					})
+					return;
+				}
+				uni.showLoading({
+					title: '加载中'
+				})
+				evaluateSave(this.formData).then((res) => {
+					this.$emit('getList');
+					this.close();
+					uni.hideLoading();
+				}).then((err) => {
+					uni.hideLoading();
+				})
+			},
+			close() {
+				this.$refs.popup.close()
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.select-container {
+		min-height: 50vh;
+
+		.title {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			height: 100rpx;
+			line-height: 100rpx;
+			text-align: center;
+			background-color: $j-primary-border-green;
+			font-weight: bold;
+			padding: 0 20rpx;
+			position: relative;
+			font-size: 32rpx;
+			color: #fff;
+
+			.btn {
+				width: 80rpx;
+				height: 32rpx;
+				display: inline-block;
+				font-size: 30rpx;
+				border: 1px solid #fff;
+				text-align: center;
+				line-height: 30rpx;
+				margin: 0;
+			}
+		}
+
+		.form {
+			padding: 20rpx 14rpx 0;
+			
+			/deep/ .uni-forms-item{
+				display: flex;
+				align-items: center;
+				margin-bottom: 20rpx;
+			}
+
+			/deep/ .uni-forms-item__label {
+				font-size: 28rpx;
+			}
+			
+			.pingjia{
+				align-items: flex-start;
+				
+				/deep/ .uni-forms-item__label{
+					width: 130rpx !important;
+				}
+			}
+
+			.textarea {
+				border: 1px solid #ddd;
+			}
+		}
+	}
+</style>

+ 59 - 0
pages/salesServiceManagement/workOrder/components/forWork/transfer.vue

@@ -0,0 +1,59 @@
+<template>
+	<view class="mainBox">
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="转派" @clickLeft="backAdd">
+			<template slot="right">
+				<u-button type="success" size="small" class="u-reset-button" @click="classification"
+					text="选择分类"></u-button>
+			</template>
+		</uni-nav-bar>
+		<view class="top-wrapper">
+			<button class="search_btn" @click="getData()">搜索</button>
+			<image class="menu_icon" src="~@/static/pda/menu.svg"></image>
+		</view>
+
+		<ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
+			:selectedData="selectedData" :localdata="classificationList" valueKey="id" textKey="name"
+			childrenKey="children" />
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				selectedData: ['1'],
+			}
+		},
+		onLoad(params) {
+
+		},
+		methods: {
+			getData() {
+
+			},
+			//返回添加页
+			backAdd() {
+				uni.navigateBack();
+			},
+			classification() {
+				this.$refs.treePicker._show();
+			},
+			confirm(id, name, rootCategoryLevelId) {
+				this.categoryLevelId = id;
+				this.tableList = [];
+				this.getData();
+			},
+			getTreeList() {
+				treeByPid({
+					ids: [1]
+				}).then(res => {
+					this.classificationList = res;
+					this.confirm(res[0].id, res[0].name)
+				})
+			},
+		}
+	}
+</script>
+
+<style>
+</style>

+ 40 - 15
pages/salesServiceManagement/workOrder/components/reportInfo.vue

@@ -1,12 +1,12 @@
 <template>
 	<u-cell-group>
 		<u-cell title="开始时间" arrow-direction="down">
-			<uni-datetime-picker :end="endTime" type="datetime" slot="value" v-model="reportForm.startTime"
+			<uni-datetime-picker :end="finishTime" type="datetime" slot="value" v-model="reportForm.acceptTime"
 				@change="starTimeChange">
 			</uni-datetime-picker>
 		</u-cell>
 		<u-cell title="结束时间" arrow-direction="down">
-			<uni-datetime-picker :start="starTime" type="datetime" slot="value" v-model="reportForm.endTime"
+			<uni-datetime-picker :start="starTime" type="datetime" slot="value" v-model="reportForm.finishTime"
 				@change="endTimeChange">
 			</uni-datetime-picker>
 		</u-cell>
@@ -36,38 +36,62 @@
 		data() {
 			return {
 				reportForm: {
-					startTime: '',
-					endTime: '',
+					acceptTime: '',
+					finishTime: '',
 					inFactDuration: ''
 				},
-				endTime: '',
+				finishTime: '',
 				starTime: '',
 				minutes: '',
 				hours: '',
 				days: ''
 			}
 		},
+		props: {
+			form: {
+				type: Object,
+				default: () => {}
+			}
+		},
+		watch: {
+			form: {
+				handler(newVal) {
+					this.reportForm = {
+						...newVal
+					}
+					this.calculateTimeDifference();
+				},
+				deep: true,
+				immediate: true
+			}
+		},
 		methods: {
 			getReportForm() {
-				let data = {
-
-				};
+				let data = JSON.parse(JSON.stringify(this.reportForm));
+				let arr1 = data.acceptTime.split(' ')
+				let arr2 = data.finishTime.split(' ')
+				if (arr1.length == 2 && !arr1[1]) {
+					data.acceptTime = data.acceptTime + '00:00:00'
+				}
+				if (arr2.length == 2 && !arr2[1]) {
+					data.finishTime = data.finishTime + '00:00:00'
+				}
 				return data;
 			},
 			// 开始时间
 			starTimeChange(e) {
 				this.starTime = e;
-				this.reportForm.startTime = e;
+				this.reportForm.acceptTime = e;
 				this.calculateTimeDifference()
 			},
 			// 结束时间
 			endTimeChange(e) {
-				this.endTime = e;
-				this.reportForm.endTime = e;
+				this.finishTime = e;
+				this.reportForm.finishTime = e;
 				this.calculateTimeDifference();
 			},
 			calculateTimeDifference() {
-				if (!this.reportForm.startTime || !this.reportForm.endTime) {
+				if (!this.reportForm.acceptTime || !this.reportForm.finishTime) {
 					this.days = '';
 					this.hours = '';
 					this.minutes = '';
@@ -75,9 +99,9 @@
 					return
 				}
 				// 计算时间差
-				const startTime = new Date(this.reportForm.startTime);
-				const endTime = new Date(this.reportForm.endTime);
-				const timeDiff = endTime - startTime; // 毫秒数
+				const acceptTime = new Date(this.reportForm.acceptTime);
+				const finishTime = new Date(this.reportForm.finishTime);
+				const timeDiff = finishTime - acceptTime; // 毫秒数
 				// 转换为天、小时、分钟
 				const minutes = timeDiff / (1000 * 60);
 				const hours = minutes / 60;
@@ -87,6 +111,7 @@
 				this.hours = hours.toFixed(1) + ' 小时';
 				this.days = days.toFixed(1) + ' 天';
 			},
+
 		}
 	}
 </script>

+ 46 - 9
pages/salesServiceManagement/workOrder/index.vue

@@ -24,13 +24,16 @@
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
 				<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
-					<myCard @addSpareItems="addSpareItems(item.id)" @report="edit('report',item.id)" @edit="edit('edit',item.id)"
-						@details="edit('view',item.id)" :item="item" :index="index+1" :columns="columns"
-						:btnList="btnList">
+					<myCard @addSpareItems="addSpareItems(item.id)" @report="edit('report',item.id)"
+						@edit="edit('edit',item.id)" @details="edit('view',item.id)" 
+						@checkAndAccept="checkAndAccept(item)" @evaluate="evaluate(item)"
+						:item="item" :index="index+1" :columns="columns" :btnList="btnList">
 					</myCard>
 				</view>
 			</u-list>
 		</view>
+		<CheckAndAccept ref="acceptRef" @getList='doSearch' />
+		<Evaluate ref="evaluateRef"  @getList='doSearch' />
 		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
@@ -40,9 +43,13 @@
 		getSalesWorkOrder,
 	} from '@/api/salesServiceManagement/workOrder/index.js'
 	import myCard from '@/pages/saleManage/components/myCard.vue'
+	import CheckAndAccept from './components/forWork/checkAndAccept.vue'
+	import Evaluate from './components/forWork/evaluate.vue'
 	export default {
 		components: {
 			myCard,
+			CheckAndAccept,
+			Evaluate
 		},
 
 		data() {
@@ -235,6 +242,32 @@
 							value: [0, 1],
 						}],
 					},
+					{
+						name: '验收',
+						apiName: 'checkAndAccept',
+						btnType: 'primary',
+						type: '2',
+						pageUrl: '',
+						judge: [{
+							authorities: '',
+						}, {
+							key: 'orderStatus',
+							value: [3, 6],
+						}],
+					},
+					{
+						name: '评价',
+						apiName: 'evaluate',
+						btnType: 'primary',
+						type: '2',
+						pageUrl: '',
+						judge: [{
+							authorities: '',
+						}, {
+							key: 'orderStatus',
+							value: [4],
+						}],
+					},
 					{
 						name: '申请配件',
 						apiName: 'addSpareItems',
@@ -251,16 +284,12 @@
 				],
 			}
 		},
-		computed: {
-
-		},
-
+		computed: {},
 		onShow() {
 			this.isEnd = false
 			this.page = 1
 			this.getList()
 		},
-
 		methods: {
 			changeChartsTab(value) {
 				this.pickTabIndex = value;
@@ -296,7 +325,7 @@
 					this.isEnd = this.tableList.length >= res.count;
 					uni.hideLoading();
 				}).catch((e) => {
-					uni.hideLoading()
+					uni.hideLoading();
 				})
 			},
 			scrolltolower() {
@@ -311,6 +340,14 @@
 					url: `/pages/salesServiceManagement/workOrder/components/accessory?id=${id}`
 				})
 			},
+			// 验收
+			checkAndAccept(item){
+				this.$refs.acceptRef.open(item.id);
+			},
+			// 评价
+			evaluate(item){
+				this.$refs.evaluateRef.open(item.id);
+			},
 			edit(type, id) {
 				console.log(type, 'type');
 				uni.navigateTo({