Browse Source

修改质检客户回显问题

wangchao 3 years ago
parent
commit
822fe40838

+ 33 - 29
pages/erpbusiness/customer.vue

@@ -32,14 +32,15 @@
 			<view style='padding-left:20px;color:#AFB3BF;font-size:14px;' v-if='show==false'>登记客户</view>
 
 			<!-- <view v-for='item in registeredCustomer'> -->
-				<view class="dj-customer" v-for="(item,index) in registeredCustomer" @click="registeredCustomerClick(item,item1)">
-					<view class="left">{{item.carNo}}</view>
-					<view class="right">
-						<view class="span1">{{item.shipperName}}(货)</view>
-						<view class="">{{item.supplier}}(商)</view>
-					</view>
-
+			<view class="dj-customer" v-for="(item,index) in registeredCustomer"
+				@click="registeredCustomerClick(item,item1)">
+				<view class="left">{{item.carNo}}</view>
+				<view class="right">
+					<view class="span1">{{item.shipperName}}(货)</view>
+					<view class="">{{item.supplier}}(商)</view>
 				</view>
+
+			</view>
 			<!-- </view> -->
 		</view>
 
@@ -128,32 +129,32 @@
 		},
 		onShow() {
 			this.purchasePriceList = uni.getStorageSync('purchasePriceList')
-				let _data = uni.getStorageSync('recentCustomers')
+			let _data = uni.getStorageSync('recentCustomers')
 			if (_data) {
-				this.recentCustomers =_data
-				for(let i=0;i<_data.length;i++){
-					if(_data[i].shipperName){
+				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
 					}
 				}
-				
+
 			} else {
 				this.recentCustomers = []
 			}
 
 			this.$api.doRequest('get', '/shippingInformation/selectShippingInformation', {
 				warehouseName: this.warehouseName,
-				compId:  uni.getStorageSync('pcUserInfo').compId,
+				compId: uni.getStorageSync('pcUserInfo').compId,
 			}).then(res => {
 				if (res.data.data) {
 					let _endTime = Date.parse(new Date());
 					let _startTime = ""
 					for (let i = 0; i < res.data.data.length; i++) {
-							_startTime = new Date((res.data.data[i].validityDate + ' 00:00:00')).getTime();
-								if (_endTime - _startTime <= 0) {
-										this.registeredCustomer.push(res.data.data[i])
-								}
+						_startTime = new Date((res.data.data[i].validityDate + ' 00:00:00')).getTime();
+						if (_endTime - _startTime <= 0) {
+							this.registeredCustomer.push(res.data.data[i])
+						}
 						// let _carList = res.data.data[i].shippingInformationList
 						// for (let k = 0; k < _carList.length; k++) {
 						// 	//判断是记录是否失效
@@ -197,13 +198,14 @@
 				}
 
 			},
-			registeredCustomerClick(item,item1){
-			uni.setStorageSync('carNo', item1)
-			uni.setStorageSync('checkcustomer', item)
+			registeredCustomerClick(item, item1) {
+				uni.setStorageSync('isClick', true)
+				uni.setStorageSync('carNo', item1)
+				uni.setStorageSync('checkcustomer', item)
 				if (this.recentCustomers.length == 0) {
 					this.recentCustomers.push(item)
 					uni.setStorageSync('recentCustomers', this.recentCustomers)
-				}else{
+				} else {
 					let _copyList = this.$u.deepClone(this.recentCustomers);
 					for (let i = 0; i < this.recentCustomers.length; i++) {
 						if (this.recentCustomers[i].customerPhone != item.shipperPhone) {
@@ -212,29 +214,30 @@
 						}
 					}
 				}
-			
+
 				uni.navigateBack()
 			},
 			checkcustomer(item) {
+				uni.setStorageSync('isClick', true)
 				var that = this
 				var count = ''
 				if (item.authenticationStatus == '已认证') {
 					// uni.showLoading({
 					// 	title: '加载中'
 					// })
-					
+
 					uni.setStorageSync('checkcustomer', item)
 					if (this.recentCustomers.length == 0) {
 						this.recentCustomers.push(item)
 						uni.setStorageSync('recentCustomers', this.recentCustomers)
-					}else{
+					} else {
 						let _isDel = false
 						for (let i = 0; i < this.recentCustomers.length; i++) {
 							if (this.recentCustomers[i].customerPhone == item.customerPhone) {
-										_isDel = true
+								_isDel = true
 							}
 						}
-						if(!_isDel){
+						if (!_isDel) {
 							let _data = uni.getStorageSync('recentCustomers')
 							_data.push(item)
 							uni.setStorageSync('recentCustomers', _data)
@@ -370,7 +373,7 @@
 				this.currentPage = 1
 				uni.showLoading({
 					title: '正在加载',
-					mask:true
+					mask: true
 				})
 				this.getList()
 			},
@@ -396,7 +399,7 @@
 				}
 				this.$api.doRequest('get', url, data).then(res => {
 					if (res.data.data) {
-							uni.hideLoading()
+						uni.hideLoading()
 						let data = res.data.data.records ? res.data.data.records : res.data.data
 						//采购信息
 						if (data.length > 0) {
@@ -1041,7 +1044,8 @@
 
 		.right {
 			display: flex;
-			.span1{
+
+			.span1 {
 				margin-right: 20rpx;
 			}
 		}

+ 31 - 25
pages/erpbusiness/edit_quality_testing.vue

@@ -17,7 +17,7 @@
 			<view class="c-row ">
 				<view class="title">客户</view>
 				<view class="con-list">
-					<view  @click='gocustomer'>
+					<view @click='gocustomer'>
 						{{gridList.customerName}}({{gridList.customerPhone}})
 					</view>
 				</view>
@@ -361,28 +361,30 @@
 			this.gridList.gradeKey = this.gradeList[0].key
 		},
 		onShow() {
-			if (uni.getStorageSync('checkcustomer')) {
-			
+			let _kh = uni.getStorageSync('isClick')
+			if (uni.getStorageSync('checkcustomer') && _kh) {
+
 				let _customerInfo = uni.getStorageSync('checkcustomer')
 				if (_customerInfo.shipperName) {
 					this.gridList.identityId = _customerInfo.id
 					//点击登记客户
 					this.gridList.customerName = _customerInfo.shipperName
 					this.gridList.customerPhone = _customerInfo.shipperPhone
-					this.gridList.carNumber=_customerInfo.carNo
+					this.gridList.carNumber = _customerInfo.carNo
 				} else {
 					//点击搜索客户
 					this.gridList.customerName = _customerInfo.customerName
 					this.gridList.customerPhone = _customerInfo.customerPhone
 				}
-			
+
 				this.gridList.customerNumberCard = _customerInfo.customerNumberCard
 			}
 		},
 		methods: {
 			gocustomer() {
 				uni.navigateTo({
-					url: '/pages/erpbusiness/customer?cangid=' + this.cangid + '&warehouseName=' + this.gridList.warehouseName + '&goodsName=' + this.gridList.goodsName+'&status=edit'
+					url: '/pages/erpbusiness/customer?cangid=' + this.cangid + '&warehouseName=' + this.gridList
+						.warehouseName + '&goodsName=' + this.gridList.goodsName + '&status=edit'
 				})
 			},
 			print() {
@@ -444,28 +446,32 @@
 			},
 			alertBtn() {
 				var that = this
-				that.gridList.reWaterContent=that.gridList.waterContent
-				if(that.gridList.buckleMiscellaneous){
-					that.gridList.reBuckleMiscellaneous=that.gridList.buckleMiscellaneous
+				that.gridList.reWaterContent = that.gridList.waterContent
+				if (that.gridList.buckleMiscellaneous) {
+					that.gridList.reBuckleMiscellaneous = that.gridList.buckleMiscellaneous
 				}
 				that.gridList.flag = 1
-				this.$api.doRequest('post', '/qualityInspectionManagement/api/editQualityInspection',that.gridList).then(res => {
-					if(res.data.code=="200"){
-						that.$api.doRequest('post', '/qualityInspectionManagement/api/editQualityInspection', {id:that.gridList.id,flag:2}).then(res => {
-							if(res.data.code=="200"){
-								that.$api.msg('提交成功!')
-								setTimeout(function(){
+				this.$api.doRequest('post', '/qualityInspectionManagement/api/editQualityInspection', that.gridList).then(
+					res => {
+						if (res.data.code == "200") {
+							that.$api.doRequest('post', '/qualityInspectionManagement/api/editQualityInspection', {
+								id: that.gridList.id,
+								flag: 2
+							}).then(res => {
+								if (res.data.code == "200") {
+									that.$api.msg('提交成功!')
+									setTimeout(function() {
 										uni.navigateBack({})
-								},1000)
-							}else{
-								that.$api.msg('提交失败')
-							}
-						})			
-						
-					}else{
-						that.$api.msg('提交失败')
-					}
-				})
+									}, 1000)
+								} else {
+									that.$api.msg('提交失败')
+								}
+							})
+
+						} else {
+							that.$api.msg('提交失败')
+						}
+					})
 			},
 			waterContentChange() {
 				var that = this

+ 1 - 0
pages/erpbusiness/quality_testing.vue

@@ -221,6 +221,7 @@
 			this.managementType = options.managementType
 		},
 		onShow() {
+			uni.setStorageSync('isClick', false)
 			uni.showLoading({
 				title: "正在加载"
 			})