|
@@ -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);
|