|
@@ -24,6 +24,12 @@
|
|
|
<template #spuName="{ item }">
|
|
|
<span class="color-primary cursor-pointer" @click="handleToGoodsDetail(item)">{{ item.spuName }}</span>
|
|
|
</template>
|
|
|
+ <template #actions="{ item }">
|
|
|
+ <div v-if="[10, 20, 30].includes(order.status) && item.extend && item.extend.fileUrls && item.extend.fileUrls.length > 0">
|
|
|
+ <v-btn variant="text" color="primary" prepend-icon="mdi-eye-outline" @click="previewFile(item.extend.fileUrls[0])">预览</v-btn>
|
|
|
+ <v-btn variant="text" color="primary" prepend-icon="mdi-arrow-down-bold-outline" @click="handleDownload(item.extend.fileUrls[0], item.spuName)">下载</v-btn>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</CtTable>
|
|
|
<div class="text-end color-primary mr-3 mt-5 font-size-20">
|
|
|
共{{ order.productCount }}件商品,合计:¥{{ fen2yuan(order.payPrice) }}
|
|
@@ -64,12 +70,13 @@
|
|
|
|
|
|
<script setup>
|
|
|
defineOptions({ name: 'mall-user-order-detail'})
|
|
|
-import { ref, onMounted } from 'vue'
|
|
|
+import { ref, onMounted, computed } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { getMallOrderDetail } from '@/api/mall/user'
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
import { timesTampChange } from '@/utils/date'
|
|
|
import { fen2yuan, formatOrderStatusDescription } from '@/hooks/web/useGoods'
|
|
|
+import { getBlob, saveAs, previewFile } from '@/utils'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const { id } = router.currentRoute.value.params
|
|
@@ -80,7 +87,8 @@ const headers = [
|
|
|
{ title: '商品名称', key: 'spuName', sortable: false },
|
|
|
{ title: '规格', key: 'contactAddress', sortable: false, value: item => item.properties.map((property) => property.valueName).join(' ') },
|
|
|
{ title: '单价', key: 'price', sortable: false, value: item => '¥' + fen2yuan(item.price) },
|
|
|
- { title: '数量', key: 'count', sortable: false }
|
|
|
+ { title: '数量', key: 'count', sortable: false },
|
|
|
+ { title: '操作', sortable: false, key: 'actions' }
|
|
|
]
|
|
|
|
|
|
onMounted(async () =>{
|
|
@@ -95,6 +103,17 @@ onMounted(async () =>{
|
|
|
order.value = data
|
|
|
})
|
|
|
|
|
|
+const showBanner = computed(() => (order) => {
|
|
|
+ return order?.items?.length ? order.items.every(k => k.spuType === '0') : false
|
|
|
+})
|
|
|
+
|
|
|
+// 下载附件
|
|
|
+const handleDownload = (url, name) => {
|
|
|
+ getBlob(url).then(blob => {
|
|
|
+ saveAs(blob, name)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// 跳转商品详情
|
|
|
const handleToGoodsDetail = (item) => {
|
|
|
window.open(`/mall/goodsDetail/${item.spuId}`)
|