Commit eec09bac by chenwq

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

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