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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<template>
  <!--
        作者:wangxw
        时间:2019-11-05
        描述:diy组件 团购
    -->
  <div @click.stop="$parent.$parent.onEditer(index)" class="drag optional" :class="{selected: index === selectedIndex}">
    <div class="supplier" :style="{background: item.style.background}">
      <div class="supplier-time" v-for="(supplier, index) in item.data" :key="index">
        <div class="supplier-data">
          <div class="supplier-name">
            商户名称
          </div>
          <div class="supplier-detail">
            <div  class="supplier-detail-left">
              <img :src="item.style.server_score_image" class="supplier-detail-img">
              <div class="supplier-detail-score">{{supplier.server_score}} {{supplier.server_score_text}}</div>
              <div class="supplier-detail-comment">{{supplier.comment}}条评论</div>
              <div class="supplier-detail-price">¥{{supplier.average_price}}/人</div>
            </div>
            <div class="supplier-detail-right">
              <div class="supplier-detail-distance">{{supplier.distance}}</div>
            </div>
          </div>
          <div class="supplier-detail-discount">
            <div class="discount-left" v-if="supplier.max_reduce_price">
              <div class="discount-left-text">超值券</div>
              <div class="discount-left-price">最高减{{supplier.max_reduce_price}}元</div>
            </div>
            <div class="discount-right" v-if="supplier.ranking<10">好评榜第{{supplier.ranking}}名</div>
          </div>
        </div>
        <div class="supplier-product">
          <div class="product-item" v-for="(product,productKey) in supplier.productList" :key="productKey">
            <div class="product-img">
              <img
                :src="product.product_image"
                alt="">
              <div class="product-discount" v-if="product.reduce_price>0">
                <div class="discount-type">超值券</div>
                <div class="discount-price">减{{product.reduce_price}}元</div>
              </div>
            </div>
            <div class="product-name">
              {{product.product_name}}
            </div>
            <div class="product-price">
              <div class="price">¥{{product.product_price}}</div>
              <div class="buy-btn">抢购</div>
            </div>
          </div>
        </div>
      </div>
      <div class="btn-edit-del">
        <div class="btn-del" @click.stop="$parent.$parent.onDeleleItem(index)">删除</div>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  data() {
    return {};
  },
  created() {
    console.log(this.item)
  },
  props: ['item', 'index', 'selectedIndex'],
  methods: {}
};
</script>
 
<style>
.supplier{
  padding: 12px;
}
.supplier-time{
  background: #ffff;
  margin-bottom: 10px;
  padding: 10px;
}
.supplier-data{
  padding: 5px;
}
.supplier-name{
  font-size: 20px;
  font-weight: bold;
}
.supplier-detail{
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
 
}
.supplier-detail-left{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
}
.supplier-detail-img{
  width: 18px!important;
  height: 18px;
}
.supplier-detail-score{
  font-size: 14px;
  color: #c73a4e;
}
.supplier-detail-comment{
  font-size: 14px;
  color: #7b7b7b;
}
.supplier-detail-price{
  font-size: 14px;
  color: #7b7b7b;
}
.supplier-detail-right{
  color: #7b7b7b;
}
.supplier-detail-discount{
  display: flex;
  align-items: center;
  gap: 10px;
}
.discount-left{
  display: flex;
  justify-content: center;
  align-items: center;
  background: #da5e66;
  border-radius: 5px;
}
.discount-left-text{
  font-size: 12px;
  color: #fff;
  padding: 5px 10px;
  line-height: 1;
}
.discount-left-price{
  font-size: 12px;
  color: #c04960;
  background: #fae7ec;
  padding: 5px 10px;
  border-top-right-radius: 5px;
  border-top-left-radius: 5px;
  border-bottom-right-radius: 5px;
  line-height: 1;
}
.discount-right{
  font-size: 14px;
  background: #f9eee2;
  color: #806849;
  padding: 5px 10px;
  border-radius: 5px;
}
.supplier-product{
  display: flex;
  gap: 10px;
  overflow-x: auto;        /* 启用水平滚动 */
  overflow-y: hidden;      /* 隐藏垂直滚动 */
  -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
  scroll-behavior: smooth; /* 平滑滚动行为(可选) */
  padding: 5px 0;          /* 添加内边距以改善滚动体验 */
  -ms-overflow-style: -ms-autohiding-scrollbar; /* IE/Edge 滚动条隐藏 */
 
}
.product-img{
  width: 110px;
  height: 110px;
  border-radius: 5px;
  position: relative;
}
.product-img img{
  border-radius: 5px;
}
.product-discount{
  position: absolute;
  bottom: 0;
  left: 0;
  font-size: 12px;
  color: #fff;
  background: #e74748;
  border-bottom-left-radius: 5px;
  border-top-right-radius: 5px;
  height: 20px;
  display: flex;
  align-content: center;
  justify-content: space-between;
}
.discount-type{
  padding: 0 5px;
  line-height: 20px;
  background: linear-gradient(to bottom, #e75f4e, #dd8961);
  border-bottom-left-radius: 5px;
  border-top-right-radius: 5px;
}
.discount-price{
  position: relative;
  background: #e74748;
  padding: 0 5px;
  border-bottom-left-radius: 5px;
  border-top-right-radius: 5px;
  line-height: 20px;
}
.product-name{
  font-size: 14px;
  color: #000000;
  white-space: nowrap;        /* 防止文本换行 */
  overflow: hidden;           /* 隐藏溢出内容 */
  text-overflow: ellipsis;    /* 显示省略号 */
  max-width: 110px;           /* 限制最大宽度 */
  margin: 5px 0;
}
.product-price{
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  background: #fbf1ef;
  border-radius: 5px;
  height: 30px;
}
.product-price{
  .price{
    font-size: 12px;
    color: #c73a4e;
    text-align: center;
    width: 60%;
    line-height: 30px;
  }
}
 
.buy-btn {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  width: 50%;
  background: linear-gradient(to right, #c73a4e 20%, #e74c3c 80%);
  text-align: center;
  color: #fff;
  clip-path: polygon(20% 0%, 100% 0%, 100% 100%, 20% 100%, 0% 100%);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  line-height: normal;
  font-size: 12px;
  font-weight: bold;
}
 
.buy-btn:hover {
  opacity: 0.9;
}
 
</style>