123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <div>
- <a-modal
- centered
- wrapClassName="setModal-modal"
- :footer="null"
- :maskClosable="false"
- :title="textTitle"
- v-model="isshow"
- @cancle="isshow=false"
- :width="500">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="setModal-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- >
- <div style="margin-bottom: 10px;text-align: center;">
- <strong>近{{ form&&form.day_limit||'' }}天下单额</strong>
- </div>
- <a-form-model-item label="LV1" prop="LV1" :label-col="{span: 4}" :wrapper-col="{span: 18}">
- <a-input-number style="width:80%;" v-model.trim="form.LV1" :precision="2" allowClear placeholder="请输入LV1下单额"/>
- 元以下
- </a-form-model-item>
- <a-form-model-item label="LV2" prop="LV2" :label-col="{span: 4}" :wrapper-col="{span: 18}">
- <a-input-group style="width: 90%;" compact>
- <a-input style="width: 43%; text-align: center;pointer-events: none; backgroundColor: #f8f8f8;color:#666;" disabled v-model.trim="form.LV1"/>
- <a-input
- style=" width: 12%; pointer-events: none; backgroundColor: #fff"
- placeholder="至"
- disabled
- />
- <a-input-number
- :precision="2"
- :min="form.LV1"
- style="width: 43%; text-align: center"
- v-model.trim="form.LV2"
- allowClear
- placeholder="请输入LV2下单额"/>
- </a-input-group>
- 元
- </a-form-model-item>
- <a-form-model-item label="LV3" prop="LV3" :label-col="{span: 4}" :wrapper-col="{span: 18}">
- <a-input-group style="width: 90%;" compact>
- <a-input style=" width: 43%; text-align: center;pointer-events: none; backgroundColor: #f8f8f8;color:#666;" disabled v-model.trim="form.LV2"/>
- <a-input
- style=" width: 12%; pointer-events: none; backgroundColor: #fff"
- placeholder="至"
- disabled
- />
- <a-input-number
- :precision="2"
- :min="form.LV2"
- style=" width: 43%; text-align: center"
- v-model.trim="form.LV3"
- allowClear
- placeholder="请输入LV3下单额"/>
- </a-input-group>
- 元
- </a-form-model-item>
- <a-form-model-item label="LV4" prop="LV4" :label-col="{span: 4}" :wrapper-col="{span: 18}">
- <a-input-group style="width: 90%;" compact>
- <a-input style=" width: 43%; text-align: center;pointer-events: none; backgroundColor: #f8f8f8;color:#666;" disabled v-model.trim="form.LV3"/>
- <a-input
- style=" width: 12%; pointer-events: none; backgroundColor: #fff"
- placeholder="至"
- disabled
- />
- <a-input-number
- :precision="2"
- :min="form.LV3"
- style=" width: 43%; text-align: center"
- v-model.trim="form.LV4"
- allowClear
- placeholder="请输入LV4下单额"/>
- </a-input-group>
- 元
- </a-form-model-item>
- <a-form-model-item label="LV5" :label-col="{span: 4}" :wrapper-col="{span: 18}">
- <a-input style="width: 80%; text-align: center;pointer-events: none; backgroundColor: #f8f8f8;color:#666;" disabled v-model.trim="form.LV4"/>
- 元以上
- </a-form-model-item>
- <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
- <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }" id="setModal-handleSubmit">保存</a-button>
- <a-button :style="{ marginLeft: '8px' }" @click="isshow=false" id="setModal-close">取消</a-button>
- </a-form-model-item>
- </a-form-model>
- </a-spin>
- </a-modal>
- </div>
- </template>
- <script>
- import { queryStoreLevelParamMap, saveStoreLevelParam } from '@/api/report.js'
- export default {
- name: 'AddHWModal',
- props: {
- openModal: {
- type: Boolean,
- default: false
- },
- shelfSn: {
- type: [String, Number],
- default: ''
- },
- nowData: {
- type: Object,
- default: function () {
- return {}
- }
- }
- },
- data () {
- return {
- spinning: false,
- isshow: this.openModal,
- textTitle: '参数设置',
- roleList: [],
- pageInfo: null,
- form: {
- LV1: '',
- LV2: '',
- LV3: '',
- lv4: '',
- LV5: '',
- day_limit: '30'
- },
- rules: {
- LV1: [{ required: true, message: '请输入LV1下单金额', trigger: 'blur' }],
- LV2: [{ required: true, message: '请输入LV2下单金额', trigger: 'blur' }],
- LV3: [{ required: true, message: '请输入LV3下单金额', trigger: 'blur' }],
- LV4: [{ required: true, message: '请输入LV4下单金额', trigger: 'blur' }]
- }
- }
- },
- methods: {
- // 查询货位详情
- getDetail () {
- this.spinning = true
- queryStoreLevelParamMap().then(res => {
- if (res.status == 200) {
- this.form = Object.assign({}, res.data)
- for (const key in this.form) {
- this.form[key] = Number(this.form[key])
- }
- }
- this.spinning = false
- })
- },
- // 保存提交
- handleSubmit () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- _this.spinning = true
- saveStoreLevelParam(_this.form).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$emit('ok')
- setTimeout(function () {
- _this.isshow = false
- _this.spinning = false
- }, 300)
- } else {
- _this.spinning = false
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- }
- },
- watch: {
- openModal (newValue, oldValue) {
- this.isshow = newValue
- },
- isshow (newValue, oldValue) {
- if (!newValue) {
- this.$refs.ruleForm.resetFields()
- this.form = {}
- this.$emit('close')
- } else {
- this.getDetail()
- }
- }
- }
- }
- </script>
- <style lang="less">
- </style>
|