| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- <template>
- <view class="list-page-container">
- <erp-nav-bar title="全部订单" />
- <!-- 2. 分类切换:使用 scroll-view 滚动,彻底释放所有综合状态 -->
- <scroll-view scroll-x class="tabs-fixed" :show-scrollbar="false" :scroll-with-animation="true" :scroll-into-view="'tab-' + currentTab">
- <view class="tabs-box">
- <view v-for="(tab, index) in tabs" :key="index" :id="'tab-' + index" class="tab-item"
- :class="{ active: currentTab === index }" @click="switchTab(index)">
- <text class="tab-txt">{{ tab }}</text>
- </view>
- <!-- 指示器:只负责等宽位移,彻底消除虚影与错位 -->
- <view class="indicator-track">
- <view class="indicator-bar" :style="{ transform: 'translateX(' + (currentTab * 140) + 'rpx)' }">
- <view class="bar-inner"></view>
- </view>
- </view>
- </view>
- </scroll-view>
- <!-- 3. 固定高度的滚动区:强制启用滚动,解决不能滑动问题 -->
- <scroll-view scroll-y class="order-scroll-view" :style="{ height: scrollHeight }" @scrolltolower="onReachEnd"
- :refresher-enabled="false" :show-scrollbar="false">
- <view class="order-list-inner">
- <view class="order-card" v-for="(item, index) in displayList" :key="index" @click="goDetail(item)">
- <view class="card-head">
- <text class="order-id">单号:{{ item.orderNo }}</text>
- <view class="status-badge" :class="item.statusType">{{ item.statusName }}</view>
- </view>
- <view class="card-body">
- <view class="model-row" v-for="(model, mIdx) in item.models.slice(0, 2)" :key="mIdx">
- <text class="m-type">{{ model.type }}</text>
- <text class="m-spec">{{ model.surface }} | {{ model.length }}mm</text>
- <text class="m-count">{{ model.count }} 支</text>
- </view>
- <view class="more-hint" v-if="item.models.length > 2">
- <text>查看更多 {{ item.models.length - 2 }} 个型号...</text>
- </view>
- <view class="total-summary">
- <text class="summary-label">共计:</text>
- <text class="summary-val">{{ item.models.length }}</text>
- <text class="summary-unit">个型号</text>
- <view class="summary-split"></view>
- <text class="summary-val highlight">{{ item.totalCount }}</text>
- <text class="summary-unit">支</text>
- </view>
- </view>
- <view class="card-foot">
- <text class="time">{{ item.time }}</text>
- <view class="btns">
- <view class="btn-view primary" @click.stop="goDetail(item)">订单详情</view>
- </view>
- </view>
- </view>
- <!-- 加载提示区 -->
- <view class="list-status-info" v-if="displayList.length > 0">
- <view class="loading-wrap" v-if="loading">
- <view class="load-dot"></view><text>排队加载中...</text>
- </view>
- <view class="nomore-wrap" v-if="noMore">
- <text class="nomore-line"></text>
- <text class="nomore-text">已加载全部数据</text>
- <text class="nomore-line"></text>
- </view>
- </view>
- <!-- 缺省态 -->
- <view class="empty-state" v-if="displayList.length === 0 && !loading">
- <image src="https://img.icons8.com/clouds/200/open-box.png" mode="aspectFit"></image>
- <text>暂无订单记录</text>
- </view>
- <view class="safe-bottom"></view>
- </view>
- </scroll-view>
- <!-- 底部菜单栏 -->
- <!-- <erp-tab-bar active="order"></erp-tab-bar> -->
- </view>
- </template>
- <script>
- import ErpTabBar from '@/components/erp-tab-bar.vue';
- import ErpNavBar from '@/components/erp-nav-bar.vue';
- import { listMyOrder } from '@/api/erp/order.js';
- export default {
- components: { ErpTabBar, ErpNavBar },
- data() {
- return {
- statusBarHeight: 20,
- navBarHeight: 44,
- tabBarHeight: 50, // 对应 100rpx
- currentTab: 0,
- loading: false,
- noMore: false,
- pageNum: 1,
- tabs: ['全部', '待确认', '已确认', '已审核', '已签批', '挤压完成', '生产完成', '已取消'],
- allOrders: [],
- displayList: []
- }
- },
- computed: {
- scrollHeight() {
- // 减去状态栏、导航栏、选项卡的高度
- return `calc(100vh - ${this.statusBarHeight + this.navBarHeight + this.tabBarHeight}px)`;
- }
- },
- onLoad(options) {
- const winInfo = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync();
- this.statusBarHeight = winInfo.statusBarHeight;
- this.tabBarHeight = winInfo.windowWidth / 750 * 110;
- if (options.tab) this.currentTab = parseInt(options.tab);
- this.refresh();
- },
- methods: {
- goBack() { uni.navigateBack(); },
- switchTab(i) { this.currentTab = i; this.refresh(); },
- refresh() { this.displayList = []; this.noMore = false; this.pageNum = 1; this.loadData(); },
- onReachEnd() { if (!this.loading && !this.noMore) this.loadData(); },
- async loadData() {
- if (this.loading || this.noMore) return;
- this.loading = true;
- try {
- const params = {
- pageNum: this.pageNum,
- pageSize: 5
- };
- if (this.currentTab > 0) {
- // 对应 status:0-待确认 1-已确认 2-已审核 3-已签批 4-挤压完成 5-生产完成 6-已取消
- const indexToStatus = [undefined, 0, 1, 2, 3, 4, 5, 6];
- params.status = indexToStatus[this.currentTab];
- }
- const res = await listMyOrder(params);
- const rows = res.rows || [];
- const formattedRows = rows.map(item => {
- const statusMap = {
- 0: { name: '待确认', type: 'pending' },
- 1: { name: '已确认', type: 'finish' },
- 2: { name: '已审核', type: 'approved' },
- 3: { name: '已签批', type: 'reviewed' },
- 4: { name: '挤压完成', type: 'exFinished' },
- 5: { name: '生产完成', type: 'productionFinish' },
- 6: { name: '已取消', type: 'cancelled' }
- };
- const s = statusMap[item.status] || { name: '待确认', type: 'pending' };
- return {
- orderNo: item.code,
- rowId: item.rowId,
- status: item.status,
- statusName: s.name,
- statusType: s.type,
- time: item.createTime,
- totalCount: item.totalCount || 0,
- models: (item.details || []).map(d => ({
- type: d.modelNum || '未知型号',
- length: Number(d.length || 0).toFixed(4),
- surface: d.surfaceName || '无',
- count: d.count || 0
- }))
- };
- });
- this.displayList = [...this.displayList, ...formattedRows];
- this.pageNum++;
- this.noMore = rows.length === 0 || this.displayList.length >= (res.total || 0);
- } catch (e) {
- console.error('加载订单列表失败', e);
- uni.showToast({ title: e || '加载订单列表失败', icon: 'none' });
- } finally {
- this.loading = false;
- }
- },
- goDetail(item) {
- uni.navigateTo({
- url: `/pages/order/detail/index?rowId=${item.rowId}`
- });
- }
- }
- }
- </script>
- <style scoped>
- /deep/ ::-webkit-scrollbar {
- display: none !important;
- width: 0 !important;
- height: 0 !important;
- -webkit-appearance: none;
- background: transparent;
- }
- .list-page-container {
- width: 100vw;
- height: 100vh;
- background: #f8fafc;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- /* 2. 选项卡:彻底解决残影红框2并支持 8 档横向滚动 */
- .tabs-fixed {
- background: #fff;
- width: 100%;
- flex-shrink: 0;
- border-bottom: 1rpx solid #f0f0f0;
- white-space: nowrap;
- }
- .tabs-box {
- height: 110rpx;
- position: relative;
- display: inline-flex;
- }
- .tab-item {
- width: 140rpx;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- z-index: 5;
- }
- .tab-txt {
- font-size: 28rpx;
- color: #888;
- transition: all 0.2s;
- }
- .tab-item.active .tab-txt {
- color: #C1001C;
- font-weight: bold;
- font-size: 32rpx;
- }
- /* 指示器轨道:等比平移消除虚影 */
- .indicator-track {
- position: absolute;
- bottom: 10rpx;
- left: 0;
- width: 100%;
- height: 6rpx;
- pointer-events: none;
- }
- .indicator-bar {
- width: 140rpx;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
- }
- .bar-inner {
- width: 40rpx;
- height: 100%;
- background: #C1001C;
- border-radius: 6rpx;
- }
- /* 3. 滚动区:解决不可滑动问题 */
- .order-scroll-view {
- width: 100%;
- }
- .order-list-inner {
- padding: 30rpx;
- padding-bottom: 60rpx;
- }
- .order-card {
- background: #fff;
- border-radius: 24rpx;
- padding: 36rpx;
- margin-bottom: 30rpx;
- box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
- }
- .card-head {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 30rpx;
- }
- .order-id {
- font-size: 28rpx;
- color: #1a1a1a;
- font-weight: bold;
- }
- .status-badge {
- font-size: 20rpx;
- padding: 4rpx 16rpx;
- border-radius: 8rpx;
- }
- .status-badge.pending {
- background: #FFF7E6;
- color: #FF9900;
- }
- .status-badge.finish {
- background: #E6F7FF;
- color: #1890FF;
- }
- .status-badge.approved {
- background: #F6FFED;
- color: #52C41A;
- }
- .status-badge.reviewed {
- background: #F9F0FF;
- color: #722ED1;
- }
- .status-badge.exFinished {
- background: #E6FFF9;
- color: #13C2C2;
- }
- .status-badge.productionFinish {
- background: #EEF2FE;
- color: #2F54EB;
- }
- .status-badge.cancelled {
- background: #FFF1F0;
- color: #F5222D;
- }
- .card-body {
- padding: 24rpx 0;
- border-top: 1rpx dashed #f0f0f0;
- margin-bottom: 24rpx;
- }
- .model-row {
- display: flex;
- align-items: center;
- margin-bottom: 12rpx;
- font-size: 24rpx;
- }
- .m-type {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- width: 140rpx;
- }
- .m-spec {
- color: #888;
- flex: 1;
- padding: 0 20rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .m-count {
- color: #555;
- width: 100rpx;
- text-align: right;
- font-weight: 500;
- }
- .more-hint {
- padding: 10rpx 0;
- font-size: 24rpx;
- color: #999;
- text-align: center;
- background: #fafafa;
- border-radius: 8rpx;
- margin-bottom: 16rpx;
- }
- .total-summary {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding-top: 20rpx;
- border-top: 1rpx solid #fafafa;
- }
- .summary-label {
- font-size: 24rpx;
- color: #999;
- }
- .summary-val {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- margin: 0 4rpx;
- }
- .summary-val.highlight {
- color: #C1001C;
- }
- .summary-unit {
- font-size: 22rpx;
- color: #999;
- margin-right: 12rpx;
- }
- .summary-split {
- width: 1rpx;
- height: 20rpx;
- background: #eee;
- margin: 0 16rpx;
- }
- .card-foot {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding-top: 10rpx;
- }
- .time {
- font-size: 24rpx;
- color: #bbb;
- }
- .btns {
- display: flex;
- gap: 16rpx;
- }
- .btn-cancel,
- .btn-view {
- padding: 12rpx 30rpx;
- border-radius: 30rpx;
- font-size: 24rpx;
- }
- .btn-cancel {
- border: 1rpx solid #ddd;
- color: #666;
- }
- .btn-audit {
- border: 1rpx solid #ddd;
- color: #C1001C;
- padding: 12rpx 20rpx;
- border-radius: 30rpx;
- font-size: 24rpx;
- }
- .btn-view.primary {
- background: #C1001C;
- color: #fff;
- }
- .list-status-info {
- padding: 40rpx 0;
- display: flex;
- justify-content: center;
- }
- .nomore-wrap {
- display: flex;
- align-items: center;
- color: #ccc;
- font-size: 24rpx;
- }
- .nomore-line {
- width: 40rpx;
- height: 1rpx;
- background: #eee;
- margin: 0 20rpx;
- }
- .loading-wrap {
- color: #999;
- font-size: 24rpx;
- display: flex;
- align-items: center;
- }
- .load-dot {
- width: 10rpx;
- height: 10rpx;
- background: #C1001C;
- border-radius: 50%;
- margin-right: 10rpx;
- animation: flash 0.6s infinite alternate;
- }
- @keyframes flash {
- from {
- opacity: 0.3;
- }
- to {
- opacity: 1;
- }
- }
- .empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-top: 200rpx;
- color: #bbb;
- font-size: 28rpx;
- }
- .empty-state image {
- width: 220rpx;
- height: 220rpx;
- margin-bottom: 30rpx;
- opacity: 0.6;
- }
- .safe-bottom {
- height: 40rpx;
- }
- /* 审核记录弹窗 */
- .overlay {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.45);
- z-index: 1000;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .audit-history-modal {
- width: 640rpx;
- max-height: 70vh;
- background: #fff;
- border-radius: 24rpx;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- .modal-head {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 30rpx 36rpx;
- border-bottom: 1rpx solid #f0f0f0;
- flex-shrink: 0;
- }
- .modal-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #1a1a1a;
- }
- .modal-close {
- font-size: 26rpx;
- color: #999;
- padding: 8rpx;
- }
- .modal-body {
- flex: 1;
- padding: 20rpx 36rpx 36rpx;
- max-height: 60vh;
- }
- .audit-item {
- display: flex;
- padding: 24rpx 0;
- border-left: 2rpx solid #eee;
- margin-left: 12rpx;
- position: relative;
- }
- .audit-item:last-child {
- border-left-color: transparent;
- }
- .audit-dot {
- width: 16rpx;
- height: 16rpx;
- border-radius: 50%;
- position: absolute;
- left: -9rpx;
- top: 28rpx;
- }
- .audit-dot.pass {
- background: #52c41a;
- }
- .audit-dot.reject {
- background: #ff4d4f;
- }
- .audit-content {
- margin-left: 30rpx;
- flex: 1;
- }
- .audit-row {
- display: flex;
- align-items: center;
- gap: 16rpx;
- margin-bottom: 8rpx;
- }
- .audit-result {
- font-size: 26rpx;
- font-weight: bold;
- }
- .audit-result.pass {
- color: #52c41a;
- }
- .audit-result.reject {
- color: #ff4d4f;
- }
- .audit-auditor {
- font-size: 24rpx;
- color: #666;
- }
- .audit-reason {
- display: block;
- font-size: 24rpx;
- color: #ff4d4f;
- background: #fff1f0;
- padding: 12rpx 16rpx;
- border-radius: 8rpx;
- margin-bottom: 8rpx;
- line-height: 1.5;
- }
- .audit-time {
- display: block;
- font-size: 22rpx;
- color: #bbb;
- margin-top: 4rpx;
- }
- .audit-empty {
- text-align: center;
- padding: 60rpx 0;
- color: #bbb;
- font-size: 28rpx;
- }
- </style>
|