"use strict"; const common_vendor = require("../../../common/vendor.js"); const api_user = require("../../../api/user.js"); require("../../../utils/request.js"); require("../../../store/index.js"); require("../../../utils/functions.js"); require("../../../utils/IDCardVerification.js"); require("../../../utils/base64.js"); require("../../../config/host.js"); require("../../../utils/md5.js"); if (!Array) { const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar"); const _component_saomiao2 = common_vendor.resolveComponent("saomiao2"); const _component_tips = common_vendor.resolveComponent("tips"); const _component_tiplist = common_vendor.resolveComponent("tiplist"); (_easycom_u_navbar2 + _component_saomiao2 + _component_tips + _component_tiplist)(); } const _easycom_u_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js"; if (!Math) { _easycom_u_navbar(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "DownGoods", setup(__props) { const tiplists = common_vendor.ref(null); const tip = common_vendor.ref(null); const details = common_vendor.reactive({ scantype: 1, mergeTray: "", newmergeTray: "", scancode: "", pageType: 1, datalist: [], checkdatalist: [], isallcheck: false, resdata: {}, trayCode: "", showstate: 0, checkmakindex: 0, codelist: [], typelist: [], Marketlist: [], checkmarkindex: 0 }); common_vendor.onLoad(async (op) => { details.pageType = op.type; if (Number(details.pageType) == 4) { details.typelist = ["物料编码", "物料名称"]; } else if (Number(details.pageType) == 5) { details.typelist = ["订单号", "运单号"]; } await initmarke(); common_vendor.index.$on("scancodedate", function(code) { if (code) { details.scancode = code; scandata(); } }); }); function backun() { common_vendor.index.navigateBack(); } async function initmarke() { let data = { warehouseCode: "LQ" }; let res = await api_user.warehouseTrayTypefindAllMarket(data); console.log(res.data); details.Marketlist = res.data; } common_vendor.watchEffect(() => { if (details.datalist.length == details.checkdatalist.length) { details.isallcheck = true; } else { details.isallcheck = false; } }); function inscan() { details.scancode = details.trayCode; scandata(); } async function scandata() { var _a; let res = null; let data = null; switch (Number(details.pageType)) { case 1: data = { trayCode: details.scancode }; res = await api_user.warehouseUpdownTypedownScanTrayCode(data); if (res.code == 200) { details.datalist = details.datalist.concat(res.data); details.checkdatalist = details.checkdatalist.concat(res.data); details.trayCode = details.scancode; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } break; case 2: data = { allocationId: details.scancode }; res = await api_user.warehouseUpdownTypeupShelfScanAllocation(data); if (res.code == 200) { details.datalist = details.datalist.concat(res.data.list); details.checkdatalist = details.checkdatalist.concat(res.data.list); details.resdata = res.data; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } break; case 3: data = { orderPackageCode: details.scancode }; res = await api_user.warehouseUpdownTypedownScanPackage(data); if (res.code == 200) { details.datalist = details.datalist.concat([res.data]); details.checkdatalist = details.checkdatalist.concat([res.data]); } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } break; case 4: data = { stockType: details.checkmakindex + 1, code: details.scancode, marketId: (_a = details.Marketlist[details.checkmarkindex]) == null ? void 0 : _a.marketId }; res = await api_user.warehouseUpdownTypedownEnterStock(data); if (res.code == 200) { details.codelist = res.data; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } break; case 5: data = { zeroType: details.checkmakindex + 1, code: details.scancode }; res = await api_user.warehouseUpdownTypedownEnterZeroOrder(data); if (res.code == 200) { details.codelist = res.data; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } break; } } async function downs() { let res = null; let data = null; let list = []; switch (Number(details.pageType)) { case 1: data = { trayCode: details.trayCode }; res = await api_user.warehouseUpdownTypedownTrayCode(data); break; case 2: data = { allocationId: details.resdata.allocationId }; res = await api_user.warehouseUpdownTypeupShelfScanAllocation(data); break; case 3: list = []; details.checkdatalist.map((item) => { list.push({ orderPackageCode: item.associationValue }); }); data = { upShelfPackageList: list }; res = await api_user.warehouseUpdownTypedownPackage(data); break; case 4: list = []; details.checkdatalist.map((item) => { list.push({ marketId: item.marketId, materialCode: item.associationValue, enterNum: item.enterNum, allocationId: item.allocationId, incomingBatch: item.incomingBatch }); }); data = { upShelfStockList: list }; res = await api_user.warehouseUpdownTypedownStock(data); break; case 5: list = []; details.checkdatalist.map((item) => { list.push({ waybillCode: item.waybillNumber, orderCode: item.associationValue, enterNum: item.enterNum, allocationId: item.allocationId }); }); data = { upShelfZeroOrderList: list }; res = await api_user.warehouseUpdownTypedownZeroOrder(data); break; } if (res.code == 200) { common_vendor.index.showToast({ title: "下架成功", icon: "none" }); details.checkdatalist = []; details.datalist = []; details.codelist = []; details.scancode = ""; details.resdata = {}; details.isallcheck = false; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } } function checkite(item) { if (details.checkdatalist.indexOf(item) == -1) { details.checkdatalist.push(item); } else { details.checkdatalist.splice(details.checkdatalist.indexOf(item), 1); } } function allquanxuan() { if (details.datalist.length == details.checkdatalist.length) { details.checkdatalist = []; } else { details.datalist.map((item) => { if (details.checkdatalist.indexOf(item) == -1) { details.checkdatalist.push(item); } }); } } function confirmlist() { let sfcg = false; details.codelist.map((item) => { if (item.enterNum > item.num) { sfcg = true; } }); if (sfcg) { tip.value.setdetails({ title: "警告", content: "入库数不能大于剩余件数", confirmTxt: "确认", isshow: true, isshowcancel: true, success: () => { tip.value.setisshow(false); }, cancel: () => { tip.value.setisshow(false); }, close: () => { tip.value.setisshow(false); } }); return; } details.codelist.map((item) => { if (item.enterNum > 0) { details.datalist.push(item); details.checkdatalist.push(item); } }); details.showstate = 0; details.codelist = []; } function setshowstate(state) { details.showstate = state; } function checkmake() { let list = []; if (Number(details.pageType) == 4) { list = ["物料编码", "物料名称"]; details.typelist = list; } else if (Number(details.pageType) == 5) { list = ["订单号", "运单号"]; details.typelist = list; } tiplists.value.setdetails({ title: "请选择商场", isshow: true, tipstate: 2, list, checklist: [], inputtext: "", confirmTxt: "确认选择", isonecheck: true, success: (deta) => { if (deta.checklist.length == 0) { common_vendor.index.showToast({ title: "请选择商场", icon: "none" }); return; } details.checkmakindex = deta.checklist[0]; tiplists.value.setdetails({ isshow: false }); details.codelist = []; }, cancel: (details2) => { tiplists.value.setdetails({ isshow: false }); }, close: (details2) => { tiplists.value.setdetails({ isshow: false }); } }); } function checkmarke() { let list = []; details.Marketlist.map((item) => { list.push(item == null ? void 0 : item.marketName); }); tiplists.value.setdetails({ title: "请选择商场", isshow: true, tipstate: 2, list, checklist: [], inputtext: "", confirmTxt: "确认选择", isonecheck: true, success: (deta) => { if (deta.checklist.length == 0) { common_vendor.index.showToast({ title: "请选择商场", icon: "none" }); return; } details.checkmarkindex = deta.checklist[0]; tiplists.value.setdetails({ isshow: false }); details.codelist = []; }, cancel: (details2) => { tiplists.value.setdetails({ isshow: false }); }, close: (details2) => { tiplists.value.setdetails({ isshow: false }); } }); } const { checkmarkindex, Marketlist, codelist, scancode, typelist, checkmakindex, showstate, trayCode, isallcheck, checkdatalist, pageType, datalist } = common_vendor.toRefs(details); return (_ctx, _cache) => { var _a; return common_vendor.e({ a: common_vendor.p({ title: "下架扫描", bgColor: "#D3832A", leftIconColor: "#ffffff", titleStyle: "color:#ffffff", placeholder: true, autoBack: true, leftIconSize: "35" }), b: common_vendor.unref(pageType) == "1" }, common_vendor.unref(pageType) == "1" ? { c: common_vendor.o(inscan), d: common_vendor.o(inscan), e: common_vendor.unref(trayCode), f: common_vendor.o(($event) => common_vendor.isRef(trayCode) ? trayCode.value = $event.detail.value : null) } : {}, { g: !common_vendor.unref(isallcheck) ? "/pagesHome/static/downnocheck.png" : "/pagesHome/static/downcheck.png", h: common_vendor.n(!common_vendor.unref(isallcheck) ? "" : "xz"), i: common_vendor.o(allquanxuan), j: common_vendor.f(common_vendor.unref(datalist), (item, index, i0) => { return common_vendor.e({ a: common_vendor.unref(checkdatalist).indexOf(item) == -1 ? "/pagesHome/static/downnocheck.png" : "/pagesHome/static/downcheck.png", b: common_vendor.t(index + 1), c: common_vendor.o(($event) => checkite(item)), d: item == null ? void 0 : item.orderCode }, (item == null ? void 0 : item.orderCode) ? { e: common_vendor.t(item == null ? void 0 : item.orderCode) } : {}, { f: item == null ? void 0 : item.goodsName }, (item == null ? void 0 : item.goodsName) ? { g: common_vendor.t(item == null ? void 0 : item.goodsName) } : {}, { h: (item == null ? void 0 : item.associationId) && common_vendor.unref(pageType) != "4" }, (item == null ? void 0 : item.associationId) && common_vendor.unref(pageType) != "4" ? { i: common_vendor.t(item == null ? void 0 : item.associationId) } : {}, { j: item == null ? void 0 : item.associationValue }, (item == null ? void 0 : item.associationValue) ? { k: common_vendor.t(item == null ? void 0 : item.associationValue) } : {}, { l: item == null ? void 0 : item.orderPackageCode }, (item == null ? void 0 : item.orderPackageCode) ? { m: common_vendor.t(item == null ? void 0 : item.orderPackageCode) } : {}, { n: item == null ? void 0 : item.trayCode }, (item == null ? void 0 : item.trayCode) ? { o: common_vendor.t(item == null ? void 0 : item.trayCode) } : {}); }), k: common_vendor.unref(pageType) == "1" ? "50vh" : "65vh", l: common_vendor.unref(pageType) == "1" || common_vendor.unref(pageType) == "2" || common_vendor.unref(pageType) == "3" }, common_vendor.unref(pageType) == "1" || common_vendor.unref(pageType) == "2" || common_vendor.unref(pageType) == "3" ? { m: common_vendor.o(backun) } : { n: common_vendor.o(($event) => setshowstate(2)) }, { o: common_vendor.o(downs), p: common_vendor.unref(showstate) }, common_vendor.unref(showstate) ? common_vendor.e({ q: common_vendor.unref(showstate) == 2 }, common_vendor.unref(showstate) == 2 ? common_vendor.e({ r: common_vendor.t(common_vendor.unref(typelist)[common_vendor.unref(checkmakindex)] || "请选择下架类型"), s: common_vendor.o(checkmake), t: details.pageType == "4" }, details.pageType == "4" ? { v: common_vendor.t(((_a = common_vendor.unref(Marketlist)[common_vendor.unref(checkmarkindex)]) == null ? void 0 : _a.marketName) || "没有商场"), w: common_vendor.o(checkmarke) } : {}, { x: "输入" + common_vendor.unref(typelist)[common_vendor.unref(checkmakindex)], y: common_vendor.unref(scancode), z: common_vendor.o(($event) => common_vendor.isRef(scancode) ? scancode.value = $event.detail.value : null), A: common_vendor.o(scandata), B: common_vendor.f(common_vendor.unref(codelist), (item, index, i0) => { return common_vendor.e({ a: item.goodsName }, item.goodsName ? { b: common_vendor.t(item.goodsName) } : {}, { c: common_vendor.t(item.num), d: item.enterNum, e: common_vendor.o(($event) => item.enterNum = $event.detail.value) }); }), C: common_vendor.o(($event) => setshowstate(0)), D: common_vendor.o(confirmlist), E: common_vendor.o(() => { }) }) : {}) : {}, { F: common_vendor.sr(tip, "3ac2a05a-2", { "k": "tip" }), G: common_vendor.sr(tiplists, "3ac2a05a-3", { "k": "tiplists" }) }); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "F:/物流/logPm/pagesHome/pages/DownGoods/DownGoods.vue"]]); wx.createPage(MiniProgramPage);