From 06df763ed4148e8baae443751b22174fdfe342cf Mon Sep 17 00:00:00 2001 From: FlowerWater <9579043+flowerwater2@user.noreply.gitee.com> Date: Sat, 20 Dec 2025 12:43:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=93=B6=E8=A1=8C=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- pages.config.ts | 2 + src/api/loan.ts | 231 ++++++++++ src/pages.json | 288 +++++++++++++ src/pages/me/loan-application.vue | 199 ++++++++- src/pages/me/me.vue | 5 + src/pagesBank/api/index.ts | 175 ++++++++ src/pagesBank/audit/detail.vue | 452 ++++++++++++++++++++ src/pagesBank/audit/list.vue | 316 +++++++++++--- src/pagesBank/customer/detail.vue | 439 +++++++++++++++++++ src/pagesBank/customer/list.vue | 438 +++++++++++++++---- src/pagesBank/customer/transaction-list.vue | 107 +++++ src/pagesBank/customer/withdraw-list.vue | 126 ++++++ src/pagesBank/dashboard/index.vue | 304 +++++++++---- src/pagesBank/mock/index.ts | 111 +++++ src/pagesMerchant/dashboard/index.vue | 2 + src/pagesMerchant/loan/assist.vue | 302 +++++++++++++ src/store/bank.ts | 33 ++ src/tabbar/config.ts | 5 +- src/typings/bank.ts | 61 +++ src/typings/loan.ts | 105 +++++ 21 files changed, 3473 insertions(+), 230 deletions(-) create mode 100644 src/api/loan.ts create mode 100644 src/pages.json create mode 100644 src/pagesBank/api/index.ts create mode 100644 src/pagesBank/audit/detail.vue create mode 100644 src/pagesBank/customer/detail.vue create mode 100644 src/pagesBank/customer/transaction-list.vue create mode 100644 src/pagesBank/customer/withdraw-list.vue create mode 100644 src/pagesBank/mock/index.ts create mode 100644 src/pagesMerchant/loan/assist.vue create mode 100644 src/store/bank.ts create mode 100644 src/typings/bank.ts create mode 100644 src/typings/loan.ts diff --git a/.gitignore b/.gitignore index 2b15ba8..04a9ed9 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,4 @@ src/manifest.json # 更新 uni-app 官方版本 # npx @dcloudio/uvm@latest -src/pages.json +# src/pages.json \ No newline at end of file diff --git a/pages.config.ts b/pages.config.ts index 17c16b9..26a1af7 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -37,6 +37,7 @@ export default defineUniPages({ { path: 'me/index', style: { navigationBarTitleText: '商家中心' } }, { path: 'me/shop', style: { navigationBarTitleText: '店铺设置' } }, { path: 'me/account', style: { navigationBarTitleText: '账号安全' } }, + { path: 'loan/assist', style: { navigationBarTitleText: '贷款辅助材料' } }, ], }, { @@ -44,6 +45,7 @@ export default defineUniPages({ pages: [ { path: 'dashboard/index', style: { navigationBarTitleText: '银行工作台' } }, { path: 'audit/list', style: { navigationBarTitleText: '审核列表' } }, + { path: 'audit/detail', style: { navigationBarTitleText: '审核详情' } }, { path: 'customer/list', style: { navigationBarTitleText: '客户管理' } }, { path: 'me/index', style: { navigationBarTitleText: '银行中心' } }, ], diff --git a/src/api/loan.ts b/src/api/loan.ts new file mode 100644 index 0000000..5c69252 --- /dev/null +++ b/src/api/loan.ts @@ -0,0 +1,231 @@ +// import { request } from '@/utils/http' +import type { LoanApplication, RelatedMerchant, AssistMaterial } from '@/typings/loan' +import { LoanStatus } from '@/typings/loan' + +/** + * [用户端] 获取用户交易过的商家列表 + */ +export function getUserMerchants() { + // Mock数据 + return new Promise<{ list: RelatedMerchant[] }>((resolve) => { + setTimeout(() => { + resolve({ + list: [ + { + merchantId: 'M001', + merchantName: '乐高玩具旗舰店', + lastTradeTime: '2025-12-01', + selected: false, + assistStatus: 'pending' + }, + { + merchantId: 'M002', + merchantName: '迪士尼官方店', + lastTradeTime: '2025-11-20', + selected: false, + assistStatus: 'pending' + }, + { + merchantId: 'M003', + merchantName: '泡泡玛特', + lastTradeTime: '2025-11-15', + selected: false, + assistStatus: 'pending' + }, + { + merchantId: 'M004', + merchantName: '奥特曼官方玩具店', + lastTradeTime: '2025-11-10', + selected: false, + assistStatus: 'pending' + }, + { + merchantId: 'M005', + merchantName: '玩具反斗城', + lastTradeTime: '2025-11-05', + selected: false, + assistStatus: 'pending' + }, + { + merchantId: 'M006', + merchantName: 'KidsLand', + lastTradeTime: '2025-10-20', + selected: false, + assistStatus: 'pending' + } + ] + }) + }, 500) + }) +} + +/** + * [用户端] 提交贷款申请 + */ +export function submitLoanApplication(data: any) { + return new Promise<{ id: string }>((resolve) => { + setTimeout(() => { + resolve({ id: `LA${Date.now()}` }) + }, 1000) + }) +} + +// 模拟数据库 +let mockDatabase: LoanApplication[] = [] + +/** + * [银行端] 获取贷款申请列表 + */ +export function getLoanApplicationList(params: any) { + return new Promise<{ list: LoanApplication[], total: number }>((resolve) => { + setTimeout(() => { + // 如果没有数据,初始化一些 Mock 数据 + if (mockDatabase.length === 0) { + mockDatabase = [ + { + id: 'LA20251219001', + userId: 'U001', + userName: '张三', + userPhone: '13800138000', + amount: 50, + term: 1, + status: LoanStatus.SUBMITTED, + createTime: '2025-12-19 10:00:00', + updateTime: '2025-12-19 10:00:00', + relatedMerchants: [ + { + merchantId: 'M001', + merchantName: '乐高玩具旗舰店', + lastTradeTime: '2025-12-01', + selected: true, + assistStatus: 'pending' + } + ], + personalInfo: { + name: '张三', + phone: '13800138000', + idCard: '440106199001011234', + region: ['广东省', '广州市', '天河区'], + detailAddress: '天河路1号' + }, + businessInfo: { + businessProject: '玩具零售', + businessTime: '3年', + annualIncome: 100, + hasDebt: 'no', + loanDemand: 50, + assets: ['house', 'car'] + }, + documentInfo: { + businessLicense: 'https://via.placeholder.com/150', + otherMaterials: [] + }, + processRecords: [] + } + ] + } + + resolve({ + list: mockDatabase, + total: mockDatabase.length + }) + }, 500) + }) +} + +/** + * [银行端] 获取贷款申请详情 + */ +export function getLoanApplicationDetail(id: string) { + return new Promise((resolve, reject) => { + setTimeout(() => { + const item = mockDatabase.find(i => i.id === id) + if (item) { + resolve(item) + } else { + // Fallback for demo + if (mockDatabase.length > 0) resolve(mockDatabase[0]) + else reject('Not found') + } + }, 500) + }) +} + +/** + * [银行端] 流程操作 + */ +export function operateLoanApplication(id: string, action: string, data?: any) { + return new Promise((resolve) => { + setTimeout(() => { + const item = mockDatabase.find(i => i.id === id) + if (item) { + // 更新状态逻辑 + switch (action) { + case 'accept': item.status = LoanStatus.ACCEPTED; break; + case 'investigate': item.status = LoanStatus.INVESTIGATING; break; + case 'report': item.status = LoanStatus.REPORTED; break; + case 'approve': item.status = LoanStatus.APPROVED; break; + case 'sign': item.status = LoanStatus.SIGNED; break; + case 'disburse': item.status = LoanStatus.DISBURSED; break; + case 'reject': item.status = LoanStatus.REJECTED; break; + } + + // 添加记录 + item.processRecords.push({ + step: action as any, + operator: '银行管理员', + operateTime: new Date().toLocaleString(), + ...data + }) + } + resolve() + }, 500) + }) +} + +/** + * [商家端] 获取待办列表 + */ +export function getMerchantPendingAssistList() { + return new Promise<{ list: any[] }>((resolve) => { + setTimeout(() => { + // 找到所有关联了当前商家的未处理申请 + // 这里简化逻辑,直接返回 Mock + resolve({ + list: [ + { + loanId: 'LA20251219001', + userName: '张三', + applyTime: '2025-12-19 10:00:00', + amount: 50, + status: 'pending' + } + ] + }) + }, 500) + }) +} + +/** + * [商家端] 提交辅助材料 + */ +export function submitAssistMaterial(loanId: string, materials: any[]) { + return new Promise((resolve) => { + setTimeout(() => { + const item = mockDatabase.find(i => i.id === loanId) + // 简化:更新第一个匹配的商家状态 + if (item && item.relatedMerchants.length > 0) { + item.relatedMerchants[0].assistStatus = 'submitted' + item.relatedMerchants[0].materials = { + merchantId: item.relatedMerchants[0].merchantId, + merchantName: item.relatedMerchants[0].merchantName, + loanApplicationId: loanId, + materials: materials, + submitTime: new Date().toLocaleString(), + status: 'submitted' + } + } + resolve() + }, 800) + }) +} diff --git a/src/pages.json b/src/pages.json new file mode 100644 index 0000000..53796b9 --- /dev/null +++ b/src/pages.json @@ -0,0 +1,288 @@ +{ + "globalStyle": { + "navigationStyle": "default", + "navigationBarTitleText": "unibest", + "navigationBarBackgroundColor": "#f8f8f8", + "navigationBarTextStyle": "black", + "backgroundColor": "#FFFFFF" + }, + "easycom": { + "autoscan": true, + "custom": { + "^fg-(.*)": "@/components/fg-$1/fg-$1.vue", + "^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue", + "^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue" + } + }, + "preloadRule": { + "pages/login/index": { + "network": "all", + "packages": [ + "pagesMerchant", + "pagesBank" + ] + } + }, + "pages": [ + // GENERATED BY UNI-PAGES, PLATFORM: H5 + { + "path": "pages/index/index", + "type": "home", + "style": { + "navigationBarTitleText": "数字广东" + } + }, + { + "path": "pages/finance/credit", + "type": "page", + "style": { + "navigationBarTitleText": "信用额度", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/finance/settlement", + "type": "page", + "style": { + "navigationBarTitleText": "应结账款", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/goods/cart", + "type": "page", + "style": { + "navigationBarTitleText": "购物车" + } + }, + { + "path": "pages/goods/detail", + "type": "page", + "style": { + "navigationBarTitleText": "商品详情", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black" + } + }, + { + "path": "pages/login/index", + "type": "page", + "style": { + "navigationBarTitleText": "登录", + "navigationBarBackgroundColor": "#ffffff" + } + }, + { + "path": "pages/me/loan-application-records", + "type": "page", + "style": { + "navigationBarTitleText": "助贷申请记录", + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black" + } + }, + { + "path": "pages/me/loan-application", + "type": "page", + "style": { + "navigationBarTitleText": "贷款申请", + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black" + } + }, + { + "path": "pages/me/me", + "type": "page", + "style": { + "navigationBarTitleText": "我的", + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black" + } + }, + { + "path": "pages/member/index", + "type": "page", + "style": { + "navigationBarTitleText": "会员中心", + "navigationBarBackgroundColor": "#1a1a1a", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/order/confirm", + "type": "page", + "style": { + "navigationBarTitleText": "确认订单" + } + }, + { + "path": "pages/order/detail", + "type": "page", + "style": { + "navigationBarTitleText": "订单详情" + } + }, + { + "path": "pages/order/list", + "type": "page", + "style": { + "navigationBarTitleText": "我的订单", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/sort/index", + "type": "page", + "style": { + "navigationBarTitleText": "分类", + "disableScroll": true + } + } + ], + "subPackages": [ + { + "root": "pagesMerchant", + "pages": [ + // GENERATED BY UNI-PAGES, PLATFORM: H5 + { + "path": "dashboard/index", + "style": { + "navigationBarTitleText": "商家工作台" + } + }, + { + "path": "order/list", + "style": { + "navigationBarTitleText": "订单管理" + } + }, + { + "path": "order/detail", + "style": { + "navigationBarTitleText": "订单详情" + } + }, + { + "path": "goods/list", + "style": { + "navigationBarTitleText": "商品管理" + } + }, + { + "path": "goods/edit", + "style": { + "navigationBarTitleText": "编辑商品" + } + }, + { + "path": "finance/index", + "style": { + "navigationBarTitleText": "财务中心" + } + }, + { + "path": "finance/settlement", + "style": { + "navigationBarTitleText": "结算记录" + } + }, + { + "path": "finance/withdraw", + "style": { + "navigationBarTitleText": "申请提现" + } + }, + { + "path": "me/index", + "style": { + "navigationBarTitleText": "商家中心" + } + }, + { + "path": "me/shop", + "style": { + "navigationBarTitleText": "店铺设置" + } + }, + { + "path": "me/account", + "style": { + "navigationBarTitleText": "账号安全" + } + }, + { + "path": "loan/assist", + "style": { + "navigationBarTitleText": "贷款辅助材料" + } + } + ] + }, + { + "root": "pagesBank", + "pages": [ + // GENERATED BY UNI-PAGES, PLATFORM: H5 + { + "path": "dashboard/index", + "style": { + "navigationBarTitleText": "银行工作台" + } + }, + { + "path": "audit/list", + "style": { + "navigationBarTitleText": "审核列表" + } + }, + { + "path": "audit/detail", + "style": { + "navigationBarTitleText": "审核详情" + } + }, + { + "path": "customer/list", + "style": { + "navigationBarTitleText": "客户管理" + } + }, + { + "path": "me/index", + "style": { + "navigationBarTitleText": "银行中心" + } + } + ] + } + ], + "tabBar": { + "custom": true, + "color": "#999999", + "selectedColor": "#018d71", + "backgroundColor": "#F8F8F8", + "borderStyle": "black", + "height": "50px", + "fontSize": "10px", + "iconWidth": "24px", + "spacing": "3px", + "list": [ + // GENERATED BY UNI-PAGES, PLATFORM: H5 + { + "text": "首页", + "pagePath": "pages/index/index" + }, + { + "text": "分类", + "pagePath": "pages/sort/index" + }, + { + "text": "购物车", + "pagePath": "pages/goods/cart" + }, + { + "text": "我的", + "pagePath": "pages/me/me" + } + ] + } +} \ No newline at end of file diff --git a/src/pages/me/loan-application.vue b/src/pages/me/loan-application.vue index 4882a15..c5c764f 100644 --- a/src/pages/me/loan-application.vue +++ b/src/pages/me/loan-application.vue @@ -352,15 +352,25 @@ function validateForm() { } // 提交表单 -function handleSubmit() { - // 取消表单校验,直接提交 +async function handleSubmit() { + if (!validateForm()) return uni.showLoading({ title: '提交中...' }) - // 模拟提交 - setTimeout(() => { + try { + // 收集选中的商家 + const selectedMerchants = merchantList.value.filter(item => item.selected) + + // 构建提交数据 + const submitData = { + ...formData.value, + relatedMerchants: selectedMerchants + } + + await submitLoanApplication(submitData) + uni.hideLoading() uni.showToast({ title: '提交成功', @@ -371,13 +381,48 @@ function handleSubmit() { setTimeout(() => { uni.navigateBack() }, 1500) - }, 2000) + } catch (error) { + uni.hideLoading() + uni.showToast({ + title: '提交失败', + icon: 'none' + }) + } } // 返回上一页 function handleBack() { uni.navigateBack() } + +// 商家选择相关 +import { getUserMerchants, submitLoanApplication } from '@/api/loan' +import type { RelatedMerchant } from '@/typings/loan' + +const merchantList = ref([]) + +onMounted(async () => { + const res = await getUserMerchants() + merchantList.value = res.list +}) + +function toggleMerchant(item: RelatedMerchant) { + item.selected = !item.selected +} + +// 展开/收起逻辑 +const isExpanded = ref(false) + +const displayedMerchants = computed(() => { + if (isExpanded.value) { + return merchantList.value + } + return merchantList.value.slice(0, 3) +}) + +function toggleExpand() { + isExpanded.value = !isExpanded.value +}