diff --git a/src/components/BottomBtn/index.vue b/src/components/BottomBtn/index.vue index ce54ac5..8d140f5 100644 --- a/src/components/BottomBtn/index.vue +++ b/src/components/BottomBtn/index.vue @@ -66,7 +66,7 @@ export default { isAuthorised: Boolean, accessId: [Number, String], isWin: [Number, String], - listType: String, + listType: String }, created() { if (this.$route.query.type === 'add') { @@ -80,8 +80,8 @@ export default { isShow: false, key: null, form: { - reason: null, - }, + reason: null + } } }, watch: { @@ -93,9 +93,9 @@ export default { this.$refs.form && this.$refs.form.resetValidation() }) } - }, + } }, - deep: true, + deep: true }, components: {}, @@ -111,7 +111,7 @@ export default { this.$refs.form.validate().then(() => { let obj = { id: this.accessId, - reason: this.form.reason, + reason: this.form.reason } this.$loading(true, 'loadingSb') if (this.key == 2) { @@ -167,9 +167,15 @@ export default { }) }, handleSubmit(key) { - if (key == 2 || key == 3) { + if (key == 2) { + this.key = key + this.title = '同意' + this.form.reason = '已同意' + // 无需原因,直接同意 + this.handleConfirm() + } else if (key == 3) { this.key = key - this.title = key == 2 ? '同意' : '驳回' + this.title = '驳回' this.isShow = true } else { if (key === 6) { @@ -185,14 +191,14 @@ export default { this.btnList = [ { title: '暂存', icon: 'star-o', color: '#909399', key: 0 }, { title: '提交', icon: 'edit', color: '#ff9900', key: 1 }, - { title: '返回', icon: 'revoke', color: '#909399', key: 6 }, + { title: '返回', icon: 'revoke', color: '#909399', key: 6 } ] } else { if (this.isAuthorised) { this.btnList = [ { title: '同意', icon: 'certificate', color: '#19be6b', key: 2 }, { title: '驳回', icon: 'exchange', color: '#fa3534', key: 3 }, - { title: '返回', icon: 'revoke', color: '#909399', key: 6 }, + { title: '返回', icon: 'revoke', color: '#909399', key: 6 } ] } else { if ( @@ -202,20 +208,20 @@ export default { ) { this.btnList = [ { title: '发起', icon: 'edit', color: '#ff9900', key: 1 }, - { title: '返回', icon: 'revoke', color: '#909399', key: 6 }, + { title: '返回', icon: 'revoke', color: '#909399', key: 6 } ] } else { this.btnList = [ - { title: '返回', icon: 'revoke', color: '#909399', key: 6 }, + { title: '返回', icon: 'revoke', color: '#909399', key: 6 } ] } } } }, 0) - }, - }, + } + } } - \ No newline at end of file + diff --git a/src/components/ConnectInvoice/index.vue b/src/components/ConnectInvoice/index.vue index 0070532..8109868 100644 --- a/src/components/ConnectInvoice/index.vue +++ b/src/components/ConnectInvoice/index.vue @@ -156,7 +156,7 @@ import { getInvoicePage02, getInvoicePage03, getInvoicePage04, - getInvoicePage05, + getInvoicePage05 } from '@/api/bs/invoice' export default { props: { @@ -167,11 +167,11 @@ export default { tripPartners: Array, // 选中同行人 list: Array, // 列表 type: [Number, String], - disabled: Boolean, + disabled: Boolean }, components: { RePick: () => import('@/components/ReComponents/RePick'), - RMList: () => import('@/components/ReComponents/RMList'), + RMList: () => import('@/components/ReComponents/RMList') }, // 计算属性 computed: { @@ -190,10 +190,11 @@ export default { }, userList() { return this.$store.getters.userList - }, + } }, data() { return { + amount: null, tableList: [], demo: false, isShow: false, @@ -205,8 +206,8 @@ export default { listQuery: { pageNo: 1, pageSize: 10, - temClaimNo: 0, - }, + temClaimNo: 0 + } } }, created() { @@ -227,7 +228,7 @@ export default { } }, deep: true, - immediate: true, + immediate: true }, // list: { // handler(val) { @@ -250,8 +251,8 @@ export default { this.getList('init') }, deep: true, - immediate: true, - }, + immediate: true + } }, methods: { handleSetCheck(index, item, type) { @@ -272,6 +273,13 @@ export default { !this.tableList[index].checked ) } + // 加金额显示参数 + this.amount = this.tableList + .filter((e) => e.checked) + .reduce((prev, next) => { + return prev + Number(next.amountInFiguers) + }, 0) + .toFixed(2) console.log(this.tableList[index].checked) if (this.tableList[index].checked) { if (!_this.invoiceIdsCopy.hasOwnProperty(_this.invoiceType)) { @@ -286,6 +294,7 @@ export default { _this.tableList[index].id ) } + // _this.invoiceIdsCopy[_this.invoiceType].push(this.tableList[index].id) } else { _this.invoiceIdsCopy[_this.invoiceType].forEach(function ( @@ -311,7 +320,10 @@ export default { handleConfirm() { // let arr = (this.tableList.filter(item => item.checked)).map(item => item.id) || [] - this.$emit('onConfirm', this.invoiceIdsCopy) + this.$emit('onConfirm', { + invoiceIdsCopy: this.invoiceIdsCopy, + amount: this.amount + }) console.log(this.invoiceIdsCopy, 'this.invoiceIdsCopy') }, @@ -385,8 +397,8 @@ export default { this.$loading(false, 'tableLoading') }) }) - }, - }, + } + } } @@ -473,4 +485,4 @@ export default { border-radius: 100%; margin: 0 0.5rem; } - \ No newline at end of file + diff --git a/src/views/company/claim/index.vue b/src/views/company/claim/index.vue index 5b11b86..1f5f966 100644 --- a/src/views/company/claim/index.vue +++ b/src/views/company/claim/index.vue @@ -311,7 +311,6 @@ label="出差类型" :name="`tripType_${index}`" :list="tripTypeList" - isRequrie isCell clearable /> @@ -371,30 +370,31 @@ :key="nIndex" >
-
+
费用  {{ nIndex + 1 }} - + 报销规则 - - 报销规则 + + - 新增发票 + />新增发票
- +
- - @@ -539,8 +520,8 @@ { required: true, message: '请输入', - validator: VerifyFunc.validatorMoney, - }, + validator: VerifyFunc.validatorMoney + } ]" v-model="item.amount" type="number" @@ -631,8 +612,8 @@ required: true, trigger: 'onBlur', message: '格式错误', - validator: VerifyFunc.validatorMoney, - }, + validator: VerifyFunc.validatorMoney + } ]" type="number" label="金额" @@ -727,8 +708,8 @@ @onCancel="nitem.show = false" :isOpen="nitem.show" @onConfirm=" - (arr) => { - handleConfirmIe1(arr, nIndex) + ({ invoiceIdsCopy, amount }) => { + handleConfirmIe1(invoiceIdsCopy, nIndex, amount) } " /> @@ -836,7 +817,7 @@ import { createExpenseClaim, findClaimRules, getExpenseClaim, - getMyExpenseClaim, + getMyExpenseClaim } from '@/api/bs/expenseClaim' import { getInvoicePage } from '@/api/bs/invoice' import { listData } from '@/api/system/dict/data' @@ -857,7 +838,7 @@ export default { FollowPeoPle: () => import('@/components/FollowPeoPle'), ConnectInvoice: () => import('@/components/ConnectInvoice'), UploadFile: () => import('@/components/UploadFile'), - Rules: () => import('./components/Rules'), + Rules: () => import('./components/Rules') }, // 生命周期,创建完成时(可以访问当前this实例) created() { @@ -888,7 +869,7 @@ export default { { title: '暂存', icon: 'star-o', color: '#909399', key: 0 }, { title: '提交', icon: 'edit', color: '#ff9900', key: 1 }, { title: '同意', icon: 'certificate', color: '#19be6b', key: 2 }, - { title: '驳回', icon: 'exchange', color: '#fa3534', key: 3 }, + { title: '驳回', icon: 'exchange', color: '#fa3534', key: 3 } ], tripTypeList: [], // 出差类型 feeTypeList: [], // 费用类型 @@ -937,10 +918,10 @@ export default { feeType: null, amount: undefined, invoiceCount: undefined, - remark: null, - }, - ], - }, + remark: null + } + ] + } ], // 日常申请的 expenseClaimDetails: [ @@ -952,11 +933,11 @@ export default { feeType: null, amount: undefined, invoiceCount: undefined, - remark: null, - }, - ], + remark: null + } + ] }, - times: null, + times: null } }, // 计算属性 @@ -994,7 +975,7 @@ export default { }, RCBX() { return ['RCBX'].includes(this.$route.query.billType) - }, + } }, // 监听data中的数据变化 watch: {}, @@ -1005,10 +986,10 @@ export default { this.$router.push({ path: '/myInvoice', query: { - isAdd:'isAdd' + isAdd: 'isAdd' } }) - }, + }, getTree() { getAreaTree().then((res) => { let tree = res.data || [] @@ -1050,7 +1031,7 @@ export default { ? destinationLocation[destinationLocation.length - 1] : destinationLocation, feeType, - costDeptId: this.form.costDeptId, + costDeptId: this.form.costDeptId }).then((res) => { this.dialogObj = { dept: getTreeIds(this.userDeptTree, this.form.costDeptId).join('-'), @@ -1062,7 +1043,7 @@ export default { ).join('-'), feetypeName: this.feeTypeList.find((item) => item.value == feeType) .label, - maxMoney: res.data === 0 || res.data ? res.data : '未设置', + maxMoney: res.data === 0 || res.data ? res.data : '未设置' } this.isShow = true }) @@ -1112,7 +1093,7 @@ export default { files: this.fileList, billType: this.$route.query.billType, ignoreFeeTip, - status: key, + status: key } if (this.$route.query.billType === 'RCBX') { delete newForm.expenseClaimTrips @@ -1146,7 +1127,7 @@ export default { if (!response.data) { Dialog.confirm({ title: '提示', - message: `${response.msg} 您确认要提交吗?`, + message: `${response.msg} 您确认要提交吗?` }).then(() => { this.handleBtConfirm(key, 1) }) @@ -1294,13 +1275,18 @@ export default { // // }) }, - handleConfirmIe(arr, index, nIndex) { + handleConfirmIe(arr, index, nIndex, amount) { // let nameArr = ((this.ieList.filter(item => arr.includes(item.id)) || []).map(item => item.invoiceCode)).join('、') this.$set( this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'invoiceIds', arr ) + this.$set( + this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], + 'amount', + amount + ) this.$set( this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'show', @@ -1317,7 +1303,7 @@ export default { this.totalCount(arr) == 0 ? '请关联' : '已关联发票' ) }, - handleConfirmIe1(arr, nIndex) { + handleConfirmIe1(arr, nIndex, amount) { // let nameArr = ((this.ieList.filter(item => arr.includes(item.id)) || []).map(item => item.invoiceCode)).join('、') this.$set(this.form.expenseClaimDetails[nIndex], 'invoiceIds', arr) this.$set(this.form.expenseClaimDetails[nIndex], 'show', false) @@ -1331,6 +1317,7 @@ export default { 'invoiceName', this.totalCount(arr) == 0 ? '请关联' : '已关联发票' ) + this.$set(this.form.expenseClaimDetails[nIndex], 'amount', amount) }, totalCount(obj) { @@ -1361,7 +1348,7 @@ export default { feeType: null, amount: undefined, invoiceCount: undefined, - remark: null, + remark: null }) }, @@ -1371,7 +1358,7 @@ export default { feeType: null, amount: undefined, invoiceCount: undefined, - remark: null, + remark: null }) }, handleInitForm() { @@ -1403,10 +1390,10 @@ export default { ).format('YY/MM/DD')}`, tripPartnersName: nameArr.join('、'), departureLocation: Number(item.departureLocation), - destinationLocation: Number(item.destinationLocation), + destinationLocation: Number(item.destinationLocation) } } - ), + ) } if (Array.isArray(this.form.expenseClaimTrips)) { this.form.expenseClaimTrips.forEach((n) => { @@ -1514,16 +1501,16 @@ export default { feeType: null, amount: undefined, invoiceCount: undefined, - remark: null, - }, - ], + remark: null + } + ] }) }, handleGetInvoiceList(ids = []) { return new Promise((resolve) => { getInvoicePage({ pageNo: 1, - pageSize: this.$store.getters.requestPageSize, + pageSize: this.$store.getters.requestPageSize }).then((res) => { this.ieList = (res.data && res.data.list) || [] getExpenseApplyMyPage({ @@ -1538,7 +1525,7 @@ export default { ids: ids.length ? ids.join(',') : null, sortingFieldStr: encodeURIComponent( JSON.stringify([{ field: 'id', order: 'desc' }]) - ), + ) }).then((res) => { let list = (res.data.list || []).map((item) => { return { @@ -1558,7 +1545,7 @@ export default { ( findAreaIdName(this.areaTree, item.destinationLocation) || {} - ).name, + ).name ] }), time: @@ -1571,7 +1558,7 @@ export default { item.expenseApplyTrips.length - 1 ].endTime ).format('YYYY/MM/DD')}` - : '-', + : '-' } }) list.forEach((element) => { @@ -1594,7 +1581,7 @@ export default { title: `序号:${index + 1} 编号:${item.applyNo}申请人:${ item.nickname }行程路线:${item.rode}出差天数:${item.tripDay || 0}天`, - disabled: item.status != 2 ? true : false, + disabled: item.status != 2 ? true : false } }) @@ -1610,7 +1597,7 @@ export default { listData({ pageNo: 1, pageSize: this.$store.getters.requestPageSize, - dictType: 'bs_trip_type', + dictType: 'bs_trip_type' }).then((res) => { // 出差类型 this.tripTypeList = res.data.list || [] @@ -1618,7 +1605,7 @@ export default { listData({ pageNo: 1, pageSize: this.$store.getters.requestPageSize, - dictType: 'bs_fee_type', + dictType: 'bs_fee_type' }).then((res) => { // 出差类型 this.feeTypeList = res.data.list || [] @@ -1640,7 +1627,7 @@ export default { if (startTime && endTime) { this.defaultDate = [ dayjs(startTime).toDate(), - dayjs(endTime).toDate(), + dayjs(endTime).toDate() ] } }) @@ -1689,10 +1676,10 @@ export default { Number(dayjs(list[1]).diff(dayjs(list[0]), 'day')) + 1 this.$set(this.form.expenseClaimTrips[this.index], 'tripDay', day) this.dateShow = false - }, - }, + } + } } \ No newline at end of file +