gx
queenwuli
2021-01-15 4b80c98ef5fda8d6358778f2efe8bb35cb20ccf9
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
133
134
135
<template>
    <!-- 充值卡 -->
    <view>
        <view class="list">
            <view class="list-item">
                <text>商品编码</text>
                <text>{{productInfo.goodsNo}}</text>
            </view>
            <view class="list-item">
                <text>商品分类</text>
                <text>{{productInfo.goodsType}}</text>
            </view>
            <view class="list-item">
                <text>赠送金额</text>
                <text>{{productInfo.giftPrice || 0}}</text>
            </view>
            <view class="list-item">
                <text>充值卡使用范围</text>
                <text>{{productInfo.carIsAll | formatCard}}</text>
            </view>
            <view class="list-item">
                <text>最大使用次数</text>
                <text>{{productInfo.maxUseCnt || '-'}}</text>
            </view>
            <view class="list-item">
                <text>每人限购次数</text>
                <text>{{productInfo.limitBuyCnt || '-'}}</text>
            </view>
            <view class="list-item">
                <text>最大销售数量</text>
                <text>{{productInfo.maxSaleCnt || '-'}}</text>
            </view>
        </view>
        <view class="list">
            <view class="title">
                <text>卡项产品可消费类型</text>
            </view>
            <uni-collapse accordion="true">
                <uni-collapse-item :title="item.name" :showAnimation="true" v-for="item in list">
                    <view class="list-row-wrap">
                        <view class="list-row" v-for="op in item.children">
                            {{op.name}}
                        </view>
                    </view>
                </uni-collapse-item>
            </uni-collapse>
        </view>
        
        <view class="list">
            <view class="title">
                <text>卡项产品可消费产品</text>
            </view>
            <view class="list-item" v-for="item in productInfo.assembleProj">
                <text>{{item.name}}</text>
            </view>
        </view>
    </view>
</template>
 
<script>
    import uniCollapse from '../../../components/uni-collapse/uni-collapse.vue'
    import uniCollapseItem from '../../../components/uni-collapse-item/uni-collapse-item.vue'
    export default{
        components: {
            uniCollapse,
            uniCollapseItem
        },
        props:{
            productInfo: {
                default: {}
            }
        },
        data(){
            return {
                list: []
            }
        },
        filters:{
            formatCard(val){
                if(val==='是'){
                    return '所有产品'
                } else {
                    return '部分产品'
                }
            }
        },
        created() {
            let arr = [];
            this.productInfo.cardCategory.forEach((item) => {
                if(item.parentId === 0){
                    item.children = [];
                    arr.push(item)
                }
            });
            arr.forEach((item) => {
                this.productInfo.cardCategory.forEach((op) => {
                    if(op.parentId === item.id){
                        item.children.push(op)
                    }
                });
            });
            this.list = arr;
        }
    }
</script>
 
<style>
    .list{
        background: #FFFFFF;
        padding: 0 10px;
        font-size: 14px;
    }
    .list .title{
        text-align: center;
        padding: 20px 0 8px;
        font-size: 16px;
    }
    .list-item{
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #EDEAF4;
        padding: 12px 0;
    }
    .list-row-wrap{
        font-size: 13px;
        padding: 0 40rpx 10rpx;
        color: #999;
    }
    .list-row{
        line-height: 24px;
    }
    .uni-collapse-cell--open{
        background-color: #F6F6F8;
    }
</style>