feat: 创建订单接口
This commit is contained in:
@@ -52,3 +52,16 @@ export const RemoveShoppingCartItem = (params, loading?: boolean) => {
|
|||||||
loading
|
loading
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建订单
|
||||||
|
* @param { Array } data - 商品id数组
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const CreateOrder = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/buyer/buyer/order/create',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export interface WardrobeItem {
|
export interface WardrobeItem {
|
||||||
buyerId: number
|
buyerId: number
|
||||||
categories: string[]
|
categories: string[]
|
||||||
@@ -14,14 +16,15 @@ export const fetchMyWardrobe = (data: WardrobeItem): Promise<ApiResponse> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderItem {
|
export interface OrderItem {
|
||||||
status: number
|
status: number // 0未支付 1已支付 2已取消 不穿查全部
|
||||||
page: number
|
page: number
|
||||||
size: number
|
size: number
|
||||||
}
|
}
|
||||||
export const fetchMyOrders = (data: OrderItem): Promise<ApiResponse> => {
|
export const fetchMyOrders = (data: OrderItem): Promise<ApiResponse> => {
|
||||||
return request({
|
return request({
|
||||||
url: '/buyer/buyer/order/page',
|
url: '/buyer/buyer/order/page',
|
||||||
method: 'post',
|
method: 'get',
|
||||||
data
|
params: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,8 +74,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, shallowRef } from 'vue'
|
import { computed, shallowRef, onMounted,ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { fetchMyOrders } from '@/api/user'
|
||||||
import ScItem from '@/views/shoppingCart/sc-item.vue'
|
import ScItem from '@/views/shoppingCart/sc-item.vue'
|
||||||
|
|
||||||
type OrderStatus = 'all' | 'paid' | 'unpaid' | 'cancelled'
|
type OrderStatus = 'all' | 'paid' | 'unpaid' | 'cancelled'
|
||||||
@@ -211,6 +212,20 @@ const getOrderActionLabel = (status: ActualOrderStatus) => {
|
|||||||
if (status === 'unpaid') return t('Wardrobe.orders.actions.completePayment')
|
if (status === 'unpaid') return t('Wardrobe.orders.actions.completePayment')
|
||||||
return t('Wardrobe.orders.actions.buyAgain')
|
return t('Wardrobe.orders.actions.buyAgain')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const orderParams =ref({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
status: ''
|
||||||
|
})
|
||||||
|
const fetchAllOrders = () => {
|
||||||
|
fetchMyOrders(orderParams.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchAllOrders()
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user