【类 型】:fix

【主	题】:表格
【描	述】:
	[原因]:修改表格显示字段
	[过程]:1.表格显示字段 id 订单号 电话 下单时间 操作  2.最后加一个合计行 计算订单总数 和 订单总额
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-07-08 16:51:02 +08:00
parent e258596dd6
commit e8f0bd6cd8

View File

@ -24,27 +24,30 @@
</el-col>
</el-row>
<!-- 订单列表 -->
<el-table class="m-t-20 w-100" ref="myTable"
<el-table class="m-t-20 w-100" ref="myTable" show-summary :summary-method="getSummaries"
:data="orderList.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
<el-table-column align="center" type="selection" width="40">
<el-table-column align="center" type="selection" width="70" min-width="40">
</el-table-column>
<el-table-column align="center" prop="id" label="id" width="50">
<el-table-column align="center" prop="id" label="id" width="70">
</el-table-column>
<el-table-column prop="order_sn" label="订单号" width="150" min-width="150">
<el-table-column prop="order_sn" label="订单号" width="130" min-width="130">
</el-table-column>
<el-table-column prop="tel" label="客户电话" min-width="150">
<el-table-column prop="tel" label="客户电话" min-width="130">
</el-table-column>
<el-table-column label="下单时间" width="140" min-width="140">
<template slot-scope="scope">
{{ scope.row.addtime | parseTime('{y}-{m}-{d} {h}:{i}') }}
{{ scope.row.order_time | parseTime('{y}-{m}-{d} {h}:{i}') }}
</template>
</el-table-column>
<el-table-column prop="controler" label="操作" width="380" min-width="380">
<el-table-column prop="controler" label="操作">
<template slot-scope="scope">
<el-button-group>
<el-button type="warning" icon="el-icon-edit">同意退款</el-button>
<el-button type="danger" icon="el-icon-delete" @click="deleteAdmin([scope.row.id])">拒绝退款</el-button>
<el-button type="primary" icon="el-icon-search"
<!-- 已付款 未接单 -->
<!-- <template v-if="scope.row.main_status === '已付款' && scope.row.shipment_status === '未接单'">
<el-button type="danger" icon="el-icon-delete">取消订单</el-button>
<el-button type="primary" icon="el-icon-search">确认接单</el-button>
</template> -->
<el-button type="success" icon="el-icon-search"
@click="$router.replace(`/order/show/${scope.row.id}`)">查看</el-button>
</el-button-group>
</template>
@ -103,14 +106,23 @@ export default {
async getOrderList (orderSerch) {
const res = await getOrderList(orderSerch)
this.orderList = res.data.orderList
console.log(res.data.orderList)
},
/**
* @description: 表单提交 加入防抖
*/
debouncedGetOrderList: debounce(function (val) {
this.getOrderList(val)
}, 500)
}, 500),
/**
* @description: 表格求和
*/
getSummaries () {
const sum = this.orderList.reduce((acc, order) => {
return acc + (order.total_price - order.refund_price)
}, 0)
const total = this.orderList.length
return ['合计', '', '', '', '', `${total}${sum}`]
}
},
watch: {
shop_id (val) {