master
parent
44584f55b3
commit
e18b8dda78
@ -1,170 +1,183 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--查询-->
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" text="订单列表" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div>
|
||||
<Input v-model="select.keyword" style="width: 200px; margin-right: 10px" placeholder="关键字搜索" />
|
||||
<Button type="primary" style="margin-left: 10px" @click="select.page = 1,getOrder()">查询</Button>
|
||||
<!-- <Button type="primary" style="margin-left: 10px" @click="$refs['addOrder'].type = 'add',$refs['addOrder'].isShow = true">创建订单</Button>-->
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<xy-table
|
||||
:total="total"
|
||||
:table-item="table"
|
||||
:list="list"
|
||||
@editor="editor"
|
||||
@delete="destroy"
|
||||
@pageSizeChange="e => select.page_size = e"
|
||||
@pageIndexChange="e => {select.page = e;getOrder()}"></xy-table>
|
||||
|
||||
<add-order ref="addOrder" :accounts="accounts" :types="types" @refresh="getOrder"></add-order>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList,destroy} from '@/api/order'
|
||||
import {getList as getUnit} from '@/api/payUnit'
|
||||
import {getList as getTypes} from '@/api/productType'
|
||||
|
||||
import addOrder from "@/views/order/component/addOrder";
|
||||
export default {
|
||||
components:{
|
||||
addOrder
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select:{
|
||||
page:1,
|
||||
page_size:10,
|
||||
keyword:''
|
||||
},
|
||||
|
||||
accounts:[],
|
||||
types:[],
|
||||
total:0,
|
||||
list:[
|
||||
|
||||
],
|
||||
table:[
|
||||
{
|
||||
prop:'no',
|
||||
width:220,
|
||||
label:'订单编号'
|
||||
},
|
||||
{
|
||||
prop:'customer.name',
|
||||
label:'客户',
|
||||
width:180
|
||||
},
|
||||
{
|
||||
prop:'product.name',
|
||||
label:'产品',
|
||||
width: 200,
|
||||
align:'left'
|
||||
},
|
||||
{
|
||||
prop:'start_date',
|
||||
label:'开始时间',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
prop:'end_date',
|
||||
label:'结束时间',
|
||||
width: 200,
|
||||
formatter:(cell,data,value) => {
|
||||
if(value) return value
|
||||
return '未定'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop:'unit_price',
|
||||
label:'单次价格',
|
||||
width: 180,
|
||||
align:'right'
|
||||
},
|
||||
{
|
||||
prop:'total_time',
|
||||
label:'总计时长',
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
prop:'total_money',
|
||||
label:'总计金额',
|
||||
width: 180,
|
||||
align:'right'
|
||||
},
|
||||
{
|
||||
prop:'status',
|
||||
label:'执行状态',
|
||||
width: 160,
|
||||
customFn:(row)=>{
|
||||
let statusName = new Map([
|
||||
[0,'未开始'],
|
||||
[1,'进行中'],
|
||||
[2,'已完成'],
|
||||
])
|
||||
let statusColor = new Map([
|
||||
[0,'blue'],
|
||||
[1,'red'],
|
||||
[2,'green'],
|
||||
])
|
||||
return (
|
||||
<div style={{'color':statusColor.get(row.status)}}>{statusName.get(row.status)}</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
label:'收款单',
|
||||
width: 140
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getTypes(){
|
||||
const res = await getTypes({page:1,page_size:9999},false)
|
||||
this.types = res.data
|
||||
},
|
||||
|
||||
async getAccounts(){
|
||||
const res = await getUnit({page:1,page_size:9999})
|
||||
this.accounts = res.data
|
||||
},
|
||||
|
||||
async getOrder(){
|
||||
const res = await getList(this.select)
|
||||
this.total = res.total
|
||||
this.list = res.data
|
||||
console.log(this.list)
|
||||
},
|
||||
|
||||
editor(row){
|
||||
this.$refs['addOrder'].type = 'editor'
|
||||
this.$refs['addOrder'].id = row.id
|
||||
this.$refs['addOrder'].isShow = true
|
||||
},
|
||||
destroy(row){
|
||||
destroy(row.id).then(res => {
|
||||
this.$successMessage('destroy','订单')
|
||||
this.getOrder()
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTypes()
|
||||
this.getAccounts()
|
||||
this.getOrder()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
<template>
|
||||
<div>
|
||||
<!--查询-->
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" text="订单列表" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div>
|
||||
<Input v-model="select.keyword" style="width: 200px; margin-right: 10px" placeholder="关键字搜索" />
|
||||
<Button type="primary" style="margin-left: 10px" @click="select.page = 1,getOrder()">查询</Button>
|
||||
<!-- <Button type="primary" style="margin-left: 10px" @click="$refs['addOrder'].type = 'add',$refs['addOrder'].isShow = true">创建订单</Button>-->
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<xy-table :total="total" :table-item="table" :list="list" @editor="editor" @delete="destroy"
|
||||
@pageSizeChange="e => {select.page_size = e;select.page=1;getOrder()}"
|
||||
@pageIndexChange="e => {select.page = e;getOrder()}"></xy-table>
|
||||
|
||||
<add-order ref="addOrder" :accounts="accounts" :types="types" @refresh="getOrder"></add-order>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getList,
|
||||
destroy
|
||||
} from '@/api/order'
|
||||
import {
|
||||
getList as getUnit
|
||||
} from '@/api/payUnit'
|
||||
import {
|
||||
getList as getTypes
|
||||
} from '@/api/productType'
|
||||
|
||||
import addOrder from "@/views/order/component/addOrder";
|
||||
export default {
|
||||
components: {
|
||||
addOrder
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
keyword: ''
|
||||
},
|
||||
|
||||
accounts: [],
|
||||
types: [],
|
||||
total: 0,
|
||||
list: [
|
||||
|
||||
],
|
||||
table: [{
|
||||
prop: 'no',
|
||||
width: 220,
|
||||
label: '订单编号'
|
||||
},
|
||||
{
|
||||
prop: 'customer.name',
|
||||
label: '客户',
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
prop: 'product.name',
|
||||
label: '产品',
|
||||
width: 200,
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'start_date',
|
||||
label: '开始时间',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
prop: 'end_date',
|
||||
label: '结束时间',
|
||||
width: 200,
|
||||
formatter: (cell, data, value) => {
|
||||
if (value) return value
|
||||
return '未定'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'unit_price',
|
||||
label: '单次价格',
|
||||
width: 180,
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
prop: 'total_time',
|
||||
label: '总计时长',
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
prop: 'total_money',
|
||||
label: '总计金额',
|
||||
width: 180,
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '执行状态',
|
||||
width: 160,
|
||||
customFn: (row) => {
|
||||
let statusName = new Map([
|
||||
[0, '未开始'],
|
||||
[1, '进行中'],
|
||||
[2, '已完成'],
|
||||
])
|
||||
let statusColor = new Map([
|
||||
[0, 'blue'],
|
||||
[1, 'red'],
|
||||
[2, 'green'],
|
||||
])
|
||||
return ( <
|
||||
div style = {
|
||||
{
|
||||
'color': statusColor.get(row.status)
|
||||
}
|
||||
} > {
|
||||
statusName.get(row.status)
|
||||
} < /div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '收款单',
|
||||
width: 140
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getTypes() {
|
||||
const res = await getTypes({
|
||||
page: 1,
|
||||
page_size: 9999
|
||||
}, false)
|
||||
this.types = res.data
|
||||
},
|
||||
|
||||
async getAccounts() {
|
||||
const res = await getUnit({
|
||||
page: 1,
|
||||
page_size: 9999
|
||||
})
|
||||
this.accounts = res.data
|
||||
},
|
||||
|
||||
async getOrder() {
|
||||
const res = await getList(this.select)
|
||||
this.total = res.total
|
||||
this.list = res.data
|
||||
console.log(this.list)
|
||||
},
|
||||
|
||||
editor(row) {
|
||||
this.$refs['addOrder'].type = 'editor'
|
||||
this.$refs['addOrder'].id = row.id
|
||||
this.$refs['addOrder'].isShow = true
|
||||
},
|
||||
destroy(row) {
|
||||
destroy(row.id).then(res => {
|
||||
this.$successMessage('destroy', '订单')
|
||||
this.getOrder()
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTypes()
|
||||
this.getAccounts()
|
||||
this.getOrder()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
|
||||
Loading…
Reference in new issue