Bläddra i källkod

feature: 添加发起合同发票审批流程

liuyaqi 2 år sedan
förälder
incheckning
34caf34aec

+ 4 - 0
src/api/contract/invoice.js

@@ -28,4 +28,8 @@ export default {
   updateInvoice(query) {
     return micro_request.postRequest(basePath, 'CtrContractInvoice', 'Update', query)
   },
+  // 提交审核
+  applyInvoice(query) {
+    return micro_request.postRequest(basePath, 'CtrContractInvoice', 'InvoiceApply', query)
+  },
 }

+ 70 - 0
src/views/contract/components/ApplyInvoice.vue

@@ -0,0 +1,70 @@
+<!--
+ * @Author: wanglj 471442253@qq.com
+ * @Date: 2022-12-26 14:34:34
+ * @LastEditors: wanglj
+ * @LastEditTime: 2023-01-13 09:41:38
+ * @Description: file content
+ * @FilePath: \opms_frontend\src\views\customer\components\allocate.vue
+-->
+<template>
+  <el-dialog title="提交审核" :visible.sync="visible" width="50%" @close="handleClose">
+    <el-form label-width="150px" :model="form">
+      <el-form-item label="是否已回全款">
+        <el-radio-group v-model="form.allReceive">
+          <el-radio label="未回全款" />
+          <el-radio label="已回全款" />
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item label="回款金额(元)">
+        <el-input v-model.number="form.receiveAmount" clearable placeholder="请输入回款金额(元)" />
+      </el-form-item>
+    </el-form>
+    <span slot="footer">
+      <el-button size="mini" type="primary" @click="handleSubmit">确定</el-button>
+      <el-button size="mini" @click="visible = false">取消</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+  import invoiceApi from '@/api/contract/invoice'
+  import to from 'await-to-js'
+  export default {
+    components: {},
+    data() {
+      return {
+        visible: false,
+        form: {
+          id: 0,
+          allReceive: '未回全款',
+          receiveAmount: 0,
+        },
+      }
+    },
+    methods: {
+      handleClose() {
+        this.form = {
+          id: 0,
+          allReceive: '未回全款',
+          receiveAmount: 0,
+        }
+      },
+      async handleSubmit() {
+        if (this.form.receiveAmount <= 0) return this.$message.warning('请输入回款金额')
+        const [err, res] = await to(
+          invoiceApi.applyInvoice({
+            id: this.form.id,
+            allReceive: this.form.allReceive == '已回全款' ? true : false,
+            receiveAmount: this.form.receiveAmount,
+          })
+        )
+        if (err) return
+        this.$message.success(res.msg)
+        this.visible = false
+        this.$emit('refresh')
+      },
+    },
+  }
+</script>
+
+<style></style>

+ 14 - 2
src/views/contract/components/DetailsInvoice.vue

@@ -28,7 +28,19 @@
             {{ invoiceTypeData.filter((item) => item.key == row.invoiceType)[0].value || '-' }}
           </span>
           <span v-else-if="item.prop == 'approStatus'">
-            {{ row.approStatus == '10' ? '未通过' : '已通过' }}
+            {{
+              row.approStatus == '10'
+                ? '待提交审核'
+                : row.approStatus == '20'
+                ? '待审核'
+                : row.approStatus == '30'
+                ? '审核已同意'
+                : row.approStatus == '40'
+                ? '审核已拒绝'
+                : row.approStatus == '50'
+                ? '审核已撤销'
+                : ''
+            }}
           </span>
           <span v-else-if="item.prop == 'contractAmount'">
             {{ formatPrice(row.contractAmount) }}
@@ -116,8 +128,8 @@
           },
           {
             label: '审核状态',
-            width: 'auto',
             prop: 'approStatus',
+            width: '100px',
           },
           {
             label: '备注',

+ 2 - 2
src/views/contract/components/Invoicing.vue

@@ -59,7 +59,7 @@
         editVisible: false,
         editForm: {
           id: 0,
-          approStatus: '20',
+          // approStatus: '20',
           actualInvoiceDate: '', //实际开票日期
           invoiceCode: '', //发票号码
           courierCode: '', //快递单号
@@ -93,7 +93,7 @@
       handleClose() {
         this.editForm = {
           id: 0,
-          approStatus: '20',
+          // approStatus: '20',
           actualInvoiceDate: '', //实际开票日期
           invoiceCode: '', //发票号码
           courierCode: '', //快递单号

+ 48 - 4
src/views/contract/invoice.vue

@@ -47,7 +47,19 @@
             {{ invoiceTypeData.filter((item) => item.key == row.invoiceType)[0].value || '-' }}
           </span>
           <span v-else-if="item.prop == 'approStatus'">
-            {{ row.approStatus == '10' ? '未通过' : '已通过' }}
+            {{
+              row.approStatus == '10'
+                ? '待提交审核'
+                : row.approStatus == '20'
+                ? '待审核'
+                : row.approStatus == '30'
+                ? '审核已同意'
+                : row.approStatus == '40'
+                ? '审核已拒绝'
+                : row.approStatus == '50'
+                ? '审核已撤销'
+                : ''
+            }}
           </span>
           <span v-else-if="item.prop == 'contractAmount'">
             {{ formatPrice(row.contractAmount) }}
@@ -64,7 +76,12 @@
       </el-table-column>
       <el-table-column align="center" fixed="right" label="操作">
         <template slot-scope="scope">
-          <el-button type="text" @click="$refs.invoicing.init(scope.row.id)">通过</el-button>
+          <el-button v-if="scope.row.approStatus == '30'" type="text" @click="$refs.invoicing.init(scope.row.id)">
+            更新开票信息
+          </el-button>
+          <el-button v-if="scope.row.approStatus == '10'" type="text" @click="handleApply(scope.row.id)">
+            提交审核
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -77,6 +94,7 @@
       @current-change="handleCurrentChange"
       @size-change="handleSizeChange" />
     <invoicing ref="invoicing" @invoiceSave="queryData" />
+    <ApplyInvoice ref="applyInvoice" @refresh="queryData" />
   </div>
 </template>
 
@@ -85,10 +103,11 @@
   import invoiceApi from '@/api/contract/invoice'
   import Invoicing from './components/Invoicing'
   import TableTool from '@/components/table/TableTool'
+  import ApplyInvoice from './components/ApplyInvoice'
 
   export default {
     name: 'DetailsInvoice',
-    components: { Invoicing, TableTool },
+    components: { Invoicing, TableTool, ApplyInvoice },
     props: {
       details: {
         type: Object,
@@ -153,8 +172,8 @@
           },
           {
             label: '审核状态',
-            width: 'auto',
             prop: 'approStatus',
+            width: '100px',
           },
           {
             label: '备注',
@@ -186,6 +205,31 @@
       setSelectRows(val) {
         this.selectRows = val.map((item) => item.id)
       },
+      handleApply(id) {
+        this.$refs.applyInvoice.form.id = id
+        this.$refs.applyInvoice.visible = true
+        // this.$confirm('确认提交审核?', '提示', {
+        //   confirmButtonText: '确定',
+        //   cancelButtonText: '取消',
+        //   type: 'warning',
+        // })
+        //   .then(async () => {
+        //     const [err, res] = await to(
+        //       invoiceApi.applyInvoice({
+        //         id: [id],
+        //       })
+        //     )
+        //     if (err) return
+        //     if (res.code == 200) {
+        //       this.$message({
+        //         type: 'success',
+        //         message: '提交成功!',
+        //       })
+        //       this.queryData()
+        //     }
+        //   })
+        //   .catch((err) => console.log(err))
+      },
       async getOptions() {
         await Promise.all([this.getDicts('invoice_type')])
           .then(([invoiceType]) => {

+ 2 - 1
src/views/customer/components/Shift.vue

@@ -20,7 +20,7 @@
           <el-checkbox label="客户" />
         </el-checkbox-group>
       </el-form-item>
-      <el-form-item label="备注信息" prop="remark">
+      <el-form-item label="转移原因" prop="remark">
         <el-input v-model="form.remark" maxlength="500" resize="none" :rows="5" show-word-limit type="textarea" />
       </el-form-item>
     </el-form>
@@ -50,6 +50,7 @@
         rules: {
           salesName: [{ required: true, message: '请选择接收对象', trigger: 'change' }],
           about: [{ required: true, message: '请选择转移相关', trigger: 'change' }],
+          remark: [{ required: true, message: '请选择转移原因', trigger: 'change' }],
         },
         userList: [],
       }