fix: 设备扫码检测到订单为in_used状态,跳转不成功的问题
This commit is contained in:
+11
-2
@@ -3,6 +3,7 @@ const common_vendor = require("../common/vendor.js");
|
||||
const config_url = require("./url.js");
|
||||
const request = (option) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
common_vendor.index.__f__("log", "at config/http.js:9", `发起请求: ${option.method} ${config_url.URL + option.url}`, option.data);
|
||||
common_vendor.index.request({
|
||||
url: config_url.URL + option.url,
|
||||
method: option.method,
|
||||
@@ -15,17 +16,25 @@ const request = (option) => {
|
||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
||||
},
|
||||
success(res) {
|
||||
common_vendor.index.__f__("log", "at config/http.js:24", `请求响应: ${option.url}`, res);
|
||||
if (res.statusCode !== 200) {
|
||||
common_vendor.index.__f__("error", "at config/http.js:28", `HTTP状态码错误: ${res.statusCode}`, res.data);
|
||||
if (res.data) {
|
||||
resolve(res.data);
|
||||
return;
|
||||
}
|
||||
reject({ msg: `请求失败,状态码:${res.statusCode}` });
|
||||
return;
|
||||
}
|
||||
if (res.data.code !== 200) {
|
||||
reject(res.data);
|
||||
if (res.data && res.data.code !== 200) {
|
||||
common_vendor.index.__f__("warn", "at config/http.js:42", `业务状态码错误: ${res.data.code}`, res.data);
|
||||
resolve(res.data);
|
||||
return;
|
||||
}
|
||||
resolve(res.data);
|
||||
},
|
||||
fail(err) {
|
||||
common_vendor.index.__f__("error", "at config/http.js:53", `请求失败: ${option.url}`, err);
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
|
||||
+4
-2
@@ -1,4 +1,5 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
const config_http = require("./http.js");
|
||||
const login = (data) => {
|
||||
return config_http.request({
|
||||
@@ -40,9 +41,10 @@ const queryById = (id) => {
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
const overOrderById = (data) => {
|
||||
const overOrderById = (orderId) => {
|
||||
common_vendor.index.__f__("log", "at config/user.js:78", `调用结束订单API, orderId: ${orderId}`);
|
||||
return config_http.request({
|
||||
url: `/app/order/close/${data}`,
|
||||
url: `/app/order/close/${orderId}`,
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user