|
@@ -5,7 +5,7 @@
|
|
|
centered
|
|
|
:maskClosable="false"
|
|
|
:confirmLoading="confirmLoading"
|
|
|
- :width="960"
|
|
|
+ :width="800"
|
|
|
:footer="null"
|
|
|
@cancel="cancel"
|
|
|
>
|
|
@@ -16,67 +16,43 @@
|
|
|
:model="form"
|
|
|
:rules="rules"
|
|
|
:label-col="formItemLayout.labelCol"
|
|
|
- :wrapper-col="formItemLayout.wrapperCol"
|
|
|
- >
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item label="客户名称" prop="buyerSn">
|
|
|
- <custList id="chooseCustom-buyerSn" defValKey="buyerSn" @change="custChange" v-model="form.buyerSn"></custList>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item label="联系人">
|
|
|
- {{ form.consigneeName }}
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item label="联系电话">
|
|
|
- {{ form.consigneeTel }}
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item label="客户地址">
|
|
|
- {{ form.customerAddr }}
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item label="收款方式" prop="settleStyleSn">
|
|
|
- <settleStyle id="chooseCustom-settleStyleSn" v-model="form.settleStyleSn"></settleStyle>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item label="选择收货地址" prop="shippingAddr">
|
|
|
- <a-select id="chooseCustom-shippingAddr" v-model="form.shippingAddr" placeholder="请选择收货地址">
|
|
|
- <a-select-option v-for="item in addrList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ :wrapper-col="formItemLayout.wrapperCol">
|
|
|
+ <a-form-model-item label="客户名称" prop="buyerSn">
|
|
|
+ <dealerSubareaScopeList ref="dealerSubareaScopeList" id="chooseCustom-buyerSn" defValKey="buyerSn" @change="custChange" v-model="form.buyerSn" />
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item label="支付方式" prop="settleStyleSn">
|
|
|
+ <v-select
|
|
|
+ code="SETTLE_STYLE"
|
|
|
+ id="chooseCustom-settleStyleSn"
|
|
|
+ v-model="form.settleStyleSn"
|
|
|
+ allowClear
|
|
|
+ placeholder="请选择支付方式"></v-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item prop="consigneeTel">
|
|
|
+ <span slot="label"><i style="color: red;">*</i> 收货地址</span>
|
|
|
+ {{ chooseAddr }}
|
|
|
+ <a-button type="link" :disabled="!form.buyerSn" id="chooseCustom-chooseAddr" @click="handleChoose">{{ addressVal }} >></a-button>
|
|
|
+ </a-form-model-item>
|
|
|
<a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
|
|
|
<a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">保存</a-button>
|
|
|
<a-button @click="cancel" style="margin-left: 15px" id="chooseCustom-btn-back">取消</a-button>
|
|
|
</a-form-model-item>
|
|
|
</a-form-model>
|
|
|
</a-spin>
|
|
|
+ <!-- 选择地址 -->
|
|
|
+ <choose-address-modal :openModal="openAddrModal" :paramsData="form.buyerSn" @ok="handleOk" @verify="verifyFun" @close="openAddrModal=false" />
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { salesSave } from '@/api/sales'
|
|
|
import { VSelect } from '@/components'
|
|
|
-import custList from '@/views/common/custList.vue'
|
|
|
-import settleStyle from '@/views/common/settleStyle.js'
|
|
|
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
|
|
|
+import chooseAddressModal from './receivingAddress/chooseAddressModal.vue'
|
|
|
+import { dealerRecevieAddrQuery } from '@/api/dealerRecevieAddr'
|
|
|
+import { salesSave } from '@/api/sales'
|
|
|
export default {
|
|
|
name: 'ChooseCustomModal',
|
|
|
- components: { VSelect, custList, settleStyle },
|
|
|
+ components: { VSelect, dealerSubareaScopeList, chooseAddressModal },
|
|
|
props: {
|
|
|
show: [Boolean]
|
|
|
},
|
|
@@ -90,71 +66,44 @@ export default {
|
|
|
labelCol: { span: 4 },
|
|
|
wrapperCol: { span: 18 }
|
|
|
},
|
|
|
- buyerSnBak: '', // 更改前客户sn备份
|
|
|
- priceTypeBak: '', // 更改前客户价格类型备份
|
|
|
form: {
|
|
|
- buyerName: '', // 客户名称
|
|
|
buyerSn: undefined, // 客户sn
|
|
|
- consigneeTel: '', // 联系电话
|
|
|
- consigneeName: '', // 联系人
|
|
|
- shippingAddressProvinceSn: undefined, // 省
|
|
|
- shippingAddressProvinceName: '',
|
|
|
- shippingAddressCitySn: undefined, // 市
|
|
|
- shippingAddressCityName: '',
|
|
|
- shippingAddressCountySn: undefined, // 区
|
|
|
- shippingAddressCountyName: '',
|
|
|
- shippingAddress: '', // 详细地址
|
|
|
- fax: '', // 客户传真
|
|
|
- dispatchType: undefined, // 配送方式
|
|
|
- satelliteFlag: 0, // 是否卫星仓客户
|
|
|
- priceType: undefined, // 价格类型
|
|
|
- settleStyleSn: '', // 收款方式
|
|
|
- salesManSn: undefined, // 业务员
|
|
|
- salesManName: '',
|
|
|
- distributionFlag: '0', // 铺货出库
|
|
|
- salesTragetType: 'C',
|
|
|
- remarks: '' // 备注
|
|
|
+ buyerName: '',
|
|
|
+ settleStyleSn: undefined,
|
|
|
+ shippingAddrProvinceSn: '',
|
|
|
+ shippingAddrProvinceName: '', // 省
|
|
|
+ shippingAddrCitySn: '',
|
|
|
+ shippingAddrCityName: '', // 市
|
|
|
+ shippingAddrCountySn: '',
|
|
|
+ shippingAddrCountyName: '', // 区
|
|
|
+ shippingAddr: '', // 详细地址
|
|
|
+ consigneeTel: '', // 联系电话
|
|
|
+ consigneeName: '' // 联系人名称
|
|
|
},
|
|
|
rules: {
|
|
|
- buyerSn: [
|
|
|
- { required: true, message: '请选择客户', trigger: ['change', 'blur'] }
|
|
|
- ],
|
|
|
- consigneeTel: [{ required: true, message: '请输入联系电话', trigger: 'blur' }, { pattern: /^\d{11}$/, message: '请输入正确的手机号' }],
|
|
|
- shippingAddressProvinceSn: [
|
|
|
- { required: true, message: '请选择省', trigger: 'change' }
|
|
|
- ],
|
|
|
- shippingAddressCitySn: [
|
|
|
- { required: true, message: '请选择市', trigger: 'change' }
|
|
|
- ],
|
|
|
- shippingAddressCountySn: [
|
|
|
- { required: true, message: '请选择区/县', trigger: 'change' }
|
|
|
- ],
|
|
|
- shippingAddress: [
|
|
|
- { required: true, message: '请输入详细地址', trigger: 'blur' }
|
|
|
- ],
|
|
|
- priceType: [
|
|
|
- { required: true, message: '请选择价格类型', trigger: ['change', 'blur'] }
|
|
|
- ],
|
|
|
- settleStyleSn: [
|
|
|
- { required: true, message: '请选择收款方式', trigger: ['change', 'blur'] }
|
|
|
- ],
|
|
|
- distributionFlag: [
|
|
|
- { required: true, message: '请选择是否铺货出库', trigger: 'change' }
|
|
|
- ]
|
|
|
- // salesManSn: [
|
|
|
- // { required: true, message: '请选择业务员', trigger: 'change' }
|
|
|
- // ]
|
|
|
+ buyerSn: [ { required: true, message: '请选择客户', trigger: ['change', 'blur'] } ],
|
|
|
+ settleStyleSn: [ { required: true, message: '请选择支付方式', trigger: ['change', 'blur'] } ],
|
|
|
+ consigneeTel: [ { required: true, message: '请选择收货地址', trigger: ['change', 'blur'] } ]
|
|
|
},
|
|
|
- custAllList: [], // 客户 下拉数据
|
|
|
- addrList: [], // 地址列表
|
|
|
- custId: undefined, // 客户id
|
|
|
- isEdit: false // 是否编辑状态
|
|
|
+ addressVal: '选择地址', // 选择地址/更换地址
|
|
|
+ chooseAddr: '', // 当前已选地址信息
|
|
|
+ openAddrModal: false // 选择地址弹框是否显示
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 客户 change
|
|
|
custChange (val) {
|
|
|
- console.log(val, 'custChange')
|
|
|
+ if (val && val.key) {
|
|
|
+ this.form.buyerSn = val.key || undefined
|
|
|
+ this.form.buyerName = val.name || ''
|
|
|
+ this.getDefaultAddress()
|
|
|
+ } else {
|
|
|
+ this.verifyFun(this.addressId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 选择地址
|
|
|
+ handleChoose () {
|
|
|
+ this.openAddrModal = true
|
|
|
},
|
|
|
// 保存
|
|
|
handleSubmit (e) {
|
|
@@ -173,7 +122,6 @@ export default {
|
|
|
salesSaveFun () {
|
|
|
const _this = this
|
|
|
const form = this.form
|
|
|
- console.log(form, 'save data')
|
|
|
_this.spinning = true
|
|
|
salesSave(form).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -193,18 +141,62 @@ export default {
|
|
|
this.opened = false
|
|
|
this.$emit('cancel')
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
+ },
|
|
|
+ // 地址保存
|
|
|
+ handleOk (data) {
|
|
|
+ this.chooseAddr = (data.consigneeName || '') + '(' + (data.consigneeTel || '') + ')' + ' ' + (data.address || '')
|
|
|
+ this.addressVal = '更换地址'
|
|
|
+ this.form.shippingAddrProvinceSn = data.provinceSn
|
|
|
+ this.form.shippingAddrProvinceName = data.provinceName // 省
|
|
|
+ this.form.shippingAddrCitySn = data.citySn
|
|
|
+ this.form.shippingAddrCityName = data.cityName // 市
|
|
|
+ this.form.shippingAddrCountySn = data.countySn
|
|
|
+ this.form.shippingAddrCountyName = data.countyName // 区
|
|
|
+ this.form.shippingAddr = data.addr// 详细地址
|
|
|
+ this.form.consigneeTel = data.consigneeTel // 联系电话
|
|
|
+ this.form.consigneeName = data.consigneeName
|
|
|
+ this.addressId = data.id || undefined
|
|
|
+ this.openAddrModal = false
|
|
|
+ },
|
|
|
+ verifyFun (id) {
|
|
|
+ if (id == this.addressId) {
|
|
|
+ this.chooseAddr = ''
|
|
|
+ this.addressVal = '选择地址'
|
|
|
+ this.form.shippingAddrProvinceSn = ''
|
|
|
+ this.form.shippingAddrProvinceName = ''// 省
|
|
|
+ this.form.shippingAddrCitySn = ''
|
|
|
+ this.form.shippingAddrCityName = '' // 市
|
|
|
+ this.form.shippingAddrCountySn = ''
|
|
|
+ this.form.shippingAddrCountyName = '' // 区
|
|
|
+ this.form.shippingAddr = ''// 详细地址
|
|
|
+ this.form.consigneeTel = '' // 联系电话
|
|
|
+ this.form.consigneeName = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取默认地址
|
|
|
+ getDefaultAddress () {
|
|
|
+ dealerRecevieAddrQuery({ defaultFlag: 1, dealerSn: this.form.buyerSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if (res.data.length == 1) {
|
|
|
+ res.data[0].address = res.data[0].provinceName + '-' + res.data[0].cityName + '-' + res.data[0].countyName + '-' + res.data[0].addr
|
|
|
+ this.addressId = res.data[0].id || undefined
|
|
|
+ this.handleOk(res.data[0])
|
|
|
+ } else {
|
|
|
+ this.verifyFun(this.addressId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
show (newValue, oldValue) {
|
|
|
this.opened = newValue
|
|
|
- if (newValue) {
|
|
|
- this.getArea('province')
|
|
|
+ if (!newValue) {
|
|
|
+ this.$refs.dealerSubareaScopeList.resetForm()
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.verifyFun(this.addressId)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style>
|
|
|
-</style>
|