// 顶部内容组件 var specialTopConHtml = '
'; specialTopConHtml += ''; specialTopConHtml += ''; specialTopConHtml += ''; specialTopConHtml += ''; /* specialTopConHtml += '
'; specialTopConHtml += '{{listMore.title}}'; specialTopConHtml += '
'; specialTopConHtml += ''; specialTopConHtml += '
'; */ specialTopConHtml +='
'; Vue.component("special-top-content", { data: function () { return { data: this.$parent.data, list: this.$parent.data.list, listMore: this.$parent.data.listMore, imgUrl1: "", imgUrl2: "", imgUrl3: "", imgUrl4: "" } }, created: function () { this.imgUrl1 = this.list[0].imageUrl; this.imgUrl2 = this.list[1].imageUrl; this.imgUrl3 = this.list[2].imageUrl; this.imgUrl4 = this.list[3].imageUrl; if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods: { verify : function () { var res = { code : true, message : "" }; return res; }, }, template: specialTopConHtml }); /** * 空的验证组件,后续如果增加业务,则更改组件 */ var specialListHtml = '
'; specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
    '; specialListHtml += '
  • '; specialListHtml += '' specialListHtml += '' specialListHtml += '
  • '; specialListHtml += '
'; /* specialListHtml += ''; */ specialListHtml += '
'; specialListHtml += '
'; specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
'; specialListHtml += '选择'; specialListHtml += '
'; specialListHtml += '
'; /* specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
'; specialListHtml += '
'; specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
'; specialListHtml += ''; specialListHtml += '
'; specialListHtml += '
'; */ specialListHtml += ''; // specialListHtml += '

商品数量选择 0 时,前台会自动上拉加载更多

'; specialListHtml += '
'; var select_goods_list = []; //配合商品选择器使用 Vue.component("special-list", { template: specialListHtml, data: function () { return { data: this.$parent.data, goodsSources: [ { text: "默认", value: "default", src: specialResourcePath + "/special/img/goods.png", selectedSrc: specialResourcePath + "/special/img/goods_1.png" }, { text : "手动选择", value : "diy", src: specialResourcePath + "/special/img/manual.png", selectedSrc: specialResourcePath + "/special/img/manual_1.png" } ], categoryList: [], isLoad: false, isShow: false, selectIndex: 0,//当前选中的下标 goodsCount: [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.goodsCount > 50) { layer.msg("商品数量最多为50"); this.$parent.data.goodsCount = 50; } if (this.$parent.data.goodsCount.length > 0 && this.$parent.data.goodsCount < 1) { layer.msg("商品数量不能小于0"); this.$parent.data.goodsCount = 1; } }, verify: function () { var res = {code: true, message: ""}; if (this.data.goodsCount.length === 0) { res.code = false; res.message = "请输入商品数量"; } if (this.data.goodsCount < 0) { res.code = false; res.message = "商品数量不能小于0"; } if (this.data.goodsCount > 50) { res.message = "商品数量最多为50"; } return res; }, addGoods: function () { var self = this; goodsSelect(function (res) { // if (!res.length) return false; // self.$parent.data.goodsId = []; // for (var i = 0; i < res.length; i++) { // self.$parent.data.goodsId.push(res[i]); // } self.$parent.data.goodsId = res; }, self.$parent.data.goodsId, {mode: "spu", promotion: "special", disabled: 0, post: post}); } } }); var specialStyleHtml = '
'; specialStyleHtml += ''; specialStyleHtml += '
'; // specialStyleHtml += '{{data.styleName}}'; specialStyleHtml += '
{{data.styleName}}
'; specialStyleHtml += '
选择
'; specialStyleHtml += '
'; specialStyleHtml += '
'; Vue.component("special-style", { template: specialStyleHtml, data: function() { return { data: this.$parent.data, } }, created:function() { if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods: { verify: function () { var res = { code: true, message: "" }; return res; }, selectGroupbuyStyle: function() { var self = this; layer.open({ type: 1, title: '风格选择', area:['930px','630px'], btn: ['确定', '返回'], content: $(".draggable-element[data-index='" + self.data.index + "'] .edit-attribute .pintuan-list-style").html(), success: function(layero, index) { $(".layui-layer-content input[name='style']").val(self.data.style); $(".layui-layer-content input[name='style_name']").val(self.data.styleName); $("body").on("click", ".layui-layer-content .style-list-con-pintuan .style-li-pintuan", function () { $(this).addClass("selected ns-border-color").siblings().removeClass("selected ns-border-color"); $(".layui-layer-content input[name='style']").val($(this).index() + 1); $(".layui-layer-content input[name='style_name']").val($(this).find("span").text()); }); }, yes: function (index, layero) { self.data.style = $(".layui-layer-content input[name='style']").val(); self.data.styleName = $(".layui-layer-content input[name='style_name']").val(); layer.closeAll() } }); }, } }) // 图片上传 var specialTopHtml = ''; Vue.component("special-top-list",{ template : specialTopHtml, data : function(){ return { data : this.$parent.data, list : this.$parent.data.list, listMore: this.$parent.data.listMore }; }, created : function(){ if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, watch : { }, methods : { verify:function () { var res = { code : true, message : "" }; var _self = this; if(_self.data.specialId == ""){ res.code = false; res.message = "请选择专题"; $(this).find(".error-msg").text("请选择专题").show(); return res; }else{ $(this).find(".error-msg").text("").hide(); } return res; }, addSpecial() { var self = this; specialSelect(function (res) { console.log(res) self.$parent.data.specialId = res.id; self.$parent.data.specialName = res.name; let style = self.$parent.data.style || 1; self.$parent.data.list[style-1].imageUrl = res.image; }, self.$parent.data.specialId, {disabled:0}); } } }); // 背景颜色可选 var specialColorHtml = '
'; specialColorHtml += ''; specialColorHtml += '
'; specialColorHtml += ''; specialColorHtml += '
'; specialColorHtml += '
'; Vue.component("special-color", { template: specialColorHtml, data: function () { return { data: this.$parent.data, colorList: [ {name: "红", className: "red", color: "#FFD7D7"}, {name: "蓝", className: "blue", color: "#D7FAFF"}, {name: "黄", className: "yellow", color: "#FFF4E0"}, {name: "紫", className: "violet", color: "#F9E5FF"} ] }; }, created: function () { if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods: { verify : function () { var res = { code : true, message : "" }; return res; } }, }); // 切换方式 var changeType = '
'; changeType += ''; changeType += '
'; changeType += ''; changeType += '
'; /* changeType += ''; changeType += '
'; changeType += ''; changeType += ''; changeType += '
'; */ changeType += '
'; Vue.component("change-type", { template: changeType, data: function () { return { data: this.$parent.data, changeTypeList: [ {name: "平移滑动", value: 1, src: specialResourcePath + "/special/img/manual.png", selectedSrc: specialResourcePath + "/special/img/manual_1.png"}, {name: "切屏滑动", value: 2, src: specialResourcePath + "/special/img/manual.png", selectedSrc: specialResourcePath + "/special/img/manual_1.png"}, ] }; }, created: function () { if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods: { verify : function () { var res = { code : true, message : "" }; return res; } }, });