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