diff --git a/src/views/company/invoice/index.vue b/src/views/company/invoice/index.vue index 5fd02ee..c08a074 100644 --- a/src/views/company/invoice/index.vue +++ b/src/views/company/invoice/index.vue @@ -1,132 +1,735 @@ @@ -141,32 +744,36 @@ import { createInvoice01, updateInvoice01, getInvoice01, - invoiceScanApi01, - invoiceCheckApi01, + // invoiceScanApi01, + // invoiceCheckApi01, createInvoice02, updateInvoice02, getInvoice02, - invoiceScanApi02, - invoiceCheckApi02, + // invoiceScanApi02, + // invoiceCheckApi02, createInvoice03, updateInvoice03, getInvoice03, - invoiceScanApi03, - invoiceCheckApi03, + // invoiceScanApi03, + // invoiceCheckApi03, createInvoice04, updateInvoice04, getInvoice04, - invoiceScanApi04, - invoiceCheckApi04, + // invoiceScanApi04, + // invoiceCheckApi04, createInvoice05, updateInvoice05, getInvoice05, - invoiceScanApi05, - invoiceCheckApi05, - exportInvoiceExcel01, exportInvoiceExcel02, exportInvoiceExcel03, exportInvoiceExcel04, exportInvoiceExcel05 -} from "@/api/bs/invoice"; -import { listData } from "@/api/system/dict/data"; -import { getDictDatas, DICT_TYPE } from "@/utils/dict"; + // invoiceScanApi05, + // invoiceCheckApi05, + // exportInvoiceExcel01, + // exportInvoiceExcel02, + // exportInvoiceExcel03, + // exportInvoiceExcel04, + // exportInvoiceExcel05, +} from '@/api/bs/invoice' +import { listData } from '@/api/system/dict/data' +import { getDictDatas, DICT_TYPE } from '@/utils/dict' import VerifyFunc from '@/utils/verify' import { Dialog } from 'vant' export default { @@ -174,21 +781,18 @@ export default { //import引入组件才能使用 props: {}, components: { - RePick: () => import('@/components/ReComponents/RePick'), - FollowPeoPle: () => import('@/components/FollowPeoPle'), - UploadFile: () => import('@/components/UploadFile'), + // RePick: () => import('@/components/ReComponents/RePick'), + // FollowPeoPle: () => import('@/components/FollowPeoPle'), + // UploadFile: () => import('@/components/UploadFile'), UploadImagePdf: () => import('@/components/UploadImagePdf'), }, // 生命周期,创建完成时(可以访问当前this实例) created() { this.handleInitList() this.handleInitForm() - }, // 生命周期:挂载完成时(可以访问DOM元素) - mounted() { - - }, + mounted() {}, data() { return { isChecked: false, @@ -198,9 +802,27 @@ export default { typeStr: null, // show: 查看 edit: 编辑: 其他新增 fileList: [], btnList: [ - { title: '删除', icon: 'delete-o', color: "#EC3359", key: 'del', show: ['edit'].includes(this.$route.query.type) }, - { title: '提交', icon: 'edit', color: "#ff9900", key: 'submit', show: ['edit', 'add'].includes(this.$route.query.type) }, - { title: '返回', icon: 'revoke', color: "#909399", key: 'back', show: true }, + { + title: '删除', + icon: 'delete-o', + color: '#EC3359', + key: 'del', + show: ['edit'].includes(this.$route.query.type), + }, + { + title: '提交', + icon: 'edit', + color: '#ff9900', + key: 'submit', + show: ['edit', 'add'].includes(this.$route.query.type), + }, + { + title: '返回', + icon: 'revoke', + color: '#909399', + key: 'back', + show: true, + }, ], tripTypeList: [], index: 0, @@ -209,11 +831,11 @@ export default { defaultDate: new Date(), dateShow: false, form: {}, - invoiceType:'01', - dateType:'', - timeShow:false, - currentTime:'', - timeType:'', + invoiceType: '01', + dateType: '', + timeShow: false, + currentTime: '', + timeType: '', ServiceTypeList: [ { text: '餐饮', value: '餐饮' }, { text: '电器设备', value: '电器设备' }, @@ -235,14 +857,14 @@ export default { { text: '电子发票(专用发票)', value: '电子发票(专用发票)' }, { text: '电子发票(普通发票)', value: '电子发票(普通发票)' }, ], - agentList:[ + agentList: [ { text: '否', value: false }, { text: '是', value: true }, ], - serviceTypeShow:false, - invoiceTypeShow:false, - agentTypeShow:false - }; + serviceTypeShow: false, + invoiceTypeShow: false, + agentTypeShow: false, + } }, // 计算属性 computed: { @@ -272,16 +894,36 @@ export default { watch: {}, // 方法集合 methods: { - handleBlur1(val) { - if ((this.form.taxAmount || this.form.taxAmount === 0) || (this.form.excludingTaxAmount || this.form.excludingTaxAmount === 0)) { - this.$set(this.form, 'totalAmount', Number(this.form.taxAmount || 0) + Number(this.form.excludingTaxAmount || 0)) + handleBlur1() { + if ( + this.form.taxAmount || + this.form.taxAmount === 0 || + this.form.excludingTaxAmount || + this.form.excludingTaxAmount === 0 + ) { + this.$set( + this.form, + 'totalAmount', + Number(this.form.taxAmount || 0) + + Number(this.form.excludingTaxAmount || 0) + ) } else { this.$set(this.form, 'totalAmount', null) } }, - handleBlur2(val) { - if ((this.form.taxAmount || this.form.taxAmount === 0) || (this.form.excludingTaxAmount || this.form.excludingTaxAmount === 0)) { - this.$set(this.form, 'totalAmount', Number(this.form.taxAmount || 0) + Number(this.form.excludingTaxAmount || 0)) + handleBlur2() { + if ( + this.form.taxAmount || + this.form.taxAmount === 0 || + this.form.excludingTaxAmount || + this.form.excludingTaxAmount === 0 + ) { + this.$set( + this.form, + 'totalAmount', + Number(this.form.taxAmount || 0) + + Number(this.form.excludingTaxAmount || 0) + ) } else { this.$set(this.form, 'totalAmount', null) } @@ -295,39 +937,62 @@ export default { // ...obj // } // if (isChecked) { - // } else + // } else }, handleCheck() { this.$nextTick(() => { - this.$refs.form.validate().then(() => { - this.scanRes = { - ...this.form, - invoiceDate: `${dayjs(this.form.invoiceDate).valueOf()}` - } - this.$refs.UploadImagePdf.beginCheck() - }).catch((err) => { - if (err && err.length > 0){ - this.$fm('您还有数据未填写') - } - if (err && err.length > 0 && err[0].name) { - const fieldElement = this.$refs.form.$el.querySelector(`[name="${err[0].name}"]`); - const fieldHeight = fieldElement.offsetHeight; - const scrollHeight = fieldHeight + 50; // 假设添加了 50px 的额外高度 - this.$refs.form.scrollToField(err[0].name, scrollHeight); - } - }) + this.$refs.form + .validate() + .then(() => { + this.scanRes = { + ...this.form, + invoiceDate: `${dayjs(this.form.invoiceDate).valueOf()}`, + } + this.$refs.UploadImagePdf.beginCheck() + }) + .catch((err) => { + if (err && err.length > 0) { + this.$fm('您还有数据未填写') + } + if (err && err.length > 0 && err[0].name) { + const fieldElement = this.$refs.form.$el.querySelector( + `[name="${err[0].name}"]` + ) + const fieldHeight = fieldElement.offsetHeight + const scrollHeight = fieldHeight + 50 // 假设添加了 50px 的额外高度 + this.$refs.form.scrollToField(err[0].name, scrollHeight) + } + }) }) }, hanadleScanRes(res) { this.form = { ...(res.data || {}), - invoiceDate1: `${res.data.invoiceDate ? dayjs(res.data.invoiceDate).format('YYYY/MM/DD') : ''}`, - startingDate1:`${res.data.startingDate ? dayjs(res.data.startingDate).format('YYYY/MM/DD') : ''}`, - startTime1:`${res.data.startTime ? dayjs(res.data.startTime).format('YYYY/MM/DD') : ''}`, - endTime1:`${res.data.endTime ? dayjs(res.data.endTime).format('YYYY/MM/DD') : ''}`, - applicationDate1:`${res.data.applicationDate ? dayjs(res.data.applicationDate).format('YYYY/MM/DD') : ''}`, - agent1:res.data.agent, - type: res.data.type + invoiceDate1: `${ + res.data.invoiceDate + ? dayjs(res.data.invoiceDate).format('YYYY/MM/DD') + : '' + }`, + startingDate1: `${ + res.data.startingDate + ? dayjs(res.data.startingDate).format('YYYY/MM/DD') + : '' + }`, + startTime1: `${ + res.data.startTime + ? dayjs(res.data.startTime).format('YYYY/MM/DD') + : '' + }`, + endTime1: `${ + res.data.endTime ? dayjs(res.data.endTime).format('YYYY/MM/DD') : '' + }`, + applicationDate1: `${ + res.data.applicationDate + ? dayjs(res.data.applicationDate).format('YYYY/MM/DD') + : '' + }`, + agent1: res.data.agent, + type: res.data.type, } this.scanRes = res.data || {} }, @@ -336,34 +1001,65 @@ export default { }, handleInitForm() { let _this = this - const { id, type,invoiceType } = this.$route.query || {} + const { id, type, invoiceType } = this.$route.query || {} this.typeStr = type this.invoiceType = invoiceType if (id) { this.$loading(true, 'loadingSb') - const getInvoice = _this.invoiceType == '01' ? getInvoice01 : _this.invoiceType == '02' ? getInvoice02 : _this.invoiceType == '03' ? getInvoice03 : _this.invoiceType == '04' ? getInvoice04 : getInvoice05; - getInvoice(id).then((res) => { - let backRes = res.data || {} - this.form = { - ...backRes, - invoiceDate1: `${res.data.invoiceDate ? dayjs(res.data.invoiceDate).format('YYYY/MM/DD') : ''}`, - startingDate1:`${res.data.startingDate ? dayjs(res.data.startingDate).format('YYYY/MM/DD') : ''}`, - startTime1:`${res.data.startTime ? dayjs(res.data.startTime).format('YYYY/MM/DD') : ''}`, - endTime1:`${res.data.endTime ? dayjs(res.data.endTime).format('YYYY/MM/DD') : ''}`, - applicationDate1:`${res.data.applicationDate ? dayjs(res.data.applicationDate).format('YYYY/MM/DD') : ''}`, - agent1:res.data.agent, - type: backRes.type - } - this.fileList = res.data.files || [] - if (res.data && res.data.status == 1) { - this.isChecked = true - } else { - this.isChecked = false - } - // this.handleBlur1() - }).finally(() => { - this.$loading(false, 'loadingSb') - }) + const getInvoice = + _this.invoiceType == '01' + ? getInvoice01 + : _this.invoiceType == '02' + ? getInvoice02 + : _this.invoiceType == '03' + ? getInvoice03 + : _this.invoiceType == '04' + ? getInvoice04 + : getInvoice05 + getInvoice(id) + .then((res) => { + let backRes = res.data || {} + this.form = { + ...backRes, + invoiceDate1: `${ + res.data.invoiceDate + ? dayjs(res.data.invoiceDate).format('YYYY/MM/DD') + : '' + }`, + startingDate1: `${ + res.data.startingDate + ? dayjs(res.data.startingDate).format('YYYY/MM/DD') + : '' + }`, + startTime1: `${ + res.data.startTime + ? dayjs(res.data.startTime).format('YYYY/MM/DD') + : '' + }`, + endTime1: `${ + res.data.endTime + ? dayjs(res.data.endTime).format('YYYY/MM/DD') + : '' + }`, + applicationDate1: `${ + res.data.applicationDate + ? dayjs(res.data.applicationDate).format('YYYY/MM/DD') + : '' + }`, + agent1: res.data.agent, + type: backRes.type, + } + this.fileList = res.data.files || [] + if (res.data && res.data.status == 1) { + this.isChecked = true + } else { + this.isChecked = false + } + // this.handleBlur1() + }) + .finally(() => { + this.$loading(false, 'loadingSb') + }) } }, handleUpload(list) { @@ -371,26 +1067,37 @@ export default { }, handleNewConfirmPo(arr, index) { let nameArr = [] - this.userList.forEach(element => { + this.userList.forEach((element) => { if (arr.includes(element.id)) { nameArr.push(element.nickname) } - }); + }) this.$set(this.form.expenseApplyTrips[index], 'tripPartners', arr) - this.$set(this.form.expenseApplyTrips[index], 'tripPartnersName', nameArr.join('、')) + this.$set( + this.form.expenseApplyTrips[index], + 'tripPartnersName', + nameArr.join('、') + ) this.$set(this.form.expenseApplyTrips[index], 'isOpen', false) }, handleConfirmPo(arr, index) { - let nameArr = this.form.expenseApplyTrips[index].tripPartnersName && this.form.expenseApplyTrips[index].tripPartnersName.split('、') || [] + let nameArr = + (this.form.expenseApplyTrips[index].tripPartnersName && + this.form.expenseApplyTrips[index].tripPartnersName.split('、')) || + [] let newArr = this.form.expenseApplyTrips[index].tripPartners || [] - this.userList.forEach(element => { + this.userList.forEach((element) => { if (arr.includes(element.id)) { nameArr.push(element.nickname) newArr.push(element.id) } - }); + }) this.$set(this.form.expenseApplyTrips[index], 'tripPartners', newArr) - this.$set(this.form.expenseApplyTrips[index], 'tripPartnersName', nameArr.join('、')) + this.$set( + this.form.expenseApplyTrips[index], + 'tripPartnersName', + nameArr.join('、') + ) this.$set(this.form.expenseApplyTrips[index], 'isOpen', false) }, handlePoShow(index) { @@ -398,10 +1105,8 @@ export default { this.$set(this.form.expenseApplyTrips[index], 'type', 0) this.$set(this.form.expenseApplyTrips[index], 'isOpen', true) } else { - this.$fm('请先添加同行人!') } - }, handlePoCancel(index) { this.$set(this.form.expenseApplyTrips[index], 'isOpen', false) @@ -415,64 +1120,98 @@ export default { Dialog.confirm({ title: '提示', message: '你确定要删除吗?', - }) - .then(() => { - this.$loading(true, 'form') - const deleteInvoice = this.invoiceType == '01' ? deleteInvoice01 : this.invoiceType == '02' ? deleteInvoice02 : this.invoiceType == '03' ? deleteInvoice03 : this.invoiceType == '04' ? deleteInvoice04 : deleteInvoice05; - deleteInvoice(this.form.id).then(() => { + }).then(() => { + this.$loading(true, 'form') + const deleteInvoice = + this.invoiceType == '01' + ? deleteInvoice01 + : this.invoiceType == '02' + ? deleteInvoice02 + : this.invoiceType == '03' + ? deleteInvoice03 + : this.invoiceType == '04' + ? deleteInvoice04 + : deleteInvoice05 + deleteInvoice(this.form.id) + .then(() => { // 清楚缓存 this.$EventBus.$emit('handleResetLive', 'company-myInvoice') this.$loading(false, 'form') history.back() - }).catch(() => { + }) + .catch(() => { this.$loading(false, 'form') }) - }) + }) return } if (key === 'back') { return history.back() } this.$nextTick(() => { - this.$refs.form.validate().then(() => { - // 添加/修改的提交 - let newForm = { - ...this.form, - files: this.fileList, - } - this.$loading(true, 'form') - if (newForm.id != null) { - const updateInvoice = this.invoiceType == '01' ? updateInvoice01 : this.invoiceType == '02' ? updateInvoice02 : this.invoiceType == '03' ? updateInvoice03 : this.invoiceType == '04' ? updateInvoice04 : updateInvoice05; - updateInvoice(newForm).then(() => { - history.back() - this.$modal.msgSuccess("修改成功!"); - this.$loading(false, 'form') - }).catch(() => { + this.$refs.form + .validate() + .then(() => { + // 添加/修改的提交 + let newForm = { + ...this.form, + files: this.fileList, + } + this.$loading(true, 'form') + if (newForm.id != null) { + const updateInvoice = + this.invoiceType == '01' + ? updateInvoice01 + : this.invoiceType == '02' + ? updateInvoice02 + : this.invoiceType == '03' + ? updateInvoice03 + : this.invoiceType == '04' + ? updateInvoice04 + : updateInvoice05 + updateInvoice(newForm) + .then(() => { + history.back() + this.$modal.msgSuccess('修改成功!') + this.$loading(false, 'form') + }) + .catch(() => { + this.$loading(false, 'form') + }) + return + } + const createInvoice = + this.invoiceType == '01' + ? createInvoice01 + : this.invoiceType == '02' + ? createInvoice02 + : this.invoiceType == '03' + ? createInvoice03 + : this.invoiceType == '04' + ? createInvoice04 + : createInvoice05 + createInvoice(newForm).then(() => { this.$loading(false, 'form') + this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`) + // 清楚缓存 + this.$EventBus.$emit('handleResetLive', 'company-myInvoice') + history.back() }) - return; - } - const createInvoice = this.invoiceType == '01' ? createInvoice01 : this.invoiceType == '02' ? createInvoice02 : this.invoiceType == '03' ? createInvoice03 : this.invoiceType == '04' ? createInvoice04 : createInvoice05; - createInvoice(newForm).then(() => { + }) + .catch((err) => { this.$loading(false, 'form') - this.$sm(`${this.form.id ? '修改成功!' : '新增成功!'}`) - // 清楚缓存 - this.$EventBus.$emit('handleResetLive', 'company-myInvoice') - history.back() - }); - }).catch((err) => { - this.$loading(false, 'form') - if (err && err.length > 0){ - this.$fm('您还有数据未填写') - } - if (err && err.length > 0 && err[0].name) { - const fieldElement = this.$refs.form.$el.querySelector(`[name="${err[0].name}"]`); - const fieldHeight = fieldElement.offsetHeight; - const scrollHeight = fieldHeight + 50; // 假设添加了 50px 的额外高度 - this.$refs.form.scrollToField(err[0].name, scrollHeight); - - } - }) + if (err && err.length > 0) { + this.$fm('您还有数据未填写') + } + if (err && err.length > 0 && err[0].name) { + const fieldElement = this.$refs.form.$el.querySelector( + `[name="${err[0].name}"]` + ) + const fieldHeight = fieldElement.offsetHeight + const scrollHeight = fieldHeight + 50 // 假设添加了 50px 的额外高度 + this.$refs.form.scrollToField(err[0].name, scrollHeight) + } + }) }) }, handleDel(index) { @@ -490,7 +1229,7 @@ export default { tripDay: undefined, tripType: null, tripPartners: [], // 出差同行人 - tripPartnersName: "", + tripPartnersName: '', amount: undefined, isOpen: false, type: 0, @@ -509,77 +1248,100 @@ export default { }, handleDateShow(dateType) { this.dateType = dateType - let date = dateType == 'invoiceDate'?this.form.invoiceDate:dateType=='startingDate'?this.form.startingDate:dateType=='startTime'?this.form.startTime:dateType=='endTime'?this.form.endTime:dateType=='applicationDate'?this.form.applicationDate:'' + let date = + dateType == 'invoiceDate' + ? this.form.invoiceDate + : dateType == 'startingDate' + ? this.form.startingDate + : dateType == 'startTime' + ? this.form.startTime + : dateType == 'endTime' + ? this.form.endTime + : dateType == 'applicationDate' + ? this.form.applicationDate + : '' // const { date } = this.form this.$nextTick(() => { this.$refs.vanCalendar && this.$refs.vanCalendar.reset() this.dateShow = true if (date) { - let time = dayjs(Number(date)).format('YYYY/MM/DD'); + let time = dayjs(Number(date)).format('YYYY/MM/DD') this.defaultDate = new Date(time) } }) }, handleDateSelect(val) { - if(this.dateType == 'invoiceDate'){ - this.$set(this.form, 'invoiceDate1', `${dayjs(val).format('YYYY/MM/DD')}`) + if (this.dateType == 'invoiceDate') { + this.$set( + this.form, + 'invoiceDate1', + `${dayjs(val).format('YYYY/MM/DD')}` + ) this.$set(this.form, 'invoiceDate', `${dayjs(val).valueOf()}`) - }else if(this.dateType == 'startingDate'){ - this.$set(this.form, 'startingDate1', `${dayjs(val).format('YYYY/MM/DD')}`) + } else if (this.dateType == 'startingDate') { + this.$set( + this.form, + 'startingDate1', + `${dayjs(val).format('YYYY/MM/DD')}` + ) this.$set(this.form, 'startingDate', `${dayjs(val).valueOf()}`) - }else if(this.dateType == 'startTime'){ + } else if (this.dateType == 'startTime') { this.$set(this.form, 'startTime1', `${dayjs(val).format('YYYY/MM/DD')}`) this.$set(this.form, 'startTime', `${dayjs(val).valueOf()}`) - }else if(this.dateType == 'endTime'){ + } else if (this.dateType == 'endTime') { this.$set(this.form, 'endTime1', `${dayjs(val).format('YYYY/MM/DD')}`) this.$set(this.form, 'endTime', `${dayjs(val).valueOf()}`) - }else if(this.dateType == 'applicationDate'){ - this.$set(this.form, 'applicationDate1', `${dayjs(val).format('YYYY/MM/DD')}`) + } else if (this.dateType == 'applicationDate') { + this.$set( + this.form, + 'applicationDate1', + `${dayjs(val).format('YYYY/MM/DD')}` + ) this.$set(this.form, 'applicationDate', `${dayjs(val).valueOf()}`) } this.dateShow = false }, - handleTimeShow(timeType,date){ + handleTimeShow(timeType, date) { this.timeShow = true this.currentTime = date this.timeType = timeType }, - timeConfirm(val){ - if(this.timeType=='pickupTime'){ + timeConfirm(val) { + if (this.timeType == 'pickupTime') { this.form.pickupTime = val - }else if(this.timeType=='dropoffTime'){ + } else if (this.timeType == 'dropoffTime') { this.form.dropoffTime = val - }else if(this.timeType=='startingTime'){ + } else if (this.timeType == 'startingTime') { this.form.startingTime = val } this.timeShow = false }, - timeCancel(){ + timeCancel() { this.timeShow = false }, - serviceTypeOnConfirm(value){ + serviceTypeOnConfirm(value) { this.form.serviceType = value.text this.serviceTypeShow = false }, - invoiceTypeOnConfirm(value){ + invoiceTypeOnConfirm(value) { this.form.invoiceType = value.text this.invoiceTypeShow = false }, - agentTypeOnConfirm(value){ + agentTypeOnConfirm(value) { this.form.agent1 = value.text this.form.agent = value.value this.agentTypeShow = false }, - handleServiceTypeShow(){ + handleServiceTypeShow() { this.serviceTypeShow = true }, - handleInvoiceTypeShow(){ + handleInvoiceTypeShow() { this.invoiceTypeShow = true }, - handleAgentTypeShow(){ + handleAgentTypeShow() { this.agentTypeShow = true - } + }, }, } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index d3f9c9c..c8c0935 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -4,13 +4,11 @@
- {{userInfo.nickname}} + {{ userInfo.nickname }}
-
- 财务数字一体化 -
+
财务数字一体化
@@ -27,21 +25,24 @@ -
- 退出 -
+
退出
-
-
{{item.title}}
+
+
{{ item.title }}
- +
- {{nt.title}} + {{ nt.title }}
@@ -55,7 +56,7 @@