app-shop.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="app-shop">
  3. <view class="app-item dir-left-nowrap main-between cross-center" v-for="(item, index) in newList" :key="index">
  4. <view class="app-left dir-left-nowrap main-left cross-top">
  5. <app-jump-button form backgroundColor="white" arrangement="left" open_type="navigate" :url="`/pages/store/detail?id=${item.id}`">
  6. <image class="app-image" :style="{backgroundImage: `url(${item.pic_url})`}"></image>
  7. <view class="app-content dir-top-nowrap main-right" :class="{'main-center': !showName || !showScore || !showTel}">
  8. <text class="app-text t-omit" v-if="showName">{{item.name}}</text>
  9. <view class="app-score dir-left-nowrap main-left" v-if="showScore">
  10. <text>评分: </text>
  11. <view class="app-love">
  12. <image
  13. class="navPicUrl app-icon image-no-rep image-cover"
  14. v-for="(score, index) of item.score"
  15. :key="index"
  16. :src="scorePicUrl ? scorePicUrl : '/static/image/icon/store-score.png'"
  17. ></image>
  18. </view>
  19. </view>
  20. <text class="app-phone" v-if="showTel">电话: {{item.mobile}}</text>
  21. <text class="app-distance" v-if="item.distance">距离: {{item.distance}}</text>
  22. </view>
  23. </app-jump-button>
  24. </view>
  25. <view class="app-jump">
  26. <app-jump-button open_type="map" arrangement="column" form backgroundColor="white" :latitude="item.latitude" :longitude="item.longitude">
  27. <image :src="navPicUrl ? navPicUrl : '/static/image/icon/navigation.png'" class="scorePicUrl app-icon image-no-rep image-cover"></image>
  28. <text class="app-text">一键导航</text>
  29. </app-jump-button>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'app-shop',
  37. props: {
  38. list: {
  39. type: Array,
  40. default: function() {
  41. return [
  42. ]
  43. }
  44. },
  45. navPicUrl: {
  46. type: String,
  47. default: function() {
  48. return "";
  49. }
  50. },
  51. scorePicUrl: {
  52. type: String,
  53. default: function() {
  54. return "";
  55. }
  56. },
  57. showName: {
  58. type: Boolean,
  59. default: function() {
  60. return true;
  61. }
  62. },
  63. showScore: {
  64. type: Boolean,
  65. default: function() {
  66. return true;
  67. }
  68. },
  69. showTel: {
  70. type: Boolean,
  71. default: function() {
  72. return true;
  73. }
  74. },
  75. scrollTop: {
  76. type: Number,
  77. default: function() {
  78. return 0;
  79. }
  80. },
  81. value: {
  82. type: Boolean,
  83. default: function() {
  84. return true;
  85. }
  86. }
  87. },
  88. data() {
  89. return {
  90. height: 0,
  91. request: true
  92. }
  93. },
  94. created() {
  95. let that = this;
  96. uni.getSystemInfo({
  97. success: function (response) {
  98. that.height = response.windowHeight;
  99. }
  100. })
  101. },
  102. methods: {
  103. autoEnd() {
  104. this.$lazyLoadingData('app-shop').then(response => {
  105. if (response[0].height + response[0].top < this.height) {
  106. this.request = false;
  107. this.$emit('input', this.request);
  108. }
  109. });
  110. },
  111. },
  112. watch: {
  113. scrollTop: {
  114. handler: function(n,o) {
  115. if (n > o && this.request) this.autoEnd();
  116. }
  117. }
  118. },
  119. computed: {
  120. carCount() {
  121. return function (item) {
  122. return new Array(item.score);
  123. }
  124. },
  125. newList() {
  126. this.list.forEach(item => {
  127. if (!(item.score instanceof Array)) {
  128. item.score = new Array(item.score);
  129. }
  130. });
  131. return this.list;
  132. }
  133. }
  134. }
  135. </script>
  136. <style scoped lang="scss">
  137. .app-item {
  138. height: #{219rpx};
  139. width: #{750rpx};
  140. border-bottom: #{1rpx} solid #e2e2e2;
  141. background-color: white;
  142. overflow: hidden;
  143. .app-left {
  144. margin-left: #{24rpx};
  145. height: #{219rpx};
  146. width: #{600rpx};
  147. .app-image {
  148. height: #{150rpx};
  149. width: #{150rpx};
  150. border-radius: 50%;
  151. background-size: 100% auto;
  152. margin-top: #{35rpx};
  153. }
  154. }
  155. .app-jump {
  156. //height: #{219rpx};
  157. //width: #{131rpx};
  158. margin-left: auto;
  159. padding-right: #{20rpx};
  160. .app-icon {
  161. width: #{50rpx};
  162. height: #{50rpx};
  163. }
  164. .app-text {
  165. font-size: #{22rpx};
  166. color: #999999;
  167. margin-top: #{16rpx};
  168. }
  169. }
  170. .app-content {
  171. margin-left: #{20rpx};
  172. margin-top: #{20rpx};
  173. width: #{449upx};
  174. .app-text {
  175. font-size: #{28rpx};
  176. color: #353535;
  177. font-weight: bold;
  178. margin-bottom: #{18rpx};
  179. }
  180. .app-phone {
  181. font-size: #{26rpx};
  182. color: #999999;
  183. margin-bottom: #{15rpx};
  184. }
  185. .app-distance {
  186. font-size: #{26rpx};
  187. color: #999999;
  188. margin-bottom: #{15rpx};
  189. }
  190. .app-score {
  191. height: #{26rpx};
  192. margin-bottom: #{15rpx};
  193. line-height: #{26rpx};
  194. >text {
  195. font-size: #{26rpx};
  196. color: #999999;
  197. }
  198. .app-love {
  199. margin-left: #{4rpx};
  200. .app-icon {
  201. width: #{20rpx};
  202. height: #{18rpx};
  203. margin-right: #{4rpx};
  204. }
  205. }
  206. }
  207. }
  208. }
  209. </style>