store_list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="page-container">
  3. <view class="search-wrapper">
  4. <view class="search-bar">
  5. <uni-icons type="search" size="20" color="#999"></uni-icons>
  6. <input
  7. class="search-input"
  8. v-model="searchQuery"
  9. placeholder="输入门店名称"
  10. placeholder-class="placeholder"
  11. @confirm="handleSearch"
  12. />
  13. </view>
  14. <view class="filter-tabs">
  15. <view
  16. class="tab-item"
  17. :class="{ active: auditFilter === 0 }"
  18. @click="changeAuditFilter(0)"
  19. >
  20. <text>待审核</text>
  21. </view>
  22. <view
  23. class="tab-item"
  24. :class="{ active: auditFilter === 1 }"
  25. @click="changeAuditFilter(1)"
  26. >
  27. <text>已审核</text>
  28. </view>
  29. <view
  30. class="tab-item"
  31. :class="{ active: auditFilter === 2 }"
  32. @click="changeAuditFilter(2)"
  33. >
  34. <text>已驳回</text>
  35. </view>
  36. </view>
  37. </view>
  38. <scroll-view
  39. scroll-y="true"
  40. class="list-container"
  41. @scrolltolower="handleScrollToLower"
  42. :lower-threshold="100"
  43. >
  44. <view v-if="isLoading && pagination.page === 1" class="loading-wrapper">
  45. <text>加载中...</text>
  46. </view>
  47. <view v-if="storeList.length === 0 && !isLoading" class="empty-list">
  48. <text>没有找到相关门店</text>
  49. </view>
  50. <view v-for="store in storeList" :key="store.id" class="store-card">
  51. <view v-if="store.audit_status" class="audit-tag" :class="store.audit_status">
  52. <text v-if="store.audit_status === 'pending'">待审核</text>
  53. <text v-if="store.audit_status === 'approved'">已审核</text>
  54. <text v-if="store.audit_status === 'rejected'">已驳回</text>
  55. </view>
  56. <view class="card-decorator"></view>
  57. <view class="card-content">
  58. <view class="card-header">
  59. <uni-icons type="shop-filled" size="20" color="#3c82f8"></uni-icons>
  60. <text class="store-name">{{ store.store_name }}</text>
  61. </view>
  62. <view class="info-grid">
  63. <view class="info-row">
  64. <text class="info-label">店主名称:</text>
  65. <text class="info-value">{{ store.contact_name }}</text>
  66. </view>
  67. <view class="info-row">
  68. <text class="info-label">联系方式:</text>
  69. <text class="info-value">{{ store.contact_phone }}</text>
  70. </view>
  71. <view class="info-row">
  72. <text class="info-label">门店地址:</text>
  73. <text class="info-value">{{ store.address }}</text>
  74. </view>
  75. <view class="info-row" v-if="store.review_status === 2">
  76. <text class="info-label">驳回原因:</text>
  77. <text class="info-value" style="color: red">{{ store.reject_reason }}</text>
  78. </view>
  79. </view>
  80. <view class="action-buttons">
  81. <view class="action-btn" @click="viewDetails(store.id)">
  82. <uni-icons type="eye-filled" size="18" color="#3c82f8"></uni-icons>
  83. <text>详情</text>
  84. </view>
  85. <view class="action-btn" @click="dataSummary(store.id)">
  86. <uni-icons type="compose" size="18" color="#3c82f8"></uni-icons>
  87. <text>数据汇总</text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="list-placeholder"></view>
  93. <view v-if="isLoading && pagination.page > 1" class="load-more">
  94. <text>加载更多...</text>
  95. </view>
  96. <view v-if="loadStatus === 'noMore' && storeList.length > 0" class="load-more">
  97. <text>没有更多数据了</text>
  98. </view>
  99. </scroll-view>
  100. </view>
  101. </template>
  102. <script>
  103. import {getStoreList} from "@/api/hexiao";
  104. export default {
  105. data() {
  106. return {
  107. searchQuery: '',
  108. storeList: [],
  109. pagination: {
  110. page: 1,
  111. limit: 10,
  112. },
  113. isLoading: false,
  114. loadStatus: 'more',
  115. auditFilter: 0,
  116. scrollTimer: null,
  117. isScrolling: false,
  118. };
  119. },
  120. onShow(){
  121. this.fetchStoreList(true);
  122. },
  123. onLoad() {
  124. this.fetchStoreList(true);
  125. },
  126. methods: {
  127. fetchStoreList(isRefresh = false) {
  128. if (this.isLoading || (this.loadStatus === 'noMore' && !isRefresh)) {
  129. return;
  130. }
  131. if (isRefresh) {
  132. this.pagination.page = 1;
  133. this.storeList = [];
  134. this.loadStatus = 'more';
  135. }
  136. this.isLoading = true;
  137. if (!isRefresh) {
  138. this.loadStatus = 'loading';
  139. }
  140. getStoreList(this.pagination.page, this.pagination.limit, this.searchQuery, 0, this.auditFilter).then(res=>{
  141. let data = res.data;
  142. let list = data.records || [];
  143. if (list.length > 0) {
  144. this.storeList = [...this.storeList, ...list];
  145. this.pagination.page++;
  146. this.loadStatus = list.length < this.pagination.limit ? 'noMore' : 'more';
  147. } else {
  148. this.loadStatus = 'noMore';
  149. }
  150. this.isLoading = false;
  151. this.isScrolling = false;
  152. }).catch(() => {
  153. this.isLoading = false;
  154. this.isScrolling = false;
  155. });
  156. },
  157. handleSearch() {
  158. this.pagination.page = 1;
  159. this.fetchStoreList(true);
  160. },
  161. changeAuditFilter(status) {
  162. if (this.auditFilter !== status) {
  163. this.auditFilter = status;
  164. this.pagination.page = 1;
  165. this.fetchStoreList(true);
  166. }
  167. },
  168. handleScrollToLower() {
  169. if (this.isScrolling || this.isLoading || this.loadStatus === 'noMore') {
  170. return;
  171. }
  172. this.isScrolling = true;
  173. if (this.scrollTimer) {
  174. clearTimeout(this.scrollTimer);
  175. }
  176. this.scrollTimer = setTimeout(() => {
  177. this.fetchStoreList(false);
  178. this.scrollTimer = null;
  179. }, 300);
  180. },
  181. viewDetails(id) {
  182. uni.navigateTo({ url: '/pages/hexiao/ywy/add_retail?edit=0&id='+id });
  183. },
  184. dataSummary(id){
  185. uni.navigateTo({ url: '/pages/hexiao/jxs/sale_detail?id='+id });
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .page-container {
  192. background-color: #f5f6fa;
  193. height: 100vh;
  194. display: flex;
  195. flex-direction: column;
  196. overflow: hidden;
  197. }
  198. .search-wrapper {
  199. padding: 20rpx;
  200. background-color: #ffffff;
  201. position: sticky;
  202. top: 0;
  203. z-index: 100;
  204. flex-shrink: 0;
  205. }
  206. .search-bar {
  207. display: flex;
  208. align-items: center;
  209. background-color: #f5f6fa;
  210. border-radius: 50rpx;
  211. padding: 0 25rpx;
  212. height: 70rpx;
  213. }
  214. .search-input {
  215. flex: 1;
  216. font-size: 28rpx;
  217. margin-left: 15rpx;
  218. }
  219. .placeholder {
  220. color: #b0b0b0;
  221. }
  222. .filter-tabs {
  223. display: flex;
  224. background-color: #f5f6fa;
  225. border-radius: 10rpx;
  226. margin-top: 20rpx;
  227. padding: 8rpx;
  228. flex-shrink: 0;
  229. }
  230. .tab-item {
  231. flex: 1;
  232. text-align: center;
  233. padding: 16rpx 0;
  234. font-size: 26rpx;
  235. color: #666;
  236. border-radius: 8rpx;
  237. transition: all 0.3s;
  238. }
  239. .tab-item.active {
  240. background-color: #ffffff;
  241. color: #3c82f8;
  242. font-weight: bold;
  243. box-shadow: 0 2rpx 8rpx rgba(60, 130, 248, 0.2);
  244. }
  245. .audit-tag {
  246. position: absolute;
  247. top: 10rpx;
  248. right: 10rpx;
  249. padding: 6rpx 16rpx;
  250. border-radius: 20rpx;
  251. font-size: 22rpx;
  252. font-weight: bold;
  253. z-index: 1;
  254. }
  255. .audit-tag.pending {
  256. background-color: #fff8e1;
  257. color: #ff9800;
  258. border: 1rpx solid #ff9800;
  259. }
  260. .audit-tag.approved {
  261. background-color: #e8f5e9;
  262. color: #4caf50;
  263. border: 1rpx solid #4caf50;
  264. }
  265. .audit-tag.rejected {
  266. background-color: #ffebee;
  267. color: #f44336;
  268. border: 1rpx solid #f44336;
  269. }
  270. .list-container {
  271. flex: 1;
  272. padding: 0 20rpx;
  273. box-sizing: border-box;
  274. overflow: hidden;
  275. }
  276. .loading-wrapper {
  277. text-align: center;
  278. padding: 40rpx 0;
  279. color: #999;
  280. font-size: 28rpx;
  281. }
  282. .load-more {
  283. text-align: center;
  284. padding: 30rpx 0;
  285. color: #999;
  286. font-size: 26rpx;
  287. border-top: 1rpx solid #f0f0f0;
  288. margin-top: 20rpx;
  289. }
  290. .empty-list {
  291. text-align: center;
  292. color: #999;
  293. padding-top: 100rpx;
  294. font-size: 28rpx;
  295. }
  296. .store-card {
  297. background-color: #ffffff;
  298. border-radius: 16rpx;
  299. margin-top: 20rpx;
  300. position: relative;
  301. overflow: hidden;
  302. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
  303. }
  304. .card-decorator {
  305. position: absolute;
  306. left: 0;
  307. top: 0;
  308. bottom: 0;
  309. width: 8rpx;
  310. background-color: #e3efff;
  311. }
  312. .card-content {
  313. padding: 30rpx;
  314. padding-left: 40rpx;
  315. }
  316. .card-header {
  317. display: flex;
  318. align-items: center;
  319. }
  320. .store-name {
  321. font-size: 32rpx;
  322. font-weight: bold;
  323. color: #333;
  324. margin-left: 15rpx;
  325. }
  326. .info-grid {
  327. margin-top: 20rpx;
  328. font-size: 26rpx;
  329. color: #666;
  330. }
  331. .info-row {
  332. margin-top: 10rpx;
  333. }
  334. .action-buttons {
  335. display: flex;
  336. justify-content: space-around;
  337. border-top: 1rpx solid #f5f5f5;
  338. margin-top: 30rpx;
  339. padding-top: 25rpx;
  340. }
  341. .action-btn {
  342. display: flex;
  343. align-items: center;
  344. font-size: 26rpx;
  345. color: #3c82f8;
  346. }
  347. .action-btn text {
  348. margin-left: 8rpx;
  349. }
  350. .list-placeholder {
  351. height: 80rpx;
  352. width: 100%;
  353. }
  354. </style>