|
@@ -107,7 +107,30 @@ function getCategoryData(product_id,i){
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+function generalsku(){
|
|
|
|
+ $('.sell-sku-body-table.option tr').each(function(){
|
|
|
|
+ general_sku = '';
|
|
|
|
+ $(this).find('.spu_option_content').each(function(){
|
|
|
|
+ attr = $(this).attr("rel");
|
|
|
|
+ val = $(this).attr('title');
|
|
|
|
+ if(!val){
|
|
|
|
+ i = 1;
|
|
|
|
+ alert("<?= Yii::$service->page->translate->__('can not select empty') ?>");
|
|
|
|
+ }
|
|
|
|
+ val = val.replace(/ /g, "*")
|
|
|
|
+ if(!general_sku){
|
|
|
|
+ general_sku = val;
|
|
|
|
+ }else{
|
|
|
|
+ general_sku += "-"+val;
|
|
|
|
+ }
|
|
|
|
+ general_sku = general_sku.toLowerCase();
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ $(this).find('.sku_code').val(general_sku);
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
|
|
|
|
+}
|
|
function thissubmit(thiss){
|
|
function thissubmit(thiss){
|
|
// product image
|
|
// product image
|
|
main_image_image = $('.productimg input[type=radio]:checked').val();
|
|
main_image_image = $('.productimg input[type=radio]:checked').val();
|
|
@@ -139,30 +162,31 @@ function thissubmit(thiss){
|
|
|
|
|
|
$(".tabsContent .image_gallery").val(image_gallery);
|
|
$(".tabsContent .image_gallery").val(image_gallery);
|
|
//custom_option
|
|
//custom_option
|
|
- //i = 0;
|
|
|
|
- //custom_option = new Object();
|
|
|
|
- //jQuery(".custom_option_list tbody tr").each(function(){
|
|
|
|
- // option_header = new Object();
|
|
|
|
- // $(this).find("td").each(function(){
|
|
|
|
- // rel = $(this).attr("rel");
|
|
|
|
- //
|
|
|
|
- // if(rel != 'image'){
|
|
|
|
- // if(rel){
|
|
|
|
- // option_header[rel] = $(this).attr('val');
|
|
|
|
- // }
|
|
|
|
- // }else{
|
|
|
|
- // rel = $(this).find("img").attr("rel");
|
|
|
|
- // option_header['image'] = rel;
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // });
|
|
|
|
- // custom_option[i] = option_header;
|
|
|
|
- // i++;
|
|
|
|
- //});
|
|
|
|
- //
|
|
|
|
- //custom_option = JSON.stringify(custom_option);
|
|
|
|
- //alert(custom_option);
|
|
|
|
- //jQuery(".custom_option_value").val(custom_option);
|
|
|
|
|
|
+ i = 0;
|
|
|
|
+ custom_option = new Object();
|
|
|
|
+ jQuery(".sell-sku-body-table.option tbody tr:gt(0)").each(function(){
|
|
|
|
+ option_header = new Object();
|
|
|
|
+ option_header['sku']=$(this).find('.sku_code').val();
|
|
|
|
+ option_header['price']=$(this).find('.price').val();
|
|
|
|
+ option_header['qty']=$(this).find('.qty').val();
|
|
|
|
+ option_header['image'] =$(this).find("img").attr("rel");
|
|
|
|
+ $(this).find('.spu_option_content').each(function(){
|
|
|
|
+ rel = $(this).attr("rel");
|
|
|
|
+ if(rel){
|
|
|
|
+ if(rel){
|
|
|
|
+ option_header[rel] = $(this).attr('title');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ console.log(option_header);
|
|
|
|
+ custom_option[i] = option_header;
|
|
|
|
+ i++;
|
|
|
|
+ });
|
|
|
|
+ console.log(custom_option);
|
|
|
|
+ custom_option = JSON.stringify(custom_option);
|
|
|
|
+ jQuery(".custom_option_value").val(custom_option);
|
|
|
|
+
|
|
|
|
|
|
cate_str = "";
|
|
cate_str = "";
|
|
jQuery(".category_tree div.ckbox.checked").each(function(){
|
|
jQuery(".category_tree div.ckbox.checked").each(function(){
|
|
@@ -190,45 +214,10 @@ function thissubmit(thiss){
|
|
|
|
|
|
spuStr = '';
|
|
spuStr = '';
|
|
isSkuPriceQtyEmpty = false;
|
|
isSkuPriceQtyEmpty = false;
|
|
- $(".sell-sku-body-table tr ").each(function(){
|
|
|
|
- skuStr = '';
|
|
|
|
- iss = 0;
|
|
|
|
- $(this).find("td.sell-sku-cell .cell-inner p.spu_attr_content").each(function(){
|
|
|
|
- sAttr = $(this).attr('rel');
|
|
|
|
- sAttrVal = $(this).attr('title');
|
|
|
|
- if (sAttr && sAttrVal) {
|
|
|
|
- skuStr += sAttr+ '###' + sAttrVal + '|||';
|
|
|
|
- iss = 1;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- if (iss) {
|
|
|
|
- sSkuCodeVal = $(this).find("td.sell-sku-cell .sku_code").val();
|
|
|
|
- sSkuPriceVal = $(this).find("td.sell-sku-cell .sku_price").val();
|
|
|
|
- sSkuQtyVal = $(this).find("td.sell-sku-cell .sku_qty").val();
|
|
|
|
- if (sSkuCodeVal && sSkuPriceVal && sSkuQtyVal) {
|
|
|
|
- skuStr += 'sku###' + sSkuCodeVal + '|||';
|
|
|
|
- skuStr += 'price###' + sSkuPriceVal + '|||';
|
|
|
|
- skuStr += 'qty###' + sSkuQtyVal;
|
|
|
|
- spuStr += skuStr + '***';
|
|
|
|
- } else {
|
|
|
|
- isSkuPriceQtyEmpty = true;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- if (isSkuPriceQtyEmpty) {
|
|
|
|
- alert("sku,价格,库存不能为空");
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- if (!spuStr) {
|
|
|
|
- alert("您应该至少添加一行spu属性");
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- $(".spu_attrs").val(spuStr);
|
|
|
|
//alert(tier_price_str);
|
|
//alert(tier_price_str);
|
|
jQuery(".tier_price_input").val(tier_price_str);
|
|
jQuery(".tier_price_input").val(tier_price_str);
|
|
//alert($(".tier_price_input").val());
|
|
//alert($(".tier_price_input").val());
|
|
|
|
+ // jQuery(".custom_option_list tbody tr:gt(0)").find('input').remove();
|
|
return validateCallback(thiss, dialogAjaxDoneCloseAndReflush);
|
|
return validateCallback(thiss, dialogAjaxDoneCloseAndReflush);
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@@ -238,7 +227,7 @@ function thissubmit(thiss){
|
|
<?php echo CRequest::getCsrfInputHtml(); ?>
|
|
<?php echo CRequest::getCsrfInputHtml(); ?>
|
|
<input type="hidden" name="operate" value="<?= $operate ?>" />
|
|
<input type="hidden" name="operate" value="<?= $operate ?>" />
|
|
<input type="hidden" class="primary_info" value="<?= $primaryInfo ?>" />
|
|
<input type="hidden" class="primary_info" value="<?= $primaryInfo ?>" />
|
|
- <input type="hidden" class="spu_attrs" name="spu_attrs" value="" />
|
|
|
|
|
|
+ <input type="hidden" class="custom_option_value" name="custom_option" value="" />
|
|
<div class="tabs" >
|
|
<div class="tabs" >
|
|
<div class="tabsHeader">
|
|
<div class="tabsHeader">
|
|
<div class="tabsHeaderContent">
|
|
<div class="tabsHeaderContent">
|
|
@@ -252,8 +241,8 @@ function thissubmit(thiss){
|
|
<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Attr Group') ?></span></a></li>
|
|
<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Attr Group') ?></span></a></li>
|
|
|
|
|
|
<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Spu Attr') ?></span></a></li>
|
|
<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Spu Attr') ?></span></a></li>
|
|
- <!--<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Custom Option') ?></span></a></li>
|
|
|
|
- -->
|
|
|
|
|
|
+ <li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Custom Option') ?></span></a></li>
|
|
|
|
+
|
|
<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Relate Product') ?></span></a></li>
|
|
<li><a href="javascript:;"><span><?= Yii::$service->page->translate->__('Relate Product') ?></span></a></li>
|
|
</ul>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
@@ -495,7 +484,7 @@ function thissubmit(thiss){
|
|
i = 0;
|
|
i = 0;
|
|
hStr = '';
|
|
hStr = '';
|
|
htmlStr += getTableStr(attrArr, i, hStr);
|
|
htmlStr += getTableStr(attrArr, i, hStr);
|
|
- $(".sell-sku-body-table tbody").html(htmlStr);
|
|
|
|
|
|
+ $(".sell-sku-body-table.option tbody").html(htmlStr);
|
|
});
|
|
});
|
|
|
|
|
|
function getTableStr(attrArr, i, hStr) {
|
|
function getTableStr(attrArr, i, hStr) {
|
|
@@ -602,6 +591,339 @@ function thissubmit(thiss){
|
|
</colgroup>
|
|
</colgroup>
|
|
<tbody>
|
|
<tbody>
|
|
|
|
|
|
|
|
+ </tbody>
|
|
|
|
+ </table>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div >
|
|
|
|
+ <div class="group_option">
|
|
|
|
+ <?php if (is_array($groupOption) && !empty($groupOption)): $iu = 0; ?>
|
|
|
|
+ <?php foreach ($groupOption as $spuName => $spuData): $iu++; ?>
|
|
|
|
+ <div class="spu_option_one" style="margin-top:10px;margin-bottom:20px;" rel="<?= $spuName ?>">
|
|
|
|
+ <div style="margin-bottom: 10px;">
|
|
|
|
+ <label style="text-transform: capitalize;"><?= $spuName ?></label>
|
|
|
|
+ <input type="text" style="width:100px;" class="spu_option_input spu_option_input_<?= $iu ?>" />
|
|
|
|
+
|
|
|
|
+ <a rel="<?= $iu ?>" style="text-align:right; float:none;" href="javascript:void(0)" class="add_option button">
|
|
|
|
+ <span> <?= Yii::$service->page->translate->__('Add') ?></span>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="spu_option_info spu_option_info_<?= $iu ?>">
|
|
|
|
+ <?php foreach ($spuData as $sd): ?>
|
|
|
|
+ <span style=" margin-right: 10px; font-size: 14px; height: 30px; line-height: 30px; min-width: 105px;display: inline-block;">
|
|
|
|
+ <input class="spuOptionCheck" type="checkbox" id="<?= $sd?>" rel="<?= $sd?>">
|
|
|
|
+ <label for="<?= $sd?>" style="text-transform: capitalize;font-size:14px;"><?= $sd?></label>
|
|
|
|
+ </span>
|
|
|
|
+ <?php endforeach; ?>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <?php endforeach; ?>
|
|
|
|
+ <div style="display:block;height: 40px;margin-bottom:5px;" class="fill">
|
|
|
|
+ <div style="margin-bottom: 10px;max-width:30%;float:left">
|
|
|
|
+ <label style="text-transform: capitalize;">价格</label>
|
|
|
|
+ <input type="text" style="width:100px;" class="fillprice textInput">
|
|
|
|
+
|
|
|
|
+ <a rel="3" style="text-align:right; float:none;" href="javascript:void(0)" class="button custom_option_price">
|
|
|
|
+ <span> 填充</span>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="margin-bottom: 10px;max-width:30%;float:left">
|
|
|
|
+ <label style="text-transform: capitalize;"> 库存</label>
|
|
|
|
+ <input type="text" style="width:100px;" class="textInput fillqty">
|
|
|
|
+
|
|
|
|
+ <a rel="3" style="text-align:right; float:none;" href="javascript:void(0)" class="button custom_option_qty">
|
|
|
|
+ <span> 填充</span>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="margin:0px 10px 10px 10px;max-width:30%;float:left">
|
|
|
|
+ <a rel="3" style="text-align:right; float:none;" href="javascript:void(0)" class="button custom_option_chose_image">
|
|
|
|
+ <span> 选择图片</span>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="margin:0px 10px 10px 10px;max-width:30%;float:left">
|
|
|
|
+ <a rel="3" style="text-align:right; float:none;" href="javascript:void(0)" class="button chose_custom_op_img">
|
|
|
|
+ <span> 填充图片</span>
|
|
|
|
+ </a>
|
|
|
|
+ <div class="chosened_img"></div>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="margin:0px 10px 10px 10px;max-width:30%;float:left">
|
|
|
|
+ <a rel="3" style="text-align:right; float:none;" href="javascript:void(0)" class="button" onclick="generalsku()">
|
|
|
|
+ <span> 填充sku</span>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="custom_option_img_list" style="border: 1px dashed rgb(136, 136, 136); margin: 15px 0px; padding: 8px 0px;">
|
|
|
|
+ </div>
|
|
|
|
+ <?php endif; ?>
|
|
|
|
+
|
|
|
|
+ <script>
|
|
|
|
+ function deleteoptionitem(){
|
|
|
|
+ $(this).parents('tr');
|
|
|
|
+ $(this).parents('tr').remove();
|
|
|
|
+ }
|
|
|
|
+ $(document).ready(function(){
|
|
|
|
+
|
|
|
|
+ $(".dialog").on("click",".spuOptionCheck",function(){
|
|
|
|
+ var optionArr = [];
|
|
|
|
+ var htmlStr = '<tr>';
|
|
|
|
+ var optionRows = {};
|
|
|
|
+ $columnsAllRows = 0;
|
|
|
|
+ $(".spu_option_one").each(function(){
|
|
|
|
+ var obj = {};
|
|
|
|
+ var spuName = $(this).attr('rel');
|
|
|
|
+ obj.name = spuName;
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-text">' + spuName + '</td>';
|
|
|
|
+ rows = 0;
|
|
|
|
+ var spuData = [];
|
|
|
|
+ $(this).find(".spuOptionCheck:checked").each(function(){
|
|
|
|
+ var val = $(this).attr('rel');
|
|
|
|
+ spuData.push(val);
|
|
|
|
+ rows++;
|
|
|
|
+ });
|
|
|
|
+ // 计算rows数
|
|
|
|
+ for (var x in optionRows){
|
|
|
|
+ v = optionRows[x];
|
|
|
|
+ optionRows[x] = v * rows;
|
|
|
|
+ }
|
|
|
|
+ optionRows[spuName] = 1;
|
|
|
|
+ obj.data = spuData;
|
|
|
|
+ optionArr.push(obj);
|
|
|
|
+ });
|
|
|
|
+ for (x in optionArr) {
|
|
|
|
+ obj = optionArr[x];
|
|
|
|
+ obj.rowSize = optionRows[obj.name];
|
|
|
|
+ }
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-text">Sku编码</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-text">价格</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-text">库存</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-text">图片</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-text">删除</td>';
|
|
|
|
+ htmlStr += '</tr>';
|
|
|
|
+ i = 0;
|
|
|
|
+ hStr = '';
|
|
|
|
+ console.log(optionArr);
|
|
|
|
+ htmlStr += getTableStr(optionArr, i, hStr);
|
|
|
|
+
|
|
|
|
+ $(".sell-sku-body-table.option tbody").html(htmlStr);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // function getTableStr(optionArr, i, hStr) {
|
|
|
|
+ // var optionObj = optionArr[i];
|
|
|
|
+ // var htmlStr = '';
|
|
|
|
+ // for (var j = 0; j < optionObj.data.length; j++) {
|
|
|
|
+ // rowspan = optionObj.rowSize;
|
|
|
|
+ // spuName = optionObj.name;
|
|
|
|
+ // vData = optionObj.data;
|
|
|
|
+ // optionVal = vData[j];
|
|
|
|
+ // shStr = hStr;
|
|
|
|
+ // ii = i + 1;
|
|
|
|
+ // if ( ii >= optionArr.length) {
|
|
|
|
+ // if (j > 0) {
|
|
|
|
+ // reallyDo = 'sell-sku-cell-text';
|
|
|
|
+ // replaceWith = "sell-sku-cell-text hide";
|
|
|
|
+ // shStr = shStr.replace(new RegExp(reallyDo, 'g'), replaceWith);
|
|
|
|
+ // }
|
|
|
|
+ // } else if(ii != 1){
|
|
|
|
+ // if (j > 0) {
|
|
|
|
+ // reallyDo = 'sell-sku-cell-text';
|
|
|
|
+ // replaceWith = "sell-sku-cell-text hide";
|
|
|
|
+ // shStr = shStr.replace(new RegExp(reallyDo, 'g'), replaceWith);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // shStr += '<td class="sell-sku-cell sell-sku-cell-text" rowspan="'+ rowspan +'">';
|
|
|
|
+ // shStr += '<div class="cell-inner" style="min-width: 78px;">';
|
|
|
|
+ // shStr += ' <div class="sell-sku-cell-text">';
|
|
|
|
+ // shStr += ' <p class="spu_option_content sell-sku-cell-text-content" rel="'+spuName+'" title="'+optionVal+'">'+optionVal+'</p>';
|
|
|
|
+ // shStr += ' </div>';
|
|
|
|
+ // shStr += '</div>';
|
|
|
|
+ // shStr += '</td>';
|
|
|
|
+ // if ( ii < optionArr.length) {
|
|
|
|
+ // htmlStr += getTableStr(optionArr, ii, shStr);
|
|
|
|
+ // } else {
|
|
|
|
+ // htmlStr += '<tr>' + shStr;
|
|
|
|
+ // htmlStr += '<td class="sell-sku-cell sell-sku-cell-input" rowspan="1">';
|
|
|
|
+ // htmlStr += ' <div class="cell-inner" style="min-width: 160px;">';
|
|
|
|
+ // htmlStr += ' <span class="sell-o-input"><span class="input-wrap">';
|
|
|
|
+ // htmlStr += ' <span class="next-input next-input-single next-input-medium fusion-input">';
|
|
|
|
+ // htmlStr += ' <input class="textInput valid sku_code" type="text" label="商家编码" name="skuOuterId" value="" maxlength="64" height="100%">';
|
|
|
|
+ // htmlStr += ' </span></span></span></div>';
|
|
|
|
+ // htmlStr += '</td>';
|
|
|
|
+ // htmlStr += '<td class="sell-sku-cell sell-sku-cell-money" rowspan="1">';
|
|
|
|
+ // htmlStr += ' <div class="cell-inner" style="min-width: 90px;">';
|
|
|
|
+ // htmlStr += ' <span class="sell-o-number">';
|
|
|
|
+ // htmlStr += ' <span class="input-wrap">';
|
|
|
|
+ // htmlStr += ' <span class="next-input next-input-single next-input-medium fusion-input">';
|
|
|
|
+ // htmlStr += ' <input class="textInput valid price" type="text" label="价格(元)" required="" value="" name="price" maxlength="15" height="100%">';
|
|
|
|
+ // htmlStr += ' </span></span></span></div>';
|
|
|
|
+ // htmlStr += '</td>';
|
|
|
|
+ // htmlStr += '<td class="sell-sku-cell sell-sku-cell-positiveNumber" rowspan="1">';
|
|
|
|
+ // htmlStr += ' <div class="cell-inner" style="min-width: 90px;">';
|
|
|
|
+ // htmlStr += ' <span class="sell-o-number">';
|
|
|
|
+ // htmlStr += ' <span class="input-wrap">';
|
|
|
|
+ // htmlStr += ' <span class="next-input next-input-single next-input-medium fusion-input">';
|
|
|
|
+ // htmlStr += ' <input class="textInput valid qty" type="text" label="数量(件)" required="" value="0" name="qty" maxlength="15" height="100%">';
|
|
|
|
+ // htmlStr += ' </span></span></span></div>';
|
|
|
|
+ // htmlStr += '</td>';
|
|
|
|
+ // htmlStr += '<td class="sell-sku-cell sell-sku-cell-image" rowspan="1">';
|
|
|
|
+ // htmlStr += '<img style="width:30px;">'
|
|
|
|
+ // htmlStr += '</td>';
|
|
|
|
+ // htmlStr += '<td class="sell-sku-cell " rowspan="1">';
|
|
|
|
+ // htmlStr += '<a title="删除" href="javascript:void(0)" class="btnDel deleteoptionitem" ><i class="fa fa-trash-o"></i></a>'
|
|
|
|
+ // htmlStr += '</td>';
|
|
|
|
+ // htmlStr += '</tr>';
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // return htmlStr;
|
|
|
|
+ // }
|
|
|
|
+ function getTableStr(optionArr, i, hStr) {
|
|
|
|
+ var optionObj = optionArr[i];
|
|
|
|
+ var htmlStr = '';
|
|
|
|
+ for (var j = 0; j < optionObj.data.length; j++) {
|
|
|
|
+ rowspan = optionObj.rowSize;
|
|
|
|
+ spuName = optionObj.name;
|
|
|
|
+ vData = optionObj.data;
|
|
|
|
+ optionVal = vData[j];
|
|
|
|
+ shStr = hStr;
|
|
|
|
+ ii = i + 1;
|
|
|
|
+ shStr += '<td class="sell-sku-cell sell-sku-cell-text" >';
|
|
|
|
+ shStr += '<div class="cell-inner" style="min-width: 78px;">';
|
|
|
|
+ shStr += ' <div class="sell-sku-cell-text">';
|
|
|
|
+ shStr += ' <p class="spu_option_content sell-sku-cell-text-content" rel="'+spuName+'" title="'+optionVal+'">'+optionVal+'</p>';
|
|
|
|
+ shStr += ' </div>';
|
|
|
|
+ shStr += '</div>';
|
|
|
|
+ shStr += '</td>';
|
|
|
|
+ if ( ii < optionArr.length) {
|
|
|
|
+ htmlStr += getTableStr(optionArr, ii, shStr);
|
|
|
|
+ } else {
|
|
|
|
+ htmlStr += '<tr>' + shStr;
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-input" rowspan="1">';
|
|
|
|
+ htmlStr += ' <div class="cell-inner" style="min-width: 160px;">';
|
|
|
|
+ htmlStr += ' <span class="sell-o-input"><span class="input-wrap">';
|
|
|
|
+ htmlStr += ' <span class="next-input next-input-single next-input-medium fusion-input">';
|
|
|
|
+ htmlStr += ' <input class="textInput valid sku_code" type="text" label="商家编码" name="skuOuterId" value="" maxlength="64" height="100%">';
|
|
|
|
+ htmlStr += ' </span></span></span></div>';
|
|
|
|
+ htmlStr += '</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-money" rowspan="1">';
|
|
|
|
+ htmlStr += ' <div class="cell-inner" style="min-width: 90px;">';
|
|
|
|
+ htmlStr += ' <span class="sell-o-number">';
|
|
|
|
+ htmlStr += ' <span class="input-wrap">';
|
|
|
|
+ htmlStr += ' <span class="next-input next-input-single next-input-medium fusion-input">';
|
|
|
|
+ htmlStr += ' <input class="textInput valid price" type="text" label="价格(元)" required="" value="" name="price" maxlength="15" height="100%">';
|
|
|
|
+ htmlStr += ' </span></span></span></div>';
|
|
|
|
+ htmlStr += '</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-positiveNumber" rowspan="1">';
|
|
|
|
+ htmlStr += ' <div class="cell-inner" style="min-width: 90px;">';
|
|
|
|
+ htmlStr += ' <span class="sell-o-number">';
|
|
|
|
+ htmlStr += ' <span class="input-wrap">';
|
|
|
|
+ htmlStr += ' <span class="next-input next-input-single next-input-medium fusion-input">';
|
|
|
|
+ htmlStr += ' <input class="textInput valid qty" type="text" label="数量(件)" required="" value="0" name="qty" maxlength="15" height="100%">';
|
|
|
|
+ htmlStr += ' </span></span></span></div>';
|
|
|
|
+ htmlStr += '</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell sell-sku-cell-image" rowspan="1">';
|
|
|
|
+ htmlStr += '<img style="width:30px;">'
|
|
|
|
+ htmlStr += '</td>';
|
|
|
|
+ htmlStr += '<td class="sell-sku-cell " rowspan="1">';
|
|
|
|
+ htmlStr += '<a title="删除" href="javascript:void(0)" class="btnDel deleteoptionitem" ><i class="fa fa-trash-o"></i></a>'
|
|
|
|
+ htmlStr += '</td>';
|
|
|
|
+ htmlStr += '</tr>';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return htmlStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $(".dialog").on("click",".add_option",function(){
|
|
|
|
+ var rel = $(this).attr('rel');
|
|
|
|
+ var str1 = ".spu_option_input_" + rel;
|
|
|
|
+ var str2 = ".spu_option_info_" + rel ;
|
|
|
|
+ var addVal = $(str1).val();
|
|
|
|
+ addVal = addVal.toLowerCase();
|
|
|
|
+ if (!addVal) {
|
|
|
|
+ alert("请填写值");
|
|
|
|
+ } else {
|
|
|
|
+ var isCF = 0;
|
|
|
|
+ $(str2 + " input").each(function(){
|
|
|
|
+ v = $(this).attr('rel');
|
|
|
|
+ v = v.toLowerCase();
|
|
|
|
+ if (v == addVal) {
|
|
|
|
+ alert("添加的值重复");
|
|
|
|
+ isCF = 1;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (isCF == 0) {
|
|
|
|
+ appendStr = '<span style=" margin-right: 10px; font-size: 14px; height: 30px; line-height: 30px; min-width: 105px;display: inline-block;"><input class="spuAttrCheck" type="checkbox" id="'+addVal+'" rel="'+addVal+'"><label for="'+addVal+'" style="text-transform: capitalize;font-size:14px;">'+addVal+'</label> </span>';
|
|
|
|
+ //alert(appendStr);
|
|
|
|
+ $(str2).append(appendStr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ $('.fill').on('click','.custom_option_price',function(){
|
|
|
|
+ val=$('.fillprice').val()
|
|
|
|
+ if(val){
|
|
|
|
+ $('.sell-sku-body-table.option').find('.price').val(val);
|
|
|
|
+ }else{
|
|
|
|
+ alert('请填写价格')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ $('.fill').on('click','.custom_option_qty',function(){
|
|
|
|
+ val=$('.fillqty').val()
|
|
|
|
+ if(val){
|
|
|
|
+ $('.sell-sku-body-table.option').find('.qty').val(val);
|
|
|
|
+ }else{
|
|
|
|
+ alert('请填写库存')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ $('.fill').on('click','.chose_custom_op_img',function(){
|
|
|
|
+ src=$('.chosened_img img').attr('src');
|
|
|
|
+ rel=$('.chosened_img img').attr('rel');
|
|
|
|
+ if(val){
|
|
|
|
+ $('.sell-sku-body-table.option').find('.sell-sku-cell-image img').attr('src',src).attr('rel',rel);
|
|
|
|
+ }else{
|
|
|
|
+ alert('请填写')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ $('.fill').on('click','.custom_option_chose_image',function(){
|
|
|
|
+ var custom_option_image='';
|
|
|
|
+ $('.list.productimg .p_img img').each(function(){
|
|
|
|
+
|
|
|
|
+ custom_option_image+='<span>'
|
|
|
|
+ custom_option_image+='<img rel='+$(this).attr('rel')+' style="width:80px;" src="'+$(this).attr('src')+'">'
|
|
|
|
+ custom_option_image+='</span>'
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ $('.custom_option_img_list').html(custom_option_image);
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ $('.sell-sku-body-table.option').on('click','.deleteoptionitem',function(){
|
|
|
|
+ $(this).parent('td').parent('tr').remove();
|
|
|
|
+ })
|
|
|
|
+ jQuery(document).on("click",".custom_option_img_list img",function(){
|
|
|
|
+ rel = $(this).attr('rel');
|
|
|
|
+ src = $(this).attr('src');
|
|
|
|
+ $(".chosened_img").html('<img style="width:80px;" rel="'+rel+'" src="'+src+'">');
|
|
|
|
+ $(".custom_option_img_list").slideUp("slow");
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ </script>
|
|
|
|
+
|
|
|
|
+ <table class="sell-sku-inner-table sell-sku-body-table option " style="transform: translateY(0px);">
|
|
|
|
+
|
|
|
|
+ <colgroup>
|
|
|
|
+ <col width="111px">
|
|
|
|
+ <col width="113px">
|
|
|
|
+ <col width="109px">
|
|
|
|
+ <col width="111px">
|
|
|
|
+ <col width="194px">
|
|
|
|
+ <col width="151px">
|
|
|
|
+ </colgroup>
|
|
|
|
+ <tbody>
|
|
|
|
+
|
|
</tbody>
|
|
</tbody>
|
|
</table>
|
|
</table>
|
|
</div>
|
|
</div>
|