commonCell.vue
2.6 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
119
120
121
122
123
124
125
126
127
128
129
<template>
<view class="box">
<u-cell-group v-if="headTitle !== ''" :border="false">
<u-cell :title="headTitle" :titleStyle="{color: '#333', fontSize: '24rpx'}">
<text slot="right-icon" style="font-size: 24rpx;font-weight: 500;" :style="{color: colorState(state)}">{{ orderState(state) }}</text>
</u-cell>
</u-cell-group>
<view class="orderInfo">
<view class="order_line" :class="{isBorder: border}" v-for="(item, index) in lineInfo" :key="index">
<text class="left_text">{{ item.title }}</text>
<u-avatar v-if="item.type === 'avatar'" :src="userInfo[item.valueName]"></u-avatar>
<text v-if="item.type === 'text'">{{ item.valueName }}</text>
<u--input
v-if="item.type === 'input'"
:customStyle="{border: 0, width: '200rpx'}"
:placeholder="userInfo[item.valueName]"
v-model="userInfo[item.valueName]"
inputAlign="right"
color="#333"
fontSize="13px"
border="surround"
@blur="UpdataInfo"
/>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
lineInfo: {
type: Array,
require: true
},
border: {
type: Boolean,
default: false
},
headTitle: {
type: String,
default: ''
},
rightTitle: {
type: String,
default: ''
},
state: {
type: Number,
default: 0
}
},
data(){
return {
userInfo: {
avatar: 'https://cdn.uviewui.com/uview/album/1.jpg',
nickname: 'CLOOL',
sex: '男',
phoneNum: '13336668888',
Birthday: '1999-12-26'
},
}
},
computed: {
orderState(){
return (index) => {
let orderObj ={
1: '已完成',
2: '待支付',
3: '待评价',
4: '已取消',
5: '退款/售后',
6: '待使用'
}
return orderObj[index]
}
},
colorState(){
return (index) => {
let colorObj ={
1: '#FFA100',
2: '#F33B10',
3: '#FFA100',
4: '#999999',
5: '#F33B10',
6: '#999999'
}
return colorObj[index]
}
}
},
methods: {
UpdataInfo(value){
this.$emit('updataInfo', this.userInfo)
},
showQR(){
this.$emit('showQRcode', true)
}
}
}
</script>
<style lang="scss" scoped>
.box{
background: #FFFFFF;
border-radius: 12rpx;
box-sizing: border-box;
}
.orderInfo{
padding: 0 30rpx;
.order_line{
display: flex;
align-items: center;
justify-content: space-between;
height: 90rpx;
font-size: 26rpx;
color: #333;
&.isBorder {
border-bottom: 2rpx solid #E1E1E1;
}
&:last-child{
border-bottom: 0;
}
.left_text{
color: #666;
}
}
}
</style>