siteInspection.vue 4.8 KB

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