| | |
| | | <el-input v-model="form.price" placeholder="请输入" @input="inputAction(form, 'price')" > |
| | | <template slot="append" >{{form.couponType ===1?'折':'元'}}</template> |
| | | </el-input> |
| | | <div class="discrep" v-if="form.couponType === 1" >,折扣优惠金额上限</div> |
| | | <el-input v-model="form.maxPrice" v-if="form.couponType === 1" placeholder="请输入" @input="inputAction(form, 'maxPrice')" > |
| | | <template slot="append" >元</template> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="优惠券说明" prop="info"> |
| | | <el-input type="textarea" v-model="form.info" placeholder="请输入优惠券说明" v-trim/> |
| | | <el-input type="textarea" v-model="form.info" placeholder="请输入优惠券说明" maxlength="500" v-trim/> |
| | | </el-form-item> |
| | | <p class="tip-header" >使用限制</p> |
| | | <el-form-item label="有效期" prop="useType"> |
| | |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.applyType===1" label="选择品类" prop="applyCateIdList" > |
| | | <el-select v-model="form.applyCateIdList" placeholder="请选择,支持多选" filterable multiple clearable > |
| | | <el-select v-model="form.applyCateIdList" placeholder="请选择商品分类,支持多选" filterable multiple clearable > |
| | | <el-option v-for="item in categorys" :key="'optCate'+item.id" :label="item.name" :value="item.id"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <p class="tip-header" >发放规则</p> |
| | | <el-form-item label="发放总量" prop="num"> |
| | | <div class="num-style"> |
| | | <el-input-number v-model="form.num" :controls="false" :min="1" :max="99999" placeholder="请输入发放总量(1~99999)" v-trim></el-input-number> |
| | | <el-input-number v-model="form.num" :controls="false" :min="0" :max="99999" placeholder="请输入发放总量(0~99999)" v-trim></el-input-number> |
| | | </div> |
| | | <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:发放总量为0表示不限制</p> |
| | | </el-form-item> |
| | | </el-form> |
| | | <OperaCouponGoodsWindow ref="OperaCouponGoodsWindow" @success="doSelect"/> |
| | |
| | | import { fetchList as shopList } from '@/api/business/shop' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { findAll as labelList } from '@/api/business/labels' |
| | | import { allList as goodsList} from '@/api/business/goods' |
| | | import { allList as goodsList } from '@/api/business/goods' |
| | | import OperaCouponGoodsWindow from '@/components/business/OperaCouponGoodsWindow' |
| | | export default { |
| | | name: 'OperaCouponWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow,OperaCouponGoodsWindow }, |
| | | components: { GlobalWindow, OperaCouponGoodsWindow }, |
| | | data () { |
| | | const couponRules = (rule, value, callback) => { |
| | | if (!this.form.limitPrice) { |
| | | callback(new Error('请输入满额')) |
| | | } else if (!this.form.price) { |
| | | callback(new Error('请完善优惠规则')) |
| | | } else if (this.form.couponType == 1 && (this.form.price <= 0 || this.form.price >= 10)) { |
| | | callback(new Error('优惠折扣只能为 (0,10)范围内')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | return { |
| | | searchLoading: false, |
| | | getDate: [], |
| | | applyDataList:[], |
| | | showGoods:false, |
| | | applyDataList: [], |
| | | showGoods: false, |
| | | // 表单数据 |
| | | form: { |
| | | id: null, |
| | |
| | | ], |
| | | num: [ |
| | | { required: true, validator: numRule, message: '请输入发放总数', tigger: 'blur' } |
| | | ], |
| | | /*integral: [ |
| | | ] |
| | | /* integral: [ |
| | | { required: true, validator: numRule, message: '请输入兑换条件', tigger: 'blur' } |
| | | ],*/ |
| | | ], */ |
| | | // validDays: [ |
| | | // { required: true, message: '请输入可用时间', tigger: 'blur' } |
| | | // ], |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | selectGoods(){ |
| | | selectGoods () { |
| | | this.$refs.OperaCouponGoodsWindow.open('选择商品', this.applyDataList) |
| | | }, |
| | | loadLabels(){ |
| | | loadLabels () { |
| | | labelList({ |
| | | type: 0 // 商品分类 |
| | | }).then(res => { |
| | | this.categorys = res || [] |
| | | }) |
| | | }, |
| | | loadSelectGoods(){ |
| | | loadSelectGoods () { |
| | | console.log(this.form.applyIdList) |
| | | if(!this.form.applyIdList || !this.form.applyIdList.length){ |
| | | if (!this.form.applyIdList || !this.form.applyIdList.length) { |
| | | return |
| | | } |
| | | goodsList({ |
| | |
| | | this.applyDataList = res || [] |
| | | }) |
| | | }, |
| | | doSelect(rows){ |
| | | console.log(rows,this.applyDataList) |
| | | this.applyDataList =[] |
| | | this.form.applyIdList=[] |
| | | if(rows && rows.length){ |
| | | doSelect (rows) { |
| | | console.log(rows, this.applyDataList) |
| | | this.applyDataList = [] |
| | | this.form.applyIdList = [] |
| | | if (rows && rows.length) { |
| | | rows.forEach(item => { |
| | | this.applyDataList.push(item) |
| | | this.form.applyIdList.push(item.id) |
| | |
| | | } |
| | | }, |
| | | open (title, target, type) { |
| | | this.showGoods=false |
| | | this.showGoods = false |
| | | this.title = title |
| | | this.visible = true |
| | | this.form.type = type |
| | | this.getDate = [] |
| | | this.form.startDate = '' |
| | | this.form.endDate = '' |
| | | this.applyDataList=[] |
| | | this.form.applyIdList=[] |
| | | this.form.applyCateIdList=[] |
| | | this.applyDataList = [] |
| | | this.form.applyIdList = [] |
| | | this.form.applyCateIdList = [] |
| | | this.loadLabels() |
| | | this.form.limitPrice=null |
| | | this.form.price=null |
| | | this.form.startDate=null |
| | | this.form.endDate=null |
| | | this.form.num=1 |
| | | this.form.limitPrice = null |
| | | this.form.price = null |
| | | this.form.startDate = null |
| | | this.form.endDate = null |
| | | this.form.num = 1 |
| | | // 新建 |
| | | if (target == null) { |
| | | this.$nextTick(() => { |
| | |
| | | this.form[key] = target[key] |
| | | } |
| | | this.getDate = [target.startDate, target.endDate] |
| | | if(this.form.applyType === 1){ |
| | | this.form.applyCateIdList =[] |
| | | if (this.form.applyType === 1) { |
| | | this.form.applyCateIdList = [] |
| | | var ta = this.form.applyIds.split(',') |
| | | if(ta && ta.length){ |
| | | ta.forEach(tt =>{ |
| | | if (ta && ta.length) { |
| | | ta.forEach(tt => { |
| | | this.form.applyCateIdList.push(parseInt(tt)) |
| | | }) |
| | | } |
| | | } |
| | | if(this.form.applyType === 2){ |
| | | if (this.form.applyType === 2) { |
| | | this.form.applyIdList = this.form.applyIds.split(',') |
| | | this.loadSelectGoods() |
| | | } |