初始上传
This commit is contained in:
73
app/component/view/goods_recommend/css/design.css
Executable file
73
app/component/view/goods_recommend/css/design.css
Executable file
@@ -0,0 +1,73 @@
|
||||
.edit-attribute .tag-wrap .layui-form-radio:last-child{margin-right: 0;}
|
||||
|
||||
/* 选择商品分类弹出框 */
|
||||
.goods-category-layer {display: none;}
|
||||
.layui-layer-content .category-wrap .category-item, .layui-layer-content .category-head {height: 30px;line-height: 30px;border: 1px solid #ededed;border-radius: 5px;padding: 0 15px;margin: 0 15px 10px 0;box-sizing: border-box;color: #666;font-size: 12px;}
|
||||
.layui-layer-content .category-head {background: #eee;height: 40px;line-height: 40px;}
|
||||
.layui-layer-content .category-wrap {overflow-y: scroll;height: calc(100% - 45px);}
|
||||
.layui-layer-content .category-wrap::-webkit-scrollbar {display: none;}
|
||||
.layui-layer-content .category-wrap .category-item {cursor: pointer;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
|
||||
|
||||
/* 选择风格 */
|
||||
.style-list-box-goods-recommend {display: none;}
|
||||
.style-list-con-goods-recommend {display: flex;flex-wrap: wrap;}
|
||||
.style-list-con-goods-recommend .style-li-goods-recommend {overflow: hidden;display: flex;align-items: center;justify-content: center;width: 280px;height: 210px;margin-right: 12px;margin-top: 15px;cursor: pointer;border: 1px solid #ededed;background: #f7f8fa;}
|
||||
.style-list-con-goods-recommend .style-li-goods-recommend img{width: 100%;}
|
||||
.style-list-con-goods-recommend .style-li-goods-recommend:nth-child(1), .style-list-con-goods-recommend .style-li-goods-recommend:nth-child(2), .style-list-con-goods-recommend .style-li-goods-recommend:nth-child(3){margin-top: 0;}
|
||||
.style-list-con-goods-recommend .style-li-goods-recommend:nth-child(3n) {margin-right: 0;}
|
||||
|
||||
.goods-recommend .top-wrap{display: flex;align-items: center;padding: 10px 0;}
|
||||
.goods-recommend .top-wrap i{border-radius: 50%;font-size: 25px;margin-right: 5px;width: 35px;height: 35px;text-align: center;line-height: 35px;margin-left: 10px;}
|
||||
.goods-recommend .top-wrap .line{height: 14px;margin: 0 5px;border: 1px solid;}
|
||||
.goods-recommend .top-wrap h3{font-weight: bold;}
|
||||
.goods-recommend .top-wrap .sub{font-size: 12px;}
|
||||
|
||||
/* 商品块基础样式 */
|
||||
.goods-recommend .goods-list .goods-item {line-height: 1;}
|
||||
.goods-recommend .goods-list .goods-item .sale {font-size: 12px;}
|
||||
.goods-recommend .goods-list .goods-item .info-wrap .goods-name{margin-bottom: 5px;font-size: 14px;line-height: 1.3;}
|
||||
|
||||
/* ---------- 三列(一行三个)---------- */
|
||||
.goods-recommend .style-1 .goods-list{display: flex;flex-wrap: wrap;margin: 0 10px;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item{display: flex;flex-direction: column;background: #fff;overflow: hidden;margin-top: 10px;width: 100px;box-sizing: border-box;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item:nth-of-type(1), .goods-recommend .style-1 .goods-list .goods-item:nth-of-type(2), .goods-recommend .style-1 .goods-list .goods-item:nth-of-type(3){margin-top: 0;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .goods-img{width: calc(100% + 2px);height: 110px;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .goods-img img{width: 100%;height: 100%;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .info-wrap{display: flex;flex-direction: column;flex: 1;margin: 5px;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .info-wrap .pro-info{margin-top: auto;display: flex;justify-content: space-between;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .info-wrap .pro-info .discount-price{display: flex;justify-content: space-between;align-items: center;flex: 1;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .info-wrap .pro-info .discount-price .price-wrap{font-size: 0;font-weight: bold;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .info-wrap .pro-info .discount-price .price-wrap .unit{font-size: 12px;}
|
||||
.goods-recommend .style-1 .goods-list .goods-item .info-wrap .pro-info .discount-price .price-wrap .price{font-size: 16px;}
|
||||
|
||||
.goods-recommend .style-2{background-repeat: round;padding-bottom: 10px;}
|
||||
.goods-recommend .style-2 .goods-list{display: flex;margin: 0 5px;background: #fff;border-radius: 10px;padding: 10px;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item{display: flex;flex-direction: column;background: #fff;overflow: hidden;margin-top: 10px;width: 100px;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item.stroke{width: 100px;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item:nth-of-type(1), .goods-recommend .style-2 .goods-list .goods-item:nth-of-type(2), .goods-recommend .style-2 .goods-list .goods-item:nth-of-type(3){margin-top: 0;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .goods-img{width: calc(100% + 2px);height: 110px;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .goods-img img{width: 100%;height: 100%;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .info-wrap{display: flex;flex-direction: column;flex: 1;margin: 5px;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .info-wrap .pro-info{margin-top: auto;display: flex;justify-content: space-between;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .info-wrap .pro-info .discount-price{display: flex;justify-content: space-between;align-items: center;flex: 1;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .info-wrap .pro-info .discount-price .price-wrap{font-size: 0;font-weight: bold;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .info-wrap .pro-info .discount-price .price-wrap .unit{font-size: 12px;}
|
||||
.goods-recommend .style-2 .goods-list .goods-item .info-wrap .pro-info .discount-price .price-wrap .price{font-size: 16px;}
|
||||
|
||||
.goods-recommend .style-3 {background-position: bottom;}
|
||||
.goods-recommend .style-3 .goods-list{display: flex;flex-wrap: wrap;margin: 0 10px;}
|
||||
.goods-recommend .style-3 .goods-list .goods-item{display: flex;flex-direction: column;overflow: hidden;margin-top: 10px;width: 100px;box-sizing: border-box;}
|
||||
.goods-recommend .style-3 .goods-list .goods-item .goods-img{width: calc(100% + 2px);height: 110px;}
|
||||
.goods-recommend .style-3 .goods-list .goods-item .goods-img img{width: 100%;height: 100%;}
|
||||
.goods-recommend .style-3 .goods-list .goods-item .info-wrap{display: flex;flex-direction: column;flex: 1;margin: 5px;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info{text-align: center;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .label-wrap{border-radius: 20px;padding: 4px;display: inline-block;margin: 5px 0;position: relative;padding-left: 26px;padding-right:8px;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .label-wrap img{position: absolute;top: -1px;left: -1px;width: 23px;height: 23px;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .label-wrap span{font-size: 12px;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .discount-price{}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .discount-price .price-wrap{font-size: 0;font-weight: bold;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .discount-price .price-wrap .unit{font-size: 12px;}
|
||||
.goods-recommend .style-3 .goods-item .info-wrap .pro-info .discount-price .price-wrap .price{font-size: 16px;}
|
||||
|
||||
.goods-recommend .edit-content-wrap .layui-form-radio{margin-right:5px;}
|
||||
.goods-recommend .edit-content-wrap .layui-form-radio:last-child{margin-right: 0;padding-right: 0;}
|
||||
410
app/component/view/goods_recommend/design.html
Executable file
410
app/component/view/goods_recommend/design.html
Executable file
@@ -0,0 +1,410 @@
|
||||
<nc-component :data="data[index]" class="goods-recommend">
|
||||
|
||||
<!-- 预览 -->
|
||||
<template slot="preview">
|
||||
|
||||
<div :class="[nc.style]" :style="{ backgroundColor: nc.componentBgColor,backgroundImage: 'url('+ changeImgUrl(nc.bgUrl)+ ')',borderTopLeftRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
|
||||
borderTopRightRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
|
||||
borderBottomLeftRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
|
||||
borderBottomRightRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0) }">
|
||||
|
||||
<div class="top-wrap" v-if="nc.topStyle.support">
|
||||
<i :class="[nc.topStyle.icon.value]" :style="{ backgroundColor : nc.topStyle.icon.bgColor, color : nc.topStyle.icon.color }"></i>
|
||||
<h3 :style="{ color : nc.topStyle.color }">{{ nc.topStyle.title }}</h3>
|
||||
<span class="line" :style="{ color : nc.topStyle.subColor }"></span>
|
||||
<span class="sub" :style="{ color : nc.topStyle.subColor }">{{ nc.topStyle.subTitle }}</span>
|
||||
</div>
|
||||
|
||||
<div class="goods-list">
|
||||
<template v-if="nc.tempData.previewList && Object.keys(nc.tempData.previewList).length">
|
||||
<div :class="['goods-item',nc.ornament.type]" v-for="(item, previewIndex) in nc.tempData.previewList" :key="previewIndex"
|
||||
:style="{
|
||||
backgroundColor: nc.elementBgColor,
|
||||
borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
|
||||
borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
|
||||
borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
|
||||
borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
|
||||
boxShadow: nc.ornament.type == 'shadow' ? ('0 0 5px ' + nc.ornament.color) : '',
|
||||
marginLeft: (51 - nc.margin.both * 2) /6 + 'px',
|
||||
marginRight: (51 - nc.margin.both * 2) /6 + 'px',
|
||||
border: nc.ornament.type == 'stroke' ? '1px solid ' + nc.ornament.color : ''}">
|
||||
|
||||
<div class="goods-img" :style="{ borderRadius: nc.imgAroundRadius + 'px' }">
|
||||
<img :src="item.goods_image ? changeImgUrl(item.goods_image) : changeImgUrl('public/static/img/default_img/square.png')" :style="{ borderRadius: nc.imgAroundRadius + 'px' }" onerror="this.src = ns.img('public/static/img/default_img/square.png');" />
|
||||
</div>
|
||||
|
||||
<div class="info-wrap" v-if="nc.goodsNameStyle.control || nc.priceStyle.mainControl || nc.priceStyle.lineControl || nc.labelStyle.support">
|
||||
<div class="goods-name" v-if="nc.goodsNameStyle.control" :style="{ color : nc.goodsNameStyle.color,fontWeight : nc.goodsNameStyle.fontWeight ? 'bold' : '' }" :class="[{'using-hidden' : nc.nameLineMode == 'single'},{'multi-hidden' : nc.nameLineMode == 'multiple'}]">{{ item.goods_name }}</div>
|
||||
<div class="pro-info">
|
||||
<div class="label-wrap" v-if="nc.labelStyle.support" :style="{ background : nc.labelStyle.bgColor,color : nc.labelStyle.color}">
|
||||
<img src="{$resource_path}/img/label.png" />
|
||||
<span>{{nc.labelStyle.title}}</span>
|
||||
</div>
|
||||
<div class="discount-price">
|
||||
<div class="price-wrap" v-if="nc.priceStyle.mainControl">
|
||||
<span class="unit" :style="{ color : nc.priceStyle.mainColor }">¥</span>
|
||||
<span class="price" :style="{ color : nc.priceStyle.mainColor }">{{item.discount_price.split(".")[0]}}</span>
|
||||
<span class="price" :style="{ color : nc.priceStyle.mainColor }" v-if="item.discount_price.split('.')[1]">{{"."+item.discount_price.split(".")[1]}}</span>
|
||||
</div>
|
||||
<div class="delete-price" v-if="nc.priceStyle.lineControl" :style="{ color : nc.priceStyle.lineColor }">¥{{item.line_price}}</div>
|
||||
<div class="sale" v-if="nc.saleStyle.control" :style="{ color : nc.saleStyle.color }">售{{ item.sale_num }}件</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<!-- 内容编辑 -->
|
||||
<template slot="edit-content">
|
||||
<template v-if="nc.lazyLoad">
|
||||
<goods-recommend-sources></goods-recommend-sources>
|
||||
|
||||
<div class="template-edit-title">
|
||||
<h3>推荐风格</h3>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">风格</label>
|
||||
<div class="layui-input-block" v-if="nc.tempData.methods">
|
||||
<div v-if="nc.styleName" class="text-color selected-style" @click="nc.tempData.methods.selectStyle()">
|
||||
<span>{{nc.styleName}}</span>
|
||||
<i class="layui-icon layui-icon-right"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="template-edit-title" v-if="nc.topStyle.support">
|
||||
<h3>推荐标题</h3>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="nc.topStyle.title" maxlength="10" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">副标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="nc.topStyle.subTitle" maxlength="10" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="template-edit-title">
|
||||
<h3>推荐商品</h3>
|
||||
<div class="layui-form-item" v-if="nc.tempData.goodsSources">
|
||||
<label class="layui-form-label sm">数据来源</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="source-selected">
|
||||
<div class="source">{{ nc.tempData.goodsSources[nc.sources].text }}</div>
|
||||
<div v-for="(item,sourcesKey) in nc.tempData.goodsSources" :key="sourcesKey" class="source-item" :title="item.text" @click="nc.sources=sourcesKey" :class="{ 'text-color border-color' : (nc.sources == sourcesKey) }">
|
||||
<i class='iconfont' :class='item.icon'></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="nc.sources == 'category'">
|
||||
<label class="layui-form-label sm">商品分类</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="selected-style" @click="nc.tempData.methods.selectCategory()">
|
||||
<span :class="{ 'text-color' : nc.categoryId > 0 }">{{ nc.categoryName }}</span>
|
||||
<i class="iconfont iconyoujiantou"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="nc.sources == 'diy'">
|
||||
<label class="layui-form-label sm">手动选择</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="selected-style" @click="nc.tempData.methods.addGoods()">
|
||||
<span v-if="nc.goodsId.length == 0">请选择</span>
|
||||
<span v-if="nc.goodsId.length > 0" class="text-color">已选{{ nc.goodsId.length }}个</span>
|
||||
<i class="iconfont iconyoujiantou"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<slide :data="{ field : 'count', label: '商品数量', min:1, max: 30}" v-if="nc.sources != 'diy'"></slide>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<div v-for="(item,sortIndex) in nc.tempData.sortWayList" :key="sortIndex" @click="nc.sortWay=item.value" :class="{ 'layui-unselect layui-form-radio' : true,'layui-form-radioed' : (nc.sortWay==item.value) }">
|
||||
<i class="layui-anim layui-icon">{{ nc.sortWay == item.value ? "" : "" }}</i>
|
||||
<div>{{item.text}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="template-edit-title" v-if="nc.labelStyle.support">
|
||||
<h3>标签内容</h3>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">标签</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" v-model="nc.labelStyle.title" maxlength="4" placeholder="请输入标签" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="template-edit-title">
|
||||
<h3>显示内容</h3>
|
||||
<div class="layui-form-item" v-show="nc.goodsNameStyle.support">
|
||||
<label class="layui-form-label sm">商品名称</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" @click="nc.goodsNameStyle.control = !nc.goodsNameStyle.control" :class="{ 'layui-form-checked' : nc.goodsNameStyle.control }">
|
||||
<span>{{ nc.goodsNameStyle.control ? '显示' : '隐藏' }}</span>
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">销售价</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" @click="nc.priceStyle.mainControl = !nc.priceStyle.mainControl" :class="{ 'layui-form-checked' : nc.priceStyle.mainControl }">
|
||||
<span>{{ nc.priceStyle.mainControl ? '显示' : '隐藏' }}</span>
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-show="nc.priceStyle.lineSupport">
|
||||
<label class="layui-form-label sm">划线价</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" @click="nc.priceStyle.lineControl = !nc.priceStyle.lineControl" :class="{ 'layui-form-checked' : nc.priceStyle.lineControl }">
|
||||
<span>{{ nc.priceStyle.lineControl ? '显示' : '隐藏' }}</span>
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-show="nc.saleStyle.support">
|
||||
<label class="layui-form-label sm">商品销量</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" @click="nc.saleStyle.control = !nc.saleStyle.control" :class="{ 'layui-form-checked' : nc.saleStyle.control }">
|
||||
<span>{{ nc.saleStyle.control ? '显示' : '隐藏' }}</span>
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<!-- 弹框 -->
|
||||
<article class="style-list-box-goods-recommend">
|
||||
<div class="style-list-goods-recommend layui-form">
|
||||
<div class="style-list-con-goods-recommend">
|
||||
<div class="style-li-goods-recommend" v-for="(value,name,index) in nc.tempData.styleList" :key="name" :class="{'selected border-color': nc.style == name}" :data_key="name">
|
||||
<span class="layui-hide">风格{{index + 1}}</span>
|
||||
<img :src="'{$resource_path}/img/style' + (index+1) + '.png'" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="style">
|
||||
<input type="hidden" name="style_name" />
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<!-- 商品分类选择弹框 -->
|
||||
<script type="text/html" class="goods-category-layer">
|
||||
<div class="goods-category-list layui-form">
|
||||
<table class="layui-table pithy-table">
|
||||
<colgroup>
|
||||
<col width="5%">
|
||||
<col width="3%">
|
||||
<col width="37%">
|
||||
<col width="25%">
|
||||
<col width="30%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>分类名称</th>
|
||||
<th>简称</th>
|
||||
<th>图片</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if condition="$category_list"}
|
||||
{foreach name="$category_list" item="vo"}
|
||||
<tr class='category-line'>
|
||||
<td><input type="checkbox" name="category_select_id" data-category_select_id = "{$vo['category_id']}"lay-skin="primary" value='{:json_encode($vo)}' lay-filter="category_select_id"{if !empty($link_array.category_id) && $link_array.category_id == $vo['category_id']}checked{/if}></td>
|
||||
<td>
|
||||
{notempty name="$vo['child_list']"}
|
||||
<span class="switch text-color js-switch" data-category-id="{$vo['category_id']}" data-level="{$vo['level']}" data-open="0">+</span>
|
||||
{/notempty}
|
||||
</td>
|
||||
<td class="category-name">{$vo['category_name']}</td>
|
||||
<td>{$vo['short_name']}</td>
|
||||
<td>
|
||||
{notempty name="$vo['image']"}
|
||||
<div class="img-box">
|
||||
<img layer-src src="{:img($vo['image'])}"/>
|
||||
</div>
|
||||
{/notempty}
|
||||
</td>
|
||||
</tr>
|
||||
{notempty name="$vo['child_list']"}
|
||||
{foreach name="$vo['child_list']" item="second"}
|
||||
<tr class='category-line' data-category-id-1="{$second['category_id_1']}" style="display:none;">
|
||||
<td><input type="checkbox" name="category_select_id" lay-skin="primary"data-category_select_id = "{$second['category_id']}" value='{:json_encode($second)}' lay-filter="category_select_id"{if !empty($link_array.category_id) && $link_array.category_id == $second['category_id']}checked{/if}></td>
|
||||
<td></td>
|
||||
<td style="padding-left: 20px;">
|
||||
<span class="switch text-color js-switch" data-category-id="{$second['category_id']}" data-level="{$second['level']}" data-open="1" style="padding-right: 20px;">-</span>
|
||||
<span class="category-name">{$second['category_name']}</span>
|
||||
</td>
|
||||
<td>{$second['short_name']}</td>
|
||||
<td>
|
||||
{notempty name="$second['image']"}
|
||||
<img layer-src src="{:img($second['image'])}"/>
|
||||
{/notempty}
|
||||
</td>
|
||||
</tr>
|
||||
{notempty name="$second['child_list']"}
|
||||
{foreach name="$second['child_list']" item="third"}
|
||||
<tr class='category-line' data-category-id-1="{$third['category_id_1']}" data-category-id-2="{$third['category_id_2']}" style="display:none;">
|
||||
<td><input type="checkbox" name="category_select_id" lay-skin="primary" value='{:json_encode($third)}' data-category_select_id = '{$third['category_id']}'lay-filter="category_select_id"{if !empty($link_array.category_id) && $link_array.category_id == $third['category_id']}checked{/if}></td>
|
||||
<td></td>
|
||||
<td style="padding-left: 80px;">
|
||||
<span class="category-name">{$third['category_name']}</span>
|
||||
</td>
|
||||
<td>{$third['short_name']}</td>
|
||||
<td>
|
||||
{notempty name="$third['image']"}
|
||||
<img layer-src src="{:img($third['image'])}"/>
|
||||
{/notempty}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/notempty}
|
||||
{/foreach}
|
||||
{/notempty}
|
||||
{/foreach}
|
||||
{else/}
|
||||
<tr>
|
||||
<td colspan="9" style="text-align: center">无数据</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
</template>
|
||||
|
||||
<!-- 样式编辑 -->
|
||||
<template slot="edit-style">
|
||||
<template v-if="nc.lazyLoad">
|
||||
|
||||
<div class="template-edit-title">
|
||||
<h3>头部样式</h3>
|
||||
|
||||
<div v-if="nc.topStyle.support">
|
||||
<nc-icon :data="{ field : 'value',label:'选择图标', parent : nc.topStyle.icon, color: 'color'}"></nc-icon>
|
||||
|
||||
<color :data="{ field : 'color', 'label' : '图标颜色', parent : nc.topStyle.icon, 'defaultColor': '#303133' }"></color>
|
||||
|
||||
<color :data="{ field : 'bgColor', 'label' : '图标背景', parent : nc.topStyle.icon }"></color>
|
||||
<color :data="{ field : 'color', 'label' : '标题颜色', parent : nc.topStyle, defaultColor : '#303133' }"></color>
|
||||
<color :data="{ field : 'subColor', 'label': '副标题颜色', parent : nc.topStyle, defaultColor : '#999CA7' }"></color>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">背景图片</label>
|
||||
<div class="layui-input-block img-upload">
|
||||
<img-upload :data="{ data : nc, field : 'bgUrl', isShow:true }"></img-upload>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="template-edit-title">
|
||||
<h3>商品样式</h3>
|
||||
<div class="layui-form-item tag-wrap">
|
||||
<label class="layui-form-label sm">边框</label>
|
||||
<div class="layui-input-block">
|
||||
<div v-for="(item,ornamentIndex) in nc.tempData.ornamentList" :key="ornamentIndex" @click="nc.ornament.type=item.type" :class="{ 'layui-unselect layui-form-radio' : true,'layui-form-radioed' : (nc.ornament.type==item.type) }">
|
||||
<i class="layui-anim layui-icon">{{ nc.ornament.type == item.type ? "" : "" }}</i>
|
||||
<div>{{item.text}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<color v-if="nc.ornament.type != 'default'" :data="{ field : 'color', 'label' : '边框颜色', parent : 'ornament', defaultColor : '#EDEDED' }"></color>
|
||||
|
||||
<slide :data="{ field : 'imgAroundRadius', label: '图片圆角', min:0, max: 50 }"></slide>
|
||||
|
||||
<div class="layui-form-item" v-show="nc.goodsNameStyle.control">
|
||||
<label class="layui-form-label sm">商品名称</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" @click="nc.goodsNameStyle.fontWeight = !nc.goodsNameStyle.fontWeight" :class="{ 'layui-form-checked' : nc.goodsNameStyle.fontWeight }">
|
||||
<span>加粗</span>
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
</div>
|
||||
<div v-for="(item,nameLineIndex) in nc.tempData.nameLineModeList" :key="nameLineIndex" @click="nc.nameLineMode=item.value" :class="{ 'layui-unselect layui-form-radio' : true,'layui-form-radioed' : (nc.nameLineMode==item.value) }">
|
||||
<i class="layui-anim layui-icon">{{ nc.nameLineMode == item.value ? "" : "" }}</i>
|
||||
<div>{{item.text}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<color :data="{ field : 'elementBgColor', 'label' : '商品背景' }"></color>
|
||||
|
||||
<slide v-show="nc.elementAngle == 'round'" :data="{ field : 'topElementAroundRadius', label : '上圆角', max : 50 }"></slide>
|
||||
<slide v-show="nc.elementAngle == 'round'" :data="{ field : 'bottomElementAroundRadius', label : '下圆角', max : 50 }"></slide>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">色调</label>
|
||||
<div class="layui-input-block">
|
||||
<div @click="nc.theme='default'" :class="{ 'layui-unselect layui-form-radio' : true,'layui-form-radioed' : (nc.theme == 'default') }">
|
||||
<i class="layui-anim layui-icon">{{ nc.theme == 'default' ? "" : "" }}</i>
|
||||
<div>跟随主题风格</div>
|
||||
</div>
|
||||
<div @click="nc.theme='diy'" :class="{ 'layui-unselect layui-form-radio' : true,'layui-form-radioed' : (nc.theme == 'diy') }">
|
||||
<i class="layui-anim layui-icon">{{ nc.theme == 'diy' ? "" : "" }}</i>
|
||||
<div>自定义</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="nc.theme == 'diy'">
|
||||
<div v-show="nc.goodsNameStyle.support">
|
||||
<color :data="{ field : 'color', 'label' : '商品名称', parent : 'goodsNameStyle', defaultColor : '#303133' }"></color>
|
||||
</div>
|
||||
<color :data="{ field : 'mainColor', 'label' : '销售价', parent : 'priceStyle', defaultColor : '#FF6A00' }"></color>
|
||||
<div v-show="nc.priceStyle.lineSupport">
|
||||
<color :data="{ field : 'lineColor', 'label' : '划线价', parent : 'priceStyle', defaultColor : '#999CA7' }"></color>
|
||||
</div>
|
||||
<div v-show="nc.saleStyle.support">
|
||||
<color :data="{ field : 'color', 'label' : '商品销量', parent : 'saleStyle', defaultColor : '#999CA7' }"></color>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- 资源 -->
|
||||
<template slot="resource">
|
||||
<js>
|
||||
var goodsRecommendResourcePath = "{$resource_path}"; // http路径
|
||||
var goodsRecommendRelativePath = "{$relative_path}"; // 相对路径
|
||||
</js>
|
||||
<css src="{$resource_path}/css/design.css"></css>
|
||||
<js src="{$resource_path}/js/design.js"></js>
|
||||
</template>
|
||||
|
||||
</nc-component>
|
||||
BIN
app/component/view/goods_recommend/img/bg.png
Executable file
BIN
app/component/view/goods_recommend/img/bg.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
BIN
app/component/view/goods_recommend/img/label.png
Executable file
BIN
app/component/view/goods_recommend/img/label.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 763 B |
BIN
app/component/view/goods_recommend/img/style1.png
Executable file
BIN
app/component/view/goods_recommend/img/style1.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
BIN
app/component/view/goods_recommend/img/style2.png
Executable file
BIN
app/component/view/goods_recommend/img/style2.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
BIN
app/component/view/goods_recommend/img/style3.png
Executable file
BIN
app/component/view/goods_recommend/img/style3.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
BIN
app/component/view/goods_recommend/img/style3_bg.png
Executable file
BIN
app/component/view/goods_recommend/img/style3_bg.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
281
app/component/view/goods_recommend/js/design.js
Executable file
281
app/component/view/goods_recommend/js/design.js
Executable file
@@ -0,0 +1,281 @@
|
||||
var goodsListHtml = '<div style="display:none;"></div>';
|
||||
|
||||
Vue.component("goods-recommend-sources", {
|
||||
template: goodsListHtml,
|
||||
data: function () {
|
||||
return {
|
||||
data: this.$parent.data,
|
||||
goodsSources: {
|
||||
initial: {
|
||||
text: "默认",
|
||||
icon: "iconmofang"
|
||||
},
|
||||
category: {
|
||||
text: "商品分类",
|
||||
icon: "iconshangpinfenlei"
|
||||
},
|
||||
diy: {
|
||||
text: "手动选择",
|
||||
icon: "iconshoudongxuanze"
|
||||
},
|
||||
},
|
||||
sortWayList: [
|
||||
{
|
||||
text: "综合",
|
||||
value: "default"
|
||||
},
|
||||
{
|
||||
text: "新品",
|
||||
value: "news"
|
||||
},
|
||||
{
|
||||
text: "热销",
|
||||
value: "sales"
|
||||
},
|
||||
{
|
||||
text: "价格",
|
||||
value: "price"
|
||||
}
|
||||
],
|
||||
styleList: {
|
||||
"style-1": {
|
||||
goodsNameSupport: true, // 是否支持商品名称
|
||||
saleSupport: true, // 是否支持商品销量
|
||||
lineSupport: false, // 是否支持划线价
|
||||
bgUrl: '',
|
||||
componentBgColor: '',
|
||||
elementBgColor: '#FFFFFF',
|
||||
topStyle: {
|
||||
support: true,
|
||||
icon: {
|
||||
value: "icondiy icon-system-tuijian",
|
||||
color: "#FF3D3D",
|
||||
bgColor: "",
|
||||
},
|
||||
color: "#303133",
|
||||
subColor: "#999CA7"
|
||||
},
|
||||
},
|
||||
"style-2": {
|
||||
goodsNameSupport: true, // 是否支持商品名称
|
||||
saleSupport: true, // 是否支持商品销量
|
||||
lineSupport: false, // 是否支持划线价
|
||||
bgUrl: goodsRecommendRelativePath + '/img/bg.png',
|
||||
componentBgColor: '#1278FE',
|
||||
elementBgColor: '#FFFFFF',
|
||||
topStyle: {
|
||||
support: true,
|
||||
icon: {
|
||||
value: "icondiy icon-system-tuijian",
|
||||
color: "#1278FE",
|
||||
bgColor: "#FFFFFF",
|
||||
},
|
||||
color: "#FFFFFF",
|
||||
subColor: "#FFFFFF"
|
||||
},
|
||||
},
|
||||
"style-3": {
|
||||
goodsNameSupport: false, // 是否支持商品名称
|
||||
saleSupport: false, // 是否支持商品销量
|
||||
lineSupport: false, // 是否支持划线价
|
||||
bgUrl: goodsRecommendRelativePath + '/img/style3_bg.png',
|
||||
componentBgColor: '',
|
||||
elementBgColor: '',
|
||||
labelStyle: {
|
||||
support: true,
|
||||
bgColor: "#FF504D",
|
||||
title: "新人专享"
|
||||
}
|
||||
},
|
||||
},
|
||||
ornamentList: [
|
||||
{
|
||||
type: 'default',
|
||||
text: '默认',
|
||||
},
|
||||
{
|
||||
type: 'shadow',
|
||||
text: '投影',
|
||||
},
|
||||
{
|
||||
type: 'stroke',
|
||||
text: '描边',
|
||||
},
|
||||
],
|
||||
nameLineModeList: [
|
||||
{
|
||||
text: "单行",
|
||||
value: "single"
|
||||
},
|
||||
{
|
||||
text: "多行",
|
||||
value: "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
if (!this.$parent.data.verify) this.$parent.data.verify = [];
|
||||
this.$parent.data.verify.push(this.verify);//加载验证方法
|
||||
|
||||
this.$parent.data.ignore = ['textColor']; //加载忽略内容 -- 其他设置中的属性设置
|
||||
this.$parent.data.ignoreLoad = true; // 等待忽略数组赋值后加载
|
||||
|
||||
var previewList = {};
|
||||
for (var i = 1; i < 4; i++) {
|
||||
previewList["goods_id_" + ns.gen_non_duplicate(i)] = {
|
||||
goods_name: "商品名称",
|
||||
discount_price: (Math.random() * 10 * i + 10).toFixed(0), // 随机价格
|
||||
line_price: (Math.random() * 10 * i + 10 + 10).toFixed(0), // 随机价格
|
||||
sale_num: Math.floor((Math.random() * 10 * i + 10 + 10))
|
||||
};
|
||||
}
|
||||
|
||||
// 组件所需的临时数据
|
||||
this.$parent.data.tempData = {
|
||||
goodsSources: this.goodsSources,
|
||||
sortWayList: this.sortWayList,
|
||||
styleList: this.styleList,
|
||||
ornamentList: this.ornamentList,
|
||||
nameLineModeList: this.nameLineModeList,
|
||||
previewList: previewList,
|
||||
methods: {
|
||||
addGoods: this.addGoods,
|
||||
selectCategory: this.selectCategory,
|
||||
selectTemplate: this.selectTemplate,
|
||||
selectStyle: this.selectStyle
|
||||
},
|
||||
};
|
||||
|
||||
},
|
||||
methods: {
|
||||
verify: function (index) {
|
||||
var res = {code: true, message: ""};
|
||||
if (vue.data[index].sources === 'category' && vue.data[index].categoryId === 0) {
|
||||
res.code = false;
|
||||
res.message = "请选择商品分类";
|
||||
}
|
||||
return res;
|
||||
},
|
||||
addGoods: function () {
|
||||
var self = this;
|
||||
goodsSelect(function (res) {
|
||||
self.$parent.data.goodsId = res;
|
||||
}, self.$parent.data.goodsId, {mode: "spu", disabled: 0, promotion: "module", post: ns.appModule});
|
||||
},
|
||||
selectCategory() {
|
||||
var self = this;
|
||||
layui.use(['form'], function () {
|
||||
var form = layui.form;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '选择分类',
|
||||
area: ['630px', '430px'],
|
||||
btn: ['确定', '返回'],
|
||||
content: $(".draggable-element[data-index='" + self.data.index + "'] .edit-attribute .goods-category-layer").html(),
|
||||
success: function (layero, index) {
|
||||
$(".js-switch").click(function () {
|
||||
var category_id = $(this).attr("data-category-id");
|
||||
var level = $(this).attr("data-level");
|
||||
var open = parseInt($(this).attr("data-open").toString());
|
||||
|
||||
if (open) {
|
||||
$(".goods-category-list .layui-table tr[data-category-id-" + level + "='" + category_id + "']").hide();
|
||||
$(this).text("+");
|
||||
} else {
|
||||
$(".goods-category-list .layui-table tr[data-category-id-" + level + "='" + category_id + "']").show();
|
||||
$(this).text("-");
|
||||
}
|
||||
$(this).attr("data-open", (open ? 0 : 1));
|
||||
});
|
||||
|
||||
// 勾选分类
|
||||
form.on('checkbox(category_select_id)', function (data) {
|
||||
if (data.elem.checked) {
|
||||
$("input[name='category_select_id']:checked").prop("checked", false);
|
||||
$(data.elem).prop("checked", true);
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name='category_select_id']:checked").prop("checked", false);
|
||||
if (self.data.categoryId) {
|
||||
$('.layui-layer-content [data-category_select_id="' + self.data.categoryId + '"]').prop("checked", true);
|
||||
}
|
||||
form.render();
|
||||
},
|
||||
yes: function (index, layero) {
|
||||
var selected = $(".layui-layer-content input[name='category_select_id']:checked");
|
||||
if (selected.length === 0) {
|
||||
layer.msg('请选择商品分类');
|
||||
return;
|
||||
}
|
||||
self.data.categoryName = selected.parents('tr').find('.category-name').text();
|
||||
self.data.categoryId = selected.attr('data-category_select_id');
|
||||
layer.closeAll()
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
selectTemplate(template, item) {
|
||||
this.$parent.data.goodsNameStyle.support = this.styleList[this.$parent.data.style].goodsNameSupport;
|
||||
this.$parent.data.goodsNameStyle.control = this.styleList[this.$parent.data.style].goodsNameSupport;
|
||||
|
||||
this.$parent.data.saleStyle.support = this.styleList[this.$parent.data.style].saleSupport;
|
||||
this.$parent.data.saleStyle.control = this.styleList[this.$parent.data.style].saleSupport;
|
||||
|
||||
this.$parent.data.priceStyle.lineSupport = this.styleList[this.$parent.data.style].lineSupport;
|
||||
this.$parent.data.priceStyle.lineControl = this.styleList[this.$parent.data.style].lineSupport;
|
||||
|
||||
this.$parent.data.bgUrl = this.styleList[this.$parent.data.style].bgUrl;
|
||||
this.$parent.data.componentBgColor = this.styleList[this.$parent.data.style].componentBgColor;
|
||||
this.$parent.data.elementBgColor = this.styleList[this.$parent.data.style].elementBgColor;
|
||||
|
||||
// 顶部标题样式
|
||||
if(this.styleList[this.$parent.data.style].topStyle) {
|
||||
this.$parent.data.topStyle.support = this.styleList[this.$parent.data.style].topStyle.support;
|
||||
this.$parent.data.topStyle.color = this.styleList[this.$parent.data.style].topStyle.color;
|
||||
this.$parent.data.topStyle.subColor = this.styleList[this.$parent.data.style].topStyle.subColor;
|
||||
this.$parent.data.topStyle.icon.value = this.styleList[this.$parent.data.style].topStyle.icon.value;
|
||||
this.$parent.data.topStyle.icon.color = this.styleList[this.$parent.data.style].topStyle.icon.color;
|
||||
this.$parent.data.topStyle.icon.bgColor = this.styleList[this.$parent.data.style].topStyle.icon.bgColor;
|
||||
}else{
|
||||
this.$parent.data.topStyle.support = false;
|
||||
}
|
||||
|
||||
if(this.styleList[this.$parent.data.style].labelStyle){
|
||||
this.$parent.data.labelStyle.support = this.styleList[this.$parent.data.style].labelStyle.support;
|
||||
this.$parent.data.labelStyle.bgColor = this.styleList[this.$parent.data.style].labelStyle.bgColor;
|
||||
this.$parent.data.labelStyle.title = this.styleList[this.$parent.data.style].labelStyle.title;
|
||||
}else{
|
||||
this.$parent.data.labelStyle.support = false;
|
||||
}
|
||||
|
||||
},
|
||||
selectStyle: function () {
|
||||
var self = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '风格选择',
|
||||
area: ['920px', '400px'],
|
||||
btn: ['确定', '返回'],
|
||||
content: $(".draggable-element[data-index='" + self.data.index + "'] .edit-attribute .style-list-box-goods-recommend").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").off("click", ".layui-layer-content .style-list-con-goods-recommend .style-li-goods-recommend").on("click", ".layui-layer-content .style-list-con-goods-recommend .style-li-goods-recommend", function () {
|
||||
$(this).addClass("selected border-color").siblings().removeClass("selected border-color bg-color-after");
|
||||
$(".layui-layer-content input[name='style']").val($(this).attr("data_key"));
|
||||
$(".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();
|
||||
self.selectTemplate();
|
||||
layer.closeAll()
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user