提交 3c2cb2b2 authored 作者: lihuihui's avatar lihuihui

update: 发票管理,项目列表开发完毕

上级 509a164d
...@@ -6,3 +6,13 @@ import httpRequest from '@/utils/axios' ...@@ -6,3 +6,13 @@ import httpRequest from '@/utils/axios'
export function getInvoiceList(params) { export function getInvoiceList(params) {
return httpRequest.get('/api/finance/v1/invoices/list', { params }).then({}) return httpRequest.get('/api/finance/v1/invoices/list', { params }).then({})
} }
// 获取支付过滤条件
export function getCondition(params) {
return httpRequest.get('/api/finance/v1/payments/condition', { params })
}
// 分配发票跟进人
export function assignSales(data) {
return httpRequest.post('/api/finance/v1/invoices/assign-sales', data, {})
}
<template> <template>
<div> <div>
<el-dialog title="分配票据跟进人" center :visible.sync="visible" :before-close="modalClose"> <el-dialog title="分配票据跟进人" center v-bind="$attrs" v-on="$listeners">
<el-form :model="form"> <el-form :model="form">
<el-form-item label="票据跟进人"> <el-form-item label="票据跟进人">
<el-select v-model="form.region" placeholder="请选择活动区域"> <el-select v-model="form.value" placeholder="请选择活动区域">
<el-option label="区域一" value="shanghai"></el-option> <el-option
<el-option label="区域二" value="beijing"></el-option> v-for="(item, index) in options"
:key="index"
:label="item.user_name"
:value="item.user_id"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="$emit('dialogHide')">取 消</el-button> <el-button @click="$emit('update:visible', false)">取 消</el-button>
<el-button type="primary" @click="$emit('dialogHide')">确 定</el-button> <el-button type="primary" @click="assignSales">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { assignSales } from '../api'
export default { export default {
props: { props: {
visible: { options: { type: Array },
type: Boolean, invoicesIds: { type: Array }
default: false
}
}, },
data() { data() {
return { return {
form: { form: {
name: '', value: ''
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
} }
} }
}, },
methods: { methods: {
modalClose() { modalClose() {
this.$emit('update:visible', false) this.$emit('update:visible', false)
},
assignSales() {
const ids = this.invoicesIds.map(item => item.id)
const params = {
invoices_id: ids.join(','),
sales_rep_user_id: this.form.value
}
assignSales(params).then(res => {
this.$emit('update:visible', false)
this.$emit('success')
})
} }
} }
} }
......
<template> <template>
<div> <div>
<app-card style="max-width: 100%"> <app-card>
<app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange"> <app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange">
<!-- 允许开具发票 -->
<template v-slot:ticket_type="{ params }">
<el-radio-group v-model="params.can_add_invoice">
<el-radio :label="1">开启</el-radio>
<el-radio :label="2">关闭</el-radio>
</el-radio-group>
</template>
<!-- 首次缴费时间 -->
<template v-slot:firstDate="{ params }">
<el-date-picker
v-model="params.firstDate"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
size="small"
style="width: 360px"
>
</el-date-picker>
</template>
<!-- 末次缴费时间 -->
<template v-slot:lastDate="{ params }">
<el-date-picker
v-model="params.lastDate"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
size="small"
style="width: 360px"
>
</el-date-picker>
</template>
<el-row> <el-row>
<el-button type="primary" @click="isShowDialog = true">分配票据跟进人</el-button> <el-button type="primary" @click="isHandleSelection">分配票据跟进人</el-button>
</el-row> </el-row>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ name: 'invoiceView', params: { id: row.id } }"> <router-link :to="{ name: 'paymentView', params: { id: row.id } }">
<el-button type="text">查看</el-button> <el-button type="text">查看</el-button>
</router-link> </router-link>
</template> </template>
<template #footer>
<span>已选择{{ multipleSelection.length }}</span>
<el-button @click="exportSelect" style="margin-left: 40px">导出</el-button>
</template>
</app-list> </app-list>
</app-card> </app-card>
<distribution-dialog @dialogHide="dialogHide" :visible.sync="isShowDialog"></distribution-dialog> <distribution-dialog
@success="success"
:visible.sync="isShowDialog"
:options="conditionList.sales_rep_user_id"
:invoicesIds="multipleSelection"
></distribution-dialog>
</div> </div>
</template> </template>
...@@ -22,12 +66,16 @@ import AppList from '@/components/base/AppList.vue' ...@@ -22,12 +66,16 @@ import AppList from '@/components/base/AppList.vue'
import AppCard from '@/components/base/AppCard.vue' import AppCard from '@/components/base/AppCard.vue'
import DistributionDialog from '../components/DistributionDialog.vue' import DistributionDialog from '../components/DistributionDialog.vue'
// 接口 // 接口
import { getInvoiceList } from '../api' import { getInvoiceList, getCondition } from '../api'
import XLSX from 'xlsx'
import { funDownload } from '@/utils/util'
export default { export default {
components: { AppCard, AppList, DistributionDialog }, components: { AppCard, AppList, DistributionDialog },
data() { data() {
return { return {
multipleSelection: [],
conditionList: {},
invoiceColorType: [ invoiceColorType: [
{ label: '红字发票', value: '1' }, { label: '红字发票', value: '1' },
{ label: '蓝字发票', value: '0' } { label: '蓝字发票', value: '0' }
...@@ -37,7 +85,7 @@ export default { ...@@ -37,7 +85,7 @@ export default {
{ label: '普通电子发票', value: '2' }, { label: '普通电子发票', value: '2' },
{ label: '专用纸质发票', value: '3' } { label: '专用纸质发票', value: '3' }
], ],
taxpayer_type: [ taxpayerType: [
{ label: '个人', value: '1' }, { label: '个人', value: '1' },
{ label: '企业', value: '2' }, { label: '企业', value: '2' },
{ label: '非营利性单位', value: '3' } { label: '非营利性单位', value: '3' }
...@@ -59,9 +107,22 @@ export default { ...@@ -59,9 +107,22 @@ export default {
const _this = this const _this = this
return { return {
remote: { remote: {
httpRequest: getInvoiceList httpRequest: getInvoiceList,
// params: { shop_id: this.shopId, spu_id: '', spu_name: '', group_id: '', price_min: '', price_max: '' } params: { invoice_haoma: '', name: '', txn_id: '', invoice_type: '', invoice_color_type: '', sales_rep_user_id: '', can_add_invoice: '', firstDate: '', lastDate: '' },
// beforeRequest: this.beforeRequest beforeRequest: this.beforeRequest,
callback(data) {
data.forEach(item => {
// 发票类型
item.invoiceTypeViewName = _this.findName(_this.invoiceType, item.invoice_type)
// 抬头类型
item.taxpayeTypeViewName = _this.findName(_this.taxpayerType, item.taxpayer_type)
// 开票类型
item.invoiceColorTypeViewName = _this.findName(_this.invoiceColorType, item.invoice_color_type)
// 开票状态
item.invoiceStatusViewName = _this.findName(_this.invoiceStatus, item.invoice_status)
})
return data
}
}, },
filters: [ filters: [
{ type: 'input', prop: 'invoice_haoma', placeholder: '发票号码' }, { type: 'input', prop: 'invoice_haoma', placeholder: '发票号码' },
...@@ -80,8 +141,25 @@ export default { ...@@ -80,8 +141,25 @@ export default {
placeholder: '请选择开票类型' placeholder: '请选择开票类型'
} }
], ],
moreFilters: [
{
prop: 'sales_rep_user_id',
label: '跟进人',
type: 'select',
placeholder: '跟进人',
options: this.conditionList.sales_rep_user_id,
labelKey: 'user_name',
valueKey: 'user_id',
filterable: true,
remote: true
},
{ label: '允许开具发票', prop: 'can_add_invoice', slots: 'ticket_type' },
{ label: '首次缴费时间', prop: 'firstDate', slots: 'firstDate' },
{ label: '末次缴费时间', prop: 'lastDate', slots: 'lastDate' }
],
columnsOptions: { key: 'invoices' }, columnsOptions: { key: 'invoices' },
columns: [ columns: [
{ type: 'selection', minWidth: '50px', fixed: 'left' },
{ label: '发票代码', prop: 'invoice_daima' }, { label: '发票代码', prop: 'invoice_daima' },
{ label: '发票号码', prop: 'invoice_haoma' }, { label: '发票号码', prop: 'invoice_haoma' },
{ label: '客户姓名', prop: 'name' }, { label: '客户姓名', prop: 'name' },
...@@ -94,36 +172,9 @@ export default { ...@@ -94,36 +172,9 @@ export default {
{ label: '不含税金额', prop: 'invoice_excluding_tax_amount' }, { label: '不含税金额', prop: 'invoice_excluding_tax_amount' },
{ label: '含税金额', prop: 'invoice_total_amount' }, { label: '含税金额', prop: 'invoice_total_amount' },
{ label: '缴费时间', prop: 'final_payment_time' }, { label: '缴费时间', prop: 'final_payment_time' },
{ { label: '发票类型', prop: 'invoiceTypeViewName' },
label: '发票类型', { label: '抬头类型', prop: 'taxpayeTypeViewName' },
prop: 'invoice_type', { label: '开票类型', prop: 'invoiceColorTypeViewName' },
computed({ row }) {
const found = _this.invoiceType.find(item => {
return parseInt(item.value) === parseInt(row.invoice_type)
})
return found ? found.label : row.invoice_type
}
},
{
label: '抬头类型',
prop: 'taxpayer_type',
computed({ row }) {
const found = _this.taxpayer_type.find(item => {
return parseInt(item.value) === parseInt(row.taxpayer_type)
})
return found ? found.label : row.taxpayer_type
}
},
{
label: '开票类型',
prop: 'invoice_color_type',
computed({ row }) {
const found = _this.invoiceColorType.find(item => {
return parseInt(item.value) === parseInt(row.invoice_color_type)
})
return found ? found.label : row.invoice_color_type
}
},
{ label: '原发票号码', prop: 'old_invoice_haoma' }, { label: '原发票号码', prop: 'old_invoice_haoma' },
{ label: '原发票代码', prop: 'old_invoice_daima' }, { label: '原发票代码', prop: 'old_invoice_daima' },
{ label: '纳税人名称', prop: 'taxpayer_name' }, { label: '纳税人名称', prop: 'taxpayer_name' },
...@@ -140,76 +191,94 @@ export default { ...@@ -140,76 +191,94 @@ export default {
{ label: '票据跟进人', prop: 'sales_rep_user_id_name' }, { label: '票据跟进人', prop: 'sales_rep_user_id_name' },
{ label: '发票申请日期', prop: 'invoice_application_time' }, { label: '发票申请日期', prop: 'invoice_application_time' },
{ label: '开票时间', prop: 'invoice_issuing_time' }, { label: '开票时间', prop: 'invoice_issuing_time' },
{ { label: '开票状态', prop: 'invoiceStatusViewName' },
label: '开票状态',
prop: 'invoice_status',
computed({ row }) {
const found = _this.invoiceStatus.find(item => {
return parseInt(item.value) === parseInt(row.invoice_status)
})
return found ? found.label : row.invoice_status
}
},
{ label: '操作', slots: 'table-x', align: 'center', fixed: 'right' } { label: '操作', slots: 'table-x', align: 'center', fixed: 'right' }
],
data: [
{
invoice_code: '1',
invoice_num: '2016-05-02',
data1: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
order: '99832459873849'
},
{
invoice_code: '2',
invoice_num: '2016-05-04',
data1: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄',
order: '99832459873849'
},
{
invoice_code: '3',
invoice_num: '2016-05-01',
data1: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄',
order: '99832459873849'
},
{
invoice_code: '4',
invoice_num: '2016-05-03',
data1: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄',
order: '99832459873849'
}
] ]
} }
} }
}, },
created() {
getCondition().then(res => {
this.conditionList = res.data
})
},
methods: { methods: {
dialogHide() {
this.isShowDialog = false
},
beforeRequest(params, isReset) { beforeRequest(params, isReset) {
// 重置 if (params.firstDate) {
if (isReset) { const [firstTimeFrom, firstTimeTo] = params.firstDate
params.price_min = '' params.first_payment_time_from = firstTimeFrom
params.price_max = '' params.first_payment_time_to = firstTimeTo
}
if (params.lastDate) {
const [finalTimeFrom, finalTimeTo] = params.lastDate
params.final_payment_time_from = finalTimeFrom
params.final_payment_time_to = finalTimeTo
} }
params.status = this.activeName === '0' ? '' : this.activeName
params.price_zone = `${params.price_min || ''},${params.price_max || ''}`
return params return params
}, },
// 编辑 // 分配票据跟进人弹窗
handleUpdate(row) { dialogHide() {
this.$router.push({ name: 'goodsEdit', params: { id: row.spu_id } }) this.isShowDialog = false
}, },
// 选择 // 选择
handleSelectionChange(value) { handleSelectionChange(value) {
this.multipleSelection = value this.multipleSelection = value
},
// 分配票据跟进人
isHandleSelection() {
this.multipleSelection.length
? (this.isShowDialog = true)
: this.$message({ message: '请选择列表', type: 'warning' })
},
// 选择跟进人后刷新列表
success() {
this.$refs.list.refetch()
},
// 导出
exportSelect() {
const list = this.tableOptions.columns.filter(item => {
return item.prop && item.prop !== 'head_img'
})
const headList = list.map(item => item.label)
const propList = list.map(item => item.prop)
const excelList = []
excelList.push(headList)
console.log(this.tableOptions.columns, '321123==')
this.multipleSelection.forEach(item => {
const rowValArr = []
propList.forEach(key => {
let val = item[key]
if (key === 'can_add_invoice') val = val === '1' ? '允许' : '不允许'
rowValArr.push(val)
})
excelList.push(rowValArr)
})
const ws = XLSX.utils.aoa_to_sheet(excelList)
ws['!cols'] = [
{ wpx: 120 },
{ wpx: 120 },
{ wpx: 160 },
{ wpx: 180 },
{ wpx: 120 },
{ wpx: 80 },
{ wpx: 200 },
{ wpx: 120 },
{ wpx: 120 }
]
const wb = XLSX.utils.book_new()
wb.SheetNames.push('Worksheet')
wb.Sheets.Worksheet = ws
const wopts = { bookType: 'xlsx', bookSST: false, type: 'array' }
const wbout = XLSX.write(wb, wopts)
const url = URL.createObjectURL(new window.Blob([wbout], { type: 'application/octet-stream' }))
funDownload(url, `发票列表_${Date.now()}.xlsx`)
},
// 过滤对应option label
findName(names, item) {
const found = names.find(findItem => {
return parseInt(findItem.value) === parseInt(item)
})
return found ? found.label : item
} }
} }
} }
......
...@@ -216,6 +216,7 @@ export default { ...@@ -216,6 +216,7 @@ export default {
], ],
moreFilters: [ moreFilters: [
{ {
prop: 'sales_rep_user_id',
label: '跟进人', label: '跟进人',
type: 'select', type: 'select',
placeholder: '跟进人', placeholder: '跟进人',
...@@ -226,6 +227,7 @@ export default { ...@@ -226,6 +227,7 @@ export default {
remote: true remote: true
}, },
{ {
prop: 'invoice_type',
label: '发票类型', label: '发票类型',
type: 'select', type: 'select',
placeholder: '发票类型', placeholder: '发票类型',
......
<template> <template>
<div> <div>
<app-card style="max-width: 100%"> <app-card style="max-width: 100%">
<app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange"> <app-list v-bind="tableOptions" ref="list">
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ name: 'invoiceView', params: { id: row.id } }"> <router-link :to="{ name: 'invoiceView', params: { id: row.id } }">
<el-button type="text">查看</el-button> <el-button type="text">查看</el-button>
...@@ -94,22 +94,6 @@ export default { ...@@ -94,22 +94,6 @@ export default {
] ]
} }
} }
},
methods: {
beforeRequest(params, isReset) {
// 重置
if (isReset) {
params.price_min = ''
params.price_max = ''
}
params.status = this.activeName === '0' ? '' : this.activeName
params.price_zone = `${params.price_min || ''},${params.price_max || ''}`
return params
},
// 选择
handleSelectionChange(value) {
this.multipleSelection = value
}
} }
} }
</script> </script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论