diff --git a/miniprogram/app.json b/miniprogram/app.json
index 9253fe3..5933b62 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -31,6 +31,7 @@
"pages/other/goods/goods",
"pages/other/goodsDetail/goodsDetail",
"pages/other/batch/batch",
+ "pages/other/batchDetail/batchDetail",
"pages/base/viewAttachment/viewAttachment",
"pages/other/outbound/outbound"
],
diff --git a/miniprogram/pages/agreement/agreement.wxss b/miniprogram/pages/agreement/agreement.wxss
index 3d95ba3..71df25d 100644
--- a/miniprogram/pages/agreement/agreement.wxss
+++ b/miniprogram/pages/agreement/agreement.wxss
@@ -1,5 +1,3 @@
-/* pages/agreement/agreement.wxss */
-
page {
padding-bottom: constant(safe-area-inset-bottom);
/*兼容 IOS<11.2*/
diff --git a/miniprogram/pages/base/viewAttachment/viewAttachment.wxss b/miniprogram/pages/base/viewAttachment/viewAttachment.wxss
index a880bac..e69de29 100644
--- a/miniprogram/pages/base/viewAttachment/viewAttachment.wxss
+++ b/miniprogram/pages/base/viewAttachment/viewAttachment.wxss
@@ -1 +0,0 @@
-/* pages/other/viewAttachment/viewAttachment.wxss */
\ No newline at end of file
diff --git a/miniprogram/pages/components/card-plugin/card-plugin.wxss b/miniprogram/pages/components/card-plugin/card-plugin.wxss
index c551c01..313390b 100644
--- a/miniprogram/pages/components/card-plugin/card-plugin.wxss
+++ b/miniprogram/pages/components/card-plugin/card-plugin.wxss
@@ -1,4 +1,3 @@
-/* pages/components/card_plugin/card_plugin.wxss */
.header,
.footer {
display: flex;
diff --git a/miniprogram/pages/finance/flow/flow.wxss b/miniprogram/pages/finance/flow/flow.wxss
index b119efb..e69de29 100644
--- a/miniprogram/pages/finance/flow/flow.wxss
+++ b/miniprogram/pages/finance/flow/flow.wxss
@@ -1 +0,0 @@
-/* pages/finance/flow/flow.wxss */
\ No newline at end of file
diff --git a/miniprogram/pages/finance/giro/giro.wxss b/miniprogram/pages/finance/giro/giro.wxss
index ded56ca..e69de29 100644
--- a/miniprogram/pages/finance/giro/giro.wxss
+++ b/miniprogram/pages/finance/giro/giro.wxss
@@ -1 +0,0 @@
-/* pages/finance/giro/giro.wxss */
\ No newline at end of file
diff --git a/miniprogram/pages/finance/outcome/outcome.wxss b/miniprogram/pages/finance/outcome/outcome.wxss
index b1c577e..e69de29 100644
--- a/miniprogram/pages/finance/outcome/outcome.wxss
+++ b/miniprogram/pages/finance/outcome/outcome.wxss
@@ -1 +0,0 @@
-/* pages/finance/outcome/outcome.wxss */
\ No newline at end of file
diff --git a/miniprogram/pages/other/batch/batch.ts b/miniprogram/pages/other/batch/batch.ts
index e465034..d81e8fd 100644
--- a/miniprogram/pages/other/batch/batch.ts
+++ b/miniprogram/pages/other/batch/batch.ts
@@ -112,9 +112,9 @@ Page({
const index = data.index;
const item = this.data.list[index];
wx.navigateTo({
- url: `/pages/other/goodsDetail/goodsDetail?goods_id=${
- item.goods_id
- }&title=${encodeURIComponent(item.goods_name)}`,
+ url: `/pages/other/batchDetail/batchDetail?batch_id=${
+ item.batch_id
+ }&title=${encodeURIComponent(item.batch_no)}`,
});
},
diff --git a/miniprogram/pages/other/batch/batch.wxml b/miniprogram/pages/other/batch/batch.wxml
index bb140a4..aac6c06 100644
--- a/miniprogram/pages/other/batch/batch.wxml
+++ b/miniprogram/pages/other/batch/batch.wxml
@@ -44,7 +44,7 @@
diff --git a/miniprogram/pages/other/batchDetail/batchDetail.json b/miniprogram/pages/other/batchDetail/batchDetail.json
new file mode 100644
index 0000000..8b9261c
--- /dev/null
+++ b/miniprogram/pages/other/batchDetail/batchDetail.json
@@ -0,0 +1,16 @@
+{
+ "usingComponents": {
+ "search-popup": "/pages/components/search-popup/search-popup",
+ "card-plugin": "/pages/components/card-plugin/card-plugin",
+ "card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
+ "option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
+ "date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
+ "sort-plugin": "/pages/components/sort-plugin/sort-plugin",
+ "select-plugin": "/pages/components/select-plugin/select-plugin",
+ "count-plugin": "/pages/components/count-plugin/count-plugin",
+ "total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
+ "pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
+ "search-input": "/pages/components/search-input/search-input"
+ },
+ "navigationBarTitleText": "批次详情"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/other/batchDetail/batchDetail.ts b/miniprogram/pages/other/batchDetail/batchDetail.ts
new file mode 100644
index 0000000..b48a6b3
--- /dev/null
+++ b/miniprogram/pages/other/batchDetail/batchDetail.ts
@@ -0,0 +1,153 @@
+import { loginStatus, post } from '@/utils/https';
+import { cloneLite, getAuthInfo, getDataSet, toArray, toNumber } from '@/utils/util';
+
+const defaultParams = { curr_page: 1, page_count: 20, batch_id: '' };
+
+Page({
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ params: cloneLite(defaultParams) as any,
+ list: [] as any[],
+ count: 0,
+ sort: [{ label: '创建日期', value: 'create_date' }],
+ depots: [] as any[],
+ depotsObj: {} as any,
+ },
+ handleLogin(e: any) {
+ this.setData({ isLogin: e.detail });
+ if (e.detail) {
+ this.init();
+ }
+ },
+ init() {
+ this.setData({ authInfo: getAuthInfo() });
+ this.getList();
+ this.getData();
+ },
+ searchChange(e: any) {
+ const key = getDataSet(e).key;
+ this.data.params[key] = e.detail.value;
+ this.setData({ params: this.data.params });
+ },
+ searchChange2(e: any) {
+ const key = getDataSet(e).key;
+ const val = `${e.detail.value || ''}`.trim();
+ if (val) {
+ this.data.params[key] = val;
+ } else {
+ delete this.data.params[key];
+ }
+ this.setData({ params: this.data.params });
+ },
+ onOptionChange(e: any) {
+ const key = getDataSet(e).key;
+ this.data.params[key] = e.detail.value;
+ this.setData({ params: this.data.params });
+ },
+ datePickerConfirm(e: any) {
+ const data = getDataSet(e);
+ this.data.params[data.key] = e.detail.value;
+ this.setData({ params: this.data.params });
+ },
+ searchOk() {
+ this.getList(1);
+ },
+ searchReset() {
+ this.data.params = cloneLite(defaultParams);
+ this.getList(1);
+ },
+ onSort(e: any) {
+ this.data.params.order = e.detail.value;
+ this.setData({ params: this.data.params });
+ this.getList(1);
+ },
+ paginationChange(e: any) {
+ this.getList(e.detail.curr_page);
+ },
+ getData() {
+ post('ErpDepot/ajaxDepotList').then((res: any) => {
+ const depots = toArray(res.data).map((el) => {
+ this.data.depotsObj[el.depot_id] = el.depot_name;
+ return { label: el.depot_name, value: el.depot_id };
+ });
+ this.setData({
+ depots,
+ depotsObj: this.data.depotsObj,
+ });
+ });
+ },
+ getList(curr: number = 1) {
+ this.data.params.curr_page = curr;
+ this.setData({ params: this.data.params });
+ const temp = cloneLite(this.data.params);
+
+ post('GoodsBatch/getBatchLogList', temp).then((res: any) => {
+ const list = toArray(res.data);
+ if (list.length == 0 && this.data.params.curr_page > 1) {
+ this.getList(this.data.params.curr_page - 1);
+ }
+ this.setData({
+ count: toNumber(res.count),
+ list: list,
+ });
+ });
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ const { batch_id, title } = options;
+ this.data.params.batch_id = batch_id;
+ if (title) {
+ wx.setNavigationBarTitle({ title });
+ }
+ this.setData({ loading: true });
+ loginStatus()
+ .then(() => {
+ this.setData({ isLogin: true, loading: false });
+ this.init();
+ })
+ .catch((err) => {
+ this.setData({ isLogin: false, loading: false });
+ console.log('调用登录状态请求失败', err);
+ });
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {},
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {},
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide() {},
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload() {},
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh() {},
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {},
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {},
+});
diff --git a/miniprogram/pages/other/batchDetail/batchDetail.wxml b/miniprogram/pages/other/batchDetail/batchDetail.wxml
new file mode 100644
index 0000000..e0fb5b2
--- /dev/null
+++ b/miniprogram/pages/other/batchDetail/batchDetail.wxml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+ {{ item.rel_bill_no }}
+ {{item.type}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/other/batchDetail/batchDetail.wxss b/miniprogram/pages/other/batchDetail/batchDetail.wxss
new file mode 100644
index 0000000..e69de29
diff --git a/miniprogram/pages/other/goods/goods.ts b/miniprogram/pages/other/goods/goods.ts
index 1d35c26..1eecf9a 100644
--- a/miniprogram/pages/other/goods/goods.ts
+++ b/miniprogram/pages/other/goods/goods.ts
@@ -66,6 +66,52 @@ Page({
paginationChange(e: any) {
this.getList(e.detail.curr_page);
},
+ /**
+ * 根据父级ID排序树形结构的一维数组
+ */
+ sortTreeArrayByParentId(
+ arr: any[],
+ rootParentId = 0,
+ idKey = 'cate_id',
+ parentIdKey = 'parent_cate_id',
+ ) {
+ // 1. 构建映射表,快速查找子节点
+ const nodeMap = new Map();
+ arr.forEach((node) => {
+ nodeMap.set(node[idKey], { ...node, children: [] });
+ });
+
+ // 2. 构建树形结构
+ const tree: any[] = [];
+ arr.forEach((node) => {
+ const currentNode = nodeMap.get(node[idKey]);
+ const parentNode = nodeMap.get(node[parentIdKey]);
+
+ if (parentNode) {
+ // 有父节点,添加到父节点的children中
+ parentNode.children.push(currentNode);
+ } else if (node[parentIdKey] === rootParentId) {
+ // 根节点,直接加入树形结构
+ tree.push(currentNode);
+ }
+ });
+
+ // 3. 递归扁平化树形结构,按层级输出
+ function flattenTree(nodes: any[]) {
+ const result: any[] = [];
+ nodes.forEach((node) => {
+ // 先加入当前节点
+ result.push({ ...node, children: undefined }); // 移除children属性,还原原始结构
+ // 递归处理子节点
+ if (node.children && node.children.length > 0) {
+ result.push(...flattenTree(node.children));
+ }
+ });
+ return result;
+ }
+
+ return flattenTree(tree);
+ },
getData() {
post('ErpDepot/list').then((res: any) => {
const depots = toArray(res.data?.list).map((el) => {
@@ -74,10 +120,14 @@ Page({
this.setData({ depots });
});
post('GoodsCategory/list').then((res: any) => {
- const goodsClass = toArray(res.data?.list).map((el) => {
+ // const goodsClass = toArray(res.data?.list).map((el) => {
+ // return { label: el.cate_name, value: el.cate_id };
+ // });
+ const sortedArray = this.sortTreeArrayByParentId(toArray(res.data?.list)).map((el) => {
return { label: el.cate_name, value: el.cate_id };
});
- this.setData({ goodsClass });
+
+ this.setData({ goodsClass: sortedArray });
});
},
getList(curr: number = 1) {