#
whycq
2023-10-07 e3a9edfa7a5fe7be708eaf84ea534bbde700d1e0
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
130
131
132
<template>
    <view >
        <view class="main">
            <view class="main-left" >
                <view class="main-list" v-for="it in dataList" style="width: 100%;">
                    <view class="left-key">{{it.key}}</view>
                    <view>:</view>
                    <view class="left-val">
                        <text class="val-text" style="">{{it.value}}</text>
                    </view>
                </view>
            </view>
            <uni-badge class="main-right uni-badge-left-margin" :text="index" absolute="rightTop" size="small" type="primary">
                <view @click="goDetail">
                    <view class="list-options">
                        <uni-icons class="opt-icon" type="right" size="20" color="#707070"></uni-icons>
                    </view>
                </view>
            </uni-badge>
        </view>
    </view>
</template>
 
<script>
    export default {
        name:"z-data-list",
        data() {
            return {
                dataList: [
                    {key: '商品编码',value: 'fbr3242'},
                    {key: '批号',value: '20231006'},
                    {key: '数量',value: '200'},
                    {key: '商品编码',value: 'fbr3242'},
                    {key: '批号',value: '20231006'},
                    {key: '数量',value: '200'}
                ],
                detailList: [],
                dataKey: {}
            };
        },
        methods: {
            goDetail() {
                this.$emit('goDetail');
            }
        },
        created() {
            this.dataList = this.list.detl
        },
        props: {
            list: {
                type: Object,
                default() {
                    return {}
                }
            },
            keyName: {
                type: Object,
                default() {
                    return {}
                }
            },
            index: {
                type: Number,
                default: 2
            }
        }
    }
</script>
<!-- align-items: stretch -->
<!-- 牛逼!!! -->
<!-- 设置align-items为stretch,使子元素填充垂直方向的可用高度,实现高度相等的效果。 -->
<style scoped>
    .main {
        position: relative;
        min-height: 70rpx;
        background-color: #ebe7e6;
        display: flex;
        align-items: stretch;
        margin: 8px 8px 8px 8px;
        border-radius: 16rpx;
    }
    .main-left {
        flex: 7;
        display: flex;
        flex-direction: column;
        padding-top: 8rpx;
        padding-bottom: 8rpx;
        color: #444;
        font-size: 14px;
    }
    .main-right {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        border-left: 1px solid #ffffff;
    }
    .main-list {
        display: flex;
        align-items: center;
        margin: 8rpx 0;
    }
    .list-options {
        display: flex;
        flex-direction: column;
    }
    .list-number {
        position: absolute;
        right: 10px;
        top: 5px;
    }
    .opt-icon {
        display: flex;
    }
    .left-key {
        width: 130rpx;
        padding-right: 8rpx;
        text-align: end;
        font-weight: 700;
    }
    .left-val {
        flex: 1;
        padding-left: 8rpx;
        color: #666;
    }
    .val-text {
        background-color: blue;
        padding: 2px 4px;
        border-radius: 8rpx;
        color: white;
    }
</style>