card1.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="filter">
  3. <view class="flex justify-around">
  4. <view :class="{active:activeIndex==index}" class="con" :key="index"
  5. v-for="(item,index) in tagsList" @click="filter(index)">
  6. <text class="title">{{item.title}}</text>
  7. <view class="tag">
  8. <text>{{item.desc}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="item">
  13. <view class="card" @click="goDetail(item.id)" v-for="(item,index) in list" :key="index">
  14. <view class="left">
  15. <image :src="item.cover" mode=""></image>
  16. </view>
  17. <view class="right" style="width: 100%;">
  18. <view class="title flex justify-between" >
  19. <view class="text-cut-1" style="width: 70%;">
  20. <text class="">{{item.name}}</text>
  21. </view>
  22. <view @click.stop="$jump(`/pagesD/pages/menu/menu?shopId=${item.id}`)" class="text-base center" style="font-size: 28rpx;font-weight: normal;">
  23. <image class="" style="width: 36rpx;height: 36rpx;margin-right: 4rpx;" src="@/static/icon/order.png" mode=""></image>
  24. <text>去点餐</text>
  25. </view>
  26. </view>
  27. <view class="data">
  28. <view class="">
  29. <block>
  30. <u-icon name="star-fill" color="#ff7001" size="30"></u-icon>
  31. <text
  32. style="margin-left: 4rpx;margin-right: 20rpx;color: #ff7001;font-size: 26rpx;">{{item.score}}</text>
  33. </block>
  34. <block>
  35. <text>月售</text>
  36. <text class="margin-left-10">{{item.sales==-1?0:item.sales}}</text>
  37. </block>
  38. </view>
  39. <view>
  40. <u-icon name="map-fill" color="#FF9447"></u-icon>
  41. <text class="margin-left-10">{{distance(item.latitude,item.longitude)}} km</text>
  42. </view>
  43. </view>
  44. <view class="text-cut-2" style="width: 100%;height: 32rpx;margin-top: 14rpx;">
  45. <view v-for="(item1,index1) in item.labelKey.split(',')" :key="index1" class="cu-tag sm "
  46. style="background-color: #fff0d9;color: #ffa353;">
  47. {{item1}}
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default{
  57. props:{
  58. list:Array
  59. },
  60. data(){
  61. return {
  62. activeIndex: 0,
  63. tagsList: [{
  64. title: '智能筛选',
  65. desc: '大数据优选'
  66. },
  67. {
  68. title: '销量最好',
  69. desc: '销量最好'
  70. }, {
  71. title: '评分最高',
  72. desc: '好评如潮'
  73. },
  74. {
  75. title: '距离最近',
  76. desc: '由近到远'
  77. }]
  78. }
  79. },
  80. computed:{
  81. distance() {
  82. return (lat1,lng1) => {
  83. if (this.vuex_location!=null) {
  84. let distance=this.$util.calculateDistance(lat1,lng1,this.vuex_location.latitude,this.vuex_location.longitude)
  85. console.log(distance);
  86. return distance
  87. }else{
  88. return 0
  89. }
  90. };
  91. },
  92. },
  93. methods:{
  94. goDetail(id){
  95. uni.navigateTo({
  96. url:"/pages/consume/detail/shop-detail?id="+id,
  97. fail(err) {
  98. console.log(err);
  99. }
  100. })
  101. },
  102. filter(index){
  103. this.activeIndex=index
  104. console.log(this.activeIndex);
  105. this.$emit('filter',index)
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .filter {
  112. padding: 10rpx;
  113. display: flex;
  114. flex-direction: column;
  115. .con {
  116. display: flex;
  117. flex-direction: column;
  118. justify-content: center;
  119. align-items: center;
  120. .title {
  121. font-size: 28rpx;
  122. font-weight: 800;
  123. }
  124. .tag {
  125. color: #888888;
  126. padding: 4rpx;
  127. margin-top: 10rpx;
  128. font-size: 22rpx;
  129. }
  130. }
  131. .active {
  132. color: #fd5d4a;
  133. .title {
  134. width: 100%;
  135. }
  136. .tag {
  137. border-radius: 20rpx 0 20rpx 0;
  138. background-color: #ffddd5;
  139. color: #fd5d4a;
  140. }
  141. }
  142. }
  143. .item {
  144. display: flex;
  145. flex-direction: column;
  146. margin-top: 50rpx;
  147. .card {
  148. margin-bottom: 20rpx;
  149. display: flex;
  150. border-bottom: 1rpx solid #ececec;
  151. padding-bottom: 20rpx;
  152. .left {
  153. width: 30%;
  154. image {
  155. width: 100%;
  156. border-radius: 12rpx;
  157. height: 180rpx;
  158. }
  159. }
  160. .right {
  161. margin-left: 20rpx;
  162. display: flex;
  163. width: 70%;
  164. flex-direction: column;
  165. .title {
  166. font-size: 30rpx;
  167. font-weight: 800;
  168. margin-bottom: 30rpx;
  169. }
  170. .data {
  171. margin-top: 20rpx;
  172. display: flex;
  173. justify-content: space-between;
  174. font-size: 24rpx;
  175. color: #666666;
  176. }
  177. .label {
  178. margin-top: 10rpx;
  179. }
  180. }
  181. }
  182. .card:last-child {
  183. border: none;
  184. margin-bottom: 0;
  185. padding-bottom: 0;
  186. }
  187. }
  188. </style>