Explorar o código

收款条件设置调整

qymljy %!s(int64=2) %!d(string=hai) anos
pai
achega
bdd74bac96

+ 122 - 35
src/HDrpManagement/collectionRule/components/add.vue

@@ -1,26 +1,54 @@
 <template>
   <div>
-    <el-button size="mini" type="primary" @click="dialogFormVisible = true">新 建</el-button>
-    <el-dialog title="新建收款条件" append-to-body :visible.sync="dialogFormVisible" width="40%" @close="onClose">
+    <el-button size="small" type="primary" @click="dialogFormVisible = true">新 建</el-button>
+    <el-dialog title="新建收款条件" append-to-body :visible.sync="dialogFormVisible" width="800px" @close="onClose">
       <el-row :gutter="20">
         <el-form :model="form" :rules="rules" ref="form" label-width="140px" label-position="right" size="mini">
           <el-col :span="24">
-            <el-form-item label="账期依据" prop="point">
-              <el-select class="width-240" v-model="form.point" placeholder="请选择账期依据">
-                <el-option label="订单" value="订单审核"></el-option>
-                <el-option label="出库" value="销售出库审核"></el-option>
-                <el-option label="发票" value="发票审核"></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24" v-if="form.point == '订单审核'">
-            <el-form-item label="立账额度比例(%)" prop="amountrate">
-              <el-input v-model="form.amountrate" placeholder="请输入立账额度比例(%)"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="后置天数" prop="days">
-              <el-input v-model="form.days" placeholder="请输入后置天数"></el-input>
+            <el-form-item label="立账节点" prop="accountingnodes">
+              <div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-checkbox v-model="form.accountingnodes.ordercheck.isused" true-label="1" false-label="0">订单审核</el-checkbox>
+                  <span style="margin-left: 50px">后置天数:</span>
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.ordercheck.days" placeholder="请输入" ></el-input>
+                  <span style="margin-left: 5px">天</span>
+                  <span style="margin-left: 50px">立账额度:</span>
+                </div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.ordercheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorOrder }"  @change="checkAmountrate(form.accountingnodes.ordercheck.amountrate,'订单审核')"></el-input>
+                  <span style="margin-left: 5px">%</span>
+                  <p v-if="isErrorOrder" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
+                </div>
+              </div>
+              <div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-checkbox v-model="form.accountingnodes.logisticscheck.isused" true-label="1" false-label="0">订单出货</el-checkbox>
+                  <span style="margin-left: 50px">后置天数:</span>
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.logisticscheck.days" placeholder="请输入"></el-input>
+                  <span style="margin-left: 5px">天</span>
+                  <span style="margin-left: 50px">立账额度:</span>
+                </div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.logisticscheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorLogistics }"  @change="checkAmountrate(form.accountingnodes.logisticscheck.amountrate,'订单出货')"></el-input>
+                  <span style="margin-left: 5px">%</span>
+                  <p v-if="isErrorLogistics" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
+                </div>
+
+              </div>
+              <div>
+                <div style="float: left">
+                  <el-checkbox v-model="form.accountingnodes.invoiceapplycheck.isused" true-label="1" false-label="0">订单开票</el-checkbox>
+                  <span style="margin-left: 50px">后置天数:</span>
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.invoiceapplycheck.days" placeholder="请输入"></el-input>
+                  <span style="margin-left: 5px">天</span>
+                  <span style="margin-left: 50px">立账额度:</span>
+                </div>
+                <div style="float: left">
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.invoiceapplycheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorInvoiceapply }"  @change="checkAmountrate(form.accountingnodes.invoiceapplycheck.amountrate,'订单开票')"></el-input>
+                  <span style="margin-left: 5px">%</span>
+                  <p v-if="isErrorInvoiceapply" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
+                </div>
+              </div>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -37,7 +65,7 @@
       </el-row>
       <div class="dialog-footer">
         <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width" :disabled="form.point == '' && form.amountrate == '' && form.days == '' && form.remarks == ''">确 定</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width" :disabled="form.accountingnodes.ordercheck.isused == '0' && form.accountingnodes.logisticscheck.isused == '0' && form.accountingnodes.invoiceapplycheck.isused == '0' && form.remarks == ''">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -62,7 +90,24 @@ export default {
         "amountrate":'',
         "point":"",
         "remarks":"",
-        "isdefault":1
+        "isdefault":1,
+        "accountingnodes": {
+          "ordercheck": {//订单审核
+            "days": "",//后置天数
+            "amountrate": "",//立账额度
+            "isused": "0"//是否勾选
+          },
+          "logisticscheck": {//订单出货
+            "days": "",
+            "amountrate": "",
+            "isused": "0"
+          },
+          "invoiceapplycheck": {//订单开票
+            "days": "",
+            "amountrate": "",
+            "isused": "0"
+          }
+        }
       },
       rules:{
         point:[
@@ -81,26 +126,59 @@ export default {
         remarks:[
           { required: false, message: '请输入描述', trigger: 'blur'}
         ],
-      }
+      },
+      isErrorOrder: false,
+      isErrorLogistics:false,
+      isErrorInvoiceapply:false
     }
   },
   methods:{
+    checkAmountrate(val,key){
+      if (val > 100 || val < 0){
+        if (key === '订单审核'){
+          this.isErrorOrder = true
+        }else if (key === '订单出货'){
+          this.isErrorLogistics = true
+        }else {
+          this.isErrorInvoiceapply = true
+        }
+      }else {
+        if (key === '订单审核'){
+          this.isErrorOrder = false
+        }else if (key === '订单出货'){
+          this.isErrorLogistics = false
+        }else {
+          this.isErrorInvoiceapply = false
+        }
+      }
+    },
     onSubmit(){
       console.log(this.form)
-      this.$refs['form'].validate(async (valid) => {
-        if (!valid) return false
-        this.form.amountrate = (this.form.amountrate /100).toFixed(4)
-        const res = await this.$api.requested({
-          "id": "20230110095903",
-          "version":1,
-          "content": this.form
+      const order = this.form.accountingnodes.ordercheck.isused == '1'?this.form.accountingnodes.ordercheck.amountrate:0
+      const logistics = this.form.accountingnodes.logisticscheck.isused == '1'?this.form.accountingnodes.logisticscheck.amountrate:0
+      const invoiceapply = this.form.accountingnodes.invoiceapplycheck.isused == '1'?this.form.accountingnodes.invoiceapplycheck.amountrate:0
+      console.log(order + logistics + invoiceapply)
+      if (parseFloat(order) + parseFloat(logistics) + parseFloat(invoiceapply) !== 100 ){
+        this.$message.error('已选节点立账额度合计需等于100%');
+      }else {
+        this.$refs['form'].validate(async (valid) => {
+          if (!valid) return false
+          /*this.form.amountrate = (this.form.amountrate /100).toFixed(4)*/
+          this.form.accountingnodes.ordercheck.amountrate = (this.form.accountingnodes.ordercheck.amountrate/100).toFixed(4)
+          this.form.accountingnodes.logisticscheck.amountrate = (this.form.accountingnodes.logisticscheck.amountrate/100).toFixed(4)
+          this.form.accountingnodes.invoiceapplycheck.amountrate = (this.form.accountingnodes.invoiceapplycheck.amountrate/100).toFixed(4)
+          const res = await this.$api.requested({
+            "id": "20230110095903",
+            "content": this.form
+          })
+          this.tool.showMessage(res,()=>{
+            this.$emit('onSuccess')
+            this.$refs['form'].resetFields();
+            this.dialogFormVisible = false
+          })
         })
-        this.tool.showMessage(res,()=>{
-          this.$emit('onSuccess')
-          this.$refs['form'].resetFields();
-          this.dialogFormVisible = false
-        })
-      })
+      }
+
     },
     onClose(){
       this.$refs['form'].resetFields();
@@ -117,4 +195,13 @@ export default {
 .el-select {
   width: 100% !important;
 }
-</style>
+
+</style>
+<style>
+  .is-error .el-input__inner {
+    border-color: red;
+  }
+  .error-message {
+    color: red;
+  }
+</style>

+ 120 - 0
src/HDrpManagement/collectionRule/components/addCopy.vue

@@ -0,0 +1,120 @@
+<template>
+  <div>
+    <el-button size="mini" type="primary" @click="dialogFormVisible = true">新 建</el-button>
+    <el-dialog title="新建收款条件" append-to-body :visible.sync="dialogFormVisible" width="40%" @close="onClose">
+      <el-row :gutter="20">
+        <el-form :model="form" :rules="rules" ref="form" label-width="140px" label-position="right" size="mini">
+          <el-col :span="24">
+            <el-form-item label="账期依据" prop="point">
+              <el-select class="width-240" v-model="form.point" placeholder="请选择账期依据">
+                <el-option label="订单" value="订单审核"></el-option>
+                <el-option label="出库" value="销售出库审核"></el-option>
+                <el-option label="发票" value="发票审核"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24" v-if="form.point == '订单审核'">
+            <el-form-item label="立账额度比例(%)" prop="amountrate">
+              <el-input v-model="form.amountrate" placeholder="请输入立账额度比例(%)"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="后置天数" prop="days">
+              <el-input v-model="form.days" placeholder="请输入后置天数"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="描述" prop="remarks">
+              <el-input type="textarea" v-model="form.remarks" placeholder="请输入描述"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="是否默认条件" prop="isdefault">
+              <el-checkbox :true-label="1" :false-label="0" v-model="form.isdefault"></el-checkbox>
+            </el-form-item>
+          </el-col>
+        </el-form>
+      </el-row>
+      <div class="dialog-footer">
+        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width" :disabled="form.point == '' && form.amountrate == '' && form.days == '' && form.remarks == ''">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "add",
+  data(){
+    var NumberSize = (rule, value, callback) => {
+      if (+value >= 0 && +value <= 100) {
+        callback()
+      } else {
+        return callback(new Error('额度比率范围(0-100)'));
+      }
+    }
+    return {
+      dialogFormVisible:false,
+      form:{
+        "sa_receivableruleid":0,
+        "days":"",
+        "amountrate":'',
+        "point":"",
+        "remarks":"",
+        "isdefault":1
+      },
+      rules:{
+        point:[
+          { required: false, message: '请选择账期依据', trigger: 'change'},
+        ],
+        amountrate:[
+          { required: false, message: '请输入立账额度比率', trigger: 'blur'},
+          { validator: NumberSize , trigger:'blur'}
+        ],
+        days:[
+          { required: false, message: '请输入后置天数', trigger: 'blur'}
+        ],
+        isdefault:[
+          { required: false, message: '请选择是否默认条件', trigger: 'blur'}
+        ],
+        remarks:[
+          { required: false, message: '请输入描述', trigger: 'blur'}
+        ],
+      }
+    }
+  },
+  methods:{
+    onSubmit(){
+      console.log(this.form)
+      this.$refs['form'].validate(async (valid) => {
+        if (!valid) return false
+        this.form.amountrate = (this.form.amountrate /100).toFixed(4)
+        const res = await this.$api.requested({
+          "id": "20230110095903",
+          "version":1,
+          "content": this.form
+        })
+        this.tool.showMessage(res,()=>{
+          this.$emit('onSuccess')
+          this.$refs['form'].resetFields();
+          this.dialogFormVisible = false
+        })
+      })
+    },
+    onClose(){
+      this.$refs['form'].resetFields();
+      this.dialogFormVisible = false
+    }
+  }
+}
+</script>
+
+<style scoped>
+.dialog-footer {
+  margin-top: 0;
+}
+.el-select {
+  width: 100% !important;
+}
+</style>

+ 128 - 26
src/HDrpManagement/collectionRule/components/edit.vue

@@ -1,31 +1,59 @@
 <template>
   <div>
-    <el-button size="mini" type="primary" @click="editBtn">编 辑</el-button>
-    <el-dialog title="编辑收款条件" append-to-body :visible.sync="dialogFormVisible" width="40%">
+    <el-button size="mini" type="text" @click="editBtn">编 辑</el-button>
+    <el-dialog title="编辑收款条件" append-to-body :visible.sync="dialogFormVisible" width="40%" @close="dialogFormVisible = false;$refs.form.resetFields();$emit('onSuccess');isErrorInvoiceapply=false;isErrorLogistics=false;isErrorOrder=false">
       <el-row :gutter="20">
         <el-form :model="form" :rules="rules" ref="form" label-width="140px" label-position="right" size="mini">
           <el-col :span="24">
-            <el-form-item label="账期依据" prop="point">
-              <el-select class="width-240" v-model="form.point" placeholder="请选择账期依据">
-                <el-option label="订单" value="订单审核"></el-option>
-                <el-option label="出库" value="销售出库审核"></el-option>
-                <el-option label="发票" value="发票审核"></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24" v-if="form.point == '订单审核'">
-            <el-form-item label="立账额度比例" prop="amountrate">
-              <el-input v-model="form.amountrate" placeholder="请输入立账额度比例"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="后置天数" prop="days">
-              <el-input v-model="form.days" placeholder="请输入后置天数"></el-input>
+            <el-form-item label="立账节点" prop="accountingnodes">
+              <div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-checkbox v-model="form.accountingnodes.ordercheck.isused" true-label="1" false-label="0">订单审核</el-checkbox>
+                  <span style="margin-left: 50px">后置天数:</span>
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.ordercheck.days" placeholder="请输入" ></el-input>
+                  <span style="margin-left: 5px">天</span>
+                  <span style="margin-left: 50px">立账额度:</span>
+                </div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.ordercheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorOrder }"  @change="checkAmountrate(form.accountingnodes.ordercheck.amountrate,'订单审核')"></el-input>
+                  <span style="margin-left: 5px">%</span>
+                  <p v-if="isErrorOrder" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
+                </div>
+              </div>
+              <div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-checkbox v-model="form.accountingnodes.logisticscheck.isused" true-label="1" false-label="0">订单出货</el-checkbox>
+                  <span style="margin-left: 50px">后置天数:</span>
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.logisticscheck.days" placeholder="请输入"></el-input>
+                  <span style="margin-left: 5px">天</span>
+                  <span style="margin-left: 50px">立账额度:</span>
+                </div>
+                <div style="float: left;margin-bottom: 10px">
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.logisticscheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorLogistics }"  @change="checkAmountrate(form.accountingnodes.logisticscheck.amountrate,'订单出货')"></el-input>
+                  <span style="margin-left: 5px">%</span>
+                  <p v-if="isErrorLogistics" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
+                </div>
+
+              </div>
+              <div>
+                <div style="float: left">
+                  <el-checkbox v-model="form.accountingnodes.invoiceapplycheck.isused" true-label="1" false-label="0">订单开票</el-checkbox>
+                  <span style="margin-left: 50px">后置天数:</span>
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.invoiceapplycheck.days" placeholder="请输入"></el-input>
+                  <span style="margin-left: 5px">天</span>
+                  <span style="margin-left: 50px">立账额度:</span>
+                </div>
+                <div style="float: left">
+                  <el-input type="number" style="width: 100px" v-model="form.accountingnodes.invoiceapplycheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorInvoiceapply }"  @change="checkAmountrate(form.accountingnodes.invoiceapplycheck.amountrate,'订单开票')"></el-input>
+                  <span style="margin-left: 5px">%</span>
+                  <p v-if="isErrorInvoiceapply" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
+                </div>
+              </div>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="描述" prop="remarks">
-              <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"></el-input>
+              <el-input type="textarea" v-model="form.remarks" placeholder="请输入描述"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -36,7 +64,7 @@
         </el-form>
       </el-row>
       <div class="dialog-footer">
-        <el-button size="small" @click="dialogFormVisible = false;$refs.form.resetFields()" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" @click="dialogFormVisible = false;$refs.form.resetFields();$emit('onSuccess');isErrorInvoiceapply=false;isErrorLogistics=false;isErrorOrder=false" class="normal-btn-width">取 消</el-button>
         <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
       </div>
     </el-dialog>
@@ -45,7 +73,7 @@
 
 <script>
 export default {
-  name: "add",
+  name: "edit",
   props:['data'],
   data(){
     var NumberSize = (rule, value, callback) => {
@@ -63,7 +91,24 @@ export default {
         "amountrate":'',
         "point":"",
         "remarks":"",
-        "isdefault":1
+        "isdefault":1,
+        "accountingnodes": {
+          "ordercheck": {//订单审核
+            "days": "",//后置天数
+            "amountrate": "",//立账额度
+            "isused": "0"//是否勾选
+          },
+          "logisticscheck": {//订单出货
+            "days": "",
+            "amountrate": "",
+            "isused": "0"
+          },
+          "invoiceapplycheck": {//订单开票
+            "days": "",
+            "amountrate": "",
+            "isused": "0"
+          }
+        }
       },
       rules:{
         point:[
@@ -82,17 +127,74 @@ export default {
         remarks:[
           { required: false, message: '请输入描述', trigger: 'blur'}
         ],
-      }
+      },
+      isErrorOrder: false,
+      isErrorLogistics:false,
+      isErrorInvoiceapply:false
     }
   },
   methods:{
     editBtn () {
       this.dialogFormVisible = true
       this.form = Object.assign({},this.form,this.data)
-      this.form.amountrate = this.form.amountrate * 100
+      console.log(this.form,'form1')
+      if (this.form.accountingnodes){
+       /* this.form.accountingnodes.ordercheck.amountrate = Math.round((this.form.accountingnodes.ordercheck.amountrate*100)*100)/100
+        this.form.accountingnodes.logisticscheck.amountrate = Math.round((this.form.accountingnodes.logisticscheck.amountrate*100)*100)/100
+        this.form.accountingnodes.invoiceapplycheck.amountrate = Math.round((this.form.accountingnodes.invoiceapplycheck.amountrate*100)*100)/100*/
+      }else {
+        this.form.accountingnodes.ordercheck.amountrate = ''
+        this.form.accountingnodes.logisticscheck.amountrate = ''
+        this.form.accountingnodes.invoiceapplycheck.amountrate = ''
+      }
+
+    },
+    checkAmountrate(val,key){
+      if (val > 100 || val < 0){
+        if (key === '订单审核'){
+          this.isErrorOrder = true
+        }else if (key === '订单出货'){
+          this.isErrorLogistics = true
+        }else {
+          this.isErrorInvoiceapply = true
+        }
+      }else {
+        if (key === '订单审核'){
+          this.isErrorOrder = false
+        }else if (key === '订单出货'){
+          this.isErrorLogistics = false
+        }else {
+          this.isErrorInvoiceapply = false
+        }
+      }
     },
     onSubmit(){
       console.log(this.form)
+      const order = this.form.accountingnodes.ordercheck.isused == '1'?this.form.accountingnodes.ordercheck.amountrate:0
+      const logistics = this.form.accountingnodes.logisticscheck.isused == '1'?this.form.accountingnodes.logisticscheck.amountrate:0
+      const invoiceapply = this.form.accountingnodes.invoiceapplycheck.isused == '1'?this.form.accountingnodes.invoiceapplycheck.amountrate:0
+      console.log(order + logistics + invoiceapply)
+      if (parseFloat(order) + parseFloat(logistics) + parseFloat(invoiceapply) !== 100 ){
+        this.$message.error('已选节点立账额度合计需等于100%');
+      }else {
+        this.$refs['form'].validate(async (valid) => {
+          if (!valid) return false
+          /*this.form.amountrate = (this.form.amountrate /100).toFixed(4)*/
+          this.form.accountingnodes.ordercheck.amountrate = (this.form.accountingnodes.ordercheck.amountrate/100).toFixed(4)
+          this.form.accountingnodes.logisticscheck.amountrate = (this.form.accountingnodes.logisticscheck.amountrate/100).toFixed(4)
+          this.form.accountingnodes.invoiceapplycheck.amountrate = (this.form.accountingnodes.invoiceapplycheck.amountrate/100).toFixed(4)
+          const res = await this.$api.requested({
+            "id": "20230110095903",
+            "content": this.form
+          })
+          this.tool.showMessage(res,()=>{
+            this.$emit('onSuccess')
+            this.$refs['form'].resetFields();
+            this.dialogFormVisible = false
+          })
+        })
+      }
+     /* console.log(this.form)
       this.$refs['form'].validate(async (valid) => {
         if (!valid) return false
         this.form.amountrate = (this.form.amountrate /100).toFixed(4)
@@ -106,7 +208,7 @@ export default {
           this.$refs['form'].resetFields();
           this.dialogFormVisible = false
         })
-      })
+      })*/
     }
   }
 }
@@ -119,4 +221,4 @@ export default {
 .el-select {
   width: 100% !important;
 }
-</style>
+</style>

+ 122 - 0
src/HDrpManagement/collectionRule/components/editCopy.vue

@@ -0,0 +1,122 @@
+<template>
+  <div>
+    <el-button size="mini" type="primary" @click="editBtn">编 辑</el-button>
+    <el-dialog title="编辑收款条件" append-to-body :visible.sync="dialogFormVisible" width="40%">
+      <el-row :gutter="20">
+        <el-form :model="form" :rules="rules" ref="form" label-width="140px" label-position="right" size="mini">
+          <el-col :span="24">
+            <el-form-item label="账期依据" prop="point">
+              <el-select class="width-240" v-model="form.point" placeholder="请选择账期依据">
+                <el-option label="订单" value="订单审核"></el-option>
+                <el-option label="出库" value="销售出库审核"></el-option>
+                <el-option label="发票" value="发票审核"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24" v-if="form.point == '订单审核'">
+            <el-form-item label="立账额度比例" prop="amountrate">
+              <el-input v-model="form.amountrate" placeholder="请输入立账额度比例"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="后置天数" prop="days">
+              <el-input v-model="form.days" placeholder="请输入后置天数"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="描述" prop="remarks">
+              <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="是否默认条件" prop="isdefault">
+              <el-checkbox :true-label="1" :false-label="0" v-model="form.isdefault"></el-checkbox>
+            </el-form-item>
+          </el-col>
+        </el-form>
+      </el-row>
+      <div class="dialog-footer">
+        <el-button size="small" @click="dialogFormVisible = false;$refs.form.resetFields()" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "add",
+  props:['data'],
+  data(){
+    var NumberSize = (rule, value, callback) => {
+      if (+value >= 0 && +value <= 100) {
+        callback()
+      } else {
+        return callback(new Error('额度比率范围(0-100)'));
+      }
+    }
+    return {
+      dialogFormVisible:false,
+      form:{
+        "sa_receivableruleid":0,
+        "days":"10",
+        "amountrate":'',
+        "point":"",
+        "remarks":"",
+        "isdefault":1
+      },
+      rules:{
+        point:[
+          { required: false, message: '请选择账期依据', trigger: 'change'},
+        ],
+        amountrate:[
+          { required: false, message: '请输入立账额度比率', trigger: 'blur'},
+          { validator: NumberSize , trigger:'blur'}
+        ],
+        days:[
+          { required: false, message: '请输入后置天数', trigger: 'blur'}
+        ],
+        isdefault:[
+          { required: false, message: '请选择是否默认条件', trigger: 'blur'}
+        ],
+        remarks:[
+          { required: false, message: '请输入描述', trigger: 'blur'}
+        ],
+      }
+    }
+  },
+  methods:{
+    editBtn () {
+      this.dialogFormVisible = true
+      this.form = Object.assign({},this.form,this.data)
+      this.form.amountrate = this.form.amountrate * 100
+    },
+    onSubmit(){
+      console.log(this.form)
+      this.$refs['form'].validate(async (valid) => {
+        if (!valid) return false
+        this.form.amountrate = (this.form.amountrate /100).toFixed(4)
+        const res = await this.$api.requested({
+          "id": "20230110095903",
+          "version":1,
+          "content": this.form
+        })
+        this.tool.showMessage(res,()=>{
+          this.$emit('onSuccess')
+          this.$refs['form'].resetFields();
+          this.dialogFormVisible = false
+        })
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.dialog-footer {
+  margin-top: 0;
+}
+.el-select {
+  width: 100% !important;
+}
+</style>

+ 9 - 2
src/HDrpManagement/collectionRule/index.vue

@@ -21,7 +21,7 @@
               clearable>
             </el-input>
           </div>
-          <Table :tableData="list">
+          <Table :tableData="list" @onSuccess="listData()">
           </Table>
           <div style="margin-top:16px;text-align:right">
             <el-pagination
@@ -85,7 +85,14 @@ export default {
       const res = await this.$api.requested(this.params)
       this.list = res.data
       this.total = res.total
-      console.log(this.list)
+      this.list.forEach(item=>{
+        if (item.accountingnodes){
+          item.accountingnodes.ordercheck.amountrate = Math.round((item.accountingnodes.ordercheck.amountrate * 100)*100)/100
+          item.accountingnodes.logisticscheck.amountrate = Math.round((item.accountingnodes.logisticscheck.amountrate * 100)*100)/100
+          item.accountingnodes.invoiceapplycheck.amountrate = Math.round((item.accountingnodes.invoiceapplycheck.amountrate * 100)*100)/100
+        }
+      })
+      console.log(this.list,'list')
     },
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);

+ 90 - 8
src/HDrpManagement/collectionRule/modules/table.vue

@@ -24,8 +24,14 @@
             label="订单审核"
             width="100">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '订单审核'" style="color: red">是</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.ordercheck.isused == '1'" style="color: red">是</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
+
+<!--              <div v-if="scope.row.point == '订单审核'" style="color: red">是</div>
+              <div v-else>&#45;&#45;</div>-->
             </template>
           </el-table-column>
           <el-table-column
@@ -33,8 +39,13 @@
             label="立账额度"
             width="100">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '订单审核'">{{scope.row.amountrate * 100}}%</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.ordercheck.amountrate">{{scope.row.accountingnodes.ordercheck.amountrate}}%</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
+<!--              <div v-if="scope.row.point == '订单审核'">{{scope.row.amountrate * 100}}%</div>
+              <div v-else>&#45;&#45;</div>-->
             </template>
           </el-table-column>
           <el-table-column
@@ -42,8 +53,13 @@
             label="后置天数"
             width="100">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '订单审核'">{{scope.row.days}}</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.ordercheck.days">{{scope.row.accountingnodes.ordercheck.days}}</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
+<!--              <div v-if="scope.row.point == '订单审核'">{{scope.row.days}}</div>
+              <div v-else>&#45;&#45;</div>-->
             </template>
           </el-table-column>
         </el-table-column>
@@ -55,7 +71,22 @@
             label="销售出库审核"
             width="120">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '销售出库审核'" style="color: red">是</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.logisticscheck.isused == '1'" style="color: red">是</div>
+                <div v-else>--</div>
+              </div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+              prop="amountrate"
+              label="立账额度"
+              width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.logisticscheck.amountrate">{{scope.row.accountingnodes.logisticscheck.amountrate}}%</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
             </template>
           </el-table-column>
@@ -64,7 +95,10 @@
             label="后置天数"
             width="100">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '销售出库审核'">{{scope.row.days}}</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.logisticscheck.days">{{scope.row.accountingnodes.logisticscheck.days}}</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
             </template>
           </el-table-column>
@@ -77,7 +111,22 @@
             label="发票审核"
             width="100">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '发票审核'" style="color: red">是</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.invoiceapplycheck.isused == '1'" style="color: red">是</div>
+                <div v-else>--</div>
+              </div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+              prop="amountrate"
+              label="立账额度"
+              width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.invoiceapplycheck.amountrate">{{scope.row.accountingnodes.invoiceapplycheck.amountrate}}%</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
             </template>
           </el-table-column>
@@ -86,7 +135,10 @@
             label="后置天数"
             width="100">
             <template slot-scope="scope">
-              <div v-if="scope.row.point == '发票审核'">{{scope.row.days}}</div>
+              <div v-if="scope.row.accountingnodes">
+                <div v-if="scope.row.accountingnodes.invoiceapplycheck.days">{{scope.row.accountingnodes.invoiceapplycheck.days}}</div>
+                <div v-else>--</div>
+              </div>
               <div v-else>--</div>
             </template>
           </el-table-column>
@@ -106,7 +158,9 @@
        label="操作"
        width="150px">
        <template slot-scope="scope">
-         <el-button type="text" size="mini" @click="goDetail(scope.row)">详 情</el-button>
+<!--         <el-button type="text" size="mini" @click="goDetail(scope.row)">详 情</el-button>-->
+         <edit :data="scope.row" class="inline-16" @onSuccess="onSuccess"></edit>
+         <el-button :disabled="scope.row.isdefault === 1" size="mini" v-if="tool.checkAuth($route.name,'delete')" type="text" @click="onDel(scope.row.sa_receivableruleid)">删 除</el-button>
        </template>
       </el-table-column>
   </el-table>
@@ -114,17 +168,45 @@
 </template>
 
 <script>
+import edit from '../components/edit'
 export default {
   props:['tableData'],
   data () {
     return {
     }
   },
+  components:{edit},
   methods: {
     goDetail (data) {
       let query = {id:data.sa_receivableruleid,rowindex:data.rowindex}
       this.$router.push({path:'/collectionRuleDetail',query:query})
       this.$store.dispatch('changeDetailDrawer',true)
+    },
+    onDel(id){
+      this.$confirm('确定删除该收款条件吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        closeOnClickModal:false,
+        type: 'warning'
+      }).then(async() => {
+        const res = await this.$api.requested({
+          "id":20230110100203,
+          "content":{
+            "sa_receivableruleids":[id]
+          }
+        })
+        this.tool.showMessage(res,()=>{
+         this.$emit('onSuccess')
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    onSuccess(){
+      this.$emit('onSuccess')
     }
   }
 }

+ 135 - 0
src/HDrpManagement/collectionRule/modules/tableCopy.vue

@@ -0,0 +1,135 @@
+<!--  -->
+<template>
+  <div>
+    <el-table
+        height="calc(100vh - 330px)"
+    :data="tableData"
+    style="width: 100%">
+      <el-table-column
+        prop="ruleno"
+        label="收款条件编号"
+        width="200">
+      </el-table-column>
+      <el-table-column
+          prop="remarks"
+          label="描述"
+          >
+      </el-table-column>
+      <el-table-column label="应收款期计算依据">
+        <el-table-column
+          prop="name"
+          label="订单">
+          <el-table-column
+            prop="point"
+            label="订单审核"
+            width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '订单审核'" style="color: red">是</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="amountrate"
+            label="立账额度"
+            width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '订单审核'">{{scope.row.amountrate * 100}}%</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="days"
+            label="后置天数"
+            width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '订单审核'">{{scope.row.days}}</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column
+          prop="name"
+          label="发货">
+          <el-table-column
+            prop="point"
+            label="销售出库审核"
+            width="120">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '销售出库审核'" style="color: red">是</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="days"
+            label="后置天数"
+            width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '销售出库审核'">{{scope.row.days}}</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column
+          prop="name"
+          label="发票">
+          <el-table-column
+            prop="point"
+            label="发票审核"
+            width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '发票审核'" style="color: red">是</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="days"
+            label="后置天数"
+            width="100">
+            <template slot-scope="scope">
+              <div v-if="scope.row.point == '发票审核'">{{scope.row.days}}</div>
+              <div v-else>--</div>
+            </template>
+          </el-table-column>
+        </el-table-column>
+      </el-table-column>
+      <el-table-column
+        prop="isdefault"
+        label="是否默认条件"
+        width="120">
+        <template slot-scope="scope">
+          <span v-if="scope.row.isdefault" style="color: red">是</span>
+          <span v-else>否</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+       prop="a"
+       label="操作"
+       width="150px">
+       <template slot-scope="scope">
+         <el-button type="text" size="mini" @click="goDetail(scope.row)">详 情</el-button>
+       </template>
+      </el-table-column>
+  </el-table>
+  </div>
+</template>
+
+<script>
+export default {
+  props:['tableData'],
+  data () {
+    return {
+    }
+  },
+  methods: {
+    goDetail (data) {
+      let query = {id:data.sa_receivableruleid,rowindex:data.rowindex}
+      this.$router.push({path:'/collectionRuleDetail',query:query})
+      this.$store.dispatch('changeDetailDrawer',true)
+    }
+  }
+}
+</script>
+
+<style  scoped>
+
+</style>

+ 2 - 2
vue.config.js

@@ -14,8 +14,8 @@ module.exports = {
       port: 8000,
       proxy: {
         '/apis': {
-          target: 'http://61.164.207.46:8000',  // target host*/
-          // target: 'http://192.168.3.13:8080',  // target host*!
+          // target: 'http://61.164.207.46:8000',  // target host*/
+          target: 'http://192.168.3.13:8080',  // target host*!
           // target: 'http://192.168.3.9:8090',  // target host*!
           // target: 'https://oms.idcgroup.com.cn:8079/',  // target host
           // target: 'localhost:8080',  // target host