添加页面及完善二级页面
This commit is contained in:
@@ -26,8 +26,11 @@
|
||||
"pages/finance/giro/giro",
|
||||
"pages/finance/giroDetail/giroDetail",
|
||||
"pages/finance/flow/flow",
|
||||
"pages/base/depot/depot",
|
||||
"pages/base/depot/edit/edit",
|
||||
"pages/base/supplier/supplier",
|
||||
"pages/base/customer/customer",
|
||||
"pages/base/customer/edit/edit",
|
||||
"pages/base/account/account",
|
||||
"pages/base/account/edit/edit",
|
||||
"pages/base/item/item",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { loginStatus } from './utils/https';
|
||||
import { updateVersion } from './utils/util';
|
||||
|
||||
// app.ts
|
||||
@@ -22,6 +23,7 @@ App<
|
||||
},
|
||||
onShow() {
|
||||
updateVersion();
|
||||
loginStatus();
|
||||
},
|
||||
// Storage: Storage, // 将 Storage 挂载到 App 实例上
|
||||
});
|
||||
|
||||
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="M585.817966 804.571429h365.714285v73.142857-219.428572 73.142857H585.817966v73.142858z m0 73.142857v73.142857h365.714285v-73.142857H585.817966z m365.714285-219.428572V585.142857H585.817966v73.142857h365.714285z m-73.142857-146.285714h109.714286a36.571429 36.571429 0 0 1 36.571429 36.571429v438.857142a36.571429 36.571429 0 0 1-36.571429 36.571429h-438.857143a36.571429 36.571429 0 0 1-36.571428-36.571429V950.857143H110.389394a36.571429 36.571429 0 0 1-36.571428-36.571429v-438.857143a36.571429 36.571429 0 0 1 73.142857 0V877.714286h365.714286V548.571429a36.571429 36.571429 0 0 1 36.571428-36.571429H805.246537v-36.571429a36.571429 36.571429 0 1 1 73.142857 0V512z m13.165715-81.627429L476.10368 84.187429 60.652251 430.372571a36.571429 36.571429 0 1 1-46.811428-56.173714l438.857143-365.714286a36.571429 36.571429 0 0 1 46.811428 0l438.857143 365.714286a36.571429 36.571429 0 0 1-46.811428 56.173714z" fill="#165dff"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -63,7 +63,7 @@ Page({
|
||||
},
|
||||
);
|
||||
} else {
|
||||
toastError('类型名称必填');
|
||||
toastError('账户名称必填');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<page-plugin isAuth="1" 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>
|
||||
@@ -15,8 +14,8 @@
|
||||
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">
|
||||
<t-textarea placeholder="备注" autosize maxlength="255" 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;">
|
||||
|
||||
@@ -74,7 +74,19 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
|
||||
wx.navigateTo({
|
||||
url: '/pages/base/customer/edit/edit',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('customerEdit', {
|
||||
data: index == -1 ? { crm_type: 1 } : this.data.list[index],
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
onOrderDel(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_CUSTOMER_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>
|
||||
|
||||
@@ -28,6 +32,8 @@
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_CUSTOMER_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_CUSTOMER_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
|
||||
10
miniprogram/pages/base/customer/edit/edit.json
Normal file
10
miniprogram/pages/base/customer/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": ""
|
||||
}
|
||||
123
miniprogram/pages/base/customer/edit/edit.ts
Normal file
123
miniprogram/pages/base/customer/edit/edit.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
getDataSet,
|
||||
sleep,
|
||||
toastError,
|
||||
toastSuccess,
|
||||
toObject,
|
||||
} from '@/utils/util';
|
||||
|
||||
const defaultParams = { comments: '', crm_name: '', crm_type: 1 };
|
||||
|
||||
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.crm_name) {
|
||||
if (this.data.params.crm_phone && this.data.params.crm_phone.length != 11) {
|
||||
toastError('手机号码需11位');
|
||||
return;
|
||||
}
|
||||
|
||||
post(this.data.mode == 'new' ? 'ErpCrm/add' : 'ErpCrm/edit', this.data.params).then(() => {
|
||||
toastSuccess('保存成功');
|
||||
sleep(() => {
|
||||
wx.navigateBack();
|
||||
}, 1000);
|
||||
});
|
||||
} else {
|
||||
toastError('项目名称必填');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {
|
||||
const eventChannel: any = this.getOpenerEventChannel();
|
||||
eventChannel?.on('customerEdit', (e: any) => {
|
||||
const data = toObject(e.data);
|
||||
|
||||
Object.keys(data).forEach((key) => {
|
||||
if (data[key] === null) {
|
||||
data[key] = '';
|
||||
}
|
||||
});
|
||||
|
||||
// console.log(data);
|
||||
wx.setNavigationBarTitle({
|
||||
title: data.crm_id
|
||||
? `${data.crm_name} 修改`
|
||||
: data.crm_type == 1
|
||||
? '新增经销商'
|
||||
: '新增供应商',
|
||||
});
|
||||
this.setData({ params: data, mode: data.crm_id ? 'edit' : 'new' });
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// onShareAppMessage() {},
|
||||
});
|
||||
38
miniprogram/pages/base/customer/edit/edit.wxml
Normal file
38
miniprogram/pages/base/customer/edit/edit.wxml
Normal file
@@ -0,0 +1,38 @@
|
||||
<page-plugin isAuth="1" loading="{{loading}}" is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="名称" focus value="{{params.crm_name}}" data-key="crm_name"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label" class="required">名称 </view>
|
||||
</t-input>
|
||||
<t-input placeholder="手机号码" value="{{params.crm_phone}}" data-key="crm_phone"
|
||||
bind:change="onChange" align="right" type="number" maxlength="11"
|
||||
style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label">手机号码</view>
|
||||
</t-input>
|
||||
<t-input placeholder="地址" value="{{params.crm_address}}" data-key="crm_address"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label">地址</view>
|
||||
</t-input>
|
||||
<t-input placeholder="开户行" value="{{params.bank_name}}" data-key="bank_name"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label">开户行</view>
|
||||
</t-input>
|
||||
<t-input placeholder="账号" value="{{params.bank_nums}}" data-key="bank_nums" bind:change="onChange"
|
||||
align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label">账号</view>
|
||||
</t-input>
|
||||
<t-input placeholder="纳税人识别号" value="{{params.tax_code}}" data-key="tax_code"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label">纳税人识别号</view>
|
||||
</t-input>
|
||||
<t-input placeholder="税率(%)" value="{{params.tax_rate}}" data-key="tax_rate"
|
||||
bind:change="onChange" align="right" style="padding-left: 0;padding-right: 0;">
|
||||
<view slot="label">税率(%)</view>
|
||||
</t-input>
|
||||
<t-textarea placeholder="备注" autosize maxlength="255" 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/customer/edit/edit.wxss
Normal file
0
miniprogram/pages/base/customer/edit/edit.wxss
Normal file
15
miniprogram/pages/base/depot/depot.json
Normal file
15
miniprogram/pages/base/depot/depot.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": "仓库信息"
|
||||
}
|
||||
159
miniprogram/pages/base/depot/depot.ts
Normal file
159
miniprogram/pages/base/depot/depot.ts
Normal file
@@ -0,0 +1,159 @@
|
||||
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('ErpDepot/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,
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
|
||||
wx.navigateTo({
|
||||
url: '/pages/base/depot/edit/edit',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('depotEdit', {
|
||||
data: index == -1 ? {} : this.data.list[index],
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
onOrderState(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
showModal({
|
||||
content: `确认${item.state == 1 ? '禁用' : '启用'} ${item.depot_name}?`,
|
||||
}).then(() => {
|
||||
post('ErpDepot/setState', { depot_id: item.depot_id }).then(() => {
|
||||
toastSuccess(`${item.state == 1 ? '禁用' : '启用'}成功`);
|
||||
sleep(() => {
|
||||
this.getList();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderDel(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
showModal({ content: `确认删除 ${item.depot_name}?` }).then(() => {
|
||||
post('ErpDepot/del', { depot_id: item.depot_id }).then(() => {
|
||||
toastSuccess('删除成功');
|
||||
sleep(() => {
|
||||
this.getList();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
});
|
||||
47
miniprogram/pages/base/depot/depot.wxml
Normal file
47
miniprogram/pages/base/depot/depot.wxml
Normal file
@@ -0,0 +1,47 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ERP_DEPOT_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
|
||||
bind:handleLogin="handleLogin">
|
||||
<search-popup placeholder="输入仓库名称" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.depot_name}}" data-key="depot_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_ERP_DEPOT_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="depot_id" showAll="1">
|
||||
<view slot="header" class="flex-b">
|
||||
<view>{{ item.depot_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="备注" 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_ERP_DEPOT_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_DEPOT_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_ERP_DEPOT_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/depot/depot.wxss
Normal file
0
miniprogram/pages/base/depot/depot.wxss
Normal file
9
miniprogram/pages/base/depot/edit/edit.json
Normal file
9
miniprogram/pages/base/depot/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/depot/edit/edit.ts
Normal file
109
miniprogram/pages/base/depot/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: '', depot_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.depot_name) {
|
||||
post(this.data.mode == 'new' ? 'ErpDepot/add' : 'ErpDepot/edit', this.data.params).then(
|
||||
() => {
|
||||
toastSuccess('保存成功');
|
||||
sleep(() => {
|
||||
wx.navigateBack();
|
||||
}, 1000);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
toastError('仓库名称必填');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {
|
||||
const eventChannel: any = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel?.on('depotEdit', (e: any) => {
|
||||
const data = toObject(e.data);
|
||||
wx.setNavigationBarTitle({
|
||||
title: data.depot_id ? `${data.depot_name} 修改` : '新增仓库配置',
|
||||
});
|
||||
this.setData({ params: data, mode: data.depot_id ? 'edit' : 'new' });
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
});
|
||||
19
miniprogram/pages/base/depot/edit/edit.wxml
Normal file
19
miniprogram/pages/base/depot/edit/edit.wxml
Normal file
@@ -0,0 +1,19 @@
|
||||
<page-plugin isAuth="1" loading="{{loading}}" is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<t-input placeholder="仓库名称" focus value="{{params.depot_name}}" data-key="depot_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="备注" autosize maxlength="255" 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/depot/edit/edit.wxss
Normal file
0
miniprogram/pages/base/depot/edit/edit.wxss
Normal file
@@ -1,5 +1,4 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<page-plugin isAuth="1" 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>
|
||||
@@ -14,8 +13,8 @@
|
||||
</t-radio-group>
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-textarea placeholder="备注" bordered style="margin-top: 16rpx;" value="{{params.comments}}"
|
||||
data-key="comments" bind:change="onChange">
|
||||
<t-textarea placeholder="备注" autosize maxlength="255" 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;">
|
||||
|
||||
@@ -106,5 +106,5 @@ Page({
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
// onShareAppMessage() {},
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<page-plugin isAuth="1" 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>
|
||||
@@ -10,8 +9,8 @@
|
||||
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">
|
||||
<t-textarea placeholder="备注" autosize maxlength="255" 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;">
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
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">
|
||||
<t-textarea placeholder="备注" autosize maxlength="255" 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;">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ORDER_CATEGORY_VIEW']}}" loading="{{loading}}"
|
||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||
<page-plugin isAuth="1" 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;">
|
||||
@@ -11,8 +10,8 @@
|
||||
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">
|
||||
<t-textarea placeholder="备注" autosize maxlength="255" 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;">
|
||||
|
||||
@@ -74,7 +74,19 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
onOrderEdit(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
|
||||
wx.navigateTo({
|
||||
url: '/pages/base/customer/edit/edit',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('customerEdit', {
|
||||
data: index == -1 ? { crm_type: 2 } : this.data.list[index],
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
onOrderDel(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
</search-popup>
|
||||
|
||||
<count-plugin count="{{count}}">
|
||||
<view slot="left">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SUPPLIER_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>
|
||||
|
||||
@@ -28,6 +32,8 @@
|
||||
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
|
||||
</view>
|
||||
<view slot="footer" class="card-plugin-footer">
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SUPPLIER_EDIT']}}" size="small" theme="primary"
|
||||
bind:tap="onOrderEdit" data-index="{{index}}">编辑</t-button>
|
||||
<t-button wx:if="{{authInfo['SF_ERP_SUPPLIER_DEL']}}" size="small" theme="danger"
|
||||
bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</view>
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
<view slot="note" style="color: #000;">{{params.bill_date || ''}}</view>
|
||||
</t-cell>
|
||||
|
||||
<t-textarea bindchange="onCommentInput" placeholder="备注" autosize="{{true}}" bordered="{{true}}">
|
||||
<view slot="label" style="font-size: initial;">备注</view>
|
||||
<t-textarea bindchange="onCommentInput" placeholder="备注" autosize maxlength="255" bordered
|
||||
style="margin-top: 16rpx;">
|
||||
<view slot="label" class="textarea-label">备注</view>
|
||||
</t-textarea>
|
||||
|
||||
<!-- <t-input label="备注" placeholder="备注" bindchange="onCommentInput" /> -->
|
||||
|
||||
@@ -3,7 +3,15 @@
|
||||
* YangXB 2021.11.24
|
||||
* */
|
||||
import { base, http } from './config';
|
||||
import { getStorage, goIndexPage, isArray, setStorage, toArray, toastError } from './util';
|
||||
import {
|
||||
getCurrentPage,
|
||||
getStorage,
|
||||
goIndexPage,
|
||||
isArray,
|
||||
setStorage,
|
||||
toArray,
|
||||
toastError,
|
||||
} from './util';
|
||||
/**
|
||||
* 请求
|
||||
*/
|
||||
@@ -50,10 +58,11 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
|
||||
});
|
||||
}
|
||||
if (request.data.err_code == 110000) {
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = getCurrentPage();
|
||||
console.log(currentPage);
|
||||
if (
|
||||
!['pages/index/index', 'pages/processEntry/processEntry', 'pages/my/my'].includes(
|
||||
pages[pages.length - 1].route,
|
||||
currentPage.route,
|
||||
)
|
||||
) {
|
||||
goIndexPage();
|
||||
@@ -182,7 +191,7 @@ export const loginStatusPage = (that: WechatMiniprogram.Page.Instance<any, any>)
|
||||
})
|
||||
.catch((err) => {
|
||||
that.setData({ isLogin: false, loading: false });
|
||||
reject();
|
||||
reject(err);
|
||||
console.log('调用登录状态请求失败', err);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -112,6 +112,7 @@ export const menuConfig = [
|
||||
icon: 'grid-view',
|
||||
iconColor: iconColor,
|
||||
children: [
|
||||
{ title: '仓库信息', url: '/pages/base/depot/depot', auth: 'SF_ERP_DEPOT_VIEW' },
|
||||
{ title: '供应商', url: '/pages/base/supplier/supplier', auth: 'SF_ERP_SUPPLIER_VIEW' },
|
||||
{ title: '经销商', url: '/pages/base/customer/customer', auth: 'SF_ERP_CUSTOMER_VIEW' },
|
||||
{ title: '结算账户', url: '/pages/base/account/account', auth: 'SF_ERP_ACCOUNT_VIEW' },
|
||||
|
||||
@@ -54,10 +54,13 @@ export const isObject = (data: any) => {
|
||||
|
||||
export const toObject = (data: any) => (isObject(data) ? data : {});
|
||||
|
||||
export const reloadPage = () => {
|
||||
export const getCurrentPage = () => {
|
||||
let pages = getCurrentPages(); //获取加载的页面
|
||||
let currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
||||
let url = currentPage.route; //当前页面url
|
||||
return pages[pages.length - 1];
|
||||
};
|
||||
|
||||
export const reloadPage = () => {
|
||||
let url = getCurrentPage().route; //当前页面url
|
||||
// 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
|
||||
wx.redirectTo({ url: '/' + url });
|
||||
};
|
||||
@@ -326,9 +329,7 @@ export const removeStorage = (key: string) => {
|
||||
* 获取当前页面路由
|
||||
*/
|
||||
export const getCurrentPageRoute = () => {
|
||||
const pages = getCurrentPages(); // 获取页面栈
|
||||
const currentPage = pages[pages.length - 1]; // 获取当前页面对象
|
||||
return `/${currentPage.route}`; // 获取当前页面路径
|
||||
return `/${getCurrentPage().route}`; // 获取当前页面路径
|
||||
};
|
||||
|
||||
/** 价格保留位数 */
|
||||
|
||||
Reference in New Issue
Block a user