|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
<view class="page"> |
|
|
|
|
<uni-card v-if="customerId" :is-shadow="false" :border="false" is-full> |
|
|
|
|
<view class="info"> |
|
|
|
|
<view class="name">{{ form.customerName }}</view> |
|
|
|
|
<view class="name"><image class="school" src="@/static/image/school.png" mode="widthFix"></image>{{ form.customerName }}</view> |
|
|
|
|
<view class="text">客户类型:{{ customerType }}</view> |
|
|
|
|
<view class="text">产品到期时间:{{ form.expireDate || '' }}</view> |
|
|
|
|
</view> |
|
|
|
@ -11,7 +11,7 @@ |
|
|
|
|
<view class="block"> |
|
|
|
|
<view class="l-title">基本信息</view> |
|
|
|
|
<view class="form-list"> |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view :class="['line req', {err: err === 'customerName'}]"> |
|
|
|
|
<view class="name">客户名称</view> |
|
|
|
|
<view v-if="isDetail" class="val">{{ form.customerName }}</view> |
|
|
|
|
<view v-else :class="['ph', {val: form.customerName}]" @click="schoolVisible = true">{{ form.customerName || '请选择学校' }}</view> |
|
|
|
@ -24,30 +24,30 @@ |
|
|
|
|
<view class="name">城市</view> |
|
|
|
|
<view class="val">{{ form.cityName }}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view :class="['line req', {err: err === 'industryClass'}]"> |
|
|
|
|
<view class="name">行业类型</view> |
|
|
|
|
<view v-if="isDetail" class="val">{{ form.industryClassName }}</view> |
|
|
|
|
<uni-data-picker v-else class="picker-input" placeholder="请选择行业类型" popup-title="请选择行业类型" preload :clear-icon="false" :localdata="industryClassList" :map="{text: 'industryClassName', value: 'industryClassId'}" v-model="form.industryClassId" @change="industryClassChange"></uni-data-picker> |
|
|
|
|
</view> |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view :class="['line req', {err: err === 'industry'}]"> |
|
|
|
|
<view class="name">行业</view> |
|
|
|
|
<view v-if="isDetail" class="val">{{ form.industryName }}</view> |
|
|
|
|
<uni-data-picker v-else class="picker-input" placeholder="请选择行业" popup-title="请选择行业" preload :clear-icon="false" :localdata="industryList" :map="{text: 'industryName', value: 'industryId'}" v-model="form.industryId" :readonly="form.industryClassId ? false : true"></uni-data-picker> |
|
|
|
|
<uni-data-picker v-else class="picker-input" placeholder="请选择行业" popup-title="请选择行业" preload :clear-icon="false" :localdata="industryList" :map="{text: 'industryName', value: 'industryId'}" v-model="form.industryId" :readonly="form.industryClassId ? false : true" @change="handleErr('industry')"></uni-data-picker> |
|
|
|
|
</view> |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view :class="['line req', {err: err === 'name'}]"> |
|
|
|
|
<view class="name">联系人姓名</view> |
|
|
|
|
<view v-if="isDetail" class="val">{{ form.name }}</view> |
|
|
|
|
<input v-else type="text" placeholder="请输入" v-model="form.name"> |
|
|
|
|
<input v-else type="text" placeholder="请输入" v-model="form.name" @change="handleErr('name')"> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">手机</view> |
|
|
|
|
<view v-if="isDetail" class="val">{{ form.phone }}</view> |
|
|
|
|
<input v-else type="number" maxlength="11" placeholder="请输入" v-model="form.phone"> |
|
|
|
|
</view> |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view :class="['line req', {err: err === 'account'}]"> |
|
|
|
|
<view class="name">账号</view> |
|
|
|
|
<view v-if="isDetail" class="val">{{ form.account }}</view> |
|
|
|
|
<input v-else type="text" placeholder="请以院校首字母+admin的格式来设置" v-model="form.account"> |
|
|
|
|
<input v-else type="text" placeholder="请以院校首字母+admin的格式来设置" v-model="form.account" @change="handleErr('account')"> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">职务</view> |
|
|
|
@ -72,15 +72,15 @@ |
|
|
|
|
|
|
|
|
|
<view v-if="isDetail" class="action"> |
|
|
|
|
<view class="item" @click="toPage(`../clientDetail/clientDetail?customerId=${customerId}`)"> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="20" color="#959595"></uni-icons> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons> |
|
|
|
|
<view class="text">编辑</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item" @click="toPage(`/order/ordered/ordered?customerId=${customerId}`)"> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="20" color="#959595"></uni-icons> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="30" color="#959595"></uni-icons> |
|
|
|
|
<view class="text">已订阅产品</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item" @click="toPage(`/order/curClient/curClient?customerId=${customerId}&name=${form.customerName}`)"> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-dingdan" size="20" color="#959595"></uni-icons> |
|
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-dingdan" size="30" color="#959595"></uni-icons> |
|
|
|
|
<view class="text">订单</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -148,6 +148,7 @@ |
|
|
|
|
schoolId: '' |
|
|
|
|
}, |
|
|
|
|
customerType: '', |
|
|
|
|
err: '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -228,10 +229,16 @@ |
|
|
|
|
schoolId |
|
|
|
|
}).then(res => { |
|
|
|
|
this.nameRepeat = false |
|
|
|
|
this.handleErr('customerName') |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.nameRepeat = true |
|
|
|
|
this.err = 'customerName' |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 处理错误提示 |
|
|
|
|
handleErr(val) { |
|
|
|
|
if (val === this.err) this.err = '' |
|
|
|
|
}, |
|
|
|
|
// 获取行业类 |
|
|
|
|
getIndustryClass() { |
|
|
|
|
queryIndustryClass().then(({ list }) => { |
|
|
|
@ -240,6 +247,7 @@ |
|
|
|
|
}, |
|
|
|
|
// 行业分类选择回调 |
|
|
|
|
industryClassChange() { |
|
|
|
|
this.handleErr('industryClass') |
|
|
|
|
this.getIndustry() |
|
|
|
|
}, |
|
|
|
|
// 获取行业 |
|
|
|
@ -259,20 +267,54 @@ |
|
|
|
|
const refs = this.$refs |
|
|
|
|
const { form } = this |
|
|
|
|
const { schoolId, industryClassId, industryId, name, account } = form |
|
|
|
|
if (!schoolId) return this.$util.errMsg('请选择客户!')
if (this.nameRepeat) return this.$util.errMsg('客户已存在!')
if (!industryClassId) return this.$util.errMsg('请选择行业类型!')
if (!industryId) return this.$util.errMsg('请选择行业!')
if (!name) return this.$util.errMsg('请输入联系人姓名!')
if (!account) return this.$util.errMsg('请输入账号!') |
|
|
|
|
if (!schoolId) { |
|
|
|
|
this.err = 'customerName' |
|
|
|
|
return this.$util.errMsg('请选择客户!') |
|
|
|
|
}
if (this.nameRepeat) { |
|
|
|
|
this.err = 'customerName' |
|
|
|
|
return this.$util.errMsg('客户已存在!') |
|
|
|
|
}
if (!industryClassId) { |
|
|
|
|
this.err = 'industryClass' |
|
|
|
|
return this.$util.errMsg('请选择行业类型!') |
|
|
|
|
}
if (!industryId) { |
|
|
|
|
this.err = 'industry' |
|
|
|
|
return this.$util.errMsg('请选择行业!') |
|
|
|
|
}
if (!name) { |
|
|
|
|
this.err = 'name' |
|
|
|
|
return this.$util.errMsg('请输入联系人姓名!') |
|
|
|
|
}
if (!account) { |
|
|
|
|
this.err = 'account' |
|
|
|
|
return this.$util.errMsg('请输入账号!') |
|
|
|
|
} |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '提交中' |
|
|
|
|
}) |
|
|
|
|
if (this.customerId) { |
|
|
|
|
updateCustomer(form).then(res => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
this.$util.sucMsg('编辑成功') |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.$util.to('../clients/clients') |
|
|
|
|
}, 1500) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} else { |
|
|
|
|
addCustomer(form).then(res => { |
|
|
|
|
this.$util.errMsg('创建客户成功!你现在可以去订单给客户下单了。', 2000) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
addCustomer(form).then(({ customerId }) => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
const that = this |
|
|
|
|
uni.showModal({ |
|
|
|
|
title: '提示', |
|
|
|
|
content: '创建客户成功,是否马上为该客户创建订单?', |
|
|
|
|
success: function (res) { |
|
|
|
|
if (res.confirm) { |
|
|
|
|
// 选择是则直接跳转到新建订单页面,并且选中当前新加的客户 |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: `/order/orderDetail/orderDetail?customerId=${customerId}` |
|
|
|
|
}) |
|
|
|
|
} else if (res.cancel) { |
|
|
|
|
uni.navigateBack() |
|
|
|
|
}, 1500) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -287,10 +329,16 @@ |
|
|
|
|
} |
|
|
|
|
.info { |
|
|
|
|
.name { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
margin-bottom: 5px; |
|
|
|
|
font-size: 16px; |
|
|
|
|
color: #333; |
|
|
|
|
} |
|
|
|
|
.school { |
|
|
|
|
width: 48rpx; |
|
|
|
|
margin-right: 10rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.action { |
|
|
|
|
z-index: 2; |
|
|
|
|