acdr-ui/dist/dev/mp-weixin/sheep/api/trade/order.js

160 lines
4.1 KiB
JavaScript

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
const sheep_request_index = require("../../request/index.js");
const sheep_helper_utils = require("../../helper/utils.js");
const OrderApi = {
// 计算订单信息
settlementOrder: (data) => {
const data2 = __spreadValues({}, data);
if (!(data.couponId > 0)) {
delete data2.couponId;
}
if (!(data.addressId > 0)) {
delete data2.addressId;
}
if (!(data.pickUpStoreId > 0)) {
delete data2.pickUpStoreId;
}
if (sheep_helper_utils.isEmpty(data.receiverName)) {
delete data2.receiverName;
}
if (sheep_helper_utils.isEmpty(data.receiverMobile)) {
delete data2.receiverMobile;
}
if (!(data.combinationActivityId > 0)) {
delete data2.combinationActivityId;
}
if (!(data.combinationHeadId > 0)) {
delete data2.combinationHeadId;
}
if (!(data.seckillActivityId > 0)) {
delete data2.seckillActivityId;
}
delete data2.items;
for (let i = 0; i < data.items.length; i++) {
data2[encodeURIComponent("items[" + i + "].skuId")] = data.items[i].skuId + "";
data2[encodeURIComponent("items[" + i + "].count")] = data.items[i].count + "";
if (data.items[i].cartId) {
data2[encodeURIComponent("items[" + i + "].cartId")] = data.items[i].cartId + "";
}
}
const queryString = Object.keys(data2).map((key) => key + "=" + data2[key]).join("&");
return sheep_request_index.request({
url: `/trade/order/settlement?${queryString}`,
method: "GET",
custom: {
showError: true,
showLoading: true
}
});
},
// 创建订单
createOrder: (data) => {
return sheep_request_index.request({
url: `/trade/order/create`,
method: "POST",
data
});
},
// 获得订单
getOrder: (id) => {
return sheep_request_index.request({
url: `/trade/order/get-detail`,
method: "GET",
params: {
id
},
custom: {
showLoading: false
}
});
},
// 订单列表
getOrderPage: (params) => {
return sheep_request_index.request({
url: "/trade/order/page",
method: "GET",
params,
custom: {
showLoading: false
}
});
},
// 确认收货
receiveOrder: (id) => {
return sheep_request_index.request({
url: `/trade/order/receive`,
method: "PUT",
params: {
id
}
});
},
// 取消订单
cancelOrder: (id) => {
return sheep_request_index.request({
url: `/trade/order/cancel`,
method: "DELETE",
params: {
id
}
});
},
// 删除订单
deleteOrder: (id) => {
return sheep_request_index.request({
url: `/trade/order/delete`,
method: "DELETE",
params: {
id
}
});
},
// 获得交易订单的物流轨迹
getOrderExpressTrackList: (id) => {
return sheep_request_index.request({
url: `/trade/order/get-express-track-list`,
method: "GET",
params: {
id
}
});
},
// 获得交易订单数量
getOrderCount: () => {
return sheep_request_index.request({
url: "/trade/order/get-count",
method: "GET",
custom: {
showLoading: false,
auth: true
}
});
},
// 创建单个评论
createOrderItemComment: (data) => {
return sheep_request_index.request({
url: `/trade/order/item/create-comment`,
method: "POST",
data
});
}
};
exports.OrderApi = OrderApi;
//# sourceMappingURL=order.js.map