shop-card.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view @click="nevigateToDetail(shopId)">
  3. <view class="shop-card">
  4. <view class="shop-info">
  5. <image :src="shopIcon" class="shop-icon"></image>
  6. <view class="shop-details">
  7. <view class="shop-name">{{ shopName }}</view>
  8. <view class="shop-extra">
  9. <text>月售{{ shopInfo+' ' }} </text>
  10. <text>{{' ' + shopdistance }}km</text>
  11. </view>
  12. <view class="shop-rating">
  13. <van-rate :value="mark" disabled size="18" />
  14. </view>
  15. </view>
  16. </view>
  17. <view class="shop-right">
  18. <view class="shop-tags">
  19. <view class="tag" v-for="(item, index) in tag" :key="index">{{ item }}</view>
  20. </view>
  21. <view class="shop-coupons">
  22. <view class="coupon" v-for="(coupon, index) in coupon" :key="index">
  23. <!-- <view class="coupon-title">{{ coupon.title }}</view>-->
  24. <view class="coupon-desc">{{ coupon.desc }}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. components: {
  34. },
  35. props: {
  36. shopId: { default: 0 },
  37. shopName: { default: '麦当劳' },
  38. shopIcon: { default: '../../static/R.jpg' },
  39. shopInfo: { default: '月售10单' },
  40. shopdistance: { default: 2.5 },
  41. tag: { default: () => ['新建路炸鸡热销榜第2名'] },
  42. coupon: {
  43. default: () => [
  44. { desc: '满20减2', full: 20, count: 2 },
  45. { desc: '满50减8', full: 50, count: 8 }
  46. ]
  47. },
  48. mark: { default: 4.5 }
  49. },
  50. methods: {
  51. nevigateToDetail(item){
  52. console.log(item)
  53. console.log(this.shopId)
  54. console.log('这里')
  55. uni.navigateTo({
  56. url: `/subpkg/shopdetail/shopdetail?shopID=${JSON.stringify(item)}`
  57. })
  58. },
  59. },
  60. }
  61. </script>
  62. <style lang="scss">
  63. .shop-card {
  64. display: flex;
  65. justify-content: space-between;
  66. align-items: center;
  67. padding: 15px;
  68. background-color: #fff;
  69. border-radius: 10%;
  70. box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  71. }
  72. .shop-info {
  73. display: flex;
  74. align-items: center;
  75. }
  76. .shop-icon {
  77. width: 60px;
  78. height: 60px;
  79. border-radius: 20%;
  80. margin-right: 15px;
  81. }
  82. .shop-details {
  83. display: flex;
  84. flex-direction: column;
  85. }
  86. .shop-name {
  87. font-weight: bold;
  88. font-size: 16px;
  89. }
  90. .shop-extra {
  91. font-size: 13px;
  92. color: #999;
  93. margin-top: 5px;
  94. }
  95. .shop-rating {
  96. margin-top: 5px;
  97. }
  98. .shop-right {
  99. display: flex;
  100. flex-direction: column;
  101. align-items: flex-end;
  102. }
  103. .shop-tags {
  104. display: flex;
  105. margin-bottom: 10px;
  106. }
  107. .tag {
  108. background-color: #f5f5f5;
  109. color: red;
  110. padding: 5px 10px;
  111. border-radius: 15px;
  112. font-size: 10px;
  113. margin-left: 5px;
  114. }
  115. .shop-coupons {
  116. display: flex;
  117. flex-direction: column;
  118. }
  119. .coupon {
  120. background-color: #fef0e5;
  121. color: #e6a23c;
  122. padding: 8px 12px;
  123. border-radius: 8px;
  124. font-size: 10px;
  125. margin-bottom: 5px;
  126. }
  127. .coupon-title {
  128. font-weight: bold;
  129. font-size: 13px;
  130. }
  131. </style>
  132. <!--<template>-->
  133. <!-- <view class="shop-card">-->
  134. <!-- <view class="shop-info">-->
  135. <!-- <image :src="shopIcon" class="shop-icon"></image>-->
  136. <!-- <view class="shop-details">-->
  137. <!-- <view class="shop-name">{{ shopName }}</view>-->
  138. <!-- <view class="shop-extra">-->
  139. <!-- <text>{{ shopInfo }}</text>-->
  140. <!-- <text>{{ shopdistance }}km</text>-->
  141. <!-- </view>-->
  142. <!-- </view>-->
  143. <!-- </view>-->
  144. <!-- <view class="shop-tags">-->
  145. <!-- <view class="tag" v-for="(item, index) in tag" :key="index">{{ item }}</view>-->
  146. <!-- </view>-->
  147. <!-- </view>-->
  148. <!--</template>-->
  149. <!--<script>-->
  150. <!--export default {-->
  151. <!-- data() {-->
  152. <!-- return {};-->
  153. <!-- },-->
  154. <!-- props: {-->
  155. <!-- shopId: {default:0},-->
  156. <!-- shopName: {default:'麦当劳'},-->
  157. <!-- shopIcon: {default:'../../static/R.jpg'},-->
  158. <!-- shopInfo: {default:'月售10单'},-->
  159. <!-- shopdistance: {default:2.5},-->
  160. <!-- tag: {default:['新建路炸鸡热销榜第2名']},-->
  161. <!-- coupon: {default:[{title:'满减优惠',desc:'满20减2',full:20,count:2},{title:'满减优惠',desc:'满50减8',full:50,count:8}]},-->
  162. <!-- mark: {default:4.5},-->
  163. <!-- }-->
  164. <!--}-->
  165. <!--</script>-->
  166. <!--<style lang="scss">-->
  167. <!--.shop-card {-->
  168. <!-- display: flex;-->
  169. <!-- justify-content: space-between;-->
  170. <!-- align-items: center;-->
  171. <!-- padding: 10px;-->
  172. <!-- background-color: #fff;-->
  173. <!-- border-radius: 5px;-->
  174. <!-- box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);-->
  175. <!--}-->
  176. <!--.shop-info {-->
  177. <!-- display: flex;-->
  178. <!-- align-items: center;-->
  179. <!--}-->
  180. <!--.shop-icon {-->
  181. <!-- width: 50px;-->
  182. <!-- height: 50px;-->
  183. <!-- border-radius: 50%;-->
  184. <!-- margin-right: 10px;-->
  185. <!--}-->
  186. <!--.shop-details {-->
  187. <!-- display: flex;-->
  188. <!-- flex-direction: column;-->
  189. <!--}-->
  190. <!--.shop-name {-->
  191. <!-- font-weight: bold;-->
  192. <!--}-->
  193. <!--.shop-extra {-->
  194. <!-- font-size: 12px;-->
  195. <!-- color: #999;-->
  196. <!--}-->
  197. <!--.shop-tags {-->
  198. <!-- display: flex;-->
  199. <!--}-->
  200. <!--.tag {-->
  201. <!-- background-color: #f5f5f5;-->
  202. <!-- color: #333;-->
  203. <!-- padding: 5px 10px;-->
  204. <!-- border-radius: 15px;-->
  205. <!-- font-size: 12px;-->
  206. <!-- margin-left: 5px;-->
  207. <!--}-->
  208. <!--</style>-->
  209. <!--&lt;!&ndash;<template>&ndash;&gt;-->
  210. <!--&lt;!&ndash; <view>&ndash;&gt;-->
  211. <!--&lt;!&ndash; </view>&ndash;&gt;-->
  212. <!--&lt;!&ndash;</template>&ndash;&gt;-->
  213. <!--&lt;!&ndash;<script>&ndash;&gt;-->
  214. <!--&lt;!&ndash;export default {&ndash;&gt;-->
  215. <!--&lt;!&ndash; data() {&ndash;&gt;-->
  216. <!--&lt;!&ndash; return {};&ndash;&gt;-->
  217. <!--&lt;!&ndash; },&ndash;&gt;-->
  218. <!--&lt;!&ndash; props: {&ndash;&gt;-->
  219. <!--&lt;!&ndash; shopId:0,&ndash;&gt;-->
  220. <!--&lt;!&ndash; shopName:'麦当劳',&ndash;&gt;-->
  221. <!--&lt;!&ndash; shopIcon:'../../static/R.jpg',&ndash;&gt;-->
  222. <!--&lt;!&ndash; shopInfo:'月售10单',&ndash;&gt;-->
  223. <!--&lt;!&ndash; shopdistance:2.5,&ndash;&gt;-->
  224. <!--&lt;!&ndash; tag:['新建路炸鸡热销榜第2名'],&ndash;&gt;-->
  225. <!--&lt;!&ndash; }&ndash;&gt;-->
  226. <!--&lt;!&ndash;}&ndash;&gt;-->
  227. <!--&lt;!&ndash;</script>&ndash;&gt;-->
  228. <!--&lt;!&ndash;<style lang="scss">&ndash;&gt;-->
  229. <!--&lt;!&ndash;</style>&ndash;&gt;-->