Commit eca5b1a6 by 李伟康

```

feat(boutique): 优惠券弹窗组件新增车型选择功能

- 新增CarBrands组件用于车型选择
- 修改表单配置,将车型字段从text类型改为select类型
- 添加品牌车型选择逻辑,支持品牌和子品牌的选择
- 更新数据绑定,区分customerInfo和carInfo数据结构
- 增加车型选择的必填验证
- 优化车型信息的显示逻辑,支持动态数据展示
- 修改优惠券接收状态检查时的数据结构引用
```
1 parent 0ffe837c
...@@ -32,6 +32,21 @@ ...@@ -32,6 +32,21 @@
> >
<view :class="['label',{required:i.required}]">{{ i.label }}</view> <view :class="['label',{required:i.required}]">{{ i.label }}</view>
<view :class="['value', { error: showError(i.key) && i.required },{disabled: pageParams.received}]"> <view :class="['value', { error: showError(i.key) && i.required },{disabled: pageParams.received}]">
<template v-if="i.addHtml">
<view
:class="['select', `${pageParams.carInfo[i.key]? '' : 'placeholder'}`]"
@click="showPopup(i.popKey)"
:key="selectKey"
>
{{ pageParams.carInfo[i.key] || i.placeholder }}
<uni-icons
class="arrow"
type="down"
:size="16"
></uni-icons>
</view>
</template>
<template v-else>
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <input
:type="i.inputType" :type="i.inputType"
...@@ -61,6 +76,7 @@ ...@@ -61,6 +76,7 @@
<template v-else> <template v-else>
<view class="text">{{ customerInfo[i.key] }}</view> <view class="text">{{ customerInfo[i.key] }}</view>
</template> </template>
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -77,7 +93,14 @@ ...@@ -77,7 +93,14 @@
:key="idx" :key="idx"
> >
<view class="label">{{ j.label }}</view> <view class="label">{{ j.label }}</view>
<view class="value-text">{{ customerInfo[j.key] || '--'}}</view> <view class="value-text">
<template v-if="j.addHtml">
{{ pageParams.carInfo[j.key] || '--'}}
</template>
<template v-else>
{{ customerInfo[j.key] || '--'}}
</template>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -147,6 +170,11 @@ ...@@ -147,6 +170,11 @@
>生成专属二维码</view> >生成专属二维码</view>
</view> </view>
</MessageBox> </MessageBox>
<car-brands
:linkage="false"
ref="carBrandListVisible"
@select="handleSelect($event, 'carBrandListVisible')"
/>
<employee <employee
ref="employeeBoxVisible" ref="employeeBoxVisible"
@select="handleSelect($event,'employeeBoxVisible')" @select="handleSelect($event,'employeeBoxVisible')"
...@@ -179,6 +207,8 @@ ...@@ -179,6 +207,8 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import Employee from '@/components/Employee.vue' import Employee from '@/components/Employee.vue'
import qrcode from '@/utils/qrcode.js' import qrcode from '@/utils/qrcode.js'
import CarBrands from '@/components/CarBrands.vue'
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/;
import dayjs from 'dayjs' import dayjs from 'dayjs'
const formObject_boutique = [{ const formObject_boutique = [{
...@@ -201,10 +231,12 @@ const formObject_boutique = [{ ...@@ -201,10 +231,12 @@ const formObject_boutique = [{
}, },
{ {
label: "品牌车型", label: "品牌车型",
key: "carModel", type: "select",
type: "text",
popKey: "carBrandListVisible", popKey: "carBrandListVisible",
placeholder: '请选择车型' placeholder: '请选择车型',
addHtml: 'carbrand',
key: 'name',
required: true
}, },
{ {
label: "交付专员", label: "交付专员",
...@@ -233,12 +265,22 @@ export default { ...@@ -233,12 +265,22 @@ export default {
title: String, title: String,
tips: String tips: String
}, },
components: { Employee }, components: { Employee, CarBrands },
watch: { watch: {
watchCustomerInfo: { watchCustomerInfo: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
this.customerInfo = Object.assign(this.customerInfo, newval) this.customerInfo = Object.assign(this.customerInfo, newval)
if (newval.carModel) {
this.pageParams.carInfo = {
carChildsBrandId: newval.carChildsBrandId,
carChildsBrandName: newval.carChildsBrandName,
carBrandId: newval.carBrandId,
carBrand: newval.carBrand,
id: newval.carSeriesId,
name: newval.carModel
}
}
try { try {
// 监听完成接待修改数据,同步修改生成优惠券按钮状态 // 监听完成接待修改数据,同步修改生成优惠券按钮状态
const { customerName, phoneNumber, staffName } = this.customerInfo const { customerName, phoneNumber, staffName } = this.customerInfo
...@@ -268,6 +310,21 @@ export default { ...@@ -268,6 +310,21 @@ export default {
}, },
show () { show () {
this.closeAllPopup() this.closeAllPopup()
},
carInfo: {
handler (newval) {
console.log(newval, '===')
this.pageParams.carInfo = {
carChildsBrandId: newval.carChildsBrandId,
carChildsBrandName: newval.carChildsBrandName,
carBrandId: newval.carBrandId,
carBrand: newval.carBrand,
id: newval.id,
name: newval.name
}
},
deep: true,
immediate: true
} }
}, },
computed: { computed: {
...@@ -419,11 +476,18 @@ export default { ...@@ -419,11 +476,18 @@ export default {
if (popkey == "employeeBoxVisible") { if (popkey == "employeeBoxVisible") {
this.customerInfo.salesUuid = item.uuid; this.customerInfo.salesUuid = item.uuid;
this.customerInfo.staffName = item.staffName; this.customerInfo.staffName = item.staffName;
this.$store.dispatch("setCustomerInfo", this.customerInfo);
} else { } else {
this.$refs.carBrandListVisible.close(); this.$refs.carBrandListVisible.close();
this.customerInfo.carModel = item.name; this.pageParams.carInfo = {
carChildsBrandId: item.carChildsBrandId,
carChildsBrandName: item.carChildsBrandName,
carBrandId: item.carBrandId,
carBrand: item.carBrand,
id: item.id,
name: item.name
}
} }
this.$store.dispatch("setCustomerInfo", this.customerInfo);
this.selectKey = Date.now() this.selectKey = Date.now()
const { customerName, phoneNumber, staffName } = this.customerInfo const { customerName, phoneNumber, staffName } = this.customerInfo
this.isCheck = customerName && phoneNumber && staffName this.isCheck = customerName && phoneNumber && staffName
...@@ -455,7 +519,7 @@ export default { ...@@ -455,7 +519,7 @@ export default {
if (this.pageParams.received) return if (this.pageParams.received) return
if (!this.isCheck) return // 按钮置灰的情况 if (!this.isCheck) return // 按钮置灰的情况
try { try {
const { pageParams: { clickFlag, couponId }, carInfo, customerInfo } = this, { const { pageParams: { clickFlag, couponId, carInfo }, customerInfo } = this, {
shopMerchantId } = uni.$storage.get("userInfo"), shopMerchantId } = uni.$storage.get("userInfo"),
validateStatus = await this.validate(), validateStatus = await this.validate(),
checkCouponAmount = await this.checkCouponAmount(couponId, [shopMerchantId]) checkCouponAmount = await this.checkCouponAmount(couponId, [shopMerchantId])
...@@ -512,7 +576,7 @@ export default { ...@@ -512,7 +576,7 @@ export default {
try { try {
this.pageParams.received = false this.pageParams.received = false
this.pageParams.qrTimer = setInterval(async () => { this.pageParams.qrTimer = setInterval(async () => {
const { pageParams: { couponId }, customerInfo } = this, const { pageParams: { couponId ,carInfo }, customerInfo } = this,
res = await uni.$api.boutiqueApi.findCustomerReceivedStatus({ res = await uni.$api.boutiqueApi.findCustomerReceivedStatus({
merchantCouponId: couponId, merchantCouponId: couponId,
customerPhone: customerInfo.phoneNumber, customerPhone: customerInfo.phoneNumber,
...@@ -524,7 +588,7 @@ export default { ...@@ -524,7 +588,7 @@ export default {
this.$emit('reception', { this.$emit('reception', {
item: { item: {
customerName: customerInfo.customerName, customerName: customerInfo.customerName,
carSeriesName: customerInfo.carModel, carSeriesName: carInfo.name,
customerPhone: customerInfo.phoneNumber, customerPhone: customerInfo.phoneNumber,
userId: customerInfo.salesUuid, userId: customerInfo.salesUuid,
employeeName: customerInfo.staffName, employeeName: customerInfo.staffName,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!