408249787 1 year ago
parent
commit
30b56d803a
1 changed files with 34 additions and 4 deletions
  1. 34 4
      src/views/purchase/purchase-order-page/modules/BaseForm.vue

+ 34 - 4
src/views/purchase/purchase-order-page/modules/BaseForm.vue

@@ -225,14 +225,22 @@
         rowKey="id"
       >
         <template slot="ftaxprice" slot-scope="text, record">
-          <a-input v-model="record.ftaxprice" />
+          <a-input-number v-model="record.ftaxprice" :step="0.0001" />
+        </template>
+        <template slot="num" slot-scope="text, record">
+          <a-input-number v-model="record.num" />
+        </template>
+        <template slot="ipertaxrate" slot-scope="text, record">
+          <a-input-number
+            v-model="record.ipertaxrate"
+            :step="0.01"
+            :formatter="value => `${value}%`"
+            :parser="value => value.replace('%', '')" />
         </template>
         <template slot="cbmemo" slot-scope="text, record">
           <a-input v-model="record.cbmemo" />
         </template>
-        <template slot="num" slot-scope="text, record">
-          <a-input v-model="record.num" />
-        </template>
+
         <span slot="action" slot-scope="record">
           <template>
             <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record)">
@@ -326,6 +334,21 @@ export default {
           width: 150,
           scopedSlots: { customRender: 'num' }
         },
+        {
+          title: '税率',
+          dataIndex: 'ipertaxrate',
+          width: 150,
+          scopedSlots: { customRender: 'ipertaxrate' }
+        },
+        {
+          title: '价税合计',
+          dataIndex: 'iorisum',
+          width: 150,
+          customRender: (text, record, index) => {
+            record.iorisum = this.computeTax(record.ftaxprice, record.num, record.ipertaxrate)
+            return record.iorisum
+          }
+        },
         {
           title: '操作',
           key: 'action',
@@ -362,6 +385,10 @@ export default {
     this.soMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SO_TYPE)
   },
   methods: {
+    computeTax (ftaxprice, num, ipertaxrate) {
+      const data = (ftaxprice * [num * (1 + ipertaxrate * 0.01)]).toFixed(2)
+      return isNaN(data) ? 0 : data
+    },
     disabledDate (current) {
       // Can not select days before today and today
       return current && current < moment().endOf('day')
@@ -448,6 +475,8 @@ export default {
             status++
             this.$message.error('请填写' + item.spareName + '单价')
           }
+          item.ftaxprice = item.ftaxprice.toFixed(4)
+          item.ipertaxrate = item.ipertaxrate.toFixed(2)
           return item
         })
         if (status !== 0) {
@@ -488,6 +517,7 @@ export default {
           const selectData = this.BaseTool.Object.copy(rows[i])
           selectData.storeNum = selectData.num
           selectData.num = 1
+          selectData.ipertaxrate = 13
           data.push(selectData)
         }
       }