优化页面

This commit is contained in:
TOP糯米 2023-04-01 10:37:32 +08:00
parent 6e96d9cb9c
commit 2758dbd01c
6 changed files with 33 additions and 52 deletions

View File

@ -83,11 +83,7 @@ export default {
default: true, default: true,
}, },
}, },
computed: { computed: {},
...mapGetters({
isLogin: "user/isLogin",
}),
},
mounted() { mounted() {
const { statusBarHeight, headerHeight } = getApp().globalData.pageConfig; const { statusBarHeight, headerHeight } = getApp().globalData.pageConfig;
// #ifndef H5 // #ifndef H5
@ -103,9 +99,6 @@ export default {
if (this.showHeader) { if (this.showHeader) {
this.bodyPaddingTop = safePaddingTop; this.bodyPaddingTop = safePaddingTop;
} }
if (this.isLogin) {
this.$store.dispatch("user/info");
}
}, },
methods: { methods: {
onClick() { onClick() {

View File

@ -91,6 +91,13 @@ export default {
mobile: response.data.mobile, mobile: response.data.mobile,
createTime: response.data.create_time, createTime: response.data.create_time,
worker: null, worker: null,
serviceData: {
times: response.data.data.count || 0,
favorableRate: response.data.data.good || "0",
grade: response.data.data.score || "0",
disposableBalance: response.data.balance || 0,
FreezeBalance: response.data.balance_no || 0,
}
}; };
if (response.data.worker) { if (response.data.worker) {
user.worker = { user.worker = {
@ -242,27 +249,6 @@ export default {
}).catch(e => { }); }).catch(e => { });
}); });
}, },
/**
* 服务数据
*/
serviceData() {
return new Promise((resolve, reject) => {
prototype.$request({
api: "user.info",
}).then(response => {
if (response.code == 1) {
return resolve({
times: response.data.data.count || 0,
favorableRate: response.data.data.good || "0",
grade: response.data.data.score || "0",
disposableBalance: response.data.balance || 0,
FreezeBalance: response.data.balance_no || 0,
});
}
return reject(response.msg);
}).catch(e => { });
});
},
/** /**
* 注销登录 * 注销登录
*/ */

View File

@ -14,7 +14,7 @@
</view> </view>
<view class="total-box"> <view class="total-box">
<text class="text">可提现金额</text> <text class="text">可提现金额</text>
<text class="num">¥ {{ balance }}</text> <text class="num">¥ {{ userInfo.serviceData.disposableBalance }}</text>
</view> </view>
</view> </view>
<view class="withdraw-section withdraw-desc"> <view class="withdraw-section withdraw-desc">
@ -31,6 +31,7 @@
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import { mapState } from "vuex";
export default { export default {
name: "member-cash-withdraw", name: "member-cash-withdraw",
data() { data() {
@ -44,12 +45,14 @@ export default {
components: { components: {
AppLayout, AppLayout,
}, },
computed: {}, computed: {
...mapState({
userInfo: (state) => state.user.info,
}),
},
onLoad() {}, onLoad() {},
onShow() { async onShow() {
this.$models.user.serviceData().then((data) => { await this.$store.dispatch("user/info", true);
this.balance = data.disposableBalance;
});
this.$models.user.withdrawExplain().then((data) => { this.$models.user.withdrawExplain().then((data) => {
this.explain = data.tixian_content; this.explain = data.tixian_content;
this.min = data.min; this.min = data.min;

View File

@ -40,27 +40,27 @@
<view class="service-data"> <view class="service-data">
<view class="section-text"> <view class="section-text">
<text>服务</text> <text>服务</text>
<text class="num">{{ serviceData.times }}</text> <text class="num">{{ userInfo.serviceData.times }}</text>
<text></text> <text></text>
</view> </view>
<view class="section-text"> <view class="section-text">
<text>好评率</text> <text>好评率</text>
<text class="num">{{ serviceData.favorableRate }}</text> <text class="num">{{ userInfo.serviceData.favorableRate }}</text>
<text>%</text> <text>%</text>
</view> </view>
<view class="section-text"> <view class="section-text">
<text>评分</text> <text>评分</text>
<text class="num">{{ serviceData.grade }}</text> <text class="num">{{ userInfo.serviceData.grade }}</text>
</view> </view>
</view> </view>
<view class="balance-box"> <view class="balance-box">
<view class="balance-section"> <view class="balance-section">
<text class="title">可提现余额</text> <text class="title">可提现余额</text>
<text class="num">{{ utils.formatNumber(serviceData.disposableBalance, 2) }}</text> <text class="num">{{ utils.formatNumber(userInfo.serviceData.disposableBalance, 2) }}</text>
</view> </view>
<view class="balance-section"> <view class="balance-section">
<text class="title">反馈期余额</text> <text class="title">反馈期余额</text>
<text class="num">{{ utils.formatNumber(serviceData.FreezeBalance, 2) }}</text> <text class="num">{{ utils.formatNumber(userInfo.serviceData.FreezeBalance, 2) }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -132,13 +132,6 @@ export default {
showService: false, showService: false,
showCarefreeModal: false, showCarefreeModal: false,
carefreeContent: "", carefreeContent: "",
serviceData: {
times: 0,
favorableRate: "0",
grade: "0",
disposableBalance: 0,
FreezeBalance: 0,
},
}; };
}, },
components: { components: {
@ -164,9 +157,6 @@ export default {
if (!this.finishInfo) { if (!this.finishInfo) {
this.$utils.toPage("/pages/member/service-info"); this.$utils.toPage("/pages/member/service-info");
} }
this.$models.user.serviceData().then((data) => {
this.serviceData = data;
});
let [typeText, typeTextColor] = this.$models.worker.worketTypeText(this.userInfo.worker.type); let [typeText, typeTextColor] = this.$models.worker.worketTypeText(this.userInfo.worker.type);
this.typeText = typeText; this.typeText = typeText;
this.typeTextColor = typeTextColor; this.typeTextColor = typeTextColor;

View File

@ -35,7 +35,7 @@
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import { mapState } from "vuex"; import { mapGetters, mapState } from "vuex";
export default { export default {
name: "member-password", name: "member-password",
data() { data() {
@ -52,9 +52,11 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
isLogin: (state) => state.user.token.length > 0,
userInfo: (state) => state.user.info, userInfo: (state) => state.user.info,
}), }),
...mapGetters({
isLogin: "user/isLogin",
}),
}, },
onLoad() { onLoad() {
if (!this.isLogin) { if (!this.isLogin) {

View File

@ -12,6 +12,13 @@ export default {
mobile: "", mobile: "",
createTime: 0, createTime: 0,
worker: {}, worker: {},
serviceData: {
times: 0,
favorableRate: "0",
grade: "0",
disposableBalance: 0,
FreezeBalance: 0,
},
}, },
}, },
getters: { getters: {