Ver código fonte

收款事由

lilei 1 ano atrás
pai
commit
9cbe7811ca

+ 1 - 0
src/store/modules/app.js

@@ -36,6 +36,7 @@ const app = {
     employeeList: [], // 申请人列表
     defectiveReturnReason: [], // 不良品申请退货列表
     goodReturnReason: [], // 良品申请退货列表
+    bookReason:[], // 收款事由
     tempBillOfData: null, // 临时存储收货单数据
     authMenusList: [], // 权限菜单数据
     priceAuthOptions: [], // 价格权限选项

+ 11 - 0
src/views/Home.vue

@@ -118,6 +118,17 @@ export default {
         key: 'defectiveReturnReason',
         isEnable: 1
       })
+      // 收款事由
+      vm.$store.state.app.bookReason = [
+        { dispName: '品牌货款', code: '0' },
+        { dispName: '轮胎货款', code: '1' },
+        { dispName: '品牌+轮胎货款', code: '2' },
+        { dispName: '蓄电池直发货款', code: '3' },
+        { dispName: '品牌+授信款还款', code: '4' },
+        { dispName: '转置还款', code: '5' },
+        { dispName: '分期还款', code: '6' },
+        { dispName: '品牌+分期还款', code: '7' }
+      ]
       // 菜单数据
       vm.getYyMenuList()
       vm.$store.state.app.priceAuthOptions = [

+ 71 - 0
src/views/common/bookReason.js

@@ -0,0 +1,71 @@
+const BookReason = {
+  template: `
+      <a-select
+        :placeholder="placeholder"
+        style="width:100%"
+        :size="size"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        @change="handleChange"
+        option-filter-prop="children"
+        :dropdownMatchSelectWidth="false"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in list" :key="item.code" :value="item.code">
+          {{item.dispName}}
+        </a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+      default: undefined
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    placeholder: {
+      type: String,
+      default: '请选择收款事由'
+    },
+    size: {
+      type: String,
+      default: 'default'
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      list: []
+    };
+  },
+  created() {
+    this.list = this.$store.state.app.bookReason
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue || undefined
+    }
+  },
+  methods: {
+    filterOption(input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      );
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      const row = this.list.find(item => item.code == value)
+      this.$emit('change', value, row);
+      this.$emit('input', value);
+    },
+    getCodeByName(value){
+      const row = this.list.find(item => item.dispName == value)
+      return row? row.code : ''
+    }
+  },
+};
+
+export default BookReason

+ 17 - 9
src/views/financialManagement/financialCollection/baseModal.vue

@@ -20,7 +20,7 @@
           <employee style="width: 100%;" @change="employeeChange" ref="applyPerson" v-model="form.applyPersonSn"></employee>
         </a-form-model-item>
         <a-form-model-item label="收款事由" prop="bookReason">
-          <a-input :maxLength="100" placeholder="请输入收款事由(最多100个字符)" v-model="form.bookReason"></a-input>
+          <bookReason ref="bookReason" v-model="bookReasonCode" @change="updateReason"></bookReason>
         </a-form-model-item>
         <a-form-model-item label="付款方类型" prop="payerType">
           <v-select
@@ -68,11 +68,12 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect, Upload } from '@/components'
 import employee from '../../expenseManagement/expenseReimbursement/employee.js'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import bookReason from '@/views/common/bookReason'
 import { financeBookSave, financeBookFindBySn, queryLastFinishDingUser } from '@/api/financeBook.js'
 export default {
   name: 'FcBaseModal',
   mixins: [commonMixin],
-  components: { VSelect, Upload, employee, dealerSubareaScopeList },
+  components: { VSelect, Upload, employee, dealerSubareaScopeList, bookReason },
   props: {
     show: [Boolean],
     bookSn: {
@@ -95,16 +96,17 @@ export default {
       attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo',
       form: {
         applyPersonSn: undefined,
-        bookReason: '',
+        bookReason: undefined,
         payerType: 'DEALER',
         dealerSn: undefined,
         payerName: undefined,
         remarks: '',
         attachmentList: ''
       },
+      bookReasonCode: undefined,
       rules: {
         applyPersonSn: [ { required: true, message: '请选择申请人', trigger: ['change', 'blur'] } ],
-        bookReason: [ { required: true, message: '请输入收款事由', trigger: ['change', 'blur'] } ],
+        bookReason: [ { required: true, message: '请选择收款事由', trigger: ['change', 'blur'] } ],
         payerType: [ { required: true, message: '请选择付款方类型', trigger: ['change', 'blur'] } ],
         dealerSn: [ { required: true, message: '请选择付款方', trigger: ['change', 'blur'] } ],
         payerName: [ { required: true, message: '请输入付款方名称', trigger: ['change', 'blur'] } ]
@@ -124,9 +126,11 @@ export default {
       this.form.dealerSn = ''
       this.form.payerName = ''
     },
+    updateReason (val, record) {
+      this.form.bookReason = record.dispName
+    },
     // 客户
     custChange (v) {
-      console.log(v)
       if (v && v.key) {
         this.form.dealerSn = v.key
         this.form.payerName = v.row ? v.row.dealerName : ''
@@ -194,6 +198,10 @@ export default {
               this.$refs.settleClientName.getDetail(this.form.dealerSn)
             })
           }
+          // 回显收款事由
+          this.$nextTick(() => {
+            this.bookReasonCode = this.$refs.bookReason.getCodeByName(this.form.bookReason)
+          })
         } else {
           this.$refs.ruleForm.resetFields()
         }
@@ -206,7 +214,7 @@ export default {
       this.$emit('cancel')
       this.$refs.ruleForm.resetFields()
     },
-   async pageInit () {
+    async pageInit () {
       this.$nextTick(() => {
         this.attachList = []
         this.$refs.attachList.setFileList('')
@@ -215,10 +223,10 @@ export default {
           this.$refs.settleClientName.resetForm()
         }
       })
-
+      this.bookReasonCode = undefined
       this.form = {
         applyPersonSn: undefined,
-        bookReason: '',
+        bookReason: undefined,
         payerType: 'DEALER',
         dealerSn: undefined,
         payerName: undefined,
@@ -228,7 +236,7 @@ export default {
 
       if (this.bookSn) { //  编辑页
         this.getDetail()
-      }else{
+      } else {
         // 最近一次审核人
         const lastAuditInfo = await queryLastFinishDingUser().then(res => res.data)
         this.form.applyPersonSn = lastAuditInfo ? lastAuditInfo.applyPersonSn : undefined