-shop.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view v-if="storeDetail">
  3. <!-- 商店信息 -->
  4. <view class="store-info" >
  5. <view class="logo">
  6. <u-image width="120rpx" mode="aspectFit" height="120rpx" :src="storeDetail.storeLogo"></u-image>
  7. </view>
  8. <view class="name-star star-con">
  9. <text class="name">{{ storeDetail.storeName }}</text>
  10. <view>
  11. <text :class="{ star: storeDetail.store_service_credit > 0 }"></text>
  12. <text :class="{ star: storeDetail.store_service_credit > 1 }"></text>
  13. <text :class="{ star: storeDetail.store_service_credit > 2 }"></text>
  14. <text :class="{ star: storeDetail.store_service_credit > 3 }"></text>
  15. <text :class="{ star: storeDetail.store_service_credit > 4 }"></text>
  16. </view>
  17. </view>
  18. <view class="to-store-btn" @click="tostorePage(goodsDetail)">
  19. <view>进店逛逛</view>
  20. </view>
  21. </view>
  22. <view class="store-recommend" id="main8">
  23. <view class="store-recommend-title">商品推荐</view>
  24. <view class="recommend-list">
  25. <view class="recommend-item" @click="clickGoods(item)" v-for="(item, index) in res" :key="index">
  26. <u-image class="recommend-item-img" :fade="true" duration="450" :lazy-load="true" :src="item.thumbnail" height="218rpx">
  27. <u-loading slot="loading"></u-loading>
  28. <view slot="error" style="font-size: 24rpx; ">加载失败</view>
  29. </u-image>
  30. <view class="recommend-item-name">
  31. {{ item.goodsName }}
  32. </view>
  33. <view class="item-price" v-if="item.price != undefined">
  34. ¥<span class="item-price-blod">{{ formatPrice(item.price)[0] }}</span>.{{ formatPrice(item.price)[1] }}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {};
  45. },
  46. props: ["res", "goodsDetail", "storeDetail"],
  47. mounted() {},
  48. methods: {
  49. // 格式化金钱 1999 --> [1999,00]
  50. formatPrice(val) {
  51. if (typeof val == "undefined") {
  52. return val;
  53. }
  54. return val.toFixed(2).split(".");
  55. },
  56. // 点击商品
  57. clickGoods(val) {
  58. uni.navigateTo({
  59. url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`
  60. });
  61. },
  62. tostorePage(val) {
  63. uni.navigateTo({
  64. url: "../product/shopPage?id=" + val.storeId,
  65. });
  66. },
  67. },
  68. };
  69. </script>
  70. <style lang="scss" scoped>
  71. @import "../product.scss";
  72. .recommend-item-name {
  73. height: 70rpx;
  74. color: #333;
  75. font-weight: 400;
  76. font-size: 24rpx;
  77. overflow: hidden;
  78. text-overflow: ellipsis;
  79. display: -webkit-box;
  80. -webkit-line-clamp: 2;
  81. -webkit-box-orient: vertical;
  82. }
  83. .item-price-blod {
  84. font-weight: bold;
  85. font-size: 32rpx;
  86. }
  87. .recommend-item {
  88. width: 30%;
  89. margin: 10rpx 0rpx;
  90. overflow: hidden;
  91. border-radius: 12rpx;
  92. /deep/ .u-image__image {
  93. height: 218rpx;
  94. border-radius: 12rpx !important;
  95. }
  96. }
  97. .recommend-item-img {
  98. /deep/ .u-image__image {
  99. width: 100% !important;
  100. }
  101. }
  102. .recommend-list-view {
  103. width: 100%;
  104. }
  105. .store-info {
  106. display: flex;
  107. justify-content: space-between;
  108. background: #fff;
  109. padding: 40rpx 20rpx 50rpx;
  110. .logo {
  111. overflow: hidden;
  112. border-radius: 6px;
  113. > img {
  114. width: 100%;
  115. height: 100%;
  116. }
  117. }
  118. .name-star {
  119. flex: 1;
  120. margin-left: 20rpx;
  121. padding: 10rpx 0;
  122. font-size: 30rpx;
  123. .name {
  124. width: 100%;
  125. font-weight: 700;
  126. font-size: 28rpx;
  127. line-height: 24px;
  128. }
  129. }
  130. .to-store-btn {
  131. padding: 20rpx 0;
  132. > view {
  133. font-size: 24rpx;
  134. color: #fff;
  135. width: 160rpx;
  136. height: 60rpx;
  137. line-height: 60rpx;
  138. text-align: center;
  139. background: $main-color;
  140. border-radius: 28rpx;
  141. }
  142. }
  143. }
  144. /* star */
  145. .star-con {
  146. display: flex;
  147. flex-direction: column;
  148. view {
  149. flex: 1;
  150. display: flex;
  151. align-items: center;
  152. .star {
  153. width: 30rpx;
  154. height: 30rpx;
  155. background: url(https://image.shutterstock.com/image-vector/star-icon-vector-illustration-260nw-474687040.jpg);
  156. background-size: 100%;
  157. }
  158. }
  159. }
  160. .recommend-list {
  161. display: flex;
  162. flex-wrap: wrap;
  163. justify-content: space-between;
  164. /deep/ .u-row {
  165. width: 100%;
  166. }
  167. .item-price {
  168. margin: 10rpx 0 20rpx 0;
  169. text-align: left;
  170. font-weight: bold;
  171. overflow: hidden;
  172. white-space: nowrap;
  173. margin: 18rpx 0;
  174. font-size: 22rpx;
  175. color: $jd-color;
  176. }
  177. .recommend-list-con {
  178. display: flex;
  179. flex-direction: column;
  180. width: 32%;
  181. margin-bottom: 24rpx;
  182. }
  183. .name {
  184. overflow: hidden;
  185. white-space: nowrap;
  186. }
  187. }
  188. .store-recommend {
  189. background: #fff;
  190. margin: 20rpx 0 0 0;
  191. }
  192. </style>