184 lines
4.4 KiB
JavaScript
184 lines
4.4 KiB
JavaScript
import HttpRequest from "../system/request";
|
|
|
|
/**
|
|
* 立即购买
|
|
* @param {Number} product_id 商品id
|
|
* @returns {Promise} 立即购买
|
|
*/
|
|
export const pay_by_order = async (product_id) => {
|
|
const res = await HttpRequest.post('pay_by_order', {
|
|
product_id: product_id
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
});
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 创建订单
|
|
* @param {Number} product_id 商品id
|
|
* @param {Number} address_id 地址id
|
|
* @param {Number} coupon_id 优惠券id
|
|
* @returns {Promise} 创建订单
|
|
*/
|
|
export const pay_by_create_order = async (product_id, address_id, coupon_id) => {
|
|
const res = await HttpRequest.post('pay_by_create_order', {
|
|
product_id: product_id,
|
|
address_id: address_id,
|
|
coupon_id: coupon_id
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 支付成功
|
|
* @param {String} order_no 订单号
|
|
* @returns {Promise} 支付成功
|
|
*/
|
|
export const pay_by_pay = async (order_no) => {
|
|
const res = await HttpRequest.post('order_pay_success', {
|
|
order_no: order_no
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 获取订单列表
|
|
* @param {Number} status 订单状态
|
|
* @param {Number} page 页码
|
|
* @param {Number} page_size 每页条数
|
|
* @param {String} title 商品标题搜索关键词
|
|
* @returns {Promise} 获取订单列表
|
|
*/
|
|
export const get_order_list = async (status, page, page_size, title = "") => {
|
|
// 接收参数
|
|
const res = await HttpRequest.post('get_order_list', {
|
|
status: status,
|
|
keyword: title,
|
|
page: page,
|
|
limit: page_size
|
|
});
|
|
return res.data;
|
|
}
|
|
/**
|
|
* 订单收货
|
|
* @param {String} order_no 订单号
|
|
* @returns {Promise} 订单收货结果
|
|
*/
|
|
export const order_receive = async (order_no) => {
|
|
const res = await HttpRequest.post('order_receive', {
|
|
order_no: order_no
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 申请售后
|
|
* @param {String} order_no 订单号
|
|
* @param {String} extend_info 扩展信息
|
|
* @returns {Promise} 申请售后结果
|
|
*/
|
|
export const apply_refund = async (order_no, extend_info = "") => {
|
|
const res = await HttpRequest.post('apply_refund', {
|
|
order_no: order_no,
|
|
extend_info: extend_info
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 取消售后
|
|
* @param {String} order_no 订单号
|
|
* @returns {Promise} 取消售后结果
|
|
*/
|
|
export const cancel_refund = async (order_no) => {
|
|
const res = await HttpRequest.post('cancel_refund', {
|
|
order_no: order_no
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 删除订单
|
|
* @param {String} order_no 订单号
|
|
* @returns {Promise} 删除订单结果
|
|
*/
|
|
export const delete_order = async (order_no) => {
|
|
const res = await HttpRequest.post('delete_order', {
|
|
order_no: order_no
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 获取订单详情
|
|
* @param {String} order_no 订单号
|
|
* @returns {Promise} 获取订单详情
|
|
*/
|
|
export const get_order_detail = async (order_no) => {
|
|
const res = await HttpRequest.post('get_order_detail', {
|
|
order_no: order_no
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 申请发票
|
|
* @param {String} order_no 订单号
|
|
* @param {String} invoice_title 发票抬头
|
|
* @param {String} invoice_content 发票内容
|
|
* @param {Number} invoice_type 发票类型
|
|
* @param {String} user_email 用户邮箱
|
|
* @returns {Promise} 申请发票结果
|
|
*/
|
|
export const apply_invoice = async (order_no, invoice_title, invoice_content, invoice_type, user_email) => {
|
|
const res = await HttpRequest.post('apply_invoice', {
|
|
order_no: order_no,
|
|
invoice_title: invoice_title,
|
|
invoice_content: invoice_content,
|
|
invoice_type: invoice_type,
|
|
user_email: user_email
|
|
});
|
|
if (res.status == 1) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 获取订单统计
|
|
* @returns {Promise} 获取订单统计
|
|
*/
|
|
export const get_order_statistics = async () => {
|
|
const res = await HttpRequest.post('get_order_statistics');
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
} |