siteInspection.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="siteInspection-wrap">
  3. <!-- <u-sticky> -->
  4. <!-- 搜索框 -->
  5. <view class="search-con">
  6. <u-search placeholder="查找全部门店" v-model="queryValue" @custom="searchHandle(1)" @search="searchHandle(1)" bg-color="#fff" :action-style="{background: '#2979ff',color: '#fff', borderRadius: '6upx',padding: '6upx 0', fontSize: '26upx'}"></u-search>
  7. </view>
  8. <!-- 定位 -->
  9. <view class="location-con">
  10. <text class="location-tit">当前位置:</text>
  11. <view class="location-main" @click="getLocation">
  12. <text class="location-addr">{{location}}</text>
  13. <u-icon name="map" color="#2979ff" size="34" class="location-icon"></u-icon>
  14. </view>
  15. </view>
  16. <!-- </u-sticky> -->
  17. <!-- 附近的门店 -->
  18. <view class="store-con">
  19. <text class="store-tit">附近的门店:</text>
  20. <scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
  21. <!-- 列表数据 -->
  22. <view class="list-con">
  23. <view class="list-item" v-for="(item,index) in listdata" :key="index" @click="chooseStore(item)">
  24. <view class="item-main">
  25. <u-icon name="home-fill" size="34" color="#2979ff" class="company-icon"></u-icon>
  26. {{item.name}}
  27. </view>
  28. <u-icon name="rewind-right-fill" size="34" color="#2979ff" class="company-icon"></u-icon>
  29. </view>
  30. </view>
  31. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  32. <view class="loadmore">
  33. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  34. </view>
  35. </scroll-view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default{
  41. data(){
  42. return{
  43. queryValue: '',
  44. location: '',
  45. noDataText: '未查找到附近门店', // 列表请求状态提示语
  46. status: 'loadmore', // 加载中状态
  47. // status: 'loading', // 加载中状态
  48. listdata: [
  49. {name: '常青二路店'},
  50. {name: '兰州通达街店'},
  51. {name: '科技西路店'},
  52. {name: '常青二路店'},
  53. {name: '常青二路店'},
  54. {name: '兰州通达街店'},
  55. {name: '科技西路店'},
  56. {name: '常青二路店'},
  57. {name: '常青二路店'},
  58. {name: '兰州通达街店'},
  59. {name: '科技西路店'},
  60. {name: '常青二路店'},
  61. ], // 列表数据
  62. pageNo: 1, // 当前页码
  63. pageSize: 10, // 每页条数
  64. total: 0, // 数据总条数
  65. }
  66. },
  67. onShow() {
  68. this.init()
  69. },
  70. methods: {
  71. // 初始化
  72. init(){
  73. this.getLocation()
  74. },
  75. // 获取当前位置
  76. getLocation(){
  77. const _this = this
  78. uni.getLocation({
  79. type: 'gcj02',
  80. geocode: true,
  81. success: function (res) {
  82. console.log(res)
  83. _this.location = res.address.province + res.address.city + res.address.district + res.address.street + res.address.streetNum +'靠近' + res.address.poiName
  84. console.log(_this.location, '城市编码 ', res.address.cityCode)
  85. _this.searchHandle(res)
  86. }
  87. })
  88. },
  89. //
  90. searchHandle(pageNo){
  91. // this.status = "loading"
  92. pageNo ? this.pageNo = pageNo : null
  93. // searchSuppliers({
  94. // pageNo: this.pageNo,
  95. // pageSize: this.pageSize,
  96. // queryWord: this.queryValue
  97. // }).then(res => {
  98. // if (res.status == 200) {
  99. // if(this.pageNo>1){
  100. // this.listdata = this.listdata.concat(res.data.list || [])
  101. // }else{
  102. // this.listdata = res.data.list || []
  103. // }
  104. // this.total = res.data.count || 0
  105. // this.listdata.length == 0 && this.queryValue != '' ? this.noDataText = '没有搜索到相关结果' : this.noDataText = '暂无数据'
  106. // } else {
  107. // this.noDataText = res.message
  108. // this.listdata = []
  109. // this.total = 0
  110. // }
  111. // this.status = "loadmore"
  112. // })
  113. },
  114. // scroll-view到底部加载更多
  115. onreachBottom() {
  116. if(this.listdata.length < this.total){
  117. this.pageNo += 1
  118. this.searchHandle()
  119. }else{
  120. this.status = "nomore"
  121. }
  122. },
  123. // 选择门店
  124. chooseStore(item){
  125. uni.navigateTo({
  126. url:"/pages/signIn/signIn"
  127. })
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .siteInspection-wrap{
  134. background-color: #f8f8f8;
  135. .search-con{
  136. padding: 30upx 30upx;
  137. // background-color: #fff;
  138. }
  139. // 定位
  140. .location-con{
  141. padding: 0 30upx;
  142. background-color: #fff;
  143. .location-main{
  144. margin-top: 14upx;
  145. padding: 20upx;
  146. border-radius: 12upx;
  147. background-color: #fff;
  148. .location-addr{
  149. font-size: 24upx;
  150. }
  151. .location-icon{
  152. padding-left: 10upx;
  153. vertical-align: bottom;
  154. }
  155. }
  156. }
  157. // 附近的门店
  158. .store-con{
  159. .store-tit{
  160. display: block;
  161. padding: 30upx 30upx 20upx;
  162. }
  163. // 列表
  164. .scroll-con{
  165. height: calc(100vh - 215px);
  166. width: 100%;
  167. overflow: auto;
  168. .list-con{
  169. padding: 0 30upx;
  170. .list-item{
  171. background-color: #fff;
  172. border-radius: 16upx;
  173. padding: 20upx 30upx 18upx;
  174. margin-bottom: 20upx;
  175. display: flex;
  176. justify-content: space-between;
  177. align-items: center;
  178. .item-main{
  179. font-size: 15px;
  180. color: rgb(48, 49, 51);
  181. .company-icon{
  182. margin-right: 6upx;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. }
  190. </style>