纸板小程序:订单/送货单:列表与详情功能

This commit is contained in:
2026-06-11 11:26:40 +08:00
commit ef9ede1605
2317 changed files with 61642 additions and 0 deletions
@@ -0,0 +1,5 @@
{
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar"
}
}
@@ -0,0 +1,240 @@
.page-container {
width: 100vw;
height: 100vh;
box-sizing: border-box;
background: #ebebeb;
// background: linear-gradient( 135deg, #ca7d79 0%, #c5140a 30%, #c5140a 50%, #ca7d79 100%);
}
.sreach_module {
box-sizing: border-box;
padding: 20rpx;
background-color: #ffffff;
// border-radius: 15rpx;
// border-bottom: 1px solid #c5140a;
// padding: ;
.sreach_input_warp {
width: 100%;
.input_view {
width: 100%;
.t-input {
border: 1px solid #ffffff;
transition: all .5s;
}
}
.custon_status {
display: flex;
justify-content: space-between;
height: 60rpx;
overflow: hidden;
.custom_view {
color: #c5140a;
display: flex;
align-items: center;
margin-left: 20rpx;
// font-weight: bold;
.custom_name {
margin-left: 10rpx;
.t-dropdown-menu__title {
color: #c5140a !important;
}
}
}
.status_view {
display: flex;
align-items: center;
.status_name {
margin-left: 10rpx;
}
// font-weight: bold;
// color: #c5140a;
}
}
.date {
display: flex;
justify-content: space-between;
.date_item {
display: flex;
width: 48%;
.date_label {
min-width: 30%;
font-size: 26rpx;
display: flex;
align-items: center;
}
.date_input {
width: 100%;
overflow: hidden;
border-radius: 20rpx;
}
}
}
// .custom_view {
// width: 19%;
// }
// .status_view {
// width: 19%;
// }
}
}
.show_btn {
width: 120rpx;
font-size: 22rpx;
color: #ffffff;
background-color: #c5140a;
border-radius: 15rpx;
margin: 15rpx 0 0 20rpx;
height: 46rpx;
display: flex;
align-items: center;
justify-content: center;
transition: all .5s;
}
.show_btn_hide {
opacity: 0;
height: 0;
padding: 0;
margin: 0 0 0 20rpx;
overflow: hidden;
transition: all .5s;
}
.count {
width: 95%;
margin: 0 auto;
margin-top: 15rpx;
border-radius: 15rpx;
background-color: #ffffff;
// display: flex;
// justify-content: space-between;
text-align: center;
// padding: 10rpx 0;
height: 204rpx;
position: relative;
transition: all .5s;
.hide_btn {
position: absolute;
left: 0;
bottom: 0;
writing-mode: vertical-rl;
text-orientation: upright;
font-size: 22rpx;
padding: 8rpx 6rpx;
color: #ffffff;
background-color: #c5140a;
border-radius: 0 15rpx 0 15rpx;
}
.stock,.poduce {
width: 50%;
.title {
font-weight: bold;
font-size: 26rpx;
}
.value {
font-size: 28rpx;
color: #c5140a;
margin-top: 10rpx;
}
}
.value {
height: 38.4rpx;
}
}
.hide_count_view {
opacity: 0;
height: 0;
padding: 0;
margin: 0 0 0 20rpx;
overflow: hidden;
transition: all .5s;
}
.content_warp {
height: 100%;
// margin-top: 10rpx;
.data_list {
width: 100%;
// height: calc(100vh - 665rpx);
margin-top: 15rpx;
transition: all .5s;
// background-color: #c5140a;
.data_item {
width: 95%;
box-sizing: border-box;
margin: 0 auto;
margin-bottom: 15rpx;
border-radius: 15rpx;
background-color: #ffffff;
padding: 20rpx;
font-size: 26rpx;
position: relative;
.item_code {
display: flex;
justify-content: space-between;
font-size: 28rpx;
.code {
font-weight: bold;
}
.status {
font-size: 26rpx;
padding: 10rpx 25rpx;
border-radius: 0 15rpx 0 15rpx;
position: absolute;
right: 0;
top: 0;
// color: #c5130a20;
}
}
.item_material {
margin-top: 5rpx;
}
.item_details {
text {
padding-left: 20rpx;
}
}
.time {
text-align: right;
font-size: 28rpx;
font-weight: bold;
}
}
}
}
.input_view .t-icon-base {
color: #9da4b0;
transition: all .5s;
}
.t-input__wrap {
position: relative;
right: 2%;
}
.input_focus {
border: 1px solid #c5140a !important;
transition: all .5s !important;
.t-icon-base {
color: #c5140a !important;
transition: all .5s;
}
}
.t-dropdown-menu__item--active {
color: #c5140a !important;
}
.t-radio__icon--checked {
color: #c5140a !important;
}
.t-dropdown-menu::after {
background: #ffffff !important;
}
.not_data {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 150rpx;
.text {
color: #c5140a;
margin-top: 20rpx;
}
}
.custom_name_drop {
.t-icon-base {
display: none !important;
}
}
@@ -0,0 +1,279 @@
// utils/app.ts.ts
import { getMonthDay } from '../../utils/util'
import { getCardBoardOrderList } from '../../api/index'
import { getAppInstance } from '../../utils/app';
const app = getAppInstance();
// const userInfo = wx.getStorageSync('userInfo');
// const devicecode = wx.getStorageSync('devicecode');
Page({
/**
* 页面的初始数据
*/
data: {
date_field: '',
s_date: '',
e_date: '',
search_input_focus: false,
status: '全状态',
customerId: 0,
searchTxt: '',
statusOptions: [
{
label: '全状态',
value: '全状态'
},
{
label: '未复核',
value: '未复核'
},
{
label: '已复核',
value: '已复核'
},
{
label: '审核中',
value: '审核中'
},
{
label: '已终审',
value: '已终审'
},
{
label: '已排程',
value: '已排程'
},
{
label: '已生产',
value: '已生产'
},
{
label: '已入库',
value: '已入库'
},
{
label: '已发货',
value: '已发货'
},
{
label: '已作废',
value: '已作废'
},
],
statusColorMap: {
},
sDateVisible: false,
startDate: '',
list: [],
showCount: true,
totalData: {},
customerList: [],
pageNumber: 1, // 当前页码
pageSize: 20, // 每页数量
hasMore: true, // 是否还有更多数据
loading: false, // 是否正在加载(防止重复请求)
isCust: false //是否为客户账号,限制仅可查看本身的订单
},
hideCount() {
this.setData({
showCount: false
})
},
showCount() {
this.setData({
showCount: true
})
},
// 触底事件
onScrollToLower() {
// 防止重复加载 & 无更多数据
if (this.data.loading || !this.data.hasMore) return
this.setData({ loading: true,pageNumber: this.data.pageNumber + 1 })
wx.nextTick(() => {
this.getOrderList(true);
})
},
// 跳转订单详情
toOrderDetail(e) {
const id = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/pages/cardBoardOrderDetail/cardBoardOrderDetail?id=${id}`
})
},
// 日期相关
showPicker(e) {
const field = e.currentTarget.dataset.field;
this.setData({ sDateVisible: true, date_field: field });
},
onCancel() {
this.setData({ sDateVisible: false });
},
// 选择日期
onConfirm(e) {
const { value } = e.detail;
this.setData({ [this.data.date_field]: value,sDateVisible: false });
},
// 关键词搜索
handleSearchTxtChange(e) {
const { value } = e.detail;
this.setData({ searchTxt: value });
},
// 切换状态
onChange(e) {
this.setData({
status: e.detail.value,
});
this.getOrderList(false);
},
// 切换客户
onCustChange(e) {
this.setData({
customerId: e.detail.value,
});
this.getOrderList(false);
},
// 搜索输入框焦点事件
inputFocus() {
this.setData({
search_input_focus: true
})
},
inputBlur() {
this.setData({
search_input_focus: false
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
const days = getMonthDay();
const userInfo = wx.getStorageSync('userInfo');
this.setData({
s_date: days[0],
e_date: days[1],
customerId: userInfo.custid?userInfo.custid:0,
customerList: app.globalData.customerList,
date_field: 's_date',
isCust: userInfo.custid?true:false,
statusColorMap: app.globalData.statusColorMap
})
this.getOrderList(false);
},
async getOrderList(isLoadMore: Boolean) {
try {
wx.showLoading({ title: '加载中' });
const { searchTxt, pageNumber, pageSize, s_date, e_date, status, customerId }= this.data;
const filterStr = {};
if (s_date || e_date) {
filterStr.createtime = [(s_date?'#>=#' + s_date:''),(e_date?'#<=#' + e_date:'')]
}
if (customerId) {
filterStr.customerid = '#IN#' + customerId;
}
if (status && status != '全状态') {
filterStr.productionstatus = '#IN#' + status;
}
const params = {
pageNumber,
pageSize,
searchTxt,
screenStr: JSON.stringify(filterStr)
};
const res = await getCardBoardOrderList(params).catch( () => {});
console.log(res);
// const res = await new Promise((resolve, reject) => {
// wx.request({
// url: 'https://yueyingkeji.twaycloud.com/api/WxAppCardBoardOrder',
// method: 'GET',
// header: {
// Authorization: `${userInfo.id},${userInfo.accesstoken}`,
// devicecode: devicecode
// },
// data: ,
// success: resolve,
// fail: reject
// });
// });
if (res.statusCode === 200) {
const dataList = res.data.list.map( item => {
item.createtime = item.createtime.replace('T', ' ')
return item;
})
let totalData = res.data.totalData;
for (const key in totalData) {
const val = totalData[key];
// 是数字 且 不是整数(有小数点)
if (typeof val === 'number' && !Number.isInteger(val)) {
totalData[key] = val.toFixed(2); // 字符串类型,如 "3.14"
}
}
this.setData({
hasMore: this.data.list.length + this.data.pageSize >= res.data.searchListResourceParamaters.total?false:true,
loading: false,
list: isLoadMore == true?[...this.data.list,...dataList]: dataList,
totalData: res.data.totalData || {}
});
} else {
wx.showToast({ title: '数据加载失败', icon: 'none' });
}
} catch (err) {
wx.showToast({ title: '系统错误', icon: 'none' });
} finally {
wx.hideLoading();
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
@@ -0,0 +1,148 @@
<!--index.wxml-->
<navigation-bar title="纸板订单" back="{{false}}" color="white" background="#c5140a"></navigation-bar>
<view class="page-container">
<view class="sreach_module">
<view class="sreach_input_warp">
<view class="input_view">
<t-input
class="{{search_input_focus?'input_focus':''}}"
value="{{searchTxt}}"
placeholder-style="color: #9da4b0"
placeholder="纸质/切长/备注"
bind:change="handleSearchTxtChange"
cursor-spacing="30"
prefixIcon="search"
bind:focus="inputFocus"
bind:blur="inputBlur"
style="border-radius: 200rpx;height: 25rpx;background-color: #f9fafb;padding-right: 20rpx;border: 1px solid #ffffff;"
>
<t-button bind:tap="getOrderList" slot="extra" theme="danger" size="extra-small" style="background-color: #c5140a; border-radius: 200px;width: 120rpx;"> 搜索 </t-button>
</t-input>
</view>
<view class="custon_status">
<view class="custom_view">
<t-icon name="user-business-filled" size="40rpx" style="color: #c5140a; position: relative; left: 10rpx;"></t-icon>
<view class="custom_name">
<t-dropdown-menu class="{{isCust?'custom_name_drop':''}}">
<t-dropdown-item
options="{{customerList}}"
placement="right"
disabled="{{isCust}}"
value="{{customerId}}"
bindchange="onCustChange"
/>
</t-dropdown-menu>
</view>
</view>
<view class="status_view">
<t-dropdown-menu>
<t-dropdown-item options="{{statusOptions}}" placement="right" value="{{status}}" bindchange="onChange" />
</t-dropdown-menu>
</view>
</view>
<view class="date">
<view class="date_s date_item">
<view class="date_label">起始日期</view>
<view class="date_input">
<t-input
value="{{s_date}}"
data-field="s_date"
placeholder-style="color: #b7b7b7;font-size: 26rpx;"
placeholder="请选择日期"
cursor-spacing="30"
readonly="{{true}}"
bind:tap="showPicker"
style="border-radius: 20rpx;height: 20rpx;background-color: #f9fafb;padding: 20rpx 30rpx;"
/>
</view>
</view>
<view class="date_e date_item">
<view class="date_label">终止日期</view>
<view class="date_input">
<t-input
value="{{e_date}}"
data-field="e_date"
placeholder-style="color: #b7b7b7;font-size: 26rpx;"
placeholder="请选择日期"
cursor-spacing="30"
readonly="{{true}}"
bind:tap="showPicker"
style="border-radius: 20rpx;height: 20rpx;background-color: #f9fafb;padding: 20rpx 30rpx;"
/>
</view>
</view>
</view>
</view>
</view>
<view class="show_btn {{showCount?'show_btn_hide':''}}" bind:tap="showCount">显示统计</view>
<view class="count {{showCount?'':'hide_count_view'}}">
<view style="display: flex;justify-content: space-between;padding-top: 10rpx;">
<view class="stock">
<view class="title">总数量</view>
<view class="value">{{totalData.TotalNum}}</view>
</view>
<view class="stock">
<view class="title">未入库</view>
<view class="value">{{totalData.TotalUnNum}}</view>
</view>
<view class="stock">
<view class="title">已入库</view>
<view class="value">{{totalData.TotalInNum}}</view>
</view>
<view class="poduce">
<view class="title">已送货</view>
<view class="value">{{totalData.TotalDeliNum}}</view>
</view>
</view>
<view style="display: flex;justify-content: space-between; margin-top: 20rpx;">
<view class="stock">
<view class="title">总价格</view>
<view class="value">{{totalData.TotalMoney}}</view>
</view>
<view class="poduce">
<view class="title">总面积</view>
<view class="value">{{totalData.TotalSquaNum}}㎡/{{totalData.TotalCubicVolume}}m³</view>
</view>
</view>
<view class="hide_btn" bind:tap="hideCount">隐藏</view>
</view>
<view class="content_warp">
<scroll-view class="data_list" style="height: {{showCount?'calc(100vh - 670rpx);':'calc(100vh - 510rpx);'}}"
scroll-y="{{list.length != 0}}" bindscrolltolower="onScrollToLower" lower-threshold="100">
<view class="data_item" wx:for="{{list}}" wx:key="id" data-id="{{item.id}}" bind:tap="toOrderDetail">
<view class="item_code">
<view class="code">{{'订单编号:'+item.code}}</view>
<view class="status" style="color: {{statusColorMap[item.productionstatus]}}; background-color: {{statusColorMap[item.productionstatus] + '20'}}">{{item.productionstatus}}</view>
</view>
<view class="item_material">{{'纸质:' + item.paper + '('+ item.corrugatedtype +')'}}</view>
<view class="item_spec">{{'规格:' + item.wide + ' x ' + item.long +' = ' + item.totalnum + ' 片 ' + '平方数:' + item.squaNum + 'm³' }}</view>
<view class="item_line">{{'压线:' + '(' + (item.linetype?item.linetype:'开') + ')' + item.line}}</view>
<view class="item_details">
{{'明细:' + '未入库: ' + item.unnum}}
<text>{{'已入库: ' + item.innum}}</text>
<text>{{'已送货: ' + item.delinum}}</text>
</view>
<view class="remark">{{'备注:' + item.remark}}</view>
<view class="time">{{item.createtime}}</view>
</view>
<view class="not_data" wx:if="{{list.length == 0}}" >
<image src="../../assets/images/not_data.png" mode="widthFix" style="width: 400rpx"/>
<view class="text">暂无订单数据</view>
</view>
</scroll-view>
</view>
<view class="piker">
<t-date-time-picker
visible="{{sDateVisible}}"
title=""
value="{{date_field == 's_date'?s_date:e_date}}"
mode="date"
format="YYYY-MM-DD"
bindconfirm="onConfirm"
bindcancel="onCancel"
confirm-btn="确认"
cancel-btn="取消"
start="{{'1900-01-01'}}"
/>
</view>
</view>