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.
534 lines
18 KiB
534 lines
18 KiB
"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_tiplist = common_vendor.resolveComponent("tiplist"); |
|
const _component_saomiao2 = common_vendor.resolveComponent("saomiao2"); |
|
(_easycom_u_navbar2 + _component_tiplist + _component_saomiao2)(); |
|
} |
|
const _easycom_u_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js"; |
|
if (!Math) { |
|
(_easycom_u_navbar + cusSelects)(); |
|
} |
|
const cusSelects = () => "../../../compoment/cus-selects-fan/cus-selects-fan.js"; |
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ |
|
__name: "CustomerOrdersDetails", |
|
setup(__props) { |
|
const utils = common_vendor.inject("utils"); |
|
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: "", |
|
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: [] |
|
} |
|
}); |
|
const tiplists = common_vendor.ref(null); |
|
common_vendor.onLoad((op) => { |
|
details.items = JSON.parse(op.item); |
|
details.id = op.id; |
|
}); |
|
function goorderdetail(item) { |
|
common_vendor.index.navigateTo({ |
|
url: "/pagesHome/pages/orderDetails/orderDetails?orderCode=" + item.orderCode |
|
}); |
|
} |
|
common_vendor.onShow(async () => { |
|
common_vendor.index.$on("scancodedate", function(code) { |
|
if (code) { |
|
console.log("code", code); |
|
details.scancode = code; |
|
details.isscan = true; |
|
scandata(); |
|
} |
|
}); |
|
let data = { |
|
reservationId: details.items.id, |
|
completecode: details.orderType, |
|
orderCode: details.inputtxt |
|
}; |
|
details.datalist = []; |
|
let response = null; |
|
response = await api_user.deliveryorder(data); |
|
details.zero.data = []; |
|
details.order.data = []; |
|
if (response.data) { |
|
response.data.forEach((val) => { |
|
if (val.isZero === "1") |
|
return details.zero.data.push(val); |
|
details.order.data.push(val); |
|
}); |
|
} |
|
let response1 = await api_user.signforinventory(data); |
|
details.stock.data = response1.data || []; |
|
console.log("response :>> ", response); |
|
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; |
|
}); |
|
common_vendor.onHide(() => { |
|
common_vendor.index.$off("scancodedate"); |
|
}); |
|
common_vendor.onPullDownRefresh(() => { |
|
details.datalist = []; |
|
details.order.page.current = 1; |
|
details.zero.page.current = 1; |
|
details.stock.page.current = 1; |
|
const timer = setTimeout(async () => { |
|
await initpage(); |
|
common_vendor.index.stopPullDownRefresh(); |
|
clearTimeout(timer); |
|
}, 500); |
|
}); |
|
const loadingNub = common_vendor.computed(() => { |
|
let num = 0; |
|
num += details.order.data.reduce((curr, item) => curr + item.loadingNub, 0); |
|
num += details.zero.data.reduce((curr, item) => curr + item.loadingNub, 0); |
|
num += details.stock.data.reduce((curr, item) => { |
|
if (item.loadingStatusName !== "未装车") |
|
return curr += 1; |
|
return curr; |
|
}, 0); |
|
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() { |
|
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; |
|
details.zero.data = []; |
|
details.order.data = []; |
|
data.forEach((val) => { |
|
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.signforinventory(submitData); |
|
const { data } = response; |
|
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 setorderStatus(state) { |
|
details.orderStatus = state; |
|
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(); |
|
} |
|
async function scandata() { |
|
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 { code, audio } = res; |
|
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); |
|
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, |
|
type: 1, |
|
barcode: details.scancode |
|
}; |
|
let res = await api_user.deliveryloadinginventory(data); |
|
const { audio } = res; |
|
console.log("res :>> ", res); |
|
if (!audio) |
|
return; |
|
} |
|
} catch (err) { |
|
console.log("err :>> ", err); |
|
} finally { |
|
common_vendor.index.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.audio) { |
|
} |
|
common_vendor.index.startPullDownRefresh(); |
|
} catch (err) { |
|
console.log("err :>> ", err); |
|
} finally { |
|
common_vendor.index.hideLoading(); |
|
tiplists.value.setdetails({ isshow: false }); |
|
} |
|
}, |
|
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.p({ |
|
title: "客户订单扫描", |
|
bgColor: "#D3832A", |
|
leftIconColor: "#ffffff", |
|
titleStyle: "color:#ffffff", |
|
placeholder: true, |
|
autoBack: true, |
|
leftIconSize: "35" |
|
}), |
|
b: common_vendor.t(common_vendor.unref(items).consignee), |
|
c: common_vendor.o(showsdqs), |
|
d: common_vendor.t(common_vendor.unref(items).isstock), |
|
e: common_vendor.t(common_vendor.unref(items).isload), |
|
f: common_vendor.t(common_vendor.unref(items).ordNub), |
|
g: common_vendor.t(common_vendor.unref(items).reservationNum), |
|
h: common_vendor.t(common_vendor.unref(loadingNub)), |
|
i: common_vendor.t(common_vendor.unref(items).signNub), |
|
j: common_vendor.o(checktype), |
|
k: common_vendor.p({ |
|
data: common_vendor.unref(typearr), |
|
value: common_vendor.unref(schanvalue), |
|
placeholder: "全部", |
|
arrLeft: 5, |
|
size: "145", |
|
clearable: true |
|
}), |
|
l: common_vendor.unref(inputtxt), |
|
m: common_vendor.o(($event) => common_vendor.isRef(inputtxt) ? inputtxt.value = $event.detail.value : null), |
|
n: common_vendor.o(initpage), |
|
o: common_vendor.n(common_vendor.unref(orderStatus) == 1 ? "xz" : ""), |
|
p: common_vendor.o(($event) => setorderStatus(1)), |
|
q: common_vendor.n(common_vendor.unref(orderStatus) == 2 ? "xz" : ""), |
|
r: common_vendor.o(($event) => setorderStatus(2)), |
|
s: common_vendor.n(common_vendor.unref(orderStatus) == 3 ? "xz" : ""), |
|
t: common_vendor.o(($event) => setorderStatus(3)), |
|
v: 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.t(item.reservationNum), |
|
d: common_vendor.t(item.loadingNub), |
|
e: common_vendor.unref(listcheckindex) == index |
|
}, common_vendor.unref(listcheckindex) == index ? { |
|
f: common_vendor.f(item.distributionAppParcelListVOS, (ite, k1, i1) => { |
|
return { |
|
a: common_vendor.t(ite.orderPackageCode), |
|
b: common_vendor.t(ite.thirdProduct), |
|
c: common_vendor.t(ite.isScan ? ite.isScan : "未扫") |
|
}; |
|
}) |
|
} : {}, { |
|
g: item.complete |
|
}, item.complete ? { |
|
h: common_vendor.t(item.complete), |
|
i: common_vendor.n(item.completecode == 3 ? "tip tp1" : item.completecode == 1 ? "tip tp2" : "tip tp3") |
|
} : {}, { |
|
j: item.isHaveAbnormalPackageName |
|
}, item.isHaveAbnormalPackageName ? { |
|
k: common_vendor.t(item.isHaveAbnormalPackageName) |
|
} : {}, { |
|
l: common_vendor.o(($event) => checkphon(item, index), item) |
|
}) : common_vendor.unref(orderStatus) == 2 ? common_vendor.e({ |
|
m: common_vendor.o(($event) => goorderdetail(item), item), |
|
n: common_vendor.t(item.orderCode), |
|
o: common_vendor.o(($event) => goorderdetail(item), item), |
|
p: common_vendor.t(item.descriptionGoods), |
|
q: common_vendor.t(item.reservationNum), |
|
r: common_vendor.t(item.loadingNub), |
|
s: item.complete |
|
}, item.complete ? { |
|
t: common_vendor.t(item.complete), |
|
v: common_vendor.n(item.completecode == 3 ? "tip tp1" : item.completecode == 1 ? "tip tp2" : "tip tp3") |
|
} : {}, { |
|
w: common_vendor.o(($event) => checkphon(item, index), item) |
|
}) : common_vendor.unref(orderStatus) == 3 ? common_vendor.e({ |
|
x: common_vendor.t(item.sku), |
|
y: common_vendor.t(item.descriptionGoods), |
|
z: common_vendor.t(item.cargoNorms), |
|
A: item.signingStatusName === "待备货" |
|
}, item.signingStatusName === "待备货" ? { |
|
B: common_vendor.t(item.signingStatusName) |
|
} : { |
|
C: common_vendor.t(item.stockPackageCode || "暂无数据") |
|
}, { |
|
D: common_vendor.t(item.cargoUnit), |
|
E: item.loadingStatusName |
|
}, item.loadingStatusName ? { |
|
F: common_vendor.t(item.loadingStatusName), |
|
G: common_vendor.n(item.loadingStatusName == "未装车" ? "tip tp2" : "tip tp1") |
|
} : {}, { |
|
H: common_vendor.o(($event) => checkphon(item, index), item) |
|
}) : {}, { |
|
I: item |
|
}); |
|
}), |
|
w: common_vendor.unref(orderStatus) == 1, |
|
x: common_vendor.unref(orderStatus) == 2, |
|
y: common_vendor.unref(orderStatus) == 3, |
|
z: common_vendor.o(() => { |
|
}), |
|
A: common_vendor.o(reatchBottom), |
|
B: common_vendor.sr(tiplists, "e3e6ac36-2", { |
|
"k": "tiplists" |
|
}) |
|
}; |
|
}; |
|
} |
|
}); |
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/workSpace/logpm/pagesHome/pages/CustomerOrdersDetails/CustomerOrdersDetails.vue"]]); |
|
wx.createPage(MiniProgramPage);
|
|
|