zhangdan 3 lat temu
rodzic
commit
c8dbbee877

+ 55 - 0
api/customer.js

@@ -0,0 +1,55 @@
+import axios from '@/libs/axios.js'
+
+// 客户列表
+export const customerList = (params) => {
+	const url=`cust/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
+}
+
+// 新增客户
+export const custSave = (params) => {
+  return axios.request({
+    url: 'cust/save',
+    data: params,
+    method: 'post'
+  })
+} 
+// 根据sn修改客户信息
+export const updateByCustomerSn = params => {
+  return axios.request({
+    url: 'cust/updateByCustomerSn',
+    data: params,
+    method: 'post'
+  })
+}
+ // 客户详情
+export const customerDetail = params => {
+  return axios.request({
+    url: `cust/findById/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}

+// 客户类型
+export const custType = (params) => {
+  return axios.request({
+    url: 'custType/findAll',
+    data: params,
+    method: 'post'
+  })
+} 
+
+// 业务员
+export const employeeAllList = (params) => {
+  return axios.request({
+    url: 'employee/queryList',
+    data: {},
+    method: 'post'
+  })
+}

+ 0 - 45
api/sales.js

@@ -142,48 +142,3 @@ export const settleStyleQueryAll = (params) => {
   })
 }
 
-// 客户列表
-export const customerList = (params) => {
-	const url=`cust/queryPage/${params.pageNo}/${params.pageSize}`
-	delete params.pageNo
-	delete params.pageSize
-	return axios.request({
-		url: url,
-		data: params,
-		method: 'post'
-	})
-}
-
-// 新增客户
-export const custSave = (params) => {
-  return axios.request({
-    url: 'cust/save',
-    data: params,
-    method: 'post'
-  })
-} 
- // 客户详情
-export const customerDetail = params => {
-  return axios.request({
-    url: `cust/findById/${params.id}`,
-    data: {},
-    method: 'get'
-  })
-}

-// 客户类型
-export const custType = (params) => {
-  return axios.request({
-    url: 'custType/findAll',
-    data: params,
-    method: 'post'
-  })
-} 
-
-// h业务员
-export const employeeAllList = (params) => {
-  return axios.request({
-    url: 'employee/queryList',
-    data: {},
-    method: 'post'
-  })
-}

+ 1 - 0
components/select/v-select.vue

@@ -2,6 +2,7 @@
 	<picker @change="toChange" :value="index" :range="datalist" range-key="dispName">
 		<view style="display: flex;align-items: center;">
 			<input class="form-input" :disabled="disabled" style="width: 100%;" v-model="selected" placeholder-style="color:#C0C4CC" :placeholder="getPlaceholderText" />
+			<u-icon name="arrow-right" color="#C0C4CC" ></u-icon>
 		</view>
 	</picker>
 </template>

+ 15 - 3
pages/common/customerSearch.vue

@@ -23,7 +23,7 @@
 </template>
 
 <script>
-	import {customerList} from '@/api/sales.js'
+	import {customerList} from '@/api/customer.js'
 	export default{
 		data(){
 			return{
@@ -34,6 +34,14 @@
 				isShow:true
 			}
 		},
+		onLoad() {
+			this.queryWord=''
+			this.listData=[]
+		},
+		onShow() {
+			this.queryWord=''
+			this.listData=[]
+		},
 		methods:{
 			getData(){
 				customerList({queryWord:this.queryWord,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
@@ -53,7 +61,7 @@
 			clearSearch(){
 				this.queryWord = ''
 				this.listData = []
-				this.getData()
+				// this.getData()
 			},
 			chooseItem(val){
 				console.log(val)
@@ -62,7 +70,7 @@
 				// 	url:'/pages/sales/addSales'
 				// })
 				uni.navigateTo({
-					url:'/pages/sales/addSales?nowId='+this.listData[val].id
+					url:'/pages/sales/addSales?pageType=edit&nowId='+this.listData[val].id
 				})
 				
 			}
@@ -73,8 +81,12 @@
 <style lang="scss">
 	.search-box{
 		width: 100%;
+		display: flex;
+		flex-direction: column;
+		// flex: 1;
 		.picker-content{
 			padding: 6upx 0 20upx;
+			flex: 1;
 			.picker-main{
 				width: 100%;
 				.picker-main-item{

+ 5 - 62
pages/sales/addCustomer.vue

@@ -35,7 +35,7 @@
 				</u-form-item>
 				<u-form-item label="配送方式" >
 					<v-select ref="dispatchType" :disabled="true" placeholder="请选择配送方式" @itemChange="choosedispatchType" code="DISPATCH_TYPE" style="width: 100%"></v-select>
-					<u-icon name="arrow-right" color="#C0C4CC" slot="right" @click="chooseType"></u-icon>
+					<u-icon name="arrow-right" color="#C0C4CC" slot="right"></u-icon>
 				</u-form-item>
 			</u-form>
 		</view>
@@ -52,8 +52,8 @@
 </template>
 
 <script>
-	import {customerDetail,settleStyleQueryAll,custType,custSave,employeeAllList,salesSave} from '@/api/sales.js'
-	import { getLookUpDatas } from '@/api/data'
+	import {settleStyleQueryAll} from '@/api/sales.js'
+	import {customerDetail,custType,custSave,employeeAllList} from '@/api/customer.js'
 	import Address from '@/components/address.vue'
 	import vSelect  from  '@/components/select/v-select.vue'
 	export default{
@@ -61,7 +61,6 @@
 		data(){
 			return{
 				customerData:null, // 客户信息
-				priceTypeName:'', //客户类型名称
 				customBtnStyle: {  //  自定义按钮样式
 					margin:0
 				},
@@ -86,10 +85,6 @@
 					priceType: '', //  价格类型
 					settleStyleSn: undefined //  收款方式
 				},
-				distributionFlag:0, //铺货出库
-				showDispatch:false,// 配送方式下拉弹窗初始值
-				dispatchTypeList:[], // 配送方式列表
-				dispatchTypeName:'', // 配送方式名称
 				showSettle:false,//结算方式初始值
 				settleTypeList:[],//收款方式列表
 				settleStyleName:'',//收款方式名称
@@ -98,66 +93,19 @@
 				custTypeName:'', // 客户类型名称
 				areaInfo: {},  //  省市区
 				areaIdArr: [],  //  省市区id数组
-				itemId:'',
-				ckList:[{dispName: "是",code:1,lookupCode: "FLAG"},{dispName: "否",code:0,lookupCode: "FLAG"}],
-				showUser:false,//业务员下拉框初始默认值
 				defaultSettleIndex:[0] ,//选中收款方式的下标
-				defaultIndex:[0] ,//选中收款方式的下标
 				defaultCustIndex:[0],//选中客户类型的下标
-				defaultUserIndex:[0],//选中业务员的下标
 			}
 		},
 		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
 		onReady() {
 			this.$refs.uForm.setRules(this.rules);
 		},
-		onUnload() {
-			this.$u.vuex("vuex_OrderAddress",{})
-		},
 		onLoad(option) {
-			console.log(option.nowId,'option')
 			this.getSettleStyle()
 			this.getCustomerList()
 		},
 		methods:{
-			getCodeList(code){
-				getLookUpDatas({type:code}).then(res=>{
-					if(res.status==200){
-						this.dispatchTypeList=res.data
-						this.showDispatch=true
-					}
-				})
-			},
-			// getCustomerData(val){
-			// 	customerDetail({id:val}).then(res=>{
-			// 		if(res.status==200){
-			// 			this.customerData=res.data
-			// 			if(this.customerData.priceType || this.customerData.dispatchType){
-			// 				setTimeout(()=>{
-			// 					this.$refs.priceType.setVal(this.customerData.priceType)
-			// 					this.$refs.dispatchType.setVal(this.customerData.dispatchType)
-			// 				},200)
-							
-			// 			}
-			// 			this.form=Object.assign(this.form,res.data)
-			// 		}else{
-			// 			this.customerData=null
-			// 		}
-			// 	})
-			// },
-			getCodeByName (dispName) {
-			  return this.dispatchTypeList.find((item) => {
-			    return item.dispName == dispName
-			  })
-			},
-			// 重新选择
-			goBack(){
-				uni.navigateBack({})
-			},
-			radioChange(e) {
-				console.log(e);
-				this.distributionFlag=e
-			},
 			// 选择价格类型
 			chooseType(val){
 				console.log(val,'vai')
@@ -215,16 +163,12 @@
 				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
 			},
-			userChange(e){
-				this.defaultUserIndex=[e]
-				this.custTypeName=this.custTypeList[e].name
-				this.form.customerTypeSn=this.custTypeList[e].customerTypeSn
-			},
 			// 保存 (新增客户)
 			customerSubmit(){
 				console.log('保存===========')
@@ -268,10 +212,9 @@
 									title: res.message,
 									icon: 'none'
 								})
-								// uni.$emit('setFun',res.data)
 								setTimeout(()=>{
 									uni.navigateTo({
-										url:'/pages/sales/addSales?nowId='+res.data.id
+										url:'/pages/sales/addSales?pageType=add&nowId='+res.data.id
 									})
 								},300)
 							} 

+ 63 - 195
pages/sales/addSales.vue

@@ -23,7 +23,6 @@
 				</u-form-item>
 				<u-form-item label="价格类型" required >
 					<v-select ref="priceType" :disabled="true" placeholder="请选择价格类型" @itemChange="chooseType" code="PRICE_TYPE" style="width: 100%"></v-select>
-					<u-icon name="arrow-right" color="#C0C4CC" slot="right"></u-icon>
 				</u-form-item>
 				<u-form-item label="收款方式" required prop="settleStyleSn">
 					<u-input v-model="settleStyleName" input-align="right" :disabled="true" placeholder="请选择收款方式" @click="showSettle=true"/>
@@ -43,7 +42,6 @@
 				</u-form-item>
 				<u-form-item label="配送方式" >
 					<v-select ref="dispatchType" :disabled="true" placeholder="请选择配送方式" @itemChange="choosedispatchType" code="DISPATCH_TYPE" style="width: 100%"></v-select>
-					<u-icon name="arrow-right" color="#C0C4CC" slot="right" @click="chooseType(0)"></u-icon>
 				</u-form-item>
 				<u-form-item label="业务员">
 					<u-input v-model="userName" input-align="right" :disabled="true" placeholder="请选择业务员"  @click="showUser=true"/>
@@ -55,8 +53,7 @@
 			</u-form>
 		</view>
 		<view class="form-footer-btn">
-			<u-button v-if="!itemId" class="handle-btn" size="medium" shape="circle" hover-class="none" @click="customerSubmit" :custom-style="customBtnStyle">保存</u-button>
-			<u-button v-else class="handle-btn" size="medium" shape="circle" hover-class="none" @click="salesSbmit" :custom-style="customBtnStyle">新增销售单</u-button>
+			<u-button class="handle-btn" size="medium" shape="circle" hover-class="none" @click="handleSaveCust" :custom-style="customBtnStyle">保存</u-button>
 		</view>
 		<!-- 省市区 -->
 		<Address ref="applyAddress" @onConfirm="areaConfirm"></Address>
@@ -70,9 +67,8 @@
 </template>
 
 <script>
-	import {customerDetail,settleStyleQueryAll,custType,custSave,employeeAllList,salesSave} from '@/api/sales.js'
-	import { getLookUpDatas } from '@/api/data'
-	import { getArea } from '@/api/data'
+	import {settleStyleQueryAll,salesSave} from '@/api/sales.js'
+	import {customerDetail,custType,employeeAllList,updateByCustomerSn} from '@/api/customer.js'
 	import Address from '@/components/address.vue'
 	import vSelect  from  '@/components/select/v-select.vue'
 	export default{
@@ -86,8 +82,6 @@
 					margin:0
 				},
 				showDispatch:false,// 配送方式下拉弹窗初始值
-				dispatchTypeList:[], // 配送方式列表
-				dispatchTypeName:'', // 配送方式名称
 				showSettle:false,//结算方式初始值
 				settleTypeList:[],//收款方式列表
 				settleStyleName:'',//收款方式名称
@@ -141,80 +135,50 @@
 			this.$refs.uForm.setRules(this.rules);
 		},
 		onLoad(option) {
-			// uni.$on('setFun',this.setFun)
 			console.log(option.nowId,'option')
-			// this.form = this.$store.state.vuex_OrderAddress
-			// this.areaIdArr = this.form.receiveAreas.split(',')
-			// this.areaInfo.label = this.form.receiveAreasName.replace(/\,/g,'-')
 			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.customerSn){
-					// 	const settleInd=this.custTypeList.findIndex((item)=>{
-					// 		return item.customerSn==this.customerData.customerSn
-					// 	})
-					// 	this.custTypeName=this.custTypeList[settleInd].name
-					// 	this.defaultCustIndex=[settleInd]
-					// }
+					// 回显业务员并下拉数据默认高亮选中
+					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()
 		},
-		onUnload() {
-			this.$u.vuex("vuex_OrderAddress",{})
-			// uni.$off('setFun',this.setFun)
-		},
 		methods:{
-			// 新增完客户将客户数据传过来
-			// setFun(data){
-			// 	console.log(data,'========页面传参')
-			// 	// if(data){
-			// 	// 	this.form = Object.assign(this.form, {
-			// 	// 	  buyerName: data.customerName, // 客户名称
-			// 	// 	  buyerSn: data.customerSn, // 客户sn
-			// 	// 	  consigneeTel: data.contactTel, //  联系电话
-			// 	// 	  contactMobile: data.contactMobile,
-			// 	// 	  consigneeName: data.contactName, //  联系人
-			// 	// 	  shippingAddressProvinceSn: data.provinceSn, //  省
-			// 	// 	  shippingAddressProvinceName: data.provinceName,
-			// 	// 	  shippingAddressCitySn: data.citySn, // 市
-			// 	// 	  shippingAddressCityName: data.cityName,
-			// 	// 	  shippingAddressCountySn: data.countySn, // 区
-			// 	// 	  shippingAddressCountyName: data.countyName,
-			// 	// 	  shippingAddress: data.customerAddr, //  详细地址
-			// 	// 	  fax: data.fax, //  客户传真
-			// 	// 	  dispatchType: data.dispatchType, //  配送方式
-			// 	// 	  satelliteFlag: data.satelliteFlag, //  是否卫星仓客户
-			// 	// 	  priceType: data.priceType, //  价格类型
-			// 	// 	  settleStyleSn: data.settleStyleSn //  收款方式
-			// 	// 	})
-			// 	// }
-			// },
-			getCodeList(code){
-				getLookUpDatas({type:code}).then(res=>{
-					if(res.status==200){
-						this.dispatchTypeList=res.data
-						this.showDispatch=true
-					}
-				})
-			},
 			getCustomerData(val){
 				customerDetail({id:val}).then(res=>{
 					if(res.status==200){
 						this.customerData=res.data
-						if (this.customerData.provinceSn) { this.getArea('city', this.customerData.provinceSn) }
-						if (this.customerData.citySn) { this.getArea('district', this.customerData.citySn) }
-						
+						this.areaIdArr=[this.customerData.provinceSn,this.customerData.citySn,this.customerData.countySn]
+						this.areaInfo={label:this.customerData.provinceName+'-'+this.customerData.cityName+'-'+this.customerData.countyName}
 						// this.setFun(res.data)
 						this.form = Object.assign(this.form, {
 						  buyerName: this.customerData.customerName, // 客户名称
@@ -238,9 +202,12 @@
 						if(this.customerData.priceType || this.customerData.dispatchType){
 							setTimeout(()=>{
 								this.$refs.priceType.setVal(this.customerData.priceType)
+							},200)
+						}
+						if(this.customerData.dispatchType){
+							setTimeout(()=>{
 								this.$refs.dispatchType.setVal(this.customerData.dispatchType)
 							},200)
-							
 						}
 						this.form=Object.assign(this.form,res.data)
 					}else{
@@ -248,77 +215,39 @@
 					}
 				})
 			},
-			// 获取城市列表
-			getCityList (val) {
-			  this.addrCityList = []
-			  this.addrDistrictList = []
-			  this.form.shippingAddressCitySn = undefined
-			  this.form.shippingAddressCityName = ''
-			  this.form.shippingAddressCountySn = undefined
-			  this.form.shippingAddressCountyName = ''
-			  if (val) {
-			    this.getArea('city', val)
-			    this.form.shippingAddressProvinceName = this.addrProvinceList.find(item => item.areaSn == val).name
-			  } else {
-			    this.form.shippingAddressProvinceName = ''
-			  }
-			},
-			// 获取区县列表
-			getAreaList (val) {
-			  this.addrDistrictList = []
-			  this.form.shippingAddressCountySn = undefined
-			  this.form.shippingAddressCountyName = ''
-			  if (val) {
-			    this.getArea('district', val)
-			    this.form.shippingAddressCityName = this.addrCityList.find(item => item.areaSn == val).name
-			  } else {
-			    this.form.shippingAddressCityName = ''
-			  }
-			},
-			// 区县变更
-			areaCharged (val) {
-			  if (val) {
-			    this.form.shippingAddressCountyName = this.addrDistrictList.find(item => item.areaSn == val).name
-			  } else {
-			    this.form.shippingAddressCountyName = ''
-			  }
-			},
-			//  省/市/区
-			getArea (leve, sn) {
-			  let params
-			  if (leve == 'province') {
-			    params = { type: '2' }
-			  } else {
-			    params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
+			// 客户信息信息更改后先保存
+			handleSaveCust () {
+			  const params = {
+			    customerName: this.form.buyerName,
+			    customerSn: this.form.buyerSn,
+			    contactTel: this.form.consigneeTel, //  联系电话
+			    contactMobile: this.form.contactMobile,
+			    contactName: this.form.consigneeName, //  联系人
+			    provinceSn: this.form.shippingAddressProvinceSn, //  省
+			    provinceName: this.form.shippingAddressProvinceName,
+			    citySn: this.form.shippingAddressCitySn, // 市
+			    cityName: this.form.shippingAddressCityName,
+			    countySn: this.form.shippingAddressCountySn, // 区
+			    countyName: this.form.shippingAddressCountyName,
+			    customerAddr: this.form.shippingAddress, //  详细地址
+			    dispatchType: this.form.dispatchType, //  配送方式
+			    priceType: this.form.priceType, //  价格类型
+			    settleStyleSn: this.form.settleStyleSn //  收款方式
 			  }
-			  getArea(params).then(res => {
+			  updateByCustomerSn(params).then(res => {
 			    if (res.status == 200) {
-			      if (leve == 'province') {
-			        this.addrProvinceList = res.data || []
-			      } else if (leve == 'city') {
-			        this.addrCityList = res.data || []
-			      } else if (leve == 'district') {
-			        this.addrDistrictList = res.data || []
-			      }
-			    } else {
-			      if (leve == 'province') {
-			        this.addrProvinceList = []
-			      } else if (leve == 'city') {
-			        this.addrCityList = []
-			      } else if (leve == 'district') {
-			        this.addrDistrictList = []
-			      }
-			    }
-			  })
-			},
-			getCodeByName (dispName) {
-			  return this.dispatchTypeList.find((item) => {
-			    return item.dispName == dispName
+			      // 保存销售单
+			      this.salesSbmit()
+			    } 
 			  })
 			},
 			// 重新选择
 			goBack(){
-				uni.navigateBack({})
+				uni.$emit('clear')
+				setTimeout(()=>{
+					uni.navigateBack({})
+				},500)
+				
 			},
 			radioChange(e) {
 				console.log(e);
@@ -350,10 +279,6 @@
 				// console.log(this.areaIdArr,'this.areaIdArr')
 				this.$refs.applyAddress.open(this.areaIdArr)
 			},
-			brandClean(){
-				this.settleStyleName=''
-				this.form.settleStyleSn=undefined
-			},
 			// 获取业务员列表数据
 			getUserAllList () {
 			  employeeAllList({}).then(res => {
@@ -389,76 +314,19 @@
 				console.log(e,'data')
 				this.defaultSettleIndex=[e]
 				this.settleStyleName=this.settleTypeList[e].name
-				if(this.itemId){
-					this.form.settleStyleSn=this.settleTypeList[e].settleStyleSn
-				}else{
-					this.form.settleStyleSn=this.settleTypeList[e].settleStyleSn
-				}
-				
-				
+				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]
-				this.custTypeName=this.custTypeList[e].name
-				this.form.customerTypeSn=this.custTypeList[e].customerTypeSn
-			},
-			// 保存 (新增客户)
-			customerSubmit(){
-				console.log('保存===========')
-				this.$refs.uForm.validate(valid => {
-					if (valid) {
-						console.log('验证通过');
-						if (this.form.customerName ==='') {
-							uni.showToast({
-								title: '请输入客户名称',
-								icon: 'none'
-							})
-							return false
-						}
-						//  省市区
-						if(this.areaIdArr.length == 0){
-							uni.showToast({icon: 'none',title: '请选择省市区'})
-							return
-						}
-						if (this.form.priceType ==undefined ) {
-							uni.showToast({
-								title: '请选择价格类型',
-								icon: 'none'
-							})
-							return false
-						}
-						if (this.form.settleStyleSn ==undefined) {
-							uni.showToast({
-								title: '请选择收款方式',
-								icon: 'none'
-							})
-							return false
-						}
-						const params=Object.assign({},this.form,this.areaIdArr)
-						console.log(params,'params')
-						if(this.form.id) {
-							params.id = this.form.id
-						}
-						custSave(params).then(res=>{
-							if(res.status == 200) {
-								uni.showToast({
-									title: res.message,
-									icon: 'none'
-								})
-								setTimeout(()=>{
-									uni.navigateBack()
-								},300)
-							} 
-						})
-					} else {
-						console.log('验证失败');
-					}
-				})
+				this.form.salesManName=this.userList[e].name
+				this.form.salesManSn=this.userList[e].salesManSn
 			},
 			// 保存 (新增销售单)
 			salesSbmit(){
@@ -478,7 +346,7 @@
 							uni.showToast({icon: 'none',title: '请选择省市区'})
 							return
 						}
-						if (this.form.priceType ==undefined ||this.form.priceType =='') {
+						if (this.form.priceType ==undefined) {
 							uni.showToast({
 								title: '请选择价格类型',
 								icon: 'none'
@@ -510,9 +378,9 @@
 							satelliteFlag: 0, //  是否卫星仓客户
 							priceType:this.form.priceType?this.form.priceType: this.customerData.priceType, //  价格类型
 							settleStyleSn:this.form.settleStyleSn?this.form.settleStyleSn: this.customerData.settleStyleSn, //  收款方式
-							salesManSn:this.salesManSn ||undefined, //  业务员
+							salesManSn:this.form.salesManSn ||undefined, //  业务员
 							salesManName: '',
-							distributionFlag: '0', // 铺货出库
+							distributionFlag: this.form.distributionFlag, // 铺货出库
 							salesTragetType: 'CUSTOMER',
 							remarks: this.remarks //  备注
 						}

+ 116 - 28
pages/sales/chooseCustomer.vue

@@ -1,54 +1,142 @@
 <template>
 	<view class="chooseCustomer-content">
-		<view class="flex justify_between align_center search-title">
-			<text class="search-label">客户名称</text>
-			<view class="search-btn">
-				<text>没有搜索到?</text>
-				<text>点击</text>
-				<text @click="addCustomer">新增客户</text>
+		<view class="search">
+			<view class="flex justify_between align_center search-title">
+				<text class="search-label">客户名称</text>
+				<view class="search-btn">
+					<text>没有搜索到?</text>
+					<text>点击</text>
+					<text @click="addCustomer">新增客户</text>
+				</view>
 			</view>
+			<u-search
+				placeholder="请输入客户名称搜索" 
+				v-model="queryWord" 
+				@input="searchBrand"
+				@search="searchBrand"
+				@clear="clearSearch"
+				:action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': $config('primaryColor'), 'border-radius': '6upx', 'padding': '12upx 0'}">
+			</u-search>
 		</view>
-		<!-- 客户搜索框 -->
-		<customerSearch></customerSearch>
+			<scroll-view  class="picker-content flex_1" scroll-y>
+				<view class="picker-main">
+					<view class="picker-main-item" v-for="(item, index) in listData" :key="item.id" @click="chooseItem(index)">
+						<view class="item-name">{{item.customerName}}</view>
+					</view>
+					<view v-if="listData&&listData.length>=20" style="color:#999;font-size: 26upx;text-align: center;padding: 10upx;">最多显示前20条匹配客户,请尝试输入更多内容</view>
+					<view v-if="listData && listData.length == 0">
+						<u-empty text="暂无匹配客户" mode="list" :img-width="200" :margin-top="60"></u-empty>
+					</view>
+				</view>
+			</scroll-view>
 	</view>
 </template>
 
 <script>
-	import customerSearch from '@/pages/common/customerSearch.vue'
+	import {customerList} from '@/api/customer.js'
 	export default{
-		components:{customerSearch},
 		data(){
 			return{
-				// 新增客户
-				addCustomer(){
-					uni.navigateTo({
-						url:'/pages/sales/addCustomer'
-					})
+				listData:[],
+				queryWord:'',
+				pageSize:20,
+				pageNo:1,
+			}
+		},
+		onLoad() {
+			uni.$on('clear',this.clearSearch)
+			this.init()
+		},
+		onUnload() {
+			uni.$off('clear',this.clearSearch)
+		},
+		methods:{
+			// 初始数据
+			init(){
+				this.listData=[]
+				this.queryWord=''
+				this.pageSize=20
+				this.pageNo=1
+			},
+			// 新增客户
+			addCustomer(){
+				uni.navigateTo({
+					url:'/pages/sales/addCustomer'
+				})
+			},
+			getData(){
+				console.log('调用')
+				customerList({queryWord:this.queryWord,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
+					if(res.status == 200 && res.data){
+						this.listData = res.data.list
+					}else{
+						this.listData = []
+					}
+				})
+			},
+			// 搜索品牌
+			searchBrand(){
+				if(this.queryWord != ''){
+					this.getData()
 				}
+			},
+			clearSearch(){
+				this.queryWord = ''
+				this.listData = []
+			},
+			chooseItem(val){
+				console.log(val)
+				this.queryWord=this.listData[val].customerName
+				uni.navigateTo({
+					url:'/pages/sales/addSales?pageType=edit&nowId='+this.listData[val].id
+				})
 			}
-		}
+		},
 	}
 </script>
 
 <style lang="scss">
 	.chooseCustomer-content{
 		width: 100%;
+		height: 100vh;
 		background-color: #fff;
 		padding:0 30upx;
-		.search-title{
-			padding: 20upx 0;
-			.search-label{
-				font-size: 30upx;
-				font-weight: 600;
+		.search{
+			.search-title{
+				padding: 20upx 0;
+				.search-label{
+					font-size: 30upx;
+					font-weight: 600;
+				}
+				.search-btn{
+					font-size: 28upx;
+					color: #999;
+					text:last-child{
+						display: inline-block;
+						padding-left: 10upx;
+						color:#007AFF
+					}
+				}
 			}
-			.search-btn{
-				font-size: 28upx;
-				color: #999;
-				text:last-child{
-					display: inline-block;
-					padding-left: 10upx;
-					color:#007AFF
+		}
+		.picker-content{
+			padding: 6upx 0 20upx;
+			width: 100%;
+			flex: 1;
+			overflow-y: scroll;
+			.picker-main{
+				width: 100%;
+				.picker-main-item{
+					padding: 0 20upx;
+					.item-name{
+						padding: 14upx 0;
+						border-bottom: 1rpx solid #e5e6eb;
+					}
+					.item-name:not(:last-child){
+						border-bottom:none
+					}
 				}
+				
 			}
 		}
 	}

+ 1 - 2
pages/sales/productPricing.vue

@@ -76,7 +76,7 @@
 					{ name: '终端会员价', checked: false, val: 'terminalPrice' },
 				],
 				pageNo:1,
-				pageSize:6,
+				pageSize:15,
 				noDataText: '暂无数据',
 				theme: '',
 				status: 'loadmore',
@@ -103,7 +103,6 @@
 				this.$nextTick(function(){
 					this.getList(1)
 				})
-				
 			},
 			// 列表
 			getList(pageNo){