329 lines
8.9 KiB
Vue
329 lines
8.9 KiB
Vue
<template>
|
|
<div class="content">
|
|
<div class="cart_wrap card">
|
|
<div class="header">
|
|
<div class="left">
|
|
<el-input placeholder="搜索订单" v-model="tableData.proName"></el-input>
|
|
<el-select v-model="tableData.status" placeholder="订单状态">
|
|
<el-option v-for="item in statusList" :key="item.value" :value="item.value"
|
|
:label="item.label"></el-option>
|
|
</el-select>
|
|
<div class="btn">
|
|
<el-button type="primary" :icon="Search" @click="groupOrderlistAjax">搜索</el-button>
|
|
<el-button :icon="RefreshRight" :loading="tableData.resetLoading"
|
|
@click="resetHandle">重置</el-button>
|
|
</div>
|
|
</div>
|
|
<el-button type="warning" :icon="MagicStick" @click="scanGroupRef.show()">核销团购券</el-button>
|
|
</div>
|
|
<div class="tab_container">
|
|
<el-table :data="tableData.list" height="540px" v-loading="tableData.loading">
|
|
<el-table-column label="订单号" prop="orderNo" width="150px"></el-table-column>
|
|
<el-table-column label="优惠卷" prop="proImg" width="220px">
|
|
<template v-slot="scope">
|
|
<div class="info_wrap">
|
|
<el-image :src="scope.row.proImg" style="width: 40px;height: 40px;flex-shrink: 0;" />
|
|
<div class="t">{{ scope.row.proName }}</div>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="支付方式" prop="payType">
|
|
<template v-slot="scope">
|
|
{{ payTypeFilter(scope.row.payType) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="订单金额" prop="orderAmount">
|
|
<template v-slot="scope">
|
|
¥{{ scope.row.orderAmount }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="实付金额" prop="payAmount">
|
|
<template v-slot="scope">
|
|
¥{{ scope.row.payAmount }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="下单数量" prop="number">
|
|
<template v-slot="scope">
|
|
{{ scope.row.number }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="状态" prop="status">
|
|
<template v-slot="scope">
|
|
{{ statusFilter(scope.row.status) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" fixed="right">
|
|
<template v-slot="scope">
|
|
<el-button type="primary" size="small">退款</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<div class="pagination">
|
|
<el-pagination @current-change="paginationChange" :current-page="tableData.page"
|
|
:page-size="tableData.size" layout="total, prev, pager, next, jumper" :total="tableData.total"
|
|
background>
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
<scanGroup ref="scanGroupRef" @succcess="groupOrderlistAjax" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { groupOrderlist } from '@/api/group'
|
|
import { Search, RefreshRight, MagicStick } from '@element-plus/icons-vue'
|
|
import { ref, onMounted, reactive } from 'vue'
|
|
import scanGroup from './components/scanGroup.vue'
|
|
import { useUser } from "@/store/user.js"
|
|
const store = useUser()
|
|
|
|
const scanGroupRef = ref(null)
|
|
|
|
const tableData = reactive({
|
|
resetLoading: false,
|
|
proName: '',
|
|
status: '',
|
|
loading: false,
|
|
list: [],
|
|
page: 1,
|
|
size: 10,
|
|
total: 0
|
|
})
|
|
|
|
// 支付方式类型
|
|
function payTypeFilter(t) {
|
|
const m = {
|
|
wechatPay: '微信支付',
|
|
aliPay: '支付宝支付'
|
|
}
|
|
return m[t]
|
|
}
|
|
|
|
const statusList = reactive([
|
|
{
|
|
value: 'unpaid',
|
|
label: '待付款'
|
|
},
|
|
{
|
|
value: 'unused',
|
|
label: '待使用'
|
|
},
|
|
{
|
|
value: 'closed',
|
|
label: '已完成'
|
|
},
|
|
{
|
|
value: 'refunding',
|
|
label: '退款中'
|
|
},
|
|
{
|
|
value: 'refund',
|
|
label: '已退款'
|
|
},
|
|
{
|
|
value: 'cancelled',
|
|
label: '已取消'
|
|
}
|
|
])
|
|
|
|
// 状态
|
|
function statusFilter(t) {
|
|
return statusList.find(item => item.value == t)?.label
|
|
}
|
|
|
|
// 分页变化
|
|
function paginationChange(e) {
|
|
tableData.page = e
|
|
groupOrderlistAjax()
|
|
}
|
|
|
|
// 重置
|
|
function resetHandle() {
|
|
tableData.proName = ''
|
|
tableData.status = ''
|
|
tableData.page = 1
|
|
tableData.resetLoading = true
|
|
groupOrderlistAjax()
|
|
}
|
|
|
|
// 获取团购订单数据
|
|
async function groupOrderlistAjax() {
|
|
try {
|
|
tableData.loading = true
|
|
const res = await groupOrderlist({
|
|
shopId: store.userInfo.shopId,
|
|
proName: tableData.proName,
|
|
status: tableData.status,
|
|
page: tableData.page,
|
|
size: tableData.size
|
|
})
|
|
tableData.resetLoading = false
|
|
tableData.loading = false
|
|
tableData.list = res.list
|
|
tableData.total = res.total
|
|
} catch (error) {
|
|
tableData.loading = false
|
|
console.log(error);
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
groupOrderlistAjax()
|
|
})
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.pagination {
|
|
display: flex;
|
|
padding: 0 14px;
|
|
}
|
|
|
|
.info_wrap {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
|
|
.t {
|
|
width: 100px;
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
|
|
.cart_wrap {
|
|
flex: 2;
|
|
}
|
|
|
|
.right_card {
|
|
flex: 1;
|
|
height: 100%;
|
|
margin-left: var(--el-font-size-base);
|
|
}
|
|
|
|
.header {
|
|
display: flex;
|
|
padding: 14px;
|
|
justify-content: space-between;
|
|
border-bottom: 1px solid #ececec;
|
|
|
|
.left {
|
|
display: flex;
|
|
gap: 10px;
|
|
|
|
.btn {
|
|
display: flex;
|
|
}
|
|
}
|
|
|
|
.menus {
|
|
display: flex;
|
|
padding: 0 10px;
|
|
|
|
.item {
|
|
padding: 0 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
position: relative;
|
|
|
|
span {
|
|
font-size: var(--el-font-size-base);
|
|
}
|
|
|
|
&.active {
|
|
|
|
&::after {
|
|
content: "";
|
|
width: 70%;
|
|
height: 4px;
|
|
border-radius: 4px;
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 15%;
|
|
background-color: var(--primary-color);
|
|
}
|
|
|
|
span {
|
|
color: var(--primary-color);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.all {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
}
|
|
|
|
.tab_container {
|
|
padding: 0 var(--el-font-size-base) var(--el-font-size-base);
|
|
|
|
.tab_head {
|
|
padding-bottom: var(--el-font-size-base);
|
|
}
|
|
|
|
.overflow_y {
|
|
height: calc(100vh - 225px);
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.tab_list {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
grid-template-rows: auto;
|
|
gap: var(--el-font-size-base);
|
|
|
|
.item {
|
|
background-color: #efefef;
|
|
border-radius: 6px;
|
|
overflow: hidden;
|
|
border: 2px solid #fff;
|
|
|
|
&.active {
|
|
border-color: var(--primary-color);
|
|
}
|
|
|
|
&:hover {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.tab_title {
|
|
height: var(--el-component-size-large);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 10px;
|
|
color: #fff;
|
|
|
|
&.subscribe {
|
|
background-color: var(--el-color-success);
|
|
}
|
|
|
|
&.closed {
|
|
background-color: #999;
|
|
}
|
|
|
|
&.opening {
|
|
background-color: var(--primary-color);
|
|
}
|
|
|
|
&.cleaning {
|
|
background-color: var(--el-color-danger);
|
|
}
|
|
}
|
|
|
|
.tab_cont {
|
|
height: 120px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
.icon {
|
|
color: #555;
|
|
font-size: 30px;
|
|
transform: rotate(45deg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |