|
@@ -42,7 +42,7 @@
|
|
|
.b-close{position: relative; display: inline-block;margin: 2px 0; padding:4px 1em 4px 4px; width: 150px;background: #f0f0f0;border: 1px solid rgba(0,0,0,.1);border-radius: 5px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;cursor: pointer;}
|
|
|
.my-close{position:absolute;right: 0.5em;top: 0.45em;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(45deg);transform: rotate(45deg);display: inline-block;}
|
|
|
.my-close:after{content: "";position: absolute;top: 0;left: 0;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(270deg);transform: rotate(270deg);}
|
|
|
-
|
|
|
+ .my-btn-submit2{width: 88px;height: 30px; background-color: #50a2ea;color: #fff;border: 1px solid #50a2ea;cursor:pointer;margin: 10px 10px 0 10px;}
|
|
|
</style>
|
|
|
<meta name="keywords" content="${path}">
|
|
|
<meta name="description" content="H-ui.admin v3.0,是一款由国人开发的轻量级扁平化网站后台模板,完全免费开源的网站后台管理系统模版,适合中小型CMS后台系统。">
|
|
@@ -116,66 +116,59 @@
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="row cl">
|
|
|
- <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin-top: 14px;"><span class="c-red">*</span>产品:</label>
|
|
|
- <div class="formControls col-9 col-sm-9 huanhang" style="margin: 10px 0px 10px 0;">
|
|
|
- <select id="productId" name="strategyProductId" class="chosen" style="width: 195px">
|
|
|
- <option value="0" <#if deliveryStrategy.strategyProductId == 0>selected</#if>>所有产品</option>
|
|
|
- <#if (productList?size > 0)>
|
|
|
- <#list productList as product>
|
|
|
- <option value="${product.productId!""}">${product.productName!""}</option>
|
|
|
- </#list>
|
|
|
- </#if>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="input-box" style="margin-top: -20px;">
|
|
|
- <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;"></label>
|
|
|
- <div class="formControls col-9 col-sm-9 huanhang" id="config2">
|
|
|
- <div class="row">
|
|
|
- <ul class="close-box" id="configui2">
|
|
|
- <#if deliveryStrategy.listStrategyProduct?? && (deliveryStrategy.listStrategyProduct?size > 0) >
|
|
|
- <#list deliveryStrategy.listStrategyProduct as list>
|
|
|
- <li class="b-close" id="productId1">
|
|
|
- <input type="hidden" value="${list.productId}" name="productId1">${list.productName}
|
|
|
- <span class="my-close" onclick="deleteli(this)"></span>
|
|
|
- </li>
|
|
|
- </#list>
|
|
|
- </#if>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
|
|
|
- </div>
|
|
|
- </div>
|
|
|
<div class="row cl">
|
|
|
- <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin-top: 14px;"><span class="c-red">*</span>产品:</label>
|
|
|
- <div class="formControls col-9 col-sm-9 huanhang" style="margin: 10px 0px 10px 0;">
|
|
|
- <select id="productColorId" name="strategyColorId" class="chosen" style="width: 195px">
|
|
|
- <option value="0" <#if deliveryStrategy.strategyColorId == 0>selected</#if>>所有颜色</option>
|
|
|
- <#if (productColorList?size > 0)>
|
|
|
- <#list productColorList as productColor>
|
|
|
- <option value="${productColor.colorId!""}">${productColor.colorName!""}</option>
|
|
|
+ <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin-top: 14px;"></label>
|
|
|
+ <div class="formControls col-3 col-sm-3 huanhang" >
|
|
|
+ <table class="table table-border table-bg table-bordered" style="margin-top: 10px;" id="all_product">
|
|
|
+ <thead>
|
|
|
+ <tr class="text-c">
|
|
|
+ <th style="text-align: center;" width="10">产品</th>
|
|
|
+ <th style="text-align: center;" width="10">颜色</th>
|
|
|
+ <th style="text-align: center;" width="10">操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="add_product">
|
|
|
+ <#if deliveryStrategy.listStrategyColor?? && (deliveryStrategy.listStrategyColor?size > 0) >
|
|
|
+ <#list deliveryStrategy.listStrategyColor as list>
|
|
|
+ <tr class="text-c">
|
|
|
+ <input type="hidden" class="productId" value="${list.productId!''}">
|
|
|
+ <input type="hidden" class="productColorId" value="${list.colorId!''}">
|
|
|
+ <td>${list.productName!''}</td>
|
|
|
+ <td>${list.colorName!''}</td>
|
|
|
+ <td><a onclick="updateProduct(this);">编辑</a> <a onclick="delEmployee(this);">删除</a></td>
|
|
|
+ </tr>
|
|
|
</#list>
|
|
|
</#if>
|
|
|
- </select>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <button type="button" class="my-btn-submit2" onclick="isShow();" style="margin-top: 20px;">添加产品</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="input-box" style="margin-top: -20px;">
|
|
|
- <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;"></label>
|
|
|
- <div class="formControls col-9 col-sm-9 huanhang" id="config3">
|
|
|
- <div class="row">
|
|
|
- <ul class="close-box" id="configui3">
|
|
|
- <#if deliveryStrategy.listStrategyColor?? && (deliveryStrategy.listStrategyColor?size > 0) >
|
|
|
- <#list deliveryStrategy.listStrategyColor as list>
|
|
|
- <li class="b-close" id="productColorId1">
|
|
|
- <input type="hidden" value="${list.colorId}" name="productColorId1">${list.colorName}
|
|
|
- <span class="my-close" onclick="deleteli(this)"></span>
|
|
|
- </li>
|
|
|
+ <div class="row cl" id="productDiv" style="display: none;">
|
|
|
+ <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin-top: 14px;"></label>
|
|
|
+ <div class="formControls col-9 col-sm-9 huanhang" style="margin: 10px 0px 10px 0;">
|
|
|
+ <div style="line-height: 30px;width: 400px;line-break: auto;background-color: #E6E6E6;padding-left: 10px;padding-bottom: 10px;">
|
|
|
+ <span style="margin-bottom: 15px;">产品:</span><br>
|
|
|
+ <select id="productId" class="chosen2" class="my-select" style="width: 195px;">
|
|
|
+ <option value="0">所有产品</option>
|
|
|
+ <#if (productList?size > 0)>
|
|
|
+ <#list productList as product>
|
|
|
+ <option value="${product.productId!""}" >${product.productName!""}</option>
|
|
|
</#list>
|
|
|
</#if>
|
|
|
- </ul>
|
|
|
+ </select><br>
|
|
|
+ 颜色:<br>
|
|
|
+ <select id="productColorId" class="chosen2" class="my-select" style="width: 195px">
|
|
|
+ <option value="0">所有颜色</option>
|
|
|
+ <#if (productColorList?size > 0)>
|
|
|
+ <#list productColorList as productColor>
|
|
|
+ <option value="${productColor.colorId!""}" >${productColor.colorName!""}</option>
|
|
|
+ </#list>
|
|
|
+ </#if>
|
|
|
+ </select><br>
|
|
|
+ <button type="button" class="my-btn-submit2" onclick="addPorduct();" style="margin-top: 20px;">确认添加</button>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row cl">
|
|
@@ -200,6 +193,7 @@
|
|
|
<label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin-top: 14px;"></label>
|
|
|
<div class="formControls col-9 col-sm-9 huanhang" style="margin: 10px 0px 10px 0;">
|
|
|
<input type="hidden" name="strategyId" value="${deliveryStrategy.strategyId!""}">
|
|
|
+ <input type="hidden" id="strategyColorArray" name="strategyColorArray" value="">
|
|
|
<button type="button" class="my-btn-submit" onclick="addDeliveryStrategy();" style="margin-top: 20px;">确认修改</button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -207,6 +201,49 @@
|
|
|
</article>
|
|
|
<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
+ function isShow() {
|
|
|
+ $("#productDiv").show();
|
|
|
+ }
|
|
|
+ function addPorduct() {
|
|
|
+ $("#trid").remove();
|
|
|
+ var productId = $("#productId").val();
|
|
|
+ var productColorId = $("#productColorId").val();
|
|
|
+ var productIdName = $("#productId").find("option:selected").text();
|
|
|
+ var productColorIdName = $("#productColorId").find("option:selected").text();
|
|
|
+ if(productId === "0"){
|
|
|
+ productColorId = 0;
|
|
|
+ productColorIdName = "所有颜色";
|
|
|
+ }
|
|
|
+ var isProduct = true;
|
|
|
+ $("#add_product").find("tr").each(function(){
|
|
|
+ var productIdc = $(this).find(".productId").val();
|
|
|
+ var productColorId = $(this).find(".productColorId").val();
|
|
|
+ if(productIdc === "0"){
|
|
|
+ /*layer.msg("已选择所有产品,请先删除!", {icon: 5, time: 2000});*/
|
|
|
+ $("#add_product").html("");
|
|
|
+ }
|
|
|
+ if(productColorId === "0" && productId == productIdc && productId != "0"){
|
|
|
+ layer.msg("已选择该产品所有颜色,请先删除!", {icon: 5, time: 2000});
|
|
|
+ isProduct = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(!isProduct){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var html = '<tr class="text-c">' +
|
|
|
+ ' <input type="hidden" class="productId" value="'+ productId +'">' +
|
|
|
+ ' <input type="hidden" class="productColorId" value="'+ productColorId +'">' +
|
|
|
+ ' <td>'+ productIdName +'</td>' +
|
|
|
+ ' <td>'+ productColorIdName +'</td>' +
|
|
|
+ ' <td><a onclick="updateProduct(this);">编辑</a> <a onclick="delEmployee(this);">删除</a></td>' +
|
|
|
+ ' </tr>';
|
|
|
+ if(productId === "0"){
|
|
|
+ $("#add_product").html(html);
|
|
|
+ }else{
|
|
|
+ $("#add_product").append(html);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
$('#storeId').change(function() {
|
|
|
var name = $("#storeId option:selected").text();
|
|
|
var id = $('#storeId').val();
|
|
@@ -227,51 +264,33 @@
|
|
|
}
|
|
|
|
|
|
});
|
|
|
- $('#productId').change(function() {
|
|
|
- var name = $("#productId option:selected").text();
|
|
|
- var id = $('#productId').val();
|
|
|
- var bl = true;
|
|
|
- if(id != "" && id != 0) {
|
|
|
- $("input[name='strategyProductId']").each(function (j, item) {
|
|
|
- var s = $(item).val();
|
|
|
- if (s === id) {
|
|
|
- bl = false;
|
|
|
- }
|
|
|
- });
|
|
|
- if (bl) {
|
|
|
- $("#configui2").append('<li class="b-close" id="productId1">' +
|
|
|
- ' <input type="hidden" value="' + id + '" name="productId1">' + name +
|
|
|
- '<span class="my-close" onclick="deleteli(this)"></span>' +
|
|
|
- '</li>');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- $('#productColorId').change(function() {
|
|
|
- var name = $("#productColorId option:selected").text();
|
|
|
- var id = $('#productColorId').val();
|
|
|
- var bl = true;
|
|
|
- if(id != "" && id != 0) {
|
|
|
- $("input[name='strategyColorId']").each(function (j, item) {
|
|
|
- var s = $(item).val();
|
|
|
- if (s === id) {
|
|
|
- bl = false;
|
|
|
- }
|
|
|
- });
|
|
|
- if (bl) {
|
|
|
- $("#configui3").append('<li class="b-close" id="productColorId1">' +
|
|
|
- ' <input type="hidden" value="' + id + '" name="productColorId1">' + name +
|
|
|
- '<span class="my-close" onclick="deleteli(this)"></span>' +
|
|
|
- '</li>');
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
function deleteli(obj) {
|
|
|
$(obj).parent().remove();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ function delEmployee($this){
|
|
|
+ $($this).parent().parent().remove();
|
|
|
+ if($("table#all_product tr:visible").length == 1){
|
|
|
+ $("#add_product").html("<tr id=\"trid\"><td colspan=\"3\" class=\"td-manage text-c\" >暂时没有产品信息,请添加!</td></tr>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ */
|
|
|
+ function updateProduct($this){
|
|
|
+ $("#productDiv").show();
|
|
|
+ var productId = $($this).parent().parent().find(".productId").val();
|
|
|
+ var productColorId = $($this).parent().parent().find(".productColorId").val();
|
|
|
+ $("#productId").val(productId);
|
|
|
+ getProduct(productId);
|
|
|
+ $("#productColorId").val(productColorId);
|
|
|
+ $("#productId").trigger("chosen:updated");//初始化
|
|
|
+ $("#productColorId").trigger("chosen:updated");//初始化
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改
|
|
@@ -297,6 +316,22 @@
|
|
|
layer.msg("优先级不能为空!", {icon: 5, time: 2000});
|
|
|
return;
|
|
|
}
|
|
|
+ //选择产品
|
|
|
+ var flag = false;
|
|
|
+ /*封装产品项*/
|
|
|
+ var strategyColorArray = new Array();
|
|
|
+ $("#add_product").find("tr").each(function(){
|
|
|
+ var strategyColor = new Object();
|
|
|
+ strategyColor.colorId = $(this).find(".productColorId").val();
|
|
|
+ strategyColor.productId = $(this).find(".productId").val();
|
|
|
+ strategyColorArray.push(strategyColor);
|
|
|
+ flag = true;
|
|
|
+ })
|
|
|
+ if(!flag){
|
|
|
+ layer.msg("必须要有一个产品!", {icon: 5, time: 5000});
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $("#strategyColorArray").val(JSON.stringify(strategyColorArray));
|
|
|
$.ajax({
|
|
|
cache: true,
|
|
|
type: "POST",
|
|
@@ -350,6 +385,11 @@
|
|
|
getProduct($(this).children('option:selected').val());
|
|
|
})
|
|
|
function getProduct(productId) {
|
|
|
+ if(productId === "0"){
|
|
|
+ $("#productColorId").html("<option value='0'>所有颜色</option>");
|
|
|
+ $("#productColorId").trigger("chosen:updated");//初始化
|
|
|
+ return;
|
|
|
+ }
|
|
|
$.ajax({
|
|
|
cache: true,
|
|
|
type: "POST",
|
|
@@ -392,6 +432,22 @@
|
|
|
group_search: false, //选项组是否可搜。此处搜索不可搜
|
|
|
include_group_label_in_selected: true //选中选项是否显示选项分组。false不显示,true显示。默认false。
|
|
|
});
|
|
|
+ $('.chosen2').chosen({
|
|
|
+ no_results_text: "没有找到结果!",//搜索无结果时显示的提示
|
|
|
+ search_contains:true, //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
|
|
|
+ allow_single_deselect:true, //单选下拉框是否允许取消选择。如果允许,选中选项会有一个x号可以删除选项
|
|
|
+ disable_search: false, //禁用搜索。设置为true,则无法搜索选项。
|
|
|
+ disable_search_threshold: 0, //当选项少等于于指定个数时禁用搜索。
|
|
|
+ inherit_select_classes: true, //是否继承原下拉框的样式类,此处设为继承
|
|
|
+ placeholder_text_single: '选择国家', //单选选择框的默认提示信息,当选项为空时会显示。如果原下拉框设置了data-placeholder,会覆盖这里的值。
|
|
|
+ width: '255px', //设置chosen下拉框的宽度。即使原下拉框本身设置了宽度,也会被width覆盖。
|
|
|
+ max_shown_results: 1000, //下拉框最大显示选项数量
|
|
|
+ display_disabled_options: false,
|
|
|
+ single_backstroke_delete: false, //false表示按两次删除键才能删除选项,true表示按一次删除键即可删除
|
|
|
+ case_sensitive_search: false, //搜索大小写敏感。此处设为不敏感
|
|
|
+ group_search: false, //选项组是否可搜。此处搜索不可搜
|
|
|
+ include_group_label_in_selected: true //选中选项是否显示选项分组。false不显示,true显示。默认false。
|
|
|
+ });
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|