解决前面的bug

This commit is contained in:
yuanteng 2024-11-06 01:12:38 +08:00
parent 6bd1d4f49f
commit 771cd1ede2

View File

@ -1,10 +1,10 @@
<template> <template>
<div> <div>
<el-input style="width: 200px; height: 30px; margin-right: 10px;" suffix-icon="Search" placeholder="请输入商品名称" <el-input style="width: 200px; height: 30px; margin-right: 10px;" suffix-icon="Search" placeholder="请输入商品名称"
v-model="id"></el-input> v-model="id"></el-input>
<el-button class="ml-5" type="primary" @click="load" style="height: 25px;">搜索</el-button> <el-button class="ml-5" type="primary" @click="load" style="height: 25px;">搜索</el-button>
<el-button type="warning" @click="reset" style="height:25px">重置</el-button> <el-button type="warning" @click="reset" style="height:25px">重置</el-button>
</div> </div>
<div style="margin: 15px 0"> <div style="margin: 15px 0">
<el-popconfirm class="ml-5" confirm-button-text='确定' cancel-button-text='取消' icon="InfoFilled" icon-color="red" <el-popconfirm class="ml-5" confirm-button-text='确定' cancel-button-text='取消' icon="InfoFilled" icon-color="red"
title="您确定批量删除这些数据吗?" @confirm="delBatch" width=180> title="您确定批量删除这些数据吗?" @confirm="delBatch" width=180>
@ -52,116 +52,151 @@
:small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper" :small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper"
:total="total" /> :total="total" />
</div> </div>
<!-- <el-dialog v-model="dialogFormVisible" title="Shipping address" width="500">--> <!-- <el-dialog v-model="dialogFormVisible" title="Shipping address" width="500">-->
<!-- <el-form :model="">--> <!-- <el-form :model="">-->
<!-- <el-form-item label="快递单号" :label-width="formLabelWidth">--> <!-- <el-form-item label="快递单号" :label-width="formLabelWidth">-->
<!-- <el-input v-model=" " autocomplete="off" />--> <!-- <el-input v-model=" " autocomplete="off" />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-form>--> <!-- </el-form>-->
<!-- <template #footer>--> <!-- <template #footer>-->
<!-- <div class="dialog-footer">--> <!-- <div class="dialog-footer">-->
<!-- <el-button @click="dialogFormVisible = false">取消</el-button>--> <!-- <el-button @click="dialogFormVisible = false">取消</el-button>-->
<!-- <el-button type="primary" @click="dialogFormVisible = false">--> <!-- <el-button type="primary" @click="dialogFormVisible = false">-->
<!-- 确定--> <!-- 确定-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- </div>--> <!-- </div>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-dialog>--> <!-- </el-dialog>-->
<!--</template>--> </template>
<!--<script lang="ts" setup>--> <script lang="ts" setup>
<!--import {ref} from "vue";--> import {ref,onMounted} from "vue";
<!--import myAxios from "@/api/myAxios";--> import myAxios from "@/api/myAxios";
<!--import {ElMessage} from "element-plus";--> import {ElMessage} from "element-plus";
<!--const tableData : any= ref([]);--> const tableData : any= ref([]);
<!--const total = ref(0);--> const total = ref(0);
<!--// const title = ref('')--> const num = ref(0)
<!--// const editForm : any = ref({});--> const dialogFormVisible = ref(false)
<!--// const DialogVisible = ref(true);--> const formLabelWidth = '140px'
<!--const dialogFormVisible = ref(false)--> onMounted(()=>{
<!--const formLabelWidth = '140px'--> getOrderList()
<!--const searchParams: any = ref({ //--> })
<!-- current: 1, //-->
<!-- pageSize: 5 //-->
<!--})-->
<!--const handleSizeChange = (newSize: any) => {-->
<!-- searchParams.value.pageSize = newSize //-->
<!-- getOrderList()-->
<!--}-->
<!--const handleCurrentChange = (Current: any) => {-->
<!-- searchParams.value.current = Current-->
<!-- getOrderList()-->
<!--}-->
<!--const handleSelectionChange = (row: any) => {-->
<!-- id.value = JSON.parse(JSON.stringify(row));-->
<!--}-->
<!--const getOrderList = async () => {-->
<!-- try {-->
<!-- const res = await myAxios.post('', { ...searchParams.value });-->
<!-- if (res.data.code === 1) {-->
<!-- tableData.value = res.data.data.records;-->
<!-- total.value = parseInt(res.data.data.total)-->
<!-- } else {-->
<!-- ElMessage({-->
<!-- message: '获取数据失败',-->
<!-- });-->
<!-- }-->
<!-- } catch (error) {-->
<!-- ElMessage({-->
<!-- message: '发生错误',-->
<!-- });-->
<!-- }-->
<!--}-->
<!--const orderList = ref({-->
<!--id:'',-->
<!--userId:'',-->
<!--addressSnapshot:{-->
<!--name:'',-->
<!--phone:'',-->
<!--region:'',-->
<!--detailAddress:''-->
<!--},-->
<!--couponSnapshot:{-->
<!--name:'',-->
<!--conditionAmount:''-->
<!--},-->
<!--totalAmount:'',-->
<!--orderStatus:'',-->
<!--createTime:'',-->
<!--updateTime:'',-->
<!--isDelete:'',-->
<!--orderNumber:''-->
<!--})-->
<!--const delBatch =()=>{-->
<!-- //-->
<!--}-->
<!--//-->
<!--const shipments = (index: number, row: any , flag : number) => {-->
<!--};--> const searchParams: any = ref({ //
<!--//--> current: 1, //
<!--const ReviseOrView = (index: number, row: any , flag : number) => {--> pageSize: 5 //
})
const handleSizeChange = (newSize: any) => {
searchParams.value.pageSize = newSize //
getOrderList()
}
const handleCurrentChange = (Current: any) => {
searchParams.value.current = Current
getOrderList()
}
const handleSelectionChange = (row: any) => {
// id.value = JSON.parse(JSON.stringify(row));
}
const getOrderList = async () => {
try {
const res = await myAxios.post('/order/list/page', { ...searchParams.value });
// console.log(res)
if (res.data.code === 1) {
tableData.value = res.data.data.records
total.value = parseInt(res.data.data.total)
for(let key in tableData.value) {
num.value = parseInt(key)
const resOrderDetail = await myAxios.post('/order/list/item',{id:tableData.value[key].id})
if( resOrderDetail.data.code === 1 ) {
tableData.value.goodSnapshot= resOrderDetail.data.data[key].goodSnapshot
tableData.value.quantity = resOrderDetail.data.data[key].quality
// console.log(resOrderDetail.data.data[0].goodSnapshot.name)
console.log( tableData.value.goodSnapshot.name)
console.log( resOrderDetail.data.data[key].quantity)
}
}
} else {
ElMessage({
message: '获取数据失败',
});
}
} catch (error) {
ElMessage({
message: '发生错误',
});
}
}
<!--};-->
<!--const deleteProduct = async (index: number) => {-->
<!-- console.log(typeof index)-->
<!-- const res = await myAxios.post('/goods/delete', { id: index })-->
<!-- console.log(res)-->
<!-- if (res.data.code === 1) {-->
<!-- ElMessage({-->
<!-- type: 'success',-->
<!-- message: '删除成功',-->
<!-- })-->
<!-- getOrderList()-->
<!-- }-->
<!--}-->
<!--const reset = () => {-->
<!-- id.value = '';-->
<!--};--> // const getItemList = async (id: number) => {
<!--const load =()=>{}--> // try {
<!--</script>--> // const res = await myAxios.post('/order/list/item', { id:tableData.value[key].id});
// console.log(res)
// if (res.data.code === 1) {
// tableData.value = res.data.data.records;
// total.value = parseInt(res.data.data.total)
// } else {
// ElMessage({
// message: '',
// });
// }
// } catch (error) {
// ElMessage({
// message: '',
// });
// }
// }
<!--<style lang="scss" scoped>--> // const orderList = ref({
// id:'',
// userId:'',
// addressSnapshot:{
// name:'',
// phone:'',
// region:'',
// detailAddress:''
// },
// couponSnapshot:{
// name:'',
// conditionAmount:''
// },
// totalAmount:'',
// orderStatus:'',
// createTime:'',
// updateTime:'',
// isDelete:'',
// orderNumber:''
// })
const delBatch =()=>{
//
}
//
const shipments = (index: number, row: any , flag : number) => {
<!--</style> --> };
//
const ReviseOrView = (index: number, row: any , flag : number) => {
};
const deleteProduct = async (index: number) => {
console.log(typeof index)
const res = await myAxios.post('/goods/delete', { id: index })
console.log(res)
if (res.data.code === 1) {
ElMessage({
type: 'success',
message: '删除成功',
})
getOrderList()
}
}
const reset = () => {
id.value = '';
};
const load =()=>{}
</script>
<style lang="scss" scoped>
</style>