|
@@ -1806,11 +1806,12 @@
|
|
})
|
|
})
|
|
|
|
|
|
function insertDefaultSkuRow() {
|
|
function insertDefaultSkuRow() {
|
|
- var skuTemplate = $('#skuTemplate').html();
|
|
|
|
- $("#skus").append(skuTemplate).show();
|
|
|
|
- var current = $("#skus").find('.sku').eq(-1);
|
|
|
|
|
|
+ console.log('skyList', skuList);
|
|
if (skuList) {
|
|
if (skuList) {
|
|
for (var i = 0; i < skuList.length; i++) {
|
|
for (var i = 0; i < skuList.length; i++) {
|
|
|
|
+ var skuTemplate = $('#skuTemplate').html();
|
|
|
|
+ $("#skus").append(skuTemplate).show();
|
|
|
|
+ var current = $("#skus").find('.sku').eq(-1);
|
|
var product = skuList[i];
|
|
var product = skuList[i];
|
|
product.skuIndex = i;
|
|
product.skuIndex = i;
|
|
setSkuPrototypeValues(current, product);
|
|
setSkuPrototypeValues(current, product);
|
|
@@ -1868,7 +1869,7 @@
|
|
// 机构价
|
|
// 机构价
|
|
var price = el.find('input[name$="price"]');
|
|
var price = el.find('input[name$="price"]');
|
|
price.val(product.price)
|
|
price.val(product.price)
|
|
- price.attr('name', 'skuList[0].price');
|
|
|
|
|
|
+ price.attr('name', 'skuList[' + skuIndex + '].price');
|
|
// 商品展示阶梯价格
|
|
// 商品展示阶梯价格
|
|
var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
|
|
var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
|
|
// 起订量
|
|
// 起订量
|
|
@@ -1891,25 +1892,26 @@
|
|
ladderPriceBox.find('.ladderPrice').each(function (index, item) {
|
|
ladderPriceBox.find('.ladderPrice').each(function (index, item) {
|
|
var ladderPrice = {}
|
|
var ladderPrice = {}
|
|
if (product.ladderPriceList && product.ladderPriceList.length > 0) {
|
|
if (product.ladderPriceList && product.ladderPriceList.length > 0) {
|
|
- ladderPrice = product.ladderPriceList[index];
|
|
|
|
|
|
+ ladderPrice = product.ladderPriceList[index] || {};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ console.log('ladderPrice---', ladderPrice)
|
|
// 起订量
|
|
// 起订量
|
|
var buyNum = $(item).find('[name$="buyNum"]');
|
|
var buyNum = $(item).find('[name$="buyNum"]');
|
|
buyNum.val(ladderPrice.buyNum);
|
|
buyNum.val(ladderPrice.buyNum);
|
|
- buyNum.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[0].buyNum');
|
|
|
|
|
|
+ buyNum.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyNum');
|
|
// 价格
|
|
// 价格
|
|
var buyPrice = $(item).find('[name$="buyPrice"]');
|
|
var buyPrice = $(item).find('[name$="buyPrice"]');
|
|
buyPrice.val(ladderPrice.buyPrice);
|
|
buyPrice.val(ladderPrice.buyPrice);
|
|
- buyPrice.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[0].buyPrice');
|
|
|
|
|
|
+ buyPrice.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyPrice');
|
|
// 阶梯价id
|
|
// 阶梯价id
|
|
var id = $(item).find('[name$="id"]');
|
|
var id = $(item).find('[name$="id"]');
|
|
id.val(ladderPrice.id);
|
|
id.val(ladderPrice.id);
|
|
- id.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[0].id');
|
|
|
|
|
|
+ id.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].id');
|
|
// 阶梯价delFlag
|
|
// 阶梯价delFlag
|
|
var delFlag = $(item).find('[name$="delFlag"]');
|
|
var delFlag = $(item).find('[name$="delFlag"]');
|
|
delFlag.val(ladderPrice.delFlag || 1);
|
|
delFlag.val(ladderPrice.delFlag || 1);
|
|
- delFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[0].delFlag');
|
|
|
|
|
|
+ delFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].delFlag');
|
|
});
|
|
});
|
|
|
|
|
|
skuIndex++;
|
|
skuIndex++;
|
|
@@ -1960,11 +1962,18 @@
|
|
})
|
|
})
|
|
|
|
|
|
ladderPriceBox.find('.ladderPrice').each(function (index, item) {
|
|
ladderPriceBox.find('.ladderPrice').each(function (index, item) {
|
|
- var delFlag = index.delFlag;
|
|
|
|
- if (index != 0 && (delFlag != 0 || product && product.ladderPriceFlag != 1)) {
|
|
|
|
|
|
+ var ladderPrice = product.ladderPriceList[index]
|
|
|
|
+ var delFlag = 1
|
|
|
|
+ if (ladderPrice) {
|
|
|
|
+ delFlag = ladderPrice.delFlag
|
|
|
|
+ }
|
|
|
|
+ console.log(delFlag)
|
|
|
|
+ if (index != 0) {
|
|
$(item).hide();
|
|
$(item).hide();
|
|
}
|
|
}
|
|
- ;
|
|
|
|
|
|
+ if (delFlag == 0 && product.ladderPriceFlag == 1) {
|
|
|
|
+ $(item).show()
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
|
|
costCheckFlag.on('change', function () {
|
|
costCheckFlag.on('change', function () {
|