Преглед на файлове

售后工单 修改 申请配件功能开发

jingshuyong преди 1 година
родител
ревизия
93d88efd11

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

@@ -17,6 +17,7 @@ export async function getSalesWorkOrder(params) {
 	return Promise.reject(new Error(res.message));
 }
 
+// 获取信息
 export async function getSalesWorkOrderById(id) {
 	const res = await get(Vue.prototype.apiUrl + `/eom/afterSalesWorkOrder/getById/${id}`);
 	if (res.code == 0) {
@@ -24,3 +25,43 @@ export async function getSalesWorkOrderById(id) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+//修改
+export async function updateScheme(data) {
+	const res = await putJ(Vue.prototype.apiUrl + `/eom/afterSalesWorkOrder/updateScheme`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+/**
+ * 查询库存可用数
+ */
+export async function getWarehouseOutStock(params) {
+	const res = await get(Vue.prototype.apiUrl + `/wms/stocktwo/getWarehouseOutStock`, params);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+/**
+ * 查询库存仓库列表
+ */
+export async function getIdWarehouseList(params) {
+	const res = await get(Vue.prototype.apiUrl + `/wms/outindetailtwo/getBatchWarehouseList`, params);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+//申请备品备件
+export async function saveOrUpdateSalesWorkOrder(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/eom/afterSalesWorkOrder/saveOrUpdate`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 8 - 0
pages.json

@@ -2148,6 +2148,14 @@
 						"navigationStyle": "custom",
 						"navigationBarTextStyle": "white"
 					}
+				},
+				{
+					"path": "pages/salesServiceManagement/workOrder/components/accessory", 
+					"style": {
+						"navigationBarTitleText": "配件信息",
+						"navigationStyle": "custom",
+						"navigationBarTextStyle": "white"
+					}
 				}
 	
 	],

+ 1 - 1
pages/saleManage/contact/add.vue

@@ -8,7 +8,7 @@
 			<u-cell title="客户分类" arrow-direction="down">
 				<u--input slot="value" placeholder="请选择" border="surround" v-model="form.categoryName"
 					@click.native="showPicker"></u--input>
-			</u-cell>
+			</u-cell>1
 			<u-cell title="客户名称" arrow-direction="down">
 				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.name"></u--input>
 			</u-cell>

+ 0 - 15
pages/salesServiceManagement/demandList/add.vue

@@ -164,21 +164,6 @@
 			async getDetails(id) {
 				this.getByCode();
 				const res = await getSalesDemandById(id);
-				// this.form.tableList = res.productDetail;
-				// this.form.contactInfoVOS = res.contactInfoVOS;
-				// this.form.code = res.code;
-				// this.form.contactName = res.contactName;
-				// this.form.contactCode = res.contactCode;
-				// this.form.contactId = res.contactId;
-				// this.form.contactAddress = res.contactAddress;
-				// this.form.expectedTime = res.expectedTime;
-				// this.createUserName = res.createUserName;
-				// this.form.orderCode = res.orderCode;
-				// this.form.orderId = res.orderId;
-				// this.form.name = res.name;
-				// this.form.createUserId = res.createUserId;
-				// this.form.id = res.id;
-				// this.form.processInstanceId = res.processInstanceId;
 				let data = JSON.parse(JSON.stringify(res));
 				this.form = data;
 				this.createUserName = data.createUserName;

+ 6 - 11
pages/salesServiceManagement/demandList/components/AfterSales.vue

@@ -52,7 +52,6 @@
 			itemList: {
 				handler(newVal) {
 					let list = JSON.parse(JSON.stringify(newVal));
-					console.log(list, 'list');
 					list.map((el) => {
 						el.faultDetails = el.faultDetails ? el.faultDetails : []
 					})
@@ -80,17 +79,13 @@
 					return []
 				}
 				if (this.isReport) {
-					let list = JSON.parse(JSON.stringify(this.btnList));
-					list.map((el) => {
-						el.judge = [{
-							authorities: '',
-						}, {
-							key: 'customize',
-							value: ['5'],
+					this.btnList[1].judge = [{
+						authorities: '',
+					}, {
+						key: 'customize',
+						value: ['5'],
 
-						}]
-					})
-					return list;
+					}]
 				}
 				return this.btnList;
 			}

+ 1 - 1
pages/salesServiceManagement/demandList/components/contactList.vue

@@ -27,7 +27,7 @@
 									<text class="text">
 										操作:
 									</text>
-									<u-button v-if="btnOperate(item)" @click="goContact('edit',index,item)"
+									<u-button v-if="type != 'view'" @click="goContact('edit',index,item)"
 										:plain="true" :hairline="true" size='mini' type="default" text="编辑"></u-button>
 									<u-button v-if="btnOperate(item)" @click="del(index)" :plain="true" :hairline="true"
 										size='mini' type="default" class="delete" text="删除"></u-button>

+ 237 - 0
pages/salesServiceManagement/workOrder/components/accessory.vue

@@ -0,0 +1,237 @@
+<template>
+	<view class="">
+		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="配件申请"
+			@clickLeft="back">
+		</uni-nav-bar>
+		<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
+		<u-cell-group v-show="current == 0">
+			<u-cell title="需求编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input readonly style="flex:1" border="surround" v-model="form.code">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="名称" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input readonly placeholder="请输入" style="flex:1" border="surround" v-model="form.name">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="领用部门" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input readonly placeholder="请输入" style="flex:1" border="surround"
+						v-model="form.receivingDeptName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="领用人" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input readonly placeholder="请输入" style="flex:1" border="surround" v-model="form.recipientName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="使用时间" arrow-direction="down">
+				<uni-datetime-picker type="datetime" slot="value" v-model="form.usageTime">
+				</uni-datetime-picker>
+			</u-cell>
+			<u-cell title="部门" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input style="flex:1" placeholder="请选择" border="surround" @click.native="selectDepartment"
+						v-model="form.executeGroupName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="执行人" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<zxz-uni-data-select class="executor_user" :localdata="userList" v-model="form.executeUserId"
+						@change="handleUserChange" :multiple="Usertype==2"></zxz-uni-data-select>
+				</view>
+			</u-cell>
+			<u-cell title="用途" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--textarea style="flex:1" border="surround" placeholder="请输入内容" v-model="form.purpose"></u--textarea>
+				</view>
+			</u-cell>
+		</u-cell-group>
+		<accessoryList :itemList="tableList" v-show="current == 1" />
+		<view class="footerButton">
+			<u-button type="default" text="返回" @click="back"></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"
+			valueKey="id" textKey="name" childrenKey="children" />
+		<u-toast ref="uToast"></u-toast>
+	</view>
+</template>
+
+<script>
+	import accessoryList from './accessoryList.vue';
+	import {
+		getByCode
+	} from '@/api/pda/common.js'
+	import {
+		listOrganizations,
+		getUserPage
+	} from '@/api/myTicket/index.js'
+	import {
+		getSalesWorkOrderById,
+		saveOrUpdateSalesWorkOrder
+	} from '@/api/salesServiceManagement/workOrder/index.js'
+	export default {
+		components: {
+			accessoryList
+		},
+		computed: {
+
+		},
+		data() {
+			return {
+				current: 0,
+				type: 'edit',
+				form: {
+					name: '',
+					receivingDeptName: '',
+					receivingDeptId: '',
+					recipientName: '',
+					recipientId: '',
+					purpose: '',
+					executeGroupId: '',
+					executeGroupName: '',
+					executeUserName: '',
+					executeUserId: '',
+					usageTime: ''
+				},
+				Usertype: '',
+				list: ['基本信息', '配件信息'],
+				listData: [], // 部门数据
+				userList: [], // 执行人列表
+				tableList: [], // 配件列表
+			}
+		},
+		onLoad(params) {
+			this.type = params.type;
+			this.title = params.type == 'view' ? '工单详情' : '修改工单';
+			this.getDetails(params.id);
+		},
+		onUnload() {},
+		created() {},
+		methods: {
+			async getDetails(id) {
+				let data = await getSalesWorkOrderById(id);
+				this.tableList = data.costListVOS.filter((item) => {
+					if (item.typeId == 2 && item.isApply != 1) {
+						item.totalPrice = item.settlementPrice;
+						item.categoryCode = item.code;
+						item.categoryName = item.name;
+						return item;
+					}
+				})
+				this.form.receivingDeptName = data.executeGroupName;
+				this.form.receivingDeptId = data.executeGroupId;
+				this.form.recipientName = data.executeUserName;
+				this.form.recipientId = data.executeUserId;
+				this.form.name = data.name;
+				this.form.id = data.id;
+				console.log(this.tableList, 'data ---- 1 + 1')
+				this.getDept();
+			},
+			getDept() {
+				listOrganizations(1).then(data => {
+					this.listData = data;
+				})
+			},
+			confirm(data, name) {
+				this.form.executeGroupName = name
+				this.form.executeGroupId = data[0]
+				this.form.executeUserName = ''
+				this.form.executeUserId = ''
+				this.getUser(data[0])
+			},
+			getUser(deptCode) {
+				getUserPage({
+					pageNum: 1,
+					size: -1,
+					groupId: deptCode
+				}).then(data => {
+					this.userList = data.list.map(item => {
+						item.text = item.name
+						item.value = item.id
+						return item
+					})
+				})
+			},
+			sectionChange(index) {
+				this.current = index;
+			},
+			// 选择部门
+			selectDepartment() {
+				this.$refs.treePicker._show();
+			},
+			// 选择人
+			handleUserChange(obj) {
+				this.form.executeUserName = obj.name;
+			},
+			save(){
+				if(!this.form.usageTime){
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择使用时间",
+					})
+					return;
+				}
+				if(!this.form.executeGroupName){
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择部门",
+					})
+					return;
+				}
+				if(!this.form.executeUserName){
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择执行人",
+					})
+					return;
+				}
+				console.log(this.form,'form --- ===')
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	/deep/.u-subsection__item__text {
+		font-size: 28rpx !important;
+	}
+
+	/deep/.u-cell__body__content {
+		flex: none;
+		margin-right: 16rpx;
+	}
+
+	/deep/ .time_select .uni-data-tree-input {
+		width: 200rpx;
+	}
+
+	/deep/ .executor_user {
+		background: #fff;
+	}
+
+	.footerButton {
+		width: 100%;
+		height: 84rpx;
+		display: flex;
+		position: fixed;
+		bottom: 0;
+		z-index: 10;
+
+		/deep/.u-button {
+			height: 100%;
+		}
+
+		>view {
+			flex: 1;
+
+		}
+	}
+</style>

+ 211 - 0
pages/salesServiceManagement/workOrder/components/accessoryList.vue

@@ -0,0 +1,211 @@
+<template>
+	<view class="scheme">
+		<u-list class="listContent">
+			<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
+				<myCard :item="item" @del="del(index)" @edit="add('edit',item,index)" :index="index+1"
+					:columns="columns" :btnList="btnList">
+					<u--input placeholder="请输入" type="number" @input="(val) =>inputChange(val,'totalCount',index)"
+						slot="totalCount" v-model="item.totalCount">
+					</u--input>
+					<u--input placeholder="请输入" type="number" @input="(val) =>inputChange(val,'singlePrice',index)"
+						slot="singlePrice" v-model="item.singlePrice">
+					</u--input>
+				</myCard>
+			</view>
+		</u-list>
+		<view class="add" @click="add('add')" v-if="type != 'view'">
+			<u-icon name="plus" color="#fff"></u-icon>
+		</view>
+	</view>
+</template>
+
+<script>
+	import myCard from '@/pages/saleManage/components/myCard.vue'
+	import {
+		getWarehouseOutStock,
+		getIdWarehouseList
+	} from '@/api/salesServiceManagement/workOrder/index.js';
+	export default {
+		components: {
+			myCard
+		},
+		props: {
+			type: {
+				type: String,
+				default: 'edit'
+			},
+			itemList: {
+				type: Array,
+				default: () => []
+			},
+		},
+		watch: {
+			itemList: {
+				handler(newVal) {
+					let list = JSON.parse(JSON.stringify(newVal));
+					console.log(list, 'list------- 子组件')
+					this.tableList = list;
+				},
+				deep: true,
+				immediate: true
+			}
+		},
+		data() {
+			return {
+				columns: [
+					[{
+						label: '物品名称:',
+						prop: 'categoryName',
+						type: 'title',
+						className: 'perce100',
+					}],
+					[{
+						label: '物品编码:',
+						prop: 'categoryCode'
+					}],
+					[{
+						label: '型号:',
+						prop: 'categoryModel'
+					}, {
+						label: '规格:',
+						prop: 'specification',
+					}],
+					[{
+						label: '级别:',
+						prop: 'level',
+					}],
+					[{
+						label: '数量:',
+						prop: 'totalCount',
+						slot: 'totalCount',
+					}],
+					[{
+						label: '单价:',
+						prop: 'singlePrice',
+						slot: 'singlePrice',
+					}],
+					[{
+						label: '总价:',
+						prop: 'totalPrice'
+					}],
+					[{
+						label: '计量单位:',
+						prop: 'measureUnit'
+					}],
+					[{
+						label: '仓库:',
+						prop: 'warehouseName'
+					}],
+					[{
+						label: '操作:',
+						prop: 'action',
+						type: 'action',
+						className: 'perce100',
+					}],
+				],
+				btnList: [{
+					name: '删除',
+					apiName: 'del',
+					btnType: 'primary',
+					type: '2',
+					pageUrl: '',
+				}, ],
+				tableList: []
+			}
+		},
+		computed: {},
+		created() {
+			// uni.$off('updateInfo');
+			// uni.$on('updateInfo', (data) => {
+			// 	data.customize = '5';
+			// 	if (data.index || data.index == 0) {
+			// 		let index = data.index;
+			// 		delete data.index;
+			// 		this.$set(this.tableList, index, data);
+			// 		return
+			// 	}
+			// 	this.tableList.push(data);
+			// })
+		},
+		onShow() {
+
+		},
+		methods: {
+			add() {
+				console.log(12345)
+				// uni.navigateTo({
+				// 	url: `/pages/salesServiceManagement/workOrder/components/accessoryList`
+				// })
+			},
+			del(index) {
+				uni.showModal({
+					title: '确认删除',
+					content: '确定要删除所选配件数据吗?',
+					confirmText: '删除',
+					confirmColor: '#FF4D4F',
+					success: (res) => {
+						if (res.confirm) {
+							this.tableList.splice(index, 1)
+						} else if (res.cancel) {
+							// 用户点击了取消按钮
+							console.log('用户取消删除');
+						}
+					}
+				});
+			},
+			inputChange(e, field, index) {
+				let value = '';
+				if (field == 'singlePrice') {
+					value = e.replace(/[^\d.]/g, '');
+					const parts = value.split('.');
+					if (parts.length > 2) {
+						value = parts[0] + '.' + parts.slice(1).join('');
+					}
+					if (value.startsWith('0') && value.length > 1 && value[1] !== '.') {
+						value = value.replace(/^0+/, '');
+					}
+				} else {
+					value = e.replace(/[^\d]/g, '')
+					if (value.startsWith('0') && value.length > 1) {
+						value = value.replace(/^0+/, '');
+					}
+				}
+				console.log(value, 'value')
+				let obj = this.tableList[index];
+				obj[field] = value;
+				let num1 = obj.totalCount ? obj.totalCount - 0 : 0;
+				let num2 = obj.singlePrice ? obj.singlePrice - 0 : 0;
+				let total = (num1 * num2).toFixed(1);
+				obj.totalPrice = total;
+				console.log(obj, 'obj')
+				console.log(this.tableList, 'tab')
+				// this.$set(this.tableList,index,)
+				// obj.settlementPrice = num1 * num2;
+			},
+			getTabData() {
+				return this.tableList || [];
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
+
+	.scheme {
+		padding: 10rpx 20rpx;
+	}
+
+	.add {
+		width: 96rpx;
+		height: 96rpx;
+		border-radius: 48rpx;
+		background: #3c9cff;
+		position: fixed;
+		bottom: 100rpx;
+		right: 24rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+</style>

+ 140 - 25
pages/salesServiceManagement/workOrder/components/editPlan.vue

@@ -3,17 +3,21 @@
 		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
 			:title="title" @clickLeft="back">
 		</uni-nav-bar>
-		<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
+		<view class="scrollable-tabs" ref="tabsContainer">
+			<u-subsection :list="tabs" :current="currentIndex" @change="(e)=>sectionChange(e)"></u-subsection>
+		</view>
 
-		<DemandInfo :demandForm="demandForm" v-show="current == 0" :itemList="productDetail" />
-		<PlanInfo :planForm="planForm" v-show="current == 1" />
-		<AfterSales v-show="current == 2" :itemList="productDetail" :type="type" :isReport="isReport" />
-		<ContactList ref="contactRef" :type="type" v-show="current == 3" :itemList="contactInfoVOS"
+		<DemandInfo :demandForm="demandForm" v-show="currentValue == 3" :itemList="productDetail" />
+		<PlanInfo :planForm="planForm" v-show="currentValue == 4" />
+		<AfterSales ref="salesRef" v-show="currentValue == 5" :itemList="productDetail" :type="type"
 			:isReport="isReport" />
-		<SchemeList v-show="current == 4" :type='type' :itemList="costListVOS" />
-
+		<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">
 			<u-button type="default" text="返回" @click="back"></u-button>
+			<u-button type="primary" text="报工" @click="back"></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"
@@ -23,46 +27,73 @@
 </template>
 
 <script>
-	import AfterSales from '@/pages/salesServiceManagement/demandList/components/AfterSales.vue'
-	import ContactList from '@/pages/salesServiceManagement/demandList/components/contactList.vue'
 	import {
-		getSalesWorkOrderById
-	} from '@/api/salesServiceManagement/workOrder/index.js'
-	import PlanInfo from './planInfo.vue'
-	import DemandInfo from './demandInfo.vue'
-	import SchemeList from './schemeList.vue'
+		getSalesWorkOrderById,
+		updateScheme
+	} from '@/api/salesServiceManagement/workOrder/index.js';
+	import {
+		contactDetail
+	} from '@/api/saleManage/contact/index.js';
+	import ReportInfo from './reportInfo.vue';
+	import AfterSales from '@/pages/salesServiceManagement/demandList/components/AfterSales.vue';
+	import ContactList from '@/pages/salesServiceManagement/demandList/components/contactList.vue';
+	import PlanInfo from './planInfo.vue';
+	import DemandInfo from './demandInfo.vue';
+	import SchemeList from './schemeList.vue';
 	import {
 		getByCode
-	} from '@/api/pda/common.js'
+	} from '@/api/pda/common.js';
 	import {
 		listOrganizations,
 		getUserPage
-	} from '@/api/myTicket/index.js'
+	} from '@/api/myTicket/index.js';
+	let resData = {};
+	let contractInfo = {};
 	export default {
 		components: {
 			SchemeList,
 			PlanInfo,
 			DemandInfo,
 			AfterSales,
-			ContactList
+			ContactList,
+			ReportInfo
 		},
 		computed: {
 			isDisable() {
-				let flag = this.type != 'view'
+				let flag = this.type != 'view';
 				return flag;
 			},
 			isReport() {
-				let flag = this.type != 'view' ? true : false
-				return flag
+				let flag = this.type != 'view' ? true : false;
+				return flag;
+			},
+			currentIndex() {
+				return this.tabs.findIndex(item => item.id == this.currentValue);
 			}
 		},
 		data() {
 			return {
-				current: 0,
 				title: '修改工单',
 				type: 'edit',
 				Usertype: '',
-				list: ['需求信息', '计划信息', '售后对象', '联系人', '方案'],
+				tabs: [{
+						name: '售后对象',
+						id: 5
+					}, {
+						name: '联系人',
+						id: 6
+					},
+					{
+						name: '联系人',
+						id: 7
+					}, {
+						name: '需求信息',
+						id: 3
+					}, {
+						name: '计划信息',
+						id: 4
+					},
+				],
 				listData: [], // 部门数据
 				userList: [], // 执行人列表
 				demandForm: {}, // 需求基本信息
@@ -70,11 +101,22 @@
 				productDetail: [], // 售后对象
 				contactInfoVOS: [], // 联系人
 				costListVOS: [], // 方案
+				currentValue: 5
 			}
 		},
 		onLoad(params) {
 			this.type = params.type;
-			this.title = params.type == 'view' ? '工单详情' : '修改工单';
+			this.title = params.type == 'view' ? '工单详情' : params.type == 'edit' ? '修改工单' : '报工';
+			if (params.type == 'report') {
+				this.tabs.unshift({
+					name: '报工信息',
+					id: 1
+				}, {
+					name: '配件回收',
+					id: 2
+				});
+				this.currentValue = 1;
+			}
 			this.getDetails(params.id);
 		},
 		onUnload() {},
@@ -84,11 +126,20 @@
 				// await this.getByData();
 				// this.getDept();
 				const res = await getSalesWorkOrderById(id);
-				console.log(res, 'res 1=1')
+				this.contactData(res.afterSalesDemandVO.contactId, 'init');
+				resData = res;
 				this.costListVOS = res.costListVOS;
 				this.demandData(res.afterSalesDemandVO);
 				this.planData(res.afterSalesPlanVO);
 			},
+			// 工单绑定的客户数据
+			async contactData(id) {
+				let {
+					base
+				} = await contactDetail(id);
+				base.contactName = base.name;
+				contractInfo = base;
+			},
 			// 需求数据
 			async demandData(data) {
 				this.contactInfoVOS = data.contactInfoVOS || [];
@@ -137,6 +188,51 @@
 					this.listData = data;
 				})
 			},
+			save() {
+				let productDetail = this.$refs.salesRef.getTabData();
+				let contactInfoVOS = this.$refs.contactRef.getTabData();
+				let costListVOS = this.$refs.schemeRef.getTabData();
+				let obj = resData.afterSalesDemandVO;
+				let data = {
+					attachments: resData.attachments,
+					costListVOS: costListVOS,
+					faultPhenomenon: resData.inFactDuration,
+					faultReason: resData.faultReason,
+					id: resData.id,
+					inFactDuration: resData.inFactDuration,
+					maintenanceProcess: resData.maintenanceProcess,
+					salesDemandUpdatePO: {
+						orderCode: obj.orderCode,
+						orderId: obj.orderId,
+						name: obj.name,
+						faultLevel: obj.faultLevel ? String(obj.faultLevel) : '',
+						code: obj.code,
+						expectedTime: obj.expectedTime || '',
+						contactAddress: obj.contactAddress || '',
+						id: obj.id,
+					}
+				}
+				productDetail.map((el) => {
+					delete el.produceTime;
+				})
+				data.salesDemandUpdatePO.productDetail = productDetail;
+				data.salesDemandUpdatePO.contractInfo = contractInfo;
+				data.salesDemandUpdatePO.contactInfoVOS = contactInfoVOS;
+				uni.showLoading({
+					title: '加载中'
+				})
+				updateScheme(data).then(res => {
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					uni.hideLoading();
+					this.back();
+				}).catch(e => {
+					uni.hideLoading();
+				})
+
+			},
 			// confirm(data, name) {
 			// 	this.form.executeGroupName = name
 			// 	this.form.executeGroupId = data[0]
@@ -158,7 +254,7 @@
 			// 	})
 			// },
 			sectionChange(index) {
-				this.current = index;
+				this.currentValue = this.tabs[index].id;
 			},
 		}
 	}
@@ -199,4 +295,23 @@
 
 		}
 	}
+
+	.scrollable-tabs {
+		white-space: nowrap;
+		/* 防止选项卡换行 */
+		overflow-x: auto;
+		/* 启用横向滚动 */
+		-webkit-overflow-scrolling: touch;
+		/* 优化iOS滚动体验 */
+
+		/deep/ .u-subsection {
+			overflow-x: auto;
+		}
+
+		/deep/ .u-subsection__item__text {
+			width: 144rpx;
+			text-align: center;
+			display: inline-block;
+		}
+	}
 </style>

+ 1 - 1
pages/salesServiceManagement/workOrder/components/planInfo.vue

@@ -34,7 +34,7 @@
 		</u-cell>
 		<u-cell title="部门" arrow-direction="down">
 			<view slot="value" style="display: flex;align-items: center;width: 100%;">
-				<u--input style="flex:1" placeholder="请选择" border="surround" v-model="planForm.executeGroupName">
+				<u--input style="flex:1" readonly placeholder="请选择" border="surround" v-model="planForm.executeGroupName">
 				</u--input>
 			</view>
 		</u-cell>

+ 96 - 0
pages/salesServiceManagement/workOrder/components/reportInfo.vue

@@ -0,0 +1,96 @@
+<template>
+	<u-cell-group>
+		<u-cell title="开始时间" arrow-direction="down">
+			<uni-datetime-picker :end="endTime" type="datetime" slot="value" v-model="reportForm.startTime"
+				@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"
+				@change="endTimeChange">
+			</uni-datetime-picker>
+		</u-cell>
+		<u-cell title="时间售后时长(天)" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input readonly style="flex:1" border="surround" v-model="days">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="时间售后时长(小时)" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input readonly style="flex:1" border="surround" v-model="hours">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="时间售后时长(分钟)" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input readonly style="flex:1" border="surround" v-model="minutes">
+				</u--input>
+			</view>
+		</u-cell>
+	</u-cell-group>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				reportForm: {
+					startTime: '',
+					endTime: '',
+					inFactDuration: ''
+				},
+				endTime: '',
+				starTime: '',
+				minutes: '',
+				hours: '',
+				days: ''
+			}
+		},
+		methods: {
+			getReportForm() {
+				let data = {
+
+				};
+				return data;
+			},
+			// 开始时间
+			starTimeChange(e) {
+				this.starTime = e;
+				this.reportForm.startTime = e;
+				this.calculateTimeDifference()
+			},
+			// 结束时间
+			endTimeChange(e) {
+				this.endTime = e;
+				this.reportForm.endTime = e;
+				this.calculateTimeDifference();
+			},
+			calculateTimeDifference() {
+				console.log('123', this.reportForm)
+				if (!this.reportForm.startTime || !this.reportForm.endTime) {
+					this.days = '';
+					this.hours = '';
+					this.minutes = '';
+					this.reportForm.inFactDuration = '';
+					return
+				}
+				// 计算时间差
+				const startTime = new Date(this.reportForm.startTime);
+				const endTime = new Date(this.reportForm.endTime);
+				const timeDiff = endTime - startTime; // 毫秒数
+				// 转换为天、小时、分钟
+				const minutes = timeDiff / (1000 * 60);
+				const hours = minutes / 60;
+				const days = hours / 24;
+				this.reportForm.inFactDuration = minutes;
+				this.minutes = minutes.toFixed(0) + ' 分钟';
+				this.hours = hours.toFixed(1) + ' 小时';
+				this.days = days.toFixed(1) + ' 天';
+			},
+		}
+	}
+</script>
+
+<style>
+</style>

+ 23 - 12
pages/salesServiceManagement/workOrder/components/schemeAdd.vue

@@ -18,10 +18,11 @@
 				</view>
 			</u-cell>
 			<u-cell title="名称" arrow-direction="down">
-				<u--input v-if="form.typeId == '2'" @click.native="selectProduct" slot="value" placeholder="请选择" border="surround"
-					v-model="form.name">
+				<u--input v-if="form.typeId == '2'" @click.native="selectProduct" slot="value" placeholder="请选择"
+					border="surround" v-model="form.name">
 				</u--input>
-				<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround" v-model="form.name"></u--input>
+				<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround"
+					v-model="form.name"></u--input>
 			</u-cell>
 			<u-cell title="型号" arrow-direction="down">
 				<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround"
@@ -39,10 +40,11 @@
 			</u-cell>
 			<u-cell title="仓库" arrow-direction="down">
 				<template>
-					<uni-data-picker v-if="form.typeId != '2'" v-model="form.warehouseId" slot="value" :clear-icon='false' placeholder="请选择"
-						:localdata="warehouseList" @change="warehouseOnchange">
+					<uni-data-picker v-if="form.typeId != '2'" v-model="form.warehouseId" slot="value"
+						:clear-icon='false' placeholder="请选择" :localdata="warehouseList" @change="warehouseOnchange">
 					</uni-data-picker>
-					<u--input v-if="form.typeId == '2'" slot="value" placeholder="请输入" border="surround" v-model="form.warehouseName"></u--input>
+					<u--input v-if="form.typeId == '2'" slot="value" placeholder="请输入" border="surround"
+						v-model="form.warehouseName"></u--input>
 				</template>
 			</u-cell>
 			<u-cell title="库存" arrow-direction="down">
@@ -121,10 +123,10 @@
 		},
 		onLoad(params) {
 			let data = JSON.parse(params.data);
-			if(data.code){
+			if (data.code) {
 				this.form = data;
 			}
-			console.log(data,'params')
+			console.log(data, 'params')
 			this.obtain = params.obtain || '主数据'
 		},
 		created() {
@@ -172,7 +174,7 @@
 				})
 			},
 			save() {
-				if(!this.form.name){
+				if (!this.form.name) {
 					this.$refs.uToast.show({
 						type: "warning",
 						message: "请填写名称",
@@ -183,9 +185,18 @@
 				this.back();
 			},
 			inputChange(e, field) {
-				let value = e.replace(/[^\d]/g, '');
-				if (value.startsWith('0') && value.length > 1) {
-					value = value.replace(/^0+/, '');
+				// let value = e.replace(/[^\d]/g, '');
+				// if (value.startsWith('0') && value.length > 1) {
+				// 	value = value.replace(/^0+/, '');
+				// }
+				let value = '';
+				if (field == 'singlePrice') {
+					value = value.replace(/\./g, ''); // 如果不允许小数点,就移除所有小数点
+				} else {
+					value = e.replace(/[^\d]/g, '')
+					if (value.startsWith('0') && value.length > 1) {
+						value = value.replace(/^0+/, '');
+					}
 				}
 				this.form[field] = value;
 				let num1 = this.form.totalCount ? this.form.totalCount - 0 : 0;

+ 30 - 2
pages/salesServiceManagement/workOrder/components/schemeList.vue

@@ -15,6 +15,10 @@
 
 <script>
 	import myCard from '@/pages/saleManage/components/myCard.vue'
+	import {
+		getWarehouseOutStock,
+		getIdWarehouseList
+	} from '@/api/salesServiceManagement/workOrder/index.js';
 	export default {
 		components: {
 			myCard
@@ -34,7 +38,8 @@
 				handler(newVal) {
 					let list = JSON.parse(JSON.stringify(newVal));
 					console.log(list, 'list-------')
-					this.tableList = list
+					this.tableList = list;
+					this.setTabData()
 				},
 				deep: true,
 				immediate: true
@@ -189,8 +194,31 @@
 					}
 				});
 			},
+			async setTabData() {
+				this.tableList.forEach(async (item, index) => {
+					if (item.typeId == 2) {
+						this.$set(
+							this.tableList[index],
+							'warehouseList',
+							await getIdWarehouseList({
+								categoryId: item.categoryId
+							})
+						);
+						if (item.warehouseId) {
+							this.$set(
+								this.tableList[index],
+								'warehouseNum',
+								await getWarehouseOutStock({
+									warehouseId: item.warehouseId,
+									code: item.code
+								})
+							);
+						}
+					}
+				});
+			},
 			getTabData() {
-				let list = this.tableList.map((el)=>{
+				let list = this.tableList.map((el) => {
 					if (el.customize) {
 						delete el.customize;
 					}

+ 17 - 15
pages/salesServiceManagement/workOrder/index.vue

@@ -24,8 +24,9 @@
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent">
 				<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
-					<myCard @del="del(item)" @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)" :item="item" :index="index+1" :columns="columns"
+						:btnList="btnList">
 					</myCard>
 				</view>
 			</u-list>
@@ -211,15 +212,15 @@
 					},
 					{
 						name: '报工',
-						apiName: 'edit',
+						apiName: 'report',
 						btnType: 'error ',
 						type: '2',
 						pageUrl: '',
 						judge: [{
 							authorities: '',
 						}, {
-							key: 'planStatus',
-							value: [0, 4, 5],
+							key: 'orderStatus',
+							value: [1, 6],
 						}],
 					}, {
 						name: '转派',
@@ -230,21 +231,21 @@
 						judge: [{
 							authorities: '',
 						}, {
-							key: 'planStatus',
-							value: [0, 4, 5],
+							key: 'orderStatus',
+							value: [0, 1],
 						}],
 					},
 					{
 						name: '申请配件',
-						apiName: 'handleAudit',
+						apiName: 'addSpareItems',
 						btnType: 'primary',
 						type: '2',
 						pageUrl: '',
 						judge: [{
 							authorities: '',
 						}, {
-							key: 'planStatus',
-							value: [1],
+							key: 'orderStatus',
+							value: [1, 2],
 						}],
 					},
 				],
@@ -304,11 +305,14 @@
 				}
 				this.getList();
 			},
-			del(item) {
-
+			// 申请配件
+			addSpareItems(id) {
+				uni.navigateTo({
+					url: `/pages/salesServiceManagement/workOrder/components/accessory?id=${id}`
+				})
 			},
 			edit(type, id) {
-				console.log(type,'type');
+				console.log(type, 'type');
 				uni.navigateTo({
 					url: `/pages/salesServiceManagement/workOrder/components/editPlan?type=${type}&id=${id}`
 				})
@@ -374,7 +378,5 @@
 			border-bottom: 6rpx solid $theme-color;
 			color: $theme-color;
 		}
-
-
 	}
 </style>