Commit 8721509d authored by liuyanfang's avatar liuyanfang

发货易发货失败时提示店铺授权过期

parent 80bee0ac
...@@ -35,7 +35,8 @@ async function booking(wayCompanyId: string, orderNo: string,fhy_type:Number) { ...@@ -35,7 +35,8 @@ async function booking(wayCompanyId: string, orderNo: string,fhy_type:Number) {
let result = { let result = {
status: 0, status: 0,
msg: "", msg: "",
data: [] data: [],
action:""
} }
let printError: any = orderNo let printError: any = orderNo
result = await waitreauthDialog(); result = await waitreauthDialog();
...@@ -168,6 +169,7 @@ async function waitreauthDialog() { ...@@ -168,6 +169,7 @@ async function waitreauthDialog() {
status: 5, status: 5,
msg: "获取店铺授权", msg: "获取店铺授权",
data: [], data: [],
action:""
} }
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
await delayDate(1000); await delayDate(1000);
...@@ -189,6 +191,7 @@ async function waitOrder() { ...@@ -189,6 +191,7 @@ async function waitOrder() {
status: 4, status: 4,
msg: "获取订单超时", msg: "获取订单超时",
data: [], data: [],
action:''
} }
for (let i = 0; i < 30; i++) { for (let i = 0; i < 30; i++) {
await delayDate(1000); await delayDate(1000);
...@@ -213,6 +216,7 @@ async function waitDialog() { ...@@ -213,6 +216,7 @@ async function waitDialog() {
status: 4, status: 4,
msg: "获取打印按钮超时", msg: "获取打印按钮超时",
data: [], data: [],
action:''
} }
for (let i = 0; i < 30; i++) { for (let i = 0; i < 30; i++) {
await delayDate(1000); await delayDate(1000);
...@@ -230,6 +234,7 @@ async function waitPrintResult() { ...@@ -230,6 +234,7 @@ async function waitPrintResult() {
status: 4, status: 4,
msg: "获取打印结果超时", msg: "获取打印结果超时",
data: [], data: [],
action:''
} }
for (let i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
await delayDate(1000); await delayDate(1000);
......
...@@ -50,6 +50,10 @@ let domEle = { ...@@ -50,6 +50,10 @@ let domEle = {
document.querySelector( document.querySelector(
'.ant-modal-body>div.ant-table-wrapper .ant-table-tbody' '.ant-modal-body>div.ant-table-wrapper .ant-table-tbody'
), ),
deliverResultTable: (): any =>
document.querySelector(
'.ant-modal-body>div.ant-table-wrapper .ant-table-tbody>table'
),
deliverClose: (): any => deliverClose: (): any =>
document.querySelector('div.ant-modal-footer button'), document.querySelector('div.ant-modal-footer button'),
reauthDialog: (): any => document.querySelector('#reauthDialog'), reauthDialog: (): any => document.querySelector('#reauthDialog'),
...@@ -76,6 +80,7 @@ async function booking( ...@@ -76,6 +80,7 @@ async function booking(
status: 4, status: 4,
msg: '未找到店铺', msg: '未找到店铺',
data: [], data: [],
action:''
} }
let printError: any = orderNo let printError: any = orderNo
result = await waitreauthDialog() result = await waitreauthDialog()
...@@ -130,12 +135,9 @@ async function booking( ...@@ -130,12 +135,9 @@ async function booking(
simulateMouseClick(domEle.spanWaybillTemplate()) simulateMouseClick(domEle.spanWaybillTemplate())
let waybillTemplateList = domEle.divWaybillTemplateList() let waybillTemplateList = domEle.divWaybillTemplateList()
console.log(111111111, waybillTemplateList)
for (let i = 0; i < waybillTemplateList.childNodes.length; i++) { for (let i = 0; i < waybillTemplateList.childNodes.length; i++) {
console.log(2222, waybillTemplateList.childNodes)
let divItem = waybillTemplateList.childNodes[i] as any let divItem = waybillTemplateList.childNodes[i] as any
if (divItem.innerText.includes(waybillTemplateTitle)) { if (divItem.innerText.includes(waybillTemplateTitle)) {
console.log(333333, waybillTemplateTitle)
simulateMouseClick(divItem) simulateMouseClick(divItem)
simulateMouseClick(domEle.radioGetNewWaybill()) simulateMouseClick(domEle.radioGetNewWaybill())
...@@ -159,6 +161,7 @@ async function booking( ...@@ -159,6 +161,7 @@ async function booking(
count: domEle.tableResult().rows.length - 1, count: domEle.tableResult().rows.length - 1,
fail: 0, fail: 0,
list: [], list: [],
deliverList:[]
} }
let chooseIndex = 0 let chooseIndex = 0
let rowResultList: any = [] let rowResultList: any = []
...@@ -234,8 +237,33 @@ async function booking( ...@@ -234,8 +237,33 @@ async function booking(
} }
} }
await delayDate(1000) await delayDate(1000)
// console.log('xxxx',domEle.deliverResult(),domEle.deliverClose());
if (domEle.deliverResult()) { if (domEle.deliverResult()) {
for (
let rowIter = 1;
rowIter < domEle.deliverResultTable().rows.length;
rowIter++
) {
let rowResult = domEle.deliverResultTable().rows[rowIter].cells[3].innerText
let rowResultHTML =
domEle.deliverResultTable().rows[rowIter].cells[3].innerHTML
let rowInfo =
domEle.deliverResultTable().rows[rowIter].cells[1].innerText
let shopInfo =
domEle.deliverResultTable().rows[rowIter].cells[0].innerText
let rowRes = {
info: rowInfo,
msg: rowResult,
orderNo: '',
}
if (domEle.deliverResultTable().rows[rowIter].cells[3].innerHTML.indexOf('class="text-error"') > -1) {
if (domEle.deliverResultTable().rows[rowIter].cells[3].innerHTML.includes('店铺授权过期')) {
rowRes.msg = `${shopInfo}店铺授权过期,发货失败`
rowRes.orderNo = rowRes.orderNo?rowRes.orderNo+','+rowInfo:rowInfo
}
printReslut.deliverList.push(rowRes)
}
}
result.data = printReslut
// 关闭 // 关闭
simulateMouseClick(domEle.deliverClose()) simulateMouseClick(domEle.deliverClose())
} }
...@@ -268,6 +296,7 @@ async function waitreauthDialog() { ...@@ -268,6 +296,7 @@ async function waitreauthDialog() {
status: 5, status: 5,
msg: '获取店铺授权', msg: '获取店铺授权',
data: [], data: [],
action:''
} }
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
await delayDate(1000) await delayDate(1000)
...@@ -291,6 +320,7 @@ async function waitOrder() { ...@@ -291,6 +320,7 @@ async function waitOrder() {
status: 4, status: 4,
msg: '获取订单超时', msg: '获取订单超时',
data: [], data: [],
action:''
} }
for (let i = 0; i < 30; i++) { for (let i = 0; i < 30; i++) {
await delayDate(1000) await delayDate(1000)
...@@ -322,6 +352,8 @@ async function waitDialog() { ...@@ -322,6 +352,8 @@ async function waitDialog() {
status: 4, status: 4,
msg: '获取打印按钮超时', msg: '获取打印按钮超时',
data: [], data: [],
action:''
} }
for (let i = 0; i < 30; i++) { for (let i = 0; i < 30; i++) {
await delayDate(1000) await delayDate(1000)
...@@ -338,6 +370,8 @@ async function waitPrintResult() { ...@@ -338,6 +370,8 @@ async function waitPrintResult() {
status: 4, status: 4,
msg: '获取打印结果超时', msg: '获取打印结果超时',
data: [], data: [],
action:''
} }
for (let i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
await delayDate(1000) await delayDate(1000)
......
...@@ -236,7 +236,7 @@ chrome.runtime.onMessage.addListener(function (message: Message, sender, respons ...@@ -236,7 +236,7 @@ chrome.runtime.onMessage.addListener(function (message: Message, sender, respons
let result=null; let result=null;
(async () => { (async () => {
result = await BookingV2.booking(message.value.waybillTemplateTitle,message.value.orderNo,message.value.shopId,message.value.fhy_type); result = await BookingV2.booking(message.value.waybillTemplateTitle,message.value.orderNo,message.value.shopId,message.value.fhy_type);
result.action = 'V2'
response(result); response(result);
})(); })();
} }
...@@ -246,7 +246,7 @@ chrome.runtime.onMessage.addListener(function (message: Message, sender, respons ...@@ -246,7 +246,7 @@ chrome.runtime.onMessage.addListener(function (message: Message, sender, respons
let result=null; let result=null;
(async () => { (async () => {
result = await BookingApp.booking(message.value.wayCompanyId,message.value.orderNo,message.value.fhy_type); result = await BookingApp.booking(message.value.wayCompanyId,message.value.orderNo,message.value.fhy_type);
result.action = message.value.platform+''
response(result); response(result);
})(); })();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment