优化页面

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

View File

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

View File

@ -40,27 +40,27 @@
<view class="service-data">
<view class="section-text">
<text>服务</text>
<text class="num">{{ serviceData.times }}</text>
<text class="num">{{ userInfo.serviceData.times }}</text>
<text></text>
</view>
<view class="section-text">
<text>好评率</text>
<text class="num">{{ serviceData.favorableRate }}</text>
<text class="num">{{ userInfo.serviceData.favorableRate }}</text>
<text>%</text>
</view>
<view class="section-text">
<text>评分</text>
<text class="num">{{ serviceData.grade }}</text>
<text class="num">{{ userInfo.serviceData.grade }}</text>
</view>
</view>
<view class="balance-box">
<view class="balance-section">
<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 class="balance-section">
<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>
@ -132,13 +132,6 @@ export default {
showService: false,
showCarefreeModal: false,
carefreeContent: "",
serviceData: {
times: 0,
favorableRate: "0",
grade: "0",
disposableBalance: 0,
FreezeBalance: 0,
},
};
},
components: {
@ -164,9 +157,6 @@ export default {
if (!this.finishInfo) {
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);
this.typeText = typeText;
this.typeTextColor = typeTextColor;

View File

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

View File

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