Commit eca5b1a6 by 李伟康

```

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

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