jiangping
2024-02-01 89ecd1d3b14eb8f7e8073b0cd5190a35097366a8
开发业务接口
已添加1个文件
已修改6个文件
738 ■■■■■ 文件已修改
company/src/api/business/taxes.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaCompanyWindow.vue 428 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaTaxesUploadWindow.vue 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaTaxesWindow.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/dispatchReviewCheck.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/common/UploadAvatarImage.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/views/business/taxes.vue 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/taxes.js
@@ -6,3 +6,9 @@
        trim: true
    })
}
// æŸ¥è¯¢
export function doneApply(data) {
    return request.post('/business/taxes/doneApply', data, {
        trim: true
    })
}
company/src/components/business/OperaCompanyWindow.vue
@@ -113,223 +113,223 @@
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import UploadAvatarImage from '@/components/common/UploadAvatarImage'
    import { all } from '@/api/business/solutions'
    import { sendSms } from '@/api/business/smsEmail'
    export default {
        name: 'OperaCompanyWindow',
        extends: BaseOpera,
        components: { GlobalWindow, UploadAvatarImage },
        data () {
            return {
                // è¡¨å•数据
                form: {
                    id: null,
                    name: '',
                    code: '',
                    legalName: '',
                    taxCode: '',
                    taxAccount: '',
                    username: '',
                    taxBank: '',
                    taxAddr: '',
                    invoiceEmail: '',
                    invoiceAddr: '',
                    phone: '',
                    email: '',
                    captche: '',
                    businessImg: {
                        fileurl: '',
                        name: ''
                    },
                    idcardImgList: [],
                    signImg: {
                        fileurl: '',
                        name: ''
                    },
                    solutionList: [
                        {
                            solutionBaseId: '',
                            canAdd: 0,
                            canReduce: 0
                        }
                    ],
                    type: '',
                    file: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                    file1: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                    file2: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                    file3: {
                        imgurl: '',
                        imgurlfull: ''
                    },
                },
                timer: null,
                num: 0,
                // éªŒè¯è§„则
                rules: {
                    name: [
                        { required: true, message: '请输入公司名称' }
                    ],
                    code: [
                        { required: true, message: '请输入统一信用代码' }
                    ],
                    captche: [
                        { required: true, message: '请输入验证码' }
                    ],
                    legalName: [
                        { required: true, message: '请输入法人姓名' }
                    ],
                    phone: [
                        { required: true, message: '请输入手机号' }
                    ],
                    taxAccount: [
                        { required: true, message: '请输入手机号' }
                    ],
                    email: [
                        { required: true, message: '请输入认证邮箱' }
                    ],
                    businessImg: [
                        { required: true, message: '请上传营业执照' }
                    ],
                    idcardImgList: [
                        { required: true, message: '请上传法人身份证' }
                    ],
                    signImg: [
                        { required: true, message: '请上传电子签章' }
                    ],
                    username: [
                        { required: true, message: '请输入公司账号' }
                    ]
                },
                programme: []
            }
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import UploadAvatarImage from '@/components/common/UploadAvatarImage'
import { all } from '@/api/business/solutions'
import { sendSms } from '@/api/business/smsEmail'
export default {
  name: 'OperaCompanyWindow',
  extends: BaseOpera,
  components: { GlobalWindow, UploadAvatarImage },
  data () {
    return {
      // è¡¨å•数据
      form: {
        id: null,
        name: '',
        code: '',
        legalName: '',
        taxCode: '',
        taxAccount: '',
        username: '',
        taxBank: '',
        taxAddr: '',
        invoiceEmail: '',
        invoiceAddr: '',
        phone: '',
        email: '',
        captche: '',
        businessImg: {
          fileurl: '',
          name: ''
        },
        created () {
            this.config({
                api: '/business/company',
                'field.id': 'id'
            })
        idcardImgList: [],
        signImg: {
          fileurl: '',
          name: ''
        },
        watch: {
            visible: {
                handler(news) {
                    if (news) {
                        clearInterval(this.timer)
                        this.num = 0
                    }
                }
            }
        solutionList: [
          {
            solutionBaseId: '',
            canAdd: 0,
            canReduce: 0
          }
        ],
        type: '',
        file: {
          imgurl: '',
          imgurlfull: ''
        },
        methods: {
            send() {
                if (!this.form.phone) {
                    this.$message.warning('请输入手机号')
                    return
                }
                sendSms({ phone: this.form.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) {
                this.title = title
                this.visible = true
                this.getAll()
                // æ–°å»º
                if (target == null) {
                    this.$nextTick(() => {
                        this.$refs.form.resetFields()
                        this.form[this.configData['field.id']] = null
                    })
                    return
                }
                // ç¼–辑
                this.$nextTick(() => {
                    for (const key in this.form) {
                        this.form[key] = target[key]
                    }
                })
            },
            // èŽ·å–å…¨éƒ¨æ–¹æ¡ˆ
            getAll() {
                all({})
                    .then(res => {
                        this.programme = res
                    })
            },
            dele(index) {
                if (this.form.solutionList.length === 1) {
                    this.$message.warning('至少保留一项')
                    return
                }
                this.form.solutionList.splice(index, 1)
            },
            add() {
                this.form.solutionList.push({
                    solutionName: '',
                    canAdd: '',
                    canReduce: ''
                })
            },
            handleRemove(file, fileList) {
                console.log(file, fileList);
            },
            // æŽ¥æ”¶è¥ä¸šæ‰§ç…§æ•°æ®
            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
            }
        file1: {
          imgurl: '',
          imgurlfull: ''
        },
        file2: {
          imgurl: '',
          imgurlfull: ''
        },
        file3: {
          imgurl: '',
          imgurlfull: ''
        }
      },
      timer: null,
      num: 0,
      // éªŒè¯è§„则
      rules: {
        name: [
          { required: true, message: '请输入公司名称' }
        ],
        code: [
          { required: true, message: '请输入统一信用代码' }
        ],
        captche: [
          { required: true, message: '请输入验证码' }
        ],
        legalName: [
          { required: true, message: '请输入法人姓名' }
        ],
        phone: [
          { required: true, message: '请输入手机号' }
        ],
        taxAccount: [
          { required: true, message: '请输入手机号' }
        ],
        email: [
          { required: true, message: '请输入认证邮箱' }
        ],
        businessImg: [
          { required: true, message: '请上传营业执照' }
        ],
        idcardImgList: [
          { required: true, message: '请上传法人身份证' }
        ],
        signImg: [
          { required: true, message: '请上传电子签章' }
        ],
        username: [
          { required: true, message: '请输入公司账号' }
        ]
      },
      programme: []
    }
  },
  created () {
    this.config({
      api: '/business/company',
      'field.id': 'id'
    })
  },
  watch: {
    visible: {
      handler (news) {
        if (news) {
          clearInterval(this.timer)
          this.num = 0
        }
      }
    }
  },
  methods: {
    send () {
      if (!this.form.phone) {
        this.$message.warning('请输入手机号')
        return
      }
      sendSms({ phone: this.form.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) {
      this.title = title
      this.visible = true
      this.getAll()
      // æ–°å»º
      if (target == null) {
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          this.form[this.configData['field.id']] = null
        })
        return
      }
      // ç¼–辑
      this.$nextTick(() => {
        for (const key in this.form) {
          this.form[key] = target[key]
        }
      })
    },
    // èŽ·å–å…¨éƒ¨æ–¹æ¡ˆ
    getAll () {
      all({})
        .then(res => {
          this.programme = res
        })
    },
    dele (index) {
      if (this.form.solutionList.length === 1) {
        this.$message.warning('至少保留一项')
        return
      }
      this.form.solutionList.splice(index, 1)
    },
    add () {
      this.form.solutionList.push({
        solutionName: '',
        canAdd: '',
        canReduce: ''
      })
    },
    handleRemove (file, fileList) {
      console.log(file, fileList)
    },
    // æŽ¥æ”¶è¥ä¸šæ‰§ç…§æ•°æ®
    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
    }
  }
}
</script>
company/src/components/business/OperaTaxesUploadWindow.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,148 @@
<template>
    <GlobalWindow
        :title="title"
        width="50%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
      <el-form :model="form" ref="form" :rules="rules" style="width: 50%;">
        <el-form-item label="发票号" prop="doneCode">
          <el-input v-model="form.doneCode" placeholder="请输入" v-trim/>
        </el-form-item>
        <el-form-item label="电子发票" prop="imgurl">
          <UploadAvatarImage :uploadData="{ folder: 'taxes' }" :file="form.file" @uploadSuccess="result3" />
        </el-form-item>
      </el-form>
      <template v-slot:footer>
        <el-button type="primary" @click="doSubmit">ç¡® å®š</el-button>
        <el-button @click="visible=false">取消</el-button>
      </template>
    </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { doneApply } from '@/api/business/taxes'
import UploadAvatarImage from '@/components/common/UploadAvatarImage'
export default {
  name: 'OperaTaxesUploadWindow',
  extends: BaseOpera,
  components: { GlobalWindow, UploadAvatarImage },
  data () {
    return {
      // è¡¨å•数据
      // æœç´¢
      form: {
        id: null,
        doneCode: null,
        imgurl: null,
        file: { }
      },
      // éªŒè¯è§„则
      rules: {
        doneCode: [
          { required: true, message: '请输入发票号' }
        ],
        imgurl: [
          { required: true, message: '请上传发票电子版' }
        ]
      }
    }
  },
  created () {
    this.config({
      api: '/business/taxes',
      'field.id': 'id'
    })
  },
  methods: {
    open (title, target) {
      this.title = title
      this.visible = true
      this.form = {
        id: null,
        doneCode: null,
        imgurl: null,
        file: { }
      },
      this.form.id = target.id
      this.form.doneCode = target.doneCode
      this.form.file = { imgurl: target.imgurl, imgurlfull: target.imgurlFull }
    },
    result3 (data) {
      this.form.imgurl = null
      this.form.imgurl = data.imgurl
    },
    doSubmit () {
      this.$refs.form.validate((valid) => {
        // debugger
        if (!valid) {
          return
        }
        doneApply(this.form)
          .then(response => {
            this.visible = false
            this.$emit('success')
          }).catch(err => {
            console.log(err)
            this.$tip.apiFailed(err)
          }).finally(() => {
            this.isWorking = false
          })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
    .info {
        width: 100%;
        .info_label {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            span {
                font-size: 18px;
                font-weight: 500;
                color: #000000;
            }
        }
        .info_list {
            width: 100%;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            .info_list_item {
                width: 50%;
                display: flex;
                align-items: start;
                margin-bottom: 20px;
                .info_list_item_label {
                    width: 150px;
                    flex-shrink: 0;
                }
                .info_list_item_val {
                    flex: 1;
                    display: flex;
                    align-items: center;
                    .image {
                        width: 100px;
                        height: 100px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        overflow: hidden;
                        img {
                            width: 100%;
                        }
                    }
                }
            }
        }
    }
</style>
company/src/components/business/OperaTaxesWindow.vue
@@ -100,7 +100,8 @@
                    id: null
                },
                // éªŒè¯è§„则
                rules: {}
                rules: {},
              tableData:[]
            }
        },
        created () {
company/src/components/business/dispatchReviewCheck.vue
@@ -52,7 +52,10 @@
        },
        methods: {
          open(title,target){
            this.form.id = null
            this.form  = {
              id: null,
                  checkInfo: ''
            },
            this.title=title
            this.visible=true
            this.form.id=target.id
company/src/components/common/UploadAvatarImage.vue
@@ -10,7 +10,7 @@
      :on-success="handleAvatarSuccess"
      :on-error="uploadError"
      :before-upload="beforeAvatarUpload">
      <img v-if="file.imgurlfull" :src="file.imgurlfull" :style="customStyle" class="avatar">
      <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>
company/src/views/business/taxes.vue
@@ -68,9 +68,15 @@
                        <span v-if="row.type === 1">纸质发票</span>
                    </template>
                </el-table-column>
                <el-table-column prop="type" label="发票电子版" min-width="100px">
                    <template slot-scope="{row}">
                      <img v-if="row.imgurlfull!=null" :src="row.imgurlfull"  style="width: 90px;height: 90px">
                    </template>
                </el-table-column>
                <el-table-column label="操作" min-width="100px">
                    <template slot-scope="{row}">
                        <el-button type="text">上传发票</el-button>
                        <el-button v-if="row.status==0" type="text" @click="$refs.OperaTaxesUploadWindow.open('上传发票',row)">上传发票</el-button>
                        <el-button v-if="row.status ==1 " type="text" @click="$refs.OperaTaxesUploadWindow.open('修改发票',row)">修改发票</el-button>
                        <el-button type="text">申请详情</el-button>
                    </template>
                </el-table-column>
@@ -93,78 +99,108 @@
                <div class="form_item">
                    <div class="form_item_label">发票号:</div>
                    <div class="form_item_val">
                        <input type="text" placeholder="请输入" />
                        <input v-model="form.doneCode" type="text" placeholder="请输入" />
                    </div>
                </div>
                <div class="form_item">
                    <div class="form_item_label">上传发票:</div>
                    <div class="form_item_val">
                        <el-upload
                            action="https://jsonplaceholder.typicode.com/posts/"
                            list-type="picture-card"
                            :on-remove="handleRemove">
                            <i class="el-icon-plus"></i>
                        </el-upload>
                    <UploadAvatarImage :uploadData="{ folder: 'taxes' }" :file="form.file" @uploadSuccess="result3" />
                    </div>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="visible = false">取 æ¶ˆ</el-button>
                <el-button type="primary" @click="visible = false">提 äº¤</el-button>
                <el-button type="primary" @click="doneApplyDo">提 äº¤</el-button>
            </span>
        </el-dialog>
        <OperaTaxesWindow ref="OperaTaxesWindow" @success="handlePageChange"/>
        <OperaTaxesUploadWindow ref="OperaTaxesUploadWindow" @success="handlePageChange"/>
    </TableLayout>
</template>
<script>
    import BaseTable from '@/components/base/BaseTable'
    import TableLayout from '@/layouts/TableLayout'
    import Pagination from '@/components/common/Pagination'
    import OperaTaxesWindow from '@/components/business/OperaTaxesWindow'
    import {all as solutionAll} from "@/api/business/solutions";
    import {pageAll as companyAll} from "@/api/business/company";
    export default {
        name: 'Taxes',
        extends: BaseTable,
        components: { TableLayout, Pagination, OperaTaxesWindow },
        data () {
            return {
                // æœç´¢
              companyList:[],
                searchForm: {
                    status: '',
                    companyId: ''
                },
                visible: false
            }
        },
        created () {
            this.config({
                module: '发票信息表',
                api: '/business/taxes',
                'field.id': 'id',
                'field.main': 'id'
            })
            this.search()
          this.loadSelectList()
        },
        methods: {
            handleRemove(file, fileList) {
                console.log(file, fileList);
            },
          loadSelectList() {
            solutionAll({dataType:0}).then(res => {
              this.solutionList = res
            }).catch(err => {
            })
            companyAll({}).then(res => {
              this.companyList = res
            }).catch(err => {
            })
          }
        }
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaTaxesWindow from '@/components/business/OperaTaxesWindow'
import OperaTaxesUploadWindow from '@/components/business/OperaTaxesUploadWindow'
import { all as solutionAll } from '@/api/business/solutions'
import { pageAll as companyAll } from '@/api/business/company'
import { doneApply } from '@/api/business/taxes'
import UploadAvatarImage from '@/components/common/UploadAvatarImage'
export default {
  name: 'Taxes',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaTaxesWindow, OperaTaxesUploadWindow, UploadAvatarImage },
  data () {
    return {
      // æœç´¢
      form: {
        id: null,
        doneCode: null,
        imgurl: null,
        file:{ },
      },
      companyList: [],
      searchForm: {
        status: '',
        companyId: ''
      },
      visible: false
    }
  },
  created () {
    this.config({
      module: '发票信息表',
      api: '/business/taxes',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
    this.loadSelectList()
  },
  methods: {
    handleRemove (file, fileList) {
      console.log(file, fileList)
    },
    uploadImg (row) {
      this.form = {
        id: row.id,
        doneCode: row.doneCode,
        imgurl:null
      },
      this.form.file= {imgurl: row.imgurl, imgurlfull: row.imgurlFull }
      this.visible = true
    },
    result3 (data) {
      this.form.imgurl = null
      this.form.imgurl = data.imgurl
    },
    doneApplyDo () {
      doneApply(this.form)
        .then(response => {
          this.visible = false
          this.search()
        }).catch(err => {
          console.log(err)
          this.$tip.apiFailed(err)
        }).finally(() => {
          this.isWorking = false
        })
    },
    loadSelectList () {
      solutionAll({ dataType: 0 }).then(res => {
        this.solutionList = res
      }).catch(err => {
      })
      companyAll({}).then(res => {
        this.companyList = res
      }).catch(err => {
      })
    }
  }
}
</script>
<style lang="scss" scoped>