后台管理功能进行一些优化
This commit is contained in:
@@ -153,15 +153,42 @@
|
||||
<div class="coupon-time">
|
||||
{{ coupon.startTime }} 至 {{ coupon.endTime }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="coupon-select" v-if="selectedCoupon && selectedCoupon.id === coupon.id">
|
||||
<CheckCircleOutlined />
|
||||
<div class="coupon-select" v-if="selectedCoupon && selectedCoupon.id === coupon.id">
|
||||
<CheckCircleOutlined />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
<!-- 美甲师选择弹窗 -->
|
||||
<a-modal
|
||||
v-model:visible="showArtistModal"
|
||||
title="选择美甲师"
|
||||
width="90%"
|
||||
@ok="selectArtistAndCheckout"
|
||||
@cancel="closeArtistModal"
|
||||
>
|
||||
<div class="artist-modal-content">
|
||||
<a-empty v-if="availableArtists.length === 0" description="暂无可用美甲师" />
|
||||
<div v-else class="artist-list">
|
||||
<a-radio-group v-model:value="selectedArtist" name="artist">
|
||||
<a-radio
|
||||
v-for="artist in availableArtists"
|
||||
:key="artist.id"
|
||||
:value="artist"
|
||||
class="artist-item"
|
||||
>
|
||||
<div class="artist-info">
|
||||
<span class="artist-name">{{ artist.name }}</span>
|
||||
</div>
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -397,6 +424,26 @@ const selectCoupon = (coupon: UserCoupon) => {
|
||||
showCouponModal.value = false
|
||||
}
|
||||
|
||||
// 美甲师选择相关状态
|
||||
const showArtistModal = ref(false)
|
||||
const selectedArtist = ref<{id: number, name: string} | null>(null)
|
||||
const availableArtists = ref<{id: number, name: string}[]>([])
|
||||
|
||||
// 加载可用美甲师
|
||||
const loadAvailableArtists = async () => {
|
||||
try {
|
||||
// 这里需要根据商品ID获取可用的美甲师
|
||||
// 暂时使用模拟数据
|
||||
availableArtists.value = [
|
||||
{ id: 1, name: '美甲师1' },
|
||||
{ id: 2, name: '美甲师2' },
|
||||
{ id: 3, name: '美甲师3' }
|
||||
]
|
||||
} catch (error) {
|
||||
console.error('获取美甲师列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理结算
|
||||
const handleCheckout = async () => {
|
||||
const selectedItems = cartItems.value.filter(item => item.selected)
|
||||
@@ -405,17 +452,39 @@ const handleCheckout = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
// 加载可用美甲师
|
||||
await loadAvailableArtists()
|
||||
|
||||
// 显示美甲师选择弹窗
|
||||
showArtistModal.value = true
|
||||
}
|
||||
|
||||
// 选择美甲师并创建订单
|
||||
const selectArtistAndCheckout = async () => {
|
||||
if (!selectedArtist.value) {
|
||||
message.warning('请选择美甲师')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const order = await orderApi.createOrder({
|
||||
couponId: selectedCoupon.value ? selectedCoupon.value.id : undefined
|
||||
couponId: selectedCoupon.value ? selectedCoupon.value.id : undefined,
|
||||
artistId: selectedArtist.value.id
|
||||
})
|
||||
message.success('订单创建成功')
|
||||
showArtistModal.value = false
|
||||
router.push('/profile')
|
||||
} catch (error) {
|
||||
message.error('创建订单失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭美甲师选择弹窗
|
||||
const closeArtistModal = () => {
|
||||
showArtistModal.value = false
|
||||
selectedArtist.value = null
|
||||
}
|
||||
|
||||
// 监听选中商品变化,重新加载可用优惠券
|
||||
watch(
|
||||
() => cartItems.value.map(item => ({ id: item.id, selected: item.selected, quantity: item.quantity })),
|
||||
@@ -745,4 +814,37 @@ onMounted(() => {
|
||||
font-size: 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 美甲师选择弹窗样式 */
|
||||
.artist-modal-content {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.artist-list {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.artist-item {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.artist-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.artist-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.artist-name {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user