fix
This commit is contained in:
parent
15b03f0164
commit
bf03d3b7fb
@ -14,6 +14,7 @@ import notice from '@/api/notice/index.js'
|
|||||||
import flower from '@/api/flower/index.js'
|
import flower from '@/api/flower/index.js'
|
||||||
import badge from '@/api/badge/index.js'
|
import badge from '@/api/badge/index.js'
|
||||||
import claim from '@/api/claim/index.js'
|
import claim from '@/api/claim/index.js'
|
||||||
|
import order from '@/api/order/index.js'
|
||||||
export default {
|
export default {
|
||||||
user,
|
user,
|
||||||
sys,
|
sys,
|
||||||
@ -30,5 +31,6 @@ export default {
|
|||||||
notice,
|
notice,
|
||||||
flower,
|
flower,
|
||||||
badge,
|
badge,
|
||||||
claim
|
claim,
|
||||||
|
order
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/api/order/index.js
Normal file
24
src/api/order/index.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import fetch from '../fetch.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
remove(params) {
|
||||||
|
return fetch('/order/delete', params,'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
|
page(params) {
|
||||||
|
return fetch('/order/page', params,'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
|
detail(params) {
|
||||||
|
return fetch('/order/detail', params,'get',)
|
||||||
|
},
|
||||||
|
ship(params) {
|
||||||
|
return fetch('/order/ship', params,'post','json')
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
export(params) {
|
||||||
|
return fetch('/order/export', params, 'get', 'form', {}, 'blob')
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
178
src/views/flower/order/index.vue
Normal file
178
src/views/flower/order/index.vue
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<navbar title="订单中心" />
|
||||||
|
<a-card>
|
||||||
|
<div class="mb-20">
|
||||||
|
<div class="flex flex-center flex-justify-start">
|
||||||
|
<a-button type="text" @click="exportOrder">导出</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a-table
|
||||||
|
:data="list"
|
||||||
|
:columns="columns"
|
||||||
|
:pagination="page"
|
||||||
|
@pageChange="pageChange"
|
||||||
|
>
|
||||||
|
<template #addr="{ record }">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
{{ record.address.detail }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
{{ record.address.name }} -
|
||||||
|
{{ record.address.phone }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #user="{ record }">
|
||||||
|
<div class="flex flex-center flex-justify-start">
|
||||||
|
<a-avatar
|
||||||
|
:image-url="record.user.avatar.url"
|
||||||
|
></a-avatar>
|
||||||
|
<div class="ml-20">
|
||||||
|
<div>{{ record.user.name }}</div>
|
||||||
|
<div>{{ record.user.phone }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #status="{ record }">
|
||||||
|
<div>
|
||||||
|
<a-tag v-if="record.status === 0" color="blue">
|
||||||
|
未知
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-if="record.status === 2" color="blue">
|
||||||
|
支付成功
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-if="record.status === 2" color="blue">
|
||||||
|
退款
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-if="record.status === 3" color="blue">
|
||||||
|
未支付
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-if="record.status === 4" color="blue">
|
||||||
|
取消
|
||||||
|
</a-tag>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #ship="{ record }">
|
||||||
|
<div>
|
||||||
|
<a-tag v-if="record.status === 0" color="blue">
|
||||||
|
未发货
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="blue">
|
||||||
|
已发货
|
||||||
|
</a-tag>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #menu="{ record }">
|
||||||
|
<div>
|
||||||
|
<a-popconfirm
|
||||||
|
content="确认标记为已发货?"
|
||||||
|
@ok="ship(record.id)"
|
||||||
|
>
|
||||||
|
<a-button type="text">发货</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import navbar from '@/components/navbar/index.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
navbar
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '地址',
|
||||||
|
slotName: 'addr',
|
||||||
|
width: 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户',
|
||||||
|
slotName: 'user'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '领取时间',
|
||||||
|
dataIndex: 'createdAtStr'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否发货',
|
||||||
|
slotName: 'ship'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '支付状态',
|
||||||
|
slotName: 'status'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
slotName: 'menu'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
page: { current: 1, pageSize: 10, total: 0 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
pageChange(page) {
|
||||||
|
this.page.current = page
|
||||||
|
this.fetchList()
|
||||||
|
},
|
||||||
|
fetchList() {
|
||||||
|
this.$api.order.page(this.page).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
;((this.list = res.data.list),
|
||||||
|
(this.page.total = res.data.total))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
ship(id) {
|
||||||
|
const data = { ids: [id] }
|
||||||
|
this.$api.order.ship(data).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.fetchList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
exportOrder() {
|
||||||
|
const data = {...this.page,}
|
||||||
|
this.$api.order.export(data).then(res => {
|
||||||
|
if (!res.hasOwnProperty('code')) {
|
||||||
|
this.downloadFile(res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
downloadFile(res) {
|
||||||
|
const url = window.URL.createObjectURL(new Blob([res]))
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.style.display = 'none'
|
||||||
|
link.href = url
|
||||||
|
const btn = this.btnList.find(sub => sub.index === this.active)
|
||||||
|
const excelName = btn.label + '.xlsx'
|
||||||
|
link.setAttribute('download', excelName)
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
link.remove()
|
||||||
|
this.$notification.success('下载成功')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
Loading…
Reference in New Issue
Block a user