lilei 4 tygodni temu
rodzic
commit
572cab43c6

+ 191 - 0
src/views/financialManagement/manualEntryForm/baseModal.vue

@@ -0,0 +1,191 @@
+<template>
+  <a-modal
+    v-model="opened"
+    :title="title"
+    centered
+    :maskClosable="false"
+    :width="600"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="chooseCustom-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol">
+        <a-form-model-item label="客户名称" prop="dealerSn">
+          <dealerSubareaScopeList id="manualEntryForm-dealer" :disabled="!!bookSn" ref="settleClientName" @change="custChange" />
+        </a-form-model-item>
+        <a-form-model-item label="借贷类型" prop="dealerSn">
+          <v-select
+            v-model="form.status"
+            ref="status"
+            type="radio"
+            id="manualEntryForm-type"
+            code="FINANCE_BOOK_STATE"
+            placeholder="请选择借贷类型"
+            allowClear></v-select>
+        </a-form-model-item>
+        <a-form-model-item label="借贷金额" prop="dealerSn">
+          <a-input-number
+            id="manualEntryForm-amount"
+            :min="0"
+            :max="99999999"
+            v-model.trim="form.dealerName"
+            allowClear
+            style="width:200px;"
+            placeholder="请输入借贷金额"/>
+          元
+        </a-form-model-item>
+        <a-form-model-item label="备注">
+          <a-textarea :rows="4" :maxLength="100" placeholder="请输入备注(最多100个字符)" v-model="form.remarks"></a-textarea>
+        </a-form-model-item>
+        <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top: 30px;">
+          <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
+          <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">保存</a-button>
+        </a-form-model-item>
+      </a-form-model>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import { financeBookSave, financeBookFindBySn } from '@/api/financeBook.js'
+export default {
+  name: 'ASBaseModal',
+  mixins: [commonMixin],
+  components: { VSelect, dealerSubareaScopeList },
+  props: {
+    show: [Boolean],
+    bookSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      opened: this.show,
+      spinning: false,
+      disabled: false,
+      title: '调账',
+      confirmLoading: false,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      form: {
+        dealerSn: undefined,
+        dealerName: undefined,
+        remarks: ''
+      },
+      rules: {
+        dealerSn: [ { required: true, message: '请选择客户', trigger: ['change', 'blur'] } ]
+      }
+    }
+  },
+  methods: {
+    // 客户
+    custChange (v) {
+      if (v && v.key) {
+        this.form.dealerSn = v.key
+        this.form.dealerName = v.row ? v.row.dealerName : ''
+      } else {
+        this.form.dealerSn = ''
+        this.form.dealerName = ''
+      }
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.salesSaveFun()
+        } else {
+          return false
+        }
+      })
+    },
+    // 新建或编辑销售单
+    salesSaveFun () {
+      const _this = this
+      const form = JSON.parse(JSON.stringify(_this.form))
+      _this.spinning = true
+      financeBookSave(form).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          // 编辑
+          if (this.bookSn) {
+            _this.$emit('refashData')
+          } else {
+            // 新增
+            _this.$router.push({ name: 'accountStatementEdit', params: { sn: res.data.bookSn } })
+          }
+          _this.cancel()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    //  详情
+    getDetail () {
+      this.title = '编辑对账单'
+      this.spinning = true
+      this.confirmLoading = true
+      financeBookFindBySn({ bookSn: this.bookSn }).then(res => {
+        if (res.status == 200) {
+          const data = res.data
+          this.form = Object.assign(this.form, data)
+          // 回显客户
+          if (this.form.dealerSn) {
+            this.$nextTick(() => {
+              this.$refs.settleClientName.getDetail(this.form.dealerSn)
+            })
+          }
+        } else {
+          this.$refs.ruleForm.resetFields()
+        }
+        this.spinning = false
+        this.confirmLoading = false
+      })
+    },
+    cancel () {
+      this.opened = false
+      this.$emit('cancel')
+      this.$refs.ruleForm.resetFields()
+    },
+    async pageInit () {
+      this.$nextTick(() => {
+        this.$refs.ruleForm.resetFields()
+        if (this.$refs.settleClientName) {
+          this.$refs.settleClientName.resetForm()
+        }
+      })
+      this.form = {
+        dealerSn: undefined,
+        dealerName: undefined,
+        remarks: ''
+      }
+      //  编辑页
+      if (this.bookSn) {
+        this.getDetail()
+      }
+    }
+  },
+  watch: {
+    show (newValue, oldValue) {
+      this.opened = newValue
+      if (newValue) {
+        this.pageInit()
+      }
+    }
+  }
+}
+</script>

+ 16 - 7
src/views/financialManagement/manualEntryForm/list.vue

@@ -54,7 +54,7 @@
       <!-- 操作按钮 -->
       <div class="table-operator">
         <div class="flex-center">
-          <a-button type="primary" v-if="$hasPermissions('B_fc_new')" @click="handleAdd">调账</a-button>
+          <a-button type="primary" @click="handleAdd">调账</a-button>
           <div class="tongji-bar"></div>
         </div>
         <div></div>
@@ -85,6 +85,8 @@
         </s-table>
       </a-spin>
     </a-card>
+    <!-- 基础信息 -->
+    <baseModal v-drag :show="baseModal" @cancel="baseModal=false"></baseModal>
   </div>
 </template>
 
@@ -93,14 +95,15 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { financeBookQueryPage } from '@/api/financeBook.js'
 import rangeDate from '@/views/common/rangeDate.vue'
+import baseModal from './baseModal.vue'
 export default {
   name: 'AccountStatementBillList',
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate },
+  components: { STable, VSelect, rangeDate, baseModal },
   data () {
     return {
       spinning: false,
-      exportLoading: false,
+      baseModal: false,
       tableHeight: 0,
       queryParam: { //  查询条件
         beginDate: '',
@@ -112,6 +115,7 @@ export default {
       creatDate: [], //  创建时间
       disabled: false, //  查询、重置按钮是否可操作
       advanced: true,
+      itemSn: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -142,18 +146,23 @@ export default {
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务单号', dataIndex: 'payerName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户名称', dataIndex: 'payerName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '借方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
+        { title: '客户名称', dataIndex: 'payerName1', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '借方', dataIndex: 'productCost1', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
         { title: '贷方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
         { title: '备注', dataIndex: 'remarks', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核时间', dataIndex: 'statusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '状态', dataIndex: 'statusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'statusDictValue1', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'actions' }, width: '8%', align: 'center' }
       ]
       return arr
     }
   },
   methods: {
+    //  创建时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0] ? date[0] : ''
+      this.queryParam.endDate = date[1] ? date[1] : ''
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.beginDate = ''
@@ -168,7 +177,7 @@ export default {
     },
     // 调账
     handleAdd () {
-
+      this.baseModal = true
     },
     pageInit () {
       const _this = this