feat: 客户增加种类选择(顾客/木匠/装修公司)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,6 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="form-card">
|
<view class="form-card">
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="label">客户种类 *</text>
|
||||||
|
<picker :range="typeOptions" range-key="label" @change="onTypeChange">
|
||||||
|
<view class="picker-input">
|
||||||
|
<text :class="form.type ? '' : 'placeholder'">{{ form.typeLabel || '请选择客户种类' }}</text>
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="label">手机号 *</text>
|
<text class="label">手机号 *</text>
|
||||||
<input class="input" v-model="form.phone" placeholder="请输入手机号" type="number" />
|
<input class="input" v-model="form.phone" placeholder="请输入手机号" type="number" />
|
||||||
@@ -27,7 +36,14 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
customerId: '',
|
customerId: '',
|
||||||
|
typeOptions: [
|
||||||
|
{ label: '顾客', value: 'customer' },
|
||||||
|
{ label: '木匠', value: 'carpenter' },
|
||||||
|
{ label: '装修公司', value: 'company' }
|
||||||
|
],
|
||||||
form: {
|
form: {
|
||||||
|
type: '',
|
||||||
|
typeLabel: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
name: '',
|
name: '',
|
||||||
wechat: ''
|
wechat: ''
|
||||||
@@ -42,13 +58,24 @@ export default {
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
this.customerId = options.id
|
this.customerId = options.id
|
||||||
|
this.form.type = options.type || ''
|
||||||
|
this.form.typeLabel = options.typeLabel || ''
|
||||||
this.form.phone = options.phone || ''
|
this.form.phone = options.phone || ''
|
||||||
this.form.name = options.name || ''
|
this.form.name = options.name || ''
|
||||||
this.form.wechat = options.wechat || ''
|
this.form.wechat = options.wechat || ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onTypeChange(e) {
|
||||||
|
const idx = e.detail.value
|
||||||
|
this.form.type = this.typeOptions[idx].value
|
||||||
|
this.form.typeLabel = this.typeOptions[idx].label
|
||||||
|
},
|
||||||
async submit() {
|
async submit() {
|
||||||
|
if (!this.form.type) {
|
||||||
|
uni.showToast({ title: '请选择客户种类', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!this.form.phone) {
|
if (!this.form.phone) {
|
||||||
uni.showToast({ title: '请输入手机号', icon: 'none' })
|
uni.showToast({ title: '请输入手机号', icon: 'none' })
|
||||||
return
|
return
|
||||||
@@ -126,6 +153,28 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.picker-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-input .placeholder {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
.submit-btn {
|
.submit-btn {
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
|
|||||||
@@ -12,7 +12,10 @@
|
|||||||
@click="viewDetail(item)"
|
@click="viewDetail(item)"
|
||||||
>
|
>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<text class="name">{{ item.name }}</text>
|
<view class="name-row">
|
||||||
|
<text class="name">{{ item.name }}</text>
|
||||||
|
<text class="type-tag" v-if="item.type">{{ typeLabelMap[item.type] }}</text>
|
||||||
|
</view>
|
||||||
<text class="phone">{{ item.phone }}</text>
|
<text class="phone">{{ item.phone }}</text>
|
||||||
<text class="wechat" v-if="item.wechat">{{ item.wechat }}</text>
|
<text class="wechat" v-if="item.wechat">{{ item.wechat }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -30,7 +33,8 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
keyword: '',
|
keyword: '',
|
||||||
customers: []
|
customers: [],
|
||||||
|
typeLabelMap: { customer: '顾客', carpenter: '木匠', company: '装修公司' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -49,7 +53,10 @@ export default {
|
|||||||
this.loadCustomers()
|
this.loadCustomers()
|
||||||
},
|
},
|
||||||
viewDetail(item) {
|
viewDetail(item) {
|
||||||
uni.navigateTo({ url: `/pages/customer/create?id=${item.customerId}&name=${item.name}&phone=${item.phone}&wechat=${item.wechat || ''}` })
|
const typeLabelMap = { customer: '顾客', carpenter: '木匠', company: '装修公司' }
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/customer/create?id=${item.customerId}&type=${item.type}&typeLabel=${typeLabelMap[item.type] || ''}&name=${item.name}&phone=${item.phone}&wechat=${item.wechat || ''}`
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,6 +112,20 @@ export default {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.name-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-tag {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #fff;
|
||||||
|
background: #1890ff;
|
||||||
|
padding: 4rpx 12rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.phone, .wechat {
|
.phone, .wechat {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
|
|||||||
Reference in New Issue
Block a user