EquityTire.vue
2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<template>
<view class="equity-tire">
<GlCell
:formList="[formList]"
:formData="tireObj"
@handleLabelTips="handleLabelTips"
>
<template #tireHtml>
<view class="tire-box">
<template v-for="(i,index) in tireList">
<view
class="tire-item"
:key="index"
>
<view class="label flex">
{{i.name}}
<template v-if="index == 0">
<view
class="tips"
@click="handleLabelTips(i)"
>位置示例</view>
</template>
</view>
<view class="content">
<GlCell
:formList="[i.list]"
:formData="tireObj"
:index="index"
:cellBoxStyle="cellBoxStyle"
/>
</view>
</view>
</template>
</view>
</template>
</GlCell>
</view>
</template>
<script type='text/ecmascript-6'>
import { TIRE_FORM_LIST, TIRE_LIST } from './contant'
import utils from '@/utils/utils'
import GlCell from '@/components/Form/GlCell.vue'
export default {
name: 'EquityTire',
props: {
externalData: null,
},
components: {
GlCell,
},
data () {
return {
formList: utils.deepClone(TIRE_FORM_LIST),
tireList: utils.deepClone(TIRE_LIST),
cellBoxStyle: 'background: #f5f7fa;',
tireObj: {}
}
},
watch: {
externalData: {
handler (val) {
if (Object.keys(this.tireObj).length) return
const keyList = [
'tireBrand', 'tireScale',
'leftFrontDTO', 'leftFrontBatch',
'rightFrontDTO', 'rightFrontBatch',
'leftRearDTO', 'leftRearBatch',
'rightRearDTO', 'rightRearBatch'
]
keyList.map(key => {
this.tireObj[key] = val[key]
})
},
deep: true,
immediate: true
}
},
mounted () {
},
methods: {
handleLabelTips (item) {
let { tipsUrl } = item
uni.previewImage({
urls: [tipsUrl]
})
},
}
}
</script>
<style scoped lang='scss'>
.tire-box {
display: grid;
grid-template-columns: repeat(2, 1fr);
padding: 0 toRpx(32);
gap: toRpx(16) toRpx(32);
.tire-item {
.label {
height: toRpx(68);
color: #999999;
font-size: toRpx(26);
.tips {
color: #4673ff;
font-size: toRpx(24);
margin-left: toRpx(8);
}
}
.content {
border-radius: toRpx(16);
}
}
}
</style>