|
|
@@ -12,7 +12,7 @@
|
|
|
<view :style="{ paddingTop }">
|
|
|
<view class="title" :style="[{ height }, { lineHeight: height }]">
|
|
|
<view class="back" @click="goBack()">
|
|
|
- <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
|
|
|
+ <u-icon custName="arrow-left" color="#ffffff" size="22"></u-icon>
|
|
|
</view>
|
|
|
<text>新增客户</text>
|
|
|
</view>
|
|
|
@@ -20,34 +20,22 @@
|
|
|
</view>
|
|
|
<view class="main">
|
|
|
<u-form :model="addForm" :rules="rules" ref="addForm" label-width="0">
|
|
|
- <u-form-item prop="name" borderBottom customStyle="padding:40rpx 0 30rpx">
|
|
|
+ <u-form-item prop="custName" borderBottom customStyle="padding:40rpx 0 30rpx">
|
|
|
<view class="form-label flex_l">
|
|
|
<view class="label-tag"></view>
|
|
|
客户名称
|
|
|
</view>
|
|
|
- <u-input
|
|
|
- placeholder="输入客户名称"
|
|
|
- v-model="addForm.name"
|
|
|
- border="none"
|
|
|
- suffixIcon="account"
|
|
|
- suffixIconStyle="color:#CDCDCD"
|
|
|
- clearable
|
|
|
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
+ <u-input placeholder="输入客户名称" v-model="addForm.custName" border="none" suffixIcon="account"
|
|
|
+ suffixIconStyle="color:#CDCDCD" clearable customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
</u-form-item>
|
|
|
<u-form-item prop="industry" borderBottom customStyle="padding:40rpx 0 30rpx" @click="showIndustry = true">
|
|
|
<view class="form-label flex_l">
|
|
|
<view class="label-tag"></view>
|
|
|
客户行业
|
|
|
</view>
|
|
|
- <u-input
|
|
|
- :readonly="true"
|
|
|
- placeholder="请选择客户行业"
|
|
|
- v-model="addForm.industry"
|
|
|
- border="none"
|
|
|
- suffixIcon="arrow-down"
|
|
|
- suffixIconStyle="color:#CDCDCD"
|
|
|
- clearable
|
|
|
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
+ <u-input :readonly="true" placeholder="请选择客户行业" v-model="addForm.industry" border="none"
|
|
|
+ suffixIcon="arrow-down" suffixIconStyle="color:#CDCDCD" clearable customStyle="padding: 0 30rpx 0 12rpx">
|
|
|
+ </u-input>
|
|
|
</u-form-item>
|
|
|
<!-- <u-form-item prop="level" borderBottom customStyle="padding:40rpx 0 30rpx" @click="showLevel = true">
|
|
|
<view class="form-label flex_l">
|
|
|
@@ -69,51 +57,30 @@
|
|
|
<view class="label-tag"></view>
|
|
|
客户来源
|
|
|
</view>
|
|
|
- <u-input
|
|
|
- :readonly="true"
|
|
|
- placeholder="请选择客户来源"
|
|
|
- v-model="addForm.custSource"
|
|
|
- border="none"
|
|
|
- suffixIcon="arrow-down"
|
|
|
- suffixIconStyle="color:#CDCDCD"
|
|
|
- clearable
|
|
|
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
+ <u-input :readonly="true" placeholder="请选择客户来源" v-model="addForm.custSource" border="none"
|
|
|
+ suffixIcon="arrow-down" suffixIconStyle="color:#CDCDCD" clearable customStyle="padding: 0 30rpx 0 12rpx">
|
|
|
+ </u-input>
|
|
|
</u-form-item>
|
|
|
<u-form-item prop="area" borderBottom customStyle="padding:40rpx 0 30rpx" @click="showArea = true">
|
|
|
<view class="form-label flex_l">
|
|
|
<view class="label-tag"></view>
|
|
|
所在地区
|
|
|
</view>
|
|
|
- <u-input
|
|
|
- :readonly="true"
|
|
|
- placeholder="请选择所在地区"
|
|
|
- v-model="addForm.area"
|
|
|
- border="none"
|
|
|
- suffixIcon="arrow-down"
|
|
|
- suffixIconStyle="color:#CDCDCD"
|
|
|
- clearable
|
|
|
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
+ <u-input :readonly="true" placeholder="请选择所在地区" v-model="addForm.area" border="none" suffixIcon="arrow-down"
|
|
|
+ suffixIconStyle="color:#CDCDCD" clearable customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
</u-form-item>
|
|
|
<u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
|
|
|
<view class="form-label flex_l">
|
|
|
备注
|
|
|
</view>
|
|
|
- <u-input
|
|
|
- placeholder="输入备注"
|
|
|
- v-model="addForm.remark"
|
|
|
- border="none"
|
|
|
- clearable
|
|
|
+ <u-input placeholder="输入备注" v-model="addForm.remark" border="none" clearable
|
|
|
customStyle="padding: 0 30rpx 0 12rpx"></u-input>
|
|
|
</u-form-item>
|
|
|
</u-form>
|
|
|
<view class="save" @click="handleAdd">保存</view>
|
|
|
</view>
|
|
|
<!-- 选择客户行业 -->
|
|
|
- <u-picker
|
|
|
- :show="showIndustry"
|
|
|
- :columns="industryColumns"
|
|
|
- keyName="value"
|
|
|
- @cancel="showIndustry = false"
|
|
|
+ <u-picker :show="showIndustry" :columns="industryColumns" keyName="value" @cancel="showIndustry = false"
|
|
|
@confirm="pickIndustry"></u-picker>
|
|
|
<!-- 选择客户级别 -->
|
|
|
<!-- <u-picker
|
|
|
@@ -123,26 +90,12 @@
|
|
|
@cancel="showLevel = false"
|
|
|
@confirm="pickLevel"></u-picker> -->
|
|
|
<!-- 选择客户来源 -->
|
|
|
- <u-picker
|
|
|
- :show="showSource"
|
|
|
- :columns="sourceColumns"
|
|
|
- keyName="value"
|
|
|
- @cancel="showSource = false"
|
|
|
+ <u-picker :show="showSource" :columns="sourceColumns" keyName="value" @cancel="showSource = false"
|
|
|
@confirm="pickSource"></u-picker>
|
|
|
<!-- 选择地区 -->
|
|
|
- <u-picker
|
|
|
- :show="showArea"
|
|
|
- @cancel="showArea = false"
|
|
|
- @close="showArea = false"
|
|
|
- :columns="addressColumns"
|
|
|
- @confirm="localConfirm"
|
|
|
- title="请选择所在地"
|
|
|
- keyName="distName"
|
|
|
- itemHeight="80"
|
|
|
- closeOnClickOverlay
|
|
|
- ref="areaPicker"
|
|
|
- @change="changeHandler"
|
|
|
- immediateChange></u-picker>
|
|
|
+ <u-picker :show="showArea" @cancel="showArea = false" @close="showArea = false" :columns="addressColumns"
|
|
|
+ @confirm="localConfirm" title="请选择所在地" keyName="distName" itemHeight="80" closeOnClickOverlay ref="areaPicker"
|
|
|
+ @change="changeHandler" immediateChange></u-picker>
|
|
|
<u-notify ref="uNotify"></u-notify>
|
|
|
<u-toast ref="uToast"></u-toast>
|
|
|
</view>
|
|
|
@@ -168,19 +121,25 @@
|
|
|
areaLoading: false,
|
|
|
areaColumns: [], //省份数据
|
|
|
addressColumns: [], //数据数组
|
|
|
- selectLocation: null, //选中的省市区信息
|
|
|
addForm: {
|
|
|
- name: '', //客户姓名
|
|
|
+ custName: '', //客户姓名
|
|
|
industry: '', //行业
|
|
|
industryId: null,
|
|
|
// level: '', //级别
|
|
|
// levelId: null,
|
|
|
custSource: '', //来源
|
|
|
custSourceId: null,
|
|
|
+ area: "",
|
|
|
+ CustProvinceId: null, //省
|
|
|
+ CustProvince: '',
|
|
|
+ CustCityId: null, //市
|
|
|
+ CustCity: '',
|
|
|
+ CustRegionId: null, //区、县
|
|
|
+ CustRegion: '',
|
|
|
remark: '', //备注
|
|
|
},
|
|
|
rules: {
|
|
|
- name: {
|
|
|
+ custName: {
|
|
|
type: 'string',
|
|
|
required: true,
|
|
|
message: '请填写客户名称',
|
|
|
@@ -225,11 +184,11 @@
|
|
|
// 获取字典数据
|
|
|
getOptions() {
|
|
|
Promise.all([
|
|
|
- distrApi.getProvinceInfo(), //省市区
|
|
|
- // this.getDicts('cust_level'), //级别
|
|
|
- this.getDicts('cust_idy'), //行业
|
|
|
- this.getDicts('cust_source'), //来源
|
|
|
- ])
|
|
|
+ distrApi.getProvinceInfo(), //省市区
|
|
|
+ // this.getDicts('cust_level'), //级别
|
|
|
+ this.getDicts('cust_idy'), //行业
|
|
|
+ this.getDicts('cust_source'), //来源
|
|
|
+ ])
|
|
|
.then(([province, industry, source]) => {
|
|
|
this.areaColumns = province.data.list || []
|
|
|
// this.levelColumns = [level.data.values] || []
|
|
|
@@ -263,15 +222,24 @@
|
|
|
let shi = []
|
|
|
let qu = []
|
|
|
this.areaColumns.forEach((item) => {
|
|
|
- sheng.push({ distName: item.distName, id: item.id })
|
|
|
+ sheng.push({
|
|
|
+ distName: item.distName,
|
|
|
+ id: item.id
|
|
|
+ })
|
|
|
// 设置初始化的数据
|
|
|
if (item.distName == '北京市') {
|
|
|
item.children.forEach((child) => {
|
|
|
- shi.push({ distName: child.distName, id: child.id })
|
|
|
+ shi.push({
|
|
|
+ distName: child.distName,
|
|
|
+ id: child.id
|
|
|
+ })
|
|
|
|
|
|
if (child.distName == '北京市') {
|
|
|
child.children.forEach((el) => {
|
|
|
- qu.push({ distName: el.distName, id: el.id })
|
|
|
+ qu.push({
|
|
|
+ distName: el.distName,
|
|
|
+ id: el.id
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
@@ -302,20 +270,25 @@
|
|
|
let shi = []
|
|
|
let flag = item.children[0].distName
|
|
|
item.children.forEach((val, ol) => {
|
|
|
- shi.push({ distName: val.distName, id: val.id })
|
|
|
+ shi.push({
|
|
|
+ distName: val.distName,
|
|
|
+ id: val.id
|
|
|
+ })
|
|
|
if (shi[0].distName == flag) {
|
|
|
//设置默认开关(选择省份后设置默认城市)
|
|
|
flag = ''
|
|
|
let qu = []
|
|
|
val.children.forEach((vol) => {
|
|
|
- qu.push({ distName: vol.distName, id: vol.id })
|
|
|
+ qu.push({
|
|
|
+ distName: vol.distName,
|
|
|
+ id: vol.id
|
|
|
+ })
|
|
|
})
|
|
|
picker.setColumnValues(2, qu)
|
|
|
}
|
|
|
})
|
|
|
picker.setColumnValues(1, shi)
|
|
|
} else {
|
|
|
- // console.log(item)
|
|
|
picker.setColumnValues(1, [])
|
|
|
picker.setColumnValues(2, [])
|
|
|
}
|
|
|
@@ -328,11 +301,17 @@
|
|
|
if (value[0].distName == item.distName) {
|
|
|
let shi = []
|
|
|
item.children.forEach((val, ol) => {
|
|
|
- shi.push({ distName: val.distName, id: val.id })
|
|
|
+ shi.push({
|
|
|
+ distName: val.distName,
|
|
|
+ id: val.id
|
|
|
+ })
|
|
|
if (value[1].distName == val.distName) {
|
|
|
let qu = []
|
|
|
val.children.forEach((vol) => {
|
|
|
- qu.push({ distName: vol.distName, id: vol.id })
|
|
|
+ qu.push({
|
|
|
+ distName: vol.distName,
|
|
|
+ id: vol.id
|
|
|
+ })
|
|
|
})
|
|
|
picker.setColumnValues(2, qu)
|
|
|
}
|
|
|
@@ -343,10 +322,16 @@
|
|
|
},
|
|
|
// 确认选中的数据
|
|
|
localConfirm(e) {
|
|
|
- this.selectLocation = e
|
|
|
- this.addForm.area = e.value[1]
|
|
|
- ? e.value[0].distName + e.value[1].distName + e.value[2].distName
|
|
|
- : e.value[0].distName
|
|
|
+ if (e.value[1]) {
|
|
|
+ this.addForm.CustProvinceId = e.value[0].id
|
|
|
+ this.addForm.CustProvince = e.value[0].distName
|
|
|
+ this.addForm.CustCityId = e.value[1].id
|
|
|
+ this.addForm.CustCity = e.value[1].distName
|
|
|
+ this.addForm.CustRegionId = e.value[2].id
|
|
|
+ this.addForm.CustRegion = e.value[2].distName
|
|
|
+ this.addForm.area = e.value[0].distName + e.value[1].distName + e.value[2].distName
|
|
|
+ }
|
|
|
+
|
|
|
this.showArea = false
|
|
|
},
|
|
|
handleAdd() {
|
|
|
@@ -354,16 +339,17 @@
|
|
|
.validate()
|
|
|
.then(async () => {
|
|
|
let params = {
|
|
|
- custName: this.addForm.name,
|
|
|
- custIndustry: this.addForm.industry,
|
|
|
- // custLevel: this.addForm.level,
|
|
|
- custIndustry: this.addForm.industry,
|
|
|
+ custName: this.addForm.custName,
|
|
|
+ custIndustry: this.addForm.industryId,
|
|
|
custSource: this.addForm.custSourceId,
|
|
|
- custLocation: this.addForm.area,
|
|
|
+ CustProvinceId: this.addForm.CustProvinceId,
|
|
|
+ CustProvince: this.addForm.CustProvince,
|
|
|
+ CustCityId: this.addForm.CustCityId,
|
|
|
+ CustCity: this.addForm.CustCity,
|
|
|
+ CustRegionId: this.addForm.CustRegionId,
|
|
|
+ CustRegion: this.addForm.CustRegion,
|
|
|
remark: this.addForm.remark,
|
|
|
- custDistCode: this.selectLocation.value[0].id,
|
|
|
}
|
|
|
- // console.log(params)
|
|
|
const [err, res] = await to(customerApi.createCustomer(params))
|
|
|
if (err) return
|
|
|
if (res && res.code == 200) {
|
|
|
@@ -377,7 +363,6 @@
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
- // console.log(err)
|
|
|
this.$refs.uNotify.show({
|
|
|
top: this.height + this.paddingTop + 10,
|
|
|
type: 'warning',
|
|
|
@@ -411,12 +396,14 @@
|
|
|
width: 100%;
|
|
|
height: 284rpx;
|
|
|
background: #3e7ef8;
|
|
|
+
|
|
|
.title {
|
|
|
position: relative;
|
|
|
text-align: center;
|
|
|
font-size: 32rpx;
|
|
|
font-weight: bold;
|
|
|
color: #ffffff;
|
|
|
+
|
|
|
.back {
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
@@ -438,19 +425,22 @@
|
|
|
padding: 0 32rpx;
|
|
|
overflow: auto;
|
|
|
padding-bottom: 64rpx;
|
|
|
+
|
|
|
.form-label {
|
|
|
font-size: 32rpx;
|
|
|
font-weight: bold;
|
|
|
color: #323232;
|
|
|
padding-bottom: 18rpx;
|
|
|
+
|
|
|
.label-tag {
|
|
|
width: 15rpx;
|
|
|
height: 15rpx;
|
|
|
- background: #ff4d4f;
|
|
|
+ background: #ff4d4f;
|
|
|
border-radius: 50%;
|
|
|
margin-right: 10rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.save {
|
|
|
width: 569rpx;
|
|
|
height: 92rpx;
|