Commit 8aec21dd authored by wykolor's avatar wykolor

feat: 奖励金账户接口对接

parent 24bcbfa7
...@@ -57,7 +57,9 @@ ...@@ -57,7 +57,9 @@
"parserOptions": { "parserOptions": {
"ecmaVersion": 2020 "ecmaVersion": 2020
}, },
"rules": {} "rules": {
"@typescript-eslint/camelcase": "off"
}
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="format-detection" content="telephone=yes">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="//at.alicdn.com/t/font_2425189_lvk0clvlo2.css"> <link rel="stylesheet" href="//at.alicdn.com/t/font_2425189_lvk0clvlo2.css">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
......
...@@ -5,7 +5,9 @@ import store from "./store"; ...@@ -5,7 +5,9 @@ import store from "./store";
import "./assets/style/normalize.css"; import "./assets/style/normalize.css";
import "vant/lib/index.css"; import "vant/lib/index.css";
import "amfe-flexible"; import "amfe-flexible";
import nativeBridge from './util/nativeBridge'
createApp(App) createApp(App)
.use(store) .use(store)
.use(router) .use(router)
.use(nativeBridge)
.mount("#app"); .mount("#app");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wykolor * @Author: wykolor
* @Date: 2021-03-23 11:44:35 * @Date: 2021-03-23 11:44:35
* @Last Modified by: wykolor * @Last Modified by: wykolor
* @Last Modified time: 2021-03-24 16:20:07 * @Last Modified time: 2021-03-26 15:38:13
*/ */
export interface PageParams { export interface PageParams {
...@@ -44,10 +44,13 @@ export interface BonusListParams extends PageParams { ...@@ -44,10 +44,13 @@ export interface BonusListParams extends PageParams {
export interface BonusAccountResponse { export interface BonusAccountResponse {
status: string; status: string;
balance: number;
sumAdd: number;
sumWithdraw: number;
withdrawing: number; withdrawing: number;
balanceTotal: number;
addTotal: number;
withdrawedTotal: number;
withdrawAccount: string;
withdrawableTotal: number;
errCode: string;
} }
export interface WithdrawListParams extends PageParams { export interface WithdrawListParams extends PageParams {
......
...@@ -20,12 +20,12 @@ export const getBonusList = (params: BonusListParams) => { ...@@ -20,12 +20,12 @@ export const getBonusList = (params: BonusListParams) => {
// 奖励金账户信息 // 奖励金账户信息
export const getBonusAccount = (studentId: string) => { export const getBonusAccount = (studentId: string) => {
return get<BonusAccountResponse>(`v1/marketingAccount/bonus/count`, { studentId }); return get<BonusAccountResponse>(`/mock/api-jksxb-app/v1/marketingAccount/bonus/count`, { studentId });
}; };
// 提现记录列表 // 提现记录列表
export const getWithdrawList = (params: WithdrawListParams) => { export const getWithdrawList = (params: WithdrawListParams) => {
return post<Paging<WithdrawListResponse>>(`/v1/withdraw/query`, params); return post<Paging<WithdrawListResponse>>(`/mock/api-jksxb-app/v1/withdraw/query`, params);
}; };
// 检验图形验证码 // 检验图形验证码
......
const bonus = { const bonus = {
namespaced: true, namespaced: true,
state: () => ({ state: () => ({
studentId: 12, studentId: 0,
userId: "color" token: "",
userId: 0
}), }),
getters: { getters: {},
studentId: state => state.studentId + 1, mutations: {
userName: state => state.userId + "wangyan", saveStudentId(state, payload) {
studentFullName: state => state.studentId + state.userId state.studentId = payload;
},
saveToken(state, payload) {
state.token = payload;
},
saveUserId(state, payload) {
state.userId = payload;
}
}, },
mutations: {},
actions: {} actions: {}
}; };
......
...@@ -42,7 +42,7 @@ function install(Vue: App) { ...@@ -42,7 +42,7 @@ function install(Vue: App) {
const event_bus = mitt(); const event_bus = mitt();
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
window.$geek_excuteJS = function(args) { window.$geek_excuteJS = function (args) {
try { try {
const params = JSON.parse(args); const params = JSON.parse(args);
event_bus.emit(GEEK_NATVIE_NAME, params); event_bus.emit(GEEK_NATVIE_NAME, params);
...@@ -125,7 +125,7 @@ function install(Vue: App) { ...@@ -125,7 +125,7 @@ function install(Vue: App) {
created() { created() {
event_bus.on(GEEK_NATVIE_NAME, this.listenNativeMessage); event_bus.on(GEEK_NATVIE_NAME, this.listenNativeMessage);
}, },
beforeDestroy() { beforeUnmount() {
event_bus.off(GEEK_NATVIE_NAME, this.listenNativeMessage); event_bus.off(GEEK_NATVIE_NAME, this.listenNativeMessage);
} }
}); });
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
v-model:loading="loading" v-model:loading="loading"
v-model:error="error" v-model:error="error"
:finished="finished" :finished="finished"
finished-text="没有更多了" finished-text="~我是有底线的~"
@load="onLoad" @load="onLoad"
> >
<van-tab name="REDUCE" title="支出" class="bonus-detail-pay-list"> <van-tab name="REDUCE" title="支出" class="bonus-detail-pay-list">
......
...@@ -10,9 +10,16 @@ ...@@ -10,9 +10,16 @@
></van-col> ></van-col>
</van-row> </van-row>
<van-row class="bonus-account-money" align="center"> <van-row class="bonus-account-money" align="center">
<van-col span="12" class="money-desc" <van-col span="12" class="money-desc">
><span>¥{{ bonusAccount.balance }}</span></van-col <span style="position: relative"
> >¥{{ bonusAccount.balanceTotal }}
<label
class="frozen"
v-if="bonusAccount.status && bonusAccount.status === BonusAccountStatus.FREEZE"
>冻结
</label></span
>
</van-col>
<van-col span="12" style="text-align: right" <van-col span="12" style="text-align: right"
><van-button ><van-button
style="border-color: #fff; width: 45%" style="border-color: #fff; width: 45%"
...@@ -28,11 +35,11 @@ ...@@ -28,11 +35,11 @@
<van-row class="bonus-account-status"> <van-row class="bonus-account-status">
<van-col span="8"> <van-col span="8">
<label>累计收入</label> <label>累计收入</label>
<span>¥{{ bonusAccount.sumAdd }}</span> <span>¥{{ bonusAccount.addTotal }}</span>
</van-col> </van-col>
<van-col span="8"> <van-col span="8">
<label>累计提现</label> <label>累计提现</label>
<span>¥{{ bonusAccount.sumWithdraw }}</span> <span>¥{{ bonusAccount.withdrawedTotal }}</span>
</van-col> </van-col>
<van-col span="8"> <van-col span="8">
<label>提现中</label> <label>提现中</label>
...@@ -42,7 +49,7 @@ ...@@ -42,7 +49,7 @@
</div> </div>
<van-cell <van-cell
center center
:title="`可提现金额:¥${bonusAccount.balance}`" :title="`可提现金额:¥${bonusAccount.withdrawableTotal}`"
size="large" size="large"
style="border-radius: 0.3rem;" style="border-radius: 0.3rem;"
:border="false" :border="false"
...@@ -51,19 +58,18 @@ ...@@ -51,19 +58,18 @@
>提现</van-button >提现</van-button
> >
</van-cell> </van-cell>
<!-- -->
<div class="bouns-record"> <div class="bouns-record">
<van-row> <van-row>
<van-col span="12" class="tip">&emsp;奖励金提现金额</van-col> <van-col span="12" class="tip">&emsp;奖励金提现金额</van-col>
<van-col span="12" class="tip-money" style="text-align: right; font-weight: 550" <van-col span="12" class="tip-money" style="text-align: right; font-weight: 550"
>总计:{{ bonusAccount.sumWithdraw }}元&nbsp;</van-col >总计:{{ bonusAccount.withdrawedTotal }}元&nbsp;</van-col
> >
</van-row> </van-row>
<van-list <van-list
v-model:loading="state.loading" v-model:loading="loading"
:finished="state.finished" :finished="finished"
finished-text="我是有底线的" finished-text="~我是有底线的~"
@load="onLoad" @load="onLoad"
> >
<div class="bonus-record-item" v-for="item in withdrawList" :key="item.id"> <div class="bonus-record-item" v-for="item in withdrawList" :key="item.id">
...@@ -103,7 +109,6 @@ ...@@ -103,7 +109,6 @@
</div> </div>
</van-list> </van-list>
</div> </div>
<!-- 规则弹窗 --> <!-- 规则弹窗 -->
<van-dialog <van-dialog
v-model:show="showDialog" v-model:show="showDialog"
...@@ -154,81 +159,58 @@ ...@@ -154,81 +159,58 @@
<script lang="ts"> <script lang="ts">
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
import { computed, defineComponent, reactive } from "vue"; import { computed, defineComponent, reactive, toRefs } from "vue";
import { Dialog, Button, Col, Row, Cell, List } from "vant"; import { useRoute } from "vue-router";
import { BonusAccountResponse, WithdrawListResponse } from "@/model/bonus";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { Dialog, Button, Col, Row, Cell, List } from "vant";
import { WithdrawListParams, WithdrawListResponse } from "@/model/bonus";
import { bonusModel } from "@/server/api";
import { BonusAccountStatus } from "@/model/bonus/constant";
interface BonusState {
withdrawList: WithdrawListResponse[];
[key: string]: unknown;
}
const Bonus = defineComponent({ const Bonus = defineComponent({
setup() { setup() {
const route = useRoute();
const store = useStore(); const store = useStore();
const { studentId, token, userId } = route.query;
const bonusStoreState = computed(() => store.state.bonus); const bonusStoreState = computed(() => store.state.bonus);
const getters = computed(() => store.getters); store.commit("bonus/saveStudentId", studentId);
console.log(getters); store.commit("bonus/saveToken", token);
const state = reactive({ store.commit("bonus/saveUserId", userId);
const state = reactive<BonusState>({
loading: false, loading: false,
finished: false finished: false,
bonusAccount: {},
BonusAccountStatus,
withdrawList: []
}); });
const bonusAccount = reactive<BonusAccountResponse>({ // 获取奖励金信息
status: "", bonusModel.getBonusAccount(bonusStoreState.value.studentId).then(res => {
balance: 1.97, const { data } = res;
sumAdd: 2.09, state.bonusAccount = data;
sumWithdraw: 376.79, });
withdrawing: 4.09 const withdrawListParams = reactive<WithdrawListParams>({
pageSize: 10,
pageNum: 1,
studentId: bonusStoreState.value.studentId
}); });
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 = () => { const onLoad = () => {
// 异步更新数据 bonusModel.getWithdrawList(withdrawListParams).then(res => {
// setTimeout 仅做示例,真实场景中一般为 ajax 请求 const { hasNextPage, list } = res.data;
setTimeout(() => {
for (let i = 0; i < 10; i++) {
// withdrawList.push();
}
// 加载状态结束
state.loading = false; state.loading = false;
state.finished = !hasNextPage;
// 数据全部加载完成 state.withdrawList = state.withdrawList.concat(list);
if (withdrawList.length >= 40) { withdrawListParams.pageNum++;
state.finished = true; });
}
}, 1000);
}; };
return { return {
state, ...toRefs(state),
bonusAccount,
withdrawList,
onLoad, onLoad,
bonusStoreState bonusStoreState
}; };
...@@ -257,7 +239,9 @@ const Bonus = defineComponent({ ...@@ -257,7 +239,9 @@ const Bonus = defineComponent({
withdraw() { withdraw() {
// this.showDangerous = true; // this.showDangerous = true;
this.$router.push("withdraw"); // this.$router.push("withdraw");
// console.log(this.withdrawRule);
window.open('tel:10086', '_blank')
} }
} }
}); });
...@@ -278,6 +262,19 @@ export default Bonus; ...@@ -278,6 +262,19 @@ export default Bonus;
.money-desc { .money-desc {
font-size: 72px; font-size: 72px;
font-weight: 600; font-weight: 600;
.frozen {
background: url("../../assets/images/bonus/frozen.png") no-repeat;
background-size: 100% 100%;
font-size: 26px;
display: inline-block;
width: 117px;
height: 88px;
line-height: 76px;
text-align: center;
position: absolute;
top: -40px;
right: -100px;
}
} }
} }
.bonus-account-status { .bonus-account-status {
......
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