| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679 |
- <template>
- <view class="">
- <view class="sticky-subsection" :style="{ top: `${stickyTop}px` }">
- <view class="subsection-wrap">
- <u-subsection
- fontSize="25"
- mode="subsection"
- :list="tabList"
- :current="curNow"
- @change="sectionChange"
- activeColor="#157A2C"
- ></u-subsection>
- </view>
- </view>
- <view
- class="sticky-subsection-placeholder"
- :style="{ height: `${stickyPlaceholderHeight}px` }"
- ></view>
- <!-- Tab 0: 入库单详情 -->
- <view v-show="curNow === 0" class="basic_info">
- <view class="info_header">
- <view class="info_title">入库单详情</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view class="info_content">
- <u-row>
- <u-col span="4">
- <view class="label">物品名称:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ form.categoryName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">物品编码:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ form.categoryCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">物品分类:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ form.categoryLevelName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">包装数量:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ totalPackage || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">计量数量:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ totalCount || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- Tab 1: 基本信息 -->
- <view v-show="curNow === 1" class="basic_info">
- <view class="info_header">
- <view class="info_title">基本信息</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view class="info_content">
- <u-row>
- <u-col span="4">
- <view class="label">物品类型:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ assetTypeLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">入库类型:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ bizTypeLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">单据来源:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.sourceBizNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">入库时间:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.storageTime || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">入库登记人:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.createUserName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">审核人:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.approvalUserName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="4">
- <view class="label">备注:</view>
- </u-col>
- <u-col span="8">
- <view class="value">{{ formData.remark || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- Tab 2: 产品信息 -->
- <view v-show="curNow === 2" class="basic_info">
- <view class="info_header">
- <view class="info_title">产品信息</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view v-if="!productList.length" class="empty_text"> 暂无产品信息 </view>
- <view v-for="(row, idx) in productList" :key="idx" class="card_box">
- <view class="card_title">产品 {{ idx + 1 }}</view>
- <u-row>
- <u-col span="3">
- <view class="label">编码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">名称:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">牌号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.brandNum || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">型号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryModel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">规格:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.specification || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">批次号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.batchNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.packingQuantityDisplay,
- row.packingQuantity,
- row.packingUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">计量数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.measureQuantityDisplay,
- row.measureQuantity,
- row.measureUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">重量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(row.weightDisplay, row.weight, row.weightUnit)
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装规格:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.packingSpecification || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">仓库:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.warehouseName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">机型:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.modelKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">颜色:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.colorKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">生产要求:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.productionRequirements || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- Tab 3: 包装明细 -->
- <view v-show="curNow === 3" class="basic_info">
- <view class="info_header">
- <view class="info_title">包装明细</view>
- <u-gap height="4" bgColor="#1890FF"></u-gap>
- </view>
- <view v-if="!packingList.length" class="empty_text"> 暂无包装明细 </view>
- <view v-for="(row, idx) in packingList" :key="idx" class="card_box">
- <view class="card_title">包装 {{ idx + 1 }}</view>
- <u-row>
- <u-col span="3">
- <view class="label">编码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">名称:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.categoryName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">批次号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.batchNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装编码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.packageNo || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">包装数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.packingQuantityDisplay,
- row.packingQuantity,
- row.packingUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">计量数量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(
- row.measureQuantityDisplay,
- row.measureQuantity,
- row.measureUnit,
- )
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">重量:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{
- formatValueWithUnit(row.weightDisplay, row.weight, row.weightUnit)
- }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">仓库:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.warehouseName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">物料代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.materielDesignation || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">客户代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.clientCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">发货条码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.barcodes || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">刻码:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.engrave || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierName || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">供应商代号:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.supplierCode || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">机型:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.modelKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">颜色:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ formatField(row.colorKey) }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">质检结果:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.resultLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">质检状态:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.statusLabel || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">生产日期:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.productionDate || "—" }}</view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="3">
- <view class="label">采购日期:</view>
- </u-col>
- <u-col span="9">
- <view class="value">{{ row.purchaseDate || "—" }}</view>
- </u-col>
- </u-row>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getStorageDetail,
- allCategoryLevel,
- getLoginUser,
- } from "@/api/wt/index.js";
- import {
- getListByNameOrModeType,
- getCategoryPackageDisposition,
- getCode,
- getAssetNum,
- isVerifyRepeatIsStock,
- } from "@/api/warehouseManagement/index.js";
- const INPUT_SCENE_STATE = [
- { code: 1, label: "生产入库" },
- { code: 2, label: "采购入库" },
- { code: 3, label: "退货入库" },
- { code: 4, label: "委外入库" },
- { code: 5, label: "受托入库" },
- { code: 6, label: "调拨入库" },
- { code: 7, label: "委外退货入库" },
- { code: 8, label: "委外采购入库" },
- { code: 9, label: "仓库委外入库" },
- { code: 10, label: "采购退货入库" },
- { code: 99, label: "其他入库" },
- ];
- const QUALITY_RESULTS = {
- 0: "无",
- 1: "合格",
- 2: "不合格",
- 3: "让步接收",
- };
- const QUALITY_STATUS = {
- 0: "未质检",
- 1: "待检",
- 2: "已质检",
- };
- export default {
- props: {
- businessId: {
- default: "",
- },
- taskDefinitionKey: {
- default: "",
- },
- },
- data() {
- return {
- form: {},
- formData: {
- type: 1,
- bizType: "",
- sourceBizNo: "",
- storageTime: "",
- createUserId: "",
- createUserName: "",
- approvalUserId: "",
- approvalUserName: "",
- remark: "",
- extInfo: {
- assetType: [],
- assetTypeName: "",
- deptCode: "",
- deptName: "",
- createUserName: "",
- createUserId: "",
- deliveryPhone: "",
- documentSource: "",
- supplierName: "",
- },
- outInDetailList: [],
- },
- tabList: ["入库单详情", "基本信息", "产品信息", "包装明细"],
- curNow: 0,
- productList: [],
- packingList: [],
- assetTypeMapping: {},
- isDetail: false,
- totalPackage: "",
- totalCount: "",
- stickyPlaceholderHeight: 0,
- stickyTop: 44,
- };
- },
- computed: {
- bizType() {
- return this.taskDefinitionKey === "wmsBizType4" ? 4 : 1;
- },
- bizTypeLabel() {
- const item = INPUT_SCENE_STATE.find(
- (s) => s.code === Number(this.formData.bizType),
- );
- return item ? item.label : "";
- },
- assetTypeLabel() {
- const types = this.formData.extInfo.assetType;
- if (Array.isArray(types)) {
- return types
- .map((id) => this.assetTypeMapping[id] || "")
- .filter(Boolean)
- .join("、");
- }
- if (typeof types === "string" && types) {
- return types
- .split(",")
- .map((id) => this.assetTypeMapping[id.trim()] || "")
- .filter(Boolean)
- .join("、");
- }
- return "";
- },
- },
- async mounted() {
- this.initStickyTop();
- await this.loadAssetTypeMapping();
- await this.getDetailData(this.businessId);
- await this.getLoginUserData();
- this.updateStickyPlaceholderHeight();
- },
- methods: {
- initStickyTop() {
- try {
- const systemInfo = uni.getSystemInfoSync();
- const statusBarHeight = Number(systemInfo.statusBarHeight || 0);
- // `uni-nav-bar` 在开启 statusBar 后,内容区默认高度约为 44px。
- this.stickyTop = statusBarHeight + 44;
- } catch (error) {
- this.stickyTop = 50;
- }
- },
- updateStickyPlaceholderHeight() {
- this.$nextTick(() => {
- const query = uni.createSelectorQuery().in(this);
- query
- .select(".sticky-subsection")
- .boundingClientRect((rect) => {
- if (rect && rect.height) {
- this.stickyPlaceholderHeight = rect.height;
- }
- })
- .exec();
- });
- },
- sectionChange(index) {
- this.curNow = index;
- },
- formatField(val) {
- if (Array.isArray(val)) return val.join(",") || "—";
- return val || "—";
- },
- formatValueWithUnit(displayValue, value, unit) {
- if (displayValue || displayValue === 0 || displayValue === "0") {
- return String(displayValue);
- }
- if (value === null || value === undefined || value === "") {
- return "—";
- }
- return `${value}${unit || ""}`;
- },
- async loadAssetTypeMapping() {
- try {
- const data = await allCategoryLevel();
- const list = Array.isArray(data) ? data : data?.data || [];
- const obj = {};
- list.forEach((item) => {
- obj[item.id] = item.name;
- });
- this.assetTypeMapping = obj;
- } catch (e) {
- console.warn("加载物品分类失败", e);
- }
- },
- async getDetailData(id) {
- try {
- const data = await getStorageDetail(id);
- this.form = data;
- this.isDetail = data.detailList?.[0]?.isAllPackageData == 1;
- this.totalPackage = this.isDetail
- ? (data.detailList[0].packingCount || "") +
- (data.detailList[0]?.packingUnit || "")
- : data.detailList.length + (data.detailList[0]?.packingUnit || "");
- this.totalCount =
- (data.totalCount || "") + (data.detailList?.[0]?.measuringUnit || "");
- this.form.detailList = (data.detailList || []).map((item) => ({
- ...item,
- productName: item.categoryName,
- productCode: item.categoryCode,
- }));
- let categoryLevelTopIds = data.detailList.map(
- (item) => item.rootCategoryLevelId,
- );
- let filterCategoryLevelTopIds = [
- ...new Set(categoryLevelTopIds.filter(Boolean)),
- ];
- data.categoryLevelTopId = filterCategoryLevelTopIds.join(",");
- if (this.taskDefinitionKey === "wmsBizType4") {
- this.form.totalCount = data.detailList.reduce(
- (sum, item) => sum + (item.quantity || 0),
- 0,
- );
- }
- await this.initFormData();
- await this.initProducts();
- } catch (e) {
- console.warn("获取入库单详情失败", e);
- }
- },
- async initFormData() {
- this.formData.type = 1;
- this.formData.bizType = this.bizType;
- this.formData.sourceBizNo = this.form.code || "";
- const categoryLevelTopIds = (this.form.detailList || [])
- .map((item) => item.rootCategoryLevelId)
- .filter(Boolean);
- this.formData.extInfo.assetType = [...new Set(categoryLevelTopIds)];
- this.formData.extInfo.documentSource = this.form.code || "";
- this.formData.extInfo.supplierName = this.form.supplierName || "";
- this.getNowFormatDate();
- },
- getNowFormatDate() {
- const now = new Date();
- const pad = (n) => String(n).padStart(2, "0");
- this.formData.storageTime = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
- },
- async getLoginUserData() {
- try {
- const data = await getLoginUser();
- this.formData.createUserId =
- this.form.createUserId || data.userId || "";
- this.formData.createUserName =
- this.form.createUserName || data.name || "";
- this.formData.approvalUserId =
- this.form.approvalUserId || data.userId || "";
- this.formData.approvalUserName =
- this.form.approvalUserName || data.name || "";
- this.formData.extInfo.createUserId =
- this.form.createUserId || data.userId || "";
- this.formData.extInfo.createUserName =
- this.form.createUserName || data.name || "";
- this.formData.extInfo.deliveryPhone = data.phone || "";
- this.formData.extInfo.deptName =
- this.form.deptName || data.deptName || "";
- } catch (e) {
- console.warn("获取登录用户数据失败", e);
- }
- },
- async initProducts() {
- const detailList = this.form.detailList || [];
- if (!detailList.length) return;
- const codeList = detailList
- .map((item) => item.productCode || item.categoryCode)
- .filter(Boolean);
- if (!codeList.length) {
- this.buildFromDetailList(detailList);
- return;
- }
- try {
- const categoryList = await getListByNameOrModeType({ codeList });
- if (!categoryList || !categoryList.length) {
- this.buildFromDetailList(detailList);
- return;
- }
- const assetTypes = [
- ...new Set(
- categoryList
- .map((item) => item.categoryLevelPathIdParent)
- .filter(Boolean),
- ),
- ];
- if (assetTypes.length) {
- this.formData.extInfo.assetType = assetTypes;
- }
- let batchNo = "";
- try {
- batchNo = await getCode("lot_number_code");
- } catch (e) {
- console.warn("获取批次号失败", e);
- }
- let packingSpecs = [];
- try {
- packingSpecs = await getCategoryPackageDisposition({
- categoryIds: categoryList.map((item) => item.id),
- });
- } catch (e) {
- console.warn("获取包装规格失败", e);
- }
- const isMoreProduct = categoryList.length > 1;
- this.productList = categoryList.map((item, index) => {
- const detail =
- detailList.find(
- (d) => item.code === (d.productCode || d.categoryCode),
- ) ||
- detailList[index] ||
- {};
- const weightUnit = item.weightUnit || "";
- const itemPackingSpecs = (packingSpecs || [])
- .filter((s) => s.categoryId === item.id)
- .sort((a, b) => a.sort - b.sort);
- const packingSpecLabel = itemPackingSpecs
- .map((s) =>
- s.sort > 0
- ? `${s.packageCell}${s.packageUnit}/${s.conversionUnit}`
- : null,
- )
- .filter(Boolean)
- .join(", ");
- let packingQuantity,
- measureQuantity,
- packUnit,
- measureUnit,
- warehouseId,
- warehouseName,
- warehouseIds,
- warehouseNames,
- modelKey,
- colorKey,
- packingUnitId;
- if (this.isDetail) {
- // isAllPackageData==1: 对齐PC端 saleProductList 路径
- packUnit = detail.packingUnit || item.packingUnit || "";
- measureUnit = detail.measuringUnit || item.measuringUnit || "";
- packingQuantity = detail.packingCount || detail.quantity || 0;
- measureQuantity = detail.quantity || 0;
- warehouseId = detail.warehouseId || "";
- warehouseName = detail.warehouseName || "";
- warehouseIds = detail.warehouseId ? [detail.warehouseId] : [];
- warehouseNames = detail.warehouseName ? [detail.warehouseName] : [];
- modelKey = detail.modelKey ? detail.modelKey.split(",") : "";
- colorKey = detail.colorKey ? detail.colorKey.split(",") : "";
- packingUnitId = detail.purchaseUnitId || detail.saleUnitId || "";
- } else {
- // isAllPackageData!=1: 对齐PC端 detailList 路径
- packUnit = item.packingUnit || "";
- measureUnit = item.measuringUnit || "";
- const matchDetails = detailList.filter(
- (d) => (d.productCode || d.categoryCode) === item.code,
- );
- packingQuantity = isMoreProduct
- ? matchDetails.length
- : detailList.length;
- measureQuantity = isMoreProduct
- ? matchDetails.reduce((sum, d) => sum + (d.quantity || 0), 0)
- : this.form.totalCount || 0;
- if (isMoreProduct) {
- warehouseId = matchDetails[0]?.warehouseId || "";
- warehouseName = matchDetails[0]?.warehouseName || "";
- warehouseIds = matchDetails.map((d) => d.warehouseId);
- warehouseNames = matchDetails.map((d) => d.warehouseName);
- } else {
- warehouseId = this.form.warehouseId || "";
- warehouseName = this.form.warehouseName || "";
- warehouseIds = Array(detailList.length).fill(
- this.form.warehouseId || "",
- );
- warehouseNames = Array(detailList.length).fill(
- this.form.warehouseName || "",
- );
- }
- if (this.bizType == 1) {
- modelKey = this.form.modelKey
- ? this.form.modelKey.split(",")
- : "";
- colorKey = this.form.colorKey
- ? this.form.colorKey.split(",")
- : "";
- } else {
- modelKey = item.modelKey ? item.modelKey.split(",") : "";
- colorKey = item.colorKey ? item.colorKey.split(",") : "";
- }
- packingUnitId = "";
- }
- let weight = detail.weight || 0;
- if (
- (detail.sendTotalWeight || detail.receiveTotalWeight) &&
- item.weightUnit === item.measuringUnit
- ) {
- weight = detail.sendTotalWeight || detail.receiveTotalWeight;
- }
- const singleWeight = detail.singleWeight || 0;
- if (!weight && singleWeight) {
- weight = singleWeight * measureQuantity;
- }
- return {
- index,
- categoryId: item.id,
- categoryName: item.name,
- categoryCode: item.code,
- categoryModel: item.modelType || "",
- specification: item.specification || "",
- brandNum: item.brandNum || "",
- batchNo: this.isDetail
- ? detail.batchNo || batchNo
- : [1, 3, 6].includes(this.bizType)
- ? detailList[0]?.batchNo || batchNo
- : batchNo,
- packingQuantity,
- packingUnit: packUnit,
- packingQuantityDisplay:
- packingQuantity !== 0 ? `${packingQuantity}${packUnit}` : "",
- measureQuantity,
- measureUnit: measureUnit,
- measuringUnit: measureUnit,
- measureQuantityDisplay:
- measureQuantity !== 0 ? `${measureQuantity}${measureUnit}` : "",
- measureType: item.measureType,
- weight,
- weightUnit,
- weightDisplay: weight !== 0 ? `${weight}${weightUnit}` : "",
- singleWeight,
- warehouseId,
- warehouseName,
- warehouseIds,
- warehouseNames,
- supplierName: detail.supplierName || item.supplierName || "",
- supplierCode: detail.supplierCode || item.supplierCode || "",
- supplierId: detail.supplierId || this.form.supplierId || "",
- productionRequirements: detail.productionRequirements || "",
- packingSpecification:
- item.packingSpecification || packingSpecLabel || "",
- packingSpecificationOption: itemPackingSpecs,
- packingUnitId,
- modelKey,
- colorKey,
- netWeight: item.netWeight > -1 ? item.netWeight : 0,
- isUnpack: item.isUnpack,
- qualityControl: detail.qualityControl,
- extField: item.extField || {},
- isSave: true,
- outInDetailRecordRequestList: [],
- };
- });
- await this.buildPackingList(batchNo);
- this.formData.outInDetailList = this.productList;
- } catch (e) {
- console.warn("初始化产品数据失败", e);
- this.buildFromDetailList(detailList);
- }
- },
- buildFromDetailList(detailList) {
- this.productList = detailList.map((item, index) => {
- const packUnit = item.packingUnit || "";
- const measureUnit = item.measuringUnit || "";
- const pQty = item.packingCount || item.quantity || 0;
- const mQty = item.quantity || item.measureQuantity || 0;
- return {
- index,
- categoryId: item.categoryId || item.id || "",
- categoryName: item.categoryName || "",
- categoryCode: item.categoryCode || "",
- categoryModel: item.modelType || "",
- specification: item.specification || "",
- brandNum: item.brandNum || "",
- batchNo: item.batchNo || "",
- packingQuantity: pQty,
- packingUnit: packUnit,
- packingQuantityDisplay: pQty ? `${pQty}${packUnit}` : "",
- measureQuantity: mQty,
- measureUnit: measureUnit,
- measuringUnit: measureUnit,
- measureQuantityDisplay: mQty ? `${mQty}${measureUnit}` : "",
- weight: item.weight || 0,
- weightUnit: item.weightUnit || "",
- weightDisplay: item.weight
- ? `${item.weight}${item.weightUnit || ""}`
- : "",
- singleWeight: item.singleWeight || 0,
- warehouseId: item.warehouseId || "",
- warehouseName: item.warehouseName || "",
- warehouseIds: item.warehouseId ? [item.warehouseId] : [],
- warehouseNames: item.warehouseName ? [item.warehouseName] : [],
- supplierName: item.supplierName || "",
- supplierCode: item.supplierCode || "",
- supplierId: item.supplierId || "",
- productionRequirements: item.productionRequirements || "",
- packingSpecification: item.packingSpecification || "",
- isSave: true,
- outInDetailRecordRequestList: [],
- };
- });
- this.productList.forEach((product) => {
- product.outInDetailRecordRequestList = [
- this.buildDefaultPackingEntry(product),
- ];
- });
- this.packingList = this.productList.flatMap(
- (p) => p.outInDetailRecordRequestList,
- );
- this.formData.outInDetailList = this.productList;
- },
- buildDefaultPackingEntry(product) {
- const detail =
- (this.form.detailList || []).find(
- (d) => (d.productCode || d.categoryCode) === product.categoryCode,
- ) || {};
- return {
- packageNo: "",
- categoryCode: product.categoryCode,
- categoryName: product.categoryName,
- batchNo: product.batchNo,
- packingQuantity: product.packingQuantity,
- packingUnit: product.packingUnit,
- packingQuantityDisplay: product.packingQuantityDisplay,
- measureQuantity: product.measureQuantity,
- measureUnit: product.measureUnit,
- measureQuantityDisplay: product.measureQuantityDisplay,
- weight: product.weight,
- weightUnit: product.weightUnit,
- weightDisplay: product.weightDisplay,
- warehouseId: product.warehouseId,
- warehouseName: product.warehouseName,
- materielDesignation: "",
- clientCode: "",
- barcodes: "",
- engrave: "",
- supplierName: product.supplierName,
- supplierCode: product.supplierCode,
- result: 0,
- status: 0,
- resultLabel: QUALITY_RESULTS[0],
- statusLabel: QUALITY_STATUS[0],
- productionDate: "",
- purchaseDate: "",
- modelKey: product.modelKey || "",
- colorKey: product.colorKey || "",
- workOrderId: detail.workOrderId || "",
- taskId: detail.taskId || "",
- };
- },
- _getNowDateStr() {
- const now = new Date();
- const pad = (n) => String(n).padStart(2, "0");
- return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
- },
- _isNonSplitUnit(unit) {
- if (!unit) return false;
- const u = unit.toUpperCase();
- return ["KG", "G", "L", "ML"].includes(u) || unit === "立方";
- },
- async buildPackingList(batchNo) {
- const detailList = this.form.detailList || [];
- const isMoreProduct = this.productList.length > 1;
- let productionDate = "";
- let purchaseDate = "";
- if (this.bizType == 1) {
- productionDate = this._getNowDateStr();
- }
- if (this.isDetail) {
- // isAllPackageData == 1: 对齐PC端 saleProductList → batchSave → generateWrappers 路径
- // 从 productList 生成包装明细
- try {
- for (const product of this.productList) {
- if (!product.packingQuantity || product.packingQuantity <= 0)
- continue;
- const packingSpecOption = product.packingSpecificationOption || [];
- const packingBoolen = this._isNonSplitUnit(product.packingUnit);
- const measureBoolen = this._isNonSplitUnit(product.measureUnit);
- let packingNum = Number(product.packingQuantity);
- let filterArr = [];
- if (packingBoolen) {
- if (!product.isUnpack && product.packingUnit === "立方") {
- packingNum = 1;
- } else {
- filterArr = packingSpecOption.filter(
- (s) =>
- s.packageUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- if (filterArr.length) {
- packingNum = Math.ceil(
- product.packingQuantity / filterArr[0].packageCell,
- );
- }
- }
- } else {
- if (product.isUnpack) {
- if (measureBoolen) {
- let splitIndex = packingSpecOption.findIndex(
- (s) =>
- s.conversionUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- let num = product.packingQuantity;
- for (; splitIndex > 1; splitIndex--) {
- num = num * packingSpecOption[splitIndex].packageCell;
- }
- packingNum = Math.ceil(num);
- } else {
- if (product.packingUnitId) {
- let splitIndex = packingSpecOption.findIndex(
- (s) => s.id == product.packingUnitId,
- );
- if (splitIndex == 0) {
- packingNum = Math.ceil(
- product.measureQuantity /
- (packingSpecOption[1]?.packageCell || 1),
- );
- } else if (splitIndex == 1) {
- packingNum = product.packingQuantity;
- } else {
- for (; splitIndex > 1; splitIndex--) {
- packingNum = Math.ceil(
- product.packingQuantity *
- packingSpecOption[splitIndex].packageCell,
- );
- }
- }
- } else if (packingSpecOption[1]?.packageCell) {
- packingNum = Math.ceil(
- product.measureQuantity /
- packingSpecOption[1].packageCell,
- );
- filterArr = packingSpecOption.filter(
- (s) =>
- s.packageUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- }
- }
- } else {
- if (product.measureUnit === product.packingUnit) {
- packingNum = 0;
- } else {
- packingNum = Number(product.packingQuantity);
- }
- }
- }
- if (packingNum <= 0) packingNum = 1;
- let packageNos = [];
- try {
- const assetNumRes = await getAssetNum([
- {
- assetCode: product.categoryCode + product.index,
- batchNum: product.batchNo,
- num: packingNum,
- },
- ]);
- packageNos = assetNumRes?.data || [];
- } catch (e) {
- console.warn("获取包装编码失败", e);
- }
- const qualityStatus = product.qualityControl == 1 ? 0 : 2;
- const packingEntries = [];
- for (let i = 0; i < packageNos.length; i++) {
- let measureQuantity = 1;
- let packingQuantity = 1;
- if (packingBoolen) {
- const cell = filterArr[0]?.packageCell || 1;
- measureQuantity =
- Number(product.packingQuantity) > cell * (i + 1)
- ? cell
- : Number(product.packingQuantity) - cell * i;
- } else {
- if (
- product.weightUnit === product.measureUnit &&
- product.weight
- ) {
- measureQuantity =
- Math.trunc((product.weight / packageNos.length) * 10000) /
- 10000;
- } else if (measureBoolen) {
- let splitIndex = packingSpecOption.findIndex(
- (s) =>
- s.conversionUnit === product.packingUnit &&
- s.packageUnit !== s.conversionUnit,
- );
- measureQuantity = 1;
- for (; splitIndex > 0; splitIndex--) {
- measureQuantity =
- measureQuantity *
- packingSpecOption[splitIndex].packageCell;
- }
- } else {
- measureQuantity = packingSpecOption[1]?.packageCell || 1;
- }
- }
- let clientCode = "";
- if (this.bizType == 2) {
- clientCode = product.customerMark || "";
- } else {
- clientCode = product.extInfo?.clientCode || "";
- }
- let packingUnit = product.packingUnit;
- if (product.isUnpack) {
- if (packingBoolen) {
- packingUnit =
- packingSpecOption[1]?.conversionUnit || product.packingUnit;
- } else if (measureBoolen) {
- packingUnit =
- (packingSpecOption[1] || packingSpecOption[0])
- ?.conversionUnit || product.packingUnit;
- } else {
- packingUnit =
- packingSpecOption[1]?.conversionUnit || product.packingUnit;
- }
- }
- let measureUnit = product.isUnpack
- ? measureBoolen
- ? (packingSpecOption[1] || packingSpecOption[0])
- ?.packageUnit || product.measureUnit
- : product.measureUnit
- : product.measureUnit;
- let weight = 0;
- if (product.weightUnit === product.measureUnit) {
- weight = measureQuantity ? Number(measureQuantity) : 0;
- } else if (product.singleWeight && measureQuantity) {
- weight = Number(measureQuantity) * Number(product.singleWeight);
- }
- packingEntries.push({
- index: product.index + "-" + i,
- warehouseId: product.warehouseId || "",
- warehouseName: product.warehouseName || "",
- categoryName: product.categoryName || "",
- categoryCode: product.categoryCode || "",
- categoryModel: product.categoryModel || "",
- specification: product.specification || "",
- supplierCode: product.supplierCode || "",
- supplierName: product.supplierName || "",
- brandNum: product.brandNum || "",
- parentIndex: product.index,
- batchNo: product.batchNo || batchNo,
- packageNo: packageNos[i]?.onlyCode || "",
- packingQuantity: packingQuantity,
- packingQuantityDisplay: this.formatValueWithUnit(
- "",
- packingQuantity,
- packingUnit,
- ),
- modelKey: product.modelKey || "",
- colorKey: product.colorKey || "",
- packingUnit: packingUnit,
- measureQuantity: measureQuantity,
- measureUnit: measureUnit,
- measureQuantityDisplay: this.formatValueWithUnit(
- "",
- measureQuantity,
- measureUnit,
- ),
- weight: weight,
- weightDisplay: this.formatValueWithUnit(
- "",
- weight,
- product.weightUnit || "",
- ),
- packingSpecificationOption:
- product.packingSpecificationOption || [],
- weightUnit: product.weightUnit || "",
- netWeight: product.netWeight || 0,
- barcodes: "",
- clientCode: clientCode,
- materielDesignation: product.extInfo?.materielCode || "",
- engrave: "",
- isUnpack: product.isUnpack,
- productionDate: productionDate,
- purchaseDate: "",
- result: 1,
- qualityControl: product.qualityControl,
- status: qualityStatus,
- resultLabel: QUALITY_RESULTS[1] || "合格",
- statusLabel: QUALITY_STATUS[qualityStatus] || "未质检",
- workOrderId: "",
- taskId: "",
- });
- }
- // 处理尾包余数
- if (
- product.weightUnit !== product.measureUnit &&
- packingSpecOption[1]?.packageCell
- ) {
- const remainder =
- product.measureQuantity % packingSpecOption[1].packageCell;
- if (remainder > 0 && packingEntries.length > 0) {
- const lastEntry = packingEntries[packingEntries.length - 1];
- lastEntry.measureQuantity = remainder;
- lastEntry.measureQuantityDisplay = this.formatValueWithUnit(
- "",
- remainder,
- lastEntry.measureUnit,
- );
- if (product.singleWeight) {
- lastEntry.weight = product.singleWeight * remainder;
- lastEntry.weightDisplay = this.formatValueWithUnit(
- "",
- lastEntry.weight,
- lastEntry.weightUnit,
- );
- }
- }
- }
- product.outInDetailRecordRequestList = packingEntries;
- this.packingList.push(...packingEntries);
- }
- } catch (e) {
- console.warn("生成包装明细失败", e);
- }
- } else {
- // isAllPackageData != 1: 对齐PC端 detailList 路径
- // detailList 每条记录即是一个包装, 直接映射
- const product0 = this.productList[0] || {};
- let getAssetNumPr = isMoreProduct
- ? detailList.map((val) => ({
- assetCode: val.productCode,
- batchNum: val.productBrand ? val.productBrand : val.batchNo,
- num: 1,
- }))
- : [
- {
- assetCode:
- (product0.categoryCode || "") + (product0.index ?? 0),
- batchNum: product0.batchNo || "",
- num: detailList.length,
- },
- ];
- let packingCodeList = [];
- try {
- const assetNumRes = await getAssetNum(getAssetNumPr);
- packingCodeList = assetNumRes?.data || [];
- } catch (e) {
- console.warn("获取包装编码失败", e);
- }
- this.packingList = detailList.map((item, index) => {
- const matchProduct = isMoreProduct
- ? this.productList.find(
- (val) => val.categoryCode === item.productCode,
- ) || product0
- : product0;
- let clientCode = "";
- if (this.bizType == 2) {
- clientCode = item.customerMark || "";
- } else {
- clientCode = item.clientCode || item.extInfo?.clientCode || "";
- }
- return {
- index:
- (isMoreProduct ? matchProduct.index : product0.index) +
- "-" +
- index,
- warehouseId:
- item.warehouseId || (product0.warehouseIds || [])[index] || "",
- warehouseName:
- item.warehouseName ||
- (product0.warehouseNames || [])[index] ||
- "",
- categoryName: item.productName || product0.categoryName || "",
- categoryCode: item.productCode || product0.categoryCode || "",
- categoryModel: item.modelType || product0.categoryModel || "",
- specification: item.specification || product0.specification || "",
- brandNum: item.productBrand || product0.brandNum || "",
- colorKey:
- (item.colorKey ? item.colorKey.split(",") : "") ||
- product0.colorKey ||
- "",
- modelKey:
- (item.modelKey ? item.modelKey.split(",") : "") ||
- product0.modelKey ||
- "",
- parentIndex: isMoreProduct ? matchProduct.index : product0.index,
- batchNo: product0.batchNo || batchNo,
- packageNo:
- item.packageNo ||
- item.packingCode ||
- packingCodeList[index]?.onlyCode ||
- "",
- packingQuantity: 1,
- packingUnit: item.packingUnit || "",
- packingQuantityDisplay: this.formatValueWithUnit(
- "",
- 1,
- item.packingUnit || "",
- ),
- measureQuantity: item.quantity || item.measureQuantity || 0,
- measureUnit: item.measuringUnit || item.measureUnit || "",
- measureQuantityDisplay: this.formatValueWithUnit(
- "",
- item.quantity || item.measureQuantity || 0,
- item.measuringUnit || item.measureUnit || "",
- ),
- supplierCode: item.supplierCode || "",
- supplierId: item.supplierId || "",
- supplierName: item.supplierName || "",
- weight: item.packingWeight || 0,
- weightDisplay: this.formatValueWithUnit(
- "",
- item.packingWeight || 0,
- item.weightUnit || product0.weightUnit || "",
- ),
- singleWeight: item.singleWeight || 0,
- pricingWay: item.pricingWay || "",
- weightUnit: item.weightUnit || product0.weightUnit || "",
- packingSpecificationOption: isMoreProduct
- ? matchProduct.packingSpecificationOption || []
- : product0.packingSpecificationOption || [],
- netWeight: product0.netWeight || 0,
- barcodes: item.barcodes || item.sendCode || "",
- clientCode: clientCode,
- materielDesignation:
- item.materielDesignation || item.extInfo?.materielCode || "",
- engrave: item.engrave || item.extInfo?.engrave || "",
- isUnpack: product0.isUnpack,
- productionDate: productionDate,
- purchaseDate: purchaseDate,
- result: 1,
- status: 2,
- resultLabel: QUALITY_RESULTS[1] || "合格",
- statusLabel: QUALITY_STATUS[2] || "已质检",
- serialNumber: item.productSequence || "",
- workOrderId: item.workOrderId || "",
- taskId: item.taskId || "",
- };
- });
- this.productList.forEach((product) => {
- product.outInDetailRecordRequestList = this.packingList.filter(
- (p) => p.categoryCode === product.categoryCode,
- );
- });
- }
- },
- async getReturnStorage() {
- if (!this.productList.length) {
- uni.showToast({ title: "暂无产品信息!", icon: "none" });
- return null;
- }
- const detailList = this.form.detailList || [];
- const _packingList = this.packingList.map((packingItem) => {
- let _workOrderId = null;
- let _taskId = null;
- if ([1].includes(this.bizType)) {
- _workOrderId = detailList[0]?.workOrderId;
- _taskId = detailList[0]?.taskId;
- }
- const processed = { ...packingItem };
- if (processed.modelKey) {
- processed.modelKey = processed.modelKey.toString();
- }
- if (processed.colorKey) {
- processed.colorKey = processed.colorKey.toString();
- }
- return {
- ...processed,
- workOrderId: _workOrderId,
- taskId: _taskId,
- materialDetailList: [],
- };
- });
- const processedProductList = this.productList.map((productItem) => {
- const processed = { ...productItem };
- if (processed.modelKey) {
- processed.modelKey = processed.modelKey.toString();
- }
- if (processed.colorKey) {
- processed.colorKey = processed.colorKey.toString();
- }
- return {
- ...processed,
- outInDetailRecordRequestList: _packingList.filter(
- (item) => item.parentIndex === productItem.index,
- ),
- };
- });
- const obj = JSON.parse(JSON.stringify(this.formData));
- obj.type = 1;
- if (Array.isArray(obj.extInfo.assetType)) {
- obj.extInfo.assetType = obj.extInfo.assetType.join(",");
- }
- obj.extInfo.documentSource = obj.sourceBizNo;
- obj.extInfo.deptName = this.formData.extInfo.deptName || "";
- obj.extInfo.supplierName = this.form.supplierName || "";
- const warehouseId = [];
- const warehouseName = [];
- processedProductList.forEach((item) => {
- const ids = item.warehouseIds || [];
- const names = item.warehouseNames || [];
- ids.forEach((id, idx) => {
- if (id && !warehouseId.includes(id)) {
- warehouseId.push(id);
- warehouseName.push(names[idx] || "");
- }
- });
- });
- obj.warehouseIds = warehouseId;
- obj.warehouseNames = warehouseName;
- obj.outInDetailList = processedProductList;
- obj._packingList = _packingList;
- try {
- const isVerifyData = await isVerifyRepeatIsStock({
- categoryCodes: this.productList.map((item) => item.categoryCode),
- batchNos: this.productList.map((item) => item.batchNo),
- });
- if (isVerifyData?.length) {
- return new Promise((resolve) => {
- uni.showModal({
- title: "提示",
- content: `当前批次:${isVerifyData[0].batchNo},物品${isVerifyData
- .map((item) => item.categoryName)
- .join(",")}已有入库记录,是否继续入库!`,
- confirmText: "是",
- cancelText: "否",
- success: (modalRes) => {
- if (modalRes.confirm) {
- resolve(obj);
- } else {
- resolve(false);
- }
- },
- });
- });
- }
- } catch (e) {
- console.warn("验证重复入库失败", e);
- }
- return obj;
- },
- async getTableValue() {
- const returnStorageData = await this.getReturnStorage();
- return {
- form: this.form,
- returnStorageData: returnStorageData || {},
- };
- },
- },
- };
- </script>
- <style lang="scss">
- .sticky-subsection {
- position: fixed;
- left: 0;
- right: 0;
- z-index: 99;
- width: 100%;
- box-sizing: border-box;
- background: #f5f7fa;
- }
- .sticky-subsection-placeholder {
- width: 100%;
- }
- .subsection-wrap {
- background: #f5f7fa;
- padding: 0 16rpx 12rpx;
- width: 100%;
- box-sizing: border-box;
- }
- .basic_info {
- box-sizing: border-box;
- padding: 0 20rpx;
- }
- .info_header {
- margin-top: 10rpx;
- }
- .info_title {
- position: relative;
- padding: 16rpx 50rpx;
- font-size: 36rpx;
- color: #606266;
- }
- .info_title::after {
- content: "";
- position: absolute;
- top: 16rpx;
- left: 0px;
- width: 16rpx;
- height: 50rpx;
- background: #1890ff;
- }
- .info_content {
- .label {
- padding: 20rpx 0;
- text-align: right;
- font-size: 28rpx;
- font-weight: 700;
- color: #6e6e6e;
- }
- .value {
- padding: 20rpx 0;
- font-size: 28rpx;
- color: #606266;
- }
- }
- .card_box {
- box-sizing: border-box;
- padding: 20rpx;
- margin: 20rpx;
- width: calc(100% - 40rpx);
- border-radius: 20rpx;
- box-shadow: 0 0 12rpx -6rpx #000;
- .card_title {
- font-size: 32rpx;
- font-weight: 700;
- color: #666;
- margin-bottom: 10rpx;
- }
- .label {
- padding: 18rpx 0;
- text-align: right;
- font-size: 28rpx;
- font-weight: 700;
- color: #6e6e6e;
- }
- .value {
- padding: 18rpx 0;
- font-size: 28rpx;
- color: #606266;
- }
- }
- .empty_text {
- text-align: center;
- color: #909399;
- font-size: 28rpx;
- padding: 80rpx 0;
- }
- </style>
|