暂存
This commit is contained in:
parent
8b40389be5
commit
40412a745b
|
@ -101,7 +101,7 @@
|
|||
:total="total" />
|
||||
</div>
|
||||
<!-- 编辑/详情表单 -->
|
||||
<el-dialog v-model="DialogVisible" :title="title">
|
||||
<!-- <el-dialog v-model="DialogVisible" :title="title">
|
||||
<el-form label-width="100px" :disabled="disabled">
|
||||
<el-form-item label="商品编号">
|
||||
<el-input v-model="editForm.id" disabled></el-input>
|
||||
|
@ -183,7 +183,7 @@
|
|||
<el-button type="primary" @click="saveEdit" :disabled="disabled">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-dialog> -->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
@ -198,23 +198,25 @@ const searchParams: any = ref({ //封装分页
|
|||
sortField: "id", //根据ID分类
|
||||
sortOrder: "descend" //降序
|
||||
})
|
||||
const fileSimple = ref()
|
||||
const tableData : any= ref([]);
|
||||
const appointmentDateArr = ref([])
|
||||
const disabled = ref(true)
|
||||
const title = ref('') //表单名字
|
||||
const productName = ref('');
|
||||
const DialogVisible = ref(false);
|
||||
const state = ref(''); //根据商品上架状态select栏
|
||||
const tableData : any= ref([]);
|
||||
const editForm : any = ref({});
|
||||
const reload : any = inject("reload") //页面重新刷新
|
||||
const uploadProductImg : any = ref() //图片上传的ref绑定
|
||||
const uploadProductDetail : any = ref() //图片上传的ref绑定
|
||||
const typeList: any = ref([
|
||||
{
|
||||
value1: '',
|
||||
label: ''
|
||||
}
|
||||
])
|
||||
// const fileSimple = ref()
|
||||
// const uploadProductImg : any = ref() //图片上传的ref绑定
|
||||
// const uploadProductDetail : any = ref() //图片上传的ref绑定
|
||||
|
||||
// const typeList: any = ref([
|
||||
// {
|
||||
// value1: '',
|
||||
// label: ''
|
||||
// }
|
||||
// ])
|
||||
onMounted(() => { //页面加载时获取商品列表和分类页表
|
||||
getProductList()
|
||||
})
|
||||
|
@ -225,8 +227,7 @@ const getProductList = async () => {
|
|||
if (res.data.code === 1) {
|
||||
tableData.value = res.data.data.records;
|
||||
total.value = parseInt(res.data.data.total) //总数据量,用于分页
|
||||
console.log(tableData.value);
|
||||
|
||||
console.log('时间--->',tableData.value);
|
||||
} else {
|
||||
ElMessage({
|
||||
message: '获取数据失败',
|
||||
|
@ -294,46 +295,46 @@ const reset = () => {
|
|||
reload()
|
||||
};
|
||||
//上传图片移除 --逻辑上移除
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
console.log(uploadFile, uploadFiles)
|
||||
}
|
||||
const Exceed_ProductImg: UploadProps['onExceed'] = (files , flag) => { //覆盖商品照片
|
||||
uploadProductImg.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
uploadProductImg.value!.handleStart(file)
|
||||
}
|
||||
const Exceed_ProductDetail: UploadProps['onExceed'] = (files) => { //覆盖商品详情图片
|
||||
uploadProductDetail.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
uploadProductDetail.value!.handleStart(file)
|
||||
}
|
||||
//将 商品类别 赋值到表格里
|
||||
const loadForm = (value: any, flag: number) => {
|
||||
flag ? editForm.value.type = value : editForm.value.festivalOrder = value //三元运算符 flag=1 是关于"商品类别"选项的值 flag=0 是关于“是否为节日限定”选项的值
|
||||
}
|
||||
// const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
// console.log(uploadFile, uploadFiles)
|
||||
// }
|
||||
// const Exceed_ProductImg: UploadProps['onExceed'] = (files , flag) => { //覆盖商品照片
|
||||
// uploadProductImg.value!.clearFiles()
|
||||
// const file = files[0] as UploadRawFile
|
||||
// file.uid = genFileId()
|
||||
// uploadProductImg.value!.handleStart(file)
|
||||
// }
|
||||
// const Exceed_ProductDetail: UploadProps['onExceed'] = (files) => { //覆盖商品详情图片
|
||||
// uploadProductDetail.value!.clearFiles()
|
||||
// const file = files[0] as UploadRawFile
|
||||
// file.uid = genFileId()
|
||||
// uploadProductDetail.value!.handleStart(file)
|
||||
// }
|
||||
// //将 商品类别 赋值到表格里
|
||||
// const loadForm = (value: any, flag: number) => {
|
||||
// flag ? editForm.value.type = value : editForm.value.festivalOrder = value //三元运算符 flag=1 是关于"商品类别"选项的值 flag=0 是关于“是否为节日限定”选项的值
|
||||
// }
|
||||
//图片上传请求 此请求只要选择了图片,就会默认上传
|
||||
const handleChange = async (file: any, flag: number) => {
|
||||
fileSimple.value = file
|
||||
let formData = new FormData() //这一步很重要 创建一个FormData对象
|
||||
formData.append("file", fileSimple.value.raw) //fileSimple.value.raw 才是文件主体 将其以文件的格式插入formData
|
||||
const res = await myAxios({ //编写请求,与以前的请求不同,这一次要指定好头部类型和文件类型
|
||||
url: '/file/upload/server/not_login',
|
||||
method: 'post',
|
||||
headers: {
|
||||
'content-Type': 'multipart/form-data'
|
||||
},
|
||||
data: {
|
||||
biz: "test",
|
||||
file: formData.get("file") // 取出formData对象中的file
|
||||
}
|
||||
})
|
||||
if (res.data.code === 1) {
|
||||
//三元运算 当flag为0时,赋值给商品图片 flag为1时,赋值给详情图片
|
||||
flag ? editForm.value.detailImg = res.data.data : editForm.value.goodImg = res.data.data
|
||||
}
|
||||
}
|
||||
// const handleChange = async (file: any, flag: number) => {
|
||||
// fileSimple.value = file
|
||||
// let formData = new FormData() //这一步很重要 创建一个FormData对象
|
||||
// formData.append("file", fileSimple.value.raw) //fileSimple.value.raw 才是文件主体 将其以文件的格式插入formData
|
||||
// const res = await myAxios({ //编写请求,与以前的请求不同,这一次要指定好头部类型和文件类型
|
||||
// url: '/file/upload/server/not_login',
|
||||
// method: 'post',
|
||||
// headers: {
|
||||
// 'content-Type': 'multipart/form-data'
|
||||
// },
|
||||
// data: {
|
||||
// biz: "test",
|
||||
// file: formData.get("file") // 取出formData对象中的file
|
||||
// }
|
||||
// })
|
||||
// if (res.data.code === 1) {
|
||||
// //三元运算 当flag为0时,赋值给商品图片 flag为1时,赋值给详情图片
|
||||
// flag ? editForm.value.detailImg = res.data.data : editForm.value.goodImg = res.data.data
|
||||
// }
|
||||
// }
|
||||
const onSearch = (data : String)=>{ //搜索按钮方法
|
||||
searchParams.value.name = data
|
||||
searchParams.value.current = 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user