54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
import request from '@/utils/request.js';
|
|
import { APP_TYPE } from '@/utils/env.js';
|
|
|
|
export const orderApi = {
|
|
getList(identifier, page, page_size, payment_status) {
|
|
const data = { identifier, page, page_size };
|
|
if (payment_status !== undefined && payment_status !== null) {
|
|
data.payment_status = payment_status;
|
|
}
|
|
return request({
|
|
url: '/api/c/v1/orders',
|
|
method: 'GET',
|
|
data
|
|
});
|
|
},
|
|
|
|
getDetail(id) {
|
|
return request({
|
|
url: `/api/c/v1/orders/${id}`,
|
|
method: 'GET'
|
|
});
|
|
},
|
|
|
|
create(identifier, package_ids, payment_method) {
|
|
const data = { identifier, package_ids };
|
|
if (payment_method === 'alipay') {
|
|
data.payment_method = payment_method;
|
|
} else {
|
|
data.app_type = APP_TYPE;
|
|
}
|
|
|
|
return request({
|
|
url: '/api/c/v1/orders/create',
|
|
method: 'POST',
|
|
data
|
|
});
|
|
},
|
|
|
|
pay(order_id, payment_method, password) {
|
|
const data = { payment_method };
|
|
if (payment_method === 'wechat') {
|
|
data.app_type = APP_TYPE;
|
|
}
|
|
if (password) {
|
|
data.password = password;
|
|
}
|
|
return request({
|
|
url: `/api/c/v1/orders/${order_id}/pay`,
|
|
method: 'POST',
|
|
data
|
|
});
|
|
}
|
|
};
|