解决前面的bug

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

View File

@ -1,167 +1,202 @@
<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 style="margin: 15px 0">
<el-popconfirm class="ml-5" confirm-button-text='确定' cancel-button-text='取消' icon="InfoFilled" icon-color="red"
title="您确定批量删除这些数据吗?" @confirm="delBatch" width=180>
<template #reference>
<el-button style="height: 25px" class="ml-5" type="danger">批量删除 <el-icon style="margin-left: 5px;">
<Remove />
</el-icon></el-button>
</template>
</el-popconfirm>
</div> </div>
<el-table :data="tableData" border stripe header-cell-class-name="headerBg" <div style="margin: 15px 0">
:cell-style="{ 'text-align': 'center', 'font-size': '16px' }" @selection-change="handleSelectionChange" <el-popconfirm class="ml-5" confirm-button-text='确定' cancel-button-text='取消' icon="InfoFilled" icon-color="red"
:header-cell-style="{ 'text-align': 'center' }"> title="您确定批量删除这些数据吗?" @confirm="delBatch" width=180>
<el-table-column type="selection" width="55"></el-table-column> <template #reference>
<el-table-column prop="id" label="订单id" width="80"></el-table-column> <el-button style="height: 25px" class="ml-5" type="danger">批量删除 <el-icon style="margin-left: 5px;">
<el-table-column prop="goodSnapshot.name" label="商品名称"></el-table-column> <Remove />
<el-table-column prop="quantity" label="购买数量" width="180"></el-table-column> </el-icon></el-button>
<el-table-column prop="totalAmount" label="订单总金额"></el-table-column> </template>
<el-table-column prop="createTime" label="下单时间"></el-table-column> </el-popconfirm>
<el-table-column prop="orderNumber" label="快递单号"></el-table-column> </div>
<el-table-column prop="orderStatus" label="订单状态"></el-table-column> <el-table :data="tableData" border stripe header-cell-class-name="headerBg"
<el-table-column label="操作" width="250px"> :cell-style="{ 'text-align': 'center', 'font-size': '16px' }" @selection-change="handleSelectionChange"
<template #default="scope"> :header-cell-style="{ 'text-align': 'center' }">
<el-button size="small" @click="ReviseOrView(scope.$index, scope.row , 0)"> <el-table-column type="selection" width="55"></el-table-column>
编辑 <el-table-column prop="id" label="订单id" width="80"></el-table-column>
</el-button> <el-table-column prop="goodSnapshot.name" label="商品名称"></el-table-column>
<el-button plain @click="dialogFormVisible = true"> <el-table-column prop="quantity" label="购买数量" width="180"></el-table-column>
发货 <el-table-column prop="totalAmount" label="订单总金额"></el-table-column>
</el-button> <el-table-column prop="createTime" label="下单时间"></el-table-column>
<el-popconfirm class="ml-5" confirm-button-text='确定' cancel-button-text='取消' icon="InfoFilled" icon-color="red" <el-table-column prop="orderNumber" label="快递单号"></el-table-column>
title="是否确认删除" @confirm="deleteProduct(scope.row.id)" width=180> <el-table-column prop="orderStatus" label="订单状态"></el-table-column>
<template #reference> <el-table-column label="操作" width="250px">
<el-button class="ml-5" type="danger">取消订单</el-button> <template #default="scope">
</template> <el-button size="small" @click="ReviseOrView(scope.$index, scope.row , 0)">
</el-popconfirm> 编辑
<el-popconfirm confirm-button-text='确定' cancel-button-text='取消' icon="el-icon-info" icon-color="red" </el-button>
title="您确定删除吗?"> <el-button plain @click="dialogFormVisible = true">
</el-popconfirm> 发货
</template> </el-button>
</el-table-column> <el-popconfirm class="ml-5" confirm-button-text='确定' cancel-button-text='取消' icon="InfoFilled" icon-color="red"
</el-table> title="是否确认删除" @confirm="deleteProduct(scope.row.id)" width=180>
<div style="padding: 10px 0"> <template #reference>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" <el-button class="ml-5" type="danger">取消订单</el-button>
:current-page="searchParams.current" :page-size="searchParams.pageSize" :page-sizes="[5, 10, 15, 20]" </template>
:small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper" </el-popconfirm>
:total="total" /> <el-popconfirm confirm-button-text='确定' cancel-button-text='取消' icon="el-icon-info" icon-color="red"
</div> title="您确定删除吗?">
<!-- <el-dialog v-model="dialogFormVisible" title="Shipping address" width="500">--> </el-popconfirm>
<!-- <el-form :model="">--> </template>
<!-- <el-form-item label="快递单号" :label-width="formLabelWidth">--> </el-table-column>
<!-- <el-input v-model=" " autocomplete="off" />--> </el-table>
<!-- </el-form-item>--> <div style="padding: 10px 0">
<!-- </el-form>--> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
<!-- <template #footer>--> :current-page="searchParams.current" :page-size="searchParams.pageSize" :page-sizes="[5, 10, 15, 20]"
<!-- <div class="dialog-footer">--> :small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper"
<!-- <el-button @click="dialogFormVisible = false">取消</el-button>--> :total="total" />
<!-- <el-button type="primary" @click="dialogFormVisible = false">--> </div>
<!-- 确定--> <!-- <el-dialog v-model="dialogFormVisible" title="Shipping address" width="500">-->
<!-- </el-button>--> <!-- <el-form :model="">-->
<!-- </div>--> <!-- <el-form-item label="快递单号" :label-width="formLabelWidth">-->
<!-- </template>--> <!-- <el-input v-model=" " autocomplete="off" />-->
<!-- </el-dialog>--> <!-- </el-form-item>-->
<!--</template>--> <!-- </el-form>-->
<!-- <template #footer>-->
<!--<script lang="ts" setup>--> <!-- <div class="dialog-footer">-->
<!--import {ref} from "vue";--> <!-- <el-button @click="dialogFormVisible = false">取消</el-button>-->
<!--import myAxios from "@/api/myAxios";--> <!-- <el-button type="primary" @click="dialogFormVisible = false">-->
<!--import {ElMessage} from "element-plus";--> <!-- 确定-->
<!--const tableData : any= ref([]);--> <!-- </el-button>-->
<!--const total = ref(0);--> <!-- </div>-->
<!--// const title = ref('')--> <!-- </template>-->
<!--// const editForm : any = ref({});--> <!-- </el-dialog>-->
<!--// const DialogVisible = ref(true);--> </template>
<!--const dialogFormVisible = ref(false)-->
<!--const formLabelWidth = '140px'--> <script lang="ts" setup>
<!--const searchParams: any = ref({ //--> import {ref,onMounted} from "vue";
<!-- current: 1, //--> import myAxios from "@/api/myAxios";
<!-- pageSize: 5 //--> import {ElMessage} from "element-plus";
<!--})--> const tableData : any= ref([]);
<!--const handleSizeChange = (newSize: any) => {--> const total = ref(0);
<!-- searchParams.value.pageSize = newSize //--> const num = ref(0)
<!-- getOrderList()--> const dialogFormVisible = ref(false)
<!--}--> const formLabelWidth = '140px'
<!--const handleCurrentChange = (Current: any) => {--> onMounted(()=>{
<!-- searchParams.value.current = Current--> getOrderList()
<!-- getOrderList()--> })
<!--}-->
<!--const handleSelectionChange = (row: any) => {--> const searchParams: any = ref({ //
<!-- id.value = JSON.parse(JSON.stringify(row));--> current: 1, //
<!--}--> pageSize: 5 //
<!--const getOrderList = async () => {--> })
<!-- try {--> const handleSizeChange = (newSize: any) => {
<!-- const res = await myAxios.post('', { ...searchParams.value });--> searchParams.value.pageSize = newSize //
<!-- if (res.data.code === 1) {--> getOrderList()
<!-- tableData.value = res.data.data.records;--> }
<!-- total.value = parseInt(res.data.data.total)--> const handleCurrentChange = (Current: any) => {
<!-- } else {--> searchParams.value.current = Current
<!-- ElMessage({--> getOrderList()
<!-- message: '获取数据失败',--> }
<!-- });--> const handleSelectionChange = (row: any) => {
<!-- }--> // id.value = JSON.parse(JSON.stringify(row));
<!-- } catch (error) {--> }
<!-- ElMessage({--> const getOrderList = async () => {
<!-- message: '发生错误',--> try {
<!-- });--> const res = await myAxios.post('/order/list/page', { ...searchParams.value });
<!-- }--> // console.log(res)
<!--}--> if (res.data.code === 1) {
<!--const orderList = ref({--> tableData.value = res.data.data.records
<!--id:'',--> total.value = parseInt(res.data.data.total)
<!--userId:'',--> for(let key in tableData.value) {
<!--addressSnapshot:{--> num.value = parseInt(key)
<!--name:'',--> const resOrderDetail = await myAxios.post('/order/list/item',{id:tableData.value[key].id})
<!--phone:'',--> if( resOrderDetail.data.code === 1 ) {
<!--region:'',--> tableData.value.goodSnapshot= resOrderDetail.data.data[key].goodSnapshot
<!--detailAddress:''--> tableData.value.quantity = resOrderDetail.data.data[key].quality
<!--},--> // console.log(resOrderDetail.data.data[0].goodSnapshot.name)
<!--couponSnapshot:{--> console.log( tableData.value.goodSnapshot.name)
<!--name:'',--> console.log( resOrderDetail.data.data[key].quantity)
<!--conditionAmount:''--> }
<!--},--> }
<!--totalAmount:'',--> } else {
<!--orderStatus:'',--> ElMessage({
<!--createTime:'',--> message: '获取数据失败',
<!--updateTime:'',--> });
<!--isDelete:'',--> }
<!--orderNumber:''--> } catch (error) {
<!--})--> ElMessage({
<!--const delBatch =()=>{--> message: '发生错误',
<!-- //--> });
<!--}--> }
<!--//--> }
<!--const shipments = (index: number, row: any , flag : number) => {-->
<!--};--> // const getItemList = async (id: number) => {
<!--//--> // try {
<!--const ReviseOrView = (index: number, row: any , flag : number) => {--> // const res = await myAxios.post('/order/list/item', { id:tableData.value[key].id});
// console.log(res)
<!--};--> // if (res.data.code === 1) {
<!--const deleteProduct = async (index: number) => {--> // tableData.value = res.data.data.records;
<!-- console.log(typeof index)--> // total.value = parseInt(res.data.data.total)
<!-- const res = await myAxios.post('/goods/delete', { id: index })--> // } else {
<!-- console.log(res)--> // ElMessage({
<!-- if (res.data.code === 1) {--> // message: '',
<!-- ElMessage({--> // });
<!-- type: 'success',--> // }
<!-- message: '删除成功',--> // } catch (error) {
<!-- })--> // ElMessage({
<!-- getOrderList()--> // message: '',
<!-- }--> // });
<!--}--> // }
<!--const reset = () => {--> // }
<!-- id.value = '';-->
// const orderList = ref({
<!--};--> // id:'',
<!--const load =()=>{}--> // userId:'',
<!--</script>--> // addressSnapshot:{
// name:'',
<!--<style lang="scss" scoped>--> // phone:'',
// region:'',
<!--</style> --> // detailAddress:''
// },
// couponSnapshot:{
// name:'',
// conditionAmount:''
// },
// totalAmount:'',
// orderStatus:'',
// createTime:'',
// updateTime:'',
// isDelete:'',
// orderNumber:''
// })
const delBatch =()=>{
//
}
//
const shipments = (index: number, row: any , flag : number) => {
};
//
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>