1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <a-modal
- v-model="opened"
- title="新活动提醒"
- centered
- :maskClosable="false"
- width="30%"
- :footer="null"
- @cancel="cancel"
- >
- <a-spin :spinning="spinning" tip="Loading...">
- <div style="padding: 0 50px;">
- <div style="padding:10px 0;text-align:left;">
- 系统发布新的促销活动,是否要参与?
- </div>
- <div style="text-align:left;color:#00aaff;">
- <a-checkbox-group v-model="newPromoSnList">
- <a-row v-for="item in newActiveList" :key="item.promotionSn">
- <a-col :span="24"><a-checkbox :value="item.promotionSn">{{ item.description }}</a-checkbox></a-col>
- </a-row>
- </a-checkbox-group>
- </div>
- </div>
- <div style="margin-top:36px;text-align:center;">
- <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
- <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { salesDetailAddPromo } from '@/api/salesDetailNew'
- export default {
- name: 'NewPromoModal',
- mixins: [commonMixin],
- props: {
- show: [Boolean],
- newActiveList: [Array],
- salesBillSn: [String]
- },
- data () {
- return {
- opened: this.show,
- spinning: false,
- newPromoSnList: [], // 新活动选项sn
- confirmLoading: false
- }
- },
- methods: {
- // 保存
- handleSubmit () {
- const _this = this
- if (_this.newPromoSnList.length) {
- _this.confirmLoading = true
- salesDetailAddPromo({
- 'salesBillSn': _this.salesBillSn,
- 'promoSnList': _this.newPromoSnList
- }).then(res => {
- if (res.status == 200) {
- _this.$emit('ok', 1)
- }
- _this.confirmLoading = false
- })
- } else {
- _this.$message.info('请选择要参与的新活动')
- return true
- }
- },
- // 取消
- cancel () {
- this.opened = false
- this.$emit('cancel')
- this.$emit('ok', 0)
- }
- },
- watch: {
- show (newValue, oldValue) {
- this.opened = newValue
- if (!newValue) {
- this.newPromoSnList = []
- } else {
- // 默认全选
- this.newActiveList.map(item => {
- this.newPromoSnList.push(item.promotionSn)
- })
- }
- }
- }
- }
- </script>
|