setPriceDialog.vue 1.69 KB
<template>
    <GLDialog title="批量改价" mode="small" :visible.sync="visible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" okText="提交" cancelText="取消">
        <div class="dialog-wrap">
            <span>销售价 = 供货价  +</span>
            <el-input size="small" type="text" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
            .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" v-model="batchPrice" placeholder="请输入金额">
                <span slot="append">元</span>
            </el-input>
        </div>
    </GLDialog>
</template>

<script>
export default {
    name: 'setPriceDialog',
    props: {
        visible:{
            type: Boolean,
            default: false
        }
    },

    data() {
        return {
            batchPrice: ''
        }
    },

    methods: {
        confirmPriceChange(){
            this.$emit('confirm', this.batchPrice)
        },
        handleClose(){
            this.$emit('handleClose')
        }
    }
}
</script>
<style lang="scss" scoped>
.dialog-wrap{
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    span{
        white-space: nowrap;
        margin-right: 8px;
    }
    /deep/ .el-input{
        &, .el-input__inner{
            width: 222px;
        }
        .el-input-group__append{
            box-sizing: border-box;
            padding: 0 11px;
            span{
                margin: 0;
            }
        }
    }
}
</style>