/** * 空的验证组件,后续如果增加业务,则更改组件 */ var couponListHtml = '
'; // couponListHtml += '
'; // couponListHtml += ''; // couponListHtml += '
'; // couponListHtml += ''; // couponListHtml += '
    '; // couponListHtml += '
  • '; // couponListHtml += '' // couponListHtml += '' // couponListHtml += '
  • '; // couponListHtml += '
'; // couponListHtml += '
'; // couponListHtml += '
'; // couponListHtml += '
'; // couponListHtml += ''; // couponListHtml += '
'; // couponListHtml += '选择 '; // couponListHtml += '
'; // couponListHtml += '
'; couponListHtml += ''; couponListHtml += '
'; Vue.component("coupon-list", { template: couponListHtml, data: function () { return { data: this.$parent.data, goodsSources: [ { text: "默认", value: "default", src: couponResourcePath + "/coupon/img/goods.png", selectedSrc: couponResourcePath + "/coupon/img/goods_1.png" }, { text : "手动选择", value : "diy", src: couponResourcePath + "/coupon/img/manual.png", selectedSrc: couponResourcePath + "/coupon/img/manual_1.png" } ], isLoad: false, isShow: false, couponCount: [6, 12, 18, 24, 30], } }, created:function() { if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods: { shopNum: function(){ if (this.$parent.data.couponCount > 50){ layer.msg("优惠券数量最多为50"); this.$parent.data.couponCount = 50; } if (this.$parent.data.couponCount.length > 0 && this.$parent.data.couponCount < 1) { layer.msg("优惠券数量不能小于0"); this.$parent.data.couponCount = 1; } }, verify : function () { var res = { code : true, message : "" }; /* if(this.data.couponCount.length===0) { res.code = false; res.message = "请输入优惠券数量"; } if (this.data.goodsCount < 0) { res.code = false; res.message = "优惠券数量不能小于0"; } if(this.data.couponCount > 50){ res.code = false; res.message = "优惠券数量最多为50"; } */ return res; }, addCoupon: function(){ var self = this; self.couponSelect(function (res) { self.$parent.data.couponIds = []; for (var i=0; i
{{item.label}}
'; moreBtnHtml += ''; moreBtnHtml += ''; moreBtnHtml += ''; Vue.component("coupon-status", { props: { data: { type: Object, default: function () { return { field: "status", label: "优惠券领取状态" }; } } }, created: function () { if (this.data.label == undefined) this.data.label = "启用"; if (this.data.field == undefined) this.data.field = "status"; }, watch: { data: function (val, oldVal) { if (val.field == undefined) val.field = oldVal.field; if (val.label == undefined) val.label = "启用"; }, }, template: moreBtnHtml, data: function () { return { list: [ {label: "开启", value: 1}, {label: "关闭", value: 0}, ], parent: this.$parent.data, }; } });