card1.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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="goDetail1" v-for="(item,index) in list1" :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" 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 class="card" @click="goDetail(item.id)" v-for="(item,index) in list" :key="index">
  55. <view class="left">
  56. <image :src="item.cover" mode="aspectFill"></image>
  57. </view>
  58. <view class="right" style="width: 100%;">
  59. <view class="title flex justify-between" >
  60. <view class="text-cut-1" style="width: 70%;">
  61. <text class="">{{item.name}}</text>
  62. </view>
  63. <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;">
  64. <image class="" style="width: 32rpx;height: 32rpx;margin-right: 4rpx;" src="@/static/icon/order.png" mode=""></image>
  65. <text>去下单</text>
  66. </view>
  67. </view>
  68. <view class="margin-bottom-20">
  69. <view class="data">
  70. <view class="">
  71. <block>
  72. <u-icon name="star-fill" color="#ff7001" size="30"></u-icon>
  73. <text
  74. style="margin-left: 4rpx;margin-right: 20rpx;color: #ff7001;font-size: 26rpx;">{{item.score}}</text>
  75. </block>
  76. <block>
  77. <text>月售</text>
  78. <text class="margin-left-10">{{item.sales==-1?0:item.sales}}</text>
  79. </block>
  80. </view>
  81. <view>
  82. <u-icon name="map-fill" color="#FF9447"></u-icon>
  83. <text class="margin-left-10">{{distance(item.latitude,item.longitude)}} km</text>
  84. </view>
  85. </view>
  86. <view class="text-cut-2" style="width: 100%;height: 32rpx;margin-top: 14rpx;">
  87. <view v-for="(item1,index1) in item.labelKey.split(',')" :key="index1" class="cu-tag sm "
  88. style="background-color: #fff0d9;color: #ffa353;">
  89. {{item1}}
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. export default{
  100. props:{
  101. list:Array,
  102. list1:Array
  103. },
  104. data(){
  105. return {
  106. activeIndex: 0,
  107. tagsList: [{
  108. title: '智能筛选',
  109. desc: '大数据优选'
  110. },
  111. {
  112. title: '销量最好',
  113. desc: '销量最好'
  114. }, {
  115. title: '评分最高',
  116. desc: '好评如潮'
  117. },
  118. {
  119. title: '距离最近',
  120. desc: '由近到远'
  121. }]
  122. }
  123. },
  124. computed:{
  125. distance() {
  126. return (lat1,lng1) => {
  127. if (this.vuex_location!=null) {
  128. let distance=this.$util.calculateDistance(lat1,lng1,this.vuex_location.latitude,this.vuex_location.longitude)
  129. console.log(distance);
  130. return distance
  131. }else{
  132. return 0
  133. }
  134. };
  135. },
  136. },
  137. methods:{
  138. goDetail(id){
  139. uni.navigateTo({
  140. url:"/pages/consume/detail/shop-detail?id="+id,
  141. fail(err) {
  142. console.log(err);
  143. }
  144. })
  145. },
  146. goDetail1(id){
  147. this.$emit('goDetail1')
  148. },
  149. filter(index){
  150. this.activeIndex=index
  151. console.log(this.activeIndex);
  152. this.$emit('filter',index)
  153. },
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. .filter {
  159. padding: 10rpx;
  160. display: flex;
  161. flex-direction: column;
  162. .con {
  163. display: flex;
  164. flex-direction: column;
  165. justify-content: center;
  166. align-items: center;
  167. .title {
  168. font-size: 28rpx;
  169. font-weight: 800;
  170. }
  171. .tag {
  172. color: #888888;
  173. padding: 4rpx;
  174. margin-top: 10rpx;
  175. font-size: 22rpx;
  176. }
  177. }
  178. .active {
  179. color: #fd5d4a;
  180. .title {
  181. width: 100%;
  182. }
  183. .tag {
  184. border-radius: 20rpx 0 20rpx 0;
  185. background-color: #ffddd5;
  186. color: #fd5d4a;
  187. }
  188. }
  189. }
  190. .item {
  191. display: flex;
  192. flex-direction: column;
  193. margin-top: 50rpx;
  194. .card {
  195. margin-bottom: 15rpx;
  196. display: flex;
  197. border-bottom: 1rpx solid #ececec;
  198. padding-bottom: 10rpx;
  199. .left {
  200. width: 32%;
  201. image {
  202. width: 100%;
  203. border-radius: 8rpx;
  204. height: 175rpx;
  205. }
  206. }
  207. .right {
  208. margin-left: 20rpx;
  209. display: flex;
  210. width: 70%;
  211. flex-direction: column;
  212. justify-content: space-between;
  213. .title {
  214. font-size: 28rpx;
  215. font-weight: 800;
  216. }
  217. .data {
  218. margin-top: 20rpx;
  219. display: flex;
  220. justify-content: space-between;
  221. font-size: 24rpx;
  222. color: #666666;
  223. }
  224. .label {
  225. margin-top: 10rpx;
  226. }
  227. }
  228. }
  229. .card:last-child {
  230. border: none;
  231. margin-bottom: 0;
  232. padding-bottom: 0;
  233. }
  234. }
  235. </style>