locList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <block>
  3. <view class="item" v-for="(item,index) in list" :key='index' @click="opMap(item.lat,item.lng,item.storename,item.storeaddress)">
  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&&loaded" 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,name,address) {
  93. uni.openLocation({
  94. latitude: Number(lat),
  95. longitude: Number(lng),
  96. name,
  97. address,
  98. success(e) {
  99. }
  100. })
  101. },
  102. toPage(e) {
  103. app.globalData.toPage(e);
  104. },
  105. init() {
  106. this.page = 1
  107. this.loaded = false
  108. this.list = []
  109. },
  110. async getlist() {
  111. var that = this;
  112. let res = await this.$api.request('/Store/index', 'GET', {
  113. page: this.page,
  114. pagesize: this.pageSize,
  115. lat: this.latitude,
  116. lng: this.longitude,
  117. });
  118. console.log(res.list)
  119. if (res) {
  120. if (res.list.length > 0) {
  121. this.list = this.list.concat(res.list);
  122. this.page++;
  123. } else {
  124. this.loaded = true
  125. this.$api.msg('没有更多数据');
  126. }
  127. }
  128. }
  129. }
  130. };
  131. </script>
  132. <style>
  133. page {
  134. background: #F5F5F5;
  135. }
  136. .item {
  137. background: #fff;
  138. border-radius: 12rpx;
  139. overflow: hidden;
  140. margin: 30rpx;
  141. display: flex;
  142. align-items: center;
  143. padding: 30rpx 22rpx;
  144. box-sizing: border-box;
  145. }
  146. .sImg {
  147. width: 120rpx;
  148. height: 120rpx;
  149. border-radius: 12rpx;
  150. }
  151. .info {
  152. margin-left: 17rpx;
  153. flex: 1;
  154. }
  155. .ititle {
  156. display: flex;
  157. align-items: center;
  158. justify-content: space-between;
  159. }
  160. .ititle>image {
  161. width: 30rpx;
  162. height: 30rpx;
  163. }
  164. .ititle>view {
  165. color: #010101;
  166. font-size: 32rpx;
  167. }
  168. .iphone {
  169. display: flex;
  170. align-items: center;
  171. margin: 12rpx 0;
  172. }
  173. .iphone>image {
  174. width: 36rpx;
  175. height: 36rpx;
  176. }
  177. .iphone>view {
  178. font-size: 26rpx;
  179. color: #8E8E8E;
  180. margin-left: 4rpx;
  181. }
  182. .iaddress {
  183. display: flex;
  184. align-items: flex-start;
  185. justify-content: space-between;
  186. }
  187. .addressLeft {
  188. display: flex;
  189. align-items: center;
  190. align-items: flex-start;
  191. }
  192. .addressLeft>image {
  193. width: 36rpx;
  194. height: 36rpx;
  195. }
  196. .addressLeft>view {
  197. font-size: 26rpx;
  198. width: 326rpx;
  199. color: #8E8E8E;
  200. display: -webkit-box;
  201. overflow: hidden;
  202. text-overflow: ellipsis;
  203. -webkit-line-clamp: 2;
  204. -webkit-box-orient: vertical;
  205. margin-left: 4rpx;
  206. }
  207. .addressRight {
  208. font-size: 26rpx;
  209. color: #8E8E8E;
  210. }
  211. </style>