Просмотр исходного кода

售后管理 方案信息页面开发

8521520123jsy 1 год назад
Родитель
Сommit
f4e82d60dc

+ 13 - 1
api/wms/index.js

@@ -16,4 +16,16 @@ export async function getInfoBySourceBizNoAll(sourceBizNo) {
 		return data.data;
 	}
 	return Promise.reject(data.message);
-}
+}
+
+/**
+ * 获取产品所有库存
+ */
+export async function getInventoryTotalAPI(datas) {
+	const data = await get(
+		Vue.prototype.apiUrl + `wms/stocktwo/getInventoryTotal`, datas);
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}

+ 89 - 0
pages/salesServiceManagement/toDoList/components/productScreen.vue

@@ -0,0 +1,89 @@
+<template>
+	<view>
+		<u-popup :show="show" closeOnClickOverlay mode="top" @close="closePopup">
+			<view class="search_list">
+				<u-form labelPosition="left" :model="form" labelWidth="180" labelAlign="left" class="baseForm">
+					<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-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.contactName"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+				</u-form>
+			</view>
+			<view class="operate_box rx-bc">
+				<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 {
+		components: {},
+		props: [],
+		data() {
+			return {
+				form: {
+					brandNum: "",
+					categoryCode: "",
+					categoryName: ""
+				},
+				show: false,
+			}
+		},
+		methods: {
+			open() {
+				this.show = true;
+			},
+			closePopup() {
+
+			},
+			reset() {
+				this.form = {
+					brandNum: "",
+					categoryCode: "",
+					contactName: ""
+				}
+				this.submit();
+			},
+			submit() {
+				this.$emit('succeed',this.form);
+				this.show = false;
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.search_list {
+		padding: 0 20rpx;
+	}
+	
+	.operate_box {
+		padding: 10rpx 32rpx;
+	
+		/deep/ .u-button {
+			width: 40%;
+		}
+	}
+	
+	.item-form{
+		/deep/ .u-form-item__body__left__content__label{
+			font-size: 28rpx;
+		}
+	}
+</style>

+ 98 - 18
pages/salesServiceManagement/toDoList/components/schemeAdd.vue

@@ -4,44 +4,73 @@
 			@clickLeft="back">
 		</uni-nav-bar>
 		<u-cell-group>
-			<u-cell title="姓名" arrow-direction="down">
-				<uni-data-picker v-model="form.typeId" slot="value" placeholder="请选择" :localdata="typeIdList"
-					@change="typeOnchange">
+			<u-cell title="项目" arrow-direction="down">
+				<uni-data-picker v-model="form.typeId" slot="value" :clear-icon='false' placeholder="请选择"
+					:localdata="typeIdList" @change="typeOnchange">
 				</uni-data-picker>
 			</u-cell>
 			<u-cell title="编码" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.code"></u--input>
+
+				<u--input v-if="form.typeId != '2'" slot="value" placeholder="请输入" border="surround"
+					v-model="form.code">
+				</u--input>
+				<view class="labels" slot="value" v-if="form.typeId == '2'">
+					{{ form.code }}
+				</view>
 			</u-cell>
 			<u-cell title="名称" arrow-direction="down">
-				<u--input @click.native="selectProduct" slot="value" placeholder="请输入" border="surround"
+				<u--input @click.native="selectProduct" slot="value" placeholder="请选择" border="surround"
 					v-model="form.name">
-
 				</u--input>
 				<!-- <u--input slot="value" placeholder="请输入" border="surround" v-model="form.name"></u--input> -->
 			</u-cell>
 			<u-cell title="型号" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.categoryModel"></u--input>
+				<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround"
+					v-model="form.categoryModel"></u--input>
+				<view class="labels" slot="value" v-if="form.typeId == '2'">
+					{{ form.categoryModel }}
+				</view>
 			</u-cell>
 			<u-cell title="规格" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.specification"></u--input>
+				<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround"
+					v-model="form.specification"></u--input>
+				<view class="labels" slot="value" v-if="form.typeId == '2'">
+					{{ form.specification }}
+				</view>
 			</u-cell>
 			<u-cell title="仓库" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.warehouseId"></u--input>
+				<template>
+					<uni-data-picker v-model="form.warehouseId" slot="value" :clear-icon='false' placeholder="请选择"
+						:localdata="warehouseList" @change="warehouseOnchange">
+					</uni-data-picker>
+					<!-- <u--input slot="value" placeholder="请输入" border="surround" v-model="form.warehouseId"></u--input> -->
+				</template>
 			</u-cell>
 			<u-cell title="库存" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.warehouseNum"></u--input>
-			</u-cell>
-			<u-cell title="数量" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.totalCount"></u--input>
+				<!-- <u--input slot="value" placeholder="请输入" border="surround" v-model="form.warehouseNum"></u--input> -->
+				<view class="labels" slot="value">
+					{{ form.warehouseNum }}
+				</view>
 			</u-cell>
 			<u-cell title="单位" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.measureUnit"></u--input>
+				<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround"
+					v-model="form.measureUnit"></u--input>
+				<view class="labels" slot="value" v-if="form.typeId == '2'">
+					{{ form.measureUnit }}
+				</view>
+			</u-cell>
+			<u-cell title="数量" arrow-direction="down">
+				<u--input slot="value" @input=" (val) =>inputChange(val,'totalCount')" placeholder="请输入" border="surround"
+					v-model="form.totalCount"></u--input>
 			</u-cell>
 			<u-cell title="单价" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.singlePrice"></u--input>
+				<u--input slot="value" @input="inputChange('singlePrice')" placeholder="请输入" border="surround"
+					v-model="form.singlePrice"></u--input>
 			</u-cell>
 			<u-cell title="合计" arrow-direction="down">
-				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.settlementPrice"></u--input>
+				<view class="labels" slot="value">
+					{{ form.settlementPrice }}
+				</view>
 			</u-cell>
 			<u-cell title="详细内容" arrow-direction="down">
 				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.content"></u--input>
@@ -85,21 +114,68 @@
 						value: '3'
 					}
 				],
-				obtain: '主数据'
+				obtain: '主数据',
+				warehouseList: [], // 仓库数据
+				oldTypeId: '2', // 旧的项目选择
 			}
 		},
 		onLoad(params) {
 			this.obtain = params.obtain || '主数据'
-			console.log(params, 'params');
+		},
+		created() {
+			uni.$off('updateScheme');
+			uni.$on('updateScheme', (data) => {
+				this.form = {
+					...this.form,
+					...data
+				};
+				console.log(this.form, 'form 数据')
+				this.warehouseList = data.warehouseList.map((el) => {
+					el.text = el.warehouse_name;
+					el.value = el.warehouse_id;
+					return el;
+				});
+			})
 		},
 		methods: {
+			// 如果新的选择跟旧的一样 不做数据更改
 			typeOnchange(e) {
+				if (this.form.typeId == this.oldTypeId) {
+					return;
+				}
+				this.oldTypeId = this.form.typeId;
+				this.form = {
+					typeId: e.detail.value[0].text,
+					code: '',
+					name: '',
+					categoryModel: '', // 型号
+					specification: '', // 规格
+					content: '', // 详细内容
+					warehouseId: '', // 仓库
+					warehouseNum: '', // 库存
+					totalCount: '', // 数量
+					measureUnit: '', // 单位
+					singlePrice: '', // 单价
+					settlementPrice: '', // 合计
+				}
+				console.log(this.form, 'form -0-')
 				console.log(e, 'eee');
+			},
+			warehouseOnchange(e) {
+
 			},
 			selectProduct() {
 				uni.navigateTo({
 					url: `/pages/salesServiceManagement/toDoList/components/selectProduct?obtain=${this.obtain}`
 				})
+			},
+			save() {
+
+			},
+			inputChange(val,field) {
+				console.log(val,'val')
+				this.form[field] = this.form[field].replace(/[^\d]/g, '').replace(/^0+/, '')
+				console.log(field, 'eeeee');
 			}
 		}
 	}
@@ -113,6 +189,10 @@
 
 	.mainBox {
 		padding-bottom: 84rpx;
+
+		.labels {
+			padding-left: 18rpx;
+		}
 	}
 
 	.footerButton {

+ 141 - 28
pages/salesServiceManagement/toDoList/components/selectProduct.vue

@@ -7,6 +7,13 @@
 					text="选择分类"></u-button>
 			</template>
 		</uni-nav-bar>
+		<view class="top-wrapper">
+			<uni-section class="dimension">
+				<uni-data-select v-model="dimension" :clear="false" :localdata="dimensionList"></uni-data-select>
+			</uni-section>
+			<button class="search_btn" @click="getData">搜索</button>
+			<image class="menu_icon" @click="handleSearch" src="~@/static/pda/menu.svg"></image>
+		</view>
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent">
 				<checkbox-group v-for="(item, index) in tableList" :key="index"
@@ -44,10 +51,16 @@
 				<view class="selBtn">选择( {{ checkListLen }} )</view>
 			</u-button>
 		</view>
+		<prodctScreen ref="screen" @succeed="getData" />
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
+	import prodctScreen from './productScreen.vue'
+	import {
+		getInventoryTotalAPI
+	} from '@/api/wms/index.js'
 	import {
 		treeByPid
 	} from '@/api/pda/workOrder.js'
@@ -60,6 +73,7 @@
 	export default {
 		data() {
 			return {
+				isEnd: false,
 				tableList: [],
 				obtain: '主数据',
 				dimension: '1', // 列表维度
@@ -68,34 +82,69 @@
 				classificationList: [],
 				pageNum: 1,
 				isEnd: false,
-				detailsData:{}
+				detailsData: {},
+				checkedkList: [],
+				searchVal: '',
+				selectType: '1', // 1 单选 2 多选
+				dimensionList: [{
+						value: '4',
+						text: '物料维度'
+					},
+					{
+						value: '3',
+						text: '包装维度'
+					},
+					{
+						value: '2',
+						text: '批次维度'
+					},
+					{
+						value: '1',
+						text: '物品维度'
+					},
+				]
 			}
 		},
-		computed:{
+		components: {
+			prodctScreen
+		},
+		computed: {
 			checkListLen() {
-				return this.detailsData.id ? 1 : 0
+				return this.checkedkList.length;
 			},
 		},
 		onLoad(params) {
 			console.log(params, '参数')
-			this.obtain = params.obtain;
-			if (params.obtain == '仓库') {
-				this.changeDimension(this.dimension);
-			} else {
-
-			}
+			this.obtain = params.obtain || '主数据';
+			this.selectType = params.selectType || '1'
 		},
-		onShow(){
-			this.getTreeList()
+		onShow() {
+			this.getTreeList();
+			// this.getData();
 		},
-		components: {},
 		methods: {
+			// 获取页面数据
+			getData(parameter) {
+				this.isEnd = false
+				this.pageNum = 1
+				if (this.obtain == '仓库') {
+					this.changeDimension(this.dimension, parameter);
+				} else {
+
+				}
+			},
+			handleSearch() {
+				this.$refs.screen.open();
+			},
 			//返回添加页
 			backAdd() {
-				uni.navigateBack()
+				uni.navigateBack();
 			},
 			// 仓库数据
-			changeDimension(dimension) {
+			changeDimension(dimension, parameter = {}) {
+				if (this.isEnd) {
+					return
+				}
 				uni.showLoading({
 					title: '加载中'
 				})
@@ -104,6 +153,7 @@
 						let params = {
 							// assetName: this.assetName,
 							// dimension: this.dimension,
+							...parameter,
 							pageNum: this.pageNum,
 							size: 15,
 							categoryLevelId: this.categoryLevelId
@@ -117,11 +167,10 @@
 							el.code = el.categoryCode;
 							return el;
 						});
-
-
+						this.pageNum += 1
+						this.isEnd = this.tableList.length >= res.count;
 						uni.hideLoading();
 						resolve();
-						console.log(res, 'res')
 					} catch (error) {
 						uni.hideLoading()
 						reject()
@@ -130,13 +179,12 @@
 			},
 			classification() {
 				this.$refs.treePicker._show();
-				console.log('选择分类')
 			},
 			scrolltolower() {
-				// if (this.isEnd) {
-				// 	return
-				// }
-				// this.getList();
+				if (this.isEnd) {
+					return
+				}
+				this.getData();
 			},
 			// 选择
 			selectVal(e, val, index) {
@@ -146,7 +194,7 @@
 						this.$set(this.tableList[i], 'checked', false)
 					}
 				})
-				console.log(this.tableList, 'list - - ')
+				this.checkedkList = this.tableList.filter(item => item.checked)
 			},
 			getTreeList() {
 				treeByPid({
@@ -160,10 +208,34 @@
 				// this.rootCategoryLevelId = rootCategoryLevelId
 				this.categoryLevelId = id;
 				this.tableList = [];
-				this.changeDimension(this.dimension);
+				this.getData();
 			},
-			jumpAdd(){
-				
+			async jumpAdd() {
+				let list = this.checkedkList;
+				if (list.length == 0) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请至少选择一条产品数据",
+					})
+					return;
+				}
+				//获取仓库库存
+				// if (this.obtain == '仓库') {
+				// 	let codeList = list.map((item) => item.code);
+				// 	let inventoryTotalList = await getInventoryTotalAPI(codeList);
+				// 	list.forEach((item) => {
+				// 		let find =
+				// 			inventoryTotalList.find((key) => key.code == item.code) || {};
+				// 		item.availableCountBase = find.availableCountBase;
+				// 	});
+				// }
+
+				console.log(list, 'list --')
+				// 单选
+				if (this.selectType == '1') {
+					uni.$emit('updateScheme', list[0]);
+				}
+				this.back();
 			}
 		}
 	}
@@ -176,13 +248,13 @@
 		height: 100vh;
 		display: flex;
 		flex-direction: column;
-		
+
 		.wrapper {
 			// flex: 1;
 			height: calc(100vh - 250rpx);
 			overflow: hidden;
 		}
-		
+
 		//底部按钮
 		.footer {
 			height: 45px;
@@ -208,5 +280,46 @@
 				width: 150rpx;
 			}
 		}
+
+		.top-wrapper {
+			background-color: #fff;
+			display: flex;
+			width: 750rpx;
+			height: 88rpx;
+			padding: 16rpx 32rpx;
+			align-items: center;
+			gap: 16rpx;
+
+			/deep/.uni-section {
+				margin-top: 0px;
+			}
+
+			/deep/.uni-section-header {
+				padding: 0px;
+
+			}
+
+			.search_btn {
+				width: 120rpx;
+				height: 70rpx;
+				line-height: 70rpx;
+				padding: 0 24rpx;
+				background: $theme-color;
+				font-size: 32rpx;
+				color: #fff;
+				margin: 0;
+				margin-left: 26rpx;
+			}
+
+			.menu_icon {
+				width: 44rpx;
+				height: 44rpx;
+				margin-left: 14rpx;
+			}
+		}
+
+		.dimension {
+			width: calc(100% - 270rpx);
+		}
 	}
 </style>

+ 0 - 1
pages/salesServiceManagement/toDoList/index.vue

@@ -197,7 +197,6 @@
 					}
 					this.page += 1
 					this.isEnd = this.tableList.length >= res.count;
-					console.log(this.tableList, 'tableList')
 					uni.hideLoading();
 				}).catch((e) => {
 					uni.hideLoading()