添加基础资料下的页面功能

This commit is contained in:
zhengw
2026-03-06 17:18:27 +08:00
parent 816188c2bb
commit aa1294f997
47 changed files with 1697 additions and 5 deletions

View File

@@ -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;

View File

@@ -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>

View 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": "结算账户"
}

View 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() {},
});

View 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>

View 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": "收支项目"
}

View 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() {},
});

View 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>

View 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": "收支项目"
}

View 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() {},
});

View 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>

View File

View 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": "订单类型"
}

View 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() {},
});

View 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>

View 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": "订单类型"
}

View 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() {},
});

View 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>

View 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": "订单阶段"
}

View 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() {},
});

View 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>

View 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": "订单阶段"
}

View 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() {},
});

View 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>

View 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": "产品类型"
}

View 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() {},
});

View 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>

View 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": "产品类型"
}

View 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() {},
});

View 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>

View 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,