manageStore.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="content">
  3. <!-- 搜索 -->
  4. <view class="searchBoxBg">
  5. <view class="searchBox">
  6. <image src="../../static/img/icon_search.png" mode="" class="searchImg"></image>
  7. <input type="text" class="searchInput" placeholder="请输入门店名称、联系人、手机号" v-model="searchValue"
  8. @confirm="searchDone" />
  9. </view>
  10. </view>
  11. <!-- 门店列表 -->
  12. <view class="shopContent">
  13. <view v-for="(item,index) in shopData" :key="index">
  14. <view class="shopBox">
  15. <view class="shopTop">
  16. <view class="shopName">{{item.ShopName}}</view>
  17. <!-- 地址和电话 -->
  18. <image class="tubiao" src="../../static/img/icon_daohang_def@2x.png" mode=""
  19. @click="goAddress(item)">
  20. </image>
  21. <image class="tubiao" src="../../static/img/icon_phone_def@2x.png" mode=""
  22. @click="call(item.ContactorPhone)">
  23. </image>
  24. </view>
  25. <!-- 门店类型-开业时间-联系人 -->
  26. <view class="shopType"><text style='color: #B98B5D;'>{{item.levelName}}</text> ·
  27. <text v-if="item.OpeningTime != null">{{item.OpeningTime}}</text> 联系人:{{item.Contactor}}
  28. </view>
  29. <!-- 详细地址 -->
  30. <view class="addressView">
  31. <view class="address">{{item.Address}}</view>
  32. <view class="distance" v-if="item.distance != 0.00">{{item.distance}}km</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 上拉 加载更多 -->
  38. <view class="noMore" v-if="noMoreShow">没有更多数据</view>
  39. <!-- 无数据空白页 -->
  40. <view class="nodataBox" v-if="shopData.length == 0">
  41. <image src="../../static/img/pic_empty_def.png" mode="widthFix" class="nodataImg"></image>
  42. <view class="noTxt">暂无数据</view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. searchValue: '',
  51. managerID: '',
  52. lng: '',
  53. lat: '',
  54. shopData: [],
  55. page: 1,
  56. noMoreShow: false,
  57. }
  58. },
  59. onLoad: function(option) {
  60. this.managerID = option.managerID
  61. var that = this
  62. uni.getLocation({
  63. success(res) {
  64. that.lng = res.longitude
  65. that.lat = res.latitude
  66. that.page = 1
  67. that.getShopData()
  68. }
  69. })
  70. },
  71. methods: {
  72. searchDone(e) {
  73. this.searchValue = e.target.value;
  74. this.page = 1
  75. this.getShopData()
  76. },
  77. getShopData() {
  78. uni.showLoading({
  79. title: '加载中'
  80. })
  81. let url = 'accompany/SuperAccounts/queryShopListByManagerID',
  82. params = {
  83. page: this.page,
  84. limit: 20,
  85. managerID: this.managerID,
  86. shopName: this.searchValue,
  87. lng: this.lng,
  88. lat: this.lat,
  89. }
  90. this.$http(url, params, 'GET').then(res => {
  91. var list = res.data.Items
  92. // 处理 undefined和null转为空白字符串
  93. list.forEach((item, index) => {
  94. for (const key in item) {
  95. item[key] = this.$praseStrEmpty(item[key])
  96. }
  97. })
  98. if (this.page == 1 && list.length == 0) {
  99. this.noMoreShow = false
  100. } else if (list.length < 20) {
  101. this.noMoreShow = true
  102. }
  103. if (this.page == 1) {
  104. this.shopData = list
  105. } else {
  106. this.shopData = this.shopData.concat(list)
  107. }
  108. })
  109. },
  110. goAddress(v) {
  111. uni.openLocation({
  112. latitude: Number(v.lat),
  113. longitude: Number(v.lng),
  114. name: v.shopName,
  115. address: v.Address,
  116. });
  117. },
  118. call(e) {
  119. if (e.length != 0) {
  120. uni.makePhoneCall({
  121. phoneNumber: e
  122. })
  123. }
  124. }
  125. },
  126. // 下拉刷新 上拉加载更多
  127. onPullDownRefresh() {
  128. this.getShopData()
  129. setTimeout(function() {
  130. uni.stopPullDownRefresh();
  131. }, 1000);
  132. },
  133. onReachBottom() {
  134. this.page++
  135. this.getShopData()
  136. }
  137. }
  138. </script>
  139. <style>
  140. .content {
  141. background-color: #F4F5F7;
  142. min-height: 100vh;
  143. }
  144. .searchBoxBg {
  145. position: fixed;
  146. left: 0;
  147. top: 0;
  148. width: 100%;
  149. background-color: #FFFFFF;
  150. z-index: 99;
  151. }
  152. /* #ifdef H5 */
  153. .searchBoxBg {
  154. top: 44px;
  155. }
  156. /* #endif */
  157. .searchBox {
  158. display: flex;
  159. height: 72rpx;
  160. margin: 24rpx;
  161. background-color: #F4F5F7;
  162. border-radius: 36rpx;
  163. }
  164. .searchImg {
  165. margin-top: 20rpx;
  166. margin-left: 20rpx;
  167. width: 32rpx;
  168. height: 32rpx;
  169. }
  170. .searchInput {
  171. height: 72rpx;
  172. font-size: 28rpx;
  173. padding-left: 16rpx;
  174. width: 85%;
  175. }
  176. .shopContent {
  177. padding: 0rpx 24rpx;
  178. padding-top: 120rpx;
  179. background-color: #F4F5F7;
  180. }
  181. .shopBox {
  182. background-color: #FFFFFF;
  183. border-radius: 10rpx;
  184. margin: 20rpx 0rpx;
  185. }
  186. .shopTop {
  187. display: flex;
  188. padding: 30rpx 20rpx 10rpx 20rpx;
  189. justify-content: space-between;
  190. }
  191. .shopName {
  192. font-size: 30rpx;
  193. color: #3C3C3C;
  194. font-weight: bold;
  195. width: 500rpx;
  196. }
  197. .tubiao {
  198. width: 48rpx;
  199. height: 48rpx;
  200. margin-left: 40rpx;
  201. }
  202. .shopType {
  203. font-size: 26rpx;
  204. padding: 10rpx 20rpx;
  205. color: #3C3C3C;
  206. }
  207. .addressView {
  208. font-size: 26rpx;
  209. color: #999999;
  210. padding-left: 20rpx;
  211. padding-right: 20rpx;
  212. padding-top: 10rpx;
  213. padding-bottom: 30rpx;
  214. display: flex;
  215. justify-content: space-between;
  216. }
  217. .distance {
  218. margin-left: 20rpx;
  219. margin-right: 20rpx;
  220. }
  221. /* 空白页css */
  222. .nodataBox {
  223. text-align: center;
  224. }
  225. .nodataImg {
  226. width: 400rpx;
  227. padding-top: 300rpx;
  228. }
  229. .noTxt {
  230. font-size: 30rpx;
  231. color: #999999;
  232. padding-top: 50rpx;
  233. }
  234. .noMore {
  235. text-align: center;
  236. line-height: 50rpx;
  237. color: #999999;
  238. font-size: 28rpx;
  239. }
  240. </style>