Commit 7a97e6f2 authored by hewenhao's avatar hewenhao

feat: 优化

parent 1b008b58
...@@ -21,9 +21,6 @@ export const getBonusList = async (params: Partial<BonusListParams>) => { ...@@ -21,9 +21,6 @@ export const getBonusList = async (params: Partial<BonusListParams>) => {
); );
}; };
export const getBonusPaging = (params: Partial<BonusListParams>) =>
getBonusList(params).then(res => res.data);
// 奖励金账户信息 // 奖励金账户信息
export const getBonusAccount = (studentId: string) => { export const getBonusAccount = (studentId: string) => {
return get<BonusAccountResponse>(`/api-jksxb-app/v1/marketingAccount/bonus/count`, { studentId }); return get<BonusAccountResponse>(`/api-jksxb-app/v1/marketingAccount/bonus/count`, { studentId });
......
...@@ -6,7 +6,9 @@ import axios from "./http"; ...@@ -6,7 +6,9 @@ import axios from "./http";
* @returns * @returns
*/ */
export function get<T>(url: string, params?: object) { export function get<T>(url: string, params?: object) {
return axios.get<T>(url, { params }); return axios
.get<T>(url, { params })
.then(res => res.data);
} }
/** /**
...@@ -16,5 +18,5 @@ export function get<T>(url: string, params?: object) { ...@@ -16,5 +18,5 @@ export function get<T>(url: string, params?: object) {
* @returns * @returns
*/ */
export function post<T>(url: string, data?: object) { export function post<T>(url: string, data?: object) {
return axios.post<T>(url, data); return axios.post<T>(url, data).then(res => res.data);
} }
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
import { defineComponent, computed, onMounted } from "vue"; import { defineComponent, computed, onMounted } from "vue";
import { List, PullRefresh, Empty, Loading } from "vant"; import { List, PullRefresh, Empty, Loading } from "vant";
import { usePaging } from "@/util/use-paging"; import { usePaging } from "@/util/use-paging";
import { getBonusPaging } from "@/server/api/bonus"; import { getBonusList } from "@/server/api/bonus";
import { FlowType, BizType } from "@/model/bonus/constant"; import { FlowType, BizType } from "@/model/bonus/constant";
import { useStore } from "vuex"; import { useStore } from "vuex";
...@@ -45,7 +45,7 @@ export default defineComponent({ ...@@ -45,7 +45,7 @@ export default defineComponent({
const store = useStore(); const store = useStore();
const bonusStoreState = computed(() => store.state.bonus); const bonusStoreState = computed(() => store.state.bonus);
const [paging, loadMore, refresh, helpers] = usePaging(getBonusPaging, () => ({ const [paging, loadMore, refresh, helpers] = usePaging(getBonusList, () => ({
studentId: bonusStoreState.value.studentId, studentId: bonusStoreState.value.studentId,
flowType: "ADD" flowType: "ADD"
})); }));
...@@ -59,7 +59,7 @@ export default defineComponent({ ...@@ -59,7 +59,7 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.tab-add { .tab-add {
::v-deep(.van-pull-refresh) { :deep(.van-pull-refresh) {
min-height: calc(100vh - 80px); min-height: calc(100vh - 80px);
} }
} }
......
...@@ -147,9 +147,7 @@ const BonusDetail = defineComponent({ ...@@ -147,9 +147,7 @@ const BonusDetail = defineComponent({
}; };
try { try {
const { const { total, list } = await getBonusList(params);
data: { total, list }
} = await getBonusList(params);
if (!list || total === 0) { if (!list || total === 0) {
state.finished = true; state.finished = true;
return; return;
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
import { defineComponent, computed, onMounted } from "vue"; import { defineComponent, computed, onMounted } from "vue";
import { List, PullRefresh, Empty, Loading } from "vant"; import { List, PullRefresh, Empty, Loading } from "vant";
import { usePaging } from "@/util/use-paging"; import { usePaging } from "@/util/use-paging";
import { getBonusPaging } from "@/server/api/bonus"; import { getBonusList } from "@/server/api/bonus";
import { FlowType, BizType } from "@/model/bonus/constant"; import { FlowType, BizType } from "@/model/bonus/constant";
import { useStore } from "vuex"; import { useStore } from "vuex";
...@@ -70,7 +70,7 @@ export default defineComponent({ ...@@ -70,7 +70,7 @@ export default defineComponent({
const store = useStore(); const store = useStore();
const bonusStoreState = computed(() => store.state.bonus); const bonusStoreState = computed(() => store.state.bonus);
const [paging, loadMore, refresh, helpers] = usePaging(getBonusPaging, () => ({ const [paging, loadMore, refresh, helpers] = usePaging(getBonusList, () => ({
studentId: bonusStoreState.value.studentId, studentId: bonusStoreState.value.studentId,
flowType: "REDUCE" flowType: "REDUCE"
})); }));
...@@ -84,7 +84,7 @@ export default defineComponent({ ...@@ -84,7 +84,7 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.tab-add { .tab-add {
::v-deep(.van-pull-refresh) { :deep(.van-pull-refresh) {
min-height: calc(100vh - 80px); min-height: calc(100vh - 80px);
} }
} }
......
...@@ -259,8 +259,7 @@ const Bonus = defineComponent({ ...@@ -259,8 +259,7 @@ const Bonus = defineComponent({
message: "加载中..." message: "加载中..."
}); });
try { try {
const { data } = await getBonusAccount(bonusStoreState.value.studentId); state.bonusAccount = await getBonusAccount(bonusStoreState.value.studentId);
state.bonusAccount = data;
} finally { } finally {
Toast.clear(); Toast.clear();
} }
...@@ -273,9 +272,7 @@ const Bonus = defineComponent({ ...@@ -273,9 +272,7 @@ const Bonus = defineComponent({
const onLoad = async () => { const onLoad = async () => {
state.loading = true; state.loading = true;
try { try {
const { const { hasNextPage, list, total } = await getWithdrawList(withdrawListParams);
data: { hasNextPage, list, total }
} = await getWithdrawList(withdrawListParams);
if (!list || total === 0) { if (!list || total === 0) {
state.finished = true; state.finished = true;
return; return;
...@@ -551,7 +548,7 @@ export default Bonus; ...@@ -551,7 +548,7 @@ export default Bonus;
border-top-right-radius: 16px; border-top-right-radius: 16px;
} }
} }
::v-deep .bunus-rule-dialog { :deep .bunus-rule-dialog {
&.van-dialog { &.van-dialog {
top: 50%; top: 50%;
width: 622px; width: 622px;
......
...@@ -216,7 +216,7 @@ const Withdraw = defineComponent({ ...@@ -216,7 +216,7 @@ const Withdraw = defineComponent({
state.tencentCaptchPass = true; state.tencentCaptchPass = true;
state.smsVerifyPass = true; state.smsVerifyPass = true;
try { try {
const { data } = await checkCaptcha({ randStr: randstr, ticket }); const data = await checkCaptcha({ randStr: randstr, ticket });
Toast("发送验证码成功"); Toast("发送验证码成功");
state.mobileTip = data; state.mobileTip = data;
state.timeoutParams = countDown(60, 1000, (time: number) => { state.timeoutParams = countDown(60, 1000, (time: number) => {
...@@ -266,7 +266,7 @@ const Withdraw = defineComponent({ ...@@ -266,7 +266,7 @@ const Withdraw = defineComponent({
withdrawAmount: state.withdrawAmount, withdrawAmount: state.withdrawAmount,
withdrawAccountId: state.withdrawAccountId withdrawAccountId: state.withdrawAccountId
}; };
const { data } = await withdraw(params); const data = await withdraw(params);
state.withdrawResponse = data; state.withdrawResponse = data;
state.showWithdrawSuccess = true; state.showWithdrawSuccess = true;
state.showWithdraw = false; state.showWithdraw = false;
...@@ -289,9 +289,7 @@ const Withdraw = defineComponent({ ...@@ -289,9 +289,7 @@ const Withdraw = defineComponent({
// 获取风控值 // 获取风控值
const getWithdrawRiskReq = async () => { const getWithdrawRiskReq = async () => {
const { const { studentDailyWithdrawLimit } = await getWithdrawRisk(bonusStoreState.value.studentId);
data: { studentDailyWithdrawLimit }
} = await getWithdrawRisk(bonusStoreState.value.studentId);
state.studentDailyWithdrawLimit = studentDailyWithdrawLimit; state.studentDailyWithdrawLimit = studentDailyWithdrawLimit;
}; };
...@@ -463,8 +461,8 @@ export default Withdraw; ...@@ -463,8 +461,8 @@ export default Withdraw;
border-radius: 51px; border-radius: 51px;
} }
} }
::v-deep .withdraw-dialog, :deep .withdraw-dialog,
::v-deep .withdraw-success-dialog { :deep .withdraw-success-dialog {
overflow: initial; overflow: initial;
.close { .close {
width: 44px; width: 44px;
...@@ -477,7 +475,7 @@ export default Withdraw; ...@@ -477,7 +475,7 @@ export default Withdraw;
top: -78px; top: -78px;
} }
} }
::v-deep .withdraw-dialog { :deep .withdraw-dialog {
padding: 48px; padding: 48px;
color: #fff; color: #fff;
width: 622px; width: 622px;
...@@ -532,7 +530,7 @@ export default Withdraw; ...@@ -532,7 +530,7 @@ export default Withdraw;
} }
} }
::v-deep .withdraw-success-dialog { :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%;
......
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