|
@@ -19,70 +19,25 @@
|
|
>
|
|
>
|
|
<a-row :gutter="15">
|
|
<a-row :gutter="15">
|
|
<a-col :span="8">
|
|
<a-col :span="8">
|
|
- <a-form-model-item label="客户名称" prop="buyerSn">
|
|
|
|
- <custList id="chooseCustom-buyerSn" ref="custList" @change="custChange"></custList>
|
|
|
|
|
|
+ <a-form-model-item label="客户名称" required>
|
|
|
|
+ <custList id="chooseCustom-dealerName" ref="custList" @dealerDetail="dealerDetail" @change="custChange"></custList>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
<a-row :gutter="15">
|
|
<a-row :gutter="15">
|
|
- <a-col :span="16">
|
|
|
|
- <a-form-model-item label="客户地址" required style="margin: 0;" :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
|
|
|
|
- <a-row :gutter="15">
|
|
|
|
- <!-- 客户地址 -->
|
|
|
|
- <a-col span="8">
|
|
|
|
- <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="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="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>
|
|
|
|
- </a-col>
|
|
|
|
- </a-row>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- </a-col>
|
|
|
|
<a-col :span="8">
|
|
<a-col :span="8">
|
|
- <a-form-model-item label="" prop="customerAddr">
|
|
|
|
- <a-input
|
|
|
|
- id="chooseCustom-customerAddr"
|
|
|
|
- :maxLength="60"
|
|
|
|
- v-model="form.customerAddr"
|
|
|
|
- placeholder="请输入详细地址(最多60个字符)"
|
|
|
|
- allowClear />
|
|
|
|
|
|
+ <a-form-model-item label="联系人">
|
|
|
|
+ {{ form.contact || '--' }}
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
- </a-row>
|
|
|
|
- <a-row :gutter="15">
|
|
|
|
- <a-col :span="8">
|
|
|
|
- <a-form-model-item label="联系人" prop="consigneeName">
|
|
|
|
- <a-input
|
|
|
|
- id="chooseCustom-consigneeName"
|
|
|
|
- :maxLength="30"
|
|
|
|
- v-model="form.consigneeName"
|
|
|
|
- placeholder="请输入联系人(最多30个字符)"
|
|
|
|
- allowClear />
|
|
|
|
|
|
+ <a-col :span="6">
|
|
|
|
+ <a-form-model-item label="联系手机">
|
|
|
|
+ {{ form.contactMobile || '--' }}
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
- <a-col :span="8">
|
|
|
|
- <a-form-model-item label="联系电话" prop="consigneeTel">
|
|
|
|
- <a-input
|
|
|
|
- id="chooseCustom-consigneeTel"
|
|
|
|
- :maxLength="30"
|
|
|
|
- v-model="form.consigneeTel"
|
|
|
|
- placeholder="请输入联系电话(最多30个字符)"
|
|
|
|
- allowClear />
|
|
|
|
|
|
+ <a-col :span="10">
|
|
|
|
+ <a-form-model-item label="客户地址">
|
|
|
|
+ {{ form.provinceName }} - {{ form.cityName }} - {{ form.districtName }} {{ form.address }}
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
@@ -101,23 +56,11 @@
|
|
<a-button @click="cancel" style="margin-left: 15px" id="chooseCustom-btn-back">取消</a-button>
|
|
<a-button @click="cancel" style="margin-left: 15px" id="chooseCustom-btn-back">取消</a-button>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
</a-form-model>
|
|
- <!-- 新增客户 -->
|
|
|
|
- <a-modal
|
|
|
|
- v-model="isNewCust"
|
|
|
|
- title="新增客户"
|
|
|
|
- centered
|
|
|
|
- width="60%"
|
|
|
|
- :maskClosable="false"
|
|
|
|
- @cancel="cancelNewCust"
|
|
|
|
- :footer="null"
|
|
|
|
- >
|
|
|
|
- </a-modal>
|
|
|
|
</a-modal>
|
|
</a-modal>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { getArea } from '@/api/data'
|
|
|
|
-import { salesReturnSave } from '@/api/salesReturn'
|
|
|
|
|
|
+import { salesReturnInsert } from '@/api/salesReturn'
|
|
import { VSelect } from '@/components'
|
|
import { VSelect } from '@/components'
|
|
import custList from '@/views/common/custList.vue'
|
|
import custList from '@/views/common/custList.vue'
|
|
export default {
|
|
export default {
|
|
@@ -135,107 +78,49 @@ export default {
|
|
labelCol: { span: 8 },
|
|
labelCol: { span: 8 },
|
|
wrapperCol: { span: 16 }
|
|
wrapperCol: { span: 16 }
|
|
},
|
|
},
|
|
- buyerSnBak: '', // 更改前客户sn备份
|
|
|
|
form: {
|
|
form: {
|
|
- buyerName: '', // 客户名称
|
|
|
|
- buyerSn: undefined, // 客户sn
|
|
|
|
- consigneeTel: '', // 联系电话
|
|
|
|
- consigneeName: '', // 联系人
|
|
|
|
- priceType: '', // 价格类型
|
|
|
|
- provinceSn: undefined, // 省
|
|
|
|
|
|
+ dealerName: '', // 客户名称
|
|
|
|
+ dealerSn: '', // 客户sn
|
|
|
|
+ contactMobile: '', // 联系电话
|
|
|
|
+ contact: '', // 联系人
|
|
|
|
+ provinceSn: '', // 省
|
|
provinceName: '',
|
|
provinceName: '',
|
|
- citySn: undefined, // 市
|
|
|
|
|
|
+ citySn: '', // 市
|
|
cityName: '',
|
|
cityName: '',
|
|
- countySn: undefined, // 区
|
|
|
|
- countyName: '',
|
|
|
|
- customerAddr: '', // 详细地址
|
|
|
|
|
|
+ districtSn: '', // 区
|
|
|
|
+ districtName: '',
|
|
|
|
+ address: '', // 详细地址
|
|
grabFlag: '1' // 是否抓单
|
|
grabFlag: '1' // 是否抓单
|
|
},
|
|
},
|
|
- rules: {
|
|
|
|
- buyerSn: [
|
|
|
|
- { required: true, message: '请选择客户', trigger: ['change', 'blur'] }
|
|
|
|
- ],
|
|
|
|
- consigneeTel: [
|
|
|
|
- { required: true, message: '请输入联系电话', trigger: 'blur' }
|
|
|
|
- ],
|
|
|
|
- provinceSn: [
|
|
|
|
- { required: true, message: '请选择省', trigger: 'change' }
|
|
|
|
- ],
|
|
|
|
- citySn: [
|
|
|
|
- { required: true, message: '请选择市', trigger: 'change' }
|
|
|
|
- ],
|
|
|
|
- countySn: [
|
|
|
|
- { required: true, message: '请选择区/县', trigger: 'change' }
|
|
|
|
- ],
|
|
|
|
- customerAddr: [
|
|
|
|
- { required: true, message: '请输入详细地址', trigger: 'blur' }
|
|
|
|
- ],
|
|
|
|
- grabFlag: [
|
|
|
|
- { required: true, message: '请选择是否铺货出库', trigger: 'change' }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- addrProvinceList: [], // 省下拉
|
|
|
|
- addrCityList: [], // 市下拉
|
|
|
|
- addrDistrictList: [], // 区下拉
|
|
|
|
- custId: undefined, // 客户id
|
|
|
|
- interId: null
|
|
|
|
|
|
+ rules: {}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- custChange (val, row) {
|
|
|
|
- console.log(val, row)
|
|
|
|
|
|
+ custChange (val) {
|
|
this.form.buyerSn = val.key
|
|
this.form.buyerSn = val.key
|
|
|
|
+ this.$refs.custList.getDetail(val.key)
|
|
},
|
|
},
|
|
// 获取详情
|
|
// 获取详情
|
|
- getDetail () {
|
|
|
|
- custFindById({ id: this.custId }).then(res => {
|
|
|
|
- const data = res.data
|
|
|
|
- if (res.status == 200 && data) {
|
|
|
|
- if (data.provinceSn) { this.getArea('city', data.provinceSn) }
|
|
|
|
- if (data.citySn) { this.getArea('district', data.citySn) }
|
|
|
|
- this.form = Object.assign(this.form, {
|
|
|
|
- buyerName: data.customerName, // 客户名称
|
|
|
|
- buyerSn: data.customerSn, // 客户sn
|
|
|
|
- consigneeTel: data.contactTel, // 联系电话
|
|
|
|
- consigneeName: data.contactName, // 联系人
|
|
|
|
- provinceSn: data.provinceSn, // 省
|
|
|
|
- provinceName: data.provinceName,
|
|
|
|
- priceType: data.priceType,
|
|
|
|
- citySn: data.citySn, // 市
|
|
|
|
- cityName: data.cityName,
|
|
|
|
- countySn: data.countySn, // 区
|
|
|
|
- countyName: data.countyName,
|
|
|
|
- customerAddr: data.customerAddr, // 详细地址
|
|
|
|
- fax: data.fax // 客户传真
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- this.$message.error('获取客户信息失败')
|
|
|
|
- this.$refs.ruleForm.resetFields()
|
|
|
|
- }
|
|
|
|
- this.$refs.ruleForm.clearValidate()
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 保存客户信息
|
|
|
|
- handleSaveCust () {
|
|
|
|
- const params = {
|
|
|
|
- customerName: this.form.buyerName,
|
|
|
|
- customerSn: this.form.buyerSn,
|
|
|
|
- contactTel: this.form.consigneeTel, // 联系电话
|
|
|
|
- contactName: this.form.consigneeName, // 联系人
|
|
|
|
- provinceSn: this.form.provinceSn, // 省
|
|
|
|
- provinceName: this.form.provinceName,
|
|
|
|
- priceType: this.form.priceType,
|
|
|
|
- citySn: this.form.citySn, // 市
|
|
|
|
- cityName: this.form.cityName,
|
|
|
|
- countySn: this.form.countySn, // 区
|
|
|
|
- countyName: this.form.countyName,
|
|
|
|
- customerAddr: this.form.customerAddr // 详细地址
|
|
|
|
|
|
+ dealerDetail (data) {
|
|
|
|
+ console.log(data)
|
|
|
|
+ if (data) {
|
|
|
|
+ this.form = Object.assign(this.form, {
|
|
|
|
+ dealerName: data.dealerName, // 客户名称
|
|
|
|
+ dealerSn: data.dealerSn, // 客户sn
|
|
|
|
+ contactMobile: data.contactMobile, // 联系电话
|
|
|
|
+ contact: data.contact, // 联系人
|
|
|
|
+ provinceSn: data.provinceSn, // 省
|
|
|
|
+ provinceName: data.provinceName,
|
|
|
|
+ citySn: data.citySn, // 市
|
|
|
|
+ cityName: data.cityName,
|
|
|
|
+ districtSn: data.districtSn, // 区
|
|
|
|
+ districtName: data.districtName,
|
|
|
|
+ address: data.address // 详细地址
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('获取客户信息失败')
|
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
}
|
|
}
|
|
- updateByCustomerSn(params).then(res => {
|
|
|
|
- if (res.status != 200) {
|
|
|
|
- this.$message.error(res.message)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
},
|
|
},
|
|
// 保存
|
|
// 保存
|
|
handleSubmit (e) {
|
|
handleSubmit (e) {
|
|
@@ -243,11 +128,11 @@ export default {
|
|
const _this = this
|
|
const _this = this
|
|
this.$refs.ruleForm.validate(valid => {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- // 保存客户信息
|
|
|
|
- _this.handleSaveCust()
|
|
|
|
// 保存销售单
|
|
// 保存销售单
|
|
- if (_this.form.buyerSn) {
|
|
|
|
|
|
+ if (_this.form.dealerSn) {
|
|
_this.salesSaveFun()
|
|
_this.salesSaveFun()
|
|
|
|
+ } else {
|
|
|
|
+ _this.$message.info('请选择客户')
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
console.log('error submit!!')
|
|
console.log('error submit!!')
|
|
@@ -260,7 +145,7 @@ export default {
|
|
const _this = this
|
|
const _this = this
|
|
const form = this.form
|
|
const form = this.form
|
|
console.log(form, 'save data')
|
|
console.log(form, 'save data')
|
|
- salesReturnSave(form).then(res => {
|
|
|
|
|
|
+ salesReturnInsert(form).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
_this.$emit('ok', res.data)
|
|
_this.$emit('ok', res.data)
|
|
@@ -272,74 +157,12 @@ export default {
|
|
this.opened = false
|
|
this.opened = false
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$emit('cancel')
|
|
this.$emit('cancel')
|
|
- },
|
|
|
|
- // 获取城市列表
|
|
|
|
- getCityList (val) {
|
|
|
|
- console.log(val, '-------------')
|
|
|
|
- this.addrCityList = []
|
|
|
|
- this.addrDistrictList = []
|
|
|
|
- this.form.citySn = undefined
|
|
|
|
- this.form.cityName = ''
|
|
|
|
- this.form.countySn = undefined
|
|
|
|
- this.form.countyName = ''
|
|
|
|
- this.form.customerAddr = ''
|
|
|
|
- this.form.countyName = this.addrProvinceList.find(item => item.id == val).name
|
|
|
|
- this.getArea('city', val)
|
|
|
|
- },
|
|
|
|
- // 获取区县列表
|
|
|
|
- getAreaList (val) {
|
|
|
|
- this.addrDistrictList = []
|
|
|
|
- this.form.countySn = undefined
|
|
|
|
- this.form.countyName = ''
|
|
|
|
- this.form.customerAddr = ''
|
|
|
|
- this.form.cityName = this.addrCityList.find(item => item.id == val).name
|
|
|
|
- this.getArea('district', val)
|
|
|
|
- },
|
|
|
|
- // 区县变更
|
|
|
|
- areaCharged (val) {
|
|
|
|
- this.form.customerAddr = ''
|
|
|
|
- this.form.countyName = this.addrDistrictList.find(item => item.id == val).name
|
|
|
|
- },
|
|
|
|
- // 省/市/区
|
|
|
|
- getArea (type, sn) {
|
|
|
|
- let params
|
|
|
|
- if (type == 'province') {
|
|
|
|
- params = { level: '1' }
|
|
|
|
- } else {
|
|
|
|
- params = { psn: sn }
|
|
|
|
- }
|
|
|
|
- getArea(params).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- if (type == 'province') {
|
|
|
|
- this.addrProvinceList = res.data || []
|
|
|
|
- } else if (type == 'city') {
|
|
|
|
- this.addrCityList = res.data || []
|
|
|
|
- } else if (type == 'district') {
|
|
|
|
- this.addrDistrictList = res.data || []
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (type == 'province') {
|
|
|
|
- this.addrProvinceList = []
|
|
|
|
- } else if (type == 'city') {
|
|
|
|
- this.addrCityList = []
|
|
|
|
- } else if (type == 'district') {
|
|
|
|
- this.addrDistrictList = []
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- filterOption (input, option) {
|
|
|
|
- return (
|
|
|
|
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
- )
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
show (newValue, oldValue) {
|
|
show (newValue, oldValue) {
|
|
this.opened = newValue
|
|
this.opened = newValue
|
|
if (newValue) {
|
|
if (newValue) {
|
|
- this.getArea('province')
|
|
|
|
- this.getCustAllList()
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|