diff --git a/miniprogram/api/login.ts b/miniprogram/api/login.ts
index 2148fcc..b26b255 100644
--- a/miniprogram/api/login.ts
+++ b/miniprogram/api/login.ts
@@ -18,3 +18,8 @@ export const getInfo = (token?: string) =>
Authorization: token ? `Bearer ${token}` : undefined,
},
});
+
+export const getProfile = () =>
+ httpClient.request({
+ url: "/system/user/profile",
+ });
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 60d1943..397879e 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -6,19 +6,19 @@
"pages/stock/stock",
"pages/add-stock/add-stock"
],
+ "entryPagePath": "pages/stock/stock",
"tabBar": {
"selectedColor": "#0052d9",
"list": [{
- "pagePath": "pages/index/index",
- "text": "财务",
- "iconPath": "assets/tab-icons/money-collect.png",
- "selectedIconPath": "assets/tab-icons/money-collect_selected.png"
- },
- {
"pagePath": "pages/stock/stock",
"text": "库存",
"iconPath": "assets/tab-icons/stock.png",
"selectedIconPath": "assets/tab-icons/stock_selected.png"
+ }, {
+ "pagePath": "pages/index/index",
+ "text": "财务",
+ "iconPath": "assets/tab-icons/money-collect.png",
+ "selectedIconPath": "assets/tab-icons/money-collect_selected.png"
},
{
"pagePath": "pages/login/login",
@@ -32,7 +32,8 @@
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#f6f6f6",
"navigationBarTitleText": "口袋九章",
- "navigationBarTextStyle": "black"
+ "navigationBarTextStyle": "black",
+ "navigationStyle": "custom"
},
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
@@ -42,7 +43,8 @@
"t-button": "tdesign-miniprogram/button/button",
"t-message": "tdesign-miniprogram/message/message",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
- "t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
+ "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
+ "t-navbar": "tdesign-miniprogram/navbar/navbar"
},
"lazyCodeLoading": "requiredComponents",
"sitemapLocation": "sitemap.json"
diff --git a/miniprogram/components/infinite-scroll/index.json b/miniprogram/components/infinite-scroll/index.json
deleted file mode 100644
index e8cfaaf..0000000
--- a/miniprogram/components/infinite-scroll/index.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "component": true,
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/miniprogram/components/infinite-scroll/index.scss b/miniprogram/components/infinite-scroll/index.scss
deleted file mode 100644
index f41e090..0000000
--- a/miniprogram/components/infinite-scroll/index.scss
+++ /dev/null
@@ -1 +0,0 @@
-/* components/infinite-scroll/index.wxss */
\ No newline at end of file
diff --git a/miniprogram/components/infinite-scroll/index.ts b/miniprogram/components/infinite-scroll/index.ts
deleted file mode 100644
index 0558ced..0000000
--- a/miniprogram/components/infinite-scroll/index.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-// components/infinite-scroll/index.ts
-Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {},
-
- /**
- * 组件的方法列表
- */
- methods: {},
- lifetimes: {
- attached() {
- //@ts-ignore
- this._observer = wx.createIntersectionObserver(this);
- //@ts-ignore
- this._observer
- // .createIntersectionObserver()
- .relativeToViewport({ bottom: 100 })
- .observe(".load-more", (res: any) => {
- console.log(res);
- res.intersectionRatio; // 相交区域占目标节点的布局区域的比例
- res.intersectionRect; // 相交区域
- res.intersectionRect.left; // 相交区域的左边界坐标
- res.intersectionRect.top; // 相交区域的上边界坐标
- res.intersectionRect.width; // 相交区域的宽度
- res.intersectionRect.height; // 相交区域的高度
- });
- // //@ts-ignore
- // this._observer = wx.createIntersectionObserver(this);
-
- // //@ts-ignore
- // this._observer.relativeTo(".scroll-view").observe(".load-more", (res) => {
- // console.log("到底了");
- // this.triggerEvent("loadmore", {}, {});
- // });
- },
- },
-});
diff --git a/miniprogram/components/infinite-scroll/index.wxml b/miniprogram/components/infinite-scroll/index.wxml
deleted file mode 100644
index 34329ad..0000000
--- a/miniprogram/components/infinite-scroll/index.wxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
- load more
-
\ No newline at end of file
diff --git a/miniprogram/components/load-more/index.json b/miniprogram/components/load-more/index.json
new file mode 100644
index 0000000..fc55491
--- /dev/null
+++ b/miniprogram/components/load-more/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "t-loading": "tdesign-miniprogram/loading/loading"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/components/load-more/index.scss b/miniprogram/components/load-more/index.scss
new file mode 100644
index 0000000..089412c
--- /dev/null
+++ b/miniprogram/components/load-more/index.scss
@@ -0,0 +1,15 @@
+/* components/load-more/index.wxss */
+.load-more {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ padding: 12rpx 0;
+ .status {
+ display: flex;
+ align-items: center;
+ text {
+ margin-left: 12rpx;
+ font-size: small;
+ }
+ }
+}
diff --git a/miniprogram/components/load-more/index.ts b/miniprogram/components/load-more/index.ts
new file mode 100644
index 0000000..151b954
--- /dev/null
+++ b/miniprogram/components/load-more/index.ts
@@ -0,0 +1,21 @@
+// components/load-more/index.ts
+Component({
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ status: {
+ type: Number, // 0 loading,1 success, 3 error, 4:completed
+ },
+ },
+
+ /**
+ * 组件的初始数据
+ */
+ data: {},
+
+ /**
+ * 组件的方法列表
+ */
+ methods: {},
+});
diff --git a/miniprogram/components/load-more/index.wxml b/miniprogram/components/load-more/index.wxml
new file mode 100644
index 0000000..814c762
--- /dev/null
+++ b/miniprogram/components/load-more/index.wxml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ 加载失败
+
+
+ 没有更多
+
+
\ No newline at end of file
diff --git a/miniprogram/components/statistics-card/index.scss b/miniprogram/components/statistics-card/index.scss
index 8597540..2350b81 100644
--- a/miniprogram/components/statistics-card/index.scss
+++ b/miniprogram/components/statistics-card/index.scss
@@ -17,7 +17,7 @@
.value {
color: #0052d9;
font-size: larger;
- font-weight: bold;
+ // font-weight: bold;
}
.title {
margin-top: 6rpx;
diff --git a/miniprogram/components/statistics-card/index.wxml b/miniprogram/components/statistics-card/index.wxml
index 50a291b..6084809 100644
--- a/miniprogram/components/statistics-card/index.wxml
+++ b/miniprogram/components/statistics-card/index.wxml
@@ -2,8 +2,9 @@
- {{number.formatAmount(value.value)}}万元
- {{value.value}}
+
+
+ {{value.value}}
{{value.label}}
\ No newline at end of file
diff --git a/miniprogram/pages/add-finance/add-finance.scss b/miniprogram/pages/add-finance/add-finance.scss
index 6a24ec1..23c1910 100644
--- a/miniprogram/pages/add-finance/add-finance.scss
+++ b/miniprogram/pages/add-finance/add-finance.scss
@@ -1,4 +1,7 @@
/* pages/add-affairs/add-affairs.wxss */
+.t-navbar__content {
+ --td-navbar-bg-color: rgba(0, 0, 0, 0);
+}
.add-affairs {
padding-top: 32rpx;
.add-affairs-form {
diff --git a/miniprogram/pages/add-finance/add-finance.wxml b/miniprogram/pages/add-finance/add-finance.wxml
index e855435..154006e 100644
--- a/miniprogram/pages/add-finance/add-finance.wxml
+++ b/miniprogram/pages/add-finance/add-finance.wxml
@@ -3,6 +3,9 @@
+
+
+
diff --git a/miniprogram/pages/add-stock/add-stock.scss b/miniprogram/pages/add-stock/add-stock.scss
index 79629d0..3b4b568 100644
--- a/miniprogram/pages/add-stock/add-stock.scss
+++ b/miniprogram/pages/add-stock/add-stock.scss
@@ -1,4 +1,7 @@
/* pages/add-stock/add-stock.wxss */
+.t-navbar__content {
+ --td-navbar-bg-color: rgba(0, 0, 0, 0);
+}
.add-stock {
padding: 32rpx 0;
.add-stock-form {
diff --git a/miniprogram/pages/add-stock/add-stock.wxml b/miniprogram/pages/add-stock/add-stock.wxml
index c0571b5..9efb328 100644
--- a/miniprogram/pages/add-stock/add-stock.wxml
+++ b/miniprogram/pages/add-stock/add-stock.wxml
@@ -2,6 +2,9 @@
+
+
+
diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json
index 56bea81..9e2198e 100644
--- a/miniprogram/pages/index/index.json
+++ b/miniprogram/pages/index/index.json
@@ -3,7 +3,8 @@
"t-fab": "tdesign-miniprogram/fab/fab",
"t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
"statistics-card": "/components/statistics-card",
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
+ "t-dialog": "tdesign-miniprogram/dialog/dialog",
+ "load-more": "/components/load-more"
},
"enablePullDownRefresh": true
}
\ No newline at end of file
diff --git a/miniprogram/pages/index/index.scss b/miniprogram/pages/index/index.scss
index 2cf8998..4c17d9e 100644
--- a/miniprogram/pages/index/index.scss
+++ b/miniprogram/pages/index/index.scss
@@ -3,6 +3,9 @@ page {
padding: 32rpx 0;
background-color: #f6f6f6;
}
+.t-navbar__content {
+ --td-navbar-bg-color: rgba(0, 0, 0, 0);
+}
.home-page {
.t-fab {
z-index: 99;
@@ -92,16 +95,16 @@ page {
}
.finance-list {
.left-icon {
- width: 48rpx;
- height: 48rpx;
+ width: 72rpx;
+ height: 72rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
+ font-size: larger;
}
.btn-wrapper {
- // height: 100%;
.btn {
display: inline-flex;
justify-content: center;
diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts
index 6452138..b14c4a1 100644
--- a/miniprogram/pages/index/index.ts
+++ b/miniprogram/pages/index/index.ts
@@ -13,6 +13,7 @@ Page({
*/
data: {
showConfirmDelete: false,
+ loadStatus: 1,
permissions: [],
queryParams: {
pageNum: 1,
@@ -47,6 +48,7 @@ Page({
async getList() {
this.setData({
loading: true,
+ loadStatus: 0,
});
const { queryParams } = this.data;
try {
@@ -60,6 +62,7 @@ Page({
}
this.setData({
completed,
+ loadStatus: completed ? 3 : 1,
total: resp.total,
list: resp.rows,
});
@@ -69,6 +72,9 @@ Page({
});
}
} catch (e) {
+ this.setData({
+ loadStatus: 2,
+ });
console.log(e);
}
this.setData({
diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml
index 27da0bc..1c20276 100644
--- a/miniprogram/pages/index/index.wxml
+++ b/miniprogram/pages/index/index.wxml
@@ -3,6 +3,9 @@
+
+
+
@@ -22,47 +25,8 @@
+
-
前往登录
diff --git a/miniprogram/pages/login/login.scss b/miniprogram/pages/login/login.scss
index c4c27bb..59d9ce1 100644
--- a/miniprogram/pages/login/login.scss
+++ b/miniprogram/pages/login/login.scss
@@ -24,7 +24,9 @@
z-index: -1;
}
.avatar_login {
- margin-left: 64rpx;
+ position: absolute;
+ left: 64rpx;
+ bottom: 140rpx;
display: flex;
align-items: center;
diff --git a/miniprogram/pages/login/login.ts b/miniprogram/pages/login/login.ts
index e550e1f..1d5a336 100644
--- a/miniprogram/pages/login/login.ts
+++ b/miniprogram/pages/login/login.ts
@@ -1,4 +1,5 @@
-import { getInfo, login } from "../../api/login";
+import { getInfo, getProfile, login } from "../../api/login";
+import httpClient from "../../utils/request";
import { setToken } from "../../utils/settings";
// pages/login/login.ts
@@ -9,6 +10,7 @@ Page({
data: {
authToken: null,
user: null,
+ profile: null,
},
loginWithWeChat(e: any) {
@@ -21,10 +23,8 @@ Page({
setToken(response.token);
getInfo(response.token).then((resp: any) => {
getApp().globalData.permissions = resp.permissions;
- this.setData({
- user: resp.user,
- });
});
+ this.loadProfile();
});
},
handleLogout() {
@@ -34,6 +34,28 @@ Page({
getApp().globalData.permissions = undefined;
setToken(undefined);
},
+ loadProfile() {
+ getProfile().then((resp: any) => {
+ const { data } = resp;
+ let avatar;
+ if (data.avatar) {
+ if (
+ data.avatar.startsWith("https://") ||
+ data.avatar.startsWith("http://")
+ ) {
+ avatar = data.avatar;
+ } else {
+ avatar = `${httpClient.baseUrl}${data.avatar}`;
+ }
+ }
+ this.setData({
+ profile: {
+ ...data,
+ avatar,
+ },
+ });
+ });
+ },
/**
* 生命周期函数--监听页面加载
*/
@@ -43,12 +65,7 @@ Page({
authToken,
});
if (authToken) {
- getInfo(authToken).then((resp: any) => {
- const { user } = resp;
- this.setData({
- user,
- });
- });
+ this.loadProfile();
}
},
diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml
index 4051f76..6b0e5d5 100644
--- a/miniprogram/pages/login/login.wxml
+++ b/miniprogram/pages/login/login.wxml
@@ -6,9 +6,9 @@
-
+
登录
- {{user.nickname}}
+ {{profile.nickname}}
中科九章管理层
diff --git a/miniprogram/pages/stock/stock.json b/miniprogram/pages/stock/stock.json
index f73d14c..4e8be2b 100644
--- a/miniprogram/pages/stock/stock.json
+++ b/miniprogram/pages/stock/stock.json
@@ -1,8 +1,9 @@
{
"usingComponents": {
"t-fab": "tdesign-miniprogram/fab/fab",
- "t-sticky": "tdesign-miniprogram/sticky/sticky",
- "statistics-card": "/components/statistics-card"
+ "statistics-card": "/components/statistics-card",
+ "t-tag": "tdesign-miniprogram/tag/tag",
+ "load-more": "/components/load-more"
},
"enablePullDownRefresh": true
}
\ No newline at end of file
diff --git a/miniprogram/pages/stock/stock.scss b/miniprogram/pages/stock/stock.scss
index 1f03153..3645143 100644
--- a/miniprogram/pages/stock/stock.scss
+++ b/miniprogram/pages/stock/stock.scss
@@ -5,92 +5,47 @@
page {
padding-top: 32rpx;
}
-.stock-stick {
+.t-navbar__content {
+ --td-navbar-bg-color: rgba(0, 0, 0, 0);
+}
+.stock-tabs {
margin: 16rpx 32rpx 0;
- .stock-tabs {
- border-radius: 18rpx;
- overflow: hidden;
- }
+ border-radius: 18rpx;
+ overflow: hidden;
+}
+.stock-stick {
+ // TODO:
}
.stock-list {
padding: 16rpx 0 32rpx;
.scroll-container {
- // height: calc(100vh - 96rpx - 64rpx - 64rpx);
- .grid {
- margin: 0 32rpx;
- display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: 32rpx;
- .card {
- box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),
- 0 1px 2px -1px rgb(0 0 0 / 0.1);
- // position: relative;
- min-height: 300rpx;
- background-color: #fff;
- border-radius: 18rpx;
- padding: 18rpx;
- .prove-pic {
- width: 100%;
- height: 200rpx;
+ .description {
+ view {
+ display: flex;
+ align-items: center;
+ }
+ .spec {
+ .divider {
+ margin: 0 8rpx;
}
- .close-button {
- position: absolute;
- top: -24rpx;
- right: -24rpx;
- }
- .fields {
- margin-top: 12rpx;
- .field {
- margin-top: 12rpx;
- display: flex;
- .indicator {
- margin-top: 12rpx;
- height: 24rpx;
- width: 8rpx;
- background-color: #ea7e41;
- border-radius: 50rpx;
- margin-right: 12rpx;
- }
- .content {
- display: flex;
- flex-direction: column;
- .title {
- font-size: large;
- }
- .value {
- margin-top: 6rpx;
- font-size: small;
- }
- }
-
- &:nth-of-type(1) {
- .indicator {
- background-color: #ea7e41;
- }
- }
- &:nth-of-type(2) {
- .indicator {
- background-color: #12b3a8;
- }
- }
- &:nth-of-type(3) {
- .indicator {
- background-color: #dc7d85;
- }
- }
- &:nth-of-type(4) {
- .indicator {
- background-color: #e0d2fd;
- }
- }
- &:nth-of-type(5) {
- .indicator {
- background-color: #dc7d85;
- }
- }
- }
+ }
+ .date {
+ text {
+ margin-left: 12rpx;
}
}
}
+ .description {
+ // font-size: small;
+ }
+ .note.storage {
+ color: #38a169;
+ }
+ .note.in {
+ color: #38a169;
+ }
+ .note.out {
+ color: #dd6b20;
+ }
}
}
diff --git a/miniprogram/pages/stock/stock.ts b/miniprogram/pages/stock/stock.ts
index dd0460b..dc4cc4d 100644
--- a/miniprogram/pages/stock/stock.ts
+++ b/miniprogram/pages/stock/stock.ts
@@ -10,6 +10,9 @@ Page({
data: {
permissions: [],
authToken: undefined,
+ storageLoadingStatus: 1,
+ inLoadingStatus: 1,
+ outLoadingStatus: 1,
stockType: 0, // 库存类型
// 统计数据
statisticsData: {
@@ -47,6 +50,16 @@ Page({
storageCompleted: false,
inStockCompleted: false,
outStockCompleted: false,
+ types: [
+ {
+ label: "入库",
+ value: "1",
+ },
+ {
+ label: "出库",
+ value: "2",
+ },
+ ],
},
onTabsChange(e: any) {
const { value: stockType } = e.detail;
@@ -91,11 +104,13 @@ Page({
if (stockType == 1) {
this.setData({
inStockLoading: true,
+ inLoadingStatus: 0,
});
query = inStockQuery;
} else if (stockType == 2) {
this.setData({
outStockLoading: true,
+ outLoadingStatus: 0,
});
query = outStockQuery;
} else {
@@ -117,6 +132,7 @@ Page({
this.setData({
inStockCompleted: completed,
+ inLoadingStatus: completed ? 3 : 1,
// @ts-ignore
inStockList: [
...this.data.inStockList,
@@ -147,6 +163,7 @@ Page({
}
this.setData({
outStockCompleted: completed,
+ outLoadingStatus: completed ? 3 : 1,
// @ts-ignore
outStockList: [
...this.data.outStockList,
@@ -170,46 +187,77 @@ Page({
}
}
} catch (error) {
+ if (stockType == 1) {
+ this.setData({
+ inLoadingStatus: 2,
+ });
+ } else if (stockType == 2) {
+ this.setData({
+ outLoadingStatus: 2,
+ });
+ }
console.log(error);
}
- if (this.data.stockType == 1) {
+ if (stockType == 1) {
this.setData({
inStockLoading: false,
});
- } else if (this.data.stockType == 2) {
+ } else if (stockType == 2) {
this.setData({
outStockLoading: false,
});
}
},
+
/**
* 获取库存列表
*/
async getStorageList() {
this.setData({
- storageLoading: false,
+ storageLoading: true,
+ storageLoadingStatus: 0,
});
const { storageQuery } = this.data;
try {
const resp: any = await storageList(storageQuery);
-
let completed = false;
if (
Math.ceil(resp.total / storageQuery.pageSize) == storageQuery.pageNum
) {
completed = true;
}
+ const rows = resp.rows.map((el: any) => {
+ const specUrls = el.specPic?.split(",") ?? [];
+ const specPics = specUrls.map((pic: string) => {
+ let url;
+ if (pic.startsWith("https://") || pic.startsWith("http://")) {
+ url = pic;
+ } else {
+ url = `${httpClient.baseUrl}${pic}`;
+ }
+ return url;
+ });
+ return {
+ ...el,
+ specPics,
+ };
+ });
this.setData({
// @ts-ignore
- storageList: [...this.data.storageList, ...resp.rows],
+ storageList: [...this.data.storageList, ...rows],
storageCompleted: completed,
+ storageLoadingStatus: completed ? 3 : 1,
});
if (!completed) {
this.setData({
[`storageQuery.pageNum`]: storageQuery.pageNum + 1,
});
}
- } catch (error) {}
+ } catch (error) {
+ this.setData({
+ storageLoadingStatus: 2,
+ });
+ }
this.setData({
storageLoading: false,
});
diff --git a/miniprogram/pages/stock/stock.wxml b/miniprogram/pages/stock/stock.wxml
index 65ce1a7..dbe0d66 100644
--- a/miniprogram/pages/stock/stock.wxml
+++ b/miniprogram/pages/stock/stock.wxml
@@ -3,144 +3,105 @@
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- 产品
- {{item.productName}}
+
+
+
+
+
+
+
+
+
+ {{item.productName}}
+
+
+
+ {{item.modelName}}
+ |
+ {{item.specName}}
-
-
-
- 型号
- {{item.modelName}}
-
+
+ {{item.stock}}
-
-
-
- 规格
- {{item.specName}}
-
-
-
-
-
- 库存
- {{item.stock}}
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
- 产品
- {{item.productName}}
+
+
+
+
+
+
+
+
+
+ {{item.productName}}
+
+
+
+ {{item.modelName}}
+ |
+ {{item.specName}}
+
+
+ 入库 {{times.formatDate(item.date) || ''}}
-
-
-
- 型号
- {{item.modelName}}
-
+
+ {{item.total}}
-
-
-
- 规格
- {{item.specName}}
-
-
-
-
-
- 数量
- {{item.total}}
-
-
-
-
-
- 日期
- {{times.formatDate(item.date) || "-"}}
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
- 产品
- {{item.productName}}
+
+
+
+
+
+
+
+
+
+ {{item.productName}}
+
+
+
+ {{item.modelName}}
+ |
+ {{item.specName}}
+
+
+ 出库 {{times.formatDate(item.date) || ''}}
-
-
-
- 型号
- {{item.modelName}}
-
+
+ {{item.total}}
-
-
-
- 规格
- {{item.specName}}
-
-
-
-
-
- 数量
- {{item.total}}
-
-
-
-
-
- 日期
- {{times.formatDate(item.date) || "-"}}
-
-
-
-
-
+
+
+
+
\ No newline at end of file