cyywl_server/yudao-ui-app/api/order.js

258 lines
4.6 KiB
JavaScript
Raw Normal View History

2023-05-15 10:12:22 +08:00
import request from "@/utils/request.js";
2023-05-15 10:12:22 +08:00
/**
* 获取购物车列表
* @param numType boolean true 购物车数量,false=购物车产品数量
*/
export function getCartCounts(numType,type) {
2023-05-23 17:37:49 +08:00
return request.get("front/cart/count?numType=" + numType + "&type=" + type);
2023-05-15 10:12:22 +08:00
}
/**
* 获取购物车列表
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function getCartList(data) {
2023-05-23 17:37:49 +08:00
return request.get("front/cart/list", data);
2023-05-15 10:12:22 +08:00
}
/**
* 修改购物车数量
* @param int cartId 购物车id
* @param int number 修改数量
*/
export function changeCartNum(cartId, number) {
2023-05-23 17:37:49 +08:00
return request.post("front/cart/num?id=" + cartId + "&number="+number)
2023-05-15 10:12:22 +08:00
}
2023-05-23 17:37:49 +08:00
// export function changeCartNum(cartId, number) {
// return request.post("front/cart/num", {
// id: cartId,
// number: number
// }, {},);
// }
2023-05-15 10:12:22 +08:00
/**
* 清除购物车
* @param object ids join(',') 切割成字符串
*/
export function cartDel(ids) {
2023-05-23 17:37:49 +08:00
console.log(ids)
return request.post('front/cart/delete', {
2023-05-15 10:12:22 +08:00
ids: ids
}, {}, 1);
}
/**
* 购物车重选提交
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function getResetCart(data) {
2023-05-23 17:37:49 +08:00
return request.post('front/cart/resetcart', data);
2023-05-15 10:12:22 +08:00
}
/**
* 订单列表
* @param object data
*/
export function getOrderList(data) {
2023-05-23 17:37:49 +08:00
return request.get('front/order/list', data);
2023-05-15 10:12:22 +08:00
}
/**
* 订单产品信息
2023-05-23 18:08:01 +08:00
* @param string unique
2023-05-15 10:12:22 +08:00
*/
export function orderProduct(data) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/product', data);
2023-05-15 10:12:22 +08:00
}
/**
* 订单评价
* @param object data
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function orderComment(data) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/comment', data);
2023-05-15 10:12:22 +08:00
}
/**
* 订单支付
* @param object data
*/
export function orderPay(data) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/pay', data);
2023-05-15 10:12:22 +08:00
}
/**
* 订单统计数据
*/
export function orderData() {
2023-05-23 17:37:49 +08:00
return request.get('front/order/data')
2023-05-15 10:12:22 +08:00
}
/**
* 订单取消
* @param string id
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function orderCancel(id) {
2023-05-23 17:37:49 +08:00
return request.post('front/order/cancel', {
2023-05-15 10:12:22 +08:00
id: id
}, {}, 1);
}
/**
* 删除已完成订单
* @param string uni
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function orderDel(uni) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/del', {
2023-05-15 10:12:22 +08:00
id: uni
}, {}, 1);
}
/**
* 订单详情
2023-05-23 18:08:01 +08:00
* @param string uni
2023-05-15 10:12:22 +08:00
*/
export function getOrderDetail(uni) {
2023-05-23 17:37:49 +08:00
return request.get('front/order/detail/' + uni);
2023-05-15 10:12:22 +08:00
}
/**
* 再次下单
* @param string uni
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function orderAgain(uni) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/again', {
2023-05-15 10:12:22 +08:00
orderNo: uni
});
}
/**
* 订单收货
* @param string uni
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function orderTake(uni) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/take', {
2023-05-15 10:12:22 +08:00
id: uni
}, {}, 1);
}
/**
* 订单查询物流信息
* @returns {*}
*/
export function express(uni) {
2023-05-24 17:08:06 +08:00
return request.get("front/order/express/" + uni);
2023-05-15 10:12:22 +08:00
}
/**
* 获取退款理由
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function ordeRefundReason() {
2023-05-24 17:08:06 +08:00
return request.get('front/order/refund/reason');
2023-05-15 10:12:22 +08:00
}
/**
* 订单退款审核
* @param object data
*/
export function orderRefundVerify(data) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/refund', data);
2023-05-15 10:12:22 +08:00
}
/**
* 订单确认获取订单详细信息
* @param string cartId
*/
export function orderConfirm(cartId, isNew, addAgain,secKill,combination,bargain) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/confirm', {
2023-05-15 10:12:22 +08:00
cartIds: cartId,
isNew: isNew,
addAgain: addAgain,
secKill: secKill,
combination:combination,
bargain:bargain
});
}
/**
* 获取当前金额能使用的优惠卷
* @param string price
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function getCouponsOrderPrice(preOrderNo) {
2023-05-24 17:08:06 +08:00
return request.get(`front/coupons/order/${preOrderNo}`)
2023-05-15 10:12:22 +08:00
}
/**
* 订单创建
* @param string key
* @param object data
2023-05-23 18:08:01 +08:00
*
2023-05-15 10:12:22 +08:00
*/
export function orderCreate(data) {
2023-05-24 17:08:06 +08:00
return request.post('front/order/create', data);
2023-05-15 10:12:22 +08:00
}
/**
* 计算订单金额
* @param key
* @param data
* @returns {*}
*/
export function postOrderComputed(data) {
2023-05-24 17:08:06 +08:00
return request.post("front/order/computed/price", data);
2023-05-15 10:12:22 +08:00
}
/**
* 将字符串 转base64
* @param object data
*/
export function qrcodeApi(data) {
2023-05-24 17:08:06 +08:00
return request.post('front/qrcode/str2base64', data, {}, 1);
2023-05-15 10:12:22 +08:00
}
/**
* 微信订单支付
* @param object data
*/
export function wechatOrderPay(data) {
2023-05-24 17:08:06 +08:00
return request.post('api/front/pay/payment', data);
2023-05-15 10:12:22 +08:00
}
/**
* 微信查询支付结果
* @param object data
*/
export function wechatQueryPayResult(data) {
2023-05-24 17:08:06 +08:00
return request.get('front/pay/queryPayResult?orderNo=' + data);
2023-05-15 10:12:22 +08:00
}
/**
* 申请退款商品详情
* @param object data
*/
export function applyRefund(orderId) {
2023-05-24 17:08:06 +08:00
return request.get(`front/order/apply/refund/${orderId}`);
2023-05-15 10:12:22 +08:00
}
/**
* 预下单
* @param object data
*/
export function preOrderApi(data) {
2023-05-23 17:37:49 +08:00
return request.post(`front/order/pre/order`, data);
2023-05-15 10:12:22 +08:00
}
/**
* 加载预下单
* @param object preOrderNo
*/
export function loadPreOrderApi(preOrderNo) {
2023-05-24 17:08:06 +08:00
return request.get(`front/order/load/pre/${preOrderNo}`);
2023-05-23 18:08:01 +08:00
}