|
@@ -19,19 +19,23 @@
|
|
|
>
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="客户名称" prop="name">
|
|
|
- <a-input
|
|
|
- id="chooseCustom-name"
|
|
|
- :maxLength="30"
|
|
|
- v-model="form.name"
|
|
|
- placeholder="请输入客户名称(最多30个字符)"
|
|
|
- allowClear />
|
|
|
+ <a-form-model-item label="客户名称" prop="customerName">
|
|
|
+ <a-auto-complete
|
|
|
+ id="chooseCustom-customerName"
|
|
|
+ placeholder="请选择客户"
|
|
|
+ allowClear
|
|
|
+ v-model="form.customerName"
|
|
|
+ :filter-option="filterOption"
|
|
|
+ @select="custSelect"
|
|
|
+ @change="custChange">
|
|
|
+ <template slot="dataSource">
|
|
|
+ <a-select-option v-for="item in custAllList" :key="item.id" :title="item.id">{{ item.customerName }}</a-select-option>
|
|
|
+ </template>
|
|
|
+ </a-auto-complete>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item>
|
|
|
- (未搜索到客户时为新增客户)
|
|
|
- </a-form-model-item>
|
|
|
+ <a-form-model-item>(未搜索到客户时为新增客户)</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<a-row :gutter="15">
|
|
@@ -40,22 +44,22 @@
|
|
|
<a-row :gutter="15">
|
|
|
<!-- 客户地址 -->
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="provinceCode">
|
|
|
- <a-select id="chooseCustom-provinceCode" @change="getCityList" v-model="form.provinceCode" placeholder="请选择省">
|
|
|
+ <a-form-model-item prop="provinceSn">
|
|
|
+ <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
|
|
|
<a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="cityCode">
|
|
|
- <a-select id="chooseCustom-cityCode" @change="getAreaList" v-model="form.cityCode" placeholder="请选择市">
|
|
|
+ <a-form-model-item prop="citySn">
|
|
|
+ <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
|
|
|
<a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
- <a-form-model-item prop="districtCode">
|
|
|
- <a-select id="chooseCustom-districtCode" @change="areaCharged" v-model="form.districtCode" placeholder="请选择区/县">
|
|
|
+ <a-form-model-item prop="countySn">
|
|
|
+ <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
|
|
|
<a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
@@ -64,11 +68,11 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item prop="address">
|
|
|
+ <a-form-model-item label="详细地址" prop="customerAddr">
|
|
|
<a-input
|
|
|
- id="chooseCustom-address"
|
|
|
+ id="chooseCustom-customerAddr"
|
|
|
:maxLength="60"
|
|
|
- v-model="form.address"
|
|
|
+ v-model="form.customerAddr"
|
|
|
placeholder="请输入详细地址(最多60个字符)"
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
@@ -76,22 +80,22 @@
|
|
|
</a-row>
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="联系人" prop="contacts">
|
|
|
+ <a-form-model-item label="联系人" prop="contactName">
|
|
|
<a-input
|
|
|
- id="chooseCustom-contacts"
|
|
|
+ id="chooseCustom-contactName"
|
|
|
:maxLength="30"
|
|
|
- v-model="form.contacts"
|
|
|
+ v-model="form.contactName"
|
|
|
placeholder="请输入联系人(最多30个字符)"
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="客户电话" prop="customerPhone">
|
|
|
+ <a-form-model-item label="联系电话" prop="contactTel">
|
|
|
<a-input
|
|
|
- id="chooseCustom-customerPhone"
|
|
|
- :maxLength="11"
|
|
|
- v-model="form.customerPhone"
|
|
|
- placeholder="请输入客户电话(最多11个字符)"
|
|
|
+ id="chooseCustom-contactTel"
|
|
|
+ :maxLength="30"
|
|
|
+ v-model="form.contactTel"
|
|
|
+ placeholder="请输入联系电话(最多30个字符)"
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -101,15 +105,17 @@
|
|
|
<a-form-model-item label="价格类型" prop="priceType">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="20">
|
|
|
- <a-select id="chooseCustom-priceType" v-model="form.priceType" placeholder="请选择价格类型">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <v-select
|
|
|
+ code="PRICE_TYPE"
|
|
|
+ :disabled="!isEdit"
|
|
|
+ id="chooseCustom-priceType"
|
|
|
+ v-model="form.priceType"
|
|
|
+ allowClear
|
|
|
+ placeholder="请选择价格类型" ></v-select>
|
|
|
</a-col>
|
|
|
<a-col :span="4">
|
|
|
<a-popover>
|
|
|
- <template slot="content">
|
|
|
- (选择后在当前工单不可修改)
|
|
|
- </template>
|
|
|
+ <template slot="content">(选择后在当前工单不可修改)</template>
|
|
|
<a-icon type="question-circle" />
|
|
|
</a-popover>
|
|
|
</a-col>
|
|
@@ -118,47 +124,39 @@
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="支付方式" prop="payType">
|
|
|
- <a-select id="chooseCustom-payType" v-model="form.payType" placeholder="请选择支付方式">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <v-select code="PAY_TYPE" id="chooseCustom-payType" v-model="form.payType" allowClear placeholder="请选择支付方式" />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="收款方式" prop="payment">
|
|
|
- <a-select id="chooseCustom-payment" v-model="form.payment" placeholder="请选择收款方式">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <v-select code="SETTLE_STYLE_NAME" id="chooseCustom-payment" v-model="form.settleStyleSn" allowClear placeholder="请选择收款方式"></v-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="配送方式" prop="shipping">
|
|
|
- <a-select id="chooseCustom-shipping" v-model="form.shippingCode" placeholder="请选择配送方式">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <a-form-model-item label="配送方式" prop="dispatchType">
|
|
|
+ <v-select code="DISPATCH_TYPE" id="chooseCustom-dispatchType" v-model="form.dispatchType" allowClear placeholder="请选择配送方式"></v-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="业务员" prop="salesman">
|
|
|
- <a-select id="chooseCustom-salesman" v-model="form.salesman" placeholder="请选择业务员">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
+ <a-form-model-item label="业务员" prop="tenantId">
|
|
|
+ <a-select id="chooseCustom-tenantId" v-model="form.tenantId" placeholder="请选择业务员">
|
|
|
+ <a-select-option v-for="item in tenantList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
<a-form-model-item label="铺货出库" prop="salesman">
|
|
|
- <a-select id="chooseCustom-salesman" v-model="form.salesman" placeholder="请选择是否铺货出库">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <v-select code="FLAG" id="chooseCustom-salesman" v-model="form.salesman" allowClear placeholder="请选择"></v-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="备注" prop="remark">
|
|
|
+ <a-form-model-item label="备注" prop="remarks">
|
|
|
<a-input
|
|
|
- id="chooseCustom-remark"
|
|
|
+ id="chooseCustom-remarks"
|
|
|
type="textarea"
|
|
|
:maxLength="100"
|
|
|
v-model="form.remarks"
|
|
@@ -167,9 +165,7 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="8">
|
|
|
- <a-form-model-item label="开单人">
|
|
|
- 王明
|
|
|
- </a-form-model-item>
|
|
|
+ <a-form-model-item label="开单人">{{ $store.state.user.info.userNameCN }}</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
|
|
@@ -182,8 +178,11 @@
|
|
|
|
|
|
<script>
|
|
|
import { getArea } from '@/api/data'
|
|
|
+import { custAllList, custFindById } from '@/api/customer'
|
|
|
+import { VSelect } from '@/components'
|
|
|
export default {
|
|
|
name: 'ChooseCustomModal',
|
|
|
+ components: { VSelect },
|
|
|
props: {
|
|
|
show: [Boolean]
|
|
|
},
|
|
@@ -196,42 +195,44 @@ export default {
|
|
|
wrapperCol: { span: 16 }
|
|
|
},
|
|
|
form: {
|
|
|
- name: '', // 客户名称
|
|
|
- provinceCode: undefined, // 省
|
|
|
+ customerName: '', // 客户名称
|
|
|
+ contactTel: '', // 联系电话
|
|
|
+ contactName: '', // 联系人
|
|
|
+ provinceSn: undefined, // 省
|
|
|
provinceName: '',
|
|
|
- cityCode: undefined, // 市
|
|
|
+ citySn: undefined, // 市
|
|
|
cityName: '',
|
|
|
- districtCode: undefined, // 区
|
|
|
- districtName: '',
|
|
|
- address: '', // 详细地址
|
|
|
- contactName: '', // 联系人
|
|
|
- contactPhone: '', // 联系电话
|
|
|
- remarks: '', // 备注
|
|
|
- priceType: undefined, // 价格类型
|
|
|
- payType: undefined, // 支付方式
|
|
|
- payment: undefined // 收款方式
|
|
|
+ countySn: undefined, // 区
|
|
|
+ countyName: '',
|
|
|
+ customerAddr: '', // 详细地址
|
|
|
+ fax: '', // 客户传真
|
|
|
+ dispatchType: '', // 配送方式
|
|
|
+ satelliteFlag: 0, // 是否卫星仓客户
|
|
|
+ customerTypeSn: undefined, // 客户类型
|
|
|
+ priceType: '', // 价格类型
|
|
|
+ payType: '', // 支付方式
|
|
|
+ settleStyleSn: '', // 收款方式
|
|
|
+ tenantId: undefined, // 业务员
|
|
|
+ remarks: '' // 备注
|
|
|
},
|
|
|
rules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入客户名称', trigger: 'blur' }
|
|
|
+ customerName: [
|
|
|
+ { required: true, message: '请输入客户名称', trigger: ['change', 'blur'] }
|
|
|
],
|
|
|
- provinceCode: [
|
|
|
+ contactTel: [
|
|
|
+ { required: true, message: '请输入联系电话', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ provinceSn: [
|
|
|
{ required: true, message: '请选择省', trigger: 'change' }
|
|
|
],
|
|
|
- cityCode: [
|
|
|
+ citySn: [
|
|
|
{ required: true, message: '请选择市', trigger: 'change' }
|
|
|
],
|
|
|
- districtCode: [
|
|
|
+ countySn: [
|
|
|
{ required: true, message: '请选择区/县', trigger: 'change' }
|
|
|
],
|
|
|
- address: [
|
|
|
- { required: true, message: '请输入详细地址', trigger: 'blur' }
|
|
|
- ],
|
|
|
- contactName: [
|
|
|
- { required: true, message: '请输入联系人', trigger: 'blur' }
|
|
|
- ],
|
|
|
contactPhone: [
|
|
|
- { required: true, message: '请输入联系人电话', trigger: 'blur' }
|
|
|
+ { required: true, message: '请输入联系电话', trigger: 'blur' }
|
|
|
],
|
|
|
priceType: [
|
|
|
{ required: true, message: '请选择价格类型', trigger: 'change' }
|
|
@@ -239,63 +240,102 @@ export default {
|
|
|
payType: [
|
|
|
{ required: true, message: '请选择支付方式', trigger: 'change' }
|
|
|
],
|
|
|
- payment: [
|
|
|
+ settleStyleSn: [
|
|
|
{ required: true, message: '请选择收款方式', trigger: 'change' }
|
|
|
]
|
|
|
},
|
|
|
+ custAllList: [], // 客户 下拉数据
|
|
|
addrProvinceList: [], // 省下拉
|
|
|
addrCityList: [], // 市下拉
|
|
|
- addrDistrictList: [] // 区下拉
|
|
|
+ addrDistrictList: [], // 区下拉
|
|
|
+ tenantList: [], // 业务员 下拉
|
|
|
+ custId: undefined, // 客户id
|
|
|
+ isEdit: true // 是否可编辑
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 客户 select
|
|
|
+ custSelect (id) {
|
|
|
+ this.custId = id
|
|
|
+ this.isEdit = false
|
|
|
+ this.getDetail()
|
|
|
+ },
|
|
|
+ // 客户 change
|
|
|
+ custChange (val) {
|
|
|
+ this.custId = undefined
|
|
|
+ this.isEdit = true
|
|
|
+ },
|
|
|
+ // 获取详情
|
|
|
+ getDetail () {
|
|
|
+ custFindById({ id: this.custId }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if (res.data.provinceSn) { this.getArea('city', res.data.provinceSn) }
|
|
|
+ if (res.data.citySn) { this.getArea('district', res.data.citySn) }
|
|
|
+ this.form = Object.assign(this.form, res.data)
|
|
|
+ } else {
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 保存
|
|
|
handleSubmit (e) {
|
|
|
e.preventDefault()
|
|
|
const _this = this
|
|
|
- this.$emit('ok', { id: 1000, customName: '车领主常青二路店' })
|
|
|
- this.cancel()
|
|
|
- // this.$refs.ruleForm.validate(valid => {
|
|
|
- // if (valid) {
|
|
|
- // const form = values.form
|
|
|
- // form.desc = _this.form.desc
|
|
|
- // form.id = this.isEdit ? this.$route.params.id : null
|
|
|
- // console.log(form,'-----提交信息')
|
|
|
- // // goodsSave(form).then(res => {
|
|
|
- // // if (res.status == 200) {
|
|
|
- // // _this.$message.success(res.message)
|
|
|
- // // }
|
|
|
- // // })
|
|
|
- // } else {
|
|
|
- // console.log('error submit!!')
|
|
|
- // return false
|
|
|
- // }
|
|
|
- // })
|
|
|
+ // this.$emit('ok', { id: 1000, customName: '车领主常青二路店' })
|
|
|
+ // this.cancel()
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ console.log('-------------提交信息', _this.form)
|
|
|
+ // const form = values.form
|
|
|
+ // form.desc = _this.form.desc
|
|
|
+ // form.id = this.isEdit ? this.$route.params.id : null
|
|
|
+ // console.log(form,'-----提交信息')
|
|
|
+ // // goodsSave(form).then(res => {
|
|
|
+ // // if (res.status == 200) {
|
|
|
+ // // _this.$message.success(res.message)
|
|
|
+ // // }
|
|
|
+ // // })
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
cancel () {
|
|
|
this.opened = false
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.$emit('cancel')
|
|
|
},
|
|
|
+ // 客户无分页列表数据
|
|
|
+ getCustAllList () {
|
|
|
+ const _this = this
|
|
|
+ custAllList().then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.custAllList = res.data || []
|
|
|
+ } else {
|
|
|
+ _this.custAllList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取城市列表
|
|
|
getCityList (val) {
|
|
|
this.addrCityList = []
|
|
|
this.addrDistrictList = []
|
|
|
- this.form.cityCode = undefined
|
|
|
- this.form.districtCode = undefined
|
|
|
- this.form.address = ''
|
|
|
+ this.form.citySn = undefined
|
|
|
+ this.form.countySn = undefined
|
|
|
+ this.form.customerAddr = ''
|
|
|
this.getArea('city', val)
|
|
|
},
|
|
|
// 获取区县列表
|
|
|
getAreaList (val) {
|
|
|
this.addrDistrictList = []
|
|
|
- this.form.districtCode = undefined
|
|
|
- this.form.address = ''
|
|
|
+ this.form.countySn = undefined
|
|
|
+ this.form.customerAddr = ''
|
|
|
this.getArea('district', val)
|
|
|
},
|
|
|
// 区县变更
|
|
|
areaCharged (val) {
|
|
|
- this.form.address = ''
|
|
|
+ this.form.customerAddr = ''
|
|
|
},
|
|
|
// 省/市/区
|
|
|
getArea (type, sn) {
|
|
@@ -324,6 +364,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ filterOption (input, option) {
|
|
|
+ return (
|
|
|
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ )
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -331,6 +376,7 @@ export default {
|
|
|
this.opened = newValue
|
|
|
if (newValue) {
|
|
|
this.getArea('province')
|
|
|
+ this.getCustAllList()
|
|
|
}
|
|
|
}
|
|
|
}
|