MrShi
2024-01-26 790221ce9c7cba9fe455493c7a0e84695c021c3d
Mr.Shi
已添加1个文件
已修改5个文件
427 ■■■■ 文件已修改
company/src/api/business/company.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaCompanyDescWindow.vue 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaCompanyWindow.vue 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/modification.vue 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/common/UploadAvatarImage.vue 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/views/business/company.vue 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/company.js
@@ -31,3 +31,13 @@
export function getById (id) {
    return request.get(`/business/company/${id}`)
}
// ä¼ä¸šæ›´æ¢æ‰‹æœºå·
export function updatePhone (data) {
    return request.post('/business/company/updatePhone', data)
}
// ä¿®æ”¹ä¿é™©æ–¹æ¡ˆ
export function updateSolutions (data) {
    return request.post('/business/company/updateSolutions', data)
}
company/src/components/business/OperaCompanyDescWindow.vue
@@ -1,7 +1,8 @@
<template>
    <GlobalWindow
        :title="title"
        width="80%"
        width="100%"
        :withFooter="false"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
@@ -9,7 +10,10 @@
        <div class="info">
            <div class="info_label">
                <span>企业详情</span>
                <el-button type="primary" @click="$refs.operaCompanyWindow.open('编辑企业信息', row)">修改企业信息</el-button>
                <div>
                    <el-button type="primary" @click="$refs.modification.open('修改保险方案', form)">更改保险方案</el-button>
                    <el-button type="primary" @click="$refs.operaCompanyWindow.open('编辑企业信息', form)">修改企业信息</el-button>
                </div>
            </div>
            <div class="info_list">
                <div class="info_list_item">
@@ -118,6 +122,9 @@
        </div>
        <!-- æ–°å»º/修改 -->
        <OperaCompanyWindow ref="operaCompanyWindow" @success="callback"/>
        <!-- ä¿®æ”¹ä¿é™©æ–¹æ¡ˆ -->
        <modification ref="modification" @success="callback"/>
        <!-- ä¿®æ”¹æ‰‹æœºå· -->
        <el-dialog
            title="更改绑定手机号"
            :visible.sync="visiblePhone"
@@ -130,20 +137,21 @@
                <div class="form_item">
                    <div class="form_item_label">绑定手机号:</div>
                    <div class="form_item_val">
                        <input type="text" placeholder="请输入" />
                        <el-input v-model="phone" placeholder="请输入"></el-input>
                    </div>
                </div>
                <div class="form_item">
                    <div class="form_item_label">验证码:</div>
                    <div class="form_item_val">
                        <input type="text" placeholder="请输入" />
                        <el-button type="primary" style="margin-left: 20px;">发送验证码</el-button>
                        <el-input v-model="code" placeholder="请输入"></el-input>
                        <el-button type="primary" style="margin-left: 20px;" @click="send" v-if="num === 0">发送验证码</el-button>
                        <el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" v-else>{{num}}s</el-button>
                    </div>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="visiblePhone = false">取 æ¶ˆ</el-button>
                <el-button type="primary" @click="visiblePhone = false">提 äº¤</el-button>
                <el-button @click="close">取 æ¶ˆ</el-button>
                <el-button type="primary" @click="updatePhoneEvent">提 äº¤</el-button>
            </span>
        </el-dialog>
    </GlobalWindow>
@@ -153,20 +161,26 @@
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import OperaCompanyWindow from '@/components/business/OperaCompanyWindow'
    import { getById } from '@/api/business/company'
    import modification from '@/components/business/modification'
    import { getById, updatePhone } from '@/api/business/company'
    import { listForCompany } from '@/api/business/solutions'
    import { sendSms } from '@/api/business/smsEmail'
    export default {
        name: 'OperaCompanyDescWindow',
        extends: BaseOpera,
        components: { GlobalWindow, OperaCompanyWindow },
        components: { GlobalWindow, OperaCompanyWindow, modification },
        data () {
            return {
                ruleForm: {
                    phone: '',
                    code: ''
                },
                num: 0,
                timer: null,
                // è¡¨å•数据
                form: {},
                phone: '',
                code: '',
                visiblePhone: false,
                options: [],
                tableData: []
@@ -179,12 +193,94 @@
            })
        },
        methods: {
            close() {
                this.visiblePhone = false
                this.phone = ''
                this.code = ''
                clearInterval(this.timer)
                this.num = 0
            },
            updatePhoneEvent() {
                if (!this.phone) {
                    this.$message.warning('请输入手机号')
                    return
                }
                if (!this.code) {
                    this.$message.warning('请输入验证码')
                    return
                }
                updatePhone({
                    id: this.form.id,
                    captche: this.code,
                    phone: this.phone
                }).then(res => {
                    this.form.phone = JSON.parse(JSON.stringify(this.phone))
                    this.$message.success('操作成功')
                    this.visiblePhone = false
                    this.phone = ''
                    this.code = ''
                    clearInterval(this.timer)
                    this.num = 0
                })
            },
            send() {
                if (!this.phone) {
                    this.$message.warning('请输入手机号')
                    return
                }
                sendSms({ phone: this.phone })
                    .then(res => {
                        this.num = 60
                        this.setTime()
                    })
            },
            setTime() {
                this.timer = setInterval(() => {
                    this.num -= 1
                    if (this.num === 0) {
                        clearInterval(this.timer)
                        this.num = 0
                    }
                }, 1000)
            },
            open (title, target) {
                const that = this;
                this.title = title
                this.phone = ''
                this.code = ''
                clearInterval(this.timer)
                this.num = 0
                getById(target.id)
                    .then(res => {
                        this.form = res
                        this.form.type = 1
                        this.form.file = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        this.form.file1 = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        this.form.file2 = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        this.form.file3 = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        this.form.file.imgurl = res.businessImg.fileurl
                        this.form.file.imgurlfull = res.businessImg.fileurlFull
                        this.form.file1.imgurl = res.idcardImgList[0].fileurl
                        this.form.file1.imgurlfull = res.idcardImgList[0].fileurlFull
                        this.form.file2.imgurl = res.idcardImgList[1].fileurl
                        this.form.file2.imgurlfull = res.idcardImgList[1].fileurlFull
                        this.form.file3.imgurl = res.signImg.fileurl
                        this.form.file3.imgurlfull = res.signImg.fileurlFull
                        listForCompany({ companyId: target.id })
                            .then(resa => {
                                that.form.solutionList = resa.map(item => {
@@ -201,6 +297,7 @@
                                        canReduce: item.canReduce
                                    }
                                })
                                console.log(that.form)
                                that.visible = true
                            })
                    })
company/src/components/business/OperaCompanyWindow.vue
@@ -13,23 +13,23 @@
            <el-form-item label="统一信用代码" prop="code">
                <el-input v-model="form.code" placeholder="请输入" v-trim/>
            </el-form-item>
            <el-form-item label="法人姓名" prop="legalName">
            <el-form-item label="法人姓名" prop="legalName" v-if="form.type !== 1">
                <el-input v-model="form.legalName" placeholder="请输入" v-trim/>
            </el-form-item>
            <el-form-item label="绑定手机号" prop="phone">
            <el-form-item label="绑定手机号" prop="phone" v-if="form.type !== 1">
                <div style="width: 100%; display: flex; align-items: center;">
                    <el-input v-model="form.phone" maxlength="11" type="number" style="flex: 1;" placeholder="请输入" v-trim/>
                    <el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" @click="send" v-if="num === 0">发送验证码</el-button>
                    <el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" v-else>{{num}}s</el-button>
                </div>
            </el-form-item>
            <el-form-item label="验证码" prop="captche">
            <el-form-item label="验证码" prop="captche" v-if="form.type !== 1">
                <el-input v-model="form.captche" placeholder="请输入" v-trim/>
            </el-form-item>
            <el-form-item label="公司账号" prop="username">
            <el-form-item label="公司账号" prop="username" v-if="form.type !== 1">
                <el-input v-model="form.username" placeholder="请输入" v-trim/>
            </el-form-item>
            <el-form-item label="认证邮箱" prop="email">
            <el-form-item label="认证邮箱" prop="email" v-if="form.type !== 1">
                <el-input v-model="form.email" placeholder="请输入" v-trim/>
            </el-form-item>
            <el-form-item label="纳税人识别号" prop="taxCode">
@@ -51,21 +51,22 @@
                <el-input v-model="form.invoiceAddr" placeholder="请输入" v-trim/>
            </el-form-item>
            <el-form-item label="营业执照" prop="businessImg">
                <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file" @uploadSuccess="result" />
                <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file" @uploadSuccess="result" />
            </el-form-item>
            <el-form-item label="法人身份证" prop="idcardImgList">
                <div style="width: 100%; display: flex; align-items: center;">
                    <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file1" @uploadSuccess="result1" />
                    <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file1" @uploadSuccess="result1" />
                    <div style="width: 15px;height: 100%;"></div>
                    <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file2" @uploadSuccess="result2" />
                    <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file2" @uploadSuccess="result2" />
                </div>
            </el-form-item>
            <el-form-item label="电子签章" prop="signImg">
                <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="file3" @uploadSuccess="result3" />
                <UploadAvatarImage :uploadData="{ folder: 'company' }" :file="form.file3" @uploadSuccess="result3" />
            </el-form-item>
        </el-form>
        <el-button type="primary" style="margin-bottom: 15px;" @click="add">添加</el-button>
        <el-button type="primary" style="margin-bottom: 15px;" @click="add" v-if="form.type !== 1">添加</el-button>
        <el-table
            v-if="form.type !== 1"
            :data="form.solutionList"
            border
            style="width: 100%">
@@ -154,7 +155,24 @@
                            canAdd: 0,
                            canReduce: 0
                        }
                    ]
                    ],
                    type: '',
                    file: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                    file1: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                    file2: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                    file3: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                },
                timer: null,
                num: 0,
@@ -194,22 +212,7 @@
                        { required: true, message: '请输入公司账号' }
                    ]
                },
                file: {
                    imgurl: '',
                    imgurlfull: ''
                },
                file1: {
                    imgurl: '',
                    imgurlfull: ''
                },
                file2: {
                    imgurl: '',
                    imgurlfull: ''
                },
                file3: {
                    imgurl: '',
                    imgurlfull: ''
                },
                programme: []
            }
        },
@@ -295,19 +298,35 @@
            },
            // æŽ¥æ”¶è¥ä¸šæ‰§ç…§æ•°æ®
            result(data) {
                this.form.businessImg = {
                    fileurl: '',
                    name: ''
                }
                this.form.businessImg.fileurl = data.imgurl
                this.form.businessImg.name = data.name
            },
            // èº«ä»½è¯ç…§ç‰‡1
            result1(data) {
                this.form.idcardImgList[0] = {
                    fileurl: '',
                    name: ''
                }
                this.form.idcardImgList[0] = { fileurl: data.imgurl, name: data.name }
            },
            // èº«ä»½è¯ç…§ç‰‡2
            result2(data) {
                this.form.idcardImgList[1] = {
                    fileurl: '',
                    name: ''
                }
                this.form.idcardImgList[1] = { fileurl: data.imgurl, name: data.name }
            },
            // ç”µå­ç­¾ç« 
            result3(data) {
                this.form.signImg = {
                    fileurl: '',
                    name: ''
                }
                this.form.signImg.fileurl = data.imgurl
                this.form.signImg.name = data.name
            }
company/src/components/business/modification.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,153 @@
<template>
    <GlobalWindow
        :title="title"
        width="100%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <el-button type="primary" style="margin-bottom: 15px;" @click="add">添加</el-button>
        <el-table
            :data="form.solutionList"
            border
            style="width: 100%">
            <el-table-column
                label="序号"
                align="center"
                width="80">
                <template slot-scope="scope">
                    <span>{{scope.$index + 1}}</span>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="保险方案">
                <template slot-scope="{row}">
                    <el-select v-model="row.solutionBaseId" placeholder="请选择">
                        <el-option
                            v-for="item in programme"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id">
                        </el-option>
                    </el-select>
                </template>
            </el-table-column>
            <el-table-column
                align="center"
                label="加减保功能">
                <template slot-scope="{row}">
                    <el-checkbox :true-label="1" :false-label="0" v-model="row.canAdd">加保</el-checkbox>
                    <el-checkbox :true-label="1" :false-label="0" v-model="row.canReduce">减保</el-checkbox>
                </template>
            </el-table-column>
            <el-table-column
                label="操作"
                align="center"
                width="100">
                <template slot-scope="scope">
                    <el-button type="text" size="small" style="color: red;" @click="dele(scope.$index)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </GlobalWindow>
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import { all } from '@/api/business/solutions'
    import { listForCompany } from '@/api/business/solutions'
    import { updateSolutions } from '@/api/business/company'
    export default {
        name: 'modification',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                // è¡¨å•数据
                form: {
                    id: null,
                    solutionList: [
                        {
                            solutionBaseId: '',
                            canAdd: 0,
                            canReduce: 0
                        }
                    ]
                },
                // éªŒè¯è§„则
                rules: {
                    solutionList: [
                        { required: true, message: '请输入公司账号' }
                    ]
                },
                programme: []
            }
        },
        created () {
            this.config({
                api: '/business/company',
                'field.id': 'id'
            })
        },
        methods: {
            confirm() {
                this.isWorking = true
                updateSolutions(this.form)
                    .then(res => {
                        this.visible = false
                        this.$tip.apiSuccess('新建成功')
                        this.$emit('success')
                    })
                    .catch(e => {
                        this.$tip.apiFailed(e)
                    })
                    .finally(() => {
                        this.isWorking = false
                    })
            },
            // èŽ·å–å…¨éƒ¨æ–¹æ¡ˆ
            getAll() {
                all({})
                    .then(res => {
                        this.programme = res
                    })
            },
            open (title, target) {
                var that = this;
                this.title = title
                for (const key in this.form) {
                    this.form[key] = target[key]
                }
                this.getAll()
                listForCompany({ companyId: target.id })
                    .then(resa => {
                        that.form.solutionList = resa.map(item => {
                            return {
                                solutionBaseId: item.solutionBaseId,
                                canAdd: item.canAdd,
                                canReduce: item.canReduce
                            }
                        })
                        that.visible = true
                    })
            },
            add() {
                this.form.solutionList.push({
                    solutionName: '',
                    canAdd: '',
                    canReduce: ''
                })
            },
            dele(index) {
                if (this.form.solutionList.length === 1) {
                    this.$message.warning('至少保留一项')
                    return
                }
                this.form.solutionList.splice(index, 1)
            }
        }
    }
</script>
company/src/components/common/UploadAvatarImage.vue
@@ -3,16 +3,18 @@
    <el-upload
      class="avatar-uploader"
      accept=".png,.jpg"
      :style="customStyle"
      :action="uploadImgUrl"
      :data="uploadData"
      :show-file-list="false"
      :on-success="handleAvatarSuccess"
      :on-error="uploadError"
      :before-upload="beforeAvatarUpload">
      <template v-if="file.imgurlfull">
        <img :src="file.imgurlfull" class="avatar">
      </template>
      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
      <img v-if="file.imgurlfull" :src="file.imgurlfull" :style="customStyle" class="avatar">
      <div v-else :style="customStyle">
        <i class="el-icon-plus avatar-uploader-icon"></i>
        <div class="tips-style">{{ tipsLabel }}</div>
      </div>
    </el-upload>
  </div>
@@ -25,16 +27,16 @@
      type: Object,
      default: () => {}
    },
    tipsLabel: '',
    customStyle: {
      type: String,
      default: 'width: 90px; height: 90px;'
    },
    uploadData: Object
  },
  data() {
    return {
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadLocal',
      // uploadData: {
      //   folder: 'upload',
      //   type: 'image'
      // },
      imgurlfull: ''
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload'
    }
  },
@@ -42,10 +44,11 @@
    // ä¸Šä¼ å›¾ç‰‡
    handleAvatarSuccess(res, file) {
      if (res.code == 200) {
        this.file.imgurl = res.data.imgaddr;
        this.file.imgurlfull = res.data.url;
        this.$tip.apiSuccess('上传成功')
        this.$emit('uploadSuccess', { imgurl: res.data.imgaddr, imgurlfull: res.data.url })
        let { data } = res
        this.file.imgurl = data.imgaddr;
        this.file.imgurlfull = data.url;
        this.$message.success('上传成功')
        this.$emit('uploadSuccess', { imgurl: data.imgaddr, imgurlfull: data.url, name: data.originname })
      } else {
        this.$tip.apiFailed('上传失败')
      }
@@ -83,11 +86,11 @@
  border-color: #409EFF;
}
.avatar-uploader-icon {
  line-height: 90px;
  font-size: 28px;
  color: #8c939d;
  width: $image-width;
  height: $image-width;
  line-height: $image-width;
  text-align: center;
}
.avatar {
@@ -95,6 +98,13 @@
  height: $image-width;
  display: block;
}
.tips-style {
  height: 13px;
  font-size: 13px;
  font-weight: 400;
  color: #999999;
  line-height: 13px;
}
</style>
<style lang="scss" scoped>
::v-deep .el-upload--picture-card{
company/src/views/business/company.vue
@@ -50,7 +50,7 @@
                >
                    <template slot-scope="{row}">
                        <el-button type="text" @click="$refs.OperaCompanyDescWindow.open('企业详情', row)"  v-permissions="['business:company:update']">查看详情</el-button>
                        <el-button type="text" @click="$refs.operaCompanyWindow.open('编辑企业信息表', row)" v-permissions="['business:company:update']">修改</el-button>
                        <el-button type="text" @click="edit(row)" v-permissions="['business:company:update']">修改</el-button>
                        <el-button type="text" @click="$refs.operaCompanyWindow.open('编辑企业信息表', row)" v-permissions="['business:company:update']">电子签认证</el-button>
                    </template>
                </el-table-column>
@@ -75,7 +75,7 @@
    import Pagination from '@/components/common/Pagination'
    import OperaCompanyWindow from '@/components/business/OperaCompanyWindow'
    import OperaCompanyDescWindow from '@/components/business/OperaCompanyDescWindow'
    import { updateStatus } from '@/api/business/company'
    import { updateStatus, getById } from '@/api/business/company'
    export default {
        name: 'Company',
        extends: BaseTable,
@@ -99,6 +99,38 @@
            this.search()
        },
        methods: {
            edit(row) {
                getById(row.id)
                    .then(res => {
                        let form = res;
                        form.type = 1
                        form.file = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        form.file1 = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        form.file2 = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        form.file3 = {
                            imgurl: '',
                            imgurlfull: ''
                        }
                        form.file.imgurl = res.businessImg.fileurl
                        form.file.imgurlfull = res.businessImg.fileurlFull
                        form.file1.imgurl = res.idcardImgList[0].fileurl
                        form.file1.imgurlfull = res.idcardImgList[0].fileurlFull
                        form.file2.imgurl = res.idcardImgList[1].fileurl
                        form.file2.imgurlfull = res.idcardImgList[1].fileurlFull
                        form.file3.imgurl = res.signImg.fileurl
                        form.file3.imgurlfull = res.signImg.fileurlFull
                        this.$refs.operaCompanyWindow.open('编辑企业', form)
                    })
            },
            // ä¿®æ”¹çŠ¶æ€
            changeStatus(status, row) {
                updateStatus({ id: row.id, status })