index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view style="height: 100vh;">
  3. <uni-nav-bar title="门店信息" backgroundColor='#03803B' color="#fff" left-icon="left" fixed statusBar
  4. @clickLeft='goBack()' @clickRight="addDetails">
  5. <block slot="right">
  6. <view>
  7. <image class="nav-right" src="@/static/images/home/store/add.png" />
  8. </view>
  9. </block>
  10. </uni-nav-bar>
  11. <view style="background-color: #fff;">
  12. <uni-search-bar bgColor="#F6F6F6 " v-model="searchValue" placeholder="请输入店铺名称" @confirm="searchChange"
  13. @cancel="searchChange" @clear="searchChange">
  14. </uni-search-bar>
  15. </view>
  16. <scroll-view scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
  17. @refresherrefresh="onRefresh" class="scroll-view">
  18. <view class="list">
  19. <u-empty v-if='dataList.length==0' mode="list">
  20. </u-empty>
  21. <view class="tab-bar-item" v-for="(item, index) in dataList" :key="index" @click="inEdit(item)">
  22. <image class="icon" :src="item.url" />
  23. <view class="text">
  24. <view class="text_title">
  25. {{item.cname}}
  26. </view>
  27. <view class="text_content">
  28. <text style="color: #999999;">前置仓:</text>
  29. <text style="color: #6A6A6A"
  30. class='uni-lastmsg'>{{item.deliveryWarehouseName||'暂无仓库'}}</text>
  31. <text style="color: #999999;margin-left: 10rpx;">价格:</text>
  32. <text style="color: #6A6A6A" class='uni-lastmsg2'>¥{{item.priceSystem||0}}</text>
  33. </view>
  34. <view class="text_foot">
  35. <text style="color: #999999;">电话:</text>
  36. <text style="color: #6A6A6A">{{item.tel}}</text>
  37. </view>
  38. </view>
  39. <view class="menu">
  40. <view class="">
  41. <image class="edit" src="@/static/images/home/store/edit.png" />
  42. </view>
  43. <view class="">
  44. <image class="QR" src="@/static/images/home/store/QR.png" @click.stop="inQR(item)"/>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view v-if="loading" class="loading">加载中...</view>
  50. <view v-if="noMore" class="no-more">没有更多数据了</view>
  51. </scroll-view>
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. getList
  57. } from '@/api/home/store.js'
  58. export default {
  59. data() {
  60. return {
  61. triggered: false,
  62. searchValue: null,
  63. page: {
  64. current: 1,
  65. size: 10,
  66. total: 0,
  67. },
  68. dataList: [],
  69. loading: false,
  70. noMore: false
  71. }
  72. },
  73. onLoad() {
  74. this.getList()
  75. },
  76. onReachBottom() {
  77. if (!this.noMore) {
  78. this.page.current += 1
  79. this.getList()
  80. }
  81. },
  82. methods: {
  83. onRefresh() {
  84. if (this.triggered) return;
  85. this.triggered = true;
  86. this.noMore = false;
  87. // 模拟异步请求
  88. setTimeout(() => {
  89. this.page.current = 1
  90. this.dataList = []
  91. this.getList()
  92. }, 500);
  93. },
  94. addDetails() {
  95. uni.navigateTo({
  96. url: '/pages/home/store/details'
  97. });
  98. },
  99. inEdit(row) {
  100. uni.navigateTo({
  101. url: '/pages/home/store/details?id=' + row.id,
  102. });
  103. },
  104. inQR(row) {
  105. uni.showToast({
  106. title: '暂无二维码',
  107. icon: 'none'
  108. });
  109. },
  110. searchChange(res) {
  111. this.triggered = true;
  112. this.noMore = false;
  113. // 模拟异步请求
  114. setTimeout(() => {
  115. this.page.current = 1
  116. this.dataList = []
  117. this.getList()
  118. }, 500);
  119. },
  120. getList() {
  121. const obj = {
  122. retrieve: this.searchValue,
  123. current: this.page.current,
  124. size: this.page.size
  125. }
  126. this.loading = true
  127. uni.showLoading({
  128. title: '加载中',
  129. mask: true
  130. });
  131. getList(obj).then(res => {
  132. this.dataList = [...this.dataList, ...res.data.records]
  133. console.log(this.dataList.length)
  134. if (res.data.total <= this.dataList.length) {
  135. this.noMore = true
  136. }
  137. })
  138. .finally(() => {
  139. uni.hideLoading()
  140. this.loading = false
  141. this.triggered = false
  142. });
  143. },
  144. goBack() {
  145. uni.navigateBack({
  146. delta: 1,
  147. });
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .scroll-view {
  154. height: 100%;
  155. }
  156. .loading,
  157. .no-more {
  158. text-align: center;
  159. padding: 20px;
  160. color: #999;
  161. }
  162. .uni-lastmsg {
  163. width: 150rpx;
  164. white-space: nowrap;
  165. overflow: hidden;
  166. text-overflow: ellipsis;
  167. display: block;
  168. /* 需明确设置display */
  169. }
  170. .uni-lastmsg2 {
  171. width: 140rpx;
  172. white-space: nowrap;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. display: block;
  176. /* 需明确设置display */
  177. }
  178. .nav-right {
  179. width: 54rpx;
  180. height: 54rpx;
  181. }
  182. .list {
  183. width: 100%;
  184. .tab-bar-item {
  185. background-color: #fff;
  186. margin-top: 30rpx;
  187. padding: 30rpx 62rpx;
  188. display: flex;
  189. .icon {
  190. width: 140rpx;
  191. height: 140rpx;
  192. background: #909090;
  193. border-radius: 14rpx;
  194. }
  195. .text {
  196. padding: 0rpx 17rpx;
  197. display: flex;
  198. flex-direction: column;
  199. justify-content: space-between;
  200. height: 140rpx;
  201. .text_title {
  202. height: 44rpx;
  203. font-weight: 500;
  204. font-size: 28rpx;
  205. color: #6A6A6A;
  206. }
  207. .text_content {
  208. display: flex;
  209. margin-top: 8rpx;
  210. font-size: 28rpx;
  211. font-weight: 500;
  212. }
  213. .text_foot {
  214. font-size: 28rpx;
  215. font-weight: 500;
  216. }
  217. }
  218. .menu {
  219. position: absolute;
  220. right: 62rpx;
  221. .edit {
  222. margin-top: 10rpx;
  223. width: 30rpx;
  224. height: 33rpx;
  225. }
  226. .QR {
  227. margin-top: 54rpx;
  228. width: 30rpx;
  229. height: 31rpx;
  230. }
  231. }
  232. }
  233. }
  234. </style>