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