// 顶部内容组件 var pintuanTopConHtml = '
'; pintuanTopConHtml += ''; pintuanTopConHtml += ''; pintuanTopConHtml += ''; pintuanTopConHtml += ''; /* pintuanTopConHtml += '
'; pintuanTopConHtml += '{{listMore.title}}'; pintuanTopConHtml += '
'; pintuanTopConHtml += ''; pintuanTopConHtml += '
'; */ pintuanTopConHtml +='
'; Vue.component("pintuan-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: pintuanTopConHtml }); /** * 空的验证组件,后续如果增加业务,则更改组件 */ var pintuanListHtml = '
'; pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
    '; pintuanListHtml += '
  • '; pintuanListHtml += '' pintuanListHtml += '' pintuanListHtml += '
  • '; pintuanListHtml += '
'; /* pintuanListHtml += ''; */ pintuanListHtml += '
'; pintuanListHtml += '
'; pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
'; pintuanListHtml += '选择'; pintuanListHtml += '
'; pintuanListHtml += '
'; /* pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
'; pintuanListHtml += '
'; pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
'; pintuanListHtml += ''; pintuanListHtml += '
'; pintuanListHtml += '
'; */ pintuanListHtml += ''; // pintuanListHtml += '

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

'; pintuanListHtml += '
'; var select_goods_list = []; //配合商品选择器使用 Vue.component("pintuan-list", { template: pintuanListHtml, data: function () { return { data: this.$parent.data, goodsSources: [ { text: "默认", value: "default", src: pintuanResourcePath + "/pintuan/img/goods.png", selectedSrc: pintuanResourcePath + "/pintuan/img/goods_1.png" }, { text : "手动选择", value : "diy", src: pintuanResourcePath + "/pintuan/img/manual.png", selectedSrc: pintuanResourcePath + "/pintuan/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: "pintuan", disabled: 0, post: post}); } } }); var pintuanStyleHtml = '
'; pintuanStyleHtml += ''; pintuanStyleHtml += '
'; // pintuanStyleHtml += '{{data.styleName}}'; pintuanStyleHtml += '
{{data.styleName}}
'; pintuanStyleHtml += '
选择
'; pintuanStyleHtml += '
'; pintuanStyleHtml += '
'; Vue.component("pintuan-style", { template: pintuanStyleHtml, 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 pintuanTopHtml = ''; Vue.component("pintuan-top-list",{ template : pintuanTopHtml, 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; $(".draggable-element[data-index='" + this.data.index + "'] .graphic-navigation .graphic-nav-list>ul>li").each(function(index){ if(_self.selectedTemplate == "imageNavigation"){ $(this).find("input[name='title']").removeAttr("style");//清空输入框的样式 //检测是否有未上传的图片 if(_self.list[index].imageUrl == ""){ res.code = false; res.message = "请选择一张图片"; $(this).find(".error-msg").text("请选择一张图片").show(); return res; }else{ $(this).find(".error-msg").text("").hide(); } }else{ if(_self.list[index].title == ""){ res.code = false; res.message = "请输入标题"; $(this).find("input[name='title']").attr("style","border-color:red !important;").focus(); $(this).find(".error-msg").text("请输入标题").show(); return res; }else{ $(this).find("input[name='title']").removeAttr("style"); $(this).find(".error-msg").text("").hide(); } } }); return res; } } }); // 背景颜色可选 var pintuanColorHtml = '
'; pintuanColorHtml += ''; pintuanColorHtml += '
'; pintuanColorHtml += ''; pintuanColorHtml += '
'; pintuanColorHtml += '
'; Vue.component("pintuan-color", { template: pintuanColorHtml, 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: pintuanResourcePath + "/pintuan/img/manual.png", selectedSrc: pintuanResourcePath + "/pintuan/img/manual_1.png"}, {name: "切屏滑动", value: 2, src: pintuanResourcePath + "/pintuan/img/manual.png", selectedSrc: pintuanResourcePath + "/pintuan/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; } }, });