爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

396 lines
12 KiB

3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
3 weeks ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
6 days ago
3 weeks ago
  1. <template>
  2. <view class="tui-manage-container">
  3. <!-- 顶部导航栏 -->
  4. <view class="navbar" :style="navbarStyle">
  5. <view class="nav-left" @tap="goBack">
  6. <uni-icons type="back" size="24" color="#222" />
  7. </view>
  8. <view class="nav-title">推广官管理</view>
  9. <view class="nav-right">
  10. <!-- <uni-icons type="more-filled" size="24" color="#222" style="margin-right: 16rpx;" />
  11. <uni-icons type="scan" size="24" color="#222" /> -->
  12. </view>
  13. </view>
  14. <!-- Tab栏 -->
  15. <view class="tab-bar-fixed" :style="{top: navBarRealHeight + 'px'}">
  16. <template v-if="!searchMode">
  17. <view class="tab-tabs">
  18. <view :class="['tab-item', {active: currentTab === 0}]" @tap="switchTab(0)">全部</view>
  19. <view :class="['tab-item', {active: currentTab === 1}]" @tap="switchTab(1)">推广官申请列表</view>
  20. </view>
  21. <uni-icons type="search" size="28" color="#222" class="tab-search" @tap="onSearchIconClick" />
  22. </template>
  23. <template v-else>
  24. <view class="search-input-wrap">
  25. <uni-icons type="search" size="22" color="#999" />
  26. <input
  27. ref="searchInput"
  28. class="search-input"
  29. v-model="searchText"
  30. placeholder="请输入要查询的内容"
  31. placeholder-style="color:#ccc"
  32. />
  33. <uni-icons v-if="searchText" type="close" size="22" color="#ccc" @tap="onClearSearch" />
  34. </view>
  35. <text class="search-cancel" @tap="onCancelSearch">取消</text>
  36. </template>
  37. </view>
  38. <view class="tab-content" :style="{paddingTop: (navBarRealHeight + tabBarHeight) + 'px'}">
  39. <!-- 全部 -->
  40. <view v-if="currentTab === 0">
  41. <view v-for="(item, idx) in filteredTuiList" :key="idx" class="tui-card" @tap="goTuiDetail(item)">
  42. <view class="tui-info-row"><text class="tui-label">姓名</text><text class="tui-value">{{ item.name }}</text></view>
  43. <view class="tui-info-row"><text class="tui-label">一级推广数</text><text class="tui-value">{{ item.level1 }}</text></view>
  44. <view class="tui-info-row"><text class="tui-label">二级推广数</text><text class="tui-value">{{ item.level2 }}</text></view>
  45. <view class="tui-info-row"><text class="tui-label">回收总额</text><text class="tui-value">{{ item.totalAmount }}</text></view>
  46. <view class="tui-info-row"><text class="tui-label">佣金总额</text><text class="tui-value">{{ item.commission }}</text></view>
  47. </view>
  48. </view>
  49. <!-- 推广官申请列表 -->
  50. <view v-if="currentTab === 1">
  51. <view v-for="(item, idx) in filteredApplyList" :key="idx" class="tui-card" @tap.stop="goApplyDetail(item)">
  52. <view class="tui-info-row"><text class="tui-value">{{ item.name }} 的推广官申请</text></view>
  53. <view class="tui-info-row"><text class="tui-label">电话</text><text class="tui-value">{{ item.phone }}</text></view>
  54. <view class="tui-info-row"><text class="tui-label">每日可花推广时间</text><text class="tui-value">{{ item.time }}</text></view>
  55. <view class="tui-info-row"><text class="tui-label">申请时间</text><text class="tui-value">{{ item.applyTime }}</text></view>
  56. <view class="tui-status-bar">
  57. <view v-if="item.status==='待审批'" class="tui-status orange">待审批</view>
  58. <view v-else-if="item.status==='已驳回'" class="tui-status red">已驳回</view>
  59. <view v-else-if="item.status==='已确认'" class="tui-status gray">已确认</view>
  60. </view>
  61. <view class="tui-action-bar">
  62. <view class="tui-action" v-if="item.status==='待审批'"><uni-icons type="undo" size="32" color="#999" /><text>驳回</text></view>
  63. <view class="tui-action" v-if="item.status==='待审批'" ><uni-icons type="person" size="32" color="#999" /><text>审批</text></view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import pullRefreshMixin from '../mixins/pullRefreshMixin.js'
  72. export default {
  73. mixins: [pullRefreshMixin],
  74. data() {
  75. return {
  76. currentTab: 0,
  77. tuiList: [],
  78. applyList: [
  79. { name: '周小艺', phone: '18899102278', time: '6小时', applyTime: '2025-03-20 11:00', status: '待审批' },
  80. { name: '周小艺', phone: '18899102278', time: '6小时', applyTime: '2025-03-20 11:00', status: '已驳回' },
  81. { name: '周小艺', phone: '18899102278', time: '6小时', applyTime: '2025-03-20 11:00', status: '已确认' },
  82. { name: '周小艺', phone: '18899102278', time: '6小时', applyTime: '2025-03-20 11:00', status: '待审批' },
  83. ],
  84. statusBarHeight: 0,
  85. navBarRealHeight: 0,
  86. tabBarHeight: 80, // px
  87. searchMode: false,
  88. searchText: '',
  89. }
  90. },
  91. computed: {
  92. navbarStyle() {
  93. return `padding-top: ${this.statusBarHeight}px;`;
  94. },
  95. filteredTuiList() {
  96. if (!this.searchText) return this.tuiList;
  97. const text = this.searchText.toLowerCase();
  98. return this.tuiList.filter(item =>
  99. (item.name && item.name.toLowerCase().includes(text)) ||
  100. (item.phone && item.phone.toLowerCase().includes(text))
  101. );
  102. },
  103. filteredApplyList() {
  104. if (!this.searchText) return this.applyList;
  105. const text = this.searchText.toLowerCase();
  106. return this.applyList.filter(item =>
  107. (item.name && item.name.toLowerCase().includes(text)) ||
  108. (item.phone && item.phone.toLowerCase().includes(text))
  109. );
  110. }
  111. },
  112. onLoad() {
  113. uni.getSystemInfo({
  114. success: (res) => {
  115. this.statusBarHeight = res.statusBarHeight || 20;
  116. }
  117. });
  118. this.$nextTick(() => {
  119. uni.createSelectorQuery().select('.navbar').boundingClientRect(rect => {
  120. if (rect) {
  121. this.navBarRealHeight = rect.height;
  122. }
  123. }).exec();
  124. });
  125. // 获取推广官列表
  126. this.fetchPromotionList();
  127. // 获取推广官申请列表
  128. this.fetchPromotionApplyList();
  129. },
  130. onShow() {
  131. this.fetchPromotionList();
  132. this.fetchPromotionApplyList();
  133. },
  134. methods: {
  135. goBack() {
  136. uni.navigateBack();
  137. },
  138. switchTab(idx) {
  139. this.currentTab = idx;
  140. },
  141. goTuiDetail(tui) {
  142. uni.navigateTo({
  143. url: '/pages/manager/tui-detail',
  144. success: (res) => {
  145. res.eventChannel.emit('tuiDetail', tui);
  146. }
  147. });
  148. },
  149. goApplyDetail(apply) {
  150. uni.navigateTo({
  151. url: '/pages/manager/tui-apply-detail',
  152. success: (res) => {
  153. res.eventChannel.emit('applyDetail', apply);
  154. }
  155. });
  156. },
  157. refreshData() {
  158. // TODO: 实现推广官列表刷新逻辑,如重新请求接口
  159. },
  160. async onRefresh() {
  161. await this.refreshData && this.refreshData()
  162. },
  163. async fetchPromotionList() {
  164. try {
  165. const res = await this.$api('getPromotionList', { pageSize: 1000, current: 1 });
  166. if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
  167. this.tuiList = res.result.records.map(user => ({
  168. name: user.name || user.nickName || '-',
  169. level1: 0, // 一级推广数,暂定
  170. level2: 0, // 二级推广数,暂定
  171. totalAmount: user.money || 0,
  172. commission: user.price || 0,
  173. phone: user.phone || ''
  174. }));
  175. }
  176. } catch (e) {
  177. uni.showToast({ title: '获取推广官列表失败', icon: 'none' });
  178. }
  179. },
  180. async fetchPromotionApplyList() {
  181. try {
  182. const res = await this.$api('getPromotionApplyListPage', { pageSize: 1000, current: 1 });
  183. if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
  184. this.applyList = res.result.records.map(user => ({
  185. id: user.id,
  186. name: user.name || user.nickName || '-',
  187. phone: user.phone || '',
  188. time: user.userTime || '',
  189. applyTime: user.createTime || '',
  190. status: user.status === 0 ? '待审批' : user.status === 1 ? '已确认' : user.status === 2 ? '已驳回' : ''
  191. }));
  192. }
  193. } catch (e) {
  194. uni.showToast({ title: '获取申请列表失败', icon: 'none' });
  195. }
  196. },
  197. onSearchIconClick() {
  198. this.searchMode = true;
  199. this.$nextTick(() => {
  200. this.$refs.searchInput && this.$refs.searchInput.focus();
  201. });
  202. },
  203. onClearSearch() {
  204. this.searchText = '';
  205. },
  206. onCancelSearch() {
  207. this.searchText = '';
  208. this.searchMode = false;
  209. },
  210. },
  211. onPullDownRefresh() {
  212. Promise.all([
  213. this.fetchPromotionList(),
  214. this.fetchPromotionApplyList()
  215. ]).finally(() => {
  216. uni.stopPullDownRefresh();
  217. });
  218. }
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. .tui-manage-container {
  223. min-height: 100vh;
  224. background: #f7f7f7;
  225. padding-bottom: 40rpx;
  226. }
  227. .navbar {
  228. position: fixed;
  229. top: 0;
  230. left: 0;
  231. width: 100vw;
  232. height: 100rpx;
  233. background: #fff;
  234. z-index: 10;
  235. display: flex;
  236. align-items: flex-end;
  237. justify-content: space-between;
  238. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  239. padding: 0 32rpx;
  240. .nav-left {
  241. flex: 0 0 48rpx;
  242. display: flex;
  243. align-items: center;
  244. height: 100%;
  245. }
  246. .nav-title {
  247. flex: 1;
  248. text-align: center;
  249. font-size: 36rpx;
  250. font-weight: bold;
  251. color: #222;
  252. line-height: 100rpx;
  253. }
  254. .nav-right {
  255. flex: 0 0 80rpx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: flex-end;
  259. height: 100%;
  260. }
  261. }
  262. .tab-bar-fixed {
  263. position: fixed;
  264. left: 0;
  265. width: 100vw;
  266. z-index: 20;
  267. background: #fff;
  268. display: flex;
  269. align-items: center;
  270. justify-content: space-around;
  271. height: 80rpx;
  272. border-bottom: 2rpx solid #f3f3f3;
  273. margin: 0;
  274. box-sizing: border-box;
  275. padding-left: 0;
  276. padding-right: 32rpx;
  277. }
  278. .tab-tabs {
  279. display: flex;
  280. flex: 1;
  281. height: 100%;
  282. }
  283. .tab-item {
  284. flex: 1;
  285. text-align: center;
  286. font-size: 32rpx;
  287. color: #222;
  288. font-weight: 500;
  289. position: relative;
  290. padding-bottom: 12rpx;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. }
  295. .tab-item.active {
  296. color: #ffb400;
  297. font-weight: bold;
  298. }
  299. .tab-item.active::after {
  300. content: '';
  301. display: block;
  302. width: 48rpx;
  303. height: 6rpx;
  304. border-radius: 6rpx;
  305. background: #ffb400;
  306. position: absolute;
  307. left: 50%;
  308. transform: translateX(-50%);
  309. bottom: 0;
  310. }
  311. .tab-search {
  312. margin-left: 16rpx;
  313. }
  314. .tab-content {
  315. margin-top: 32rpx;
  316. }
  317. .tui-card {
  318. background: #fff;
  319. border-radius: 40rpx;
  320. margin: 0 32rpx 32rpx 32rpx;
  321. padding: 40rpx 36rpx 36rpx 36rpx;
  322. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  323. }
  324. .tui-info-row {
  325. display: flex;
  326. align-items: center;
  327. margin-bottom: 18rpx;
  328. .tui-label {
  329. font-size: 30rpx;
  330. color: #b3b3b3;
  331. width: 180rpx;
  332. font-weight: 400;
  333. }
  334. .tui-value {
  335. font-size: 32rpx;
  336. color: #222;
  337. font-weight: 500;
  338. }
  339. }
  340. .tui-status-bar {
  341. display: flex;
  342. justify-content: flex-end;
  343. margin-top: 12rpx;
  344. }
  345. .tui-status {
  346. font-size: 28rpx;
  347. border-radius: 0 0 20rpx 0;
  348. padding: 8rpx 32rpx;
  349. font-weight: 400;
  350. &.orange {
  351. background: #fff7e6;
  352. color: #ffb400;
  353. }
  354. &.red {
  355. background: #ffeaea;
  356. color: #ff4d4f;
  357. }
  358. &.gray {
  359. background: #f5f5f5;
  360. color: #999;
  361. }
  362. }
  363. .tui-action-bar {
  364. display: flex;
  365. justify-content: center;
  366. align-items: center;
  367. margin-top: 24rpx;
  368. gap: 80rpx;
  369. }
  370. .tui-action {
  371. display: flex;
  372. flex-direction: column;
  373. align-items: center;
  374. font-size: 28rpx;
  375. color: #999;
  376. uni-icons {
  377. margin-bottom: 4rpx;
  378. }
  379. }
  380. .search-input-wrap {
  381. display: flex;
  382. align-items: center;
  383. padding: 2rpx;
  384. border: 1rpx solid #ccc;
  385. border-radius: 10rpx;
  386. .search-input {
  387. flex: 1;
  388. // padding: 8rpx;
  389. }
  390. }
  391. .search-cancel {
  392. margin-left: 16rpx;
  393. color: #999;
  394. }
  395. </style>