Commit 186cabf2 by Lin

feat(客户页面):重构文件路径并添加新的客户页面

- 更新了 JSON 和 Vue 和 Vue 组件中的文件路径,以反映 'customerPages' 下的新结构。
- 新增了用于添加和查看客户文件的组件。
- 更新了 prelearnBridge.vue 中的默认 URL,以提升功能表现。
- 添加了日历图标资源,供新客户表单使用。
1 parent 7e43fa71
...@@ -138,14 +138,14 @@ export default { ...@@ -138,14 +138,14 @@ export default {
methods: { methods: {
handleGoCustomerFiles() { handleGoCustomerFiles() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/common/customFiles/addFiles', url: '/pages/common/customerPages/addFiles',
animationType: 'pop-in', animationType: 'pop-in',
animationDuration: 100 animationDuration: 100
}) })
}, },
handleGoCustomerDetail(item) { handleGoCustomerDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/customFiles/detailFiles?customerId=${item.id}`, url: `/pages/common/customerPages/detailFiles?customerId=${item.id}`,
animationType: 'pop-in', animationType: 'pop-in',
animationDuration: 100 animationDuration: 100
}) })
......
...@@ -161,13 +161,13 @@ ...@@ -161,13 +161,13 @@
} }
}, },
{ {
"path": "pages/common/customFiles/addFiles", "path": "pages/common/customerPages/addFiles",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/common/customFiles/detailFiles", "path": "pages/common/customerPages/detailFiles",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
......
...@@ -21,9 +21,10 @@ ...@@ -21,9 +21,10 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]" :class="['input', { error: i.error }]"
placeholder="请选择" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
@blur="inputBlur($event, i)"
/> />
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
...@@ -36,8 +37,12 @@ ...@@ -36,8 +37,12 @@
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"> <view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || `请选择${i.label}` }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <image
class="calendar-icon"
:src="require('@/assets/images/common/icon-calendar.png')"
mode="aspectFit"
/>
</view> </view>
</picker> </picker>
</template> </template>
...@@ -46,7 +51,7 @@ ...@@ -46,7 +51,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)" @click="showPopup(i.popKey)"
> >
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || `请选择${i.label}` }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -66,9 +71,10 @@ ...@@ -66,9 +71,10 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]" :class="['input', { error: i.error }]"
placeholder="请选择" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
@blur="inputBlur($event, i)"
/> />
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
...@@ -81,8 +87,12 @@ ...@@ -81,8 +87,12 @@
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"> <view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || `请选择${i.label}` }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <image
class="calendar-icon"
:src="require('@/assets/images/common/icon-calendar.png')"
mode="aspectFit"
/>
</view> </view>
</picker> </picker>
</template> </template>
...@@ -114,11 +124,6 @@ ...@@ -114,11 +124,6 @@
carModelKey="brandModel" carModelKey="brandModel"
customBoolean customBoolean
/> />
<customer-tags
ref="customerTagstVisible"
@select="handleSelect($event, 'customerTagstVisible')"
:chooseList="tagsList"
></customer-tags>
<reception-sence <reception-sence
ref="receptionSceneVisible" ref="receptionSceneVisible"
@select="handleSelect($event, 'receptionSceneVisible')" @select="handleSelect($event, 'receptionSceneVisible')"
...@@ -144,9 +149,9 @@ ...@@ -144,9 +149,9 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import CarBrands from '@/components/CarBrands.vue' import CarBrands from '@/components/CarBrands.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import CustomerTags from '@/components/HomeFrame/components/ReceptionCenter/CustomerTags.vue'
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue' import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue'
import Employee from '@/components/Employee.vue' import Employee from '@/components/Employee.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/, const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{ default_customerForm = [{
...@@ -177,11 +182,20 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -177,11 +182,20 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
popKey: 'carBrandVisible' popKey: 'carBrandVisible'
}, },
{ {
label: '流量来源',
valueKey: 'residentSaleName',
key: 'residentSaleId',
type: 'select',
required: true,
popKey: 'residentSaleVisible'
},
{
label: '交付日期', label: '交付日期',
valueKey: 'arrivalDate', valueKey: 'arrivalDate',
key: 'arrivalDate', key: 'arrivalDate',
required: true,
type: 'date' type: 'date'
}, }
// { // {
// label: '接待场景', // label: '接待场景',
// valueKey: 'receptionSceneName', // valueKey: 'receptionSceneName',
...@@ -189,15 +203,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -189,15 +203,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
// type: 'select', // type: 'select',
// required: true, // required: true,
// popKey: 'receptionSceneVisible' // popKey: 'receptionSceneVisible'
// }, // }
{ ],
label: '流量来源',
valueKey: 'customerTagName',
key: 'customerTagName',
type: 'select',
required: true,
popKey: 'customerTagstVisible'
}],
default_optionalForm = [{ default_optionalForm = [{
label: '车架号', label: '车架号',
valueKey: 'standNo', valueKey: 'standNo',
...@@ -213,22 +220,21 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -213,22 +220,21 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
type: 'date' type: 'date'
}, },
{ {
label: '建档日期',
valueKey: 'filingDate',
key: 'filingDate',
type: 'date'
},{
label: '驻店零售', label: '驻店零售',
valueKey: 'residentSaleName', valueKey: 'residentSaleName',
key: 'residentSaleId', key: 'residentSaleId',
type: 'select', type: 'select',
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible'
},
{
label: '建档日期',
valueKey: 'filingDate',
key: 'filingDate',
type: 'date'
}] }]
export default { export default {
name: 'AddFiles', name: 'AddFiles',
components: { CarBrands, CustomerTags, ReceptionSence, Employee }, components: { CarBrands, ReceptionSence, Employee },
computed: { computed: {
check () { check () {
let { customerForm, customerInfo } = this, let { customerForm, customerInfo } = this,
...@@ -241,19 +247,6 @@ export default { ...@@ -241,19 +247,6 @@ export default {
result = error result = error
} }
return result return result
},
tagsList () {
let list = [],
{ customerInfo, customerTag } = this,
names = customerInfo.customerTagName ? customerInfo.customerTagName.split('|') : [],
isd = customerTag ? customerTag.split(',') : []
names.map((e, index) => {
list.push({
labelName: e,
labelId: isd[index]
})
})
return list
} }
}, },
data () { data () {
...@@ -264,7 +257,7 @@ export default { ...@@ -264,7 +257,7 @@ export default {
customerInfo: {}, customerInfo: {},
startDate: '', startDate: '',
endDate: '', endDate: '',
customerTag: '' validateState: true
} }
}, },
onLoad (options) { onLoad (options) {
...@@ -289,7 +282,6 @@ export default { ...@@ -289,7 +282,6 @@ export default {
brandModel: '', brandModel: '',
receptionScene: '', receptionScene: '',
arrivalDate: '', arrivalDate: '',
customerTagName: '',
receptionSceneName: '', receptionSceneName: '',
standNo: '', standNo: '',
residentSaleName: '', residentSaleName: '',
...@@ -302,8 +294,6 @@ export default { ...@@ -302,8 +294,6 @@ export default {
const res = await uni.$api.customerApi.findVisitsInfo({ const res = await uni.$api.customerApi.findVisitsInfo({
id: this.customerId id: this.customerId
}) })
if (res.customerTag) this.customerTag = res.customerTag
res.customerTagName = res.customerTagName.replace(/,/g, '|')
if (res.arrivalDate) res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD") if (res.arrivalDate) res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD")
if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD") if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD")
this.customerInfo = res this.customerInfo = res
...@@ -330,15 +320,6 @@ export default { ...@@ -330,15 +320,6 @@ export default {
oneCarBrand: item.carBrand, oneCarBrand: item.carBrand,
oneCarBrandId: item.carBrandId oneCarBrandId: item.carBrandId
}) })
} else if (popkey == 'customerTagstVisible') {
let names = [],
ids = []
item.map(i => {
names.push(i.labelName)
ids.push(i.labelId)
})
this.customerInfo.customerTagName = names.join('|')
this.customerTag = ids.join(',')
} else if (popkey == 'residentSaleVisible') { } else if (popkey == 'residentSaleVisible') {
this.customerInfo.residentSaleName = item.staffName this.customerInfo.residentSaleName = item.staffName
this.customerInfo.residentSaleId = item.uuid this.customerInfo.residentSaleId = item.uuid
...@@ -350,17 +331,50 @@ export default { ...@@ -350,17 +331,50 @@ export default {
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value this.customerInfo[valueKey] = e.detail.value
}, },
inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo
if (val.key === 'standNo' && standNoVal) {
this.customerInfo.standNo = formatVinInput(standNoVal)
validateVin(this.customerInfo.standNo)
.then(result => {
const { valid } = result.data
this.validateState = valid
})
.catch(() => {
this.validateState = false
})
} else if (val.key === 'standNo') {
this.validateState = true
}
},
async submit () { async submit () {
if (this.check) return if (this.check) return
const carVin = this.customerInfo.standNo
if (carVin) {
this.customerInfo.standNo = formatVinInput(carVin)
if (this.customerInfo.standNo.length !== 17) {
uni.showToast({
title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',
icon: 'none'
})
return
}
if (!this.validateState) {
uni.showToast({
title: '车架号校验不匹配,请核对后重新输入',
icon: 'none'
})
return
}
}
try { try {
this.customerForm.map(e => { this.customerForm.map(e => {
e.error = false e.error = false
}) })
let { customerInfo, customerForm, optionalForm, customerTag } = this, let { customerInfo, customerForm, optionalForm } = this,
{ shopMerchantId, sceneType } = uni.$storage.get("userInfo"), { shopMerchantId, sceneType } = uni.$storage.get("userInfo"),
targetApi = customerInfo.id ? 'updateVisitsInfo' : 'saveVisitsInfo', targetApi = customerInfo.id ? 'updateVisitsInfo' : 'saveVisitsInfo',
params = { params = {
customerTag,
merchantId: shopMerchantId, merchantId: shopMerchantId,
bussinessScene: sceneType == 0 ? 1 : 2 bussinessScene: sceneType == 0 ? 1 : 2
} }
...@@ -379,7 +393,6 @@ export default { ...@@ -379,7 +393,6 @@ export default {
oneCarBrand: customerInfo.oneCarBrand, oneCarBrand: customerInfo.oneCarBrand,
oneCarBrandId: customerInfo.oneCarBrandId oneCarBrandId: customerInfo.oneCarBrandId
}) })
params.customerTagName = params.customerTagName.replace(/|/g, ',')
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
...@@ -547,6 +560,13 @@ export default { ...@@ -547,6 +560,13 @@ export default {
flex-shrink: 0; flex-shrink: 0;
} }
.calendar-icon {
width: 16px;
height: 16px;
margin-left: auto;
flex-shrink: 0;
}
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
......
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
}, },
}, },
onLoad(options) { onLoad(options) {
const defaultUrl = 'http://192.168.1.68:3001/gl-agent-position/?demo=prelearn-bridge' const defaultUrl = 'http://192.168.1.68:4173/prelearning.html'
this.webviewUrl = options.url ? decodeURIComponent(options.url) : defaultUrl this.webviewUrl = options.url ? decodeURIComponent(options.url) : defaultUrl
console.log('[prelearn bridge demo] open url:', this.webviewUrl) console.log('[prelearn bridge demo] open url:', this.webviewUrl)
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!