|
@@ -13,6 +13,12 @@
|
|
|
<UploadImg v-model="row.picUrl" height="50px" width="50px" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column v-if="productType !== '0'" align="center" label="文件" min-width="90">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button v-if="row?.extend?.fileUrls?.length" type="primary" link @click.stop="handleUpload(row)">已上传</el-button>
|
|
|
+ <el-button v-else size="small" plain @click="handleUpload(row)">上传文件</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<template v-if="formData!.specType && !isBatch">
|
|
|
<!-- 根据商品属性动态添加 -->
|
|
|
<el-table-column
|
|
@@ -157,6 +163,12 @@
|
|
|
/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column v-if="productType !== '0'" align="center" label="文件" min-width="90">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button v-if="row?.extend?.fileUrls?.length" type="primary" link @click.stop="handleUpload(row)">已上传</el-button>
|
|
|
+ <div v-else>未上传</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<template v-if="formData!.specType && !isBatch">
|
|
|
<!-- 根据商品属性动态添加 -->
|
|
|
<el-table-column
|
|
@@ -281,7 +293,23 @@
|
|
|
<!-- 方便扩展每个活动配置的属性不一样 -->
|
|
|
<slot name="extension"></slot>
|
|
|
</el-table>
|
|
|
+
|
|
|
+ <Dialog title="文件上传" v-model="dialogVisible">
|
|
|
+ <UploadFile
|
|
|
+ v-model="fileUrl"
|
|
|
+ :file-type="['pdf', 'doc', 'docx', 'ppt']"
|
|
|
+ :limit="1"
|
|
|
+ :drag="true"
|
|
|
+ class="min-w-80px"
|
|
|
+ @clear="fileUrl = ''"
|
|
|
+ />
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="handleUploadSubmit" type="primary">确 定</el-button>
|
|
|
+ <el-button @click="dialogVisible = false, fileUrl = ''">取 消</el-button>
|
|
|
+ </template>
|
|
|
+ </Dialog>
|
|
|
</template>
|
|
|
+
|
|
|
<script lang="ts" setup>
|
|
|
import { PropType, Ref } from 'vue'
|
|
|
import { copyValueToTarget, formatToFraction } from '@/utils'
|
|
@@ -310,6 +338,7 @@ const props = defineProps({
|
|
|
type: Array as PropType<RuleConfig[]>,
|
|
|
default: () => []
|
|
|
},
|
|
|
+ productType: propTypes.string.def(''), // 商品类型
|
|
|
isBatch: propTypes.bool.def(false), // 是否作为批量操作组件
|
|
|
isDetail: propTypes.bool.def(false), // 是否作为 sku 详情组件
|
|
|
isComponent: propTypes.bool.def(false), // 是否作为 sku 选择组件
|
|
@@ -324,6 +353,9 @@ const skuList = ref<Sku[]>([
|
|
|
barCode: '', // 商品条码
|
|
|
picUrl: '', // 图片地址
|
|
|
stock: 0, // 库存
|
|
|
+ extend: {
|
|
|
+ fileUrls: [] // 文件地址
|
|
|
+ },
|
|
|
weight: 0, // 商品重量
|
|
|
volume: 0, // 商品体积
|
|
|
firstBrokeragePrice: 0, // 一级分销的佣金
|
|
@@ -339,6 +371,22 @@ const imagePreview = (imgUrl: string) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+// 文件上传
|
|
|
+const dialogVisible = ref(false)
|
|
|
+const fileUrl = ref('')
|
|
|
+const itemData = ref({})
|
|
|
+const handleUpload = (row) => {
|
|
|
+ itemData.value = row
|
|
|
+ if (row.extend.fileUrls?.length) fileUrl.value = row.extend.fileUrls[0]
|
|
|
+ dialogVisible.value = true
|
|
|
+}
|
|
|
+const handleUploadSubmit = () => {
|
|
|
+ if (!fileUrl.value) return message.warning('请上传文件')
|
|
|
+ itemData.value.extend.fileUrls = [fileUrl.value]
|
|
|
+ dialogVisible.value = false
|
|
|
+ fileUrl.value = ''
|
|
|
+}
|
|
|
+
|
|
|
/** 批量添加 */
|
|
|
const batchAdd = () => {
|
|
|
validateProperty()
|
|
@@ -457,6 +505,9 @@ const generateTableData = (propertyList: any[]) => {
|
|
|
picUrl: '',
|
|
|
stock: 0,
|
|
|
weight: 0,
|
|
|
+ extend: {
|
|
|
+ fileUrls: [] // 文件地址
|
|
|
+ },
|
|
|
volume: 0,
|
|
|
firstBrokeragePrice: 0,
|
|
|
secondBrokeragePrice: 0
|
|
@@ -530,6 +581,9 @@ watch(
|
|
|
costPrice: 0,
|
|
|
barCode: '',
|
|
|
picUrl: '',
|
|
|
+ extend: {
|
|
|
+ fileUrls: [] // 文件地址
|
|
|
+ },
|
|
|
stock: 0,
|
|
|
weight: 0,
|
|
|
volume: 0,
|