Commit bb5040ce by 李伟康

Merge branch 'saas+v5.8.3' of http://192.168.3.233:8090/glsx/gl_tape into saas+v5.8.3

2 parents fb3cb51c d6ae98bf
...@@ -40,7 +40,8 @@ export default { ...@@ -40,7 +40,8 @@ export default {
}, },
data () { data () {
return { return {
sellerEmployeeList: [] sellerEmployeeList: [],
defaultEmployeeList: []
} }
}, },
watch: { watch: {
...@@ -56,7 +57,7 @@ export default { ...@@ -56,7 +57,7 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
selectedId () { selectedId () {
if (Array.isArray(this.list) || this.employeeType === 'seller') { if (Array.isArray(this.list) || this.employeeType === 'seller' || this.employeeType === 'default') {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
...@@ -68,6 +69,9 @@ export default { ...@@ -68,6 +69,9 @@ export default {
if (this.employeeType === 'seller') { if (this.employeeType === 'seller') {
return this.sellerEmployeeList return this.sellerEmployeeList
} }
if (this.employeeType === 'default') {
return this.defaultEmployeeList
}
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
}, },
...@@ -94,6 +98,17 @@ export default { ...@@ -94,6 +98,17 @@ export default {
this.sellerEmployeeList = res || [] this.sellerEmployeeList = res || []
return return
} }
if (this.employeeType === 'default') {
if (this.defaultEmployeeList.length) return
const { shopMerchantId, sceneType } = userInfo
const apiTargetName = sceneType == 1 ? 'getEmployeeList' : 'getOrderScreenEmployeeList'
const res = await uni.$api.popupApi[apiTargetName]({
merchantId: shopMerchantId,
sceneList: [sceneType]
})
this.defaultEmployeeList = res || []
return
}
const employeeList = this.$store.state.user.employeeList const employeeList = this.$store.state.user.employeeList
if (employeeList && employeeList.length) return if (employeeList && employeeList.length) return
const { shopMerchantId } = userInfo const { shopMerchantId } = userInfo
......
...@@ -427,7 +427,7 @@ export default { ...@@ -427,7 +427,7 @@ export default {
top: 0; top: 0;
z-index: 2; z-index: 2;
padding: 2px 10px; padding: 2px 10px;
border-radius: 0 0 8px 0; border-radius: 8px 0 8px 0;
background: linear-gradient(270deg, #FF6748 0%, #F24724 100%); background: linear-gradient(270deg, #FF6748 0%, #F24724 100%);
font-size: 12px; font-size: 12px;
line-height: normal; line-height: normal;
......
...@@ -293,41 +293,50 @@ export default { ...@@ -293,41 +293,50 @@ export default {
border-radius: 10px; border-radius: 10px;
background: rgba(44, 102, 247, 0.05); background: rgba(44, 102, 247, 0.05);
box-sizing: border-box; box-sizing: border-box;
min-height: 32px;
.customer-count-left { .customer-count-left,
.customer-count-right {
display: flex; display: flex;
align-items: center; align-items: center;
}
.customer-count-left {
gap: 2px; gap: 2px;
min-width: 0; min-width: 0;
flex: 1;
}
.customer-count-right {
gap: 2px;
flex-shrink: 0;
margin-left: 8px;
} }
.customer-count-icon { .customer-count-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
flex-shrink: 0; flex-shrink: 0;
display: block;
} }
.customer-count-label { .customer-count-label,
font-size: 13px; .customer-count-num,
line-height: normal; .customer-count-unit {
color: #6C6F75; line-height: 16px;
white-space: nowrap; white-space: nowrap;
} }
.customer-count-right { .customer-count-label {
display: flex; font-size: 13px;
align-items: flex-start; color: #6C6F75;
gap: 2px;
flex-shrink: 0;
} }
.customer-count-num, .customer-count-num,
.customer-count-unit { .customer-count-unit {
font-size: 14px; font-size: 14px;
line-height: normal;
font-weight: 500; font-weight: 500;
color: #2C66F7; color: #2C66F7;
white-space: nowrap;
} }
} }
......
...@@ -520,6 +520,7 @@ export default { ...@@ -520,6 +520,7 @@ export default {
methods: { methods: {
handleHomeContentTabClick(index) { handleHomeContentTabClick(index) {
this.homeContentTabIndex = index this.homeContentTabIndex = index
this.getCustomerProfileGroupInfo()
}, },
_syncShowFloatLog() { _syncShowFloatLog() {
this.showFloatLog = FloatLogConfig.isLogBallVisible() this.showFloatLog = FloatLogConfig.isLogBallVisible()
...@@ -708,7 +709,11 @@ export default { ...@@ -708,7 +709,11 @@ export default {
} }
}, },
async changeTab({ item, index }) { async changeTab({ item, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary() if (index == 0) {
this.$refs.messageRef.getMessageSummary()
this.getCustomerProfileGroupInfo()
this.getStrategyStatus()
}
this.previewOff = index != 0 this.previewOff = index != 0
this.$emit('changeTab', index) this.$emit('changeTab', index)
console.log(this.$refs.leftBox.hasPopupOpen) console.log(this.$refs.leftBox.hasPopupOpen)
...@@ -734,6 +739,7 @@ export default { ...@@ -734,6 +739,7 @@ export default {
try { try {
const res = await uni.$api.activityApi.getActivityStatusAPI({ merchantId }) const res = await uni.$api.activityApi.getActivityStatusAPI({ merchantId })
console.log('getStrategyStatus***', res)
if (!res) { if (!res) {
this.marketingActivityHasData = false this.marketingActivityHasData = false
this.customerListHasData = false this.customerListHasData = false
...@@ -792,6 +798,7 @@ export default { ...@@ -792,6 +798,7 @@ export default {
try { try {
const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI({ merchantId }) const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI({ merchantId })
console.log('getCustomerProfileListInfo***')
this.customerProfileList = Array.isArray(res) ? res : [] this.customerProfileList = Array.isArray(res) ? res : []
} catch (error) { } catch (error) {
console.error('查询客户建档分组信息失败:', error) console.error('查询客户建档分组信息失败:', error)
...@@ -833,6 +840,7 @@ export default { ...@@ -833,6 +840,7 @@ export default {
if (res.remainingSkipCount != null) { if (res.remainingSkipCount != null) {
this.prelearnData = { ...this.prelearnData, remainingSkipCount: res.remainingSkipCount } this.prelearnData = { ...this.prelearnData, remainingSkipCount: res.remainingSkipCount }
} }
await this.getPrelearnHome()
} catch (e) { } catch (e) {
// uni.$logger?.local?.info('预学习扣减跳过次数失败', e) // uni.$logger?.local?.info('预学习扣减跳过次数失败', e)
} }
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
></view> ></view>
</view> </view>
<view <view
v-if="item.type === 'single' && hasMinSellPrice(item.minSellPrice)" v-if="item.type === 'single' && hasActivityPrice(item.activityPrice)"
class="min-price" class="min-price"
>活动价 ¥ {{ item.minSellPrice }}</view> >活动价 ¥ {{ item.activityPrice }}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -50,9 +50,9 @@ ...@@ -50,9 +50,9 @@
<view class="child-name">{{ child.name }}</view> <view class="child-name">{{ child.name }}</view>
</view> </view>
<view <view
v-if="hasMinSellPrice(child.minSellPrice)" v-if="hasActivityPrice(child.activityPrice)"
class="min-price" class="min-price"
>活动价 ¥ {{ child.minSellPrice }}</view> >活动价 ¥ {{ child.activityPrice }}</view>
</view> </view>
<view class="card-right"> <view class="card-right">
<view class="current-price">¥ {{ child.sellPrice }}</view> <view class="current-price">¥ {{ child.sellPrice }}</view>
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
} }
}, },
methods: { methods: {
hasMinSellPrice(value) { hasActivityPrice(value) {
return value != null && value !== '' return value != null && value !== ''
}, },
shouldShowMarketingIcon(item) { shouldShowMarketingIcon(item) {
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
/> />
</view> </view>
<image <scroll-view class="detail-scroll" scroll-y>
class="goods-img" <image
:src="displayMainImage" class="goods-img"
mode="aspectFill" :src="displayMainImage"
/> mode="widthFix"
/>
</scroll-view>
<image <image
class="prelearn-entrance" class="prelearn-entrance"
...@@ -146,9 +148,13 @@ export default { ...@@ -146,9 +148,13 @@ export default {
background-color: #000; background-color: #000;
} }
.detail-scroll {
width: 100%;
height: 100vh;
}
.goods-img { .goods-img {
width: 100%; width: 100%;
height: 100%;
display: block; display: block;
} }
......
...@@ -10,29 +10,33 @@ ...@@ -10,29 +10,33 @@
<view class="detail-panel"> <view class="detail-panel">
<view class="form-header">必填信息</view> <view class="form-header">必填信息</view>
<view class="form-box flex"> <view class="form-box flex">
<template v-for="(i, index) in customerForm"> <template v-for="(i, index) in customerForm" >
<view class="form-item flex" :key="index"> <view class="form-item flex" :key="index">
<view class="label flex"> <view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <view class="input-wrap">
:type="i.inputType" <input
:maxlength="i.maxlength" :type="i.inputType"
v-model="customerInfo[i.valueKey]" :maxlength="i.maxlength"
:class="['input', { error: i.error }]" v-model="customerInfo[i.valueKey]"
:placeholder="`请输入${i.label}`" :class="['input', { error: i.error }]"
placeholder-style="color:rgba(51, 51, 51, 0.2);" :placeholder="`请输入${i.label}`"
confirm-type="done" placeholder-style="color:rgba(51, 51, 51, 0.2);"
@blur="inputBlur($event, i)" confirm-type="done"
/> @input="inputChange($event, i)"
@blur="inputBlur($event, i)"
/>
<view class="error-text" v-if="i.error && i.errorMsg">{{ i.errorMsg }}</view>
</view>
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
...@@ -66,23 +70,27 @@ ...@@ -66,23 +70,27 @@
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <view class="input-wrap">
:type="i.inputType" <input
:maxlength="i.maxlength" :type="i.inputType"
v-model="customerInfo[i.valueKey]" :maxlength="i.maxlength"
:class="['input', { error: i.error }]" v-model="customerInfo[i.valueKey]"
:placeholder="`请输入${i.label}`" :class="['input', { error: i.error }]"
placeholder-style="color:rgba(51, 51, 51, 0.2);" :placeholder="`请输入${i.label}`"
confirm-type="done" placeholder-style="color:rgba(51, 51, 51, 0.2);"
@blur="inputBlur($event, i)" confirm-type="done"
/> @input="inputChange($event, i)"
@blur="inputBlur($event, i)"
/>
<view class="error-text" v-if="i.error && i.errorMsg">{{ i.errorMsg }}</view>
</view>
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
...@@ -101,7 +109,7 @@ ...@@ -101,7 +109,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i)" @click="showPopup(i)"
> >
<view class="value text-hide">{{ getFieldDisplayValue(i) || '请选择' }}</view> <view class="value text-hide">{{ getFieldDisplayValue(i) || i.placeholder || `请选择${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>
...@@ -123,11 +131,6 @@ ...@@ -123,11 +131,6 @@
carModelKey="carTypeName" carModelKey="carTypeName"
customBoolean customBoolean
/> />
<reception-sence
ref="receptionSceneVisible"
@select="handleSelect($event, 'receptionSceneVisible')"
:customerInfo="customerInfo"
></reception-sence>
<employee <employee
ref="trafficSourceVisible" ref="trafficSourceVisible"
title="流量来源" title="流量来源"
...@@ -155,7 +158,6 @@ ...@@ -155,7 +158,6 @@
<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 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' import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/, const phoneRex = /^[1]([3-9])[0-9]{9}$/,
...@@ -191,7 +193,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -191,7 +193,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'arrivalDate', valueKey: 'arrivalDate',
key: 'arrivalDate', key: 'arrivalDate',
required: true, required: true,
type: 'date' type: 'date',
dateUnlimited: true
}, },
{ {
label: '流量来源', label: '流量来源',
...@@ -202,14 +205,6 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -202,14 +205,6 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
popKey: 'trafficSourceVisible', popKey: 'trafficSourceVisible',
merchantNameKey: 'merchantName' merchantNameKey: 'merchantName'
} }
// {
// label: '接待场景',
// valueKey: 'receptionSceneName',
// key: 'receptionScene',
// type: 'select',
// required: true,
// popKey: 'receptionSceneVisible'
// }
], ],
default_optionalForm = [{ default_optionalForm = [{
label: '车架号', label: '车架号',
...@@ -223,23 +218,26 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -223,23 +218,26 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
label: '到店日期', label: '到店日期',
valueKey: 'inviteDate', valueKey: 'inviteDate',
key: 'inviteDate', key: 'inviteDate',
type: 'date' type: 'date',
dateFromToday: true
}, },
{ {
label: '建档日期', label: '建档日期',
valueKey: 'filingDate', valueKey: 'filingDate',
key: 'filingDate', key: 'filingDate',
type: 'date' type: 'date',
dateUnlimited: true
},{ },{
label: '驻店零售', label: '驻店零售',
valueKey: 'sellerName', valueKey: 'sellerName',
key: 'sellerUserId', key: 'sellerUserId',
type: 'select', type: 'select',
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible',
placeholder: '请选择驻店零售'
}] }]
export default { export default {
name: 'AddFiles', name: 'AddFiles',
components: { CarBrands, ReceptionSence, Employee }, components: { CarBrands, Employee },
computed: { computed: {
check () { check () {
let { customerForm, customerInfo } = this, let { customerForm, customerInfo } = this,
...@@ -292,9 +290,7 @@ export default { ...@@ -292,9 +290,7 @@ export default {
carTypeName: '', carTypeName: '',
carChildsBrandId: '', carChildsBrandId: '',
carChildsBrandName: '', carChildsBrandName: '',
receptionScene: '',
arrivalDate: '', arrivalDate: '',
receptionSceneName: '',
standNo: '', standNo: '',
employeeName: '', employeeName: '',
userId: '', userId: '',
...@@ -302,7 +298,7 @@ export default { ...@@ -302,7 +298,7 @@ export default {
sellerName: '', sellerName: '',
sellerUserId: '', sellerUserId: '',
inviteDate: '', inviteDate: '',
filingDate: '' filingDate: dayjs().format('YYYY-MM-DD')
} }
this.inviteDateTouched = false this.inviteDateTouched = false
if (this.customerId) this.findVisitsInfo() if (this.customerId) this.findVisitsInfo()
...@@ -315,6 +311,9 @@ export default { ...@@ -315,6 +311,9 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).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
if (!this.customerInfo.filingDate) {
this.customerInfo.filingDate = dayjs().format('YYYY-MM-DD')
}
this.inviteDateTouched = !!res.inviteDate this.inviteDateTouched = !!res.inviteDate
}, },
backPage () { backPage () {
...@@ -357,22 +356,65 @@ export default { ...@@ -357,22 +356,65 @@ export default {
this.customerInfo[field.valueKey] = item.staffName this.customerInfo[field.valueKey] = item.staffName
this.customerInfo[field.key] = item.uuid this.customerInfo[field.key] = item.uuid
} }
} else {
this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id
} }
}, },
getDatePickerStart (field) {
if (field.dateUnlimited) return '1970-01-01'
if (field.dateFromToday) return dayjs().format('YYYY-MM-DD')
return this.startDate
},
getDatePickerEnd (field) {
return field.dateUnlimited ? '2099-12-31' : this.endDate
},
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
const value = e.detail.value const value = e.detail.value
this.customerInfo[valueKey] = value this.customerInfo[valueKey] = value
if (valueKey === 'arrivalDate' && !this.inviteDateTouched) { if (valueKey === 'arrivalDate' && !this.customerInfo.inviteDate) {
this.customerInfo.inviteDate = value this.customerInfo.inviteDate = value
} }
if (valueKey === 'inviteDate') { if (valueKey === 'inviteDate') {
this.inviteDateTouched = true this.inviteDateTouched = true
} }
}, },
getPhoneErrorMsg (phone) {
if (!phone) return '请输入手机号'
if (!/^\d+$/.test(phone)) return '手机号只能包含数字'
if (phone.length < 11) return '手机号应为11位'
if (!phoneRex.test(phone)) return '请输入正确的手机号'
return ''
},
setPhoneFieldError (field, phone) {
const errorMsg = this.getPhoneErrorMsg(phone)
field.error = !!errorMsg
field.errorMsg = errorMsg
return !errorMsg
},
inputChange (e, field) {
if (field.key !== 'customerPhone') return
const value = (e.detail.value || '').replace(/\D/g, '').slice(0, 11)
this.customerInfo.customerPhone = value
if (field.error) {
this.setPhoneFieldError(field, value)
}
},
inputBlur (e, val) { inputBlur (e, val) {
if (val.key === 'customerPhone') {
const phone = (this.customerInfo.customerPhone || '').replace(/\D/g, '')
this.customerInfo.customerPhone = phone
if (phone) {
const valid = this.setPhoneFieldError(val, phone)
if (!valid) {
// uni.showToast({
// title: val.errorMsg,
// icon: 'none'
// })
}
} else {
val.error = false
val.errorMsg = ''
}
return
}
const standNoVal = this.customerInfo.standNo const standNoVal = this.customerInfo.standNo
if (val.key === 'standNo' && standNoVal) { if (val.key === 'standNo' && standNoVal) {
this.customerInfo.standNo = formatVinInput(standNoVal) this.customerInfo.standNo = formatVinInput(standNoVal)
...@@ -411,6 +453,7 @@ export default { ...@@ -411,6 +453,7 @@ export default {
try { try {
this.customerForm.map(e => { this.customerForm.map(e => {
e.error = false e.error = false
e.errorMsg = ''
}) })
let { customerInfo, customerForm, optionalForm } = this, let { customerInfo, customerForm, optionalForm } = this,
{ shopMerchantId, sceneType } = uni.$storage.get("userInfo"), { shopMerchantId, sceneType } = uni.$storage.get("userInfo"),
...@@ -419,7 +462,10 @@ export default { ...@@ -419,7 +462,10 @@ export default {
merchantId: shopMerchantId, merchantId: shopMerchantId,
bussinessScene: sceneType == 0 ? 1 : 2 bussinessScene: sceneType == 0 ? 1 : 2
} }
if (!phoneRex.test(customerInfo.customerPhone)) throw 'customerPhone' const phoneField = customerForm.find(e => e.key === 'customerPhone')
const phone = (customerInfo.customerPhone || '').replace(/\D/g, '')
customerInfo.customerPhone = phone
if (phoneField && !this.setPhoneFieldError(phoneField, phone)) throw 'customerPhone'
customerForm.map(e => { customerForm.map(e => {
params[e.key] = customerInfo[e.key] params[e.key] = customerInfo[e.key]
}) })
...@@ -505,7 +551,18 @@ export default { ...@@ -505,7 +551,18 @@ export default {
} catch (error) { } catch (error) {
const index = this.customerForm.findIndex(e => e.key == error) const index = this.customerForm.findIndex(e => e.key == error)
if (index !== -1) { if (index !== -1) {
this.customerForm[index].error = true const field = this.customerForm[index]
if (error === 'customerPhone') {
this.setPhoneFieldError(field, this.customerInfo.customerPhone)
} else {
field.error = true
}
if (field.errorMsg) {
uni.showToast({
title: field.errorMsg,
icon: 'none'
})
}
} }
uni.hideLoading() uni.hideLoading()
} }
...@@ -586,11 +643,25 @@ export default { ...@@ -586,11 +643,25 @@ export default {
justify-content: space-between; justify-content: space-between;
.form-item { .form-item {
width: toRpx(934); width: toRpx(934);
height: toRpx(80); min-height: toRpx(80);
font-size: toRpx(28); font-size: toRpx(28);
align-items: flex-start;
}
.input-wrap {
width: toRpx(738);
.input {
width: 100%;
}
.error-text {
margin-top: toRpx(8);
font-size: toRpx(24);
line-height: toRpx(32);
color: #f24724;
}
} }
.label { .label {
width: toRpx(192); width: toRpx(192);
height: toRpx(76);
color: #292d33; color: #292d33;
justify-content: center; justify-content: center;
.required { .required {
......
...@@ -42,7 +42,9 @@ ...@@ -42,7 +42,9 @@
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'readonly'"> <template v-if="i.type == 'readonly'">
<view class="input input--readonly text-hide">{{ getFieldDisplayValue(i) || '-' }}</view> <view :class="['input input--readonly text-hide', { placeholderStyle: !getFieldDisplayValue(i) && i.placeholder }]">
{{ getFieldDisplayValue(i) || (i.placeholder || '-') }}
</view>
</template> </template>
<template v-else-if="i.type == 'input'"> <template v-else-if="i.type == 'input'">
<input <input
...@@ -50,7 +52,7 @@ ...@@ -50,7 +52,7 @@
: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)" @blur="inputBlur($event, i)"
...@@ -60,8 +62,8 @@ ...@@ -60,8 +62,8 @@
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
...@@ -99,7 +101,7 @@ ...@@ -99,7 +101,7 @@
: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)" @blur="inputBlur($event, i)"
...@@ -109,8 +111,8 @@ ...@@ -109,8 +111,8 @@
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
...@@ -157,7 +159,7 @@ ...@@ -157,7 +159,7 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
class="input input--count" class="input input--count"
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"
/> />
...@@ -169,7 +171,7 @@ ...@@ -169,7 +171,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.placeholder || '请选择' }}</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>
...@@ -245,7 +247,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -245,7 +247,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'customerPhone', valueKey: 'customerPhone',
key: 'customerPhone', key: 'customerPhone',
type: 'readonly', type: 'readonly',
required: true required: true,
placeholder: '请输入车主手机号'
}, },
{ {
label: '车型', label: '车型',
...@@ -260,7 +263,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -260,7 +263,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'deliveryDate', valueKey: 'deliveryDate',
key: 'deliveryDate', key: 'deliveryDate',
required: true, required: true,
type: 'date' type: 'date',
dateUnlimited: true
}, },
// { // {
// label: '接待场景', // label: '接待场景',
...@@ -290,7 +294,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -290,7 +294,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
label: '到店日期', label: '到店日期',
valueKey: 'inviteDate', valueKey: 'inviteDate',
key: 'inviteDate', key: 'inviteDate',
type: 'date' type: 'date',
dateFromToday: true
}, },
{ {
label: '驻店零售', label: '驻店零售',
...@@ -303,7 +308,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -303,7 +308,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
label: '建档日期', label: '建档日期',
valueKey: 'createdDate', valueKey: 'createdDate',
key: 'createdDate', key: 'createdDate',
type: 'date' type: 'date',
dateUnlimited: true
}], }],
default_groupForm = [ { default_groupForm = [ {
label: '客户群', label: '客户群',
...@@ -317,7 +323,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -317,7 +323,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'contact_name', valueKey: 'contact_name',
key: 'contact_id', key: 'contact_id',
type: 'select', type: 'select',
popKey: 'groupMemberVisible' popKey: 'groupMemberVisible',
placeholder: '请选择群成员'
}, },
{ {
label: '备注', label: '备注',
...@@ -421,15 +428,39 @@ export default { ...@@ -421,15 +428,39 @@ export default {
return map[status] || '' return map[status] || ''
}, },
async getCustormDetail() { async getCustormDetail() {
console.log('getCustormDetailAPI***', this.customerId) if (!this.customerId) {
const res = await uni.$api.customerApi.customerProfileInfoAPI({ return false
id: this.customerId }
}) try {
console.log('getCustormDetailAPI***', res) const res = await uni.$api.customerApi.customerProfileInfoAPI({
if(res) { id: this.customerId
this.customerForm = res })
if (!res || typeof res !== 'object') {
return false
}
if (res.deliveryDate) {
res.deliveryDate = dayjs(res.deliveryDate).format('YYYY-MM-DD')
}
if (res.createdDate) {
res.createdDate = dayjs(res.createdDate).format('YYYY-MM-DD')
}
if (res.inviteDate) {
res.inviteDate = dayjs(res.inviteDate).format('YYYY-MM-DD')
}
Object.assign(this.customerInfo, res)
if (!this.customerInfo.contact_id && res.wxId) {
this.customerInfo.contact_id = res.wxId
}
if (!this.customerInfo.contact_name && res.wxName) {
this.customerInfo.contact_name = res.wxName
}
this.syncDisplayInfo(this.customerInfo)
await this.getCustomerGroupInfo()
return true
} catch (error) {
console.error('getCustormDetail 失败', error)
return false
} }
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm)
}, },
async submitCustomerProfileAPI(options = {}) { async submitCustomerProfileAPI(options = {}) {
const { fromReception = false } = options const { fromReception = false } = options
...@@ -587,11 +618,22 @@ export default { ...@@ -587,11 +618,22 @@ export default {
} }
}, },
async getCustomerGroupMemberInfoAPI(contactId) { async getCustomerGroupMemberInfoAPI(contactId) {
const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({ const qwGroupId = contactId || this.customerInfo.qwGroupId
qwGroupId: contactId if (!qwGroupId) {
}) this.groupMemberList = []
console.log('群成员getCustomerGroupMemberInfoAPI***', data) return false
this.groupMemberList = Array.isArray(data) ? data : [] }
try {
const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({
qwGroupId
})
this.groupMemberList = Array.isArray(data) ? data : []
return this.groupMemberList.length > 0
} catch (error) {
console.error('getCustomerGroupMemberInfoAPI 失败', error)
this.groupMemberList = []
return false
}
}, },
syncDisplayInfo (info = this.customerInfo) { syncDisplayInfo (info = this.customerInfo) {
this.headerSnapshot = { this.headerSnapshot = {
...@@ -633,7 +675,7 @@ export default { ...@@ -633,7 +675,7 @@ export default {
receptionSceneName: '', receptionSceneName: '',
standNo: '', standNo: '',
inviteDate: '', inviteDate: '',
createdDate: '', createdDate: dayjs().format('YYYY-MM-DD'),
employeeName: '', employeeName: '',
userId: '', userId: '',
merchantName: '', merchantName: '',
...@@ -655,6 +697,9 @@ export default { ...@@ -655,6 +697,9 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
// 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name) // 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name)
Object.assign(this.customerInfo, res) Object.assign(this.customerInfo, res)
if (!this.customerInfo.createdDate) {
this.customerInfo.createdDate = dayjs().format('YYYY-MM-DD')
}
if (!this.customerInfo.contact_id && res.wxId) { if (!this.customerInfo.contact_id && res.wxId) {
this.customerInfo.contact_id = res.wxId this.customerInfo.contact_id = res.wxId
} }
...@@ -719,6 +764,14 @@ export default { ...@@ -719,6 +764,14 @@ export default {
this.customerInfo.receptionScene = item.id this.customerInfo.receptionScene = item.id
} }
}, },
getDatePickerStart (field) {
if (field.dateUnlimited) return '1970-01-01'
if (field.dateFromToday) return dayjs().format('YYYY-MM-DD')
return this.startDate
},
getDatePickerEnd (field) {
return field.dateUnlimited ? '2099-12-31' : this.endDate
},
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value this.customerInfo[valueKey] = e.detail.value
}, },
......
...@@ -10,6 +10,14 @@ export function getGoodsDisplayName(goods) { ...@@ -10,6 +10,14 @@ export function getGoodsDisplayName(goods) {
return goods.goodsAlias || goods.upgradeGoodsName || goods.goodsInfo?.goodsName || goods.baseGoodsName || '' return goods.goodsAlias || goods.upgradeGoodsName || goods.goodsInfo?.goodsName || goods.baseGoodsName || ''
} }
// 活动价:商品列表返回的原始售价,加入订单时快照,不随用户改价变化
export function getGoodsActivityPrice(goods) {
if (!goods) return undefined
const price = goods.oldPrice ?? goods.upgradePrice ?? goods.price
if (price == null || price === '') return undefined
return price
}
function buildSingleApprovalItem(item, goods, number) { function buildSingleApprovalItem(item, goods, number) {
const sellPrice = normalizeGoodsPrice(goods.sellPrice) const sellPrice = normalizeGoodsPrice(goods.sellPrice)
if (!isBelowMinSellPrice(goods, sellPrice)) return null if (!isBelowMinSellPrice(goods, sellPrice)) return null
...@@ -17,7 +25,7 @@ function buildSingleApprovalItem(item, goods, number) { ...@@ -17,7 +25,7 @@ function buildSingleApprovalItem(item, goods, number) {
type: 'single', type: 'single',
name: getGoodsDisplayName(goods), name: getGoodsDisplayName(goods),
sellPrice, sellPrice,
minSellPrice: goods.minSellPrice, activityPrice: getGoodsActivityPrice(goods),
number: number || '1', number: number || '1',
sourceItem: item sourceItem: item
} }
...@@ -47,7 +55,7 @@ function buildPackageApprovalItem(item, orderTypeCode) { ...@@ -47,7 +55,7 @@ function buildPackageApprovalItem(item, orderTypeCode) {
return { return {
name: getGoodsDisplayName(goods), name: getGoodsDisplayName(goods),
sellPrice, sellPrice,
minSellPrice: goods.minSellPrice, activityPrice: getGoodsActivityPrice(goods),
number: item.packageGoods.number || '1', number: item.packageGoods.number || '1',
sourceGoods: goods sourceGoods: goods
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!