|  |  |  | 
|---|
|  |  |  | v-model="form.applyStartTime" | 
|---|
|  |  |  | type="date" | 
|---|
|  |  |  | :picker-options="pickerOptions" | 
|---|
|  |  |  | value-format="yyyy-MM-dd" | 
|---|
|  |  |  | format="yyyy 年 MM 月 dd 日" | 
|---|
|  |  |  | value-format="yyyy-MM-dd HH:mm:ss" | 
|---|
|  |  |  | format="yyyy-MM-dd HH:mm:ss" | 
|---|
|  |  |  | placeholder="选择日期"> | 
|---|
|  |  |  | </el-date-picker> | 
|---|
|  |  |  | <span style="color: #F95601; font-size: 14px;">(次日生效投保请于17:30前提交,超时提交以保险单为准)</span> | 
|---|
|  |  |  | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | prop="currentFee" | 
|---|
|  |  |  | align="center" | 
|---|
|  |  |  | label="当前费用(元)"> | 
|---|
|  |  |  | label="已产生费用(元)"> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | prop="fee" | 
|---|
|  |  |  | 
|---|
|  |  |  | label="费用"> | 
|---|
|  |  |  | <template slot-scope="{row}"> | 
|---|
|  |  |  | <span v-if="activeName === '0'">{{row.fee}}</span> | 
|---|
|  |  |  | <span v-else>-{{row.fee}}</span> | 
|---|
|  |  |  | <span v-else>{{row.fee ? '-' + row.fee : ''}}</span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | 
|---|
|  |  |  | <importEmployees ref="importEmployees" @result="getValue" /> | 
|---|
|  |  |  | <!--    确认工种    --> | 
|---|
|  |  |  | <confirmJobType ref="confirmJobType" @result="getUser" /> | 
|---|
|  |  |  | <!--    详情    --> | 
|---|
|  |  |  | <ApplyChangeDetails1 ref="ApplyChangeDetails1" @success="success" /> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | import addEmployee from '@/components/enterprise/addEmployee' | 
|---|
|  |  |  | import importEmployees from '@/components/enterprise/importEmployees' | 
|---|
|  |  |  | import confirmJobType from '@/components/enterprise/confirmJobType' | 
|---|
|  |  |  | import ApplyChangeDetails1 from '@/components/business/ApplyChangeDetails1' | 
|---|
|  |  |  | import { all } from '@/api/business/solutions' | 
|---|
|  |  |  | import { getDetail } from '@/api/business/insuranceApply' | 
|---|
|  |  |  | import { create, getChangeCountCyclePriceVO } from '@/api/business/applyChange' | 
|---|
|  |  |  | import { getDate, compareDates, getTomorrow } from '@/utils/util' | 
|---|
|  |  |  | import { mapState } from 'vuex' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'additionSubtractionApplication', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType }, | 
|---|
|  |  |  | components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType, ApplyChangeDetails1 }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | list: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | computed: { | 
|---|
|  |  |  | ...mapState(['userInfo']) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created () { | 
|---|
|  |  |  | this.config({ | 
|---|
|  |  |  | 
|---|
|  |  |  | getDetail(this.form.id) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.list.push(res) | 
|---|
|  |  |  | this.item = res | 
|---|
|  |  |  | this.endTime = res.endTime | 
|---|
|  |  |  | this.form.solutionId = res.solutionId | 
|---|
|  |  |  | this.form.solutionsName = res.solutionsName | 
|---|
|  |  |  | this.pickerOptions = { | 
|---|
|  |  |  | disabledDate(time) { | 
|---|
|  |  |  | // - 8.64e7 | 
|---|
|  |  |  | return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date().getTime() | 
|---|
|  |  |  | // 当前日期大于等于生效日期并且最后一次操作时间等于空 | 
|---|
|  |  |  | if ([1,3].includes(compareDates(getDate(), res.startTime)) && !res.lastChangeDate) { | 
|---|
|  |  |  | return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(getTomorrow()).getTime() | 
|---|
|  |  |  | // 当前日期小于生效日期并且最后一次操作时间等于空 | 
|---|
|  |  |  | } else if (compareDates(getDate(), res.startTime) === 2 && !res.lastChangeDate) { | 
|---|
|  |  |  | return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(res.startTime).getTime() | 
|---|
|  |  |  | // 最后一次操作时间有值 | 
|---|
|  |  |  | } else if (res.lastChangeDate) { | 
|---|
|  |  |  | // 当前日期大于最后一次操作时间 | 
|---|
|  |  |  | if ([1,3].includes(compareDates(getDate(), res.lastChangeDate))) { | 
|---|
|  |  |  | return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(getTomorrow()).getTime() | 
|---|
|  |  |  | // 当前时间小于最后一次操作时间 | 
|---|
|  |  |  | } else if (compareDates(getDate(), res.lastChangeDate) === 2) { | 
|---|
|  |  |  | return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(res.lastChangeDate).getTime() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | this.changeSolution1(res.solutionId) | 
|---|
|  |  |  | // this.changeSolution1(res.solutionId) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getSummaries(param) { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.form.addDetailList.forEach(item => { | 
|---|
|  |  |  | total += item.fee | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | sums[index] = total | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.form.delDetailList.forEach(item => { | 
|---|
|  |  |  | total += item.fee | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | sums[index] = '-' + total | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sums[index] = '-' + total | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return sums | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | success() { | 
|---|
|  |  |  | this.form.addDetailList.forEach(item => { | 
|---|
|  |  |  | item.idcardNo = item.idCard | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.form.delDetailList.forEach(item => { | 
|---|
|  |  |  | item.idcardNo = item.idCard | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | // let arr = JSON.parse(JSON.stringify(this.form.addDetailList)) | 
|---|
|  |  |  | // arr.forEach(item => { | 
|---|
|  |  |  | //     item.idcardNo = item.idCard | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | this.isWorking = true | 
|---|
|  |  |  | create({ | 
|---|
|  |  |  | applyId: this.form.id, | 
|---|
|  |  |  | addDetailList: this.form.addDetailList, | 
|---|
|  |  |  | delDetailList: this.form.delDetailList, | 
|---|
|  |  |  | validTime: this.form.applyStartTime, | 
|---|
|  |  |  | type: 0 | 
|---|
|  |  |  | }).then(() => { | 
|---|
|  |  |  | this.visible = false | 
|---|
|  |  |  | this.$tip.apiSuccess('操作成功') | 
|---|
|  |  |  | this.$emit('success') | 
|---|
|  |  |  | }).catch(e => { | 
|---|
|  |  |  | this.$tip.apiFailed(e) | 
|---|
|  |  |  | }).finally(() => { | 
|---|
|  |  |  | this.isWorking = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | confirm() { | 
|---|
|  |  |  | this.$refs.form.validate((valid) => { | 
|---|
|  |  |  | if (valid) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.form.addDetailList.forEach(item => { | 
|---|
|  |  |  | item.idcardNo = item.idCard | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.$refs.ApplyChangeDetails1.open('加减保详单', this.form.addDetailList, this.form.delDetailList, { | 
|---|
|  |  |  | companyName: this.userInfo.company.name, | 
|---|
|  |  |  | solutionsName: this.form.solutionsName, | 
|---|
|  |  |  | code: this.list[0].code, | 
|---|
|  |  |  | startTime: this.list[0].startTime, | 
|---|
|  |  |  | endTime: this.list[0].endTime, | 
|---|
|  |  |  | applyStartTime: this.form.applyStartTime | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.form.delDetailList.forEach(item => { | 
|---|
|  |  |  | item.idcardNo = item.idCard | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | // let arr = JSON.parse(JSON.stringify(this.form.addDetailList)) | 
|---|
|  |  |  | // arr.forEach(item => { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // this.form.addDetailList.forEach(item => { | 
|---|
|  |  |  | //     item.idcardNo = item.idCard | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | this.isWorking = true | 
|---|
|  |  |  | create({ | 
|---|
|  |  |  | applyId: this.form.id, | 
|---|
|  |  |  | addDetailList: this.form.addDetailList, | 
|---|
|  |  |  | delDetailList: this.form.delDetailList, | 
|---|
|  |  |  | validTime: this.form.applyStartTime, | 
|---|
|  |  |  | type: 0 | 
|---|
|  |  |  | }).then(() => { | 
|---|
|  |  |  | this.visible = false | 
|---|
|  |  |  | this.$tip.apiSuccess('操作成功') | 
|---|
|  |  |  | this.$emit('success') | 
|---|
|  |  |  | }).catch(e => { | 
|---|
|  |  |  | this.$tip.apiFailed(e) | 
|---|
|  |  |  | }).finally(() => { | 
|---|
|  |  |  | this.isWorking = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | // this.form.delDetailList.forEach(item => { | 
|---|
|  |  |  | //     item.idcardNo = item.idCard | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | // // let arr = JSON.parse(JSON.stringify(this.form.addDetailList)) | 
|---|
|  |  |  | // // arr.forEach(item => { | 
|---|
|  |  |  | // //     item.idcardNo = item.idCard | 
|---|
|  |  |  | // // }) | 
|---|
|  |  |  | // this.isWorking = true | 
|---|
|  |  |  | // create({ | 
|---|
|  |  |  | //     applyId: this.form.id, | 
|---|
|  |  |  | //     addDetailList: this.form.addDetailList, | 
|---|
|  |  |  | //     delDetailList: this.form.delDetailList, | 
|---|
|  |  |  | //     validTime: this.form.applyStartTime, | 
|---|
|  |  |  | //     type: 0 | 
|---|
|  |  |  | // }).then(() => { | 
|---|
|  |  |  | //     this.visible = false | 
|---|
|  |  |  | //     this.$tip.apiSuccess('操作成功') | 
|---|
|  |  |  | //     this.$emit('success') | 
|---|
|  |  |  | // }).catch(e => { | 
|---|
|  |  |  | //     this.$tip.apiFailed(e) | 
|---|
|  |  |  | // }).finally(() => { | 
|---|
|  |  |  | //     this.isWorking = false | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$message.warning('请先选择保险方案') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!this.form.applyStartTime) { | 
|---|
|  |  |  | this.$message.warning('请先选择批单生效起期') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (this.activeName === '0') { | 
|---|
|  |  |  | this.$refs.selectEmployees.open('选取员工', { arr: this.form.addDetailList, price: this.price, notInInsuranceApplyId: this.form.id }) | 
|---|
|  |  |  | this.$refs.selectEmployees.open('选取员工', { arr: this.form.addDetailList, price: this.price, notInInsuranceApplyId: this.form.id, validTime: this.form.applyStartTime }) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$refs.selectEmployees.open('选取员工', { arr: this.form.delDetailList, price: this.price, insuranceApplyId: this.form.id }) | 
|---|
|  |  |  | this.$refs.selectEmployees.open('选取员工', { arr: this.form.delDetailList, price: this.price, insuranceApplyId: this.form.id, validTime: this.form.applyStartTime }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | addUser() { | 
|---|
|  |  |  | 
|---|
|  |  |  | // 切换方案 | 
|---|
|  |  |  | changeSolution1(e) { | 
|---|
|  |  |  | this.company.forEach(item => { | 
|---|
|  |  |  | console.log(item.id + '-----' + e) | 
|---|
|  |  |  | if (item.id === e) { | 
|---|
|  |  |  | console.log(item) | 
|---|
|  |  |  | this.item = item | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$message.warning('请选择员工') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$refs.confirmJobType.open('确认工种', { solutionId: this.form.solutionId }) | 
|---|
|  |  |  | this.$refs.confirmJobType.open('确认工种', { solutionId: this.item.newVersionSolutionId }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 查询全部方案 | 
|---|
|  |  |  | getCompany() { | 
|---|
|  |  |  | all({}) | 
|---|
|  |  |  | all({ dataType: 2 }) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.company = res | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | this.seleData = e.map(item => item.name) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getValue(list) { | 
|---|
|  |  |  | console.log(list) | 
|---|
|  |  |  | if (this.activeName === '0') { | 
|---|
|  |  |  | this.form.addDetailList.push(...list) | 
|---|
|  |  |  | } else { | 
|---|