添加基础资料下的页面功能
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
1
miniprogram/assets/icons/产品类型.svg
Normal file
1
miniprogram/assets/icons/产品类型.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1141 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="71.3125" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M417.790445 461.845585l-340.306796-146.8991a52.018324 52.018324 0 0 0-49.911663 4.537424A62.713681 62.713681 0 0 0 0.023341 372.717614v414.931214a61.66035 61.66035 0 0 0 35.651188 57.609079l340.306795 146.8991a52.909604 52.909604 0 0 0 20.90456 4.375373 52.09935 52.09935 0 0 0 28.926078-8.912797 62.713681 62.713681 0 0 0 27.386594-53.15268V519.454663A61.66035 61.66035 0 0 0 417.790445 461.845585z m-29.169154 465.004928L64.843683 787.243701V380.252979l324.10171 139.606812zM899.891738 254.744592a61.093172 61.093172 0 0 0 39.054256-58.986511 61.012147 61.012147 0 0 0-39.86451-58.014206L517.775822 3.16064a55.097291 55.097291 0 0 0-36.785544 0L99.684617 137.743875a61.012147 61.012147 0 0 0-39.864511 58.257282 61.093172 61.093172 0 0 0 39.054256 58.743435l381.305662 141.22732a54.692164 54.692164 0 0 0 38.406052 0l381.305662-141.22732z m-400.508688 79.242868l-371.58261-137.743227L499.38305 65.388168l371.58261 130.937091zM718.961958 422.710303h-77.379283A95.934106 95.934106 0 0 0 545.729595 518.563384v77.298257a96.015131 96.015131 0 0 0 95.85308 95.934107h77.379283a96.015131 96.015131 0 0 0 95.853081-95.934107V518.563384a95.934106 95.934106 0 0 0-95.853081-95.853081z m31.032739 173.151338a31.113764 31.113764 0 0 1-31.032739 31.113765h-77.379283a31.113764 31.113764 0 0 1-31.032738-31.113765V518.563384a31.113764 31.113764 0 0 1 31.032738-31.032739h77.379283A31.113764 31.113764 0 0 1 749.994697 518.563384zM908.399408 461.845585a32.410171 32.410171 0 0 0 0 64.820341h200.213831a32.410171 32.410171 0 0 0 0-64.820341h-200.213831zM1108.613239 585.571412h-200.213831a32.410171 32.410171 0 0 0 0 64.820342h200.213831a32.410171 32.410171 0 0 0 0-64.820342zM718.961958 754.671479h-77.379283A96.015131 96.015131 0 0 0 545.729595 850.767636v77.298258a96.015131 96.015131 0 0 0 95.85308 95.934106h77.379283a96.015131 96.015131 0 0 0 95.853081-96.096157V850.767636a96.015131 96.015131 0 0 0-95.853081-96.096157z m31.032739 173.232364a31.113764 31.113764 0 0 1-31.032739 31.113764h-77.379283a31.113764 31.113764 0 0 1-31.032738-31.113764V850.767636a31.113764 31.113764 0 0 1 31.032738-31.113764h77.379283a31.113764 31.113764 0 0 1 31.032739 31.113764zM1108.613239 793.482659h-200.213831a32.410171 32.410171 0 0 0 0 64.820342h200.213831a32.410171 32.410171 0 0 0 0-64.820342zM1108.613239 917.613614h-200.213831a32.410171 32.410171 0 0 0 0 64.820342h200.213831a32.410171 32.410171 0 0 0 0-64.820342z" fill="#165dff"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
1
miniprogram/assets/icons/收支项目.svg
Normal file
1
miniprogram/assets/icons/收支项目.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M856.9 477.5H650c-57.2 0-103.5 46.3-103.5 103.5 0 57.1 46.3 103.5 103.5 103.5h206.9c57.2 0 103.5-46.3 103.5-103.5S914 477.5 856.9 477.5z m0 138H650c-19 0-34.5-15.5-34.5-34.5s15.5-34.5 34.5-34.5h206.9c19 0 34.5 15.5 34.5 34.5s-15.5 34.5-34.5 34.5z" fill="#165dff"></path><path d="M891.4 277v-40.9c0-57.1-46.3-103.5-103.5-103.5H167.1c-57.2 0-103.5 46.3-103.5 103.5v551.8c0 56.9 46.6 103.5 103.5 103.5h689.8c56.9 0 103.5-46.6 103.5-103.5v-34.5c0-19-15.4-34.5-34.5-34.5-19 0-34.5 15.4-34.5 34.5v34.5c0 19-15.5 34.5-34.5 34.5H167.1c-19 0-34.5-15.5-34.5-34.5V339.6h724.3c19 0 34.5 15.5 34.5 34.5v34.5c0 19 15.4 34.5 34.5 34.5 19 0 34.5-15.4 34.5-34.5V374c0-44.7-29-82.7-69-97z m-724.3-75.4h620.8c19 0 34.5 15.5 34.5 34.5v34.5H167.1c-19 0-34.5-15.5-34.5-34.5s15.5-34.5 34.5-34.5z" fill="#165dff"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
miniprogram/assets/icons/订单类型.svg
Normal file
1
miniprogram/assets/icons/订单类型.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M899.9 335.7L590.6 173.5c-21-10.1-52.4-15.2-78.6-15.2s-57.7 5.1-78.6 15.2L124 335.7c-41.9 25.3-41.9 60.8 0 81.1l183.5 96.3L124 609.5c-41.9 20.3-41.9 60.8 0 81.1l309.3 162.2c21 10.1 52.4 15.2 78.6 15.2s57.7-5.1 78.6-15.2l309.3-162.2c41.9-25.3 41.9-60.8 0-81.1l-183.5-96.3 183.5-96.3c42-20.3 42-60.9 0.1-81.2zM847 657.5L553.9 798.9s-13.6 6.4-34.1 6.4-34.1-6.4-34.1-6.4L206.2 657.5l197.7-102.8 20.5 12.8c27.3 12.8 61.4 19.3 102.3 19.3 34.1 0 75-6.4 102.3-19.3l20.5-12.8L847 657.5z m-292.3-141s-13.7 6.4-34.2 6.4c-20.5 0-34.2-6.4-34.2-6.4L206.2 375.2l280.1-141.3s13.7-6.4 34.2-6.4c20.5 0 34.2 6.4 34.2 6.4l280.1 141.3-280.1 141.3z" fill="#165dff"></path></svg>
|
||||
|
After Width: | Height: | Size: 944 B |
1
miniprogram/assets/icons/订单阶段.svg
Normal file
1
miniprogram/assets/icons/订单阶段.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M889.856 136.192H134.144c-58.368 0-105.472 47.104-105.472 105.472v540.672c0 58.368 47.104 105.472 105.472 105.472h755.712c58.368 0 105.472-47.104 105.472-105.472V241.664c1.024-58.368-47.104-105.472-105.472-105.472z m55.296 646.144c0 30.72-24.576 55.296-55.296 55.296H134.144c-30.72 0-55.296-24.576-55.296-55.296V241.664c0-30.72 24.576-55.296 55.296-55.296h755.712c30.72 0 55.296 24.576 55.296 55.296v540.672z" fill="#165dff"></path><path d="M572.416 439.296c10.24 28.672 37.888 47.104 67.584 47.104 39.936 0 71.68-32.768 71.68-71.68s-32.768-71.68-71.68-71.68c-29.696 0-57.344 19.456-67.584 47.104l-1.024 2.048H296.96l-1.024-3.072c-10.24-28.672-37.888-47.104-67.584-47.104-39.936 0-71.68 32.768-71.68 71.68s32.768 71.68 71.68 71.68c29.696 0 57.344-19.456 67.584-47.104l1.024-2.048h274.432l1.024 3.072z m67.584-53.248c15.36 0 27.648 12.288 27.648 27.648 0 15.36-12.288 27.648-27.648 27.648-15.36 0-27.648-12.288-27.648-27.648 0-15.36 12.288-27.648 27.648-27.648z m-411.648 56.32c-15.36 0-27.648-12.288-27.648-27.648 0-15.36 12.288-27.648 27.648-27.648 15.36 0 27.648 12.288 27.648 27.648 0 15.36-12.288 27.648-27.648 27.648zM795.648 537.6c-29.696 0-57.344 19.456-67.584 47.104l-1.024 2.048H451.584l-1.024-2.048c-10.24-28.672-37.888-47.104-67.584-47.104-39.936 0-71.68 32.768-71.68 71.68s32.768 71.68 71.68 71.68c29.696 0 57.344-19.456 67.584-47.104l1.024-2.048H727.04l1.024 2.048c10.24 28.672 37.888 47.104 67.584 47.104 39.936 0 71.68-32.768 71.68-71.68s-31.744-71.68-71.68-71.68z m-411.648 100.352c-15.36 0-27.648-12.288-27.648-27.648 0-15.36 12.288-27.648 27.648-27.648 15.36 0 27.648 12.288 27.648 27.648 0 15.36-12.288 27.648-27.648 27.648z m411.648 0c-15.36 0-27.648-12.288-27.648-27.648 0-15.36 12.288-27.648 27.648-27.648 15.36 0 27.648 12.288 27.648 27.648 0 15.36-12.288 27.648-27.648 27.648z" fill="#165dff"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -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;
|
||||
|
||||
@@ -14,11 +14,15 @@
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_ACCOUNT_ADD']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="-1">新增结算账户</t-button>
|
||||
</view>
|
||||
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
|
||||
</count-plugin>
|
||||
|
||||
<empty-plugin wx:if="{{list.length == 0}}" />
|
||||
<card-plugin wx:for="{{ list }}" wx:key="account_id">
|
||||
<card-plugin wx:for="{{ list }}" wx:key="account_id" showAll="1">
|
||||
<view slot="header"
|
||||
style="display: flex;justify-content: space-between;width: 100%;align-items: center;column-gap: 12rpx;">
|
||||
<view style="word-break: break-all;min-width: 0;">
|
||||
@@ -27,17 +31,20 @@
|
||||
<view
|
||||
style="display: flex;align-items: center;column-gap: 8rpx;font-weight: normal;flex-shrink: 0;">
|
||||
<t-icon wx:if="{{item.if_default == 2}}" name="star" color="#2ba471" />
|
||||
<text wx:if="{{item.state == 1}}" style="color: #0052d9;">正常</text>
|
||||
<text wx:if="{{item.state == 1}}" style="color: #0052d9;">启用</text>
|
||||
<text wx:elif="{{item.state == 2}}" style="color: #d54941;">禁用</text>
|
||||
</view>
|
||||
</view>
|
||||
<view slot="content">
|
||||
<card-item-plugin label="期初金额" value="{{item.init_amount}}" />
|
||||
<card-item-plugin label="当前金额" value="{{item.current_amount}}" />
|
||||
<card-item-plugin label="备注" value="{{item.comments}}" />
|
||||
<card-item-plugin wx:if="{{item.comments}}" label="备注" value="{{item.comments}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_ACCOUNT_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">
|
||||
编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_ACCOUNT_EDIT'] && item.if_default == 1}}" size="small"
|
||||
theme="primary" bind:tap="onDefault" data-index="{{index}}">
|
||||
设为默认</t-button>
|
||||
|
||||
9
miniprogram/pages/base/account/edit/edit.json
Normal file
9
miniprogram/pages/base/account/edit/edit.json
Normal file
@@ -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": "结算账户"
|
||||
}
|
||||
121
miniprogram/pages/base/account/edit/edit.ts
Normal file
121
miniprogram/pages/base/account/edit/edit.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
25
miniprogram/pages/base/account/edit/edit.wxml
Normal file
25
miniprogram/pages/base/account/edit/edit.wxml
Normal file
@@ -0,0 +1,25 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="账户名称" focus value="{{params.account_name}}" data-key="account_name"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label" class="required">账户名称</view>
|
||||
</t-input>
|
||||
<t-input placeholder="期初金额" focus value="{{params.init_amount}}" data-key="init_amount"
|
||||
bind:change="onChange" bind:blur="onBlur" align="right"
|
||||
style="padding-left: 0;padding-right: 0;" type="digit">
|
||||
<view slot="label">期初金额</view>
|
||||
</t-input>
|
||||
<!-- <t-cell title="是否默认" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="note">
|
||||
<t-checkbox icon="rectangle" checked="{{params.if_default==1}}" style="padding: 0;"
|
||||
bind:change="onCheckboxChange" data-key="if_default" />
|
||||
</view>
|
||||
</t-cell> -->
|
||||
<t-textarea placeholder="备注" bordered style="margin-top: 16rpx;" value="{{params.comments}}"
|
||||
data-key="comments" bind:change="onChange">
|
||||
<view slot="label" class="textarea-label">备注</view>
|
||||
</t-textarea>
|
||||
<view style="margin-top: 32rpx;display: flex;justify-content: center;">
|
||||
<t-button theme="primary" bind:tap="onSave">保存</t-button>
|
||||
</view>
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/account/edit/edit.wxss
Normal file
0
miniprogram/pages/base/account/edit/edit.wxss
Normal file
10
miniprogram/pages/base/item/edit/edit.json
Normal file
10
miniprogram/pages/base/item/edit/edit.json
Normal file
@@ -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": "收支项目"
|
||||
}
|
||||
113
miniprogram/pages/base/item/edit/edit.ts
Normal file
113
miniprogram/pages/base/item/edit/edit.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
24
miniprogram/pages/base/item/edit/edit.wxml
Normal file
24
miniprogram/pages/base/item/edit/edit.wxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="项目名称" focus value="{{params.item_name}}" data-key="item_name"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label" class="required">项目名称 </view>
|
||||
</t-input>
|
||||
<t-cell title="收支类型" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="note">
|
||||
<t-radio-group bind:change="onChange" data-key="item_type" borderless="1"
|
||||
value="{{params.item_type}}">
|
||||
<t-radio wx:for="{{FinanceItemTypeArr}}" wx:key="value" block="{{false}}"
|
||||
label="{{item.label}}" value="{{item.value}}"
|
||||
style="margin-right: {{index == FinanceItemTypeArr.length-1 ? 0: 16}}rpx;" />
|
||||
</t-radio-group>
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-textarea placeholder="备注" bordered style="margin-top: 16rpx;" value="{{params.comments}}"
|
||||
data-key="comments" bind:change="onChange">
|
||||
<view slot="label" class="textarea-label">备注</view>
|
||||
</t-textarea>
|
||||
<view style="margin-top: 32rpx;display: flex;justify-content: center;">
|
||||
<t-button theme="primary" bind:tap="onSave">保存</t-button>
|
||||
</view>
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/item/edit/edit.wxss
Normal file
0
miniprogram/pages/base/item/edit/edit.wxss
Normal file
15
miniprogram/pages/base/item/item.json
Normal file
15
miniprogram/pages/base/item/item.json
Normal file
@@ -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": "收支项目"
|
||||
}
|
||||
160
miniprogram/pages/base/item/item.ts
Normal file
160
miniprogram/pages/base/item/item.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
49
miniprogram/pages/base/item/item.wxml
Normal file
49
miniprogram/pages/base/item/item.wxml
Normal file
@@ -0,0 +1,49 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_FINANCE_ITEM_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<search-popup placeholder="输入名称" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.item_name}}" data-key="item_name">
|
||||
<view slot="content">
|
||||
<option-cell-plugin title="生产状态" value="{{params.item_type || ''}}" bind:change="searchChange"
|
||||
mode="radio" options="{{FinanceItemTypeArr}}" data-key="item_type" />
|
||||
<!-- <search-input label="手机号码" value="{{params.crm_phone}}" data-key="crm_phone"
|
||||
bind:change="searchChange" /> -->
|
||||
|
||||
<!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
|
||||
bind:confirm="searchChange" />
|
||||
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
|
||||
bind:confirm="searchChange" /> -->
|
||||
</view>
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_FINANCE_ITEM_ADD']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="-1">新增收支项目</t-button>
|
||||
</view>
|
||||
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
|
||||
</count-plugin>
|
||||
|
||||
<empty-plugin wx:if="{{list.length == 0}}" />
|
||||
<card-plugin wx:for="{{ list }}" wx:key="item_id" showAll="1">
|
||||
<view slot="header">
|
||||
{{ item.item_name }}
|
||||
<!-- <view style="font-weight: normal;flex-shrink: 0;">{{item.state == 1 ? '启用': '禁用'}}</view> -->
|
||||
</view>
|
||||
<view slot="content">
|
||||
<card-item-plugin label="类型" value="{{FinanceItemTypeObj[item.item_type]}}" />
|
||||
<card-item-plugin label="备注" wx:if="{{item.comments}}" value="{{item.comments}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_FINANCE_ITEM_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<!-- <t-button wx:if="{{authInfo['SF_FINANCE_ITEM_EDIT']}}" size="small"
|
||||
theme="{{item.state == 1 ? 'danger' : 'primary' }}" bind:tap="onOrderState"
|
||||
data-index="{{index}}">{{item.state == 1 ? '禁用' : '启用' }}</t-button> -->
|
||||
<t-button wx:if="{{authInfo['SF_FINANCE_ITEM_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
</card-plugin>
|
||||
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
|
||||
total="{{count}}" bind:change="paginationChange" />
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/item/item.wxss
Normal file
0
miniprogram/pages/base/item/item.wxss
Normal file
9
miniprogram/pages/base/orderCategory/edit/edit.json
Normal file
9
miniprogram/pages/base/orderCategory/edit/edit.json
Normal file
@@ -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": "订单类型"
|
||||
}
|
||||
110
miniprogram/pages/base/orderCategory/edit/edit.ts
Normal file
110
miniprogram/pages/base/orderCategory/edit/edit.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
20
miniprogram/pages/base/orderCategory/edit/edit.wxml
Normal file
20
miniprogram/pages/base/orderCategory/edit/edit.wxml
Normal file
@@ -0,0 +1,20 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="类型名称" focus value="{{params.order_cate_name}}" data-key="order_cate_name"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label" class="required">类型名称 </view>
|
||||
</t-input>
|
||||
<!-- <t-cell title="是否默认" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="note">
|
||||
<t-checkbox icon="rectangle" checked="{{params.if_default==1}}" style="padding: 0;"
|
||||
bind:change="onCheckboxChange" data-key="if_default" />
|
||||
</view>
|
||||
</t-cell> -->
|
||||
<t-textarea placeholder="备注" bordered style="margin-top: 16rpx;" value="{{params.comments}}"
|
||||
data-key="comments" bind:change="onChange">
|
||||
<view slot="label" class="textarea-label">备注</view>
|
||||
</t-textarea>
|
||||
<view style="margin-top: 32rpx;display: flex;justify-content: center;">
|
||||
<t-button theme="primary" bind:tap="onSave">保存</t-button>
|
||||
</view>
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/orderCategory/edit/edit.wxss
Normal file
0
miniprogram/pages/base/orderCategory/edit/edit.wxss
Normal file
15
miniprogram/pages/base/orderCategory/orderCategory.json
Normal file
15
miniprogram/pages/base/orderCategory/orderCategory.json
Normal file
@@ -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": "订单类型"
|
||||
}
|
||||
157
miniprogram/pages/base/orderCategory/orderCategory.ts
Normal file
157
miniprogram/pages/base/orderCategory/orderCategory.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
48
miniprogram/pages/base/orderCategory/orderCategory.wxml
Normal file
48
miniprogram/pages/base/orderCategory/orderCategory.wxml
Normal file
@@ -0,0 +1,48 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<search-popup placeholder="输入名称" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.order_cate_name}}" data-key="order_cate_name"
|
||||
hideMore="1">
|
||||
<view slot="content">
|
||||
<!-- <search-input label="手机号码" value="{{params.crm_phone}}" data-key="crm_phone"
|
||||
bind:change="searchChange" /> -->
|
||||
|
||||
<!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
|
||||
bind:confirm="searchChange" />
|
||||
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
|
||||
bind:confirm="searchChange" /> -->
|
||||
</view>
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_CATEGORY_ADD']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="-1">新增订单类型</t-button>
|
||||
</view>
|
||||
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
|
||||
</count-plugin>
|
||||
|
||||
<empty-plugin wx:if="{{list.length == 0}}" />
|
||||
<card-plugin wx:for="{{ list }}" wx:key="order_cate_id" showAll="1">
|
||||
<view slot="header" class="flex-b">
|
||||
<view>{{ item.order_cate_name }}</view>
|
||||
<view style="font-weight: normal;flex-shrink: 0;">{{item.state == 1 ? '启用': '禁用'}}</view>
|
||||
</view>
|
||||
<view slot="content">
|
||||
<!-- <card-item-plugin label="状态" value="{{item.state == 1 ? '启用': '禁用'}}" /> -->
|
||||
<card-item-plugin label="备注" wx:if="{{item.comments}}" value="{{item.comments}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_CATEGORY_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_CATEGORY_EDIT']}}" size="small"
|
||||
theme="{{item.state == 1 ? 'danger' : 'primary' }}" bind:tap="onOrderState"
|
||||
data-index="{{index}}">{{item.state == 1 ? '禁用' : '启用' }}</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_CATEGORY_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
</card-plugin>
|
||||
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
|
||||
total="{{count}}" bind:change="paginationChange" />
|
||||
</page-plugin>
|
||||
9
miniprogram/pages/base/orderStep/edit/edit.json
Normal file
9
miniprogram/pages/base/orderStep/edit/edit.json
Normal file
@@ -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": "订单阶段"
|
||||
}
|
||||
109
miniprogram/pages/base/orderStep/edit/edit.ts
Normal file
109
miniprogram/pages/base/orderStep/edit/edit.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
20
miniprogram/pages/base/orderStep/edit/edit.wxml
Normal file
20
miniprogram/pages/base/orderStep/edit/edit.wxml
Normal file
@@ -0,0 +1,20 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_STEP_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="阶段名称" focus value="{{params.order_step_name}}" data-key="order_step_name"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label" class="required"> 阶段名称 </view>
|
||||
</t-input>
|
||||
<t-cell title="是否默认" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="note">
|
||||
<t-checkbox icon="rectangle" checked="{{params.if_default==1}}" style="padding: 0;"
|
||||
bind:change="onCheckboxChange" data-key="if_default" />
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-textarea placeholder="备注" bordered style="margin-top: 16rpx;" value="{{params.comments}}"
|
||||
data-key="comments" bind:change="onChange">
|
||||
<view slot="label" class="textarea-label">备注</view>
|
||||
</t-textarea>
|
||||
<view style="margin-top: 32rpx;display: flex;justify-content: center;">
|
||||
<t-button theme="primary" bind:tap="onSave">保存</t-button>
|
||||
</view>
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/orderStep/edit/edit.wxss
Normal file
0
miniprogram/pages/base/orderStep/edit/edit.wxss
Normal file
15
miniprogram/pages/base/orderStep/orderStep.json
Normal file
15
miniprogram/pages/base/orderStep/orderStep.json
Normal file
@@ -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": "订单阶段"
|
||||
}
|
||||
158
miniprogram/pages/base/orderStep/orderStep.ts
Normal file
158
miniprogram/pages/base/orderStep/orderStep.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
49
miniprogram/pages/base/orderStep/orderStep.wxml
Normal file
49
miniprogram/pages/base/orderStep/orderStep.wxml
Normal file
@@ -0,0 +1,49 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_STEP_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<search-popup placeholder="输入阶段名称" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.order_step_name}}" data-key="order_step_name"
|
||||
hideMore="1">
|
||||
<view slot="content">
|
||||
<!-- <search-input label="手机号码" value="{{params.crm_phone}}" data-key="crm_phone"
|
||||
bind:change="searchChange" /> -->
|
||||
|
||||
<!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
|
||||
bind:confirm="searchChange" />
|
||||
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
|
||||
bind:confirm="searchChange" /> -->
|
||||
</view>
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_STEP_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="-1">新增订单阶段</t-button>
|
||||
</view>
|
||||
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
|
||||
</count-plugin>
|
||||
|
||||
<empty-plugin wx:if="{{list.length == 0}}" />
|
||||
<card-plugin wx:for="{{ list }}" wx:key="order_step_id" showAll="1">
|
||||
<view slot="header" class="flex-b">
|
||||
<view>{{ item.order_step_name }}</view>
|
||||
<view style="font-weight: normal;flex-shrink: 0;">{{item.state == 1 ? '启用': '禁用'}}</view>
|
||||
</view>
|
||||
<view slot="content">
|
||||
<card-item-plugin label="是否默认" value="{{item.if_default == 1 ? '是' : '否' }}" />
|
||||
<!-- <card-item-plugin label="状态" value="{{item.state == 1 ? '启用': '禁用'}}" /> -->
|
||||
<card-item-plugin label="备注" wx:if="{{item.comments}}" value="{{item.comments}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_STEP_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_STEP_EDIT']}}" size="small"
|
||||
theme="{{item.state == 1 ? 'danger' : 'primary' }}" bind:tap="onOrderState"
|
||||
data-index="{{index}}">{{item.state == 1 ? '禁用' : '启用' }}</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ORDER_STEP_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
</card-plugin>
|
||||
<!-- <pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
|
||||
total="{{count}}" bind:change="paginationChange" /> -->
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/orderStep/orderStep.wxss
Normal file
0
miniprogram/pages/base/orderStep/orderStep.wxss
Normal file
9
miniprogram/pages/base/productType/edit/edit.json
Normal file
9
miniprogram/pages/base/productType/edit/edit.json
Normal file
@@ -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": "产品类型"
|
||||
}
|
||||
109
miniprogram/pages/base/productType/edit/edit.ts
Normal file
109
miniprogram/pages/base/productType/edit/edit.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
21
miniprogram/pages/base/productType/edit/edit.wxml
Normal file
21
miniprogram/pages/base/productType/edit/edit.wxml
Normal file
@@ -0,0 +1,21 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="类型名称" focus value="{{params.product_type_name}}"
|
||||
data-key="product_type_name" bind:change="onChange" align="right"
|
||||
style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label" class="required">类型名称</view>
|
||||
</t-input>
|
||||
<!-- <t-cell title="是否默认" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="note">
|
||||
<t-checkbox icon="rectangle" checked="{{params.if_default==1}}" style="padding: 0;"
|
||||
bind:change="onCheckboxChange" data-key="if_default" />
|
||||
</view>
|
||||
</t-cell> -->
|
||||
<t-textarea placeholder="备注" bordered style="margin-top: 16rpx;" value="{{params.comments}}"
|
||||
data-key="comments" bind:change="onChange">
|
||||
<view slot="label" class="textarea-label">备注</view>
|
||||
</t-textarea>
|
||||
<view style="margin-top: 32rpx;display: flex;justify-content: center;">
|
||||
<t-button theme="primary" bind:tap="onSave">保存</t-button>
|
||||
</view>
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/productType/edit/edit.wxss
Normal file
0
miniprogram/pages/base/productType/edit/edit.wxss
Normal file
15
miniprogram/pages/base/productType/productType.json
Normal file
15
miniprogram/pages/base/productType/productType.json
Normal file
@@ -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": "产品类型"
|
||||
}
|
||||
160
miniprogram/pages/base/productType/productType.ts
Normal file
160
miniprogram/pages/base/productType/productType.ts
Normal file
@@ -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() {},
|
||||
});
|
||||
48
miniprogram/pages/base/productType/productType.wxml
Normal file
48
miniprogram/pages/base/productType/productType.wxml
Normal file
@@ -0,0 +1,48 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_PRODUCT_TYPE_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<search-popup placeholder="输入名称" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.product_type_name}}" data-key="product_type_name"
|
||||
hideMore="1">
|
||||
<view slot="content">
|
||||
<!-- <search-input label="手机号码" value="{{params.crm_phone}}" data-key="crm_phone"
|
||||
bind:change="searchChange" /> -->
|
||||
|
||||
<!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
|
||||
bind:confirm="searchChange" />
|
||||
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
|
||||
bind:confirm="searchChange" /> -->
|
||||
</view>
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_PRODUCT_TYPE_ADD']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="-1">新增产品类型</t-button>
|
||||
</view>
|
||||
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
|
||||
</count-plugin>
|
||||
|
||||
<empty-plugin wx:if="{{list.length == 0}}" />
|
||||
<card-plugin wx:for="{{ list }}" wx:key="product_type_id" showAll="1">
|
||||
<view slot="header" class="flex-b">
|
||||
<view>{{ item.product_type_name }}</view>
|
||||
<view style="font-weight: normal;flex-shrink: 0;">{{item.state == 1 ? '启用': '禁用'}}</view>
|
||||
</view>
|
||||
<view slot="content">
|
||||
<!-- <card-item-plugin label="状态" value="{{item.state == 1 ? '启用': '禁用'}}" /> -->
|
||||
<card-item-plugin label="备注" wx:if="{{item.comments}}" value="{{item.comments}}" />
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_PRODUCT_TYPE_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_PRODUCT_TYPE_EDIT']}}" size="small"
|
||||
theme="{{item.state == 1 ? 'danger' : 'primary' }}" bind:tap="onOrderState"
|
||||
data-index="{{index}}">{{item.state == 1 ? '禁用' : '启用' }}</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_PRODUCT_TYPE_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
</card-plugin>
|
||||
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
|
||||
total="{{count}}" bind:change="paginationChange" />
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/base/productType/productType.wxss
Normal file
0
miniprogram/pages/base/productType/productType.wxss
Normal file
@@ -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,
|
||||
|
||||
@@ -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: '支出' },
|
||||
];
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user