From 81095f57a1567b7511247bffec3606f40eaf0077 Mon Sep 17 00:00:00 2001
From: weipengfei <2187978347@qq.com>
Date: Sat, 6 Apr 2024 10:21:06 +0800
Subject: [PATCH] 1
---
package-lock.json | 6 ++
package.json | 1 +
src/layout/index.vue | 4 -
src/router/index.js | 4 +-
src/utils/axios.js | 8 +-
src/views/home/index.vue | 2 +-
src/views/order/component/order.vue | 144 ++++++++++++----------------
src/views/order/indexList.vue | 1 -
src/vite-env.d.ts | 2 +
tsconfig.json | 2 +
vite.config.ts | 1 +
11 files changed, 82 insertions(+), 93 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 236db18..6ae3644 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"@element-plus/icons-vue": "^2.3.1",
"axios": "^1.6.8",
"element-plus": "^2.6.3",
+ "mitt": "^3.0.1",
"pinia": "^2.1.7",
"sass": "^1.72.0",
"vue": "^3.4.21",
@@ -1308,6 +1309,11 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/mitt": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
+ "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="
+ },
"node_modules/muggle-string": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz",
diff --git a/package.json b/package.json
index 120e1db..7c40b8c 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"@element-plus/icons-vue": "^2.3.1",
"axios": "^1.6.8",
"element-plus": "^2.6.3",
+ "mitt": "^3.0.1",
"pinia": "^2.1.7",
"sass": "^1.72.0",
"vue": "^3.4.21",
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 8ebbb8e..7f2b3b9 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -1,10 +1,6 @@
diff --git a/src/router/index.js b/src/router/index.js
index 4509fcd..27ce779 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,4 +1,4 @@
-import { createRouter, createWebHistory } from 'vue-router';
+import { createRouter, createWebHashHistory } from 'vue-router';
import layout from '@/layout/index.vue';
import { useUserStore } from '@/store/user.js';
@@ -46,7 +46,7 @@ const routes = [
];
const router = createRouter({
- history: createWebHistory(),
+ history: createWebHashHistory(),
routes
});
diff --git a/src/utils/axios.js b/src/utils/axios.js
index 0f3504b..c4b8d38 100644
--- a/src/utils/axios.js
+++ b/src/utils/axios.js
@@ -1,6 +1,6 @@
import axios from "axios";
import { ElMessage } from "element-plus";
-import { useRouter } from "vue-router";
+import router from "@/router/index.js";
import { useUserStore } from "../store/user";
const request = axios.create({
@@ -8,6 +8,7 @@ const request = axios.create({
timeout: 10000
})
+
// 请求拦截器
request.interceptors.request.use(
config => {
@@ -31,17 +32,16 @@ request.interceptors.response.use(
response => {
// 对响应数据做些什么,例如解析数据、统一处理错误等
if (response.data.status === 401 || response.data.status === 40000) {
- const router = useRouter();
ElMessage({
message: response.data.message,
type: 'error',
})
- setTimeout(() => {
+ setTimeout(()=>{
const userStore = useUserStore();
userStore.setUserInfo({});
userStore.setToken('');
router.push('/login');
- }, 800);
+ },700)
}
if (response.data.status === 400) {
ElMessage({
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index bba8940..a81e13c 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -29,7 +29,7 @@ const getStoreList = (data) => {
...data,
};
storeListApi(userStore.userInfo.service.mer_id, where.value).then((res) => {
- if(res.data.list.length < where.value.limit) loadEnd.value = true;
+ if(res.data?.list?.length < where.value.limit) loadEnd.value = true;
let list = res.data.list.map((item) => {
item.attr = Object.keys(item.sku);
return item;
diff --git a/src/views/order/component/order.vue b/src/views/order/component/order.vue
index c0b66d7..9421f05 100644
--- a/src/views/order/component/order.vue
+++ b/src/views/order/component/order.vue
@@ -1,9 +1,44 @@
@@ -13,12 +48,24 @@ const keyword = ref('')
订单列表
-
+
+
+
+
单号: {{ item.order_sn }}
+
{{ item.create_time }}
+
+
@@ -51,95 +98,30 @@ const keyword = ref('')
.header-input{
padding: 1rem;
padding-top: 0;
- padding-bottom: 2rem;
- height: 1.5rem;
+ height: 2.5rem;
border-bottom: 1px solid #eee;
}
.order-list {
- height: calc(100vh - 100px - 14rem);
+ height: calc(100vh - 100px - 8.2rem);
overflow-y: auto;
- .order-item {
- display: flex;
+ .item{
padding: 1rem;
- border-bottom: 1px solid #eee;
-
- .order-item-img {
- width: 5rem;
- height: 5rem;
- border-radius: 0.5rem;
- }
- .order-item-info {
- flex: 1;
- box-sizing: border-box;
- padding-left: 12px;
+ .top{
display: flex;
- flex-direction: column;
justify-content: space-between;
- & > div {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .order-item-title {
- .title {
- width: 18rem;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .delete {
- color: #1890ff;
- cursor: pointer;
+ align-items: flex-end;
+ .sn{
+ font-weight: bold;
+ font-size: 0.9rem;
+ &::before{
+
}
}
- .order-item-sku {
- cursor: pointer;
+ .create-time{
font-size: 0.8rem;
- color: #999;
}
}
}
}
- .order-footer {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- box-shadow: 0 -1px 10px #eee;
-
- .order-total {
- height: 2.5rem;
- padding: 1rem 2rem;
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #eee;
- align-items: center;
- .price {
- display: flex;
- align-items: center;
- .total-item {
- padding-right: 1.5rem;
- span {
- color: #f5222d;
- }
- }
- }
- .update-price {
- .btn {
- border-radius: 3rem;
- }
- }
- }
- .order-btn {
- height: 3.2rem;
- padding: 1rem 1.5rem;
- .btn {
- width: 100%;
- height: 100%;
- font-size: 1.2rem;
- border-radius: 3rem;
- }
- }
- }
}
diff --git a/src/views/order/indexList.vue b/src/views/order/indexList.vue
index f714567..6f9e21b 100644
--- a/src/views/order/indexList.vue
+++ b/src/views/order/indexList.vue
@@ -2,7 +2,6 @@
import { ref } from "vue";
import {
orderListApi,
- groupOrderListApi,
orderStatusApi,
orderLadingApi,
cartListApi
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 11f02fe..bd01096 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1 +1,3 @@
///
+declare module 'element-plus/dist/locale/zh-cn.mjs'
+declare module './router'
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 9e03e60..0db6bf2 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -14,6 +14,8 @@
"noEmit": true,
"jsx": "preserve",
+ "allowJs": true,
+
/* Linting */
"strict": true,
"noUnusedLocals": true,
diff --git a/vite.config.ts b/vite.config.ts
index 9732daa..3611be8 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
+ base: './',
server: {
port: '5175',
host: '0.0.0.0',