feat(storefabric): 新增坯布出库相关页面及功能
- 在 manifest.json 中添加 Android 包名配置 - 在 package.json 中添加 pnpm 依赖覆盖配置 - 在 pages.json 中注册坯布出库相关页面路由 - 重命名 storefabricBusinessOutAdd.vue 为 storeFabricBusinessOutAdd.vue - 重构坯布出库新增页面,优化界面布局和交互逻辑 - 添加坯布出库列表、编辑、查看等功能页面 - 集成订单状态栏、面料信息弹窗、细码弹窗等组件 - 实现坯布出库详情列表和扫码功能模块 - 优化表单验证和数据提交流程
This commit is contained in:
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
|
||||
<view class="fabric-out-page">
|
||||
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||
|
||||
|
||||
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
||||
|
||||
<text class="mr26">出仓单号</text>
|
||||
|
||||
<u-input disabled placeholder="保存后自动生成" v-model="form.order_no" />
|
||||
|
||||
</view>
|
||||
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
|
||||
<text class="mr26">出仓类型</text>
|
||||
|
||||
<view>{{ getBillTypeName() }}</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view @click="pickerSelectFun('接收单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
|
||||
<text class="mr26">接收单位<text class="redXingh">*</text></text>
|
||||
|
||||
<view :class="form.business_unit_name ? '' : 'cBlack'">
|
||||
|
||||
{{ form.business_unit_name || '请选择' }}
|
||||
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
|
||||
<text class="mr26">{{ dateLabel }}<text class="redXingh">*</text></text>
|
||||
|
||||
<picker mode="date" :value="form.delivery_time" :disabled="!headerEditable" @change="bindDateChange">
|
||||
|
||||
<view>{{ form.delivery_time }}</view>
|
||||
|
||||
</picker>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="flex-white-plr26-column ptb20 mt32">
|
||||
|
||||
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||
|
||||
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<FabricOutDetailList
|
||||
|
||||
:list="form.item_data"
|
||||
|
||||
@fabric-info="openFabricInfo"
|
||||
|
||||
@fine-code="openFineCode"
|
||||
|
||||
>
|
||||
|
||||
<FabricOutScanBar
|
||||
|
||||
slot="before-list"
|
||||
|
||||
:can-scan="canScan"
|
||||
|
||||
:value="QRBarCode"
|
||||
|
||||
:delete-mode="BarCodeDelStatus"
|
||||
|
||||
:message="BillDataMessage"
|
||||
|
||||
disabled-tip="请先提交保存后再扫码"
|
||||
|
||||
@input="QRBarCode = $event"
|
||||
|
||||
@scan="handleScan"
|
||||
|
||||
@delete-mode-change="BarCodeDelChange"
|
||||
|
||||
/>
|
||||
|
||||
<FabricOutScanDetail
|
||||
slot="before-list"
|
||||
:detail="scanDetail"
|
||||
:item-data="form.item_data"
|
||||
:group-keys="scanGroupKeys"
|
||||
@group-change="scanGroupKeys = $event"
|
||||
/>
|
||||
|
||||
</FabricOutDetailList>
|
||||
|
||||
|
||||
|
||||
<FabricOutFooter
|
||||
|
||||
v-if="!headerSaved"
|
||||
|
||||
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||
|
||||
single
|
||||
|
||||
@action="submitSave"
|
||||
|
||||
/>
|
||||
|
||||
<FabricOutFooter
|
||||
|
||||
v-else
|
||||
|
||||
:buttons="statusActionButtons"
|
||||
|
||||
@action="handleStatusAction"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
|
||||
|
||||
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
||||
|
||||
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="false" @delete="onDeleteFineCode" />
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
import formMixin from './storeFabricBusinessOutMixin.js';
|
||||
|
||||
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
||||
|
||||
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
||||
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
|
||||
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
||||
|
||||
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||
|
||||
import FabricOutScanDetail from '@/components/storefabric/FabricOutScanDetail.vue';
|
||||
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
|
||||
FabricInfoPopup,
|
||||
|
||||
FineCodePopup,
|
||||
|
||||
OrderStatusBar,
|
||||
|
||||
FabricOutDetailList,
|
||||
|
||||
FabricOutScanBar,
|
||||
|
||||
FabricOutScanDetail,
|
||||
|
||||
FabricOutFooter,
|
||||
|
||||
},
|
||||
|
||||
mixins: [formMixin],
|
||||
|
||||
onLoad() {
|
||||
|
||||
uni.setNavigationBarTitle({ title: '新增坯布出仓单' });
|
||||
|
||||
this.pageMode = 'add';
|
||||
|
||||
this.loadBaseDropdowns();
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
||||
<text class="mr26">出仓单号</text>
|
||||
<text>{{ form.order_no }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">出仓类型</text>
|
||||
<text>{{ getBillTypeName() }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">接收单位</text>
|
||||
<text>{{ form.business_unit_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">{{ dateLabel }}</text>
|
||||
<text>{{ form.delivery_time }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">单据备注</text>
|
||||
<text>{{ form.remark || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<FabricOutDetailList
|
||||
:list="form.item_data"
|
||||
@fabric-info="openFabricInfo"
|
||||
@fine-code="openFineCode"
|
||||
>
|
||||
<FabricOutScanBar
|
||||
slot="before-list"
|
||||
:can-scan="canScan"
|
||||
:value="QRBarCode"
|
||||
:delete-mode="BarCodeDelStatus"
|
||||
:message="BillDataMessage"
|
||||
@input="QRBarCode = $event"
|
||||
@scan="handleScan"
|
||||
@delete-mode-change="BarCodeDelChange"
|
||||
/>
|
||||
<FabricOutScanDetail
|
||||
slot="before-list"
|
||||
:detail="scanDetail"
|
||||
:item-data="form.item_data"
|
||||
:group-keys="scanGroupKeys"
|
||||
@group-change="scanGroupKeys = $event"
|
||||
/>
|
||||
</FabricOutDetailList>
|
||||
|
||||
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||
|
||||
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
|
||||
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
||||
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="false" @delete="onDeleteFineCode" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import formMixin from './storeFabricBusinessOutMixin.js';
|
||||
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
||||
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
||||
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||
import FabricOutScanDetail from '@/components/storefabric/FabricOutScanDetail.vue';
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FabricInfoPopup,
|
||||
FineCodePopup,
|
||||
OrderStatusBar,
|
||||
FabricOutDetailList,
|
||||
FabricOutScanBar,
|
||||
FabricOutScanDetail,
|
||||
FabricOutFooter,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
onLoad(e) {
|
||||
uni.setNavigationBarTitle({ title: '编辑坯布出仓单' });
|
||||
this.pageMode = 'edit';
|
||||
if (e.id) {
|
||||
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="filterBar">
|
||||
<u-search v-model="filters.order_no" placeholder="出仓单号" :show-action="false" @search="loadList" @custom="loadList" />
|
||||
<view class="filterBtn" @click="filterShow = true">
|
||||
<u-icon name="list" size="40" color="#666"></u-icon>
|
||||
<text>筛选</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y :style="{ height: scrollHeight }" refresher-enabled
|
||||
:refresher-triggered="triggered" @refresherrefresh="onRefresh">
|
||||
<dataNull v-if="list.length === 0" src="/src/static/img/chahua/gjNull.png"
|
||||
title="暂无坯布出仓单" title1="请点击右下角按钮新增">
|
||||
</dataNull>
|
||||
<view v-for="(item, index) in list" :key="item.id" @click="goView(item)">
|
||||
<FabricOutItem :item="item" :index="index" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<addBtn url="./storeFabricBusinessOutAdd"></addBtn>
|
||||
|
||||
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true">
|
||||
<view class="filterPanel">
|
||||
<view class="filterTitle">筛选条件</view>
|
||||
<view class="filterItem">
|
||||
<text class="filterLabel">出仓单号</text>
|
||||
<u-input v-model="filters.order_no" placeholder="请输入出仓单号" />
|
||||
</view>
|
||||
<view class="filterItem">
|
||||
<text class="filterLabel">出仓日期</text>
|
||||
<view class="dateRow">
|
||||
<picker mode="date" :value="filters.start_date" @change="e => filters.start_date = e.detail.value">
|
||||
<view class="dateInput">{{ filters.start_date || '开始日期' }}</view>
|
||||
</picker>
|
||||
<text>~</text>
|
||||
<picker mode="date" :value="filters.end_date" @change="e => filters.end_date = e.detail.value">
|
||||
<view class="dateInput">{{ filters.end_date || '结束日期' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openDeliveryUnitSelect">
|
||||
<text class="filterLabel">出仓单位</text>
|
||||
<view class="filterValue">{{ deliveryUnitLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openBusinessUnitSelect">
|
||||
<text class="filterLabel">接收单位</text>
|
||||
<view class="filterValue">{{ businessUnitLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openStatusSelect">
|
||||
<text class="filterLabel">订单状态</text>
|
||||
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterActions">
|
||||
<u-button type="warning" size="medium" @click="resetFilter">重置</u-button>
|
||||
<u-button type="primary" size="medium" @click="applyFilter">确定</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<u-select v-model="statusSelectShow" :list="statusSelectList" @confirm="onStatusConfirm"></u-select>
|
||||
<u-select v-model="unitSelectShow" :list="unitSelectList" @confirm="onUnitConfirm"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||
import FabricOutItem from '@/components/card/storeFabricBusinessOutItem.vue';
|
||||
import {
|
||||
getStatusOptions,
|
||||
AUDIT_STATUS_MAP,
|
||||
BILL_TYPES,
|
||||
formatRoll,
|
||||
mapToSelectOptions,
|
||||
fetchAllOrderList,
|
||||
} from '@/common/storeFabricBusinessOut';
|
||||
|
||||
export default {
|
||||
components: { addBtn, FabricOutItem },
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
scrollHeight: '667px',
|
||||
triggered: false,
|
||||
filterShow: false,
|
||||
statusSelectShow: false,
|
||||
unitSelectShow: false,
|
||||
unitSelectType: '',
|
||||
unitOptions: [],
|
||||
unitOptionsLoading: false,
|
||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||
filters: {
|
||||
order_no: '',
|
||||
start_date: '',
|
||||
end_date: '',
|
||||
delivery_unit_id: '',
|
||||
delivery_unit_name: '',
|
||||
business_unit_id: '',
|
||||
business_unit_name: '',
|
||||
audit_status: '',
|
||||
},
|
||||
statusSelectList: [
|
||||
{ value: '', label: '全部' },
|
||||
...getStatusOptions(),
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
statusLabel() {
|
||||
if (this.filters.audit_status === '' || this.filters.audit_status === null) return '';
|
||||
return AUDIT_STATUS_MAP[Number(this.filters.audit_status)] || '';
|
||||
},
|
||||
deliveryUnitLabel() {
|
||||
return this.filters.delivery_unit_name || '';
|
||||
},
|
||||
businessUnitLabel() {
|
||||
return this.filters.business_unit_name || '';
|
||||
},
|
||||
unitSelectList() {
|
||||
return [{ value: '', label: '全部' }, ...this.unitOptions];
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '坯布出库列表' });
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||
},
|
||||
});
|
||||
this.loadUnitOptions();
|
||||
this.loadList();
|
||||
},
|
||||
onShow() {
|
||||
this.loadList();
|
||||
},
|
||||
methods: {
|
||||
loadUnitOptions() {
|
||||
if (this.unitOptions.length || this.unitOptionsLoading) return Promise.resolve(this.unitOptions);
|
||||
this.unitOptionsLoading = true;
|
||||
return this.$u.api.businessUnit.list({})
|
||||
.then((res) => {
|
||||
this.unitOptions = mapToSelectOptions(res);
|
||||
return this.unitOptions;
|
||||
})
|
||||
.catch(() => {
|
||||
this.unitOptions = [];
|
||||
return this.unitOptions;
|
||||
})
|
||||
.finally(() => {
|
||||
this.unitOptionsLoading = false;
|
||||
});
|
||||
},
|
||||
openUnitSelect(type) {
|
||||
this.loadUnitOptions().then((list) => {
|
||||
if (!list.length) {
|
||||
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.unitSelectType = type;
|
||||
this.unitSelectShow = true;
|
||||
});
|
||||
},
|
||||
openDeliveryUnitSelect() {
|
||||
this.openUnitSelect('delivery');
|
||||
},
|
||||
openBusinessUnitSelect() {
|
||||
this.openUnitSelect('business');
|
||||
},
|
||||
onUnitConfirm(e) {
|
||||
const item = e[0] || {};
|
||||
if (this.unitSelectType === 'delivery') {
|
||||
this.filters.delivery_unit_id = item.value;
|
||||
this.filters.delivery_unit_name = item.value ? item.label : '';
|
||||
} else {
|
||||
this.filters.business_unit_id = item.value;
|
||||
this.filters.business_unit_name = item.value ? item.label : '';
|
||||
}
|
||||
},
|
||||
loadList() {
|
||||
const params = {};
|
||||
if (this.filters.order_no) params.order_no = this.filters.order_no;
|
||||
if (this.filters.audit_status !== '' && this.filters.audit_status !== null) {
|
||||
params.audit_status = this.filters.audit_status;
|
||||
}
|
||||
fetchAllOrderList((p) => this.$u.api.gfmOtherDeliveryOrder.list(p), params)
|
||||
.then((rows) => {
|
||||
this.triggered = false;
|
||||
this.list = rows.map(this.mapToCard).filter(this.matchClientFilter);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.triggered = false;
|
||||
this.list = [];
|
||||
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
|
||||
});
|
||||
},
|
||||
mapToCard(order) {
|
||||
return {
|
||||
id: order.id,
|
||||
order_no: order.order_no || '',
|
||||
out_date: (order.delivery_time || '').slice(0, 10),
|
||||
bill_type_name: this.billTypeName,
|
||||
delivery_unit_id: order.delivery_unit_id || '',
|
||||
delivery_unit_name: order.delivery_unit_name || '',
|
||||
business_unit_id: order.business_unit_id || '',
|
||||
business_unit_name: order.business_unit_name || '',
|
||||
create_user_name: order.creator_name || '',
|
||||
create_time: order.create_time || '',
|
||||
auditor_name: order.auditer_name || '',
|
||||
audit_date: order.audit_time || '',
|
||||
audit_status: order.audit_status,
|
||||
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||
total_roll: formatRoll(order.total_roll),
|
||||
};
|
||||
},
|
||||
// 后端列表仅支持 单号/状态 过滤,出仓日期与单位在前端做本地过滤
|
||||
matchClientFilter(item) {
|
||||
if (this.filters.start_date && item.out_date < this.filters.start_date) return false;
|
||||
if (this.filters.end_date && item.out_date > this.filters.end_date) return false;
|
||||
if (this.filters.delivery_unit_id && String(item.delivery_unit_id) !== String(this.filters.delivery_unit_id)) {
|
||||
return false;
|
||||
}
|
||||
if (this.filters.business_unit_id && String(item.business_unit_id) !== String(this.filters.business_unit_id)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
onRefresh() {
|
||||
this.triggered = true;
|
||||
this.loadList();
|
||||
},
|
||||
goView(item) {
|
||||
uni.navigateTo({ url: `./storeFabricBusinessOutView?id=${item.id}` });
|
||||
},
|
||||
openStatusSelect() { this.statusSelectShow = true; },
|
||||
onStatusConfirm(e) { this.filters.audit_status = e[0].value; },
|
||||
resetFilter() {
|
||||
this.filters = {
|
||||
order_no: '',
|
||||
start_date: '',
|
||||
end_date: '',
|
||||
delivery_unit_id: '',
|
||||
delivery_unit_name: '',
|
||||
business_unit_id: '',
|
||||
business_unit_name: '',
|
||||
audit_status: '',
|
||||
};
|
||||
},
|
||||
applyFilter() {
|
||||
this.filterShow = false;
|
||||
this.loadList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page { background-color: #F8F8F8; }
|
||||
.filterBar { display: flex; align-items: center; padding: 16rpx 20rpx; background: #fff; gap: 16rpx; }
|
||||
.filterBtn { display: flex; flex-direction: column; align-items: center; font-size: 22rpx; color: #666; min-width: 80rpx; }
|
||||
.filterPanel { padding: 30rpx; }
|
||||
.filterTitle { font-size: 32rpx; font-weight: bold; margin-bottom: 30rpx; }
|
||||
.filterItem { margin-bottom: 24rpx; }
|
||||
.filterLabel { display: block; font-size: 28rpx; color: #666; margin-bottom: 12rpx; }
|
||||
.filterValue { display: flex; align-items: center; justify-content: space-between; padding: 16rpx; background: #f5f5f5; border-radius: 8rpx; font-size: 28rpx; }
|
||||
.dateRow { display: flex; align-items: center; gap: 12rpx; }
|
||||
.dateInput { padding: 16rpx; background: #f5f5f5; border-radius: 8rpx; font-size: 26rpx; min-width: 200rpx; text-align: center; }
|
||||
.filterActions { display: flex; gap: 20rpx; margin-top: 40rpx; }
|
||||
</style>
|
||||
@@ -0,0 +1,404 @@
|
||||
/**
|
||||
* 坯布出仓单(其他出货单)表单 mixin(新增/编辑共用)
|
||||
*
|
||||
* 业务说明:
|
||||
* 1. 后端当前仅提供「坯布其他出货单」一种类型的接口,故出仓类型固定为 other,
|
||||
* 表头保留接收单位(business_unit) / 出货日期 / 备注 等字段。
|
||||
* 2. 用户先填写表头并「提交保存」(addGfmOtherDeliveryOrder),拿到出仓单 id 后即可扫码;
|
||||
* 扫码新增/删除细码走 updateGfmOtherDeliveryOrder;勾选锁定维度时附带 *_lock 字段,操作后用返回的最新详情刷新。
|
||||
* 3. 后端没有「修改表头」接口,保存成功或编辑进入后表头变为只读,仅可扫码维护细码。
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import {
|
||||
AUDIT_STATUS_MAP,
|
||||
BILL_TYPES,
|
||||
normalizeOrder,
|
||||
mapToSelectOptions,
|
||||
getFineCodeScanCode,
|
||||
canScanAtStatus,
|
||||
isLockedOrderStatus,
|
||||
getFormStatusActionButtons,
|
||||
orderToFormFields,
|
||||
confirmOrderStatusAction,
|
||||
DRAFT_AUDIT_STATUS,
|
||||
DRAFT_AUDIT_STATUS_NAME,
|
||||
getEmptyScanDetail,
|
||||
findScanContext,
|
||||
buildScanDetailFromContext,
|
||||
buildScanDetailFromOrderResponse,
|
||||
buildScanUpdateParams,
|
||||
getOrderDisplayWeight,
|
||||
getFineCodeDisplayWeight,
|
||||
} from '@/common/storeFabricBusinessOut';
|
||||
|
||||
export default {
|
||||
mixins: [scanMixin],
|
||||
data() {
|
||||
return {
|
||||
pageMode: 'add',
|
||||
orderId: 0,
|
||||
form: this.getEmptyForm(),
|
||||
headerSaved: false,
|
||||
selectShow: false,
|
||||
selectList: [],
|
||||
selectType: '',
|
||||
canScan: false,
|
||||
QRBarCode: '',
|
||||
BarCodeDelStatus: false,
|
||||
BillDataMessage: '',
|
||||
currentScanItem: null,
|
||||
fabricInfoShow: false,
|
||||
fineCodeShow: false,
|
||||
currentFabricInfo: {},
|
||||
currentFineCodes: [],
|
||||
currentGroupKey: '',
|
||||
scanDetail: getEmptyScanDetail(),
|
||||
scanGroupKeys: [],
|
||||
lastScanCode: '',
|
||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||
auditStatus: 0,
|
||||
businessUnitOptions: [],
|
||||
dropdownLoading: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isReadonly() {
|
||||
return this.pageMode === 'view';
|
||||
},
|
||||
isEditable() {
|
||||
return this.pageMode === 'add' || this.pageMode === 'edit';
|
||||
},
|
||||
// 表头是否可编辑:仅新增且未保存时可编辑(后端无修改表头接口)
|
||||
headerEditable() {
|
||||
return this.pageMode === 'add' && !this.headerSaved;
|
||||
},
|
||||
dateLabel() {
|
||||
return '出货日期';
|
||||
},
|
||||
/** 表头保存后,待审核/已驳回状态下显示审核、作废 */
|
||||
statusActionButtons() {
|
||||
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||
},
|
||||
displayAuditStatus() {
|
||||
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS;
|
||||
return this.auditStatus;
|
||||
},
|
||||
displayAuditStatusName() {
|
||||
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
|
||||
return AUDIT_STATUS_MAP[this.auditStatus] || '';
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.isPageActive = true;
|
||||
// #ifdef APP-PLUS
|
||||
if (this.canScan && this.isEditable) {
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
this.QRBarCode = scanResult.trim().replace(/[\r\n]/g, '');
|
||||
this.$nextTick(() => this.handleScan());
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
onHide() {
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
onUnload() {
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
registerOrderScanBroadcast() {
|
||||
// #ifdef APP-PLUS
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
this.QRBarCode = scanResult.trim().replace(/[\r\n]/g, '');
|
||||
this.$nextTick(() => this.handleScan());
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
syncCanScanFromStatus(status) {
|
||||
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||
if (this.canScan && !nextCanScan) {
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
}
|
||||
this.canScan = nextCanScan;
|
||||
},
|
||||
loadBaseDropdowns() {
|
||||
if (this.dropdownLoading) return Promise.resolve();
|
||||
if (this.businessUnitOptions.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
this.dropdownLoading = true;
|
||||
return this.ensureBusinessUnitOptions().finally(() => {
|
||||
this.dropdownLoading = false;
|
||||
});
|
||||
},
|
||||
ensureBusinessUnitOptions() {
|
||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
||||
return this.$u.api.businessUnit.list({})
|
||||
.then((res) => {
|
||||
this.businessUnitOptions = mapToSelectOptions(res);
|
||||
return this.businessUnitOptions;
|
||||
});
|
||||
},
|
||||
getEmptyForm() {
|
||||
return {
|
||||
order_no: '',
|
||||
business_unit_id: '',
|
||||
business_unit_name: '',
|
||||
delivery_time: this.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
|
||||
remark: '',
|
||||
item_data: [],
|
||||
};
|
||||
},
|
||||
loadOrder(id, options = {}) {
|
||||
const { rejectIfLocked = false } = options;
|
||||
return this.$u.api.gfmOtherDeliveryOrder.detail({ id })
|
||||
.then((res) => {
|
||||
const order = normalizeOrder(res);
|
||||
if (!order) {
|
||||
this.showError('单据不存在');
|
||||
return null;
|
||||
}
|
||||
if (rejectIfLocked && isLockedOrderStatus(order.audit_status)) {
|
||||
this.showError('当前状态不可编辑');
|
||||
setTimeout(() => uni.navigateBack(), 1500);
|
||||
return null;
|
||||
}
|
||||
this.orderId = order.id;
|
||||
this.auditStatus = order.audit_status;
|
||||
this.headerSaved = true;
|
||||
this.form = orderToFormFields(order);
|
||||
this.refreshScanDetailTotals(order);
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
if (this.canScan) this.registerOrderScanBroadcast();
|
||||
return order;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.showError(e.message || '加载单据失败');
|
||||
return null;
|
||||
});
|
||||
},
|
||||
pickerSelectFun(type) {
|
||||
if (!this.headerEditable) return;
|
||||
this.selectType = type;
|
||||
const openPicker = (list) => {
|
||||
if (!list.length) {
|
||||
this.showError('暂无可选数据');
|
||||
return;
|
||||
}
|
||||
this.selectList = list;
|
||||
this.selectShow = true;
|
||||
};
|
||||
if (type === '接收单位') {
|
||||
this.ensureBusinessUnitOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载单位列表失败'));
|
||||
}
|
||||
},
|
||||
selectConfirmFun(e) {
|
||||
const item = e[0];
|
||||
if (this.selectType === '接收单位') {
|
||||
this.form.business_unit_id = item.value;
|
||||
this.form.business_unit_name = item.label;
|
||||
}
|
||||
},
|
||||
bindDateChange(e) {
|
||||
this.form.delivery_time = e.detail.value;
|
||||
},
|
||||
validateForm() {
|
||||
if (!this.form.business_unit_id) return '请选择接收单位';
|
||||
if (!this.form.delivery_time) return '请选择出货日期';
|
||||
return '';
|
||||
},
|
||||
buildAddParam() {
|
||||
return {
|
||||
business_unit_id: Number(this.form.business_unit_id),
|
||||
delivery_time: this.form.delivery_time,
|
||||
remark: this.form.remark || '',
|
||||
};
|
||||
},
|
||||
submitSave() {
|
||||
if (this.headerSaved) {
|
||||
this.showError('表头已保存,请直接扫码维护细码');
|
||||
return;
|
||||
}
|
||||
const err = this.validateForm();
|
||||
if (err) {
|
||||
this.showError(err);
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '保存中...' });
|
||||
this.$u.api.gfmOtherDeliveryOrder.add(this.buildAddParam())
|
||||
.then((res) => {
|
||||
this.orderId = (res && res.id) || 0;
|
||||
if (!this.orderId) {
|
||||
throw new Error('保存失败,未返回单据ID');
|
||||
}
|
||||
return this.$u.api.gfmOtherDeliveryOrder.detail({ id: this.orderId });
|
||||
})
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
this.applyOrder(order);
|
||||
this.headerSaved = true;
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
this.showSuccess('保存成功,可以扫码');
|
||||
this.registerOrderScanBroadcast();
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.showError(e.message || '保存失败');
|
||||
});
|
||||
},
|
||||
applyOrder(order) {
|
||||
if (!order) return;
|
||||
this.auditStatus = order.audit_status;
|
||||
Object.assign(this.form, orderToFormFields(order));
|
||||
this.refreshScanDetailTotals(order);
|
||||
},
|
||||
refreshScanDetailTotals(order) {
|
||||
this.scanDetail = {
|
||||
...this.scanDetail,
|
||||
total_roll: order.total_roll ?? 0,
|
||||
total_weight: getOrderDisplayWeight(order),
|
||||
};
|
||||
},
|
||||
applyScanDetail(scanCode, order, scanType) {
|
||||
const fromResponse = buildScanDetailFromOrderResponse(order);
|
||||
if (fromResponse) {
|
||||
const context = findScanContext(order.item_data, scanCode);
|
||||
if (context) {
|
||||
fromResponse.weight = getFineCodeDisplayWeight(context.fineCode);
|
||||
}
|
||||
this.scanDetail = fromResponse;
|
||||
if (scanType !== 2) this.lastScanCode = scanCode;
|
||||
else if (this.lastScanCode === scanCode) this.lastScanCode = '';
|
||||
return;
|
||||
}
|
||||
const context = findScanContext(order.item_data, scanCode);
|
||||
if (context) {
|
||||
this.scanDetail = buildScanDetailFromContext(context, order);
|
||||
this.lastScanCode = scanCode;
|
||||
return;
|
||||
}
|
||||
if (scanType === 2 && this.lastScanCode === scanCode) {
|
||||
this.scanDetail = {
|
||||
...getEmptyScanDetail(),
|
||||
total_roll: order.total_roll ?? 0,
|
||||
total_weight: getOrderDisplayWeight(order),
|
||||
};
|
||||
this.lastScanCode = '';
|
||||
return;
|
||||
}
|
||||
this.refreshScanDetailTotals(order);
|
||||
},
|
||||
handleScan() {
|
||||
const code = (this.QRBarCode || '').trim();
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('请先提交保存后再扫码');
|
||||
this.QRBarCode = '';
|
||||
return;
|
||||
}
|
||||
if (!code) {
|
||||
this.QRBarCode = '';
|
||||
return;
|
||||
}
|
||||
const scanType = this.BarCodeDelStatus ? 2 : 1;
|
||||
this.doScanUpdate(code, scanType);
|
||||
},
|
||||
BarCodeDelChange(e) {
|
||||
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||
},
|
||||
/** 扫码新增/删除细码,统一走 scanUpdate 接口 */
|
||||
doScanUpdate(scanCode, scanType, options = {}) {
|
||||
const { refreshFineCodes = false } = options;
|
||||
uni.showLoading({ title: scanType === 2 ? '删除中...' : '处理中...' });
|
||||
return this.$u.api.gfmOtherDeliveryOrder.scanUpdate(buildScanUpdateParams({
|
||||
id: this.orderId,
|
||||
scanCode,
|
||||
scanType,
|
||||
groupKeys: this.scanGroupKeys,
|
||||
detail: this.scanDetail,
|
||||
}))
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
this.form.item_data = order.item_data;
|
||||
this.auditStatus = order.audit_status;
|
||||
this.applyScanDetail(scanCode, order, scanType);
|
||||
if (refreshFineCodes) {
|
||||
const row = order.item_data.find((i) => (i.group_key || String(i.id)) === this.currentGroupKey);
|
||||
this.currentFineCodes = row ? [...row.fine_codes] : [];
|
||||
}
|
||||
this.BillDataMessage = scanType === 2 ? '删除成功' : '扫描成功';
|
||||
this.QRBarCode = '';
|
||||
if (scanType === 2) this.showSuccess('删除成功');
|
||||
else util.playSuccessAudio();
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.showError(e.message || (scanType === 2 ? '删除失败' : '扫码失败'));
|
||||
this.QRBarCode = '';
|
||||
});
|
||||
},
|
||||
openFabricInfo(row) {
|
||||
this.currentFabricInfo = { ...row };
|
||||
this.fabricInfoShow = true;
|
||||
},
|
||||
openFineCode(row) {
|
||||
this.currentGroupKey = row.group_key || String(row.id);
|
||||
this.currentFineCodes = [...(row.fine_codes || [])];
|
||||
this.fineCodeShow = true;
|
||||
},
|
||||
onDeleteFineCode(fineCode) {
|
||||
if (this.isReadonly || !this.canScan) return;
|
||||
const scanCode = getFineCodeScanCode(fineCode);
|
||||
if (!scanCode) {
|
||||
this.showError('该细码缺少条码,无法删除');
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `确认删除细码 ${scanCode}?`,
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
this.doScanUpdate(scanCode, 2, { refreshFineCodes: true });
|
||||
},
|
||||
});
|
||||
},
|
||||
handleStatusAction(action) {
|
||||
confirmOrderStatusAction(this, {
|
||||
orderId: this.orderId,
|
||||
action,
|
||||
onSuccess: () => this.$u.api.gfmOtherDeliveryOrder.detail({ id: this.orderId })
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
if (!order) return;
|
||||
this.applyOrder(order);
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
this.showSuccess('操作成功');
|
||||
}),
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio();
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
showSuccess(message) {
|
||||
util.playSuccessAudio();
|
||||
uni.showToast({ title: message, icon: 'success' });
|
||||
},
|
||||
getBillTypeName() {
|
||||
return this.billTypeName;
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,160 @@
|
||||
/* 坯布出仓单页面共用样式(新增/编辑/查看) */
|
||||
.fabric-out-page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.fabric-out-mt32 {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
.fabric-out-sectionTitle {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
padding: 24rpx 26rpx 12rpx;
|
||||
border-left: 6rpx solid #007AFF;
|
||||
margin: 20rpx 26rpx 0;
|
||||
}
|
||||
.fabric-out-scanTip {
|
||||
padding: 20rpx 26rpx;
|
||||
color: #fa8c16;
|
||||
font-size: 26rpx;
|
||||
background: #fff7e6;
|
||||
margin: 16rpx 26rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.fabric-out-msgTip {
|
||||
padding: 12rpx 26rpx;
|
||||
color: #52c41a;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.fabric-out-detailList {
|
||||
padding: 0 26rpx;
|
||||
}
|
||||
.fabric-out-detailCard {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.fabric-out-detailRow {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
padding-bottom: 12rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
.fabric-out-detailMeta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
padding-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
.fabric-out-scanRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.fabric-out-scanInput {
|
||||
width: 200px;
|
||||
flex: 1;
|
||||
min-width: 160px;
|
||||
}
|
||||
.fabric-out-delCheck {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.fabric-out-scanDetail {
|
||||
background: #fff;
|
||||
margin: 0 26rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fabric-out-scanDetailRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 16rpx 20rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
.fabric-out-scanDetailRow--2col {
|
||||
justify-content: space-between;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.fabric-out-scanDetailCell {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.fabric-out-scanDetailCheck {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
gap: 4rpx;
|
||||
}
|
||||
.fabric-out-scanDetailLabel {
|
||||
color: #333;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.fabric-out-scanDetailValue {
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
.fabric-out-scanDetailTableScroll {
|
||||
width: 100%;
|
||||
}
|
||||
.fabric-out-scanDetailTable {
|
||||
min-width: 100%;
|
||||
}
|
||||
.fabric-out-scanDetailTableRow {
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
.fabric-out-scanDetailTableHead {
|
||||
background: #f5f5f5;
|
||||
font-weight: bold;
|
||||
}
|
||||
.fabric-out-scanDetailTableCell {
|
||||
padding: 14rpx 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
word-break: break-all;
|
||||
}
|
||||
.fabric-out-scanDetailEmpty {
|
||||
padding: 24rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
.fabric-out-submitView {
|
||||
width: 100%;
|
||||
padding: 16rpx 26rpx 26rpx;
|
||||
background: #fff;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-top: 1rpx solid #f1f1f1;
|
||||
display: flex;
|
||||
z-index: 100;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.fabric-out-actionBtnWrap {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.fabric-out-actionBtnWrap + .fabric-out-actionBtnWrap {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.fabric-out-actionBtn {
|
||||
flex: 1;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
||||
<text class="mr26">出仓单号</text>
|
||||
<text>{{ order.order_no }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">出仓类型</text>
|
||||
<text>{{ billTypeName }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">接收单位</text><text>{{ order.business_unit_name }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">出货日期</text><text>{{ formatTime(order.delivery_time) }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">单据备注</text><text>{{ order.remark || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">创建人</text><text>{{ order.creator_name }} {{ formatTime(order.create_time, 'YYYY-MM-DD') }}</text>
|
||||
</view>
|
||||
<view v-if="order.auditer_name" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">审核人</text><text>{{ order.auditer_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
||||
</view>
|
||||
|
||||
<FabricOutDetailList
|
||||
:title="detailTitle"
|
||||
:list="order.item_data"
|
||||
@fabric-info="openFabricInfo"
|
||||
@fine-code="openFineCode"
|
||||
/>
|
||||
|
||||
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||
|
||||
<FabricInfoPopup :show.sync="fabricInfoShow" :data="currentFabricInfo" />
|
||||
<FineCodePopup :show.sync="fineCodeShow" :list="currentFineCodes" :readonly="true" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import util from '@/common/util';
|
||||
import FabricInfoPopup from '@/components/storefabric/FabricInfoPopup.vue';
|
||||
import FineCodePopup from '@/components/storefabric/FineCodePopup.vue';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import FabricOutDetailList from '@/components/storefabric/FabricOutDetailList.vue';
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
import {
|
||||
BILL_TYPES,
|
||||
normalizeOrder,
|
||||
getViewStatusActionButtons,
|
||||
confirmOrderStatusAction,
|
||||
formatDisplayTime,
|
||||
} from '@/common/storeFabricBusinessOut';
|
||||
|
||||
export default {
|
||||
components: { FabricInfoPopup, FineCodePopup, OrderStatusBar, FabricOutDetailList, FabricOutFooter },
|
||||
data() {
|
||||
return {
|
||||
orderId: 0,
|
||||
order: {},
|
||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||
fabricInfoShow: false,
|
||||
fineCodeShow: false,
|
||||
currentFabricInfo: {},
|
||||
currentFineCodes: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
actionButtons() {
|
||||
return getViewStatusActionButtons(this.order.audit_status);
|
||||
},
|
||||
detailTitle() {
|
||||
return `出仓细码(共 ${this.order.total_roll || 0} 匹 / ${this.order.total_weight || 0} KG)`;
|
||||
},
|
||||
},
|
||||
onLoad(e) {
|
||||
uni.setNavigationBarTitle({ title: '查看坯布出仓单' });
|
||||
if (e.id) {
|
||||
this.orderId = Number(e.id);
|
||||
this.refreshOrder();
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (this.orderId) this.refreshOrder();
|
||||
},
|
||||
methods: {
|
||||
formatTime: formatDisplayTime,
|
||||
refreshOrder() {
|
||||
this.$u.api.gfmOtherDeliveryOrder.detail({ id: this.orderId })
|
||||
.then((res) => {
|
||||
const order = normalizeOrder(res);
|
||||
if (!order) {
|
||||
this.showError('单据不存在');
|
||||
return;
|
||||
}
|
||||
this.order = order;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.showError(err.message || '加载单据失败');
|
||||
});
|
||||
},
|
||||
openFabricInfo(row) {
|
||||
this.currentFabricInfo = { ...row };
|
||||
this.fabricInfoShow = true;
|
||||
},
|
||||
openFineCode(row) {
|
||||
this.currentFineCodes = [...(row.fine_codes || [])];
|
||||
this.fineCodeShow = true;
|
||||
},
|
||||
handleAction(action) {
|
||||
if (action === 'edit') {
|
||||
uni.navigateTo({ url: `./storeFabricBusinessOutEdit?id=${this.orderId}` });
|
||||
return;
|
||||
}
|
||||
confirmOrderStatusAction(this, {
|
||||
orderId: this.orderId,
|
||||
action,
|
||||
onSuccess: () => this.$u.api.gfmOtherDeliveryOrder.detail({ id: this.orderId })
|
||||
.then((res) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(res);
|
||||
if (order) this.order = order;
|
||||
util.playSuccessAudio();
|
||||
uni.showToast({ title: '操作成功', icon: 'success' });
|
||||
}),
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio();
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user