创建订单
This commit is contained in:
@@ -56,12 +56,14 @@ export const RemoveShoppingCartItem = (params, loading?: boolean) => {
|
|||||||
/**
|
/**
|
||||||
* 创建订单
|
* 创建订单
|
||||||
* @param { Array } data - 商品id数组
|
* @param { Array } data - 商品id数组
|
||||||
|
* @param loading - 是否显示loading
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const CreateOrder = (data) => {
|
export const CreateOrder = (data, loading?: boolean) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/buyer/buyer/order/create',
|
url: '/buyer/buyer/order/create',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data,
|
||||||
|
loading
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,4 @@
|
|||||||
export const SCART_STATUS = {
|
export const SCART_STATUS = {
|
||||||
/** 正常 */
|
/** 正常 */
|
||||||
NORMAL: 1,
|
NORMAL: 1,
|
||||||
/** 下架 */
|
|
||||||
DISABLED: 0,
|
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { FormatBytes, FormatDate } from '@/utils/tools'
|
import { FormatBytes, FormatDate } from '@/utils/tools'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { CreateOrder } from '@/api/shoppingCart'
|
||||||
|
const router = useRouter()
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: {
|
list: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -57,7 +60,11 @@
|
|||||||
})
|
})
|
||||||
const totalAmount = computed(() => props.list.reduce((pre, cur) => pre + cur.amount, 0).toFixed(2))
|
const totalAmount = computed(() => props.list.reduce((pre, cur) => pre + cur.amount, 0).toFixed(2))
|
||||||
const handleCheckout = () => {
|
const handleCheckout = () => {
|
||||||
console.log('购买:', props.list)
|
const ids = props.list.map((v: any) => v.listingId)
|
||||||
|
console.log('购买:', ids)
|
||||||
|
CreateOrder(ids, true).then((res) => {
|
||||||
|
router.go(0)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<slot name="checkbox" />
|
<slot name="checkbox" />
|
||||||
{{ info.status }}
|
|
||||||
<img :src="info.cover" />
|
<img :src="info.cover" />
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="title">{{ info.title }}</div>
|
<div class="title">{{ info.title }}</div>
|
||||||
|
|||||||
@@ -51,12 +51,12 @@
|
|||||||
:show-date="!isMini"
|
:show-date="!isMini"
|
||||||
:show-remove="!isView"
|
:show-remove="!isView"
|
||||||
@remove="handleRemoveClick"
|
@remove="handleRemoveClick"
|
||||||
:disabled="v.status === SCART_STATUS.DISABLED"
|
:disabled="v.status !== SCART_STATUS.NORMAL"
|
||||||
>
|
>
|
||||||
<template #checkbox v-if="!isMini">
|
<template #checkbox v-if="!isMini">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
disabled
|
disabled
|
||||||
v-if="v.status === SCART_STATUS.DISABLED"
|
v-if="v.status !== SCART_STATUS.NORMAL"
|
||||||
style="opacity: 0; pointer-events: none"
|
style="opacity: 0; pointer-events: none"
|
||||||
/>
|
/>
|
||||||
<el-checkbox v-else v-model="v.checked" @change="handleSelectedChange" />
|
<el-checkbox v-else v-model="v.checked" @change="handleSelectedChange" />
|
||||||
|
|||||||
Reference in New Issue
Block a user