From aa1294f99707c2730caabb96fc5e38050781831c Mon Sep 17 00:00:00 2001 From: zhengw <247276359@qq.com> Date: Fri, 6 Mar 2026 17:18:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9F=BA=E7=A1=80=E8=B5=84?= =?UTF-8?q?=E6=96=99=E4=B8=8B=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/app.json | 9 + miniprogram/app.wxss | 29 ++++ miniprogram/assets/icons/产品类型.svg | 1 + miniprogram/assets/icons/收支项目.svg | 1 + miniprogram/assets/icons/订单类型.svg | 1 + miniprogram/assets/icons/订单阶段.svg | 1 + miniprogram/pages/base/account/account.ts | 12 ++ miniprogram/pages/base/account/account.wxml | 13 +- miniprogram/pages/base/account/edit/edit.json | 9 + miniprogram/pages/base/account/edit/edit.ts | 121 +++++++++++++ miniprogram/pages/base/account/edit/edit.wxml | 25 +++ miniprogram/pages/base/account/edit/edit.wxss | 0 miniprogram/pages/base/item/edit/edit.json | 10 ++ miniprogram/pages/base/item/edit/edit.ts | 113 +++++++++++++ miniprogram/pages/base/item/edit/edit.wxml | 24 +++ miniprogram/pages/base/item/edit/edit.wxss | 0 miniprogram/pages/base/item/item.json | 15 ++ miniprogram/pages/base/item/item.ts | 160 ++++++++++++++++++ miniprogram/pages/base/item/item.wxml | 49 ++++++ miniprogram/pages/base/item/item.wxss | 0 .../pages/base/orderCategory/edit/edit.json | 9 + .../pages/base/orderCategory/edit/edit.ts | 110 ++++++++++++ .../pages/base/orderCategory/edit/edit.wxml | 20 +++ .../pages/base/orderCategory/edit/edit.wxss | 0 .../base/orderCategory/orderCategory.json | 15 ++ .../pages/base/orderCategory/orderCategory.ts | 157 +++++++++++++++++ .../base/orderCategory/orderCategory.wxml | 48 ++++++ .../base/orderCategory/orderCategory.wxss | 0 .../pages/base/orderStep/edit/edit.json | 9 + miniprogram/pages/base/orderStep/edit/edit.ts | 109 ++++++++++++ .../pages/base/orderStep/edit/edit.wxml | 20 +++ .../pages/base/orderStep/edit/edit.wxss | 0 .../pages/base/orderStep/orderStep.json | 15 ++ miniprogram/pages/base/orderStep/orderStep.ts | 158 +++++++++++++++++ .../pages/base/orderStep/orderStep.wxml | 49 ++++++ .../pages/base/orderStep/orderStep.wxss | 0 .../pages/base/productType/edit/edit.json | 9 + .../pages/base/productType/edit/edit.ts | 109 ++++++++++++ .../pages/base/productType/edit/edit.wxml | 21 +++ .../pages/base/productType/edit/edit.wxss | 0 .../pages/base/productType/productType.json | 15 ++ .../pages/base/productType/productType.ts | 160 ++++++++++++++++++ .../pages/base/productType/productType.wxml | 48 ++++++ .../pages/base/productType/productType.wxss | 0 .../components/page-plugin/page-plugin.ts | 4 +- miniprogram/utils/config.ts | 8 + miniprogram/utils/menuConfig.ts | 16 ++ 47 files changed, 1697 insertions(+), 5 deletions(-) create mode 100644 miniprogram/assets/icons/产品类型.svg create mode 100644 miniprogram/assets/icons/收支项目.svg create mode 100644 miniprogram/assets/icons/订单类型.svg create mode 100644 miniprogram/assets/icons/订单阶段.svg create mode 100644 miniprogram/pages/base/account/edit/edit.json create mode 100644 miniprogram/pages/base/account/edit/edit.ts create mode 100644 miniprogram/pages/base/account/edit/edit.wxml create mode 100644 miniprogram/pages/base/account/edit/edit.wxss create mode 100644 miniprogram/pages/base/item/edit/edit.json create mode 100644 miniprogram/pages/base/item/edit/edit.ts create mode 100644 miniprogram/pages/base/item/edit/edit.wxml create mode 100644 miniprogram/pages/base/item/edit/edit.wxss create mode 100644 miniprogram/pages/base/item/item.json create mode 100644 miniprogram/pages/base/item/item.ts create mode 100644 miniprogram/pages/base/item/item.wxml create mode 100644 miniprogram/pages/base/item/item.wxss create mode 100644 miniprogram/pages/base/orderCategory/edit/edit.json create mode 100644 miniprogram/pages/base/orderCategory/edit/edit.ts create mode 100644 miniprogram/pages/base/orderCategory/edit/edit.wxml create mode 100644 miniprogram/pages/base/orderCategory/edit/edit.wxss create mode 100644 miniprogram/pages/base/orderCategory/orderCategory.json create mode 100644 miniprogram/pages/base/orderCategory/orderCategory.ts create mode 100644 miniprogram/pages/base/orderCategory/orderCategory.wxml create mode 100644 miniprogram/pages/base/orderCategory/orderCategory.wxss create mode 100644 miniprogram/pages/base/orderStep/edit/edit.json create mode 100644 miniprogram/pages/base/orderStep/edit/edit.ts create mode 100644 miniprogram/pages/base/orderStep/edit/edit.wxml create mode 100644 miniprogram/pages/base/orderStep/edit/edit.wxss create mode 100644 miniprogram/pages/base/orderStep/orderStep.json create mode 100644 miniprogram/pages/base/orderStep/orderStep.ts create mode 100644 miniprogram/pages/base/orderStep/orderStep.wxml create mode 100644 miniprogram/pages/base/orderStep/orderStep.wxss create mode 100644 miniprogram/pages/base/productType/edit/edit.json create mode 100644 miniprogram/pages/base/productType/edit/edit.ts create mode 100644 miniprogram/pages/base/productType/edit/edit.wxml create mode 100644 miniprogram/pages/base/productType/edit/edit.wxss create mode 100644 miniprogram/pages/base/productType/productType.json create mode 100644 miniprogram/pages/base/productType/productType.ts create mode 100644 miniprogram/pages/base/productType/productType.wxml create mode 100644 miniprogram/pages/base/productType/productType.wxss diff --git a/miniprogram/app.json b/miniprogram/app.json index e2b4147..5d25c99 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -29,7 +29,16 @@ "pages/base/supplier/supplier", "pages/base/customer/customer", "pages/base/account/account", + "pages/base/account/edit/edit", + "pages/base/item/item", + "pages/base/item/edit/edit", "pages/base/workload/workload", + "pages/base/orderStep/orderStep", + "pages/base/orderStep/edit/edit", + "pages/base/orderCategory/orderCategory", + "pages/base/orderCategory/edit/edit", + "pages/base/productType/productType", + "pages/base/productType/edit/edit", "pages/manage/department/department", "pages/manage/groupDetail/groupDetail", "pages/manage/group/group", diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss index 1b91060..3858d0c 100644 --- a/miniprogram/app.wxss +++ b/miniprogram/app.wxss @@ -37,3 +37,32 @@ view.t-cell__title-text { .card-plugin-footer:empty { display: none; } + +.required::after { + content: '*'; + color: red; + font-size: 32rpx; + margin-left: 4rpx; +} + +.textarea-label { + font: var( + --td-cell-title-font, + var( + --td-font-body-large, + 32rpx / 48rpx var(--td-font-family, PingFang SC, Microsoft YaHei, Arial Regular) + ) + ) !important; +} + +.flex-b { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; +} + +.flex-b view { + word-break: break-all; + min-width: 0; +} diff --git a/miniprogram/assets/icons/产品类型.svg b/miniprogram/assets/icons/产品类型.svg new file mode 100644 index 0000000..b9414f5 --- /dev/null +++ b/miniprogram/assets/icons/产品类型.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/assets/icons/收支项目.svg b/miniprogram/assets/icons/收支项目.svg new file mode 100644 index 0000000..178ec1f --- /dev/null +++ b/miniprogram/assets/icons/收支项目.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/assets/icons/订单类型.svg b/miniprogram/assets/icons/订单类型.svg new file mode 100644 index 0000000..fed9696 --- /dev/null +++ b/miniprogram/assets/icons/订单类型.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/assets/icons/订单阶段.svg b/miniprogram/assets/icons/订单阶段.svg new file mode 100644 index 0000000..e65a153 --- /dev/null +++ b/miniprogram/assets/icons/订单阶段.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/pages/base/account/account.ts b/miniprogram/pages/base/account/account.ts index f8663cc..fb9556e 100644 --- a/miniprogram/pages/base/account/account.ts +++ b/miniprogram/pages/base/account/account.ts @@ -74,7 +74,19 @@ Page({ }); }); }, + onOrderEdit(e: any) { + const data = getDataSet(e); + const index = data.index; + wx.navigateTo({ + url: '/pages/base/account/edit/edit', + success: (res) => { + res.eventChannel.emit('accountEdit', { + data: index == -1 ? {} : this.data.list[index], + }); + }, + }); + }, onDefault(e: any) { const data = getDataSet(e); const index = data.index; diff --git a/miniprogram/pages/base/account/account.wxml b/miniprogram/pages/base/account/account.wxml index 95b1849..ac24917 100644 --- a/miniprogram/pages/base/account/account.wxml +++ b/miniprogram/pages/base/account/account.wxml @@ -14,11 +14,15 @@ + + 新增结算账户 + - + @@ -27,17 +31,20 @@ - 正常 + 启用 禁用 - + + + 编辑 设为默认 diff --git a/miniprogram/pages/base/account/edit/edit.json b/miniprogram/pages/base/account/edit/edit.json new file mode 100644 index 0000000..3dfeff9 --- /dev/null +++ b/miniprogram/pages/base/account/edit/edit.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "t-cell": "tdesign-miniprogram/cell/cell", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input" + }, + "navigationBarTitleText": "结算账户" +} \ No newline at end of file diff --git a/miniprogram/pages/base/account/edit/edit.ts b/miniprogram/pages/base/account/edit/edit.ts new file mode 100644 index 0000000..8317ca3 --- /dev/null +++ b/miniprogram/pages/base/account/edit/edit.ts @@ -0,0 +1,121 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + sleep, + toastError, + toastSuccess, + toNumber, + toObject, +} from '@/utils/util'; + +const defaultParams = { comments: '', account_name: '' }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + mode: 'new' as 'new' | 'edit', + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + }, + onChange(e: any) { + const key = getDataSet(e).key; + const val = e.detail.value; + this.data.params[key] = val; + this.setData({ params: this.data.params }); + }, + onBlur(e: any) { + const key = getDataSet(e).key; + if (key == 'init_amount') { + const val = e.detail.value; + this.data.params[key] = val ? toNumber(val).toFixed(2) : val; + this.setData({ params: this.data.params }); + } + }, + onCheckboxChange(e: any) { + const key = getDataSet(e).key; + this.data.params[key] = e.detail.checked ? 1 : 2; + this.setData({ params: this.data.params }); + }, + onSave() { + // console.log(this.data.params); + if (this.data.mode == 'new') { + this.data.params.current_amount = this.data.params.init_amount; + } + if (this.data.params.account_name) { + post(this.data.mode == 'new' ? 'ErpAccount/add' : 'ErpAccount/edit', this.data.params).then( + () => { + toastSuccess('保存成功'); + sleep(() => { + wx.navigateBack(); + }, 1000); + }, + ); + } else { + toastError('类型名称必填'); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) { + const eventChannel: any = this.getOpenerEventChannel(); + + eventChannel?.on('accountEdit', (e: any) => { + const data = toObject(e.data); + wx.setNavigationBarTitle({ + title: data.account_id ? `${data.account_name} 修改` : '新增结算账户', + }); + this.setData({ params: data, mode: data.account_id ? 'edit' : 'new' }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/account/edit/edit.wxml b/miniprogram/pages/base/account/edit/edit.wxml new file mode 100644 index 0000000..090e1ee --- /dev/null +++ b/miniprogram/pages/base/account/edit/edit.wxml @@ -0,0 +1,25 @@ + + + 账户名称 + + + 期初金额 + + + + 备注 + + + 保存 + + \ No newline at end of file diff --git a/miniprogram/pages/base/account/edit/edit.wxss b/miniprogram/pages/base/account/edit/edit.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/item/edit/edit.json b/miniprogram/pages/base/item/edit/edit.json new file mode 100644 index 0000000..46479a8 --- /dev/null +++ b/miniprogram/pages/base/item/edit/edit.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "t-cell": "tdesign-miniprogram/cell/cell", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input", + "t-radio": "tdesign-miniprogram/radio/radio", + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group" + }, + "navigationBarTitleText": "收支项目" +} \ No newline at end of file diff --git a/miniprogram/pages/base/item/edit/edit.ts b/miniprogram/pages/base/item/edit/edit.ts new file mode 100644 index 0000000..bb59df9 --- /dev/null +++ b/miniprogram/pages/base/item/edit/edit.ts @@ -0,0 +1,113 @@ +import { FinanceItemTypeArr } from '@/utils/config'; +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + sleep, + toastError, + toastSuccess, + toObject, +} from '@/utils/util'; + +const defaultParams = { comments: '', item_name: '', item_type: FinanceItemTypeArr[0].value }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + mode: 'new' as 'new' | 'edit', + FinanceItemTypeArr: FinanceItemTypeArr, + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + }, + onChange(e: any) { + const key = getDataSet(e).key; + const val = e.detail.value; + this.data.params[key] = val; + this.setData({ params: this.data.params }); + }, + onCheckboxChange(e: any) { + const key = getDataSet(e).key; + this.data.params[key] = e.detail.checked ? 1 : 2; + this.setData({ params: this.data.params }); + }, + onSave() { + // console.log(this.data.params); + if (this.data.params.item_name) { + post( + this.data.mode == 'new' ? 'ErpFinanceItem/add' : 'ErpFinanceItem/edit', + this.data.params, + ).then(() => { + toastSuccess('保存成功'); + sleep(() => { + wx.navigateBack(); + }, 1000); + }); + } else { + toastError('项目名称必填'); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) { + const eventChannel: any = this.getOpenerEventChannel(); + eventChannel?.on('itemEdit', (e: any) => { + const data = toObject(e.data); + // console.log(data); + wx.setNavigationBarTitle({ + title: data.item_id ? `${data.item_name} 修改` : '新增订单类型', + }); + data.item_type = data.item_type ? `${data.item_type}` : FinanceItemTypeArr[0].value; + this.setData({ params: data, mode: data.item_id ? 'edit' : 'new' }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/item/edit/edit.wxml b/miniprogram/pages/base/item/edit/edit.wxml new file mode 100644 index 0000000..7d21b3b --- /dev/null +++ b/miniprogram/pages/base/item/edit/edit.wxml @@ -0,0 +1,24 @@ + + + 项目名称 + + + + + + + + + + 备注 + + + 保存 + + \ No newline at end of file diff --git a/miniprogram/pages/base/item/edit/edit.wxss b/miniprogram/pages/base/item/edit/edit.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/item/item.json b/miniprogram/pages/base/item/item.json new file mode 100644 index 0000000..14d501d --- /dev/null +++ b/miniprogram/pages/base/item/item.json @@ -0,0 +1,15 @@ +{ + "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", + "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/base/item/item.ts b/miniprogram/pages/base/item/item.ts new file mode 100644 index 0000000..dfc0249 --- /dev/null +++ b/miniprogram/pages/base/item/item.ts @@ -0,0 +1,160 @@ +import { FinanceItemTypeArr, FinanceItemTypeObj } from '@/utils/config'; +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + searchValueFormat, + showModal, + sleep, + toArray, + toastSuccess, + toNumber, +} from '@/utils/util'; + +const defaultParams = { curr_page: 1, page_count: 20 }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + list: [] as any[], + count: 0, + sort: [{ label: '创建日期', value: 'create_date' }], + FinanceItemTypeObj: FinanceItemTypeObj, + FinanceItemTypeArr: [{ label: '全部', value: '' }, ...FinanceItemTypeArr], + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + this.getList(); + }, + searchChange(e: any) { + const key = getDataSet(e).key; + const val = searchValueFormat(e.detail.value); + if (val) { + this.data.params[key] = val; + } else { + delete this.data.params[key]; + } + 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); + }, + getList(curr: number = 1) { + this.data.params.curr_page = curr; + this.setData({ params: this.data.params }); + const temp = cloneLite(this.data.params); + + post('ErpFinanceItem/list', temp).then((res: any) => { + const list = toArray(res.data?.list); + // if (list.length == 0 && this.data.params.curr_page > 1) { + // this.getList(this.data.params.curr_page - 1); + // } + this.setData({ count: toNumber(res.data?.count), list: list }); + }); + }, + + onOrderDel(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ content: `确认删除 ${item.item_name}?` }).then(() => { + post('ErpFinanceItem/del', { item_id: item.item_id }).then(() => { + toastSuccess('删除成功'); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderState(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ + content: `确认${item.state == 1 ? '禁用' : '启用'} ${item.item_name}?`, + }).then(() => { + // post('OrderCategory/setState', { order_cate_id: item.order_cate_id }).then(() => { + // toastSuccess(`${item.state == 1 ? '禁用' : '启用'}成功`); + // sleep(() => { + // this.getList(); + // }, 1000); + // }); + }); + }, + onOrderEdit(e: any) { + const data = getDataSet(e); + const index = data.index; + + wx.navigateTo({ + url: '/pages/base/item/edit/edit', + success: (res) => { + res.eventChannel.emit('itemEdit', { + data: index == -1 ? {} : this.data.list[index], + }); + }, + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/item/item.wxml b/miniprogram/pages/base/item/item.wxml new file mode 100644 index 0000000..2708bb7 --- /dev/null +++ b/miniprogram/pages/base/item/item.wxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + 新增收支项目 + + + + + + + + {{ item.item_name }} + + + + + + + + + 编辑 + + 删除 + + + + \ No newline at end of file diff --git a/miniprogram/pages/base/item/item.wxss b/miniprogram/pages/base/item/item.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/orderCategory/edit/edit.json b/miniprogram/pages/base/orderCategory/edit/edit.json new file mode 100644 index 0000000..a10d5f9 --- /dev/null +++ b/miniprogram/pages/base/orderCategory/edit/edit.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "t-cell": "tdesign-miniprogram/cell/cell", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input" + }, + "navigationBarTitleText": "订单类型" +} \ No newline at end of file diff --git a/miniprogram/pages/base/orderCategory/edit/edit.ts b/miniprogram/pages/base/orderCategory/edit/edit.ts new file mode 100644 index 0000000..013e1f6 --- /dev/null +++ b/miniprogram/pages/base/orderCategory/edit/edit.ts @@ -0,0 +1,110 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + sleep, + toastError, + toastSuccess, + toObject, +} from '@/utils/util'; + +const defaultParams = { comments: '', order_cate_name: '' }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + mode: 'new' as 'new' | 'edit', + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + }, + onChange(e: any) { + const key = getDataSet(e).key; + const val = e.detail.value; + this.data.params[key] = val; + this.setData({ params: this.data.params }); + }, + onCheckboxChange(e: any) { + const key = getDataSet(e).key; + this.data.params[key] = e.detail.checked ? 1 : 2; + this.setData({ params: this.data.params }); + }, + onSave() { + // console.log(this.data.params); + if (this.data.params.order_cate_name) { + post( + this.data.mode == 'new' ? 'OrderCategory/add' : 'OrderCategory/edit', + this.data.params, + ).then(() => { + toastSuccess('保存成功'); + sleep(() => { + wx.navigateBack(); + }, 1000); + }); + } else { + toastError('类型名称必填'); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) { + const eventChannel: any = this.getOpenerEventChannel(); + + eventChannel?.on('orderCategoryEdit', (e: any) => { + const data = toObject(e.data); + wx.setNavigationBarTitle({ + title: data.order_cate_id ? `${data.order_cate_name} 修改` : '新增订单类型', + }); + this.setData({ params: data, mode: data.order_cate_id ? 'edit' : 'new' }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/orderCategory/edit/edit.wxml b/miniprogram/pages/base/orderCategory/edit/edit.wxml new file mode 100644 index 0000000..2eef3b7 --- /dev/null +++ b/miniprogram/pages/base/orderCategory/edit/edit.wxml @@ -0,0 +1,20 @@ + + + 类型名称 + + + + 备注 + + + 保存 + + \ No newline at end of file diff --git a/miniprogram/pages/base/orderCategory/edit/edit.wxss b/miniprogram/pages/base/orderCategory/edit/edit.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/orderCategory/orderCategory.json b/miniprogram/pages/base/orderCategory/orderCategory.json new file mode 100644 index 0000000..5bddb27 --- /dev/null +++ b/miniprogram/pages/base/orderCategory/orderCategory.json @@ -0,0 +1,15 @@ +{ + "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", + "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/base/orderCategory/orderCategory.ts b/miniprogram/pages/base/orderCategory/orderCategory.ts new file mode 100644 index 0000000..4cf93d9 --- /dev/null +++ b/miniprogram/pages/base/orderCategory/orderCategory.ts @@ -0,0 +1,157 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + searchValueFormat, + showModal, + sleep, + toArray, + toastSuccess, + toNumber, +} from '@/utils/util'; + +const defaultParams = { curr_page: 1, page_count: 20 }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + list: [] as any[], + count: 0, + sort: [{ label: '创建日期', value: 'create_date' }], + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + this.getList(); + }, + searchChange(e: any) { + const key = getDataSet(e).key; + const val = searchValueFormat(e.detail.value); + if (val) { + this.data.params[key] = val; + } else { + delete this.data.params[key]; + } + 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); + }, + getList(curr: number = 1) { + this.data.params.curr_page = curr; + this.setData({ params: this.data.params }); + const temp = cloneLite(this.data.params); + + post('OrderCategory/list', 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 }); + }); + }, + + onOrderDel(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ content: `确认删除 ${item.order_cate_name}?` }).then(() => { + post('OrderCategory/del', { order_cate_id: item.order_cate_id }).then(() => { + toastSuccess('删除成功'); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderState(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ + content: `确认${item.state == 1 ? '禁用' : '启用'} ${item.order_cate_name}?`, + }).then(() => { + post('OrderCategory/setState', { order_cate_id: item.order_cate_id }).then(() => { + toastSuccess(`${item.state == 1 ? '禁用' : '启用'}成功`); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderEdit(e: any) { + const data = getDataSet(e); + const index = data.index; + + wx.navigateTo({ + url: '/pages/base/orderCategory/edit/edit', + success: (res) => { + res.eventChannel.emit('orderCategoryEdit', { + data: index == -1 ? {} : this.data.list[index], + }); + }, + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/orderCategory/orderCategory.wxml b/miniprogram/pages/base/orderCategory/orderCategory.wxml new file mode 100644 index 0000000..35d3719 --- /dev/null +++ b/miniprogram/pages/base/orderCategory/orderCategory.wxml @@ -0,0 +1,48 @@ + + + + + + + + + + + + 新增订单类型 + + + + + + + + {{ item.order_cate_name }} + {{item.state == 1 ? '启用': '禁用'}} + + + + + + + + 编辑 + {{item.state == 1 ? '禁用' : '启用' }} + 删除 + + + + \ No newline at end of file diff --git a/miniprogram/pages/base/orderCategory/orderCategory.wxss b/miniprogram/pages/base/orderCategory/orderCategory.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/orderStep/edit/edit.json b/miniprogram/pages/base/orderStep/edit/edit.json new file mode 100644 index 0000000..10ceeeb --- /dev/null +++ b/miniprogram/pages/base/orderStep/edit/edit.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "t-cell": "tdesign-miniprogram/cell/cell", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input" + }, + "navigationBarTitleText": "订单阶段" +} \ No newline at end of file diff --git a/miniprogram/pages/base/orderStep/edit/edit.ts b/miniprogram/pages/base/orderStep/edit/edit.ts new file mode 100644 index 0000000..99ca28c --- /dev/null +++ b/miniprogram/pages/base/orderStep/edit/edit.ts @@ -0,0 +1,109 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + sleep, + toastError, + toastSuccess, + toObject, +} from '@/utils/util'; + +const defaultParams = { comments: '', order_step_name: '', if_default: 2 }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + mode: 'new' as 'new' | 'edit', + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + }, + onChange(e: any) { + const key = getDataSet(e).key; + const val = e.detail.value; + this.data.params[key] = val; + this.setData({ params: this.data.params }); + }, + onCheckboxChange(e: any) { + const key = getDataSet(e).key; + this.data.params[key] = e.detail.checked ? 1 : 2; + this.setData({ params: this.data.params }); + }, + onSave() { + // console.log(this.data.params); + if (this.data.params.order_step_name) { + post(this.data.mode == 'new' ? 'OrderStep/add' : 'OrderStep/edit', this.data.params).then( + () => { + toastSuccess('保存成功'); + sleep(() => { + wx.navigateBack(); + }, 1000); + }, + ); + } else { + toastError('阶段名称必填'); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) { + const eventChannel: any = this.getOpenerEventChannel(); + + eventChannel?.on('orderStepEdit', (e: any) => { + const data = toObject(e.data); + wx.setNavigationBarTitle({ + title: data.order_step_id ? `${data.order_step_name} 修改` : '新增订单阶段', + }); + this.setData({ params: data, mode: data.order_step_id ? 'edit' : 'new' }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/orderStep/edit/edit.wxml b/miniprogram/pages/base/orderStep/edit/edit.wxml new file mode 100644 index 0000000..5296bf7 --- /dev/null +++ b/miniprogram/pages/base/orderStep/edit/edit.wxml @@ -0,0 +1,20 @@ + + + 阶段名称 + + + + + + + + 备注 + + + 保存 + + \ No newline at end of file diff --git a/miniprogram/pages/base/orderStep/edit/edit.wxss b/miniprogram/pages/base/orderStep/edit/edit.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/orderStep/orderStep.json b/miniprogram/pages/base/orderStep/orderStep.json new file mode 100644 index 0000000..db7c0de --- /dev/null +++ b/miniprogram/pages/base/orderStep/orderStep.json @@ -0,0 +1,15 @@ +{ + "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", + "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/base/orderStep/orderStep.ts b/miniprogram/pages/base/orderStep/orderStep.ts new file mode 100644 index 0000000..9d6051e --- /dev/null +++ b/miniprogram/pages/base/orderStep/orderStep.ts @@ -0,0 +1,158 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + searchValueFormat, + showModal, + sleep, + toArray, + toastSuccess, + toNumber, +} from '@/utils/util'; + +const defaultParams = {}; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + list: [] as any[], + count: 0, + sort: [{ label: '创建日期', value: 'create_date' }], + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + this.getList(); + }, + searchChange(e: any) { + const key = getDataSet(e).key; + const val = searchValueFormat(e.detail.value); + if (val) { + this.data.params[key] = val; + } else { + delete this.data.params[key]; + } + 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); + }, + getList(curr: number = 1) { + this.data.params.curr_page = curr; + this.setData({ params: this.data.params }); + const temp = cloneLite(this.data.params); + + post('OrderStep/list', 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, + }); + }); + }, + + onOrderDel(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ content: `确认删除 ${item.order_step_name}?` }).then(() => { + post('OrderStep/del', { order_step_id: [item.order_step_id].join(',') }).then(() => { + toastSuccess('删除成功'); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderState(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ + content: `确认${item.state == 1 ? '禁用' : '启用'} ${item.order_step_name}?`, + }).then(() => { + post('OrderStep/setState', { order_step_id: item.order_step_id }).then(() => { + toastSuccess(`${item.state == 1 ? '禁用' : '启用'}成功`); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderEdit(e: any) { + const data = getDataSet(e); + const index = data.index; + + wx.navigateTo({ + url: '/pages/base/orderStep/edit/edit', + success: (res) => { + res.eventChannel.emit('orderStepEdit', { data: index == -1 ? {} : this.data.list[index] }); + }, + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/orderStep/orderStep.wxml b/miniprogram/pages/base/orderStep/orderStep.wxml new file mode 100644 index 0000000..87fb550 --- /dev/null +++ b/miniprogram/pages/base/orderStep/orderStep.wxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + 新增订单阶段 + + + + + + + + {{ item.order_step_name }} + {{item.state == 1 ? '启用': '禁用'}} + + + + + + + + + 编辑 + {{item.state == 1 ? '禁用' : '启用' }} + 删除 + + + + \ No newline at end of file diff --git a/miniprogram/pages/base/orderStep/orderStep.wxss b/miniprogram/pages/base/orderStep/orderStep.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/productType/edit/edit.json b/miniprogram/pages/base/productType/edit/edit.json new file mode 100644 index 0000000..9174637 --- /dev/null +++ b/miniprogram/pages/base/productType/edit/edit.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "t-cell": "tdesign-miniprogram/cell/cell", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input" + }, + "navigationBarTitleText": "产品类型" +} \ No newline at end of file diff --git a/miniprogram/pages/base/productType/edit/edit.ts b/miniprogram/pages/base/productType/edit/edit.ts new file mode 100644 index 0000000..cf8fc27 --- /dev/null +++ b/miniprogram/pages/base/productType/edit/edit.ts @@ -0,0 +1,109 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + sleep, + toastError, + toastSuccess, + toObject, +} from '@/utils/util'; + +const defaultParams = { comments: '', product_type_name: '' }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + mode: 'new' as 'new' | 'edit', + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + }, + onChange(e: any) { + const key = getDataSet(e).key; + const val = e.detail.value; + this.data.params[key] = val; + this.setData({ params: this.data.params }); + }, + onCheckboxChange(e: any) { + const key = getDataSet(e).key; + this.data.params[key] = e.detail.checked ? 1 : 2; + this.setData({ params: this.data.params }); + }, + onSave() { + // console.log(this.data.params); + if (this.data.params.product_type_name) { + post(this.data.mode == 'new' ? 'ProductType/add' : 'ProductType/edit', this.data.params).then( + () => { + toastSuccess('保存成功'); + sleep(() => { + wx.navigateBack(); + }, 1000); + }, + ); + } else { + toastError('类型名称必填'); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) { + const eventChannel: any = this.getOpenerEventChannel(); + + eventChannel?.on('productTypeEdit', (e: any) => { + const data = toObject(e.data); + wx.setNavigationBarTitle({ + title: data.product_type_id ? `${data.product_type_name} 修改` : '新增产品类型', + }); + this.setData({ params: data, mode: data.product_type_id ? 'edit' : 'new' }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/productType/edit/edit.wxml b/miniprogram/pages/base/productType/edit/edit.wxml new file mode 100644 index 0000000..261ebd3 --- /dev/null +++ b/miniprogram/pages/base/productType/edit/edit.wxml @@ -0,0 +1,21 @@ + + + 类型名称 + + + + 备注 + + + 保存 + + \ No newline at end of file diff --git a/miniprogram/pages/base/productType/edit/edit.wxss b/miniprogram/pages/base/productType/edit/edit.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/base/productType/productType.json b/miniprogram/pages/base/productType/productType.json new file mode 100644 index 0000000..ca8258f --- /dev/null +++ b/miniprogram/pages/base/productType/productType.json @@ -0,0 +1,15 @@ +{ + "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", + "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/base/productType/productType.ts b/miniprogram/pages/base/productType/productType.ts new file mode 100644 index 0000000..5e193ef --- /dev/null +++ b/miniprogram/pages/base/productType/productType.ts @@ -0,0 +1,160 @@ +import { loginStatusPage, post } from '@/utils/https'; +import { + cloneLite, + getAuthInfo, + getDataSet, + searchValueFormat, + showModal, + sleep, + toArray, + toastSuccess, + toNumber, +} from '@/utils/util'; + +const defaultParams = { curr_page: 1, page_count: 20 }; + +Page({ + /** + * 页面的初始数据 + */ + data: { + params: cloneLite(defaultParams) as any, + list: [] as any[], + count: 0, + sort: [{ label: '创建日期', value: 'create_date' }], + }, + handleLogin(e: any) { + this.setData({ isLogin: e.detail }); + if (e.detail) { + this.init(); + } + }, + init() { + this.setData({ authInfo: getAuthInfo() }); + this.getList(); + }, + searchChange(e: any) { + const key = getDataSet(e).key; + const val = searchValueFormat(e.detail.value); + if (val) { + this.data.params[key] = val; + } else { + delete this.data.params[key]; + } + 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); + }, + getList(curr: number = 1) { + this.data.params.curr_page = curr; + this.setData({ params: this.data.params }); + const temp = cloneLite(this.data.params); + + post('ProductType/list', 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, + }); + }); + }, + + onOrderDel(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ content: `确认删除 ${item.product_type_name}?` }).then(() => { + post('ProductType/del', { product_type_id: item.product_type_id }).then(() => { + toastSuccess('删除成功'); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderState(e: any) { + const data = getDataSet(e); + const index = data.index; + const item = this.data.list[index]; + showModal({ + content: `确认${item.state == 1 ? '禁用' : '启用'} ${item.product_type_name}?`, + }).then(() => { + post('ProductType/setState', { product_type_id: item.product_type_id }).then(() => { + toastSuccess(`${item.state == 1 ? '禁用' : '启用'}成功`); + sleep(() => { + this.getList(); + }, 1000); + }); + }); + }, + onOrderEdit(e: any) { + const data = getDataSet(e); + const index = data.index; + + wx.navigateTo({ + url: '/pages/base/productType/edit/edit', + success: (res) => { + res.eventChannel.emit('productTypeEdit', { + data: index == -1 ? {} : this.data.list[index], + }); + }, + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(_options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + loginStatusPage(this); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/base/productType/productType.wxml b/miniprogram/pages/base/productType/productType.wxml new file mode 100644 index 0000000..2b6b907 --- /dev/null +++ b/miniprogram/pages/base/productType/productType.wxml @@ -0,0 +1,48 @@ + + + + + + + + + + + + 新增产品类型 + + + + + + + + {{ item.product_type_name }} + {{item.state == 1 ? '启用': '禁用'}} + + + + + + + + 编辑 + {{item.state == 1 ? '禁用' : '启用' }} + 删除 + + + + \ No newline at end of file diff --git a/miniprogram/pages/base/productType/productType.wxss b/miniprogram/pages/base/productType/productType.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/components/page-plugin/page-plugin.ts b/miniprogram/pages/components/page-plugin/page-plugin.ts index 2148a57..2c3ee36 100644 --- a/miniprogram/pages/components/page-plugin/page-plugin.ts +++ b/miniprogram/pages/components/page-plugin/page-plugin.ts @@ -64,11 +64,11 @@ Component({ if (e.detail.encryptedData) { this.data.encryptedData = e.detail.encryptedData; this.data.iv = e.detail.iv; - console.log(e); + // console.log(e); login(e.detail.encryptedData, e.detail.iv) .then((res) => { - console.log(res); + // console.log(res); if (isArray(res.data)) { this.setData({ companyList: res.data, diff --git a/miniprogram/utils/config.ts b/miniprogram/utils/config.ts index 6662a1d..7fcd575 100644 --- a/miniprogram/utils/config.ts +++ b/miniprogram/utils/config.ts @@ -58,3 +58,11 @@ export const PayedStateOption = [ { label: '部分收款', value: '2' }, { label: '收款完成', value: '3' }, ]; + +/** 收支类型 */ +export const FinanceItemTypeObj = { 1: '收入', 2: '支出' }; + +export const FinanceItemTypeArr = [ + { value: '1', label: '收入' }, + { value: '2', label: '支出' }, +]; diff --git a/miniprogram/utils/menuConfig.ts b/miniprogram/utils/menuConfig.ts index 7d96546..c22a5b4 100644 --- a/miniprogram/utils/menuConfig.ts +++ b/miniprogram/utils/menuConfig.ts @@ -120,6 +120,22 @@ export const menuConfig = [ url: '/pages/base/processConfig/processConfig', auth: 'SF_PROCESS_CONFIG_VIEW', }, + { title: '订单阶段', url: '/pages/base/orderStep/orderStep', auth: 'SF_ORDER_STEP_VIEW' }, + { + title: '订单类型', + url: '/pages/base/orderCategory/orderCategory', + auth: 'SF_ORDER_STEP_VIEW', + }, + { + title: '产品类型', + url: '/pages/base/productType/productType', + auth: 'SF_PRODUCT_TYPE_VIEW', + }, + { + title: '收支项目', + url: '/pages/base/item/item', + auth: 'SF_FINANCE_ITEM_VIEW', + }, ], }, {