Kaynağa Gözat

售后服务需求完善

jingshuyong 11 ay önce
ebeveyn
işleme
27f212d135

+ 27 - 0
api/salesServiceManagement/accessory/index.js

@@ -46,3 +46,30 @@ export async function accessoryUpdate(data) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+// 配件申请记录 表格 详情
+export async function accessoryInfo(id) {
+	const res = await get(Vue.prototype.apiUrl + `/eom/sparePartsApply/getById/${id}`);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件申请记录 表格 删除
+export async function accessoryDelete(data) {
+	const res = await deleteApi(Vue.prototype.apiUrl + '/eom/sparePartsApply/delete', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件回收记录 表格 删除
+export async function recycleDelete(data) {
+	const res = await deleteApi(Vue.prototype.apiUrl + '/eom/afterSalesAccessoryApply/delete', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 9 - 0
api/salesServiceManagement/demandList/index.js

@@ -77,3 +77,12 @@ export async function getSalesDemandById(id) {
 	}
 	return Promise.reject(data.message);
 }
+
+// 删除需求 
+export async function deleteSalesDemand(data) {
+	const res = await deleteApi(Vue.prototype.apiUrl + '/eom/afterSalesDemand/delete', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

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

@@ -135,3 +135,30 @@ export async function receiveSalesWorkOrder(data) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+// 配件回收记录 表格 新增
+export async function recycleSave(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/save`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件回收记录 表格 修改
+export async function recycleUpdate(data) {
+	const res = await putJ(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/update`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件回收记录 表格 详情
+export async function recycleDetails(id) {
+	const res = await get(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/getById/${id}`);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 8 - 0
pages.json

@@ -2204,6 +2204,14 @@
 						"navigationStyle": "custom",
 						"navigationBarTextStyle": "white"
 					}
+				},
+				{
+					"path": "pages/salesServiceManagement/recycle/recycleAdd", 
+					"style": {
+						"navigationBarTitleText": "配件回收新增",
+						"navigationStyle": "custom",
+						"navigationBarTextStyle": "white"
+					}
 				}
 	],
 	"tabBar": {

+ 33 - 14
pages/salesServiceManagement/accessory/accessoryAdd.vue

@@ -50,12 +50,12 @@
 			</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="请输入内容"
+					<u--textarea style="flex:1; min-height: 160rpx;" border="surround" placeholder="请输入内容"
 						v-model="form.purpose"></u--textarea>
 				</view>
 			</u-cell>
 		</u-cell-group>
-		<accessoryList ref="accessoryRef" v-show="current == 1" />
+		<accessoryList :itemList="itemList" ref="accessoryRef" :type="type" v-show="current == 1" />
 		<view class="footerButton" v-if="isDisable">
 			<u-button type="default" text="返回" @click="back"></u-button>
 			<u-button type="primary" @click="save" text="保存"></u-button>
@@ -83,7 +83,8 @@
 	} from '@/utils/utils.js';
 	import {
 		accessorySave,
-		accessoryUpdate
+		accessoryUpdate,
+		accessoryInfo
 	} from '@/api/salesServiceManagement/accessory/index.js'
 	export default {
 		components: {
@@ -119,12 +120,19 @@
 				selectedData: [], // 使用部门绑定值
 				classificationList: [], // 使用部门数据
 				executorList: [], // 选择人数据
+				itemList:[], // 配件信息
 			}
 		},
 		onLoad(params) {
 			this.title = params.type == 'view' ? '配件申请详情' : params.type == 'edit' ? '配件申请修改' : '配件申请新增';
 			this.type = params.type;
-			this.getData();
+			console.log(params, 'params 参数');
+			if (params.id) {
+				console.log(typeof params.id);
+				this.getDetails(params.id);
+			} else {
+				this.getData();
+			}
 		},
 		created() {
 			uni.$off('updateWorkData')
@@ -139,6 +147,16 @@
 			sectionChange(index) {
 				this.current = index;
 			},
+			async getDetails(id) {
+				const res = await accessoryInfo(id);
+				for (let key in this.form) {
+					this.form[key] = res[key];
+				}
+				this.form.id = res.id;
+				this.form.code = res.code;
+				this.itemList = res.details;
+				this.getTreeList();
+			},
 			getData() {
 				let userInfo = uni.getStorageSync('userInfo');
 				this.form.receivingDeptName = userInfo.groupName;
@@ -165,7 +183,11 @@
 			confirm(id, name) {
 				this.form.useDeptName = name;
 				this.form.useDeptId = id[0];
-				this.getUserList(id[0])
+				this.form.userId = '';
+				this.form.userName = '';
+				this.executorList = [];
+				this.getUserList(id[0]);
+				this.$refs.selector.clearSearchText();
 			},
 			// 打开使用人弹窗
 			openSelector() {
@@ -188,20 +210,14 @@
 					})
 					this.executorList = list;
 				} catch (error) {
-
+					this.executorList = [];
 				}
 			},
 			// 使用人选择
 			onClose(item) {
 				this.form.userName = item.text;
-				console.log(item, 'item')
-				console.log(this.form, 'form')
 			},
 			save() {
-				uni.redirectTo({
-					url: '/pages/salesServiceManagement/accessory/index'
-				});
-				return
 				if (!this.form.name) {
 					this.$refs.uToast.show({
 						type: "warning",
@@ -242,15 +258,14 @@
 						type: "success",
 						message: "操作成功",
 					})
+					this.back();
 				}).catch((err) => {
-					console.log(err, 'err --')
 				})
 			},
 			selectWorkOrder() {
 				uni.navigateTo({
 					url: `/pages/salesServiceManagement/accessory/components/selectWork`
 				})
-				console.log('打开工单数据');
 			}
 		}
 	}
@@ -284,6 +299,10 @@
 		}
 	}
 
+	/deep/ .u-textarea__field {
+		height: 160rpx !important;
+	}
+
 	.selected-value {
 		height: 80rpx;
 		line-height: 80rpx;

+ 3 - 9
pages/salesServiceManagement/accessory/components/searchSelect.vue

@@ -63,8 +63,6 @@
 				filteredData: [],
 				// 内部选中的值(用于临时存储,确定后更新)
 				innerValue: this.value,
-				// 当前选中的对象
-				// selectedItem: null
 			}
 		},
 		watch: {
@@ -83,18 +81,14 @@
 			// 打开弹窗
 			open() {
 				this.$refs.popup.open();
-				// 打开时重置搜索状态
-				// this.searchText = '';
-				// this.filteredData = [...this.dataList];
-				// 同步当前值到innerValue(因为可能外部修改了value)
 				this.innerValue = this.value;
-				// this.selectedItem = null;
 			},
-
+			clearSearchText(){
+				this.searchText = ''
+			},
 			// 关闭弹窗
 			close() {
 				this.$refs.popup.close();
-				// this.$emit('close', this.selectedItem);
 			},
 
 			// 过滤数据

+ 37 - 5
pages/salesServiceManagement/accessory/index.vue

@@ -15,7 +15,7 @@
 			<u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
 				<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
 					<myCard :columns="columns" :btnList="btnList" :item="item" @details="add(item,'view')"
-						@edit="add(item,'edit')">
+						@edit="add(item,'edit')" @delete="deleteRow(item)">
 					</myCard>
 				</view>
 			</u-list>
@@ -23,12 +23,14 @@
 		<view class="add" @click="add('','add')">
 			<u-icon name="plus" color="#fff"></u-icon>
 		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
 	import {
 		accessoryPage,
+		accessoryDelete
 	} from '@/api/salesServiceManagement/accessory/index.js';
 	import myCard from '@/pages/saleManage/components/myCard.vue';
 	export default {
@@ -142,6 +144,19 @@
 						key: 'source',
 						value: [0],
 
+					}],
+				}, {
+					name: '删除',
+					apiName: 'delete',
+					btnType: 'primary',
+					type: '2',
+					pageUrl: '',
+					judge: [{
+						authorities: '',
+					}, {
+						key: 'source',
+						value: [0],
+
 					}],
 				}],
 				page: 1,
@@ -152,7 +167,7 @@
 			}
 		},
 		created() {
-			
+
 		},
 		onShow() {
 			this.doSearch();
@@ -195,12 +210,29 @@
 				this.getList();
 			},
 			add(item, type) {
-				console.log(item, 'item ---')
 				uni.navigateTo({
-					url: `/pages/salesServiceManagement/accessory/accessoryAdd?type=${type}&id=${item.id}`
+					url: `/pages/salesServiceManagement/accessory/accessoryAdd?type=${type}&id=${item?item.id:''}`
 				})
 			},
-			
+			async deleteRow(row) {
+				const res = await uni.showModal({
+					title: '确认删除',
+					content: '确定要删除该条数据吗?',
+					confirmText: '删除',
+					confirmColor: '#FF4D4F',
+				});
+				if (res[1].confirm) {
+					const data = await accessoryDelete([row.id]);
+					if (!data) return
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					this.doSearch();
+				} else if (res.cancel) {
+					console.log('用户取消');
+				}
+			}
 		}
 	}
 </script>

+ 10 - 8
pages/salesServiceManagement/demandList/index.vue

@@ -5,11 +5,11 @@
 		</uni-nav-bar>
 		<view class="top-wrapper">
 			<uni-section>
-				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
+				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="关键字">
 				</uni-easyinput>
 			</uni-section>
 			<button class="search_btn" @click="doSearch">搜索</button>
-			<image class="menu_icon" src="~@/static/pda/menu.svg"></image>
+			<image class="menu_icon" @click="handleSearch" src="~@/static/pda/menu.svg"></image>
 		</view>
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent">
@@ -55,20 +55,20 @@
 				</form>
 			</view>
 		</uni-popup>
+		<Screen ref="screen" @succeed="doSearch" />
 		<u-toast ref="uToast"></u-toast>
 
 	</view>
 </template>
 
 <script>
-	import {
-		deleteInformation
-	} from '@/api/saleManage/businessOpportunity/index.js'
 	import {
 		getTableList,
-		revokeSalesDemand
+		revokeSalesDemand,
+		deleteSalesDemand
 	} from '@/api/salesServiceManagement/demandList/index.js'
 	import myCard from '@/pages/saleManage/components/myCard.vue'
+	import Screen from './screen.vue'
 	export default {
 		components: {
 			myCard,
@@ -215,6 +215,9 @@
 		},
 
 		methods: {
+			handleSearch() {
+				this.$refs.screen.open();
+			},
 			doSearch() {
 				this.isEnd = false
 				this.page = 1
@@ -289,7 +292,6 @@
 				this.getList();
 			},
 			async del(item) {
-				console.log(item, 'item ---')
 				const res = await uni.showModal({
 					title: '确认删除',
 					content: '确定要删除该条数据吗?',
@@ -297,7 +299,7 @@
 					confirmColor: '#FF4D4F',
 				});
 				if (res[1].confirm) {
-					const data = await deleteInformation([row.id])
+					const data = await deleteSalesDemand([row.id])
 					if (!data) return
 					this.$refs.uToast.show({
 						type: "success",

+ 101 - 0
pages/salesServiceManagement/demandList/screen.vue

@@ -0,0 +1,101 @@
+<template>
+	<view>
+		<u-popup :show="show" closeOnClickOverlay mode="top" @close="closePopup">
+			<view class="search_list">
+				<u-form labelPosition="left" :model="form" labelWidth="140" labelAlign="left" class="baseForm">
+					<u-form-item label="仓库名称:" class="item-form" borderBottom prop="assetType">
+						<uni-data-select v-model="form.warehouseId" :clear="false" :localdata="warehouseList">
+						</uni-data-select>
+					</u-form-item>
+					<u-form-item label="物品编码:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.categoryCode"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="物品名称:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.categoryName"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="批次号:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.batchNo"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="刻码:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.engrave"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="发货码:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.barcodes"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="牌号:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.brandNum"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+				</u-form>
+			</view>
+			<view class="operate_box rx-bc">
+				<u-button size="small" class="u-reset-button" @click="show = false">
+					取消
+				</u-button>
+				<u-button size="small" class="u-reset-button" @click="reset">
+					重置
+				</u-button>
+				<u-button type="success" size="small" class="u-reset-button" @click="submit">
+					确定
+				</u-button>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	export default{
+		data(){
+			return {
+				form: {
+					warehouseId: "",
+					categoryCode: "",
+					categoryName: "",
+					batchNo: '',
+					engrave: '',
+					barcodes: '',
+					brandNum: ''
+				},
+			}
+		},
+		methods:{
+			open() {
+				this.show = true;
+			},
+			reset(){
+				
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.search_list {
+		padding: 0 20rpx;
+	}
+
+	.operate_box {
+		padding: 10rpx 32rpx;
+
+		/deep/ .u-button {
+			width: 30%;
+		}
+	}
+
+	.item-form {
+		/deep/ .u-form-item__body__left__content__label {
+			font-size: 28rpx;
+		}
+	}
+</style>

+ 63 - 5
pages/salesServiceManagement/recycle/index.vue

@@ -14,17 +14,23 @@
 		<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 :columns="columns" :btnList="btnList" :item="item">
+					<myCard :columns="columns" :btnList="btnList" @details="add(item,'view')" @edit="add(item,'edit')"
+						@delete="deleteRow(item)" :item="item">
 					</myCard>
 				</view>
 			</u-list>
 		</view>
+		<view class="add" @click="add('','add')">
+			<u-icon name="plus" color="#fff"></u-icon>
+		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
 	import {
 		recyclePage,
+		recycleDelete
 	} from '@/api/salesServiceManagement/accessory/index.js';
 	import myCard from '@/pages/saleManage/components/myCard.vue';
 	export default {
@@ -117,8 +123,21 @@
 					judge: [{
 						authorities: '',
 					}, {
-						key: 'orderStatus',
-						value: [1, 6],
+						key: 'source',
+						value: [0],
+
+					}],
+				}, {
+					name: '删除',
+					apiName: 'delete',
+					btnType: 'primary',
+					type: '2',
+					pageUrl: '',
+					judge: [{
+						authorities: '',
+					}, {
+						key: 'source',
+						value: [0],
 
 					}],
 				}],
@@ -130,6 +149,9 @@
 			}
 		},
 		created() {
+			
+		},
+		onShow(){
 			this.doSearch();
 		},
 		methods: {
@@ -156,8 +178,7 @@
 					} else {
 						this.tableList.push(...res.list);
 					}
-					console.log(this.tableList, 'res ____')
-					this.page += 1
+					this.page += 1;
 					this.isEnd = this.tableList.length >= res.count;
 					uni.hideLoading();
 				}).catch((e) => {
@@ -170,6 +191,30 @@
 				}
 				this.getList();
 			},
+			add(item, type) {
+				uni.navigateTo({
+					url: `/pages/salesServiceManagement/recycle/recycleAdd?type=${type}&id=${item?item.id:''}`
+				})
+			},
+			async deleteRow(row) {
+				const res = await uni.showModal({
+					title: '确认删除',
+					content: '确定要删除该条数据吗?',
+					confirmText: '删除',
+					confirmColor: '#FF4D4F',
+				});
+				if (res[1].confirm) {
+					const data = await recycleDelete([row.id]);
+					if (!data) return;
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					this.doSearch();
+				} else if (res.cancel) {
+					console.log('用户取消');
+				}
+			}
 		}
 	}
 </script>
@@ -211,4 +256,17 @@
 			margin-left: 14rpx;
 		}
 	}
+
+	.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>

+ 325 - 0
pages/salesServiceManagement/recycle/recycleAdd.vue

@@ -0,0 +1,325 @@
+<template>
+	<view class="mainBox">
+		<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>
+		<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 disabled 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 disabled style="flex:1" border="surround" v-model="form.recycleDeptName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="回收人" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.recycleName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="工单名称" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input placeholder="请选择" :disabled="!isDisable" @click.native="selectWorkOrder" style="flex:1"
+						border="surround" v-model="form.orderWorkName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="工单编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.orderWorkCode">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="客户名称" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.contactName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="客户编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.contactCode">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="设备名称" arrow-direction="down">
+				<uni-data-picker ellipsis :readonly="!isDisable" v-model="form.demandDetailId" slot="value"
+					placeholder="请选择" :localdata="deviceList" @change="sourceCodeOnchange">
+				</uni-data-picker>
+			</u-cell>
+			<u-cell title="设备编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 90%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.categoryCode">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="回收时间" arrow-direction="down">
+				<uni-datetime-picker :disabled="!isDisable" type="date" 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--textarea style="flex:1; min-height: 160rpx;" border="surround" placeholder="请输入内容"
+						v-model="form.reason"></u--textarea>
+				</view>
+			</u-cell>
+		</u-cell-group>
+		<accessoryList :itemList="itemList" ref="accessoryRef" :type="type" v-show="current == 1" />
+		<view class="footerButton" v-if="isDisable">
+			<u-button type="default" text="返回" @click="back"></u-button>
+			<u-button type="primary" @click="save" text="保存"></u-button>
+		</view>
+		<u-toast ref="uToast"></u-toast>
+	</view>
+</template>
+
+<script>
+	import accessoryList from '@/pages/salesServiceManagement/workOrder/components/accessoryList.vue';
+	import {
+		recycleDetails,
+		recycleSave,
+		recycleUpdate,
+		getSalesWorkOrderById
+	} from '@/api/salesServiceManagement/workOrder/index.js'
+	export default {
+		components: {
+			accessoryList
+		},
+		computed: {
+			isDisable() {
+				let flag = this.type != 'view'
+				return flag;
+			}
+		},
+		data() {
+			return {
+				current: 0,
+				list: ['基本信息', '配件信息'],
+				title: '',
+				type: '',
+				form: {
+					repairId: '', // 工单Id
+					orderWorkName: '', // 工单名称
+					recycleName: '', // 回收人名称
+					recycleId: '', // 回收人id
+					receivingDeptId: '', // 回收人部门Id
+					recycleDeptName: '', // 回收人部门名称
+					usageTime: '', // 使用时间
+					reason: '' ,// 原因
+					demandDetailId:'', // 设备id
+					categoryCode:'' ,// 设备编码
+					categoryName:'', // 设备名称
+				},
+				selectedData: [], // 使用部门绑定值
+				classificationList: [], // 使用部门数据
+				itemList: [], // 配件信息
+				deviceList: [], // 设备信息
+			}
+		},
+		onLoad(params) {
+			this.title = params.type == 'view' ? '配件回收详情' : params.type == 'edit' ? '配件回收修改' : '配件回收新增';
+			this.type = params.type;
+			if (params.id) {
+				this.getDetails(params.id);
+			} else {
+				this.getData();
+			}
+		},
+		created() {
+			uni.$off('updateWorkData')
+			uni.$on('updateWorkData', ({
+				data
+			}) => {
+				this.changeSelect(data, '')
+			})
+		},
+		methods: {
+			sectionChange(index) {
+				this.current = index;
+			},
+			async getDetails(id) {
+				const res = await recycleDetails(id);
+				for (let key in this.form) {
+					this.form[key] = res[key];
+				}
+				this.form.id = res.id;
+				this.form.code = res.code;
+				this.itemList = res.detailList;
+				this.changeSelect({
+						id: res.repairId,
+						name: res.orderWorkName,
+						code: res.orderWorkCode
+					},
+					1
+				);
+			},
+			getData() {
+				let userInfo = uni.getStorageSync('userInfo');
+				this.form.recycleDeptName = userInfo.groupName;
+				this.form.recycleDeptId = userInfo.groupId;
+				this.form.recycleName = userInfo.name;
+				this.form.recycleId = userInfo.roleId[0];
+			},
+			sourceCodeOnchange(e) {
+				const value = e.detail.value;
+				if (value.length === 0) {
+					return this.deviceSelect({
+						text: '',
+						categoryCode: '',
+						value: ''
+					});
+				}
+				let id = value[0].value;
+				let item = this.deviceList.find(item => item.value == id);
+				this.deviceSelect(item);
+			},
+			// 设备名称选择
+			deviceSelect(item) {
+				this.form.categoryName = item.text;
+				this.form.categoryCode = item.categoryCode;
+				this.form.demandDetailId = item.value;
+			},
+			// 确认选择工单
+			async changeSelect(row, type) {
+				this.$set(this.form, 'orderWorkName', row.name);
+				this.$set(this.form, 'orderWorkCode', row.code);
+				this.form.repairId = row.id; // 工单id
+				const res = await getSalesWorkOrderById(row.id);
+				this.$set(this.form, 'contactName', res.afterSalesDemandVO.contactName);
+				this.$set(this.form, 'contactCode', res.afterSalesDemandVO.contactCode);
+				let list = res.afterSalesDemandVO.productDetail.map((el) => {
+					return {
+						text: el.categoryName,
+						categoryCode: el.categoryCode,
+						value: el.id,
+
+					};
+				});
+				this.deviceList = list;
+				//  type 判断是不是修改/详情进来 是的话不需要初始赋值
+				if (!type) {
+					this.$set(this.form, 'categoryName', list[0].text);
+					this.$set(this.form, 'categoryCode', list[0].categoryCode);
+					this.$set(this.form, 'demandDetailId', list[0].value);
+				}
+			},
+			// 使用人选择
+			onClose(item) {
+				this.form.userName = item.text;
+			},
+			save() {
+				if (!this.form.orderWorkName) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择工单",
+					})
+				};
+				if (!this.form.demandDetailId) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择设备",
+					})
+				};
+				console.log(this.form, 'this.form 123456')
+				let detailList = this.$refs.accessoryRef.getTabData() || [];
+				if (detailList.length == 0) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请添加一条配件信息",
+					})
+					this.current = 1;
+					return
+				}
+				let data = {
+					...this.form,
+					detailList
+				};
+				if (data.usageTime) {
+					data.usageTime = data.usageTime + ' 00:00:00'
+				}
+				let api = this.type == 'edit' ? recycleUpdate : recycleSave;
+				api(data).then((res) => {
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					this.back();
+				}).catch((err) => {})
+			},
+			selectWorkOrder() {
+				uni.navigateTo({
+					url: `/pages/salesServiceManagement/accessory/components/selectWork`
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	/deep/.u-subsection__item__text {
+		font-size: 28rpx !important;
+	}
+
+	/deep/.u-cell__body__content {
+		flex: none;
+		margin-right: 16rpx;
+	}
+
+	.footerButton {
+		width: 100%;
+		height: 84rpx;
+		display: flex;
+		position: fixed;
+		bottom: 0;
+		z-index: 10;
+
+		/deep/.u-button {
+			height: 100%;
+		}
+
+		>view {
+			flex: 1;
+
+		}
+	}
+
+	/deep/ .u-textarea__field {
+		height: 160rpx !important;
+	}
+
+	.selected-value {
+		height: 80rpx;
+		line-height: 80rpx;
+		padding: 0 20rpx;
+		border: 1rpx solid #e5e5e5;
+		border-radius: 8rpx;
+		font-size: 28rpx;
+		color: #333;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		background-color: #fff;
+	}
+
+	// .mainBox {
+	/deep/.uni-data-tree {
+		width: calc(100% - 150rpx);
+
+		.selected-list {
+			white-space: nowrap;
+			/* 禁止文本换行 */
+			overflow: hidden;
+			/* 超出部分隐藏 */
+			text-overflow: ellipsis;
+			/* 显示省略号 */
+		}
+	}
+
+	// }
+</style>

+ 10 - 2
pages/salesServiceManagement/workOrder/components/accessoryList.vue

@@ -3,7 +3,7 @@
 		<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">
+					:columns="columns" :btnList="btnData">
 					<u--input placeholder="请输入" type="number" @input="(val) =>inputChange(val,'totalCount',index)"
 						slot="totalCount" v-model="item.totalCount">
 					</u--input>
@@ -116,7 +116,15 @@
 				tableList: []
 			}
 		},
-		computed: {},
+		computed: {
+			// 按钮
+			btnData(){
+				if(this.type == 'view'){
+					return []
+				}
+				return this.btnList;
+			}
+		},
 		created() {
 			uni.$off('updateAddessory');
 			uni.$on('updateAddessory', (data) => {