Pārlūkot izejas kodu

添加叫号功能

wangchao 3 gadi atpakaļ
vecāks
revīzija
7c7ae27bd4

+ 2 - 0
demo.vue

@@ -59,6 +59,8 @@
 				title: '提交成功',
 				type: 'success'
 			})
+			// 深拷贝
+			let b = this.$u.deepClone(a);
 			uni.setStorageSync("depotAcquisition_warehouseName",this.warehouseName)
 			uni.getStorageSync("depotAcquisition_warehouseName")
 			// 公司id

+ 17 - 5
pages/erpbusiness/add_quality_testing.vue

@@ -291,9 +291,19 @@
 		onShow() {
 			this.purchasePriceList = uni.getStorageSync('purchasePriceList')
 			if (uni.getStorageSync('checkcustomer')) {
-				this.gridList.customerName = uni.getStorageSync('checkcustomer').customerName
-				this.gridList.customerPhone = uni.getStorageSync('checkcustomer').customerPhone
-				this.gridList.customerNumberCard = uni.getStorageSync('checkcustomer').customerNumberCard
+
+				let _customerInfo = uni.getStorageSync('checkcustomer')
+				if (_customerInfo.shipperName) {
+					//点击登记客户
+					this.gridList.customerName = _customerInfo.shipperName
+					this.gridList.customerPhone =_customerInfo.shipperPhone
+				} else {
+					//点击搜索客户
+					this.gridList.customerName =_customerInfo.customerName
+					this.gridList.customerPhone = _customerInfo.customerPhone
+				}
+
+				this.gridList.customerNumberCard = _customerInfo.customerNumberCard
 			}
 			this.gridList.grade = this.gradeList[0].value
 			this.gridList.gradeKey = this.gradeList[0].key
@@ -390,7 +400,8 @@
 			},
 			gocustomer() {
 				uni.navigateTo({
-					url: '/pages/erpbusiness/customer?cangid=' + this.cangid
+					url: '/pages/erpbusiness/customer?cangid=' + this.cangid + '&warehouseName=' + this.gridList
+						.warehouseName
 				})
 			},
 			getdate() {
@@ -510,7 +521,8 @@
 												if (count <= 0) {
 													count = 0
 													that.$api.msg('该客户累计销售' + this.gridList.goodsName + (
-															response.data.data / 1000).toFixed(2) + '吨,还可售粮' +
+															response.data.data / 1000).toFixed(2) +
+														'吨,还可售粮' +
 														count + '吨', )
 
 												} else {

+ 234 - 142
pages/erpbusiness/customer.vue

@@ -22,18 +22,23 @@
 					<view v-else> {{item.customerName}}({{item.customerPhone}}) </view>
 				</view>
 			</view>
-			<view v-for='item in gridList' style='display:inline-block;'>
-				<view @click='recentcustomer(item)' class='wrap' v-if='show==false'>{{item.searchContent}}</view>
+			<view v-for='item in recentCustomers' style='display:inline-block;'>
+				<view @click='recentcustomer(item)' class='wrap' v-if='show==false'>
+					{{item.customerName}}({{item.customerPhone}})
+				</view>
 			</view>
 		</view>
 		<view class="content content1">
 			<view style='padding-left:20px;color:#AFB3BF;font-size:14px;' v-if='show==false'>登记客户</view>
-		
-			<view v-for='item in gridList'>
-				<view class="row">
-					<view class="row-item">辽H12345</view>
-					<view class="row-item">张三(货)</view>
-					<view class="row-item">李四(商)</view>
+
+			<view v-for='item in registeredCustomer'>
+				<view class="dj-customer" @click="registeredCustomerClick(item)">
+					<view class="left">{{item.carNo}}</view>
+					<view class="right">
+						<view class="">{{item.shipperName}}(货)</view>
+						<view class="">{{item.supplier}}(商)</view>
+					</view>
+
 				</view>
 			</view>
 		</view>
@@ -93,8 +98,9 @@
 				purchasePriceList: [],
 				warehouseCount: '',
 				commonWarehouseNo: '',
-				cangid: ''
-
+				cangid: '',
+				recentCustomers: [],
+				registeredCustomer: []
 			}
 		},
 		computed: {
@@ -109,6 +115,7 @@
 		},
 		onLoad(options) {
 			this.cangid = options.cangid
+			this.warehouseName = options.warehouseName
 			this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
 				warehouseId: this.cangid
 			}).then(res => {
@@ -120,26 +127,59 @@
 		},
 		onShow() {
 			this.purchasePriceList = uni.getStorageSync('purchasePriceList')
-			this.gridList = []
-			this.$api.doRequest('get', '/searchRecordsInfo/selectSearchRecordsInfo', {
-				pageSize: this.pageSize,
-				currentPage: this.currentPage,
-				functionType: "3",
-				commonId: this.userInfo.id
-			}).then(res => {
-				if (res.data.data) {
-					this.gridList = res.data.data.records
-					console.log(this.gridList)
+				let _data = uni.getStorageSync('recentCustomers')
+			if (_data) {
+				this.recentCustomers =_data
+				for(let i=0;i<_data.length;i++){
+					if(_data[i].shipperName){
+						this.recentCustomers[i].customerName = _data[i].shipperName
+						this.recentCustomers[i].customerPhone = _data[i].shipperPhone
+					}
 				}
-			})
-			this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer', {
-				compId: '',
-				authenticationStatusKey: 7,
+				
+			} else {
+				this.recentCustomers = []
+			}
+
+			this.$api.doRequest('get', '/grainDeliveryRegistration/grainDeliveryRegistrationCustomer', {
+				warehouseName: this.warehouseName
 			}).then(res => {
 				if (res.data.data) {
-					this.customerList = res.data.data
+					let _endTime = Date.parse(new Date());
+					let _startTime = ""
+					for (let i = 0; i < res.data.data.length; i++) {
+						let _carList = res.data.data[i].shippingInformationList
+						for (let k = 0; k < _carList.length; k++) {
+							//判断是记录是否失效
+							_startTime = new Date((res.data.data[i].validityDate + ' 00:00:00')).getTime();
+							if (_endTime - _startTime <= 0) {
+								this.registeredCustomer.push(_carList[k])
+							}
+						}
+					}
+					console.log(this.registeredCustomer)
 				}
 			})
+			// this.$api.doRequest('get', '/searchRecordsInfo/selectSearchRecordsInfo', {
+			// 	pageSize: this.pageSize,
+			// 	currentPage: this.currentPage,
+			// 	functionType: "3",
+			// 	commonId: this.userInfo.id
+			// }).then(res => {
+			// 	if (res.data.data) {
+			// 		this.gridList = res.data.data.records
+			// 		console.log(this.gridList)
+			// 	}
+			// })
+			// this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoCustomer', {
+			// 	compId: uni.getStorageSync('pcUserInfo').compId,
+			// 	authenticationStatusKey: 7,
+			// 	searchKeyWord:''
+			// }).then(res => {
+			// 	if (res.data.data) {debugger
+			// 		this.customerList = res.data.data
+			// 	}
+			// })
 		},
 		methods: {
 			searchinput(e) {
@@ -149,129 +189,161 @@
 				}
 
 			},
+			registeredCustomerClick(item){debugger
+			
+			uni.setStorageSync('checkcustomer', item)
+				if (this.recentCustomers.length == 0) {
+					this.recentCustomers.push(item)
+					uni.setStorageSync('recentCustomers', this.recentCustomers)
+				}else{
+					let _copyList = this.$u.deepClone(this.recentCustomers);
+					for (let i = 0; i < this.recentCustomers.length; i++) {
+						if (this.recentCustomers[i].customerPhone != item.shipperPhone) {
+							_copyList.push(item)
+							uni.setStorageSync('recentCustomers', _copyList)
+						}
+					}
+				}
+			
+				uni.navigateBack()
+			},
 			checkcustomer(item) {
-
 				var that = this
 				var count = ''
 				if (item.authenticationStatus == '已认证') {
-					uni.showLoading({
-						title: '加载中'
-					})
-					that.$api.doRequest('post', '/searchRecordsInfo/api/addInfo', {
-							commonId: that.userInfo.id,
-							searchContent: item.customerName + '(' + item.customerPhone + ')',
-							functionType: 3
-						}).then(res => {
-
-							uni.setStorageSync('checkcustomer', item)
-							that.$api.doRequest('get', '/qualityInspectionManagement/api/settledCount', {
-								compId: '',
-								customerName: item.customerName,
-								goodsName: uni.getStorageSync('goodsName'),
-							}).then(res => {
-								if (res.data.code == 200) {
-									count = res.data.data
-									that.$api.doRequest('get', '/paymentManagement/cumulant', {
-										compId: '',
-										customerName: item.customerName,
-										goodsName: uni.getStorageSync('goodsName'),
-									}).then(res => {
-										for (let i = 0; i < that.purchasePriceList.length; i++) {
-											var data = res.data.data / 1000
-											if (that.purchasePriceList[i].goodsName == uni
-												.getStorageSync('goodsName')) {
-												if (that.purchasePriceList[i].saleLimit - data < 50 ||
-													count > 0) {
-													that.$api.msg(
-														`当前客户已累计销售我司${uni.getStorageSync('goodsName')}${data.toFixed(2)}吨,最高可售${that.purchasePriceList[i].saleLimit}吨。`
-														)
-												}
-											}
-										}
-										that.show = false
-										uni.hideLoading()
-										uni.navigateBack()
-									})
-								}
-							})
-						})
-						.catch(res => {
-							uni.showToast({
-								title: '系统异常,请联系管理员',
-								icon: 'none',
-								duration: 2000
-							})
-							uni.hideLoading()
-						})
-
-
-
+					// uni.showLoading({
+					// 	title: '加载中'
+					// })
+					
+					uni.setStorageSync('checkcustomer', item)
+					if (this.recentCustomers.length == 0) {
+						this.recentCustomers.push(item)
+						uni.setStorageSync('recentCustomers', this.recentCustomers)
+					}else{
+						let _copyList = this.$u.deepClone(this.recentCustomers);
+						for (let i = 0; i < this.recentCustomers.length; i++) {
+							if (this.recentCustomers[i].customerPhone != item.customerPhone) {
+								_copyList.push(item)
+								uni.setStorageSync('recentCustomers', _copyList)
+							}
+						}
+					}
+					// uni.hideLoading()
+					uni.navigateBack()
+					// that.$api.doRequest('post', '/searchRecordsInfo/api/addInfo', {
+					// 		commonId: that.userInfo.id,
+					// 		searchContent: item.customerName + '(' + item.customerPhone + ')',
+					// 		functionType: 3
+					// 	}).then(res => {
+
+					// 		uni.setStorageSync('checkcustomer', item)
+					// 		that.$api.doRequest('get', '/qualityInspectionManagement/api/settledCount', {
+					// 			compId: '',
+					// 			customerName: item.customerName,
+					// 			goodsName: uni.getStorageSync('goodsName'),
+					// 		}).then(res => {
+					// 			if (res.data.code == 200) {
+					// 				count = res.data.data
+					// 				that.$api.doRequest('get', '/paymentManagement/cumulant', {
+					// 					compId: '',
+					// 					customerName: item.customerName,
+					// 					goodsName: uni.getStorageSync('goodsName'),
+					// 				}).then(res => {
+					// 					for (let i = 0; i < that.purchasePriceList.length; i++) {
+					// 						var data = res.data.data / 1000
+					// 						if (that.purchasePriceList[i].goodsName == uni
+					// 							.getStorageSync('goodsName')) {
+					// 							if (that.purchasePriceList[i].saleLimit - data < 50 ||
+					// 								count > 0) {
+					// 								that.$api.msg(
+					// 									`当前客户已累计销售我司${uni.getStorageSync('goodsName')}${data.toFixed(2)}吨,最高可售${that.purchasePriceList[i].saleLimit}吨。`
+					// 									)
+					// 							}
+					// 						}
+					// 					}
+					// 					that.show = false
+					// 					uni.hideLoading()
+					// 					uni.navigateBack()
+					// 				})
+					// 			}
+					// 		})
+					// 	})
+					// 	.catch(res => {
+					// 		uni.showToast({
+					// 			title: '系统异常,请联系管理员',
+					// 			icon: 'none',
+					// 			duration: 2000
+					// 		})
+					// 		uni.hideLoading()
+					// 	})
 				} else {
 					this.$api.msg('客户身份不可用')
 				}
 
 			},
 			recentcustomer(item) {
-				var count = ''
-				var that = this
-				var name = item.searchContent.split('(')[0]
-				var phone = item.searchContent.split('(')[1]
-				phone = phone.substring(0, phone.length - 1)
-				for (var i = 0; i < this.customerList.length; i++) {
-					// console.log(name,this.customerList[i].customerName,name==this.customerList[i].customerName)
-					if (this.customerList[i].customerPhone == phone) {
-						var tmpName = this.customerList[i].customerName
-						uni.setStorageSync('checkcustomer', this.customerList[i])
-						uni.showLoading({
-							title: '加载中'
-						})
-						that.$api.doRequest('post', '/searchRecordsInfo/api/addInfo', {
-								commonId: that.userInfo.id,
-								searchContent: this.customerList[i].customerName + '(' + this.customerList[i]
-									.customerPhone + ')',
-								functionType: 3
-							}).then(res => {
-								that.$api.doRequest('get', '/qualityInspectionManagement/api/settledCount', {
-									compId: '',
-									customerName: tmpName,
-									goodsName: uni.getStorageSync('goodsName'),
-								}).then(res => {
-									if (res.data.code == 200) {
-										count = res.data.data
-										that.$api.doRequest('get', '/paymentManagement/cumulant', {
-											compId: '',
-											customerName: tmpName,
-											goodsName: uni.getStorageSync('goodsName'),
-										}).then(res => {
-											for (let i = 0; i < that.purchasePriceList.length; i++) {
-												if (that.purchasePriceList[i].goodsName == uni
-													.getStorageSync('goodsName')) {
-													var data = res.data.data / 1000
-													if (that.purchasePriceList[i].saleLimit - data <
-														50 || count > 0) {
-														that.$api.msg(
-															`当前客户已累计销售我司${uni.getStorageSync('goodsName')}${data.toFixed(2)}吨,最高可售${that.purchasePriceList[i].saleLimit}吨。`
-															)
-													}
-												}
-											}
-											that.show = false
-											uni.hideLoading()
-											uni.navigateBack()
-										})
-									}
-								})
-							})
-							.catch(res => {
-								uni.showToast({
-									title: '系统异常,请联系管理员',
-									icon: 'none',
-									duration: 2000
-								})
-								uni.hideLoading()
-							})
-					}
-				}
+				uni.setStorageSync('checkcustomer', item)
+				uni.navigateBack()
+				// var count = ''
+				// var that = this
+				// var name = item.searchContent.split('(')[0]
+				// var phone = item.searchContent.split('(')[1]
+				// phone = phone.substring(0, phone.length - 1)
+				// for (var i = 0; i < this.customerList.length; i++) {
+				// 	// console.log(name,this.customerList[i].customerName,name==this.customerList[i].customerName)
+				// 	if (this.customerList[i].customerPhone == phone) {
+				// 		var tmpName = this.customerList[i].customerName
+				// 		uni.setStorageSync('checkcustomer', this.customerList[i])
+				// 		uni.showLoading({
+				// 			title: '加载中'
+				// 		})
+				// 		that.$api.doRequest('post', '/searchRecordsInfo/api/addInfo', {
+				// 				commonId: that.userInfo.id,
+				// 				searchContent: this.customerList[i].customerName + '(' + this.customerList[i]
+				// 					.customerPhone + ')',
+				// 				functionType: 3
+				// 			}).then(res => {
+				// 				that.$api.doRequest('get', '/qualityInspectionManagement/api/settledCount', {
+				// 					compId: '',
+				// 					customerName: tmpName,
+				// 					goodsName: uni.getStorageSync('goodsName'),
+				// 				}).then(res => {
+				// 					if (res.data.code == 200) {
+				// 						count = res.data.data
+				// 						that.$api.doRequest('get', '/paymentManagement/cumulant', {
+				// 							compId: '',
+				// 							customerName: tmpName,
+				// 							goodsName: uni.getStorageSync('goodsName'),
+				// 						}).then(res => {
+				// 							for (let i = 0; i < that.purchasePriceList.length; i++) {
+				// 								if (that.purchasePriceList[i].goodsName == uni
+				// 									.getStorageSync('goodsName')) {
+				// 									var data = res.data.data / 1000
+				// 									if (that.purchasePriceList[i].saleLimit - data <
+				// 										50 || count > 0) {
+				// 										that.$api.msg(
+				// 											`当前客户已累计销售我司${uni.getStorageSync('goodsName')}${data.toFixed(2)}吨,最高可售${that.purchasePriceList[i].saleLimit}吨。`
+				// 											)
+				// 									}
+				// 								}
+				// 							}
+				// 							that.show = false
+				// 							uni.hideLoading()
+				// 							uni.navigateBack()
+				// 						})
+				// 					}
+				// 				})
+				// 			})
+				// 			.catch(res => {
+				// 				uni.showToast({
+				// 					title: '系统异常,请联系管理员',
+				// 					icon: 'none',
+				// 					duration: 2000
+				// 				})
+				// 				uni.hideLoading()
+				// 			})
+				// 	}
+				// }
 			},
 			emptysearch() {
 				this.show = false
@@ -925,15 +997,35 @@
 			border-radius: 30px;
 		}
 	}
-	.content1{
+
+	.content1 {
 		margin-top: 20rpx;
 		padding: 20rpx 0;
-		.row{
+
+		.row {
 			display: flex;
-			padding:20rpx 30rpx;
-			.row-item{
+			padding: 20rpx 30rpx;
+
+			.row-item {
 				margin-right: 20rpx;
 			}
 		}
 	}
+
+	.dj-customer {
+		background: #F5F6F9;
+		display: flex;
+		width: 60%;
+		justify-content: space-between;
+		align-items: center;
+		margin: 20rpx;
+		border-radius: 30rpx;
+		padding: 10rpx 20rpx;
+
+		.right {
+			display: flex;
+		}
+
+		;
+	}
 </style>

+ 0 - 1
pages/user/depotAcquisition/grainDeliveryRegistration.vue

@@ -227,7 +227,6 @@
 					}
 					this.$api.doRequest('post', '/grainDeliveryRegistration/api/insertInfo', _dataList).then(res => {
 						if (res.data.code == 200) {
-							debugger
 							this.$api.msg('添加成功!')
 							setTimeout(function() {
 								uni.navigateBack()