mall-app-t/peach/api/trade/order.js

67 lines
1.3 KiB
JavaScript

import request from '@/peach/request'
const OrderUtil = {
// 获取订单列表
getOrderPage: (data) => {
for (let key in data) {
if (!data[key]) {
delete data[key]
}
}
let temp = JSON.parse(JSON.stringify(data))
if (temp.createTime.length > 0) {
temp['createTime[0]'] = data.createTime[0] + ' 00:00:00'
temp['createTime[1]'] = data.createTime[1] + ' 00:00:00'
}
delete temp.createTime
const queryString = Object.keys(temp)
.map((key) => encodeURIComponent(key) + '=' + temp[key])
.join('&')
return request({
url: `/trade/order/page?${queryString}`,
method: 'GET',
})
},
// 订单详情
getOrderDetail: (data) => {
return request({
url: '/trade/order/get-detail',
method: 'GET',
params: data,
})
},
// 商品核销
orderVerification: (data) => {
return request({
url: '/trade/order/verify-code',
method: 'POST',
data: data,
})
},
// 完成订单
orderComplete: (data) => {
return request({
url: '/trade/order/completed-order',
method: 'POST',
data: data,
})
},
// 订单商品评论
orderComment: (id) => {
return request({
url: '/product/comment/get-by-order-id/' + id,
method: 'GET',
})
},
}
export default OrderUtil