lilei 2 лет назад
Родитель
Сommit
1ccbe940c6

+ 48 - 103
pages/sales/addSales.vue

@@ -6,7 +6,7 @@
 				<u-button size="mini" :hair-line="false" plain type="primary" hover-class="none" @click="goBack" :custom-style="customBtnStyle">重新选择</u-button>
 			</view>
 		</view>
-		<view class="flex_1 content-box">
+		<view class="content-box">
 			<view class="content-form">
 				<u-form :model="form" ref="uForm"  label-width="180" :error-type="['toast']">
 					<u-form-item label="客户地址" required >
@@ -55,16 +55,14 @@
 					</u-form-item>
 				</u-form>
 			</view>
-			<view class="form-footer-btn">
-				<u-button class="handle-btn" size="medium" shape="circle" hover-class="none" @click="handleSaveCust" :custom-style="customBtnStyle">新增销售单</u-button>
-			</view>
+		</view>
+		<view class="form-footer-btn">
+			<u-button class="handle-btn" size="medium" shape="circle" hover-class="none" @click="handleSaveCust" :custom-style="customBtnStyle">新增销售单</u-button>
 		</view>
 		<!-- 省市区 -->
 		<Address ref="applyAddress" :isJrMini="false" @onConfirm="areaConfirm"></Address>
 		<!-- 选择收款方式 -->
 		<u-picker v-model="showSettle" title="收款方式"  @confirm="settleStyleChange" :range="settleTypeList" range-key="name" mode="selector" :default-selector="JSON.parse(JSON.stringify(defaultSettleIndex))"></u-picker>
-		<!-- 客户类型 -->
-		<u-picker v-model="showCust" title="客户类型" @confirm="custTypeChange" :range="custTypeList" range-key="name" mode="selector" :default-selector="JSON.parse(JSON.stringify(defaultCustIndex))"></u-picker>
 		<!-- 业务员 -->
 		<u-picker v-model="showUser" title="业务员" @confirm="userChange" :range="userList" range-key="name" mode="selector"></u-picker>
 	</view>
@@ -72,7 +70,7 @@
 
 <script>
 	import {settleStyleQueryAll,salesSave} from '@/api/sales.js'
-	import {customerDetail,custType,employeeAllList,updateByCustomerSn} from '@/api/customer.js'
+	import {customerDetail,employeeAllList,updateByCustomerSn} from '@/api/customer.js'
 	import Address from '@/components/address.vue'
 	import vSelect  from  '@/components/select/v-select.vue'
 	export default{
@@ -89,9 +87,6 @@
 				showSettle:false,//结算方式初始值
 				settleTypeList:[],//收款方式列表
 				settleStyleName:'',//收款方式名称
-				custTypeList:[] ,// 客户类型数据
-				showCust:false, //客户类型下拉弹窗初始值
-				custTypeName:'', // 客户类型名称
 				areaInfo: {},  //  省市区
 				areaIdArr: [],  //  省市区id数组
 				itemId:'',
@@ -140,43 +135,19 @@
 		},
 		onLoad(option) {
 			console.log(option.nowId,'option')
-			if(option.nowId){
-				// if(option.pageType=='edit'){
-				// 	uni.setNavigationBarTitle({
-				// 	  title:'编辑销售单'
-				// 	})
-				// }else{
-				// 	uni.setNavigationBarTitle({
-				// 	  title:'新增销售单'
-				// 	})
-				// }
-				this.itemId=option.nowId
-				this.getCustomerData(this.itemId)
-				this.getUserAllList()
-				setTimeout(()=>{
-					// 回显收款方式并下拉数据默认高亮选中
-					const ind=this.settleTypeList.findIndex((item)=>{
-						return item.settleStyleSn==this.customerData.settleStyleSn
-					})
-					console.log(ind,'ind')
-					this.settleStyleName=this.settleTypeList[ind].name
-					this.defaultSettleIndex=[ind]
-					// 回显业务员并下拉数据默认高亮选中
-					if(this.customerData.salesManSn){
-						const userInd=this.userList.findIndex((item)=>{
-							return item.customerSn==this.customerData.salesManSn
-						})
-						this.defaultUserIndex=[userInd]
-						this.form.salesManName=this.userList[userInd].name
-						this.form.salesManSn=this.userList[userInd].salesManSn
-					}
-					console.log(ind,'a',JSON.parse(JSON.stringify(this.defaultSettleIndex)) )
-				},200)
-			}
-			this.getSettleStyle()
-			this.getCustomerList()
+			this.itemId=option.nowId
+			this.pageInit()
 		},
 		methods:{
+			async pageInit(){
+				const a = await employeeAllList({}) // 获取业务员列表数据
+				const b = await settleStyleQueryAll({}) // 获取结算方式列表
+				this.userList = a.status == 200 ? a.data : []
+				this.settleTypeList = b.status == 200 ? b.data : []
+				if(this.itemId){
+				  this.getCustomerData(this.itemId)
+				}
+			},
 			getCustomerData(val){
 				uni.showLoading({title:'加载中...',mask:true})
 				customerDetail({id:val}).then(res=>{
@@ -205,7 +176,7 @@
 						  priceType: this.customerData.priceType, //  价格类型
 						  settleStyleSn: this.customerData.settleStyleSn //  收款方式
 						})
-						if(this.customerData.priceType || this.customerData.dispatchType){
+						if(this.customerData.priceType){
 							setTimeout(()=>{
 								this.$refs.priceType.setVal(this.customerData.priceType)
 							},200)
@@ -216,6 +187,25 @@
 							},200)
 						}
 						this.form=Object.assign(this.form,res.data)
+						
+						// 回显收款方式并下拉数据默认高亮选中
+						const ind=this.settleTypeList.findIndex((item)=>{
+							return item.settleStyleSn==this.customerData.settleStyleSn
+						})
+						if(ind){
+							this.settleStyleName=this.settleTypeList[ind].name
+							this.defaultSettleIndex=[ind]
+						}
+						// 回显业务员并下拉数据默认高亮选中
+						if(this.customerData.salesManSn){
+							const userInd=this.userList.findIndex((item)=>{
+								return item.customerSn==this.customerData.salesManSn
+							})
+							this.defaultUserIndex=[userInd]
+							this.form.salesManName=this.userList[userInd].name
+							this.form.salesManSn=this.userList[userInd].salesManSn
+						}
+						
 					}else{
 						this.customerData=null
 					}
@@ -249,11 +239,9 @@
 			},
 			// 重新选择
 			goBack(){
-				uni.$emit('clear')
-				setTimeout(()=>{
-					uni.navigateBack({})
-				},500)
-				
+				uni.redirectTo({
+					url: '/pages/sales/chooseCustomer?backPage=addSales'
+				})
 			},
 			radioChange(e) {
 				console.log(e);
@@ -285,49 +273,12 @@
 				// console.log(this.areaIdArr,'this.areaIdArr')
 				this.$refs.applyAddress.open(this.areaIdArr)
 			},
-			// 获取业务员列表数据
-			getUserAllList () {
-			  employeeAllList({}).then(res => {
-			    if (res.status == 200) {
-			      this.userList = res.data || []
-			    } else {
-			      this.userList = []
-			    }
-			  })
-			},
-			// 获取客户类型列表
-			getCustomerList(){
-				custType({}).then(res=>{
-					if(res.status==200){
-						this.custTypeList=res.data
-					}else{
-						this.custTypeList=[]
-					}
-				})
-			},
-			// 获取结算方式列表
-			getSettleStyle(){
-				settleStyleQueryAll({}).then(res=>{
-					if(res.status==200){
-						this.settleTypeList=res.data
-					}else{
-						this.settleTypeList=null
-					}
-				})
-			},
 			// 收款方式change
 			settleStyleChange(e){
-				console.log(e,'data')
 				this.defaultSettleIndex=[e]
 				this.settleStyleName=this.settleTypeList[e].name
 				this.form.settleStyleSn=this.settleTypeList[e].settleStyleSn
 			},
-			// 客户类型change
-			custTypeChange(e){
-				this.defaultCustIndex=[e]
-				this.custTypeName=this.custTypeList[e].name
-				this.form.customerTypeSn=this.custTypeList[e].customerTypeSn
-			},
 			// 业务员change
 			userChange(e){
 				this.defaultUserIndex=[e]
@@ -388,7 +339,7 @@
 							salesManName: '',
 							distributionFlag: this.form.distributionFlag, // 铺货出库
 							salesTragetType: 'CUSTOMER',
-							remarks: this.remarks //  备注
+							remarks: this.form.remarks //  备注
 						}
 						console.log(params,'params')
 						salesSave(params).then(res=>{
@@ -397,8 +348,9 @@
 									title: res.message,
 									icon: 'none'
 								})
+								uni.$emit("refreshSalesHomeBL")
 								setTimeout(()=>{
-									uni.navigateTo({
+									uni.redirectTo({
 										url:'/pages/sales/edit?pageType=edit&data='+JSON.stringify(res.data)
 									})
 								},300)
@@ -414,19 +366,18 @@
 </script>
 
 <style lang="scss">
+	page{
+		height: 100vh;
+	}
 	.addCustomer-content{
 		width: 100%;
 		height: 100vh;
-		// background-color: #fff;
-		
 		display: flex;
 		flex-direction: column;
 		.content-customerName{
 			width: 100%;
 			.customerName{
-				// position: fixed;
 				width: 100%;
-				// z-index: 999;
 				color: #000000;
 				font-size: 30upx;
 				font-weight: 1000;
@@ -435,14 +386,12 @@
 			}
 		}
 		.content-box{
-			display: flex;
-			flex-direction: column;
-			// margin-top: 100upx;
 			padding:0 40upx;
 			background-color: #fff;
+			flex-grow: 1;
+			overflow: auto;
 		}
 		.content-form{
-			flex: 1;
 			.receiveAddress{
 				width: 100%;
 				line-height: 1.5em;
@@ -456,12 +405,8 @@
 		}
 		.form-footer-btn{
 			background-color: #fff;
-			position: fixed;
-			bottom: 0;
-			left: 0;
 			width: 100%;
-			padding:0 30upx ;
-			z-index: 999;
+			padding:8px 30upx ;
 			.handle-btn{
 				width: 100%;
 				background-color: rgb(51, 95, 182);

+ 2 - 2
pages/sales/chooseCustomer.vue

@@ -123,11 +123,11 @@
 				this.listData = []
 			},
 			chooseItem(item){
-				console.log(item)
+				console.log(item,this.backPage)
 				this.queryWord=item.customerName
 				// 新增销售单
 				if(this.backPage == 'addSales'){
-					uni.navigateTo({
+					uni.redirectTo({
 						url:'/pages/sales/addSales?pageType=edit&nowId='+item.id
 					})
 				}

+ 1 - 1
pages/sales/chooseProduct.vue

@@ -124,7 +124,7 @@
 			uni.getSystemInfo({
 				success: function (res) {
 					const winH = res.windowHeight * 2
-					_this.scrollH = winH - 180
+					_this.scrollH = winH - 120
 				}
 			})
 		},

+ 6 - 6
pages/sales/edit.vue

@@ -89,13 +89,13 @@
 			</view>
 		</view>
 		<!-- 操作按钮 -->
-		<!-- <view class="sales-btn-box" v-if="detailData&&detailData.billStatus!='FINISH'">
+		<view class="sales-btn-box" v-if="detailData&&detailData.billStatus!='FINISH'">
 			<view v-if="pageData.type=='edit'" class="flex align_center justify_between">
 				<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleDel()">整单删除</u-button>
 				<u-button class="handle-btn search-btn" shape="circle" @click="handleSubmit" size="medium" hover-class="none" :custom-style="customBtnStyle">提交</u-button>
 			</view>
 			<u-button v-if="pageData.type=='detail' && (detailData&&detailData.billStatus !== 'CANCEL' && detailData.billStatus !== 'FINISH' && detailData.billStatus != 'WAIT_OUT_WAREHOUSE')" class="edit-btn" shape="circle" @click="goPage" size="medium" hover-class="none" :custom-style="customBtnStyle">编辑</u-button>
-		</view> -->
+		</view>
 		<!-- 基础信息 -->
 		<orderInfoModal :openModal="infoModal" :infoData="detailData" @close="infoModal=false" />
 		<!-- 折扣 -->
@@ -375,13 +375,13 @@
 						const winH = res.windowHeight * 2
 						let totalH = _this.$refs.salesTotal && _this.$refs.salesTotal.$el && _this.$refs.salesTotal.$el.offsetHeight || 0
 						if(_this.toggle){
-							_this.scrollH = winH - 656 - totalH
+							_this.scrollH = winH - 605 - totalH
 						}else{
-							_this.scrollH = winH - 522 - totalH
+							_this.scrollH = winH - 468 - totalH
 						}
-						// if(_this.detailData&&_this.detailData.billStatus=='FINISH'){
+						if(_this.detailData&&_this.detailData.billStatus=='FINISH'){
 							_this.scrollH = _this.scrollH + 100
-						// }
+						}
 					}
 				})
 			}

+ 2 - 2
pages/sales/index.vue

@@ -27,10 +27,10 @@
 					<u-image class="nav-pic" style="margin-top: 5upx;" :src="`../../static/${theme}/navIcon/price_icon.png`" width="60" height="60"></u-image>
 					<text class="nav-txt" style="margin-top: 5upx;">产品报价</text>
 				</view>
-				<!-- <view class="nav-item" @click="toPage('/pages/sales/chooseCustomer')">
+				<view class="nav-item" @click="toPage('/pages/sales/chooseCustomer?backPage=addSales')">
 					<u-image class="nav-pic" :src="`../../static/${theme}/navIcon/sale_icon.png`" width="70" height="70"></u-image>
 					<text class="nav-txt">新增销售单</text>
-				</view> -->
+				</view>
 				<view class="nav-item" @click="toPage('/pages/webviews/openview?title=产品查询&url=https://jgqp.51cjml.com/h5/#!/')" v-if="$hasPermissions('M_queryProduct_mobile')">
 					<u-image class="nav-pic" :src="`../../static/${theme}/navIcon/pfind.png`" width="64" height="64"></u-image>
 					<text class="nav-txt">产品查询</text>