货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

643 lines
23 KiB

"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_user = require("../../../api/user.js");
const store_useSystemSettingsStore = require("../../../store/useSystemSettingsStore.js");
require("../../../utils/request.js");
require("../../../store/index.js");
require("../../../utils/utils.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_uni_th2 = common_vendor.resolveComponent("uni-th");
const _easycom_uni_tr2 = common_vendor.resolveComponent("uni-tr");
const _easycom_uni_td2 = common_vendor.resolveComponent("uni-td");
const _easycom_uni_table2 = common_vendor.resolveComponent("uni-table");
const _component_BasicContainer = common_vendor.resolveComponent("BasicContainer");
const _component_tiplist = common_vendor.resolveComponent("tiplist");
(_easycom_uni_th2 + _easycom_uni_tr2 + _easycom_uni_td2 + _easycom_uni_table2 + _component_BasicContainer + _component_tiplist)();
}
const _easycom_uni_th = () => "../../../uni_modules/uni-table/components/uni-th/uni-th.js";
const _easycom_uni_tr = () => "../../../uni_modules/uni-table/components/uni-tr/uni-tr.js";
const _easycom_uni_td = () => "../../../uni_modules/uni-table/components/uni-td/uni-td.js";
const _easycom_uni_table = () => "../../../uni_modules/uni-table/components/uni-table/uni-table.js";
if (!Math) {
(cusSelects + _easycom_uni_th + _easycom_uni_tr + _easycom_uni_td + _easycom_uni_table)();
}
const cusSelects = () => "../../../compoment/cus-selects-fan/cus-selects-fan.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "CustomerOrdersDetails",
setup(__props) {
common_vendor.storeToRefs(store_useSystemSettingsStore.useSystemSettingsStore());
const utils = common_vendor.inject("utils");
const option = common_vendor.reactive({
title: "客户订单扫描",
haveData: true,
async pullDownRefreshInitPage() {
details.datalist = [];
details.order.page.current = 1;
details.zero.page.current = 1;
details.stock.page.current = 1;
return await initpage();
}
});
let details = common_vendor.reactive({
schanvalue: "",
orderArr: [],
stockArr: [],
zeroArr: [],
typearr: [
{
value: 3,
label: "齐套"
},
{
value: 2,
label: "部分扫"
},
{
value: 1,
label: "未扫"
}
],
items: {},
datalist: [],
scancode: "",
orderStatus: 1,
id: "",
loadingId: "",
orderType: 0,
inputtxt: "",
listcheckindex: -1,
isscan: false,
order: {
page: {
size: 10,
current: 1
},
// 分页总页数
pages: 1,
data: []
},
zero: {
page: {
size: 10,
current: 1
},
// 分页总页数
pages: 1,
data: []
},
stock: {
page: {
size: 10,
current: 1
},
// 分页总页数
pages: 1,
data: []
},
/** 滑动区域高度 */
scrollHeight: ""
});
const tiplists = common_vendor.ref(null);
const basicContainer = common_vendor.ref(null);
common_vendor.onLoad((op) => {
details.items = JSON.parse(op.item);
details.id = op.id;
details.loadingId = op.loadingId;
});
function goorderdetail(item) {
common_vendor.index.navigateTo({
url: "/pagesHome/pages/orderDetails/orderDetails?orderCode=" + item.orderCode
});
}
common_vendor.onShow(async () => {
const timer = setTimeout(() => {
basicContainer.value.startPullDownRefresh();
clearTimeout(timer);
}, 200);
let data = {
reservationId: details.items.id,
completecode: details.orderType,
orderCode: details.inputtxt
};
let response1 = await api_user.deliveryInventory(data);
details.stock.data = response1.data || [];
});
common_vendor.onMounted(async () => {
await common_vendor.nextTick$1();
details.scrollHeight = utils.getViewDistanceFormTop(".scve").then((res) => {
console.log("res :>> ", res);
details.scrollHeight = res;
});
});
const loadingNub = common_vendor.computed(() => {
let num = 0;
if (details.order.data)
num += details.order.data.reduce((curr, item) => curr + item.loadingNub, 0);
if (details.zero.data)
num += details.zero.data.reduce((curr, item) => curr + item.loadingNub, 0);
console.log("details.stock.data :>> ", details.stock.data);
if (details.stock.data)
num += details.stock.data.reduce((curr, item) => {
if (item.loadingStatusName !== "未装车")
return curr += 1;
return curr;
}, 0);
console.log("num :>> ", num);
return num;
});
function showsdqs() {
tiplists.value.setdetails({
isshow: true,
tipstate: 1,
title: "请输入扫描的码",
placeholder: "请输入扫描的码",
inputtext: "",
success: (detail) => {
details.scancode = detail.inputtext;
scandata();
tiplists.value.setdetails({ isshow: false });
},
cancel: () => {
tiplists.value.setdetails({ isshow: false });
},
close: () => {
tiplists.value.setdetails({ isshow: false });
}
});
}
async function initpage() {
details.listcheckindex = -1;
try {
let data = {
reservationId: details.items.id,
completecode: details.orderType,
orderCode: details.inputtxt
};
details.datalist = [];
if (details.orderStatus == 1 || details.orderStatus === 2)
await initPageOrder(data);
else if (details.orderStatus == 3)
await initPageStock(data);
if (details.orderStatus === 1)
details.datalist = details.order.data;
else if (details.orderStatus === 2)
details.datalist = details.zero.data;
else
details.datalist = details.stock.data;
} catch (err) {
console.log("err :>> ", err);
} finally {
return null;
}
}
async function initPageOrder(submitData) {
try {
const response = await api_user.deliveryorder(submitData);
const { data } = response;
if (response.code !== 200)
return;
details.zero.data = [];
details.order.data = [];
data && data.forEach((val) => {
let scanNum = 0;
for (let i = 0; i < val.distributionAppParcelListVOS.length; i++) {
const value = val.distributionAppParcelListVOS[i];
if (value.isScan !== "已扫")
continue;
scanNum++;
}
console.log("scanNum :>> ", scanNum);
if (scanNum === 0)
val.completecode = 1;
else if (scanNum < val.distributionAppParcelListVOS.length)
val.completecode = 2;
else
val.completecode = 3;
val.complete = val.completecode === 1 ? "未扫" : val.completecode === 2 ? "部分扫" : "齐套";
if (val.isZero === "1")
return details.zero.data.push(val);
details.order.data.push(val);
});
} catch (err) {
console.log("err :>> ", err);
}
}
async function initPageStock(submitData) {
try {
details.stock.data = [];
const response = await api_user.deliveryInventory(submitData);
const { data } = response;
if (response.code !== 200)
return;
details.stock.data = data || [];
return response;
} catch (err) {
console.log("err :>> ", err);
}
}
function checktype(e) {
if (e == "") {
details.schanvalue = "";
details.orderType = 0;
}
details.typearr.map((item) => {
if (item.value == e) {
details.schanvalue = item.label;
details.orderType = item.value;
}
});
}
function handleSearch() {
basicContainer.value.startPullDownRefresh();
}
function setorderStatus(state) {
if (details.orderStatus === state)
return;
details.orderStatus = state;
basicContainer.value.startPullDownRefresh();
if (details.orderStatus === 1)
details.datalist = details.order.data;
else if (details.orderStatus === 2)
details.datalist = details.zero.data;
else
details.datalist = details.stock.data;
console.log(" details.datalist :>> ", details.datalist);
}
function reatchBootomOrder() {
if (details.order.pages <= details.order.page.current) {
return common_vendor.index.showToast({
title: "数据加载完毕",
icon: "none"
});
}
details.order.page.current += 1;
initpage();
}
function reatchBootomZero() {
if (details.zero.pages <= details.zero.page.current) {
return common_vendor.index.showToast({
title: "数据加载完毕",
icon: "none"
});
}
details.zero.page.current += 1;
initpage();
}
function reatchBootomStock() {
if (details.stock.pages <= details.stock.page.current) {
return common_vendor.index.showToast({
title: "数据加载完毕",
icon: "none"
});
}
details.stock.page.current += 1;
initpage();
}
function reatchBottom() {
console.log("111 :>> ", 111);
if (details.orderStatus === 1)
reatchBootomOrder();
else if (details.orderStatus === 2)
reatchBootomZero();
else if (details.orderStatus === 3)
reatchBootomStock();
}
const handleDriverInfo = async (content = "请重新提交") => {
let subData = {
deliveryId: details.id
};
let res = await api_user.deliveryvehicle(subData);
const { code, data } = res;
if (code !== 200)
return;
const _driverId = common_vendor.index.getStorageSync("checkvehicle").driverId;
let _flag = false;
for (let item of data) {
if (item.driverId === _driverId) {
_flag = true;
common_vendor.index.setStorageSync("checkvehicle", item);
break;
}
}
if (!_flag) {
common_vendor.index.navigateBack({
delta: 2
});
utils.handleToast("司机信息变更");
return;
}
utils.handleToast(content);
};
async function scandata() {
let code = 0;
try {
let loadingId = common_vendor.index.getStorageSync("checkvehicle").id;
if (details.orderStatus == 1) {
let data = {
reservationId: details.items.id,
deliveryId: details.id,
loadingId,
type: 1,
barcode: details.scancode
};
let res = await api_user.deliveryloadingscan(data);
const { audio } = res;
code = res.code;
if (code === 5e3) {
utils.ttsspke("不在本次计划, 是否继续装车");
tiplists.value.setdetails({
isshow: true,
tipstate: 2,
title: "是否异常装车",
lsit: [],
isonecheck: true,
success: async (detail) => {
let loadingId2 = common_vendor.index.getStorageSync("checkvehicle").id;
let data2 = {
reservationId: details.items.id,
deliveryId: details.id,
loadingId: loadingId2,
type: 1,
barcode: details.scancode
};
const res2 = await api_user.postAbnormalTruckLoading(data2);
if (res2.code === 13e3) {
handleDriverInfo();
}
if (res2.code !== 200)
return;
basicContainer.value.startPullDownRefresh();
console.log("res :>> ", res2);
tiplists.value.setdetails({ isshow: false });
},
cancel: () => {
tiplists.value.setdetails({ isshow: false });
},
close: () => {
tiplists.value.setdetails({ isshow: false });
}
});
}
if (code === 3001)
utils.ttsspke(audio);
} else if (details.orderStatus == 3) {
let data = {
reservationId: details.items.id,
deliveryId: details.id,
loadingId: common_vendor.index.getStorageSync("checkvehicle").id,
type: 1,
barcode: details.scancode
};
let res = await api_user.deliveryloadinginventory(data);
code = res.code;
const { audio } = res;
console.log("res :>> ", res);
if (!audio)
return;
}
} catch (err) {
console.log("err :>> ", err);
} finally {
if (code === 13e3) {
handleDriverInfo("请重新扫描");
}
basicContainer.value.startPullDownRefresh();
}
}
function checkphon(item, index) {
if (item.isZero === "1") {
const inpList = item.distributionAppParcelListVOS.map((val) => {
return {
id: val.id,
title: val.firsts,
value: val.loadingNum || val.reservationNum,
maxNum: val.reservationNum,
minNum: 0,
type: "Number",
disabled: val.loadingNum === val.reservationNum,
allocationId: val.allocationId,
orderCode: val.orderCode,
stockArticleId: val.stockArticleId
};
});
tiplists.value.setdetails({
title: "设置零担物料数量",
isshow: true,
tipstate: 4,
inpList,
inputtext: "",
confirmTxt: "确认",
isonecheck: true,
success: async (deta) => {
try {
if (deta.inpList.every((val) => val.disabled))
return tiplists.value.setdetails({ isshow: false });
common_vendor.index.showLoading({
mask: true,
title: "提交中"
});
if (deta.inpList.length === 0 || item.completeStact)
return tiplists.value.setdetails({ isshow: false });
let data = {
reservationId: details.items.id,
deliveryId: details.id,
orderId: deta.inpList[0].stockArticleId,
loadingId: common_vendor.index.getStorageSync("checkvehicle").id,
parcelListDTOS: []
};
data.parcelListDTOS = deta.inpList.map((val) => {
return {
parcelListId: val.id,
stockArticleId: val.stockArticleId,
loadingNum: val.value
};
});
const res = await api_user.deliveryZeroLoading(data);
if (res.code === 13e3) {
handleDriverInfo();
}
if (res.audio) {
}
if (res.code !== 200)
return;
tiplists.value.setdetails({ isshow: false });
basicContainer.value.startPullDownRefresh();
} catch (err) {
console.log("err :>> ", err);
} finally {
common_vendor.index.hideLoading();
}
},
cancel: (details2) => {
tiplists.value.setdetails({ isshow: false });
},
close: (details2) => {
tiplists.value.setdetails({ isshow: false });
}
});
return;
}
if (details.listcheckindex == index) {
details.listcheckindex = -1;
} else {
details.listcheckindex = index;
}
}
const { listcheckindex, inputtxt, orderStatus, schanvalue, typearr, items, datalist } = common_vendor.toRefs(details);
return (_ctx, _cache) => {
return {
a: common_vendor.t(common_vendor.unref(items).consignee),
b: common_vendor.o(showsdqs),
c: common_vendor.t(common_vendor.unref(items).isstock),
d: common_vendor.t(common_vendor.unref(items).isload),
e: common_vendor.t(common_vendor.unref(items).ordNub),
f: common_vendor.t(common_vendor.unref(items).reservationNum),
g: common_vendor.t(loadingNub.value),
h: common_vendor.t(common_vendor.unref(items).signNub),
i: common_vendor.o(checktype),
j: common_vendor.p({
data: common_vendor.unref(typearr),
value: common_vendor.unref(schanvalue),
placeholder: "全部",
arrLeft: 5,
size: "145",
clearable: true
}),
k: common_vendor.unref(inputtxt),
l: common_vendor.o(($event) => common_vendor.isRef(inputtxt) ? inputtxt.value = $event.detail.value : null),
m: common_vendor.o(handleSearch),
n: common_vendor.n(common_vendor.unref(orderStatus) == 1 ? "xz" : ""),
o: common_vendor.o(($event) => setorderStatus(1)),
p: common_vendor.n(common_vendor.unref(orderStatus) == 2 ? "xz" : ""),
q: common_vendor.o(($event) => setorderStatus(2)),
r: common_vendor.n(common_vendor.unref(orderStatus) == 3 ? "xz" : ""),
s: common_vendor.o(($event) => setorderStatus(3)),
t: common_vendor.f(common_vendor.unref(datalist), (item, index, i0) => {
return common_vendor.e(common_vendor.unref(orderStatus) == 1 ? common_vendor.e({
a: common_vendor.o(($event) => goorderdetail(item), item),
b: common_vendor.t(item.orderCode || "暂无数据"),
c: common_vendor.o(($event) => goorderdetail(item), item),
d: common_vendor.t(item.waybillNumber || "暂无数据"),
e: common_vendor.t(item.reservationNum),
f: common_vendor.t(item.loadingNub),
g: common_vendor.unref(listcheckindex) == index
}, common_vendor.unref(listcheckindex) == index ? {
h: "6197e305-4-" + i0 + "," + ("6197e305-3-" + i0),
i: common_vendor.p({
align: "left"
}),
j: "6197e305-5-" + i0 + "," + ("6197e305-3-" + i0),
k: common_vendor.p({
align: "left"
}),
l: "6197e305-6-" + i0 + "," + ("6197e305-3-" + i0),
m: common_vendor.p({
align: "left"
}),
n: "6197e305-7-" + i0 + "," + ("6197e305-3-" + i0),
o: common_vendor.p({
align: "center"
}),
p: "6197e305-3-" + i0 + "," + ("6197e305-2-" + i0),
q: common_vendor.f(item.distributionAppParcelListVOS, (ite, k1, i1) => {
return {
a: common_vendor.t(ite.orderPackageCode),
b: ite.orderPackageLoadingStatus !== "20" ? 1 : "",
c: "6197e305-9-" + i0 + "-" + i1 + "," + ("6197e305-8-" + i0 + "-" + i1),
d: common_vendor.t(ite.thirdProduct),
e: "6197e305-10-" + i0 + "-" + i1 + "," + ("6197e305-8-" + i0 + "-" + i1),
f: common_vendor.t(ite.isScan),
g: "6197e305-11-" + i0 + "-" + i1 + "," + ("6197e305-8-" + i0 + "-" + i1),
h: common_vendor.t(ite.isAbnnormalSigningName || ite.isAbnormalLoadingName || "/"),
i: "6197e305-12-" + i0 + "-" + i1 + "," + ("6197e305-8-" + i0 + "-" + i1),
j: Number(ite.isAbnormalLoading) === 1 || Number(ite.isAbnnormalSigning) === 1 ? 1 : "",
k: "6197e305-8-" + i0 + "-" + i1 + "," + ("6197e305-2-" + i0)
};
}),
r: common_vendor.p({
align: "center"
}),
s: common_vendor.sr("uniTable1", "6197e305-2-" + i0 + ",6197e305-0", {
"f": 1
}),
t: common_vendor.o(() => {
}, item),
v: "6197e305-2-" + i0 + ",6197e305-0",
w: common_vendor.p({
border: true,
emptyText: "暂无更多数据"
})
} : {}, {
x: item.complete
}, item.complete ? {
y: common_vendor.t(item.complete),
z: common_vendor.n(item.completecode == 3 ? "tip tp1" : item.completecode == 1 ? "tip tp2" : "tip tp3")
} : {}, {
A: item.isHaveAbnormalPackageName
}, item.isHaveAbnormalPackageName ? {
B: common_vendor.t(item.isHaveAbnormalPackageName)
} : {}, {
C: common_vendor.o(($event) => checkphon(item, index), item)
}) : common_vendor.unref(orderStatus) == 2 ? common_vendor.e({
D: common_vendor.o(($event) => goorderdetail(item), item),
E: common_vendor.t(item.orderCode),
F: common_vendor.o(($event) => goorderdetail(item), item),
G: common_vendor.t(item.descriptionGoods),
H: common_vendor.t(item.reservationNum),
I: common_vendor.t(item.loadingNub),
J: item.complete
}, item.complete ? {
K: common_vendor.t(item.complete),
L: common_vendor.n(item.completecode == 3 ? "tip tp1" : item.completecode == 1 ? "tip tp2" : "tip tp3")
} : {}, {
M: common_vendor.o(($event) => checkphon(item, index), item)
}) : common_vendor.unref(orderStatus) == 3 ? common_vendor.e({
N: common_vendor.t(item.sku),
O: common_vendor.t(item.descriptionGoods),
P: common_vendor.t(item.cargoNorms),
Q: item.signingStatusName === "待备货"
}, item.signingStatusName === "待备货" ? {
R: common_vendor.t(item.signingStatusName)
} : {
S: common_vendor.t(item.stockPackageCode || "暂无数据")
}, {
T: common_vendor.t(item.cargoUnit),
U: item.loadingStatusName
}, item.loadingStatusName ? {
V: common_vendor.t(item.loadingStatusName),
W: common_vendor.n(item.loadingStatusName == "未装车" ? "tip tp2" : "tip tp1")
} : {}, {
X: common_vendor.o(($event) => checkphon(item, index), item)
}) : {}, {
Y: item
});
}),
v: common_vendor.unref(orderStatus) == 1,
w: common_vendor.unref(orderStatus) == 2,
x: common_vendor.unref(orderStatus) == 3,
y: common_vendor.unref(details).scrollHeight,
z: common_vendor.o(() => {
}),
A: common_vendor.o(() => {
}),
B: common_vendor.o(reatchBottom),
C: common_vendor.sr(basicContainer, "6197e305-0", {
"k": "basicContainer"
}),
D: common_vendor.p({
option
}),
E: common_vendor.sr(tiplists, "6197e305-13", {
"k": "tiplists"
})
};
};
}
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6197e305"], ["__file", "D:/worksp/logpm/pagesHome/pages/CustomerOrdersDetails/CustomerOrdersDetails.vue"]]);
wx.createPage(MiniProgramPage);