123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <template>
- <a-modal
- centered
- class="chooseType-modal"
- :footer="null"
- :maskClosable="false"
- title="编辑价格级别"
- v-model="isShow"
- @cancel="isShow=false"
- width="500px">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 表单 -->
- <a-form-model
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-form-model-item label="价格级别" prop="priceLevel">
- <v-select
- code="PRICE_LEVEL"
- :notIn="notArr"
- id="priceLevel-modal-level"
- v-model="form.priceLevel"
- allowClear
- placeholder="请选择价格级别"></v-select>
- </a-form-model-item>
- <div class="fontRed">注意:价格变更后,该商户的差价设置将同步清空</div>
- </a-form-model>
- <div class="btn-cont">
- <a-button id="priceLevel-modal-back" @click="isShow = false" >取消</a-button>
- <a-button type="primary" style="margin-left: 15px;" id="priceLevel-modal-save" @click="handleSave">确定</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- // 组件
- import { VSelect } from '@/components'
- export default {
- name: 'PriceLevelModal',
- components: { VSelect },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- priceLevelVal: { // 弹框显示状态
- type: String,
- default: ''
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- // form 表单布局
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 18 }
- },
- notArr: [], // 价格级别禁选数据
- form: {
- priceLevel: undefined // 价格级别
- },
- // 表单验证规则
- rules: {
- priceLevel: [
- { required: true, message: '请选择价格等级', trigger: 'change' }
- ]
- }
- }
- },
- methods: {
- // 保存
- handleSave () {
- const _this = this
- _this.$refs.ruleForm.validate(valid => {
- if (valid) {
- _this.$emit('ok', this.form.priceLevel)
- _this.isShow = false
- } else {
- return false
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$refs.ruleForm.resetFields()
- this.$emit('close')
- } else {
- // 特约经销商 价格级别不能修改 省、市经销商时,不能选择特约价
- if (this.$route.params.dealerLevel === 'SPECIAL') {
- this.form.priceLevel = 'SPECIAL'
- } else {
- this.notArr = ['SPECIAL']
- }
- this.form.priceLevel = this.priceLevelVal ? this.priceLevelVal : undefined
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .chooseType-modal{
- .fontRed{
- margin:15px 0 0 4%;
- color:#ed1c24;
- }
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|