Browse Source

h5费用报销,税额计算

ggooalice 2 years ago
parent
commit
f457b81c6f

+ 14 - 5
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/details.vue

@@ -150,9 +150,8 @@
                     ></van-field>
                     <van-field
                         label="税额:"
-                        v-model="item.taxValue"
-                        :readonly="!canEdit"
-                    ></van-field>
+                        readonly
+                    ><template #input>¥{{getTaxValue(item.amount,item.taxPercent)}}</template></van-field>
                     <van-field label="备注:" v-model="item.remark" :readonly="!canEdit"></van-field>
                     <van-field
                         label="报销凭证:"
@@ -167,7 +166,7 @@
                                 @delete="item.pic = null"
                                 :max-count="1"
                                 :disabled="!canEdit"
-                                :deletable="!canEdit"
+                                :deletable="canEdit"
                             />
                         </template>
                     </van-field>
@@ -325,6 +324,11 @@ export default {
             let mon = date.getMonth() + 1
             return `${date.getFullYear()}-${mon<10?'0'+mon:mon}-${date.getDate()<10?'0'+date.getDate():date.getDate()}`;
         },
+        getTaxValue(amount,percent){
+            let per = percent / 100
+            let amo = amount / (1 + per)*per
+            return amo.toFixed(2)
+        },
         costCount(){
             let costnum = 0
             for(let i in this.invoiceList){
@@ -430,7 +434,12 @@ export default {
                     this.invoiceList = res.data.invoiceList
                     for(let i in res.data.invoiceList){
                         this.formshowText.inProjectName.push(res.data.invoiceList[i].projectName)
-                        this.uploader[i] = [{url:'/upload/' + res.data.invoiceList[i].pic}]
+                        if(res.data.invoiceList[i].pic){
+                            this.uploader[i] = [{url:'/upload/' + res.data.invoiceList[i].pic}]
+                        }else{
+                            this.uploader[i] = []
+                        }
+                        
                     }
                 } else {
                     this.$toast.fail('获取失败');

+ 13 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/index.vue

@@ -71,7 +71,9 @@
                         <van-field label="费用金额(含税):" v-model="item.amount" type="number" @input="costCount"></van-field>
                         <van-field label="发票号:" v-model="item.invoiceNo"></van-field>
                         <van-field label="税率%:" v-model="item.taxPercent"></van-field>
-                        <van-field label="税额:" v-model="item.taxValue"></van-field>
+                        <van-field label="税额:" readonly>
+                            <template #input>¥{{getTaxValue(item.amount,item.taxPercent)}}</template>
+                        </van-field>
                         <van-field label="备注:" v-model="item.remark" autosize></van-field>
                         <van-field label="报销凭证:" @click="invoiceIndex = index" clickable>
                             <template #input>
@@ -301,6 +303,11 @@ export default {
             let mon = date.getMonth() + 1
             return `${date.getFullYear()}-${mon<10?'0'+mon:mon}-${date.getDate()<10?'0'+date.getDate():date.getDate()}`;
         },
+        getTaxValue(amount,percent){
+            let per = percent / 100
+            let amo = amount / (1 + per)*per
+            return amo.toFixed(2)
+        },
         activeChange(){
             sessionStorage.setItem('page',JSON.stringify(this.active))
             if(this.active == 1){
@@ -410,6 +417,9 @@ export default {
                 this.$toast.fail('请添加发票')
                 return
             }
+            for(let i in this.invoiceList){
+                this.invoiceList[i].taxValue = this.getTaxValue(this.invoiceList[i].amount,this.invoiceList[i].taxPercent)
+            }
             this.editForm.items = JSON.stringify(this.invoiceList)
             this.editForm.totalAmount = this.totalCost
             // 获取新的票据编号
@@ -589,12 +599,12 @@ export default {
         }
         .list_collapse{
             .collapse_label_l{
-                width: 60%;
+                width: 50%;
                 padding: 4px;
                 display: inline-block;
             }
             .collapse_label_r{
-                width: 40%;
+                width: 50%;
                 padding: 4px;
                 display: inline-block;
                 .waiting {