allocationNumDialog.vue 2.32 KB
<!-- 盘点 -->
<template>
  <d2-dialog title="调拨"
             :is-visible="allocationNumVisible"
             class="allocationNumDailog"
             width="30%"
             btn-ok-label="确定"
             @closeDialog="handleClose"
             @confirmDialog="handleAddConfirm">
    <el-form ref="allocationNumForm"
             :model="infoForm"
             :rules="formRules"
             label-width="120px">
      <el-form-item label="调拨数量:"
                    prop="allocationNum">
        <el-input placeholder="请输入调拨数量"
                  v-model="infoForm.allocationNum"
                  style="width:250px"
                  clearable
                  @input="handleUpgradeNum">
        </el-input>
      </el-form-item>
    </el-form>
  </d2-dialog>
</template>

<script>
import { queryGoodsCategoryBySceneId, editFeaturedGoods } from '@api/sceneCategory'
import { deepClone } from '@/common/util'
import { limitPrice } from '@/common/format'
import BigNumber from 'bignumber.js'
export default {
  name: 'AllocationNumDialog',
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      infoForm: {
        allocationNum: ''
      },
      oldVal: {
        allocationNum: ''
      },

      formRules: {
        allocationNum: [
          { required: true, message: '请输入调拨数量', trigger: 'change' }
        ]
      },
      selectLoading: false,
      // 基本数据
      baseData: {
        noRelatcategoryList: []
      }
    }
  },

  props: {
    allocationNumVisible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => { }
    }
  },

  watch: {
  },

  created() {
  },
  components: {},

  computed: {

  },

  mounted() {

  },

  methods: {

    handleUpgradeNum(newVal) {
      this.infoForm.allocationNum = limitPrice(newVal, this.oldVal.allocationNum, 8, 2, 0, this.recordInfo.stock)
      this.oldVal.allocationNum = this.infoForm.allocationNum
    },

    handleAddConfirm() {
      this.$refs.allocationNumForm.validate(valid => {
        if (valid) {
          this.recordInfo.allocateNumber = parseFloat(this.infoForm.allocationNum)
          this.handleClose(this.recordInfo)
        }
      })
    },

    handleClose(info) {
      this.$emit('dialogClose', info)
    }
  }
}
</script>
<style >
</style>