精简搜索函数, 添加页面

This commit is contained in:
zhengw
2026-02-06 14:49:13 +08:00
parent 3513a19880
commit 9ce21008a3
64 changed files with 519 additions and 559 deletions

View File

@@ -0,0 +1,18 @@
{
"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",
"popup-plugin": "/pages/components/popup-plugin/popup-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
},
"navigationBarTitleText": "生产任务"
}

View File

@@ -0,0 +1,150 @@
import { loginStatus, post } from '@/utils/https';
import { SaleOrderProcessStateOption } from '@/utils/config';
import {
cloneLite,
getAuthInfo,
getDataSet,
searchValueFormat,
toArray,
toNumber,
} from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20, process_state: [200] };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
saleOrderProcessStateOption: SaleOrderProcessStateOption,
sort: [{ label: '创建日期', value: 'create_date' }],
detail: { show: false, title: '', data: [] as any[] },
},
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);
if (temp.process_state && temp.process_state.length) {
temp.process_state = temp.process_state.join(',');
} else {
delete temp.process_state;
}
post('ProduceOrder/getListV2', 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 });
});
},
onDetail(e: any) {
const data = getDataSet(e);
const index = data.index;
const index2 = data.index2;
const item = this.data.list[index];
const item2 = item?.produce_info[index2] || {};
// console.log(index, index2, item);
this.setData({
detail: {
show: true,
title: `${item2.goods_name} 流程配置`,
data: toArray(item2.produce_info_process),
},
});
},
onClose() {
this.data.detail.show = false;
this.setData({ detail: this.data.detail });
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(_options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setData({ loading: true });
loginStatus()
.then(() => {
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,76 @@
<page-plugin isAuth="{{authInfo['SF_ERP_PRODUCT_TASK_VIEW']}}" loading="{{loading}}"
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
<search-popup placeholder="输入销售单号" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.order_no}}" data-key="order_no">
<view slot="content">
<search-input label="自定义单号" value="{{params.custom_order_no}}" data-key="custom_order_no"
bind:change="searchChange" />
<search-input label="经销商名称" value="{{params.custom_name}}" data-key="custom_name"
bind:change="searchChange" />
<!-- <search-input label="经销商手机" value="{{params.custom_phone}}" data-key="custom_phone"
bind:change="searchChange" /> -->
<search-input label="客户名称" value="{{params.end_user_name}}" data-key="end_user_name"
bind:change="searchChange" />
<search-input label="客户手机" value="{{params.end_user_phone}}" data-key="end_user_phone"
bind:change="searchChange" />
<search-input label="客户地址" value="{{params.end_user_address}}" data-key="end_user_address"
bind:change="searchChange" />
<option-cell-plugin title="生产状态" value="{{params.process_state}}" bind:change="searchChange"
mode="checkbox" data-key="process_state" options="{{saleOrderProcessStateOption}}" />
<!-- <option-cell-plugin title="收款状态" value="{{params.payed_state || ''}}"
bind:change="searchChange" mode="radio" options="{{payedStateOption}}"
data-key="payed_state" /> -->
<!-- <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}}">
<!-- <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_no" wx:for-index="i">
<view slot="header">{{ item.order_no }}</view>
<view slot="content">
<card-item-plugin wx:if="{{item.custom_order_no}}" label="自定义单号"
value="{{item.custom_order_no}}" />
<card-item-plugin wx:if="{{item.custom_name}}" label="经销商名称" value="{{item.custom_name}}" />
<card-item-plugin wx:if="{{item.custom_phone}}" label="经销商手机" value="{{item.custom_phone}}" />
<card-item-plugin wx:if="{{item.end_user_name}}" label="客户名称"
value="{{item.end_user_name}}" />
<card-item-plugin wx:if="{{item.end_user_phone}}" label="客户手机"
value="{{item.end_user_phone}}" />
<card-item-plugin wx:if="{{item.end_user_address}}" label="客户地址"
value="{{item.end_user_address}}" />
</view>
<view wx:if="{{item.produce_info.length}}" slot="footer" class="card-plugin-footer"
style="flex-direction: column;">
<t-cell-group title="产品名称">
<block wx:for="{{item.produce_info}}" wx:key="index" wx:for-item="produce">
<t-cell title="{{produce.goods_name}}" bind:tap="onDetail" data-index="{{i}}"
data-index2="{{index}}" hover arrow />
</block>
</t-cell-group>
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>
<popup-plugin visible="{{ detail.show }}" bind:close="onClose" title="{{detail.title}}">
<view style="padding: 24rpx;">
<card-plugin wx:for="{{ detail.data }}" wx:key="p_process_id" showAll="1">
<view slot="header">{{ item.p_process_name }}</view>
<view slot="content">
<card-item-plugin wx:for="{{ item.children }}" wx:key="process_id"
label="{{item.c_process_name}}" value="{{item.bonus_nums}}"
customStyle="color: {{item.state == 2 ? '#2ba471': ''}};" />
</view>
</card-plugin>
</view>
</popup-plugin>

View File

@@ -1,5 +1,6 @@
{
"usingComponents": { },
"navigationBarTitleText": "流程管理"
"navigationBarTitleText": "流程管理",
"enablePullDownRefresh": true
}

View File

@@ -8,6 +8,7 @@ Page({
data: {
process: [] as any[],
isFirstEnter: true,
isLogin: false,
},
navDetail(e: any) {
const index = getDataSet(e).index.split(',');
@@ -31,9 +32,13 @@ Page({
this.getList();
},
getList() {
post('CompanyProcessV2/getAllProcessNum').then((res: any) => {
this.setData({ process: toArray(res.data) });
});
post('CompanyProcessV2/getAllProcessNum')
.then((res: any) => {
this.setData({ process: toArray(res.data) });
})
.finally(() => {
wx.stopPullDownRefresh();
});
},
/**
* 生命周期函数--监听页面加载
@@ -78,7 +83,11 @@ Page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
onPullDownRefresh() {
if (this.data.isLogin) {
this.getList();
}
},
/**
* 页面上拉触底事件的处理函数

View File

@@ -1,5 +1,13 @@
import { loginStatus, post } from '@/utils/https';
import { cloneLite, getAuthInfo, getDataSet, toArray, toastSuccess, toNumber } from '@/utils/util';
import {
cloneLite,
getAuthInfo,
getDataSet,
searchValueFormat,
toArray,
toastSuccess,
toNumber,
} from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20, state: '1', process_id: '' };
@@ -30,12 +38,7 @@ Page({
},
searchChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchChange2(e: any) {
const key = getDataSet(e).key;
const val = `${e.detail.value || ''}`.trim();
const val = searchValueFormat(e.detail.value);
if (val) {
this.data.params[key] = val;
} else {

View File

@@ -4,19 +4,19 @@
bind:change="searchChange" bind:ok="searchOk" bind:reset="searchReset">
<view slot="content">
<search-input label="自定义单号" value="{{params.custom_order_no}}" data-key="custom_order_no"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="经销商名称" value="{{params.custom_name}}" data-key="custom_name"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="经销商手机" value="{{params.custom_phone}}" data-key="custom_phone"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="经销商地址" value="{{params.custom_address}}" data-key="custom_address"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="客户名称" value="{{params.end_user_name}}" data-key="end_user_name"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="客户手机" value="{{params.end_user_phone}}" data-key="end_user_phone"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="客户地址" value="{{params.end_user_address}}" data-key="end_user_address"
bind:change="searchChange2" />
bind:change="searchChange" />
</view>
</search-popup>
<view class="tabs">