Commit 1b08a00a authored by hewenhao's avatar hewenhao

Merge branch 'feature/2021_03_12_bonus' of dev.jiuaoedu.com:wykolor/mall-webview…

Merge branch 'feature/2021_03_12_bonus' of dev.jiuaoedu.com:wykolor/mall-webview into feature/2021_03_12_bonus
parents d7e487db d87ea504
import {
BonusAccountResponse,
BonusListParams,
BonusListResponse,
CheckCaptchaParams,
Paging,
WithdrawListParams,
WithdrawListResponse,
WithdrawParams,
WithdrawResponse,
WithdrawRiskResponse
} from "@/model/bonus";
import { get, post } from "../request";
// 奖励金收支列表
export const getBonusList = (params: BonusListParams) => {
return get<Paging<BonusListResponse>>(
`/api-jksxb-app/v1/marketingAccount/bonus/flow/list`,
params
);
};
// 奖励金账户信息
export const getBonusAccount = (studentId: string) => {
return get<BonusAccountResponse>(`/api-jksxb-app/v1/marketingAccount/bonus/count`, { studentId });
};
// 提现记录列表
export const getWithdrawList = (params: WithdrawListParams) => {
return get<Paging<WithdrawListResponse>>(`/api-jksxb-app/v1/withdraw/query`, params);
};
// 检验图形验证码
export const checkCaptcha = (params: CheckCaptchaParams) => {
return post<string>(`/api-jksxb-app/v1/withdraw/checkCaptcha`, params);
};
// 提现
export const withdraw = (params: WithdrawParams) => {
return post<WithdrawResponse>("/api-jksxb-app/v1/withdraw", params);
};
// 绑定微信
export const bindWeiChat = (params: { code: string}) => {
return post("/api-jksxb-app/v1/withdraw/bind/wx/parent", params)
}
// 获取用户风控值
export const getWithdrawRisk = (studentId: string) => {
return get<WithdrawRiskResponse>("/api-jksxb-app/v1/risk/getWithdrawRisk", { studentId })
}
\ No newline at end of file
import {
BonusAccountResponse,
BonusListParams,
BonusListResponse,
CheckCaptchaParams,
Paging,
WithdrawListParams,
WithdrawListResponse,
WithdrawParams,
WithdrawResponse,
WithdrawRiskResponse
} from "@/model/bonus";
import { get, post } from "../../request";
// 奖励金收支列表
export const getBonusList = (params: BonusListParams) => {
return get<Paging<BonusListResponse>>(
`/api-jksxb-app/v1/marketingAccount/bonus/flow/list`,
params
);
};
// 奖励金账户信息
export const getBonusAccount = (studentId: string) => {
return get<BonusAccountResponse>(`/api-jksxb-app/v1/marketingAccount/bonus/count`, { studentId });
};
// 提现记录列表
export const getWithdrawList = (params: WithdrawListParams) => {
return get<Paging<WithdrawListResponse>>(`/api-jksxb-app/v1/withdraw/query`, params);
};
// 检验图形验证码
export const checkCaptcha = (params: CheckCaptchaParams) => {
return post<string>(`/api-jksxb-app/v1/withdraw/checkCaptcha`, params);
};
// 提现
export const withdraw = (params: WithdrawParams) => {
return post<WithdrawResponse>("/api-jksxb-app/v1/withdraw", params);
};
// 绑定微信
export const bindWeiChat = (params: { code: string}) => {
return post("/api-jksxb-app/v1/withdraw/bind/wx/parent", params)
}
// 获取用户风控值
export const getWithdrawRisk = (studentId: string) => {
return get<WithdrawRiskResponse>("/api-jksxb-app/v1/risk/getWithdrawRisk", { studentId })
}
import * as bonusModel from "./bonus/index";
export { bonusModel };
......@@ -93,7 +93,7 @@ import { BonusListResponse } from "@/model/bonus";
import { FlowType, BizType } from "@/model/bonus/constant";
import { NavBar, Tab, Tabs, Cell, Empty, List, PullRefresh } from "vant";
import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
import { bonusModel } from "@/server/api";
import { getBonusList } from "@/server/api/bonus";
import { useStore } from "vuex";
import { useNativeBridge } from "@/util/use-native-bridge";
import { useRoute } from "vue-router";
......@@ -131,6 +131,7 @@ const BonusDetail = defineComponent({
});
const [sendNativeMessage] = useNativeBridge("test", arg => console.log(arg));
const onLoad = async () => {
state.loading = true;
if (state.refreshing) {
if (state.active === FlowType.ADD) {
pageAdd.pageNum = 1;
......@@ -151,13 +152,11 @@ const BonusDetail = defineComponent({
try {
const {
data: { total, list }
} = await bonusModel.getBonusList(params);
console.log(list);
} = await getBonusList(params);
if (total === 0) {
state.finished = true;
return;
}
state.loading = false;
if (state.active === FlowType.REDUCE) {
bonusList.reduceList = bonusList.reduceList.concat(list);
pageReduce.finished = bonusList.reduceList.length === total;
......
......@@ -210,11 +210,10 @@ import { useStore } from "vuex";
import { Dialog, Button, Col, Row, Cell, List, Loading, Toast, Empty } from "vant";
import { BonusAccountResponse, WithdrawListParams, WithdrawListResponse } from "@/model/bonus";
import { bonusModel } from "@/server/api";
import { BonusAccountStatus, ErrCode, WithdrawStatus } from "@/model/bonus/constant";
import { bindWeChat, useNativeBridge, makeCall } from "@/util/use-native-bridge";
import { formatBonusTipTxt } from "@/util/formatBonusTipTxt";
import { bindWeiChat } from "@/server/api/bonus";
import { bindWeiChat, getBonusAccount, getWithdrawList } from "@/server/api/bonus";
interface BonusState {
withdrawList: WithdrawListResponse[];
......@@ -249,14 +248,18 @@ const Bonus = defineComponent({
});
// 获取奖励金信息
const getBonusAccount = () => {
bonusModel.getBonusAccount(bonusStoreState.value.studentId).then(res => {
const { data } = res;
state.bonusAccount = data;
const getBonusAccountReq = async () => {
Toast.loading({
duration: 0,
message: "加载中..."
});
try {
const { data } = await getBonusAccount(bonusStoreState.value.studentId);
state.bonusAccount = data;
} finally {
Toast.clear();
}
};
getBonusAccount();
const withdrawListParams = reactive<WithdrawListParams>({
pageSize: 10,
pageNum: 1,
......@@ -267,7 +270,7 @@ const Bonus = defineComponent({
try {
const {
data: { hasNextPage, list, total }
} = await bonusModel.getWithdrawList(withdrawListParams);
} = await getWithdrawList(withdrawListParams);
if (!list || total === 0) {
state.finished = true;
return;
......@@ -287,6 +290,7 @@ const Bonus = defineComponent({
};
sendNativeMessage(message);
onLoad();
getBonusAccountReq();
});
const withdraw = () => {
if (!state.bonusAccount?.errCode) {
......@@ -318,7 +322,7 @@ const Bonus = defineComponent({
await bindWeiChat(params);
Toast("绑定成功");
state.showBindWx = false;
getBonusAccount();
getBonusAccountReq();
} catch (err) {
Toast("绑定失败");
} finally {
......@@ -335,7 +339,7 @@ const Bonus = defineComponent({
try {
const params = await bindWeChat();
await bindWeiChat(params);
getBonusAccount();
getBonusAccountReq();
Toast("绑定成功");
} catch {
Toast("绑定失败");
......@@ -383,7 +387,7 @@ export default Bonus;
.bonus-account {
padding: 30px;
color: #fff;
background: url("../../assets/images/bonus/account-bg.png") no-repeat;
background: url("~@/assets/images/bonus/account-bg.png") no-repeat;
background-size: 100% 100%;
margin-bottom: 30px;
.bonus-account-money {
......@@ -392,7 +396,7 @@ export default Bonus;
font-size: 72px;
font-weight: 600;
.frozen {
background: url("../../assets/images/bonus/frozen.png") no-repeat;
background: url("~@/assets/images/bonus/frozen.png") no-repeat;
background-size: 100% 100%;
font-size: 26px;
display: inline-block;
......
......@@ -34,7 +34,7 @@
</div>
<van-cell class="van-cell-tip" title="提现至" size="large" :border="false">
<div class="slot-value">
<img class="wechat" src="../../../assets/images/bonus/wechat.png" alt="微信图片" />
<img class="wechat" src="~@/assets/images/bonus/wechat.png" alt="微信图片" />
<span class="van-ellipsis">微信名字:{{ withdrawAccount }}</span>
</div>
</van-cell>
......@@ -81,7 +81,7 @@
<div class="handle-btns">
<van-button
:loading="withdrawing"
:disabled="withdrawing"
:disabled="withdrawing || !tencentCaptchPass || !smsVerifyCode"
loading-text="提现中..."
round
type="primary"
......@@ -186,7 +186,8 @@ const Withdraw = defineComponent({
withdrawAccount: "",
withdrawResponse: {},
studentDailyWithdrawLimit: 0, // 学生单日提现上限
withdrawing: false
withdrawing: false,
tencentCaptchPass: false // 图形验证码是否通过
});
const { withdrawableTotal, withdrawAccount } = route.params;
state.withdrawableTotal = Number(withdrawableTotal);
......@@ -221,6 +222,7 @@ const Withdraw = defineComponent({
const { data } = await checkCaptcha({ randStr: randstr, ticket });
state.mobileTip = data;
if (ret === 0) {
state.tencentCaptchPass = true;
countDown(60, 1000, (time: number) => {
time === 0 ? (state.showTime = `获取验证码`) : (state.showTime = `${time} 后再获取`);
});
......@@ -355,7 +357,7 @@ export default Withdraw;
padding: 48px;
color: #fff;
.withdraw-dialog-header {
background: url("../../../assets/images/bonus/withdraw-bg.png") no-repeat;
background: url("~@/assets/images/bonus/withdraw-bg.png") no-repeat;
background-size: 100%;
padding: 32px 30px;
.withdraw-dialog-header-money {
......@@ -396,7 +398,7 @@ export default Withdraw;
::v-deep .withdraw-success-dialog {
padding: 60px 51px 35px;
background: url("../../../assets/images/bonus/withdraw-success.png") no-repeat;
background: url("~@/assets/images/bonus/withdraw-success.png") no-repeat;
background-size: 100% 100%;
height: 785px;
box-sizing: border-box;
......
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