Commit 6977ae15 authored by wykolor's avatar wykolor

feat: mock数据对接

parent 48e03072
......@@ -5,7 +5,7 @@ import store from "./store";
import './assets/style/normalize.css';
import 'vant/lib/index.css';
import 'amfe-flexible';
createApp(App)
createApp(App)
.use(store)
.use(router)
.mount("#app");
.mount("#app");
\ No newline at end of file
/*
* @Author: wykolor
* @Date: 2021-03-23 10:36:45
* @Last Modified by: wykolor
* @Last Modified time: 2021-03-23 10:36:45
*/
// 流水类型
export enum FlowType {
ADD = 'ADD', // 收入
REDUCE = 'REDUCE' // 支出
}
// 业务类型
export enum BizType {
WITHDRAW = 'WITHDRAW', // 提现
ORDER = 'ORDER', // 订单支付
ORDER_RETURN = 'ORDER_RETURN', // 订单返还
INTRODUCE = 'INTRODUCE', // 转介绍
WITHDRAW_RETURN = 'WITHDRAW_RETURN', // 提现返还
}
// 奖励金账户状态
export enum BonusAccountStatus {
ACTIVE = 'ACTIVE', // 正常
FREEZE = 'FREEZE', // 冻结
}
\ No newline at end of file
/*
* @Author: wykolor
* @Date: 2021-03-23 11:44:35
* @Last Modified by: wykolor
* @Last Modified time: 2021-03-23 17:00:17
*/
export interface PageParams {
pageSize?: number
pageNum?: number
}
export interface baseResponse<T = object> {
code: number;
msg: string;
data: T
}
export interface Paging<T = object> {
total: number;
pageNum: number;
pageSize: number;
hasNextPage: boolean;
list: Array<T>
}
export interface BonusListResponse {
creationTime: string;
flowType: string;
amountChange: number;
bizType: string;
bizTypeName: string;
relationNo: string;
withdrawApplyTime: string;
withdrawPayTime: string;
className: string;
schoolAreaName: string;
}
export interface BonusListParams extends PageParams{
studentId: number;
flowType: string;
}
export interface BonusAccountResponse {
status: string;
balance: number;
sumAdd: number;
sumWithdraw: number;
withdrawing: number;
}
export interface WithdrawListParams extends PageParams {
studentId: number;
}
export interface WithdrawListResponse {
accountName: string ;
withdrawApplyTime: string;
withdrawAmount: number;
withdrawPayTime: string ;
status: string;
expectedPayTime: string ;
failTime: string;
reason: string;
}
export interface CheckCaptchaParams {
userId: string;
ticket: string;
randStr: string;
}
export interface WithdrawParams {
withdrawAmount: number;
userId: number;
studentId: number;
smsVerifyCode: string;
}
\ No newline at end of file
import { BonusAccountResponse, BonusListParams, BonusListResponse, CheckCaptchaParams, Paging, WithdrawListParams, WithdrawListResponse, WithdrawParams } from '@/model/bonus';
import { get, post } from '../../request';
const bonusUrl = '/v1/marketingAccount/';
const withdrawUrl = '/v1/withdraw/'
// 奖励金收支列表
export const getBonusList = (params: BonusListParams) => {
return post<Paging<BonusListResponse>>(`${bonusUrl}bonus/flow/list`, params )
}
// 奖励金账户信息
export const getBonusAccount = (studentId: string) => {
return get<BonusAccountResponse>(`${bonusUrl}bonus/count`, { studentId })
}
// 提现记录列表
export const getWithdrawList = (params: WithdrawListParams) => {
return post<Paging<WithdrawListResponse>>(`${withdrawUrl}query`, params)
}
// 检验图形验证码
export const checkCaptcha = (params: CheckCaptchaParams) => {
return get<string>(`${withdrawUrl}checkCaptcha`, params);
}
// 提现
export const withdraw = (params: WithdrawParams) => {
return post<string>('', params);
}
\ No newline at end of file
import * as bonusModel from "./bonus/index";
export {
bonusModel
}
\ No newline at end of file
import axios from "./http"
import { baseResponse } from '../model/bonus/index'
/**
* 封装的get请求
* @param {*} url 请求路径
* @param {*} params 请求参数
* @returns
*/
export function get(url: string, params?: object) {
return axios({
method: "get",
url: url,
params: params
});
export function get<T=any>(url: string, params?: object) {
return axios.get<baseResponse<T>>(url, params)
}
/**
......@@ -20,11 +16,6 @@ import axios from "./http"
* @param {*} params 请求参数
* @returns
*/
export function post(url: string, params?: object, headers?: object) {
return axios({
method: "post",
url: url,
data: params,
headers
});
export function post<T=any>(url: string, params?: object) {
return axios.post<baseResponse<T>>(url, params)
}
\ No newline at end of file
This diff is collapsed.
......@@ -10,7 +10,9 @@
></van-col>
</van-row>
<van-row class="bonus-account-money" align="center">
<van-col span="12" class="money-desc"><span>¥1200.00</span></van-col>
<van-col span="12" class="money-desc"
><span>¥{{ bonusAccount.balance }}</span></van-col
>
<van-col span="12" style="text-align: right"
><van-button
style="border-color: #fff; width: 45%"
......@@ -26,21 +28,21 @@
<van-row class="bonus-account-status">
<van-col span="8">
<label>累计收入</label>
<span>¥11334.00</span>
<span>¥{{ bonusAccount.sumAdd }}</span>
</van-col>
<van-col span="8">
<label>累计提现</label>
<span>¥00.00</span>
<span>¥{{ bonusAccount.sumWithdraw }}</span>
</van-col>
<van-col span="8">
<label>提现中</label>
<span>¥334.00</span>
<span>¥{{ bonusAccount.withdrawing }}</span>
</van-col>
</van-row>
</div>
<van-cell
center
title="可提现金额:¥12.00"
:title="`可提现金额:¥${bonusAccount.balance}`"
size="large"
style="border-radius: 0.3rem;"
:border="false"
......@@ -54,7 +56,7 @@
<van-row>
<van-col span="12" class="tip">&emsp;奖励金提现金额</van-col>
<van-col span="12" class="tip-money" style="text-align: right; font-weight: 550"
>总计:570.00元&nbsp;</van-col
>总计:{{ bonusAccount.sumWithdraw }}元&nbsp;</van-col
>
</van-row>
......@@ -64,36 +66,39 @@
finished-text="我是有底线的"
@load="onLoad"
>
<div class="bonus-record-item" v-for="item in state.bonusRecordList" :key="item.id">
<div class="bonus-record-item" v-for="item in withdrawList" :key="item.id">
<div class="bonus-record-item-header">
<div class="bonus-record-item-header-status">
<i
class="iconfont"
:class="
item.status === 0
item.status === '0'
? 'icon-shijian'
: item.status === 1
: item.status === '1'
? 'icon-jindutiaoqiandai'
: 'icon-xiazaishibai'
"
:style="{
color: item.status === 0 ? '#46BB36' : item.status === 1 ? '#027AFF' : '#F1551E'
color:
item.status === '0' ? '#46BB36' : item.status === '1' ? '#027AFF' : '#F1551E'
}"
></i>
<span>{{
item.status === 0 ? "提现中" : item.status === 1 ? "提现成功" : "提现失败"
item.status === "0" ? "提现中" : item.status === "1" ? "提现成功" : "提现失败"
}}</span>
<label v-if="item.status === 0">请耐心等候~</label>
<label v-if="item.status === '0'">请耐心等候~</label>
</div>
<p class="bonus-record-item-apply-money">
{{ item.status === 1 ? "-" : "" }}¥{{ item.applyMoney }}
{{ item.status === "1" ? "-" : "" }}¥{{ item.withdrawAmount }}
</p>
</div>
<ul class="bonus-record-item-detail">
<li>微信提现:{{ item.userName }}</li>
<li>申请时间:{{ item.applyTime }}</li>
<li>预计时间:{{ item.arrivalTime }}</li>
<li v-if="item.status === 2">失败原因:{{ item.errorReason }}</li>
<li>微信提现:{{ item.accountName }}</li>
<li>申请时间:{{ item.withdrawApplyTime }}</li>
<li v-if="item.status === '0'">预计时间:{{ item.expectedPayTime }}</li>
<li v-if="item.status === '1'">到账时间:{{ item.withdrawPayTime }}</li>
<li v-if="item.status === '2'">失败时间:{{ item.failTime }}</li>
<li v-if="item.status === '2'">失败原因:{{ item.reason }}</li>
</ul>
</div>
</van-list>
......@@ -151,58 +156,74 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
import { defineComponent, reactive } from "vue";
import { Dialog, Button, Col, Row, Cell, List } from "vant";
import { BonusAccountResponse, WithdrawListResponse } from "@/model/bonus";
const Bonus = defineComponent({
setup() {
setup(props) {
const state = reactive({
loading: false,
finished: false,
bonusRecordList: [
{
status: 0, // 提现中
userName: "王嘉尔",
applyTime: "2021-10-12 12:12:12",
arrivalTime: "2021-10-12 12:12:12",
applyMoney: 12.04
},
{
status: 1, // 提现成功
userName: "王嘉尔",
applyTime: "2021-10-12 12:12:12",
arrivalTime: "2021-10-12 12:12:12",
applyMoney: 12.02
},
{
status: 2, // 提现失败
userName: "王嘉尔",
applyTime: "2021-10-12 12:12:12",
arrivalTime: "2021-10-12 12:12:12",
applyMoney: 12.5,
errorReason: "账户异常"
}
]
finished: false
});
const bonusAccount = reactive<BonusAccountResponse>({
status: "",
balance: 1.97,
sumAdd: 2.09,
sumWithdraw: 376.79,
withdrawing: 4.09
});
const withdrawList = reactive<WithdrawListResponse[]>([
{
status: "0", // 提现中
accountName: "王嘉尔",
withdrawApplyTime: "2021-10-12 12:12:12",
withdrawPayTime: "2021-10-12 12:12:12",
expectedPayTime: "2021-10-12 12:12:12",
failTime: "2021-10-12 12:12:12",
withdrawAmount: 12.04,
reason: "账户异常"
},
{
status: "1", // 提现成功
accountName: "王嘉尔",
withdrawApplyTime: "2021-10-12 12:12:12",
withdrawPayTime: "2021-10-12 12:12:12",
expectedPayTime: "2021-10-12 12:12:12",
failTime: "2021-10-12 12:12:12",
withdrawAmount: 12.02,
reason: "账户异常"
},
{
status: "2", // 提现失败
accountName: "王嘉尔",
withdrawApplyTime: "2021-10-12 12:12:12",
withdrawPayTime: "2021-10-12 12:12:12",
expectedPayTime: "2021-10-12 12:12:12",
failTime: "2021-10-12 12:12:12",
withdrawAmount: 12.5,
reason: "账户异常"
}
]);
const onLoad = () => {
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
for (let i = 0; i < 10; i++) {
// state.bonusRecordList.push();
// withdrawList.push();
}
// 加载状态结束
state.loading = false;
// 数据全部加载完成
if (state.bonusRecordList.length >= 40) {
if (withdrawList.length >= 40) {
state.finished = true;
}
}, 1000);
};
return {
state,
bonusAccount,
withdrawList,
onLoad
};
},
......
......@@ -30,8 +30,7 @@ module.exports = {
replace: true,
mediaQuery: false,
minPixelValue: 2,
exclude: /(node_module)/i,
selectorBlackList: ["tc-", "t"]
exclude: /(node_module)/i
})
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment