Commit d532dc51 by 李伟康

feat(Insurance): 新增购车方式选择功能

- 在 Insurance 组件中添加 carBuyers 组件引用
- 在用户信息中增加 carBuyers 字段用于存储购车方式
- 实现购车方式选择弹窗和数据绑定
1 parent dbdabf98
...@@ -77,15 +77,21 @@ ...@@ -77,15 +77,21 @@
@select="handleSelect($event,'carBrandListVisible')" @select="handleSelect($event,'carBrandListVisible')"
@close="resetFocusIndex" @close="resetFocusIndex"
/> />
<carBuyers
ref="carBuyersVisible"
@select="handleSelect($event,'carBuyersVisible')"
@close="resetFocusIndex"
/>
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import CarBrands from '@/components/CarBrands.vue' import CarBrands from '@/components/CarBrands.vue'
import InsuranceTable from './components/InsuranceTable.vue' import InsuranceTable from './components/InsuranceTable.vue'
import carBuyers from './components/carBuyers.vue'
import CustomerAutocomplete from '@/components/CustomerAutocomplete.vue' import CustomerAutocomplete from '@/components/CustomerAutocomplete.vue'
export default { export default {
components: { CarBrands, InsuranceTable, CustomerAutocomplete }, components: { CarBrands, InsuranceTable, CustomerAutocomplete, carBuyers },
props: { props: {
penSwitch: Boolean, penSwitch: Boolean,
show: Boolean, show: Boolean,
...@@ -126,6 +132,12 @@ export default { ...@@ -126,6 +132,12 @@ export default {
maxlength: 10, maxlength: 10,
unit: '元', unit: '元',
}, },
{
placeholder: '购车方式',
key: 'carBuyers',
type: 'select',
popKey: 'carBuyersVisible',
}
], ],
customerInfo: {}, customerInfo: {},
focusIndex: -1, focusIndex: -1,
...@@ -157,6 +169,8 @@ export default { ...@@ -157,6 +169,8 @@ 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
} else if (popkey == 'carBuyersVisible') {
this.customerInfo.carBuyers = item.name
} else { } else {
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name this.customerInfo.carModel = item.name
...@@ -208,7 +222,7 @@ export default { ...@@ -208,7 +222,7 @@ export default {
height: 100vh; height: 100vh;
background-image: url('@/assets/images/media/insurance-bg.webp'); background-image: url('@/assets/images/media/insurance-bg.webp');
background-size: 100%; background-size: 100%;
&-content{ &-content {
height: 100%; height: 100%;
margin: $margin; margin: $margin;
position: relative; position: relative;
......
<template>
<MessageBox
ref="carBuyersVisible"
position="bottom"
:isFooter="false"
:title="`请选择${title}`"
:maxHeight="1000"
@close="$emit('close')"
>
<view class="select-box">
<view
class="select-item"
:class="{ checked: carBuyers == item.name }"
@click="handleSelect(item)"
v-for="(item, index) in carBuyersList"
:key="index"
>
{{ item.name }}
</view>
</view>
</MessageBox>
</template>
<script type="text/ecmascript-6">
export default {
name: 'carBuyers',
props: {
title: {
type: String,
default: '购车方式'
},
salesPropsUuid: {
type: String,
default: ''
}
},
data () {
return {
carBuyersList: [
{
name: '全款',
id: 1
},
{
name: '按揭',
id: 2
}
]
}
},
watch: {
watchStatus: {
immediate: true,
handler (newval) {
this.close()
}
},
},
computed: {
watchStatus () {
return this.$store.state.user.historyStatus
},
carBuyers () {
return this.$store.state.user.customerInfo.carBuyers
},
},
mounted () {
},
methods: {
open () {
this.$refs.carBuyersVisible.open()
},
handleSelect (item) {
this.close();
this.$emit('select', item)
},
close () {
this.$refs?.carBuyersVisible?.close()
}
}
}
</script>
<style scoped lang="scss">
.select-box {
margin: toRpx(40) 0;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: toRpx(32);
overflow-y: scroll;
max-height: 50vh;
padding-bottom: toRpx(60);
.select-item {
text-align: center;
height: toRpx(68);
line-height: toRpx(44);
opacity: 1;
border: toRpx(2) solid #dce0e6;
color: #333;
font-size: toRpx(32);
border-radius: toRpx(8);
&.checked {
border: toRpx(2) solid #292d33;
}
}
}
</style>
...@@ -19,7 +19,8 @@ export default { ...@@ -19,7 +19,8 @@ export default {
salesUuid: "", salesUuid: "",
staffName: "", staffName: "",
newCarFare: '', newCarFare: '',
carModelId: '' carModelId: '',
carBuyers:''
}, },
historyStatus: Date.now(), historyStatus: Date.now(),
carBrands: [], carBrands: [],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!