Przeglądaj źródła

feat(采购管理): 新增销售订单选择组件并实现相关功能

liujt 6 miesięcy temu
rodzic
commit
59c1296207

+ 8 - 0
pages.json

@@ -2098,6 +2098,14 @@
 				"navigationBarTextStyle": "white"
 			}
 		},
+		{
+			"path": "pages/purchasingManage/components/selectSaleOrder",
+			"style": {
+				"navigationBarTitleText": "选择订单",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
 		{
 			"path": "pages/saleManage/components/selectUser",
 			"style": {

+ 15 - 15
pages/login/login.vue

@@ -407,24 +407,24 @@
 					return
 				}
 				// #endif
-				// // APP场景:先检查版本
-				// try {
-				// 	const updateResult = await this.checkVersionForLogin()
-				// 	console.log('版本检查结果:', updateResult)
+				// APP场景:先检查版本
+				try {
+					const updateResult = await this.checkVersionForLogin()
+					console.log('版本检查结果:', updateResult)
 					
-				// 	// 如果是更新成功状态,停止登录流程(应用即将重启)
-				// 	if (updateResult === 'updated') {
-				// 		return
-				// 	}
+					// 如果是更新成功状态,停止登录流程(应用即将重启)
+					if (updateResult === 'updated') {
+						return
+					}
 					
-				// 	// 其他情况(latest_version, skip_update, h5_platform)都可以继续登录
-				// } catch (error) {
-				// 	console.log('版本检查失败:', error)
-				// 	// 版本检查失败时,可以选择继续登录或提示用户
-				// 	// 这里选择继续登录,不阻碍用户使用
-				// }
+					// 其他情况(latest_version, skip_update, h5_platform)都可以继续登录
+				} catch (error) {
+					console.log('版本检查失败:', error)
+					// 版本检查失败时,可以选择继续登录或提示用户
+					// 这里选择继续登录,不阻碍用户使用
+				}
 				
-				// // H5场景直接登录,无需版本检查
+				// H5场景直接登录,无需版本检查
 
 				let param = {
 					loginName: this.userInfo.username,

+ 427 - 0
pages/purchasingManage/components/selectSaleOrder.vue

@@ -0,0 +1,427 @@
+<template>
+	<view class="mainBox">
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="选择" @clickLeft="backAdd">
+
+		</uni-nav-bar>
+		<view class="searchBox">
+			<input v-model="searchVal" placeholder="请输入名称" class="searchInput" />
+			<u-button type="icon-shixiangxinzeng" size="30" @click="doSearch" data-icon="Search" class="searchBtn">
+				<view class="iconfont icon-sousuo"></view>
+				<view class="text">搜索</view>
+			</u-button>
+		</view>
+		<view class="wrapper">
+			<u-list @scrolltolower="scrolltolower" class="listContent">
+				<checkbox-group v-for="(item, index) in listData" :key="index" @change="e => selectVal(e, item, index)">
+					<label>
+						<view class="listBox">
+							<view class="listBox-sel">
+								<checkbox :value="item.code" color="#fff" :disabled="item.disabled"
+									:checked="item.checked" />
+							</view>
+							<view class="listBox-con">
+								<view class="listBox-top">
+									<view class="listBox-name">
+										{{ item.productNames }}
+									</view>
+									<view class="listBox-code">
+										{{ item.orderNo }}
+									</view>
+								</view>
+								<view class="listBox-bottom">
+									<view>编码:{{ item.productCodes }}</view>
+									<view>订单类型:{{ item.needProduce }}</view>
+									<view>客户名称:{{ item.partaName }}</view>
+									<view>客户联系人:{{ item.partaLinkName }}</view>
+									<view>生产编号:{{ item.productionCodes }}</view>
+									<view>库存数:{{ item.inventoryQuantity }}</view>
+									<view>库存状态:{{ item.inventoryQuantity }}</view>
+								</view>
+							</view>
+						</view>
+					</label>
+				</checkbox-group>
+				<u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
+			</u-list>
+		</view>
+
+		<view class="footer">
+			<view class="bottom" v-if="this.isAll==1">
+				<checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
+				<checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
+				</checkbox>
+			</view>
+			<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
+				<view class="selBtn">选择( {{ checkListLen }} )</view>
+			</u-button>
+		</view>
+		<ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择部门"
+			:localdata="classificationList" valueKey="id" textKey="name" />
+	</view>
+</template>
+
+<script>
+	import {
+		getTableList,
+	} from '@/api/saleManage/saleorder'
+	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
+	export default {
+		components: {
+			baTreePicker
+		},
+
+		data() {
+			return {
+				page: 1,
+				size: 10,
+				isEnd: false,
+				searchVal: '',
+				pickTabIndex: 1,
+				popupShow: false, //右侧搜索窗
+				typeIndex: 1,
+				listData: [], //列表数据
+				classificationList: [], //分类数据
+				seletedAll: false, //全选状态,
+				isAll: ''
+
+			}
+		},
+		//选择的列表长度
+		computed: {
+
+			checkListLen() {
+
+				return this.listData.filter(el => el.checked).length
+			},
+
+		},
+		onShow() {
+			this.isEnd = false
+			this.page = 1
+			this.getList()
+		},
+		onLoad({
+			isAll
+		}) {
+			this.isAll = isAll //1多选 2单选
+			this.getList()
+		},
+		onShow() {},
+		methods: {
+			scrolltolower() {
+				this.getList()
+			},
+			//列表数据
+			getList() {
+				if (this.isEnd) {
+					return
+				}
+
+				uni.showLoading({
+					title: '加载中'
+				})
+
+				let params = {
+					pageNum: this.page,
+					size: this.size,
+					name: this.searchVal
+				}
+
+				getTableList(params).then(res => {
+					if (this.page === 1) {
+						this.listData = res.list
+					} else {
+						this.listData.push(...res.list)
+					}
+					this.page += 1
+					this.isEnd = this.listData.length >= res.count
+				}).then(() => {
+					uni.hideLoading()
+				})
+
+
+
+				// this.isEnd = false
+				// this._getClassifyList()
+			},
+			async _getClassifyList() {
+				uni.showLoading({
+					title: '数据加载中'
+				})
+				const params = {
+					pageNum: 1,
+					size: this.size,
+					searchName: this.searchVal,
+					isNoSendDone: 0,
+					orderStatus: 2,
+
+				}
+
+				getTableList(params).then(res => {
+					uni.hideLoading()
+					if (this.page == 1) {
+						this.listData = []
+					}
+					this.listData = this.listData.concat(res.list)
+					this.isEnd = this.listData.length >= res.count
+				})
+			},
+			confirm([id]) {
+				this.categoryLevelId = id
+				this.page = 1
+				this.getList()
+			},
+			async getClassify() {
+				listOrganizations(1).then(res => {
+					this.classificationList = res
+					this.page = 1
+					this.getList()
+				});
+			},
+			doSearch() {
+				this.isEnd = false
+				this.page = 1
+				this.getList()
+			},
+			//勾选
+			selectVal(e, val, index) {
+
+				this.$set(this.listData[index], 'checked', !this.listData[index].checked)
+
+				if (this.isAll != 1) {
+					this.listData.forEach((item, i) => {
+						if (item.id != val.id) {
+							this.$set(this.listData[i], 'checked', false)
+						}
+					})
+				} else {
+
+					this.seletedAll = !this.listData.some(item => !item.checked)
+				}
+
+			},
+			//全选按钮
+			_seletedAll() {
+				if (!this.seletedAll) {
+					this.seletedAll = true
+					this.listData.map(item => {
+						this.$set(item, 'checked', true)
+					})
+				} else {
+					this.seletedAll = false
+					this.listData.map(item => {
+						this.$set(item, 'checked', false)
+					})
+				}
+			},
+			//跳转回添加页面
+			jumpAdd() {
+				uni.$emit(
+					'setSaleOrder',
+					this.listData.filter(item => item.checked)
+				)
+
+				uni.navigateBack()
+			},
+			//返回添加页
+			backAdd() {
+				uni.navigateBack()
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.mainBox {
+		height: 100vh;
+		display: flex;
+		flex-direction: column;
+
+		.wrapper {
+			flex: 1;
+			overflow: hidden;
+		}
+
+		.searchBox {
+			padding: 10rpx 0;
+			box-sizing: border-box;
+			background-color: #dedede;
+			height: 90rpx;
+			width: 100%;
+			line-height: 90rpx;
+			display: flex;
+			justify-content: space-around;
+			align-items: center;
+
+			input {
+				height: 78rpx;
+				width: 65%;
+				background: #f9f9f9 !important;
+				margin: 0 10rpx;
+				padding: 0 10rpx;
+				box-sizing: border-box;
+				border-radius: 5rpx;
+			}
+
+			.searchBtn {
+				height: 80rpx;
+				background: #f9f9f9 !important;
+				color: #676767;
+				font-size: 28rpx;
+				padding: 0 42rpx;
+				box-sizing: border-box;
+				outline: none;
+				border: none;
+				width: 260rpx;
+
+				.icon-sousuo {
+					font-size: 22px;
+				}
+
+				.text {
+					font-size: 16px;
+					margin-left: 10px;
+				}
+			}
+		}
+
+		.tab-title {
+			position: fixed;
+			top: 190rpx;
+			z-index: 99;
+			width: 100%;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			height: $tab-height;
+			line-height: $tab-height;
+			background-color: #ffffff;
+			border-bottom: 2rpx solid #f2f2f2;
+			box-sizing: border-box;
+
+			.tab-item {
+				width: 25%;
+				text-align: center;
+				font-size: 32rpx;
+				color: $uni-text-color-grey;
+			}
+
+			.tab-item.active {
+				color: $j-primary-border-green;
+				border-bottom: 1px solid $j-primary-border-green;
+				font-weight: bold;
+			}
+
+			.tab-item.filter {
+				flex: 1;
+				padding: 0px 30rpx;
+
+				.uni-icons {
+					display: flex;
+					padding-top: 5px;
+				}
+			}
+
+			.screenIcon {
+				display: flex;
+				width: 80px;
+				justify-content: center;
+
+				.screenText {
+					font-size: 32rpx;
+					color: $uni-text-color-grey;
+				}
+			}
+		}
+
+		.listContent {
+			height: 100% !important;
+
+			.listBox {
+				display: flex;
+				// height: 180rpx;
+				padding: 20rpx 0;
+				border-bottom: 2rpx solid #e5e5e5;
+
+				.listBox-sel {
+					height: 90rpx;
+					width: 80rpx;
+					// line-height: 90rpx;
+					text-align: center;
+
+					checkbox {
+						transform: scale(1.2);
+					}
+				}
+
+				.listBox-con {
+					width: 100%;
+					// display: flex;
+					// flex-wrap: wrap;
+					// justify-content: space-between;
+					align-items: center;
+					padding: 0 18rpx 0 0;
+
+					.listBox-top {
+						width: 100%;
+						display: flex;
+						justify-content: space-between;
+						padding-bottom: 10rpx;
+
+						.listBox-name,
+						.listBox-code {
+							display: inline-block;
+							font-size: $uni-font-size-sm;
+							font-weight: bold;
+						}
+					}
+
+					.listBox-bottom {
+						width: 100%;
+						display: flex;
+						justify-content: space-between;
+						font-size: $uni-font-size-sm;
+						flex-wrap: wrap;
+
+						>view {
+							width: 50%;
+							overflow: hidden;
+							white-space: nowrap;
+							text-overflow: ellipsis;
+						}
+					}
+				}
+			}
+
+			.noDate {
+				height: 100%;
+			}
+		}
+
+		//底部按钮
+		.footer {
+			height: 90rpx;
+			position: relative;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			bottom: 0;
+			width: 100%;
+			height: 100rpx;
+			border-top: 1rpx solid #eeecec;
+			background-color: #ffffff;
+			z-index: 999;
+
+			.bottom {
+				margin-left: 10rpx;
+			}
+
+			.u-reset-button {
+				position: absolute;
+				right: 10rpx;
+				top: 20rpx;
+				width: 150rpx;
+			}
+		}
+	}
+</style>

+ 67 - 8
pages/purchasingManage/purchaseNeedManage/add.vue

@@ -45,15 +45,13 @@
 				</u--input>
 			</u-cell>
 			<u-cell title="销售合同" arrow-direction="down">
-				<!-- <u--input slot="value" placeholder="请输入" border="requireUserId" v-model="form.name"></u--input> -->
-				<u--input slot="value" style="flex:1" border="surround" v-model="form.requireUserId"
-						placeholder="请选择需求人" @click.native="openSelector">
-				</u--input>
+				<u--input slot="value" placeholder="请选择" border="surround" v-model="form.saleOrderNo"
+					@click.native="selectContractShow"></u--input>
 			</u-cell>
 			<u-cell title="销售订单" arrow-direction="down">
 				<!-- <u--input slot="value" placeholder="请输入" border="requireUserId" v-model="form.name"></u--input> -->
 				<u--input slot="value" style="flex:1" border="surround" v-model="form.requireUserId"
-						placeholder="请选择需求人" @click.native="openSelector">
+						placeholder="请选择销售订单" @click.native="slectOrderShow">
 				</u--input>
 			</u-cell>
 			<u-cell title="是否接受拆单" arrow-direction="down">
@@ -143,6 +141,7 @@
 	import {
 		getUserPage
 	} from '@/api/common.js';
+	import { getTableList, getSaleOrderDetail } from '@/api/saleManage/saleorder/index'
 	export default {
 		components: {
 			produceList,
@@ -189,7 +188,33 @@
 		created() {
 
 			this.getByCode()
+			//选择合同回调
+			uni.$off('setContractList')
+			uni.$on('setContractList', async (data) => {
+				if (data && data.length > 0) {
+					this.form = Object.assign({}, this.form, {
+						saleContractId: data[0].id,
+						saleContractName: data[0].contractName,
+						saleContractNo: data[0].contractNo,
+					});
+					this.getSaleOrderList(data[0].id);
+				}
 
+			})
+
+			uni.$off('setSaleOrder')
+			uni.$on('setSaleOrder', async (data) => {
+				if(data && data.length > 0) {
+					this.form = Object.assign({}, this.form, {
+						saleContractId: '',
+						saleContractName: '',
+						saleContractNo: '',
+						saleOrderId: data[0].id,
+						saleOrderNo: data[0].orderNo
+					});
+					this.getSaleOrderDetail(this.form.saleOrderId)
+				}
+			})
 		},
 		onLoad(data) {
 			this.getTreeList()
@@ -229,9 +254,32 @@
 		},
 		onUnload() {
 			uni.$off('setSelectList')
+			uni.$off('setContractList')
+			uni.$off('setSaleOrder')
 			// uni.$off('updatelinkList')
 		},
 		methods: {
+			async getSaleOrderList(contractId) {
+				let res = await getTableList({
+				pageNum: 1,
+				size: 10,
+				contractId
+				});
+				this.form.saleOrderId = res.list[0]?.id;
+				this.form.saleOrderNo = res.list[0]?.orderNo;
+				this.getSaleOrderDetail(this.form.saleOrderId);
+			},
+			async getSaleOrderDetail(id) {
+				const data = await getSaleOrderDetail(id);
+				data.productList.forEach((item) => {
+				item.expectReceiveDate = item.produceDeliveryDeadline;
+				item.arrivalWay = 1;
+				});
+
+				this.$nextTick(() => {
+				this.$refs.produceListRef.init(data.productList);
+				});
+			},
 			async getTreeList() {
 				const data = await listOrganizations({});
 				let treeList = toTreeData({
@@ -283,6 +331,17 @@
 			onClose(item) {
 				this.form.userName = item.text;
 			},
+			//选择合同
+			selectContractShow() {
+				uni.navigateTo({
+					url: '/pages/saleManage/components/selectContract?isAll=' + 2
+				})
+			},
+			slectOrderShow() {
+				uni.navigateTo({
+					url: '/pages/purchasingManage/components/selectSaleOrder?isAll=' + 2
+				})
+			},
 			getByCode() {
 				const codeS = ['business_opport_code']
 				codeS.forEach(async (code) => {
@@ -417,9 +476,9 @@
 		}
 	}
 
-	/deep/.u-button {
-		// height: 100%;
-	}
+	// /deep/.u-button {
+	// 	// height: 100%;
+	// }
 
 	/deep/.u-subsection__item__text {
 		font-size: 28rpx !important;