123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <template>
- <a-modal
- centered
- class="endDescription-modal"
- :footer="null"
- :maskClosable="false"
- v-model="isShow"
- title="提示"
- @cancel="isShow=false"
- :width="500">
- <a-spin :spinning="spinning" tip="Loading...">
- <div style="margin-bottom: 20px;font-weight: bold;margin-left:20px;">确定要终止该促销吗?</div>
- <a-form-model
- id="endDescription-form"
- ref="ruleForm"
- :model="form"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol" >
- <a-form-model-item label="促销简称" prop="name">
- <span>{{ form.name }}</span>
- </a-form-model-item>
- <a-form-model-item label="终止说明" prop="newTimeEnd">
- <a-input id="endDescription-desc" v-model="form.desc" type="textarea" placeholder="请输入终止说明(最多50字符)" :maxLength="50"/>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button id="endDescription-modal-back" @click="isShow = false">取消</a-button>
- <a-button style="margin-left: 15px;" type="primary" id="endDescription-modal-save" @click="handleSave">确定</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- // 接口
- import { promotionIsOver } from '@/api/promotion'
- export default {
- name: 'EndDescModal',
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemObj: {
- type: Object,
- default: () => {
- return {}
- }
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- // form 表单label布局
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 18 }
- },
- // 提交参数
- form: {
- sn: undefined,
- name: '',
- desc: undefined
- }
- }
- },
- methods: {
- // 确定终止
- handleSave () {
- const _this = this
- _this.spinning = true
- promotionIsOver({ promotionSn: this.form.sn, overInfo: this.form.desc }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$emit('ok')
- _this.isShow = false
- }
- _this.spinning = false
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.form = {
- sn: undefined,
- name: '',
- desc: undefined
- }
- } else {
- if (this.itemObj) {
- this.form = { ...this.form, ...this.itemObj }
- }
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .endDescription-modal{
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|