locList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <block>
  3. <view class="item" v-for="(item,index) in list" :key='index' @click="opMap(item.lat,item.lng)">
  4. <image class="sImg" :src="item.image"
  5. mode=""></image>
  6. <view class="info">
  7. <view class="ititle">
  8. <view>{{item.storename}}</view>
  9. <image
  10. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/758f62af7f9f4e5b1d96b51619d07b19.png"
  11. mode=""></image>
  12. </view>
  13. <view class="iphone">
  14. <image
  15. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/658f859a103b4c4f20e3645fa557b592.png"
  16. mode=""></image>
  17. <view>{{item.phone}}</view>
  18. </view>
  19. <view class="iaddress">
  20. <view class="addressLeft">
  21. <image
  22. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/f598a75a5fcbbcb06f90f2858fbf08af.png"
  23. mode=""></image>
  24. <view>{{item.storeaddress}}</view>
  25. </view>
  26. <view class="addressRight">
  27. {{item.distance||0}}m
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view v-if="!list.length" style='color:#999;text-align:center;margin:150rpx 0;font-size:30rpx'>暂无数据</view>
  33. </block>
  34. </template>
  35. <script module="parse" lang="wxs">
  36. module.exports = {
  37. filterNum: function(value) {
  38. var value = value + ''
  39. console.log(value)
  40. var card = value.replace(getRegExp('(/^(\d{4})\d+(\d{4})$/)', 'g'), '$1 **** **** $2')
  41. return card
  42. }
  43. }
  44. </script>
  45. <script>
  46. // pages/tabbar/index/index.js
  47. var app = getApp();
  48. export default {
  49. data() {
  50. return {
  51. navIndex: 0,
  52. list: [
  53. // {
  54. // account: "hhD",
  55. // bank_name: "农业银行",
  56. // card_no: "6228481561378773113",
  57. // card_no_end: "3113",
  58. // create_time: "1659088920",
  59. // id: "7",
  60. // is_default: "0",
  61. // status: "1",
  62. // uniacid: "3",
  63. // update_time: "1659088920",
  64. // user_id: "1"
  65. // }
  66. ],
  67. loaded: false,
  68. page: 1,
  69. type: '',
  70. pageSize: 10
  71. };
  72. },
  73. onLoad: function(options) {
  74. var that = this;
  75. uni.getLocation({
  76. type: 'gcj02',
  77. success (res) {
  78. that.latitude = res.latitude
  79. that.longitude = res.longitude
  80. that.getlist();
  81. }
  82. })
  83. },
  84. onShow() {
  85. },
  86. onPullDownRefresh: function() {},
  87. onReachBottom: function() {
  88. this.loaded || this.getlist();
  89. },
  90. onShareAppMessage: function() {},
  91. methods: {
  92. opMap(lat,lng) {
  93. uni.openLocation({
  94. latitude: lat,
  95. longitude: lng,
  96. success(e) {
  97. }
  98. })
  99. },
  100. toPage(e) {
  101. app.globalData.toPage(e);
  102. },
  103. init() {
  104. this.page = 1
  105. this.loaded = false
  106. this.list = []
  107. },
  108. async getlist() {
  109. var that = this;
  110. let res = await this.$api.request('/Store/index', 'GET', {
  111. page: this.page,
  112. pagesize: this.pageSize,
  113. lat: this.latitude,
  114. lng: this.longitude,
  115. });
  116. console.log(res.list)
  117. if (res) {
  118. if (res.list.length > 0) {
  119. this.list = this.list.concat(res.list);
  120. this.page++;
  121. } else {
  122. this.loaded = true
  123. this.$api.msg('没有更多数据');
  124. }
  125. }
  126. }
  127. }
  128. };
  129. </script>
  130. <style>
  131. page {
  132. background: #F5F5F5;
  133. }
  134. .item {
  135. background: #fff;
  136. border-radius: 12rpx;
  137. overflow: hidden;
  138. margin: 30rpx;
  139. display: flex;
  140. align-items: center;
  141. padding: 30rpx 22rpx;
  142. box-sizing: border-box;
  143. }
  144. .sImg {
  145. width: 120rpx;
  146. height: 120rpx;
  147. border-radius: 12rpx;
  148. }
  149. .info {
  150. margin-left: 17rpx;
  151. flex: 1;
  152. }
  153. .ititle {
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-between;
  157. }
  158. .ititle>image {
  159. width: 30rpx;
  160. height: 30rpx;
  161. }
  162. .ititle>view {
  163. color: #010101;
  164. font-size: 32rpx;
  165. }
  166. .iphone {
  167. display: flex;
  168. align-items: center;
  169. margin: 12rpx 0;
  170. }
  171. .iphone>image {
  172. width: 36rpx;
  173. height: 36rpx;
  174. }
  175. .iphone>view {
  176. font-size: 26rpx;
  177. color: #8E8E8E;
  178. margin-left: 4rpx;
  179. }
  180. .iaddress {
  181. display: flex;
  182. align-items: flex-start;
  183. justify-content: space-between;
  184. }
  185. .addressLeft {
  186. display: flex;
  187. align-items: center;
  188. align-items: flex-start;
  189. }
  190. .addressLeft>image {
  191. width: 36rpx;
  192. height: 36rpx;
  193. }
  194. .addressLeft>view {
  195. font-size: 26rpx;
  196. width: 326rpx;
  197. color: #8E8E8E;
  198. display: -webkit-box;
  199. overflow: hidden;
  200. text-overflow: ellipsis;
  201. -webkit-line-clamp: 2;
  202. -webkit-box-orient: vertical;
  203. margin-left: 4rpx;
  204. }
  205. .addressRight {
  206. font-size: 26rpx;
  207. color: #8E8E8E;
  208. }
  209. </style>