2023-11-06 18:01:40 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<!-- 用户select选项 -->
|
2023-11-07 21:22:37 +08:00
|
|
|
<el-row :gutter="15" class="m-t-0">
|
|
|
|
|
<el-col :span="4">
|
2023-11-09 15:20:28 +08:00
|
|
|
<SelectionShopId class="w-100" v-model="shop_id" :allSel="true" />
|
2023-11-07 21:22:37 +08:00
|
|
|
</el-col>
|
2024-06-18 19:08:34 +08:00
|
|
|
<el-col :span="8">
|
2024-07-01 21:08:03 +08:00
|
|
|
<DatePickerOrder class="w-100" />
|
2023-11-07 21:22:37 +08:00
|
|
|
</el-col>
|
2024-06-18 19:08:34 +08:00
|
|
|
<el-col :span="12">
|
2023-11-10 16:52:17 +08:00
|
|
|
<SearchOrder class="w-100" />
|
2023-11-07 21:22:37 +08:00
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="15">
|
2024-07-01 21:08:03 +08:00
|
|
|
<el-col :span="8">
|
|
|
|
|
<SelectionMainStatus />
|
2023-11-07 21:22:37 +08:00
|
|
|
</el-col>
|
2024-07-01 21:08:03 +08:00
|
|
|
<el-col :span="8">
|
|
|
|
|
<SelectionShipmentStatus />
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<SelectionRefundStatus />
|
2023-11-07 21:22:37 +08:00
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2023-11-07 13:28:53 +08:00
|
|
|
<!-- 订单列表 -->
|
2024-07-08 16:51:02 +08:00
|
|
|
<el-table class="m-t-20 w-100" ref="myTable" show-summary :summary-method="getSummaries"
|
2024-07-01 21:08:03 +08:00
|
|
|
:data="orderList.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
|
2024-07-08 16:51:02 +08:00
|
|
|
<el-table-column align="center" type="selection" width="70" min-width="40">
|
2023-11-06 18:01:40 +08:00
|
|
|
</el-table-column>
|
2024-07-08 16:51:02 +08:00
|
|
|
<el-table-column align="center" prop="id" label="id" width="70">
|
2023-11-06 18:01:40 +08:00
|
|
|
</el-table-column>
|
2024-07-08 16:51:02 +08:00
|
|
|
<el-table-column prop="order_sn" label="订单号" width="130" min-width="130">
|
2023-11-06 18:01:40 +08:00
|
|
|
</el-table-column>
|
2024-07-08 16:51:02 +08:00
|
|
|
<el-table-column prop="tel" label="客户电话" min-width="130">
|
2023-11-06 18:01:40 +08:00
|
|
|
</el-table-column>
|
2023-11-07 13:28:53 +08:00
|
|
|
<el-table-column label="下单时间" width="140" min-width="140">
|
|
|
|
|
<template slot-scope="scope">
|
2024-07-08 16:51:02 +08:00
|
|
|
{{ scope.row.order_time | parseTime('{y}-{m}-{d} {h}:{i}') }}
|
2023-11-06 18:01:40 +08:00
|
|
|
</template>
|
2024-07-05 15:53:56 +08:00
|
|
|
</el-table-column>
|
2024-07-08 16:51:02 +08:00
|
|
|
<el-table-column prop="controler" label="操作">
|
2024-07-05 15:53:56 +08:00
|
|
|
<template slot-scope="scope">
|
2023-11-06 18:01:40 +08:00
|
|
|
<el-button-group>
|
2024-07-08 16:51:02 +08:00
|
|
|
<!-- 已付款 未接单 -->
|
|
|
|
|
<!-- <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"
|
2023-11-07 21:22:37 +08:00
|
|
|
@click="$router.replace(`/order/show/${scope.row.id}`)">查看</el-button>
|
2023-11-06 18:01:40 +08:00
|
|
|
</el-button-group>
|
|
|
|
|
</template>
|
2024-07-05 15:53:56 +08:00
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2023-11-06 18:01:40 +08:00
|
|
|
<!-- 分页 -->
|
2024-07-05 15:53:56 +08:00
|
|
|
<el-pagination class="m-t-20" layout="prev, pager, next" :current-page.sync="currentPage" :page-size="pageSize"
|
2024-07-01 21:08:03 +08:00
|
|
|
:total="orderList.length">
|
2024-07-05 15:53:56 +08:00
|
|
|
</el-pagination>
|
2023-11-06 18:01:40 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-11-07 13:28:53 +08:00
|
|
|
|
|
|
|
|
import { countSelIdArr, parseTime } from '@/utils'
|
2024-07-01 21:08:03 +08:00
|
|
|
import { getOrderList } from '@/utils/api/table'
|
2023-11-06 18:01:40 +08:00
|
|
|
import SelectionShopId from '@/components/SelectionShopId'
|
2024-07-01 21:08:03 +08:00
|
|
|
import SelectionMainStatus from '@/components/SelectionMainStatus'
|
|
|
|
|
import SelectionShipmentStatus from '@/components/SelectionShipmentStatus'
|
|
|
|
|
import SelectionRefundStatus from '@/components/SelectionRefundStatus'
|
2023-11-07 21:22:37 +08:00
|
|
|
import DatePickerOrder from '@/components/DatePickerOrder'
|
2023-11-09 16:08:22 +08:00
|
|
|
import SearchOrder from '@/components/SearchOrder'
|
2024-07-05 15:53:56 +08:00
|
|
|
import { debounce } from 'lodash'// 防抖
|
2023-11-06 18:01:40 +08:00
|
|
|
|
|
|
|
|
export default {
|
2023-11-07 13:28:53 +08:00
|
|
|
name: 'Order',
|
2023-11-06 18:01:40 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2023-11-07 13:28:53 +08:00
|
|
|
pageSize: 50, // 每页显示记录条数
|
2023-11-06 18:01:40 +08:00
|
|
|
currentPage: 1, // 当前页
|
2024-07-05 15:53:56 +08:00
|
|
|
shop_id: this.$store.state.user.shop_id, // 搜索条件 商铺id
|
|
|
|
|
orderList: []// 订单列表
|
2023-11-06 18:01:40 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
SelectionShopId,
|
2024-07-01 21:08:03 +08:00
|
|
|
SelectionMainStatus,
|
|
|
|
|
SelectionShipmentStatus,
|
|
|
|
|
SelectionRefundStatus,
|
2023-11-09 16:08:22 +08:00
|
|
|
DatePickerOrder,
|
|
|
|
|
SearchOrder
|
2023-11-06 18:01:40 +08:00
|
|
|
},
|
|
|
|
|
computed: {
|
2024-07-01 21:08:03 +08:00
|
|
|
/**
|
|
|
|
|
* @description: 搜索条件 集合
|
|
|
|
|
*/
|
|
|
|
|
orderSerch () {
|
|
|
|
|
return this.$store.getters['app/getOrderSerch']
|
2023-11-06 18:01:40 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-07-01 21:08:03 +08:00
|
|
|
countSelIdArr,
|
|
|
|
|
/**
|
|
|
|
|
* @description: 根据 缓存的搜索条件 获取订单列表
|
|
|
|
|
*/
|
|
|
|
|
async getOrderList (orderSerch) {
|
|
|
|
|
const res = await getOrderList(orderSerch)
|
2024-07-05 15:53:56 +08:00
|
|
|
this.orderList = res.data.orderList
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 表单提交 加入防抖
|
|
|
|
|
*/
|
|
|
|
|
debouncedGetOrderList: debounce(function (val) {
|
|
|
|
|
this.getOrderList(val)
|
2024-07-08 16:51:02 +08:00
|
|
|
}, 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}元`]
|
|
|
|
|
}
|
2023-11-06 18:01:40 +08:00
|
|
|
},
|
|
|
|
|
watch: {
|
2024-07-05 14:25:34 +08:00
|
|
|
shop_id (val) {
|
|
|
|
|
this.$store.commit('app/setOrderSerch', { shop_id: val })
|
|
|
|
|
},
|
2024-07-05 15:53:56 +08:00
|
|
|
orderSerch: {
|
|
|
|
|
handler (val) {
|
|
|
|
|
this.debouncedGetOrderList(val)// 表单提交 加入防抖
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
2024-07-01 21:08:03 +08:00
|
|
|
}
|
2023-11-06 18:01:40 +08:00
|
|
|
},
|
|
|
|
|
created () {
|
|
|
|
|
},
|
|
|
|
|
filters: {
|
2023-11-07 13:28:53 +08:00
|
|
|
countSelIdArr,
|
|
|
|
|
parseTime
|
2023-11-06 18:01:40 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@import "@/styles/theme.scss";
|
|
|
|
|
|
|
|
|
|
i {
|
|
|
|
|
font-size: 18px !important;
|
|
|
|
|
margin-right: 12px;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
}
|
|
|
|
|
</style>
|