This commit is contained in:
2025-09-24 20:35:15 +08:00
parent 39679f7330
commit 8a458ff0a4
12033 changed files with 1537546 additions and 13292 deletions

View File

@@ -0,0 +1,96 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const _sfc_main = {
data() {
return {
form: { phone: "", password: "" },
phoneFocused: false,
passwordFocused: false
};
},
methods: {
validate() {
const p = String(this.form.phone || "").trim();
const okPhone = /^1[3-9]\d{9}$/.test(p);
if (!okPhone) {
common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
return false;
}
return true;
},
async onLogin() {
if (!this.validate())
return;
try {
const phone = String(this.form.phone || "").trim();
const password = String(this.form.password || "");
const res = await common_http.post("/api/auth/password/login", { phone, password });
if (res && res.token) {
common_vendor.index.setStorageSync("TOKEN", res.token);
if (res.user && res.user.phone)
common_vendor.index.setStorageSync("USER_MOBILE", res.user.phone);
common_vendor.index.showToast({ title: "登录成功", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 200);
}
} catch (e) {
common_vendor.index.showToast({ title: e && e.message || "登录失败", icon: "none" });
}
},
onGoRegister() {
common_vendor.index.navigateTo({
url: "/pages/auth/register"
});
}
}
};
if (!Array) {
const _component_path = common_vendor.resolveComponent("path");
const _component_svg = common_vendor.resolveComponent("svg");
(_component_path + _component_svg)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
d: "M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2ZM21 9V7L15 4V6C15 7.66 13.66 9 12 9S9 7.66 9 6V4L3 7V9C3 10.1 3.9 11 5 11V17C5 18.1 5.9 19 7 19H9C9 20.1 9.9 21 11 21H13C14.1 21 15 20.1 15 19H17C18.1 19 19 18.1 19 17V11C20.1 11 21 10.1 21 9Z"
}),
b: common_vendor.p({
viewBox: "0 0 24 24"
}),
c: common_vendor.p({
d: "M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z"
}),
d: common_vendor.p({
viewBox: "0 0 24 24"
}),
e: common_vendor.o(($event) => $data.phoneFocused = true),
f: common_vendor.o(($event) => $data.phoneFocused = false),
g: $data.form.phone,
h: common_vendor.o(common_vendor.m(($event) => $data.form.phone = $event.detail.value, {
trim: true
})),
i: $data.phoneFocused ? 1 : "",
j: $data.form.phone ? 1 : "",
k: common_vendor.p({
d: "M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"
}),
l: common_vendor.p({
viewBox: "0 0 24 24"
}),
m: common_vendor.o(($event) => $data.passwordFocused = true),
n: common_vendor.o(($event) => $data.passwordFocused = false),
o: $data.form.password,
p: common_vendor.o(common_vendor.m(($event) => $data.form.password = $event.detail.value, {
trim: true
})),
q: $data.passwordFocused ? 1 : "",
r: $data.form.password ? 1 : "",
s: common_vendor.o((...args) => $options.onLogin && $options.onLogin(...args)),
t: common_vendor.o((...args) => $options.onGoRegister && $options.onGoRegister(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/auth/login.js.map

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "登录",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="login-container"><view class="background-decoration"><view class="circle circle-1"></view><view class="circle circle-2"></view><view class="circle circle-3"></view></view><view class="login-card"><view class="header-section"><view class="logo-container"><view class="logo-icon"><svg wx:if="{{b}}" u-s="{{['d']}}" class="icon" u-i="5ce84e30-0" bind:__l="__l" u-p="{{b}}"><path wx:if="{{a}}" u-i="5ce84e30-1,5ce84e30-0" bind:__l="__l" u-p="{{a}}"/></svg></view><text class="app-name">配件询价</text></view><text class="welcome-text">欢迎回来</text><text class="subtitle">请登录您的账户</text></view><view class="form-section"><view class="input-group"><view class="{{['input-container', i && 'focused', j && 'filled']}}"><view class="input-icon"><svg wx:if="{{d}}" u-s="{{['d']}}" class="icon" u-i="5ce84e30-2" bind:__l="__l" u-p="{{d}}"><path wx:if="{{c}}" u-i="5ce84e30-3,5ce84e30-2" bind:__l="__l" u-p="{{c}}"/></svg></view><input class="input-field" type="number" placeholder="请输入手机号" maxlength="11" bindfocus="{{e}}" bindblur="{{f}}" value="{{g}}" bindinput="{{h}}"/></view></view><view class="input-group"><view class="{{['input-container', q && 'focused', r && 'filled']}}"><view class="input-icon"><svg wx:if="{{l}}" u-s="{{['d']}}" class="icon" u-i="5ce84e30-4" bind:__l="__l" u-p="{{l}}"><path wx:if="{{k}}" u-i="5ce84e30-5,5ce84e30-4" bind:__l="__l" u-p="{{k}}"/></svg></view><input class="input-field" password placeholder="请输入密码" bindfocus="{{m}}" bindblur="{{n}}" value="{{o}}" bindinput="{{p}}"/></view></view></view><view class="actions-section"><button class="login-button" bindtap="{{s}}"><text class="button-text">登录</text></button><button class="register-button" bindtap="{{t}}"><text class="button-text">注册新账户</text></button></view><view class="footer-section"></view></view></view>

View File

@@ -0,0 +1,280 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 藏青系主色(高亮) */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.login-container {
position: relative;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 40rpx 20rpx;
overflow: hidden;
}
.background-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 0;
}
.background-decoration .circle {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
}
.background-decoration .circle.circle-1 {
width: 200rpx;
height: 200rpx;
top: 10%;
left: 10%;
animation: float 6s ease-in-out infinite;
}
.background-decoration .circle.circle-2 {
width: 150rpx;
height: 150rpx;
top: 60%;
right: 15%;
animation: float 8s ease-in-out infinite reverse;
}
.background-decoration .circle.circle-3 {
width: 100rpx;
height: 100rpx;
bottom: 20%;
left: 20%;
animation: float 5s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
}
.login-card {
position: relative;
z-index: 1;
width: 90%;
max-width: 680rpx;
background: rgba(255, 255, 255, 0.95);
-webkit-backdrop-filter: blur(20rpx);
backdrop-filter: blur(20rpx);
border-radius: 32rpx;
padding: 60rpx 40rpx 50rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.1);
border: 1rpx solid rgba(255, 255, 255, 0.2);
}
.header-section {
text-align: center;
margin-bottom: 50rpx;
}
.header-section .logo-container {
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
margin-bottom: 20rpx;
}
.header-section .logo-container .logo-icon {
width: 60rpx;
height: 60rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.header-section .logo-container .logo-icon .icon {
width: 36rpx;
height: 36rpx;
fill: white;
}
.header-section .logo-container .app-name {
font-size: 36rpx;
font-weight: 700;
color: #2d3748;
letter-spacing: 1rpx;
}
.header-section .welcome-text {
display: block;
font-size: 48rpx;
font-weight: 700;
color: #2d3748;
margin-bottom: 8rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header-section .subtitle {
display: block;
font-size: 28rpx;
color: #718096;
font-weight: 400;
}
.form-section {
margin-bottom: 40rpx;
}
.form-section .input-group {
margin-bottom: 28rpx;
}
.form-section .input-group .input-container {
position: relative;
background: #f7fafc;
border: 2rpx solid #e2e8f0;
border-radius: 16rpx;
display: flex;
align-items: center;
transition: all 0.3s ease;
}
.form-section .input-group .input-container.focused {
border-color: #667eea;
background: #ffffff;
box-shadow: 0 0 0 6rpx rgba(102, 126, 234, 0.1);
transform: translateY(-2rpx);
}
.form-section .input-group .input-container.filled {
background: #ffffff;
border-color: #cbd5e0;
}
.form-section .input-group .input-container .input-icon {
display: flex;
align-items: center;
justify-content: center;
width: 50rpx;
margin-left: 20rpx;
}
.form-section .input-group .input-container .input-icon .icon {
width: 32rpx;
height: 32rpx;
fill: #a0aec0;
transition: fill 0.3s ease;
}
.form-section .input-group .input-container.focused .input-icon .icon {
fill: #667eea;
}
.form-section .input-group .input-container .input-field {
flex: 1;
background: transparent;
border: none;
padding: 24rpx 20rpx 24rpx 12rpx;
font-size: 32rpx;
color: #2d3748;
}
.form-section .input-group .input-container .input-field::-webkit-input-placeholder {
color: #a0aec0;
font-size: 28rpx;
}
.form-section .input-group .input-container .input-field::placeholder {
color: #a0aec0;
font-size: 28rpx;
}
.actions-section {
margin-bottom: 30rpx;
}
.actions-section .login-button {
width: 100%;
height: 96rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
border-radius: 16rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.actions-section .login-button:active {
transform: translateY(2rpx);
box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.3);
}
.actions-section .login-button::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
opacity: 0;
transition: opacity 0.3s ease;
}
.actions-section .login-button:active::before {
opacity: 1;
}
.actions-section .login-button .button-text {
font-size: 32rpx;
font-weight: 600;
color: white;
letter-spacing: 1rpx;
}
.actions-section .register-button {
width: 100%;
height: 86rpx;
background: transparent;
border: 2rpx solid #e2e8f0;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
}
.actions-section .register-button:active {
background: #f7fafc;
border-color: #cbd5e0;
transform: translateY(1rpx);
}
.actions-section .register-button .button-text {
font-size: 28rpx;
font-weight: 500;
color: #718096;
}
.footer-section {
text-align: center;
}
.footer-section .hint-text {
font-size: 24rpx;
color: #a0aec0;
line-height: 1.5;
background: rgba(160, 174, 192, 0.1);
padding: 16rpx 20rpx;
border-radius: 12rpx;
border: 1rpx solid rgba(160, 174, 192, 0.2);
}
@media (max-width: 750rpx) {
.login-card {
margin: 20rpx;
padding: 50rpx 30rpx 40rpx;
}
.header-section .welcome-text {
font-size: 42rpx;
}
}

View File

@@ -0,0 +1,165 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const _sfc_main = {
data() {
return {
form: {
shopName: "",
name: "",
phone: "",
password: "",
confirmPassword: ""
},
shopNameFocused: false,
nameFocused: false,
phoneFocused: false,
passwordFocused: false,
confirmPasswordFocused: false
};
},
methods: {
validate() {
const phone = String(this.form.phone || "").trim();
const ok = /^1[3-9]\d{9}$/.test(phone);
if (!ok) {
common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
return false;
}
if (!this.form.password) {
common_vendor.index.showToast({ title: "请输入密码", icon: "none" });
return false;
}
if (this.form.password.length < 6) {
common_vendor.index.showToast({ title: "密码至少6位", icon: "none" });
return false;
}
if (!this.form.confirmPassword) {
common_vendor.index.showToast({ title: "请确认密码", icon: "none" });
return false;
}
if (this.form.password !== this.form.confirmPassword) {
common_vendor.index.showToast({ title: "两次密码不一致", icon: "none" });
return false;
}
return true;
},
async onRegister() {
if (!this.validate())
return;
const phone = String(this.form.phone || "").trim();
const name = String(this.form.name || "").trim();
const password = String(this.form.password || "");
try {
const data = await common_http.post("/api/auth/register", { phone, name: name || void 0, password });
if (data && data.token) {
common_vendor.index.setStorageSync("TOKEN", data.token);
if (data.user && data.user.phone)
common_vendor.index.setStorageSync("USER_MOBILE", data.user.phone);
common_vendor.index.showToast({ title: "注册成功", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 300);
}
} catch (e) {
const msg = e && e.message || "注册失败";
common_vendor.index.showToast({ title: msg, icon: "none" });
}
},
onGoLogin() {
common_vendor.index.navigateTo({
url: "/pages/auth/login"
});
}
}
};
if (!Array) {
const _component_path = common_vendor.resolveComponent("path");
const _component_svg = common_vendor.resolveComponent("svg");
(_component_path + _component_svg)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
d: "M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2ZM21 9V7L15 4V6C15 7.66 13.66 9 12 9S9 7.66 9 6V4L3 7V9C3 10.1 3.9 11 5 11V17C5 18.1 5.9 19 7 19H9C9 20.1 9.9 21 11 21H13C14.1 21 15 20.1 15 19H17C18.1 19 19 18.1 19 17V11C20.1 11 21 10.1 21 9Z"
}),
b: common_vendor.p({
viewBox: "0 0 24 24"
}),
c: common_vendor.p({
d: "M12,3L2,12H5V20H19V12H22L12,3M12,8.75A2.25,2.25 0 0,1 14.25,11A2.25,2.25 0 0,1 12,13.25A2.25,2.25 0 0,1 9.75,11A2.25,2.25 0 0,1 12,8.75Z"
}),
d: common_vendor.p({
viewBox: "0 0 24 24"
}),
e: common_vendor.o(($event) => $data.shopNameFocused = true),
f: common_vendor.o(($event) => $data.shopNameFocused = false),
g: $data.form.shopName,
h: common_vendor.o(common_vendor.m(($event) => $data.form.shopName = $event.detail.value, {
trim: true
})),
i: $data.shopNameFocused ? 1 : "",
j: $data.form.shopName ? 1 : "",
k: common_vendor.p({
d: "M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"
}),
l: common_vendor.p({
viewBox: "0 0 24 24"
}),
m: common_vendor.o(($event) => $data.nameFocused = true),
n: common_vendor.o(($event) => $data.nameFocused = false),
o: $data.form.name,
p: common_vendor.o(common_vendor.m(($event) => $data.form.name = $event.detail.value, {
trim: true
})),
q: $data.nameFocused ? 1 : "",
r: $data.form.name ? 1 : "",
s: common_vendor.p({
d: "M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z"
}),
t: common_vendor.p({
viewBox: "0 0 24 24"
}),
v: common_vendor.o(($event) => $data.phoneFocused = true),
w: common_vendor.o(($event) => $data.phoneFocused = false),
x: $data.form.phone,
y: common_vendor.o(common_vendor.m(($event) => $data.form.phone = $event.detail.value, {
trim: true
})),
z: $data.phoneFocused ? 1 : "",
A: $data.form.phone ? 1 : "",
B: common_vendor.p({
d: "M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"
}),
C: common_vendor.p({
viewBox: "0 0 24 24"
}),
D: common_vendor.o(($event) => $data.passwordFocused = true),
E: common_vendor.o(($event) => $data.passwordFocused = false),
F: $data.form.password,
G: common_vendor.o(common_vendor.m(($event) => $data.form.password = $event.detail.value, {
trim: true
})),
H: $data.passwordFocused ? 1 : "",
I: $data.form.password ? 1 : "",
J: common_vendor.p({
d: "M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"
}),
K: common_vendor.p({
viewBox: "0 0 24 24"
}),
L: common_vendor.o(($event) => $data.confirmPasswordFocused = true),
M: common_vendor.o(($event) => $data.confirmPasswordFocused = false),
N: $data.form.confirmPassword,
O: common_vendor.o(common_vendor.m(($event) => $data.form.confirmPassword = $event.detail.value, {
trim: true
})),
P: $data.confirmPasswordFocused ? 1 : "",
Q: $data.form.confirmPassword ? 1 : "",
R: common_vendor.o((...args) => $options.onRegister && $options.onRegister(...args)),
S: common_vendor.o((...args) => $options.onGoLogin && $options.onGoLogin(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/auth/register.js.map

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "注册",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="register-container"><view class="background-decoration"><view class="circle circle-1"></view><view class="circle circle-2"></view><view class="circle circle-3"></view></view><view class="register-card"><view class="header-section"><view class="logo-container"><view class="logo-icon"><svg wx:if="{{b}}" u-s="{{['d']}}" class="icon" u-i="41009218-0" bind:__l="__l" u-p="{{b}}"><path wx:if="{{a}}" u-i="41009218-1,41009218-0" bind:__l="__l" u-p="{{a}}"/></svg></view><text class="app-name">配件询价</text></view><text class="welcome-text">创建账户</text><text class="subtitle">请填写以下信息完成注册</text></view><view class="form-section"><view class="input-group"><view class="{{['input-container', i && 'focused', j && 'filled']}}"><view class="input-icon"><svg wx:if="{{d}}" u-s="{{['d']}}" class="icon" u-i="41009218-2" bind:__l="__l" u-p="{{d}}"><path wx:if="{{c}}" u-i="41009218-3,41009218-2" bind:__l="__l" u-p="{{c}}"/></svg></view><input class="input-field" type="text" placeholder="请输入店铺名称" bindfocus="{{e}}" bindblur="{{f}}" value="{{g}}" bindinput="{{h}}"/></view></view><view class="input-group"><view class="{{['input-container', q && 'focused', r && 'filled']}}"><view class="input-icon"><svg wx:if="{{l}}" u-s="{{['d']}}" class="icon" u-i="41009218-4" bind:__l="__l" u-p="{{l}}"><path wx:if="{{k}}" u-i="41009218-5,41009218-4" bind:__l="__l" u-p="{{k}}"/></svg></view><input class="input-field" type="text" placeholder="请输入您的姓名" bindfocus="{{m}}" bindblur="{{n}}" value="{{o}}" bindinput="{{p}}"/></view></view><view class="input-group"><view class="{{['input-container', z && 'focused', A && 'filled']}}"><view class="input-icon"><svg wx:if="{{t}}" u-s="{{['d']}}" class="icon" u-i="41009218-6" bind:__l="__l" u-p="{{t}}"><path wx:if="{{s}}" u-i="41009218-7,41009218-6" bind:__l="__l" u-p="{{s}}"/></svg></view><input class="input-field" type="number" placeholder="请输入手机号" maxlength="11" bindfocus="{{v}}" bindblur="{{w}}" value="{{x}}" bindinput="{{y}}"/></view></view><view class="input-group"><view class="{{['input-container', H && 'focused', I && 'filled']}}"><view class="input-icon"><svg wx:if="{{C}}" u-s="{{['d']}}" class="icon" u-i="41009218-8" bind:__l="__l" u-p="{{C}}"><path wx:if="{{B}}" u-i="41009218-9,41009218-8" bind:__l="__l" u-p="{{B}}"/></svg></view><input class="input-field" password placeholder="请输入密码至少6位" bindfocus="{{D}}" bindblur="{{E}}" value="{{F}}" bindinput="{{G}}"/></view></view><view class="input-group"><view class="{{['input-container', P && 'focused', Q && 'filled']}}"><view class="input-icon"><svg wx:if="{{K}}" u-s="{{['d']}}" class="icon" u-i="41009218-10" bind:__l="__l" u-p="{{K}}"><path wx:if="{{J}}" u-i="41009218-11,41009218-10" bind:__l="__l" u-p="{{J}}"/></svg></view><input class="input-field" password placeholder="请再次输入密码" bindfocus="{{L}}" bindblur="{{M}}" value="{{N}}" bindinput="{{O}}"/></view></view></view><view class="actions-section"><button class="register-button" bindtap="{{R}}"><text class="button-text">立即注册</text></button><button class="login-button" bindtap="{{S}}"><text class="button-text">已有账户?去登录</text></button></view><view class="footer-section"><text class="hint-text">注册即表示您同意我们的服务条款和隐私政策</text></view></view></view>

View File

@@ -0,0 +1,291 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 藏青系主色(高亮) */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.register-container {
position: relative;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 40rpx 20rpx;
overflow: hidden;
}
.background-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 0;
}
.background-decoration .circle {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
}
.background-decoration .circle.circle-1 {
width: 220rpx;
height: 220rpx;
top: 8%;
left: 12%;
animation: float 7s ease-in-out infinite;
}
.background-decoration .circle.circle-2 {
width: 180rpx;
height: 180rpx;
top: 65%;
right: 10%;
animation: float 9s ease-in-out infinite reverse;
}
.background-decoration .circle.circle-3 {
width: 120rpx;
height: 120rpx;
bottom: 15%;
left: 25%;
animation: float 6s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0px) rotate(0deg);
}
50% {
transform: translateY(-25px) rotate(5deg);
}
}
.register-card {
position: relative;
z-index: 1;
width: 90%;
max-width: 680rpx;
background: rgba(255, 255, 255, 0.95);
-webkit-backdrop-filter: blur(20rpx);
backdrop-filter: blur(20rpx);
border-radius: 32rpx;
padding: 50rpx 40rpx 45rpx;
box-shadow: 0 25rpx 70rpx rgba(0, 0, 0, 0.12);
border: 1rpx solid rgba(255, 255, 255, 0.3);
}
.header-section {
text-align: center;
margin-bottom: 45rpx;
}
.header-section .logo-container {
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
margin-bottom: 20rpx;
}
.header-section .logo-container .logo-icon {
width: 60rpx;
height: 60rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.header-section .logo-container .logo-icon .icon {
width: 36rpx;
height: 36rpx;
fill: white;
}
.header-section .logo-container .app-name {
font-size: 36rpx;
font-weight: 700;
color: #2d3748;
letter-spacing: 1rpx;
}
.header-section .welcome-text {
display: block;
font-size: 48rpx;
font-weight: 700;
color: #2d3748;
margin-bottom: 8rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header-section .subtitle {
display: block;
font-size: 28rpx;
color: #718096;
font-weight: 400;
}
.form-section {
margin-bottom: 40rpx;
}
.form-section .input-group {
margin-bottom: 24rpx;
}
.form-section .input-group .input-container {
position: relative;
background: #f7fafc;
border: 2rpx solid #e2e8f0;
border-radius: 16rpx;
display: flex;
align-items: center;
transition: all 0.3s ease;
}
.form-section .input-group .input-container.focused {
border-color: #667eea;
background: #ffffff;
box-shadow: 0 0 0 6rpx rgba(102, 126, 234, 0.1);
transform: translateY(-2rpx);
}
.form-section .input-group .input-container.filled {
background: #ffffff;
border-color: #cbd5e0;
}
.form-section .input-group .input-container .input-icon {
display: flex;
align-items: center;
justify-content: center;
width: 50rpx;
margin-left: 20rpx;
}
.form-section .input-group .input-container .input-icon .icon {
width: 32rpx;
height: 32rpx;
fill: #a0aec0;
transition: fill 0.3s ease;
}
.form-section .input-group .input-container.focused .input-icon .icon {
fill: #667eea;
}
.form-section .input-group .input-container .input-field {
flex: 1;
background: transparent;
border: none;
padding: 24rpx 20rpx 24rpx 12rpx;
font-size: 32rpx;
color: #2d3748;
}
.form-section .input-group .input-container .input-field::-webkit-input-placeholder {
color: #a0aec0;
font-size: 28rpx;
}
.form-section .input-group .input-container .input-field::placeholder {
color: #a0aec0;
font-size: 28rpx;
}
.actions-section {
margin-bottom: 30rpx;
}
.actions-section .register-button {
width: 100%;
height: 96rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
border-radius: 16rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.actions-section .register-button:active {
transform: translateY(2rpx);
box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.3);
}
.actions-section .register-button::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
opacity: 0;
transition: opacity 0.3s ease;
}
.actions-section .register-button:active::before {
opacity: 1;
}
.actions-section .register-button .button-text {
font-size: 32rpx;
font-weight: 600;
color: white;
letter-spacing: 1rpx;
}
.actions-section .login-button {
width: 100%;
height: 86rpx;
background: transparent;
border: 2rpx solid #e2e8f0;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
}
.actions-section .login-button:active {
background: #f7fafc;
border-color: #cbd5e0;
transform: translateY(1rpx);
}
.actions-section .login-button .button-text {
font-size: 28rpx;
font-weight: 500;
color: #718096;
}
.footer-section {
text-align: center;
}
.footer-section .hint-text {
display: block;
font-size: 24rpx;
color: #a0aec0;
line-height: 1.6;
margin-bottom: 12rpx;
}
.footer-section .static-hint {
display: block;
font-size: 22rpx;
color: #a0aec0;
line-height: 1.5;
background: rgba(160, 174, 192, 0.1);
padding: 12rpx 16rpx;
border-radius: 10rpx;
border: 1rpx solid rgba(160, 174, 192, 0.2);
}
@media (max-width: 750rpx) {
.register-card {
margin: 20rpx;
padding: 40rpx 30rpx 35rpx;
}
.header-section .welcome-text {
font-size: 42rpx;
}
.form-section .input-group {
margin-bottom: 20rpx;
}
}

View File

@@ -42,8 +42,21 @@ const _sfc_main = {
}
},
onLoad() {
const hasToken = (() => {
try {
return !!common_vendor.index.getStorageSync("TOKEN");
} catch (e) {
return false;
}
})();
if (!hasToken) {
this.items = [];
this.total = 0;
common_vendor.index.showToast({ title: "请登录使用该功能", icon: "none" });
return;
}
try {
common_vendor.index.__f__("log", "at pages/detail/index.vue:92", "[detail] onLoad route = pages/detail/index");
common_vendor.index.__f__("log", "at pages/detail/index.vue:102", "[detail] onLoad route = pages/detail/index");
} catch (e) {
}
this.computeRange();
@@ -91,6 +104,20 @@ const _sfc_main = {
this.finished = false;
this.loadMore();
},
onStartChange(e) {
var _a;
this.startDate = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) || this.startDate;
if (this.endDate && this.startDate > this.endDate)
this.endDate = this.startDate;
this.reload();
},
onEndChange(e) {
var _a;
this.endDate = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) || this.endDate;
if (this.startDate && this.endDate < this.startDate)
this.startDate = this.endDate;
this.reload();
},
async loadMore() {
if (this.loading || this.finished)
return;
@@ -137,17 +164,7 @@ const _sfc_main = {
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.n($data.range === "custom" && "active"),
b: common_vendor.o(($event) => $options.switchRange("custom")),
c: common_vendor.n($data.range === "week" && "active"),
d: common_vendor.o(($event) => $options.switchRange("week")),
e: common_vendor.n($data.range === "today" && "active"),
f: common_vendor.o(($event) => $options.switchRange("today")),
g: common_vendor.n($data.range === "month" && "active"),
h: common_vendor.o(($event) => $options.switchRange("month")),
i: common_vendor.n($data.range === "year" && "active"),
j: common_vendor.o(($event) => $options.switchRange("year")),
k: common_vendor.f($data.bizList, (b, k0, i0) => {
a: common_vendor.f($data.bizList, (b, k0, i0) => {
return {
a: common_vendor.t(b.name),
b: b.key,
@@ -155,18 +172,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
d: common_vendor.o(($event) => $options.switchBiz(b.key), b.key)
};
}),
l: $options.placeholder,
m: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
n: $data.query.kw,
o: common_vendor.o(common_vendor.m(($event) => $data.query.kw = $event.detail.value, {
b: common_vendor.t($data.startDate),
c: $data.startDate,
d: common_vendor.o((...args) => $options.onStartChange && $options.onStartChange(...args)),
e: common_vendor.t($data.endDate),
f: $data.endDate,
g: common_vendor.o((...args) => $options.onEndChange && $options.onEndChange(...args)),
h: $options.placeholder,
i: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
j: $data.query.kw,
k: common_vendor.o(common_vendor.m(($event) => $data.query.kw = $event.detail.value, {
trim: true
})),
p: common_vendor.t($options.periodLabel),
q: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
r: common_vendor.t($options.totalAmount.toFixed(2)),
s: $data.items.length
l: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
m: common_vendor.t($options.totalAmount.toFixed(2)),
n: $data.items.length
}, $data.items.length ? {
t: common_vendor.f($data.items, (it, k0, i0) => {
o: common_vendor.f($data.items, (it, k0, i0) => {
return {
a: common_vendor.t($options.formatDate(it.orderTime || it.txTime || it.createdAt)),
b: common_vendor.t(it.customerName || it.supplierName || it.accountName || it.remark || "-"),
@@ -179,8 +201,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
};
})
} : {}, {
v: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
w: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
p: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
q: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);

View File

@@ -1 +1 @@
<view class="page"><view class="seg"><view class="{{['seg-item', a]}}" bindtap="{{b}}">自定义</view><view class="{{['seg-item', c]}}" bindtap="{{d}}">本周</view><view class="{{['seg-item', e]}}" bindtap="{{f}}">今日</view><view class="{{['seg-item', g]}}" bindtap="{{h}}">本月</view><view class="{{['seg-item', i]}}" bindtap="{{j}}">本年</view></view><view class="content"><view class="biz-tabs"><view wx:for="{{k}}" wx:for-item="b" wx:key="b" class="{{['biz', b.c]}}" bindtap="{{b.d}}">{{b.a}}</view></view><view class="panel"><view class="toolbar"><view class="search"><input class="search-input" placeholder="{{l}}" bindconfirm="{{m}}" value="{{n}}" bindinput="{{o}}"/></view><view class="period">{{p}}</view><button size="mini" bindtap="{{q}}">查询</button></view><view class="total">合计:¥{{r}}</view><scroll-view scroll-y class="list" bindscrolltolower="{{v}}"><block wx:if="{{s}}"><view wx:for="{{t}}" wx:for-item="it" wx:key="g" class="item" bindtap="{{it.h}}"><view class="item-left"><view class="date">{{it.a}}</view><view class="name">{{it.b}}</view><view class="no">{{it.c}}</view></view><view class="{{['amount', it.e && 'in', it.f && 'out']}}">¥ {{it.d}}</view><view class="arrow"></view></view></block><view wx:else class="empty">暂无数据</view></scroll-view><view class="fab" bindtap="{{w}}"></view></view></view></view>
<view class="page"><view class="content"><view class="biz-tabs"><view wx:for="{{a}}" wx:for-item="b" wx:key="b" class="{{['biz', b.c]}}" bindtap="{{b.d}}">{{b.a}}</view></view><view class="panel"><view class="toolbar"><view class="period-group"><text class="period-label">期间</text><picker mode="date" value="{{c}}" bindchange="{{d}}"><view class="date-chip">{{b}}</view></picker><text class="sep">~</text><picker mode="date" value="{{f}}" bindchange="{{g}}"><view class="date-chip">{{e}}</view></picker></view><view class="search-row"><view class="search"><input class="search-input" placeholder="{{h}}" bindconfirm="{{i}}" value="{{j}}" bindinput="{{k}}"/></view><button class="btn" size="mini" bindtap="{{l}}">查询</button></view></view><view class="total">合计:¥{{m}}</view><scroll-view scroll-y class="list" bindscrolltolower="{{p}}"><block wx:if="{{n}}"><view wx:for="{{o}}" wx:for-item="it" wx:key="g" class="item" bindtap="{{it.h}}"><view class="item-left"><view class="date">{{it.a}}</view><view class="name">{{it.b}}</view><view class="no">{{it.c}}</view></view><view class="{{['amount', it.e && 'in', it.f && 'out']}}">¥ {{it.d}}</view><view class="arrow"></view></view></block><view wx:else class="empty">暂无数据</view></scroll-view><view class="fab" bindtap="{{q}}"></view></view></view></view>

View File

@@ -29,22 +29,10 @@
flex-direction: column;
height: 100vh;
}
/* 顶部分段(如需保留,可以隐藏或后续扩展) */
.seg {
display: flex;
background: #fff;
border-bottom: 2rpx solid #e5e7eb;
}
.seg-item {
flex: 1;
padding: 18rpx 0;
text-align: center;
color: #444;
}
.seg-item.active {
color: #fff;
background: #4C8DFF;
border-radius: 12rpx;
margin: 8rpx;
display: none;
}
.content {
display: flex;
@@ -82,25 +70,53 @@
}
.toolbar {
display: flex;
align-items: center;
gap: 12rpx;
padding: 8rpx 6rpx;
flex-direction: column;
gap: 10rpx;
padding: 10rpx 6rpx 6rpx;
border-bottom: 2rpx solid #e5e7eb;
}
.period-group {
display: flex;
align-items: center;
gap: 8rpx;
background: #f6f8fb;
border: 2rpx solid #e6ebf2;
border-radius: 10rpx;
padding: 8rpx 10rpx;
}
.period-label {
color: #6b778c;
}
.date-chip {
padding: 8rpx 12rpx;
background: #fff;
border: 2rpx solid #e6ebf2;
border-radius: 8rpx;
}
.sep {
color: #99a2b3;
padding: 0 6rpx;
}
.search-row {
display: flex;
align-items: center;
gap: 10rpx;
}
.search {
flex: 1;
}
.search-input {
width: 100%;
background: #f1f1f1;
background: #fff;
border-radius: 12rpx;
padding: 12rpx;
color: #111;
border: 2rpx solid #e6ebf2;
}
.period {
color: #444;
font-size: 24rpx;
padding: 0 6rpx;
.btn {
background: #4C8DFF;
color: #fff;
border: none;
}
.total {
color: #4C8DFF;

View File

@@ -2,9 +2,11 @@
const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const common_constants = require("../../common/constants.js");
const common_config = require("../../common/config.js");
const _sfc_main = {
data() {
return {
KPI_ICONS: common_config.KPI_ICONS,
kpi: { todaySales: "0.00", monthSales: "0.00", monthProfit: "0.00", stockCount: "0" },
activeTab: "home",
notices: [],
@@ -25,6 +27,19 @@ const _sfc_main = {
};
},
onLoad() {
const hasToken = (() => {
try {
return !!common_vendor.index.getStorageSync("TOKEN");
} catch (e) {
return false;
}
})();
if (!hasToken) {
this.kpi = { todaySales: "0.00", monthSales: "0.00", monthProfit: "0.00", stockCount: "0" };
this.notices = [];
common_vendor.index.showToast({ title: "请登录使用该功能", icon: "none" });
return;
}
this.fetchMetrics();
this.fetchNotices();
},
@@ -113,7 +128,7 @@ const _sfc_main = {
},
goDetail() {
try {
common_vendor.index.__f__("log", "at pages/index/index.vue:177", "[index] goDetail → /pages/detail/index");
common_vendor.index.__f__("log", "at pages/index/index.vue:198", "[index] goDetail → /pages/detail/index");
} catch (e) {
}
common_vendor.index.switchTab({ url: "/pages/detail/index" });
@@ -153,11 +168,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
}, {
b: $data.noticeError,
d: !$data.notices.length,
f: common_vendor.t($data.kpi.todaySales),
g: common_vendor.t($data.kpi.monthSales),
h: common_vendor.t($data.kpi.monthProfit),
i: common_vendor.t($data.kpi.stockCount),
j: common_vendor.f($data.features, (item, k0, i0) => {
f: $data.KPI_ICONS.todaySales,
g: common_vendor.t($data.kpi.todaySales),
h: $data.KPI_ICONS.monthSales,
i: common_vendor.t($data.kpi.monthSales),
j: $data.KPI_ICONS.monthProfit,
k: common_vendor.t($data.kpi.monthProfit),
l: $data.KPI_ICONS.stockCount,
m: common_vendor.t($data.kpi.stockCount),
n: common_vendor.f($data.features, (item, k0, i0) => {
return common_vendor.e({
a: item.img
}, item.img ? {

View File

@@ -1 +1 @@
<view class="home"><view class="notice"><view class="notice-left">公告</view><view wx:if="{{a}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">加载中...</view><view wx:elif="{{b}}" class="notice-swiper" style="display:flex;align-items:center;color:#dd524d">{{c}}</view><view wx:elif="{{d}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">暂无公告</view><swiper wx:else class="notice-swiper" circular autoplay interval="4000" duration="400" vertical><swiper-item wx:for="{{e}}" wx:for-item="n" wx:key="e"><view class="notice-item" bindtap="{{n.d}}"><text class="notice-text">{{n.a}}</text><text wx:if="{{n.b}}" class="notice-tag">{{n.c}}</text></view></swiper-item></swiper></view><view class="hero"><view class="hero-top"><text class="brand">五金配件管家</text><view class="cta"><text class="cta-text">咨询</text></view></view><view class="kpi"><view class="kpi-item"><text class="kpi-label">今日销售额</text><text class="kpi-value">{{f}}</text></view><view class="kpi-item"><text class="kpi-label">本月销售额</text><text class="kpi-value">{{g}}</text></view><view class="kpi-item"><text class="kpi-label">本月利润</text><text class="kpi-value">{{h}}</text></view><view class="kpi-item"><text class="kpi-label">库存商品数量</text><text class="kpi-value">{{i}}</text></view></view></view><view class="section-title"><text class="section-text">常用功能</text></view><view class="grid-wrap"><view class="feature-grid"><view wx:for="{{j}}" wx:for-item="item" wx:key="g" class="feature-card" bindtap="{{item.h}}"><view class="fc-icon"><image wx:if="{{item.a}}" src="{{item.b}}" class="fc-img" mode="aspectFit" binderror="{{item.c}}"></image><text wx:elif="{{item.d}}" class="fc-emoji">{{item.e}}</text><view wx:else class="fc-placeholder"></view></view><view class="fc-title">{{item.f}}</view></view></view></view></view>
<view class="home"><view class="notice"><view class="notice-left">公告</view><view wx:if="{{a}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">加载中...</view><view wx:elif="{{b}}" class="notice-swiper" style="display:flex;align-items:center;color:#dd524d">{{c}}</view><view wx:elif="{{d}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">暂无公告</view><swiper wx:else class="notice-swiper" circular autoplay interval="4000" duration="400" vertical><swiper-item wx:for="{{e}}" wx:for-item="n" wx:key="e"><view class="notice-item" bindtap="{{n.d}}"><text class="notice-text">{{n.a}}</text><text wx:if="{{n.b}}" class="notice-tag">{{n.c}}</text></view></swiper-item></swiper></view><view class="hero"><view class="hero-top"><text class="brand">五金配件管家</text><view class="cta"><text class="cta-text">咨询</text></view></view><view class="kpi kpi-grid"><view class="kpi-item kpi-card"><image src="{{f}}" class="kpi-icon" mode="aspectFit"></image><view class="kpi-content"><text class="kpi-label">今日销售额</text><text class="kpi-value">{{g}}</text></view></view><view class="kpi-item kpi-card"><image src="{{h}}" class="kpi-icon" mode="aspectFit"></image><view class="kpi-content"><text class="kpi-label">本月销售额</text><text class="kpi-value">{{i}}</text></view></view><view class="kpi-item kpi-card"><image src="{{j}}" class="kpi-icon" mode="aspectFit"></image><view class="kpi-content"><text class="kpi-label">本月利润</text><text class="kpi-value">{{k}}</text></view></view><view class="kpi-item kpi-card"><image src="{{l}}" class="kpi-icon" mode="aspectFit"></image><view class="kpi-content"><text class="kpi-label">库存商品数量</text><text class="kpi-value">{{m}}</text></view></view></view></view><view class="section-title"><text class="section-text">常用功能</text></view><view class="grid-wrap"><view class="feature-grid"><view wx:for="{{n}}" wx:for-item="item" wx:key="g" class="feature-card" bindtap="{{item.h}}"><view class="fc-icon"><image wx:if="{{item.a}}" src="{{item.b}}" class="fc-img" mode="aspectFit" binderror="{{item.c}}"></image><text wx:elif="{{item.d}}" class="fc-emoji">{{item.e}}</text><view wx:else class="fc-placeholder"></view></view><view class="fc-title">{{item.f}}</view></view></view></view></view>

View File

@@ -27,11 +27,12 @@
.home {
padding-bottom: 140rpx;
position: relative;
/* 纯白背景 */
background: #ffffff;
/* 渐变背景:顶部淡蓝过渡到白色 */
background: linear-gradient(180deg, #f8fbff 0%, #ffffff 60%);
min-height: 100vh;
}
/* 首页横幅(移除) */
/* 公告栏 */
.notice {
margin: 0 24rpx 24rpx;
@@ -109,9 +110,9 @@
/* 顶部英雄区:浅色玻璃卡片,带金色描边与柔和阴影 */
.hero {
margin: 24rpx;
padding: 32rpx;
border-radius: 28rpx;
margin: 16rpx 20rpx;
padding: 18rpx;
border-radius: 20rpx;
background: #ffffff;
border: 2rpx solid #e5e7eb;
box-shadow: none;
@@ -123,14 +124,29 @@
align-items: center;
margin-bottom: 20rpx;
}
.brand {
font-size: 42rpx;
.hero-sub {
display: flex;
gap: 12rpx;
margin-bottom: 22rpx;
flex-wrap: wrap;
}
.chip {
padding: 8rpx 16rpx;
border-radius: 999rpx;
background: rgba(76, 141, 255, 0.1);
color: #4C8DFF;
font-size: 24rpx;
font-weight: 700;
letter-spacing: 2rpx;
border: 2rpx solid rgba(76, 141, 255, 0.25);
}
.brand {
font-size: 36rpx;
font-weight: 700;
letter-spacing: 1rpx;
color: #4C8DFF;
}
.cta {
padding: 10rpx 22rpx;
padding: 8rpx 18rpx;
border-radius: 999rpx;
background: #4C8DFF;
border: 2rpx solid #4C8DFF;
@@ -156,25 +172,44 @@
border-radius: 16rpx;
padding: 16rpx 8rpx;
}
.kpi-label {
/* KPI 卡片(更扁平,降低高度) */
.kpi-grid {
grid-template-columns: repeat(2, 1fr);
gap: 16rpx;
}
.kpi-card {
display: flex;
align-items: center;
gap: 12rpx;
text-align: left;
padding: 12rpx 14rpx;
border-radius: 12rpx;
background: #fff;
border: 2rpx solid #eef2f6;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.kpi-icon {
width: 44rpx;
height: 44rpx;
opacity: 0.9;
font-size: 26rpx;
color: #444;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
line-height: 32rpx;
/* 行高>=字体,避免上沿被裁切 */
min-height: 64rpx;
/* 两行高度,防止折行挤压 */
}
.kpi-content {
display: flex;
flex-direction: column;
}
.kpi-label {
color: #6b778c;
font-weight: 700;
font-size: 24rpx;
line-height: 30rpx;
}
.kpi-value {
display: block;
margin-top: 8rpx;
font-size: 56rpx;
font-weight: 800;
color: #4C8DFF;
font-size: 36rpx;
line-height: 40rpx;
margin-top: 0;
font-weight: 800;
}
/* 常用功能:胶囊+阴影卡片样式的图标栅格(旧风格保留以防回退) */
@@ -204,59 +239,62 @@
font-weight: 700;
}
/* 功能容器:整体玻璃面板,增强融入感 */
/* 功能容器:更轻的留白 */
.grid-wrap {
margin: 0 20rpx 32rpx;
padding: 28rpx 20rpx 12rpx;
border-radius: 24rpx;
background: #ffffff;
border: 2rpx solid #e5e7eb;
box-shadow: none;
margin: 8rpx 12rpx 24rpx;
padding: 8rpx 8rpx 0;
border-radius: 20rpx;
background: transparent;
border: 0;
}
/* 新版功能卡片宫格(更现代卡片风 */
/* 功能卡片宫格:方形竖排,图标在上文字在下(与截图一致 */
.feature-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 18rpx;
padding: 18rpx 18rpx 24rpx;
grid-template-columns: repeat(3, 1fr);
gap: 14rpx;
padding: 8rpx 8rpx 18rpx;
}
.feature-card {
height: 164rpx;
background: #fff;
border: 2rpx solid #e5e7eb;
border: 2rpx solid #eef2f6;
border-radius: 16rpx;
box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.06);
padding: 18rpx;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
padding: 12rpx;
display: flex;
flex-direction: column;
align-items: center;
gap: 12rpx;
justify-content: center;
}
.fc-icon {
width: 96rpx;
height: 96rpx;
border-radius: 16rpx;
background: #f1f1f1;
width: 86rpx;
height: 86rpx;
border-radius: 18rpx;
background: #f7faff;
border: 2rpx solid #e8eef8;
display: flex;
align-items: center;
justify-content: center;
}
.fc-img {
width: 72rpx;
height: 72rpx;
width: 56rpx;
height: 56rpx;
opacity: 0.95;
}
.fc-emoji {
font-size: 56rpx;
font-size: 48rpx;
}
.fc-placeholder {
width: 72rpx;
height: 72rpx;
width: 56rpx;
height: 56rpx;
border-radius: 12rpx;
background: #f1f1f1;
border: 2rpx solid #e5e7eb;
border: 2rpx solid #e8eef8;
}
.fc-title {
margin-left: 2rpx;
font-size: 30rpx;
margin-top: 10rpx;
font-size: 26rpx;
font-weight: 700;
color: #111;
}

View File

@@ -5,21 +5,60 @@ const _sfc_main = {
data() {
return {
avatarUrl: "/static/logo.png",
shopName: "我的店铺",
mobile: ""
shopName: "未登录",
mobile: "",
pendingJsCode: "",
logging: false,
vipIsVip: false,
vipStart: "",
vipEnd: ""
};
},
onLoad() {
onShow() {
this.fetchProfile();
this.loadVipFromStorage();
try {
if (common_vendor.index.getStorageSync("TOKEN")) {
this.$forceUpdate && this.$forceUpdate();
}
} catch (e) {
}
},
computed: {
isLoggedIn() {
try {
return !!common_vendor.index.getStorageSync("TOKEN");
} catch (e) {
return false;
}
},
mobileDisplay() {
const m = String(this.mobile || "");
return m.length === 11 ? m.slice(0, 3) + "****" + m.slice(7) : m || "未绑定手机号";
},
vipStartDisplay() {
return this.formatDisplay(this.vipStart);
},
vipEndDisplay() {
return this.formatDisplay(this.vipEnd);
}
},
methods: {
// 登录相关方法已移除
async fetchProfile() {
const hasToken = (() => {
try {
return !!common_vendor.index.getStorageSync("TOKEN");
} catch (e) {
return false;
}
})();
if (!hasToken) {
this.shopName = "未登录";
this.avatarUrl = "/static/logo.png";
this.mobile = "";
return;
}
try {
await common_http.get("/api/dashboard/overview");
} catch (e) {
@@ -36,11 +75,96 @@ const _sfc_main = {
} catch (e) {
}
},
loadVipFromStorage() {
try {
const isVip = String(common_vendor.index.getStorageSync("USER_VIP_IS_VIP") || "false").toLowerCase() === "true";
const start = common_vendor.index.getStorageSync("USER_VIP_START") || "";
const end = common_vendor.index.getStorageSync("USER_VIP_END") || "";
this.vipIsVip = isVip;
this.vipStart = start;
this.vipEnd = end;
} catch (e) {
}
},
formatDisplay(value) {
if (!value)
return "-";
const s = String(value);
const m = s.match(/^(\d{4}-\d{2}-\d{2})([ T](\d{2}:\d{2}))/);
if (m)
return `${m[1]} ${m[3]}`;
return s;
},
startLogin() {
if (this.logging)
return;
this.logging = true;
const tryOnce = async () => ({});
common_vendor.index.login({ provider: "weixin", success: async (res) => {
this.pendingJsCode = res.code || "";
if (!this.pendingJsCode) {
this.logging = false;
return common_vendor.index.showToast({ title: "获取登录code失败", icon: "none" });
}
try {
await tryOnce();
} catch (e) {
const msg = e && e.message || "";
if (msg.includes("40163") || msg.toLowerCase().includes("been used")) {
common_vendor.index.login({ provider: "weixin", success: async (r2) => {
const fresh = r2.code || "";
if (!fresh) {
this.logging = false;
return;
}
try {
await tryOnce();
} finally {
this.logging = false;
}
} });
return;
}
} finally {
this.logging = false;
}
}, fail: () => {
this.logging = false;
common_vendor.index.showToast({ title: "微信登录失败", icon: "none" });
} });
},
goLogin() {
common_vendor.index.navigateTo({ url: "/pages/auth/login" });
},
goRegister() {
common_vendor.index.navigateTo({ url: "/pages/auth/register" });
},
onGetPhoneNumber(e) {
if (this.logging)
return;
this.logging = true;
common_vendor.index.login({ provider: "weixin", success: (res) => {
const jsCode = res.code || "";
if (!jsCode) {
this.logging = false;
return common_vendor.index.showToast({ title: "获取登录code失败", icon: "none" });
}
Promise.resolve().finally(() => {
this.logging = false;
});
}, fail: () => {
this.logging = false;
common_vendor.index.showToast({ title: "微信登录失败", icon: "none" });
} });
},
goSmsLogin() {
common_vendor.index.navigateTo({ url: "/pages/my/sms-login" });
},
onAvatarError() {
this.avatarUrl = "/static/logo.png";
},
goVip() {
common_vendor.index.showToast({ title: "VIP会员开发中", icon: "none" });
common_vendor.index.navigateTo({ url: "/pages/my/vip" });
},
goMyOrders() {
common_vendor.index.switchTab({ url: "/pages/detail/index" });
@@ -72,11 +196,15 @@ const _sfc_main = {
logout() {
try {
common_vendor.index.removeStorageSync("TOKEN");
common_vendor.index.removeStorageSync("LOGINED");
common_vendor.index.removeStorageSync("LOGIN_PHONE");
common_vendor.index.removeStorageSync("DEFAULT_USER_ID");
common_vendor.index.setStorageSync("ENABLE_DEFAULT_USER", "false");
common_vendor.index.removeStorageSync("USER_AVATAR");
common_vendor.index.removeStorageSync("USER_NAME");
common_vendor.index.removeStorageSync("USER_MOBILE");
common_vendor.index.removeStorageSync("SHOP_NAME");
common_vendor.index.showToast({ title: "已退出", icon: "none" });
common_vendor.index.showToast({ title: "已清理本地信息", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 300);
@@ -87,23 +215,34 @@ const _sfc_main = {
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $data.avatarUrl,
b: common_vendor.o((...args) => $options.onAvatarError && $options.onAvatarError(...args)),
c: common_vendor.t($data.shopName),
d: common_vendor.t($options.mobileDisplay),
e: common_vendor.o((...args) => $options.goVip && $options.goVip(...args)),
f: common_vendor.o((...args) => $options.goMyOrders && $options.goMyOrders(...args)),
g: common_vendor.o((...args) => $options.goSupplier && $options.goSupplier(...args)),
h: common_vendor.o((...args) => $options.goCustomer && $options.goCustomer(...args)),
i: common_vendor.o((...args) => $options.goCustomerQuote && $options.goCustomerQuote(...args)),
j: common_vendor.o((...args) => $options.goShop && $options.goShop(...args)),
k: common_vendor.o((...args) => $options.editProfile && $options.editProfile(...args)),
l: common_vendor.o((...args) => $options.goProductSettings && $options.goProductSettings(...args)),
m: common_vendor.o((...args) => $options.goSystemParams && $options.goSystemParams(...args)),
n: common_vendor.o((...args) => $options.goAbout && $options.goAbout(...args)),
o: common_vendor.o((...args) => $options.logout && $options.logout(...args))
};
return common_vendor.e({
a: !$options.isLoggedIn
}, !$options.isLoggedIn ? {
b: common_vendor.o((...args) => $options.goLogin && $options.goLogin(...args)),
c: common_vendor.o((...args) => $options.goRegister && $options.goRegister(...args))
} : {}, {
d: $data.avatarUrl,
e: common_vendor.o((...args) => $options.onAvatarError && $options.onAvatarError(...args)),
f: common_vendor.t($data.shopName),
g: common_vendor.t($options.mobileDisplay),
h: common_vendor.t($data.vipIsVip ? "VIP" : "非VIP"),
i: common_vendor.t($options.vipStartDisplay),
j: common_vendor.t($options.vipEndDisplay),
k: $data.vipIsVip ? 1 : "",
l: common_vendor.o((...args) => $options.goVip && $options.goVip(...args)),
m: common_vendor.o((...args) => $options.goMyOrders && $options.goMyOrders(...args)),
n: common_vendor.o((...args) => $options.goSupplier && $options.goSupplier(...args)),
o: common_vendor.o((...args) => $options.goCustomer && $options.goCustomer(...args)),
p: common_vendor.o((...args) => $options.goCustomerQuote && $options.goCustomerQuote(...args)),
q: common_vendor.o((...args) => $options.goShop && $options.goShop(...args)),
r: common_vendor.o((...args) => $options.editProfile && $options.editProfile(...args)),
s: common_vendor.o((...args) => $options.goProductSettings && $options.goProductSettings(...args)),
t: common_vendor.o((...args) => $options.goSystemParams && $options.goSystemParams(...args)),
v: common_vendor.o((...args) => $options.goAbout && $options.goAbout(...args)),
w: $options.isLoggedIn
}, $options.isLoggedIn ? {
x: common_vendor.o((...args) => $options.logout && $options.logout(...args))
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);

View File

@@ -1 +1 @@
<view class="me"><view class="card user"><image class="avatar" src="{{a}}" mode="aspectFill" binderror="{{b}}"/><view class="meta"><text class="name">{{c}}</text><text class="phone">{{d}}</text><text class="role">老板</text></view></view><view class="group"><view class="group-title">会员与订单</view><view class="cell" bindtap="{{e}}"><text>VIP会员</text><text class="arrow"></text></view><view class="cell" bindtap="{{f}}"><text>我的订单</text><text class="arrow"></text></view></view><view class="group"><view class="group-title">基础管理</view><view class="cell" bindtap="{{g}}"><text>供应商管理</text><text class="arrow"></text></view><view class="cell" bindtap="{{h}}"><text>客户管理</text><text class="arrow"></text></view><view class="cell" bindtap="{{i}}"><text>客户报价</text><text class="arrow"></text></view><view class="cell" bindtap="{{j}}"><text>店铺管理</text><text class="arrow"></text></view></view><view class="group"><view class="group-title">设置中心</view><view class="cell" bindtap="{{k}}"><text>账号与安全</text><text class="desc">修改头像、姓名、密码</text><text class="arrow"></text></view><view class="cell" bindtap="{{l}}"><text>商品设置</text><text class="arrow"></text></view><view class="cell" bindtap="{{m}}"><text>系统参数</text><text class="desc">低价提示、默认收款、单行折扣等</text><text class="arrow"></text></view><view class="cell" bindtap="{{n}}"><text>关于与协议</text><text class="arrow"></text></view><view class="cell danger" bindtap="{{o}}"><text>退出登录</text></view></view></view>
<view class="me"><view wx:if="{{a}}" class="card login"><view class="login-title">登录/注册以同步数据</view><button class="login-btn" type="primary" bindtap="{{b}}">登录</button><button class="login-btn minor" bindtap="{{c}}">注册</button></view><view class="card user"><image class="avatar" src="{{d}}" mode="aspectFill" binderror="{{e}}"/><view class="meta"><text class="name">{{f}}</text><text class="phone">{{g}}</text><text class="role">老板</text></view></view><view class="{{['card', 'vip', k && 'active']}}"><view class="vip-row"><text class="vip-badge">{{h}}</text><text class="vip-title">会员状态</text></view><view class="vip-meta"><view class="item"><text class="label">开始</text><text class="value">{{i}}</text></view><view class="item"><text class="label">结束</text><text class="value">{{j}}</text></view></view></view><view class="group"><view class="group-title">会员与订单</view><view class="cell" bindtap="{{l}}"><text>VIP会员</text><text class="arrow"></text></view><view class="cell" bindtap="{{m}}"><text>我的订单</text><text class="arrow"></text></view></view><view class="group"><view class="group-title">基础管理</view><view class="cell" bindtap="{{n}}"><text>供应商管理</text><text class="arrow"></text></view><view class="cell" bindtap="{{o}}"><text>客户管理</text><text class="arrow"></text></view><view class="cell" bindtap="{{p}}"><text>客户报价</text><text class="arrow"></text></view><view class="cell" bindtap="{{q}}"><text>店铺管理</text><text class="arrow"></text></view></view><view class="group"><view class="group-title">设置中心</view><view class="cell" bindtap="{{r}}"><text>账号与安全</text><text class="desc">修改头像、姓名、密码</text><text class="arrow"></text></view><view class="cell" bindtap="{{s}}"><text>商品设置</text><text class="arrow"></text></view><view class="cell" bindtap="{{t}}"><text>系统参数</text><text class="desc">低价提示、默认收款、单行折扣等</text><text class="arrow"></text></view><view class="cell" bindtap="{{v}}"><text>关于与协议</text><text class="arrow"></text></view><view wx:if="{{w}}" class="cell danger" bindtap="{{x}}"><text>退出登录</text></view></view></view>

View File

@@ -27,6 +27,27 @@
.me {
padding: 24rpx;
}
.card.login {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 22rpx;
background: #ffffff;
border-radius: 16rpx;
margin-bottom: 24rpx;
}
.login-title {
font-size: 28rpx;
font-weight: 700;
}
.login-btn.minor {
background: #f1f1f1;
color: #111;
}
.hint {
font-size: 22rpx;
color: #444;
}
.card.user {
display: flex;
gap: 18rpx;
@@ -60,6 +81,58 @@
font-size: 22rpx;
color: #444;
}
/* VIP 卡片样式 */
.card.vip {
margin-top: 24rpx;
padding: 22rpx;
background: #ffffff;
border-radius: 16rpx;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.12);
}
.card.vip.active {
border: 1rpx solid rgba(255, 208, 0, 0.6);
background-image: radial-gradient(60% 60% at 80% 0%, rgba(255, 214, 0, 0.08), transparent 60%);
}
.vip-row {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 10rpx;
}
.vip-badge {
background: #f1c40f;
color: #111;
font-weight: 800;
padding: 2rpx 10rpx;
border-radius: 8rpx;
font-size: 22rpx;
}
.vip-title {
font-size: 28rpx;
font-weight: 700;
color: #111;
}
.vip-meta {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8rpx 16rpx;
}
.vip-meta .item {
display: flex;
align-items: center;
gap: 10rpx;
}
.vip-meta .label {
width: 80rpx;
color: #444;
font-size: 24rpx;
}
.vip-meta .value {
color: #111;
font-size: 26rpx;
word-break: break-all;
}
.group {
margin-top: 24rpx;
background: #ffffff;
@@ -93,4 +166,57 @@
color: #dd524d;
justify-content: center;
font-weight: 700;
}
/* 简易对话框样式 */
.dialog-mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.45);
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
}
.dialog {
width: 600rpx;
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.2);
}
.dialog-title {
font-size: 30rpx;
font-weight: 700;
margin-bottom: 16rpx;
}
.dialog-input {
width: 100%;
height: 72rpx;
padding: 0 16rpx;
border: 1rpx solid #e5e7eb;
border-radius: 10rpx;
background: #fff;
color: #111;
}
.dialog-actions {
display: flex;
gap: 16rpx;
margin-top: 18rpx;
justify-content: flex-end;
}
.dialog-btn {
padding: 16rpx 22rpx;
border-radius: 10rpx;
}
.dialog-btn.cancel {
background: #f1f1f1;
color: #111;
}
.dialog-btn.confirm {
background: #2979ff;
color: #fff;
}

View File

@@ -0,0 +1,77 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
form: { phone: "", password: "" },
showPwd: false,
submitting: false
};
},
methods: {
validatePhone(p) {
return /^1\d{10}$/.test(String(p || ""));
},
validate() {
if (!this.validatePhone(this.form.phone)) {
common_vendor.index.showToast({ title: "请输入有效手机号", icon: "none" });
return false;
}
if (!this.form.password) {
common_vendor.index.showToast({ title: "请输入密码", icon: "none" });
return false;
}
if (this.form.password.length < 6) {
common_vendor.index.showToast({ title: "密码至少6位", icon: "none" });
return false;
}
return true;
},
submit() {
if (this.submitting)
return;
if (!this.validate())
return;
this.submitting = true;
try {
common_vendor.index.setStorageSync("LOGIN_STATUS", "logged_in");
common_vendor.index.setStorageSync("LOGIN_PHONE", this.form.phone);
try {
const uid = common_vendor.index.getStorageSync("DEFAULT_USER_ID") || "";
const enable = common_vendor.index.getStorageSync("ENABLE_DEFAULT_USER") || "";
if (!enable)
common_vendor.index.setStorageSync("ENABLE_DEFAULT_USER", "true");
if (!uid)
common_vendor.index.setStorageSync("DEFAULT_USER_ID", "2");
} catch (e) {
}
common_vendor.index.showToast({ title: "登录成功(本地)", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 500);
} finally {
this.submitting = false;
}
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $data.form.phone,
b: common_vendor.o(common_vendor.m(($event) => $data.form.phone = $event.detail.value, {
trim: true
})),
c: !$data.showPwd,
d: $data.form.password,
e: common_vendor.o(common_vendor.m(($event) => $data.form.password = $event.detail.value, {
trim: true
})),
f: common_vendor.t($data.showPwd ? "隐藏" : "显示"),
g: common_vendor.o(($event) => $data.showPwd = !$data.showPwd),
h: $data.submitting,
i: common_vendor.o((...args) => $options.submit && $options.submit(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/password-login.js.map

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "账号登录",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="login"><view class="card"><view class="title">手机号登录</view><view class="field"><text class="label">手机号</text><input class="input" type="number" placeholder="请输入手机号" maxlength="11" value="{{a}}" bindinput="{{b}}"/></view><view class="field"><text class="label">密码</text><input class="input" password="{{c}}" placeholder="请输入密码" maxlength="32" value="{{d}}" bindinput="{{e}}"/><view class="toggle" bindtap="{{g}}">{{f}}</view></view><view class="hint">本页面为静态实现,不调用后端接口,仅做本地校验与存储。</view><button class="primary" disabled="{{h}}" bindtap="{{i}}">登录</button></view></view>

View File

@@ -0,0 +1,81 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 藏青系主色(高亮) */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.login {
min-height: 100vh;
padding: 24rpx;
background: #ffffff;
}
.card {
margin-top: 60rpx;
background: #fff;
border: 2rpx solid #e5e7eb;
border-radius: 16rpx;
padding: 24rpx;
}
.title {
font-size: 36rpx;
font-weight: 800;
margin-bottom: 16rpx;
color: #111;
}
.field {
position: relative;
margin-bottom: 16rpx;
}
.label {
display: block;
margin-bottom: 8rpx;
color: #444;
}
.input {
width: 100%;
background: #f1f1f1;
border: 2rpx solid #e5e7eb;
border-radius: 12rpx;
padding: 14rpx;
color: #111;
}
.toggle {
position: absolute;
right: 12rpx;
top: 64rpx;
color: #4C8DFF;
font-size: 26rpx;
}
.hint {
color: #444;
font-size: 24rpx;
margin: 8rpx 0 16rpx;
}
.primary {
width: 100%;
background: #4C8DFF;
color: #fff;
border-radius: 999rpx;
padding: 20rpx 0;
font-weight: 800;
}

View File

@@ -0,0 +1,153 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const _sfc_main = {
data() {
return { phone: "", code: "", countdown: 0, timer: null, sending: false, logging: false, showDebug: true };
},
computed: {
btnText() {
return this.countdown > 0 ? `${this.countdown}s` : this.sending ? "发送中..." : "获取验证码";
},
trimmedPhone() {
return String(this.phone || "").trim();
},
sendBodyJson() {
return JSON.stringify({ phone: this.trimmedPhone, scene: "login" }, null, 2);
},
loginBodyJson() {
return JSON.stringify({ phone: this.trimmedPhone, code: String(this.code || "").trim() }, null, 2);
}
},
onUnload() {
if (this.timer)
clearInterval(this.timer);
},
methods: {
validatePhone(p) {
return /^1\d{10}$/.test(String(p || "").trim());
},
startCountdown(sec) {
this.countdown = sec;
if (this.timer)
clearInterval(this.timer);
this.timer = setInterval(() => {
if (this.countdown <= 1) {
clearInterval(this.timer);
this.timer = null;
this.countdown = 0;
return;
}
this.countdown--;
}, 1e3);
},
async sendCode() {
if (this.sending || this.countdown > 0)
return;
const p = String(this.phone || "").trim();
if (!this.validatePhone(p))
return common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
this.sending = true;
try {
const res = await common_http.post("/api/auth/sms/send", { phone: p, scene: "login" });
const cd = Number(res && res.cooldownSec || 60);
this.startCountdown(cd);
common_vendor.index.showToast({ title: "验证码已发送", icon: "none" });
} catch (e) {
const msg = e && e.message || "发送失败";
common_vendor.index.showToast({ title: msg, icon: "none" });
} finally {
this.sending = false;
}
},
async doLogin() {
if (this.logging)
return;
const p = String(this.phone || "").trim();
const c = String(this.code || "").trim();
if (!this.validatePhone(p))
return common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
if (!/^\d{6}$/.test(c))
return common_vendor.index.showToast({ title: "验证码格式不正确", icon: "none" });
this.logging = true;
try {
const data = await common_http.post("/api/auth/sms/login", { phone: p, code: c });
if (data && data.token) {
common_vendor.index.setStorageSync("TOKEN", data.token);
if (data.user && data.user.phone)
common_vendor.index.setStorageSync("USER_MOBILE", data.user.phone);
common_vendor.index.showToast({ title: "登录成功", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 300);
}
} catch (e) {
const msg = e && e.message || "登录失败";
common_vendor.index.showToast({ title: msg, icon: "none" });
} finally {
this.logging = false;
}
},
async quickRegister() {
if (this.logging)
return;
const p = String(this.phone || "").trim();
if (!this.validatePhone(p))
return common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
this.logging = true;
try {
const data = await common_http.post("/api/auth/register", { phone: p });
if (data && data.token) {
common_vendor.index.setStorageSync("TOKEN", data.token);
if (data.user && data.user.phone)
common_vendor.index.setStorageSync("USER_MOBILE", data.user.phone);
common_vendor.index.showToast({ title: "注册成功", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 300);
}
} catch (e) {
const msg = e && e.message || "注册失败";
common_vendor.index.showToast({ title: msg, icon: "none" });
} finally {
this.logging = false;
}
},
copy(text) {
try {
common_vendor.index.setClipboardData({ data: String(text || "") });
common_vendor.index.showToast({ title: "已复制", icon: "none" });
} catch (e) {
}
},
toggleDebug() {
this.showDebug = !this.showDebug;
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.phone,
b: common_vendor.o(($event) => $data.phone = $event.detail.value),
c: $data.code,
d: common_vendor.o(($event) => $data.code = $event.detail.value),
e: common_vendor.t($options.btnText),
f: $data.countdown > 0 || $data.sending,
g: common_vendor.o((...args) => $options.sendCode && $options.sendCode(...args)),
h: $data.logging,
i: common_vendor.o((...args) => $options.doLogin && $options.doLogin(...args)),
j: $data.logging,
k: common_vendor.o((...args) => $options.quickRegister && $options.quickRegister(...args)),
l: common_vendor.t($data.showDebug ? "收起" : "展开"),
m: common_vendor.o((...args) => $options.toggleDebug && $options.toggleDebug(...args)),
n: $data.showDebug
}, $data.showDebug ? {
o: common_vendor.t($options.sendBodyJson),
p: common_vendor.o(($event) => $options.copy($options.sendBodyJson)),
q: common_vendor.t($options.loginBodyJson),
r: common_vendor.o(($event) => $options.copy($options.loginBodyJson))
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/sms-login.js.map

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "短信验证码登录",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="page sms-login"><view class="card"><view class="title">短信验证码登录</view><view class="form"><input class="input" type="number" maxlength="11" placeholder="请输入手机号" value="{{a}}" bindinput="{{b}}"/><view class="row"><input class="input code" type="number" maxlength="6" placeholder="请输入验证码" value="{{c}}" bindinput="{{d}}"/><button class="send" disabled="{{f}}" bindtap="{{g}}">{{e}}</button></view><button class="login" type="primary" disabled="{{h}}" bindtap="{{i}}">登录/注册</button><button class="login" disabled="{{j}}" bindtap="{{k}}">注册为店主</button></view><view class="hint">首次登录将自动创建店铺与店主用户。</view><view class="debug"><view class="debug-title" bindtap="{{m}}">请求体示例(点击{{l}}</view><view wx:if="{{n}}" class="debug-body"><view class="code-title">POST /api/auth/sms/send</view><view class="code-wrap"><text class="code">{{o}}</text><button size="mini" class="copy" bindtap="{{p}}">复制</button></view><view class="code-title">POST /api/auth/sms/login</view><view class="code-wrap"><text class="code">{{q}}</text><button size="mini" class="copy" bindtap="{{r}}">复制</button></view></view></view></view></view>

View File

@@ -0,0 +1,104 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 藏青系主色(高亮) */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.sms-login {
padding: 24rpx;
}
.card {
background: #ffffff;
border-radius: 16rpx;
padding: 28rpx;
}
.title {
font-size: 32rpx;
font-weight: 700;
margin-bottom: 20rpx;
}
.form {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.row {
display: flex;
gap: 12rpx;
}
.input {
background: #fff;
border: 1rpx solid #e5e7eb;
border-radius: 12rpx;
padding: 20rpx;
font-size: 28rpx;
flex: 1;
}
.input.code {
flex: 1;
}
.send {
min-width: 220rpx;
}
.login {
margin-top: 8rpx;
}
.hint {
margin-top: 12rpx;
font-size: 22rpx;
color: #444;
}
.debug {
margin-top: 20rpx;
}
.debug-title {
font-size: 26rpx;
color: #444;
}
.debug-body {
margin-top: 12rpx;
display: flex;
flex-direction: column;
gap: 12rpx;
}
.code-title {
font-size: 24rpx;
color: #444;
}
.code-wrap {
position: relative;
background: #fff;
border: 1rpx solid #e5e7eb;
border-radius: 12rpx;
padding: 16rpx;
}
.code {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 24rpx;
white-space: pre-wrap;
}
.copy {
position: absolute;
top: 8rpx;
right: 8rpx;
}

View File

@@ -0,0 +1,52 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_config = require("../../common/config.js");
const _sfc_main = {
data() {
return {
isVip: false,
expire: "",
price: common_config.VIP_PRICE_PER_MONTH
};
},
onShow() {
this.loadVip();
},
computed: {
expireDisplay() {
const s = String(this.expire || "");
return s || "11年11月11日";
}
},
methods: {
loadVip() {
try {
this.isVip = String(common_vendor.index.getStorageSync("USER_VIP_IS_VIP") || "false").toLowerCase() === "true";
this.expire = common_vendor.index.getStorageSync("USER_VIP_END") || "";
} catch (e) {
}
},
onPay() {
common_vendor.index.showToast({ title: "静态页面演示:支付功能未接入", icon: "none" });
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.t($data.isVip ? "VIP会员" : "成为VIP会员"),
b: common_vendor.t($data.isVip ? "尊享专属特权" : "解锁更多权益"),
c: common_vendor.t($data.isVip ? "VIP会员" : "普通用户"),
d: $data.isVip ? 1 : "",
e: $data.isVip
}, $data.isVip ? {
f: common_vendor.t($options.expireDisplay)
} : {}, {
g: !$data.isVip
}, !$data.isVip ? {
h: common_vendor.t($data.price),
i: common_vendor.o((...args) => $options.onPay && $options.onPay(...args))
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/vip.js.map

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "VIP会员",
"navigationBarBackgroundColor": "#1a1a2e",
"navigationBarTextStyle": "white",
"backgroundColor": "#1a1a2e",
"backgroundTextStyle": "light",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="vip-page" style="background:linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);min-height:100vh"><view class="main-content"><view class="vip-header"><view class="vip-crown"><text class="crown-icon">👑</text></view><text class="vip-title">{{a}}</text><text class="vip-subtitle">{{b}}</text><view class="{{['vip-status', d && 'active']}}"><text class="status-text">{{c}}</text></view></view><view class="features-section"><text class="section-title">会员功能</text><view class="feature-card"><view class="feature-icon">💾</view><text class="feature-text">永久存储数据</text></view></view><view wx:if="{{e}}" class="vip-info"><view class="info-card"><text class="info-label">会员状态</text><text class="info-value active">已激活</text></view><view class="info-card"><text class="info-label">有效期至</text><text class="info-value">{{f}}</text></view></view><view wx:if="{{g}}" class="purchase-section"><view class="price-card"><text class="price-label">会员价格</text><view class="price-display"><text class="price-symbol">¥</text><text class="price-amount">{{h}}</text><text class="price-period">/月</text></view></view><button class="purchase-btn" bindtap="{{i}}"><text class="btn-text">立即开通VIP</text></button></view></view><view class="bg-decoration"><view class="decoration-circle circle-1"></view><view class="decoration-circle circle-2"></view><view class="decoration-circle circle-3"></view></view></view>

View File

@@ -0,0 +1,264 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 藏青系主色(高亮) */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
page {
background: #1a1a2e !important;
}
.vip-page {
min-height: 100vh;
width: 100%;
position: relative;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
overflow: hidden;
display: flex;
flex-direction: column;
}
.main-content {
flex: 1;
padding: 60rpx 40rpx 40rpx;
position: relative;
z-index: 10;
}
/* VIP头部区域 */
.vip-header {
text-align: center;
margin-bottom: 80rpx;
}
.vip-header .vip-crown {
margin-bottom: 30rpx;
}
.vip-header .vip-crown .crown-icon {
font-size: 80rpx;
filter: drop-shadow(0 4rpx 12rpx rgba(255, 215, 0, 0.3));
}
.vip-header .vip-title {
display: block;
font-size: 48rpx;
font-weight: 700;
color: #fff;
margin-bottom: 16rpx;
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.vip-header .vip-subtitle {
display: block;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.8);
margin-bottom: 40rpx;
}
.vip-header .vip-status {
display: inline-block;
padding: 16rpx 32rpx;
border-radius: 50rpx;
background: rgba(0, 0, 0, 0.2);
-webkit-backdrop-filter: blur(10rpx);
backdrop-filter: blur(10rpx);
border: 1rpx solid rgba(255, 215, 0, 0.4);
}
.vip-header .vip-status.active {
background: linear-gradient(45deg, #ffd700, #ffed4e);
border: 1rpx solid rgba(255, 215, 0, 0.3);
}
.vip-header .vip-status.active .status-text {
color: #333;
}
.vip-header .vip-status .status-text {
font-size: 26rpx;
font-weight: 600;
color: #fff;
}
/* 会员功能区域 */
.features-section {
margin-bottom: 60rpx;
}
.features-section .section-title {
display: block;
font-size: 36rpx;
font-weight: 600;
color: #fff;
text-align: center;
margin-bottom: 40rpx;
}
.features-section .feature-card {
background: rgba(0, 0, 0, 0.15);
-webkit-backdrop-filter: blur(15rpx);
backdrop-filter: blur(15rpx);
border-radius: 24rpx;
padding: 40rpx;
text-align: center;
border: 1rpx solid rgba(255, 215, 0, 0.3);
transition: all 0.3s ease;
}
.features-section .feature-card:hover {
transform: translateY(-4rpx);
box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.15);
}
.features-section .feature-card .feature-icon {
font-size: 60rpx;
margin-bottom: 24rpx;
filter: drop-shadow(0 4rpx 12rpx rgba(255, 215, 0, 0.3));
}
.features-section .feature-card .feature-text {
display: block;
font-size: 32rpx;
font-weight: 600;
color: #fff;
letter-spacing: 1rpx;
}
/* VIP信息卡片 */
.vip-info {
margin-bottom: 60rpx;
}
.vip-info .info-card {
background: rgba(0, 0, 0, 0.15);
-webkit-backdrop-filter: blur(15rpx);
backdrop-filter: blur(15rpx);
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 20rpx;
border: 1rpx solid rgba(255, 215, 0, 0.3);
display: flex;
justify-content: space-between;
align-items: center;
}
.vip-info .info-card .info-label {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.8);
}
.vip-info .info-card .info-value {
font-size: 30rpx;
font-weight: 600;
color: #fff;
}
.vip-info .info-card .info-value.active {
color: #ffd700;
}
/* 购买区域 */
.purchase-section .price-card {
background: rgba(0, 0, 0, 0.15);
-webkit-backdrop-filter: blur(15rpx);
backdrop-filter: blur(15rpx);
border-radius: 24rpx;
padding: 40rpx;
text-align: center;
margin-bottom: 40rpx;
border: 1rpx solid rgba(255, 215, 0, 0.3);
}
.purchase-section .price-card .price-label {
display: block;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.8);
margin-bottom: 16rpx;
}
.purchase-section .price-card .price-display {
display: flex;
align-items: baseline;
justify-content: center;
gap: 8rpx;
}
.purchase-section .price-card .price-display .price-symbol {
font-size: 32rpx;
color: #ffd700;
font-weight: 600;
}
.purchase-section .price-card .price-display .price-amount {
font-size: 60rpx;
font-weight: 700;
color: #ffd700;
}
.purchase-section .price-card .price-display .price-period {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.8);
}
.purchase-section .purchase-btn {
width: 100%;
height: 96rpx;
background: linear-gradient(45deg, #ffd700, #ffed4e);
border-radius: 50rpx;
border: none;
box-shadow: 0 8rpx 24rpx rgba(255, 215, 0, 0.3);
transition: all 0.3s ease;
}
.purchase-section .purchase-btn:active {
transform: translateY(2rpx);
box-shadow: 0 4rpx 16rpx rgba(255, 215, 0, 0.4);
}
.purchase-section .purchase-btn .btn-text {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
/* 背景装饰 */
.bg-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
z-index: 1;
}
.bg-decoration .decoration-circle {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.05);
}
.bg-decoration .decoration-circle.circle-1 {
width: 300rpx;
height: 300rpx;
top: -150rpx;
right: -100rpx;
}
.bg-decoration .decoration-circle.circle-2 {
width: 200rpx;
height: 200rpx;
bottom: 200rpx;
left: -100rpx;
}
.bg-decoration .decoration-circle.circle-3 {
width: 150rpx;
height: 150rpx;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
}
/* 响应式调整 */
@media (max-width: 375px) {
.benefits-grid {
grid-template-columns: 1fr;
}
.vip-header .vip-title {
font-size: 42rpx;
}
.main-content {
padding: 40rpx 30rpx;
}
}

View File

@@ -34,7 +34,19 @@ const _sfc_main = {
selectedAccountName: "",
// 收款/付款输入
payments: { cash: 0, bank: 0, wechat: 0 },
showMore: false
showMore: false,
SEG_ICONS: {
sale: {
out: "/static/icons/sale.png",
return: "/static/icons/other-pay.png",
collect: "/static/icons/report.png"
},
purchase: {
in: "/static/icons/purchase.png",
return: "/static/icons/other-pay.png",
pay: "/static/icons/account.png"
}
}
};
},
computed: {
@@ -279,81 +291,87 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
h: common_vendor.o(($event) => $options.switchBiz("expense")),
i: $data.biz === "sale"
}, $data.biz === "sale" ? {
j: $data.saleType === "out" ? 1 : "",
k: common_vendor.o(($event) => $data.saleType = "out"),
l: $data.saleType === "return" ? 1 : "",
m: common_vendor.o(($event) => $data.saleType = "return"),
n: $data.saleType === "collect" ? 1 : "",
o: common_vendor.o(($event) => $data.saleType = "collect")
j: $data.SEG_ICONS.sale.out,
k: common_vendor.n($data.saleType === "out" && "active"),
l: common_vendor.o(($event) => $data.saleType = "out"),
m: $data.SEG_ICONS.sale.return,
n: common_vendor.n($data.saleType === "return" && "active"),
o: common_vendor.o(($event) => $data.saleType = "return"),
p: $data.SEG_ICONS.sale.collect,
q: common_vendor.n($data.saleType === "collect" && "active"),
r: common_vendor.o(($event) => $data.saleType = "collect")
} : $data.biz === "purchase" ? {
q: $data.purchaseType === "in" ? 1 : "",
r: common_vendor.o(($event) => $data.purchaseType = "in"),
s: $data.purchaseType === "return" ? 1 : "",
t: common_vendor.o(($event) => $data.purchaseType = "return"),
v: $data.purchaseType === "pay" ? 1 : "",
w: common_vendor.o(($event) => $data.purchaseType = "pay")
t: $data.SEG_ICONS.purchase.in,
v: common_vendor.n($data.purchaseType === "in" && "active"),
w: common_vendor.o(($event) => $data.purchaseType = "in"),
x: $data.SEG_ICONS.purchase.return,
y: common_vendor.n($data.purchaseType === "return" && "active"),
z: common_vendor.o(($event) => $data.purchaseType = "return"),
A: $data.SEG_ICONS.purchase.pay,
B: common_vendor.n($data.purchaseType === "pay" && "active"),
C: common_vendor.o(($event) => $data.purchaseType = "pay")
} : {}, {
p: $data.biz === "purchase",
x: common_vendor.t($data.order.orderTime),
y: $data.order.orderTime,
z: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args)),
A: $data.biz === "sale"
s: $data.biz === "purchase",
D: common_vendor.t($data.order.orderTime),
E: $data.order.orderTime,
F: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args)),
G: $data.biz === "sale"
}, $data.biz === "sale" ? {
B: common_vendor.t($options.customerLabel),
C: common_vendor.o((...args) => $options.chooseCustomer && $options.chooseCustomer(...args))
H: common_vendor.t($options.customerLabel),
I: common_vendor.o((...args) => $options.chooseCustomer && $options.chooseCustomer(...args))
} : $data.biz === "purchase" ? {
E: common_vendor.t($options.supplierLabel),
F: common_vendor.o((...args) => $options.chooseSupplier && $options.chooseSupplier(...args))
} : {}, {
D: $data.biz === "purchase",
G: $data.biz === "sale" && $data.saleType === "collect" || $data.biz === "purchase" && $data.purchaseType === "pay"
}, $data.biz === "sale" && $data.saleType === "collect" || $data.biz === "purchase" && $data.purchaseType === "pay" ? common_vendor.e({
H: $data.biz === "sale"
}, $data.biz === "sale" ? {
I: common_vendor.t($options.customerLabel),
J: common_vendor.o((...args) => $options.chooseCustomer && $options.chooseCustomer(...args))
} : {
K: common_vendor.t($options.supplierLabel),
L: common_vendor.o((...args) => $options.chooseSupplier && $options.chooseSupplier(...args))
}, {
M: common_vendor.o([common_vendor.m(($event) => $data.payments.cash = $event.detail.value, {
number: true
}), ($event) => $options.recalcPay()]),
N: $data.payments.cash,
O: common_vendor.o([common_vendor.m(($event) => $data.payments.bank = $event.detail.value, {
number: true
}), ($event) => $options.recalcPay()]),
P: $data.payments.bank,
Q: common_vendor.o([common_vendor.m(($event) => $data.payments.wechat = $event.detail.value, {
number: true
}), ($event) => $options.recalcPay()]),
R: $data.payments.wechat,
S: common_vendor.t($data.showMore ? "收起" : ""),
T: common_vendor.o(($event) => $data.showMore = !$data.showMore),
U: common_vendor.t($options.payTotal.toFixed(2)),
V: $data.order.remark,
W: common_vendor.o(($event) => $data.order.remark = $event.detail.value),
X: common_vendor.t($data.order.orderTime),
Y: $data.order.orderTime,
Z: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args))
}) : $data.biz === "sale" || $data.biz === "purchase" ? {
ab: common_vendor.t($data.biz === "sale" ? "客户" : "供应商"),
ac: common_vendor.t($data.biz === "sale" ? $options.customerLabel : $options.supplierLabel),
ad: common_vendor.o(($event) => $data.biz === "sale" ? $options.chooseCustomer() : $options.chooseSupplier()),
ae: common_vendor.t($data.order.orderTime),
af: $data.order.orderTime,
ag: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args)),
ah: common_assets._imports_0,
ai: common_vendor.o((...args) => $options.chooseProduct && $options.chooseProduct(...args)),
aj: common_vendor.t($options.totalQuantity),
ak: common_vendor.t($options.totalAmount.toFixed(2)),
al: common_vendor.o((...args) => $options.chooseProduct && $options.chooseProduct(...args))
} : {}, {
J: $data.biz === "purchase",
M: $data.biz === "sale" && $data.saleType === "collect" || $data.biz === "purchase" && $data.purchaseType === "pay"
}, $data.biz === "sale" && $data.saleType === "collect" || $data.biz === "purchase" && $data.purchaseType === "pay" ? common_vendor.e({
N: $data.biz === "sale"
}, $data.biz === "sale" ? {
O: common_vendor.t($options.customerLabel),
P: common_vendor.o((...args) => $options.chooseCustomer && $options.chooseCustomer(...args))
} : {
am: $data.counterpartyType === "customer" ? 1 : "",
an: common_vendor.o(($event) => $options.setCounterparty("customer")),
ao: $data.counterpartyType === "supplier" ? 1 : "",
ap: common_vendor.o(($event) => $options.setCounterparty("supplier")),
aq: common_vendor.f($data.biz === "income" ? $options.incomeCategories : $options.expenseCategories, (c, k0, i0) => {
Q: common_vendor.t($options.supplierLabel),
R: common_vendor.o((...args) => $options.chooseSupplier && $options.chooseSupplier(...args))
}, {
S: common_vendor.o([common_vendor.m(($event) => $data.payments.cash = $event.detail.value, {
number: true
}), ($event) => $options.recalcPay()]),
T: $data.payments.cash,
U: common_vendor.o([common_vendor.m(($event) => $data.payments.bank = $event.detail.value, {
number: true
}), ($event) => $options.recalcPay()]),
V: $data.payments.bank,
W: common_vendor.o([common_vendor.m(($event) => $data.payments.wechat = $event.detail.value, {
number: true
}), ($event) => $options.recalcPay()]),
X: $data.payments.wechat,
Y: common_vendor.t($data.showMore ? "收起" : ""),
Z: common_vendor.o(($event) => $data.showMore = !$data.showMore),
aa: common_vendor.t($options.payTotal.toFixed(2)),
ab: $data.order.remark,
ac: common_vendor.o(($event) => $data.order.remark = $event.detail.value),
ad: common_vendor.t($data.order.orderTime),
ae: $data.order.orderTime,
af: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args))
}) : $data.biz === "sale" || $data.biz === "purchase" ? {
ah: common_vendor.t($data.biz === "sale" ? "客户" : "供应商"),
ai: common_vendor.t($data.biz === "sale" ? $options.customerLabel : $options.supplierLabel),
aj: common_vendor.o(($event) => $data.biz === "sale" ? $options.chooseCustomer() : $options.chooseSupplier()),
ak: common_vendor.t($data.order.orderTime),
al: $data.order.orderTime,
am: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args)),
an: common_assets._imports_0,
ao: common_vendor.o((...args) => $options.chooseProduct && $options.chooseProduct(...args)),
ap: common_vendor.t($options.totalQuantity),
aq: common_vendor.t($options.totalAmount.toFixed(2)),
ar: common_vendor.o((...args) => $options.chooseProduct && $options.chooseProduct(...args))
} : {
as: $data.counterpartyType === "customer" ? 1 : "",
at: common_vendor.o(($event) => $options.setCounterparty("customer")),
av: $data.counterpartyType === "supplier" ? 1 : "",
aw: common_vendor.o(($event) => $options.setCounterparty("supplier")),
ax: common_vendor.f($data.biz === "income" ? $options.incomeCategories : $options.expenseCategories, (c, k0, i0) => {
return {
a: common_vendor.t(c.label),
b: c.key,
@@ -361,23 +379,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
d: common_vendor.o(($event) => $data.activeCategory = c.key, c.key)
};
}),
ar: common_vendor.t($options.counterpartyLabel),
as: common_vendor.o((...args) => $options.chooseCounterparty && $options.chooseCounterparty(...args)),
at: common_vendor.t($options.accountLabel),
av: common_vendor.o((...args) => $options.chooseAccount && $options.chooseAccount(...args)),
aw: $data.trxAmount,
ax: common_vendor.o(common_vendor.m(($event) => $data.trxAmount = $event.detail.value, {
ay: common_vendor.t($options.counterpartyLabel),
az: common_vendor.o((...args) => $options.chooseCounterparty && $options.chooseCounterparty(...args)),
aA: common_vendor.t($options.accountLabel),
aB: common_vendor.o((...args) => $options.chooseAccount && $options.chooseAccount(...args)),
aC: $data.trxAmount,
aD: common_vendor.o(common_vendor.m(($event) => $data.trxAmount = $event.detail.value, {
number: true
})),
ay: $data.order.remark,
az: common_vendor.o(($event) => $data.order.remark = $event.detail.value)
aE: $data.order.remark,
aF: common_vendor.o(($event) => $data.order.remark = $event.detail.value)
}, {
aa: $data.biz === "sale" || $data.biz === "purchase",
aA: !$data.items.length
ag: $data.biz === "sale" || $data.biz === "purchase",
aG: !$data.items.length
}, !$data.items.length ? {
aB: common_assets._imports_0
aH: common_assets._imports_0
} : {
aC: common_vendor.f($data.items, (it, idx, i0) => {
aI: common_vendor.f($data.items, (it, idx, i0) => {
return {
a: common_vendor.t(it.productName),
b: common_vendor.o([common_vendor.m(($event) => it.quantity = $event.detail.value, {
@@ -393,8 +411,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
};
})
}, {
aD: common_vendor.o((...args) => $options.saveAndReset && $options.saveAndReset(...args)),
aE: common_vendor.o((...args) => $options.submit && $options.submit(...args))
aJ: common_vendor.o((...args) => $options.saveAndReset && $options.saveAndReset(...args)),
aK: common_vendor.o((...args) => $options.submit && $options.submit(...args))
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);

File diff suppressed because one or more lines are too long

View File

@@ -39,20 +39,39 @@
color: #111;
font-weight: 700;
}
.subtabs {
/* 三段式胶囊切换 */
.seg3 {
display: flex;
gap: 16rpx;
padding: 0 24rpx 16rpx;
}
.subbtn {
padding: 10rpx 20rpx;
gap: 0;
margin: 12rpx 16rpx;
padding: 6rpx;
background: #fff;
border: 2rpx solid #e6ebf2;
border-radius: 999rpx;
background: #f1f1f1;
color: #444;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
}
.subbtn.active {
background: #4C8DFF;
color: #fff;
.seg3-item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
padding: 12rpx 0;
color: #111;
border-radius: 999rpx;
}
/* 间隔通过内边距处理,避免空选择器 */
.seg3-item.active {
background: #fff;
color: #4C8DFF;
box-shadow: 0 4rpx 12rpx rgba(76, 141, 255, 0.2), 0 0 0 2rpx #4C8DFF inset;
}
.seg3-icon {
width: 28rpx;
height: 28rpx;
opacity: 0.9;
}
.field {
display: flex;
@@ -198,29 +217,24 @@
color: #fff;
}
/* 顶部旧 tabs 简化隐藏(改为更简洁布局) */
.tabs {
display: none;
}
/* 顶部业务 Tabs 显示 */
/* 快捷操作宫格 */
/* 信息卡片式表达(更稳重) */
.info-card {
display: grid;
grid-template-columns: 1fr 1fr auto;
gap: 10rpx;
margin: 12rpx 16rpx 0;
background: #fff;
border: 2rpx solid #e5e7eb;
border-radius: 16rpx;
padding: 10rpx;
margin: 10rpx 12rpx 0;
background: transparent;
padding: 0;
align-items: center;
}
.info-field {
background: #ffffff;
border: 2rpx solid #e5e7eb;
background: #fff;
border: 2rpx solid #e6ebf2;
border-radius: 12rpx;
padding: 10rpx 12rpx;
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
}
.info-label {
color: #444;
@@ -238,7 +252,8 @@
background: #4C8DFF;
color: #fff;
border-radius: 12rpx;
padding: 12rpx 14rpx;
padding: 14rpx 16rpx;
box-shadow: 0 8rpx 18rpx rgba(76, 141, 255, 0.26);
}
.info-icon {
width: 32rpx;

View File

@@ -13,10 +13,32 @@ const _sfc_main = {
};
},
onLoad() {
const hasToken = (() => {
try {
return !!common_vendor.index.getStorageSync("TOKEN");
} catch (e) {
return false;
}
})();
if (!hasToken) {
this.items = [];
this.categories = [];
common_vendor.index.showToast({ title: "请登录使用该功能", icon: "none" });
return;
}
this.fetchCategories();
this.reload();
},
onShow() {
const hasToken = (() => {
try {
return !!common_vendor.index.getStorageSync("TOKEN");
} catch (e) {
return false;
}
})();
if (!hasToken)
return;
this.reload();
},
computed: {