Commit eec09bac by chenwq

优化用户信息展示,调整统计数据获取逻辑,更新样式和组件引用

1 parent 4368a5a5
import http from '../request/http'
const common = 'scrm.api.carlife.common.'
module.exports = {
/**上传图片
*/
......
import api from '../request/http'
import http from '../request/http'
module.exports = {
/**. 分页查询订单 */
getOrderList(data) {
return api.post({
method: `scrm.api.shopmall.platform.order.page`,
...data
})
},
/**. 分页查询订单 */
getSalesOrderList(data) {
return api.post({
method: `scrm.api.shopmall.platform.after.sales.order.page`,
...data
})
},
/**获取订单状态数量 */
getOrderNumberList(data) {
return api.post({
method: 'scrm.api.shopmall.weapp.order.statis',
...data
})
},
/**获取客户保存的地址列表 */
getCustomerAddressList(data) {
return api.post({
method: 'scrm.api.shopmall.platform.customer.address.list',
...data
})
},
/**保存或更新收货地址 */
saveAddress(data) {
return api.post({
method: 'scrm.api.shopmall.platform.customer.address.save',
...data
})
},
/**删除收货地址 */
removeAddress(data) {
return api.post({
method: 'scrm.api.shopmall.platform.customer.address.delete',
...data
})
},
/**获取地址基础数据 */
getBaseAddress(data) {
return api.post({
method: 'scrm.api.shopmall.platform.base.address.list',
...data
})
},
/**数据统计 */
getStatistics() {
return http.get({method: '/rest/audit/statistics'})
}
}
\ No newline at end of file
// pages/tab/mine/index.js
import commonApi from "~/api/module/common";
import mineApi from "~/api/module/mine";
Page({
/**
* 页面的初始数据
......@@ -10,15 +11,20 @@ Page({
userInfo: null,
firstChar: "",
scoreSummary: {
totalPost: 9,
dealCount: 3,
dealRate: '33%'
publishCount: '',
soldCount: '',
transactionRate: ''
},
statConfig: [
{ icon: '/mine/icon-total.png', label: '发拍总数', key: 'publishCount', valueClass: 'text-black' },
{ icon: '/mine/icon-count.png', label: '成交数量', key: 'soldCount', valueClass: 'text-green' },
{ icon: '/mine/icon-rate.png', label: '成交率', key: 'transactionRate', valueClass: 'text-orange' }
],
showLogoutDialog: false,
logoutButtons: [
{ text: '取消', extClass: 'btn_cancel', eventFn: 'dialogCancel' },
{ text: '确认退出', extClass: 'btn_primary', eventFn: 'dialogConfirm' }
]
{ text: "取消", extClass: "btn_cancel", eventFn: "dialogCancel" },
{ text: "确认退出", extClass: "btn_primary", eventFn: "dialogConfirm" },
],
},
/**
......@@ -27,18 +33,26 @@ Page({
onLoad(options) {
let userInfo = wx.p.storage.get("userInfo");
let firstChar = "";
if (userInfo && userInfo.nickName) {
firstChar = userInfo.nickName.substring(0, 1);
if (userInfo && userInfo.userName) {
firstChar = userInfo.userName.substring(0, 1);
}
this.setData({
userInfo,
firstChar
firstChar,
});
this.searchScoreSummaryData();
},
searchScoreSummaryData() {
getStatistics() {
// 模拟数据或者根据实际接口获取发拍总数等数据
mineApi.getStatistics().then((res) => {
this.setData({
scoreSummary: {
publishCount: res.publishCount || 0,
soldCount: res.soldCount || 0,
transactionRate: res.transactionRate + "%",
},
});
});
},
navbarReady(e) {
......@@ -59,15 +73,18 @@ Page({
onLogoutConfirm() {
this.toggleLogoutDialog();
wx.p.wxApi.showLoading("加载中...");
commonApi.logout().then(() => {
wx.hideLoading();
wx.p.storage.rm("token");
wx.p.isLogin = false;
wx.p.storage.rm("userInfo");
wx.p.router.redirectTo("/pages/Login/Login");
}).catch(() => {
wx.hideLoading();
})
commonApi
.logout()
.then(() => {
wx.hideLoading();
wx.p.storage.rm("token");
wx.p.isLogin = false;
wx.p.storage.rm("userInfo");
wx.p.router.redirectTo("/pages/Login/Login");
})
.catch(() => {
wx.hideLoading();
});
},
goToInspection() {
......@@ -75,7 +92,7 @@ Page({
// wx.p.router.go("/pages/inspection/index");
},
onShow:function() {
this.searchScoreSummaryData();
onShow: function () {
this.getStatistics();
},
});
{
"usingComponents": {
"myOrder":"./components/myOrder/myOrder",
"Dialog": "/components/Dialog/Dialog"
"Dialog": "/components/Dialog/Dialog",
"glsx-image": "/components/image/index"
},
"navigationStyle": "custom",
"backgroundColor": "#F3F7FF"
......
......@@ -22,22 +22,22 @@ page {
}
.content {
padding: 0 32rpx;
padding-bottom: 200rpx;
padding: 0 30rpx;
padding-bottom: 48rpx;
}
/* User Info */
.user-info {
display: flex;
align-items: center;
margin-top: 40rpx;
margin-bottom: 60rpx;
padding-top: 64rpx;
margin-bottom: 48rpx;
}
.avatar {
width: 120rpx;
height: 120rpx;
background: #3b71e8;
width: 112rpx;
height: 112rpx;
background: #185EFE;
border-radius: 50%;
display: flex;
align-items: center;
......@@ -47,9 +47,9 @@ page {
}
.avatar-text {
font-size: 60rpx;
font-size: 46rpx;
color: #fff;
font-weight: 500;
font-weight: 600;
}
.avatar-img {
......@@ -63,10 +63,16 @@ page {
}
.name {
width: calc(100vw - 120rpx - 32rpx - 60rpx); /* 头像宽度 + 间距 + 预留箭头空间 */
font-size: 44rpx;
font-weight: 600;
color: #333;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Stats Card */
.stats-card {
......@@ -76,8 +82,10 @@ page {
}
.stat-item {
width: 216rpx;
height: 160rpx;
box-sizing: border-box;
width: 232rpx;
height: 192rpx;
padding: 16rpx 32rpx;
background: #fff;
border-radius: 24rpx;
display: flex;
......@@ -85,20 +93,25 @@ page {
justify-content: center;
padding-left: 24rpx;
box-sizing: border-box;
margin-right: 16rpx;
}
.stat-item:last-child {
margin-right: 0;
}
.stat-label {
display: flex;
align-items: center;
// display: flex;
// align-items: center;
font-size: 24rpx;
color: #999;
margin-bottom: 16rpx;
color: #00000066;
margin-bottom: 8rpx;
}
.stat-icon {
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
width: 40rpx;
height: 40rpx;
margin-bottom: 8rpx;
}
.stat-value {
......@@ -158,7 +171,6 @@ page {
.menu-list {
background: #fff;
border-radius: 24rpx;
padding: 0 32rpx;
margin-bottom: 24rpx;
}
......@@ -166,22 +178,13 @@ page {
display: flex;
align-items: center;
height: 140rpx;
}
.menu-icon-wrap {
width: 72rpx;
height: 72rpx;
background: #3b71e8;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
padding: 20rpx 20rpx;
}
.menu-icon {
width: 40rpx;
height: 40rpx;
width: 96rpx;
height: 96rpx;
margin-right: 24rpx;
}
.menu-content {
......@@ -214,6 +217,7 @@ page {
}
.version {
text-align: center;
font-size: 24rpx;
color: #999;
margin-bottom: 40rpx;
......@@ -223,14 +227,14 @@ page {
width: var(--fontSize720) !important;
height: var(--fontSize96);
line-height: var(--fontSize88);
background: #F3F3F3;
background: #f3f3f3;
border-radius: var(--fontSize182);
font-size: 32rpx;
font-weight: 600;
color: #000000E5;
font-weight: 600;
color: #000000e5;
font-weight: normal;
border: none;
padding: 0;
padding: 0;
}
.logout-btn::after {
......
......@@ -16,68 +16,51 @@
<view class="user-info">
<view class="avatar">
<text class="avatar-text" wx:if="{{firstChar}}">{{firstChar}}</text>
<image
wx:elif="{{userInfo && userInfo.headImgUrl}}"
src="{{userInfo.headImgUrl}}"
class="avatar-img" />
<text class="avatar-text" wx:else>未</text>
</view>
<view class="name-box">
<text class="name" wx:if="{{userInfo}}">{{userInfo.nickName || '微信用户'}}</text>
<text
class="name"
wx:else
bindtap="login"
>点击登录</text>
<text class="name text-hide">{{userInfo.userName || '微信用户'}}</text>
</view>
</view>
<!-- Stats Card -->
<view class="stats-card">
<view class="stat-item">
<view
class="stat-item"
wx:for="{{statConfig}}"
wx:key="key"
>
<view class="stat-label">
<image class="stat-icon" src="/assets/images/icon-post.png" />
<text>发拍总数</text>
<glsx-image src="{{item.icon}}" class="stat-icon">
</glsx-image>
<view>{{item.label}}</view>
</view>
<view class="stat-value text-black">9</view>
</view>
<view class="stat-item">
<view class="stat-label">
<image class="stat-icon" src="/assets/images/icon-deal.png" />
<text>成交数量</text>
</view>
<view class="stat-value text-green">3</view>
</view>
<view class="stat-item">
<view class="stat-label">
<image class="stat-icon" src="/assets/images/icon-rate.png" />
<text>成交率</text>
</view>
<view class="stat-value text-orange">33%</view>
<view class="stat-value {{item.valueClass}}">{{scoreSummary[item.key]}}</view>
</view>
</view>
<!-- Info List -->
<view class="info-list">
<view class="info-item">
<view class="info-label">
<image class="info-icon" src="/assets/images/icon-id.png" />
<glsx-image src="/mine/account.png" class="info-icon">
</glsx-image>
<text>账号ID</text>
</view>
<view class="info-value">D0001</view>
</view>
<view class="info-item border-none">
<view class="info-label">
<image class="info-icon" src="/assets/images/icon-phone.png" />
<glsx-image src="/mine/phone.png" class="info-icon">
</glsx-image>
<text>手机号</text>
</view>
<view class="info-value">{{userInfo ? (userInfo.phone || '138****0000') : '138****0000'}}</view>
<view class="info-value">{{userInfo ? userInfo.phone : ''}}</view>
</view>
</view>
<!-- Menu List -->
<view class="menu-list">
<view class="menu-item" bindtap="goToInspection">
<view class="menu-icon-wrap">
<image class="menu-icon" src="/assets/images/icon-inspection.png" />
</view>
<glsx-image src="/mine/detection.png" class="menu-icon">
</glsx-image>
<view class="menu-content">
<view class="menu-title">检测管理</view>
<view class="menu-desc">查看车辆检测报告</view>
......@@ -86,9 +69,9 @@
</view>
</view>
</view>
<view class="version">优加发拍V1.0.0</view>
<!-- Footer -->
<view class="footer">
<view class="version">优加发拍V1.0.0</view>
<button
class="logout-btn"
bindtap="toggleLogoutDialog"
......@@ -97,7 +80,6 @@
退出登录
</button>
</view>
<Dialog
show="{{showLogoutDialog}}"
title="退出登录"
......
......@@ -16,7 +16,7 @@
"miniprogram": {
"list": [
{
"name": "packageIndex/pages/editOrder/index/index",
"name": "新增/编辑发拍单",
"pathName": "packageIndex/pages/editOrder/index/index",
"query": "",
"launchMode": "default",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!