|
@@ -1,35 +1,40 @@
|
|
|
{extend name='admin@main'}
|
|
|
|
|
|
{block name="content"}
|
|
|
+
|
|
|
+{include file='store@goods/form_style'}
|
|
|
+
|
|
|
<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
|
|
|
|
|
|
- <div class="layui-card-body padding-left-40">
|
|
|
+ <div class="layui-card-body think-box-shadow padding-left-40">
|
|
|
|
|
|
- <div class="layui-form-item block relative">
|
|
|
- <h3 class="color-green"><sup class='color-red font-s14 absolute' style="margin-left:-10px">*</sup>商品分类</h3>
|
|
|
- <select class="layui-select" name="cate_id" lay-search>
|
|
|
- {foreach $cates as $cate}
|
|
|
- {if isset($vo.cate_id) and $vo.cate_id eq $cate.id}
|
|
|
- <option selected value="{$cate.id}">{$cate.title|default=''}</option>
|
|
|
- {else}
|
|
|
- <option value="{$cate.id}">{$cate.title|default=''}</option>
|
|
|
- {/if}
|
|
|
- {/foreach}
|
|
|
- </select>
|
|
|
+ <div class="layui-form-item layui-row layui-col-space15">
|
|
|
+ <label class="layui-col-xs3 relative">
|
|
|
+ <span class="color-green">商品分类</span>
|
|
|
+ <select class="layui-select" required name="cate_id" lay-search>
|
|
|
+ {foreach $cates as $cate}
|
|
|
+ {if isset($vo.cate_id) and $vo.cate_id eq $cate.id}
|
|
|
+ <option selected value="{$cate.id}">{$cate.id} - {$cate.title|default=''}</option>
|
|
|
+ {else}
|
|
|
+ <option value="{$cate.id}">{$cate.id} - {$cate.title|default=''}</option>
|
|
|
+ {/if}
|
|
|
+ {/foreach}
|
|
|
+ </select>
|
|
|
+ </label>
|
|
|
+ <label class="layui-col-xs9 relative">
|
|
|
+ <span class="color-green">商品名称</span>
|
|
|
+ <input name="title" required class="layui-input" placeholder="请输入商品名称" value="{$vo.title|default=''}">
|
|
|
+ </label>
|
|
|
</div>
|
|
|
|
|
|
- <div class="layui-form-item block relative">
|
|
|
- <h3 class="color-green"><sup class='color-red font-s14 absolute' style="margin-left:-10px">*</sup>商品名称</h3>
|
|
|
- <input name="title" required class="layui-input" placeholder="请输入商品名称" value="{$vo.title|default=''}">
|
|
|
- </div>
|
|
|
|
|
|
<div class="layui-form-item">
|
|
|
- <h3 class="color-green"><sup class='color-red font-s14 absolute' style="margin-left:-10px">*</sup>商品图片</h3>
|
|
|
+ <span class="color-green label-required-prev">商品LOGO及轮播展示图片</span>
|
|
|
<table class="layui-table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th class="text-center">LOGO</th>
|
|
|
- <th class="text-left">商品图片</th>
|
|
|
+ <th class="text-left">展示图片</th>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="90px" class="text-center"><input name="logo" type="hidden" value="{$vo.logo|default=''}"></td>
|
|
@@ -40,42 +45,25 @@
|
|
|
<script>$('[name="logo"]').uploadOneImage(), $('[name="image"]').uploadMultipleImage()</script>
|
|
|
</div>
|
|
|
|
|
|
- <fieldset class="margin-bottom-15">
|
|
|
- <legend>快递运费及分成比例</legend>
|
|
|
- <div>
|
|
|
- <div class="layui-form-item block relative">
|
|
|
- <div class="inline-block">
|
|
|
- <div class="layui-unselect layui-form-radio">
|
|
|
- <label>快递运费 <input onblur="this.value=(parseFloat(this.value)||0).toFixed(2)" name="price_express" value="{$vo.price_express|default='0.00'}" class="inline-block text-center font-s12 inner-input"> 元,</label>
|
|
|
- <label>分成比例 <input onblur="this.value=(parseFloat(this.value)||0).toFixed(4)" name="price_rate" value="{$vo.price_rate|default='0.00'}" class="inline-block text-center font-s12 inner-input"> %;</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </fieldset>
|
|
|
-
|
|
|
<div class="layui-form-item">
|
|
|
- <h3 class="color-green">
|
|
|
- <sup class='color-red font-s14 absolute' style="margin-left:-10px">*</sup>
|
|
|
- 商品规格<span class="color-desc font-s10">(最多支持3个规格分组,每个分组最多支持5个规格属性;仅添加商品时可编辑内容)</span>
|
|
|
- </h3>
|
|
|
+ <span class="color-green label-required-prev">商品规格及商品SKU绑定<span class="color-red font-s12">(规格填写后不允许再次修改)</span></span>
|
|
|
<div ng-repeat="x in specs track by $index" style="display:none" class="margin-bottom-10" ng-class="{true:'layui-show'}[isAddMode&&specs.length>0]">
|
|
|
<div class="goods-spec-box padding-10 margin-0 relative" style="background:#ddd">
|
|
|
- <span class="text-center goods-spec-title">名称</span>
|
|
|
- <input ng-model="x.name" required placeholder="请输入分组">
|
|
|
- <div class="fa-pull-right">
|
|
|
+ <span class="text-center goods-spec-title">分组</span>
|
|
|
+ <label class="label-required-null inline-block"><input ng-blur="x.name=trimSpace(x.name)" ng-model="x.name" required placeholder="请输入分组名称"></label>
|
|
|
+ <div class="pull-right">
|
|
|
+ <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="addSpecVal(x.list)">增加</a>
|
|
|
<a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-class="{false:'layui-bg-gray'}[$index>0]" ng-click="upSpecRow(specs,$index)">上移</a>
|
|
|
<a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-class="{false:'layui-bg-gray'}[$index<specs.length-1]" ng-click="dnSpecRow(specs,$index)">下移</a>
|
|
|
- <a ng-if="specs.length>1" class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="delSpecRow(specs,$index)">删除</a>
|
|
|
+ <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="delSpecRow(specs,$index)" ng-if="specs.length>1">删除</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="block padding-10 layui-bg-gray" ng-if="x.list && x.list.length > 0">
|
|
|
- <label class="goods-spec-box inline-block nowrap margin-bottom-0" ng-repeat="xx in x.list">
|
|
|
+ <div class="goods-spec-box padding-10 margin-0 layui-bg-gray block relative" ng-if="x.list && x.list.length > 0">
|
|
|
+ <label class="label-required-null inline-block margin-right-10 margin-bottom-5 relative nowrap" ng-repeat="xx in x.list">
|
|
|
<input type="checkbox" lay-ignore ng-model="xx.check" ng-click="xx.check=checkListChecked(x.list,$event.target.checked)">
|
|
|
- <input type="text" ng-model="xx.name" ng-keyup="xx.name=$event.target.value" required placeholder="请输入规格">
|
|
|
+ <input type="text" ng-blur="xx.name=trimSpace(xx.name)" ng-model="xx.name" ng-keyup="xx.name=$event.target.value" required placeholder="请输入规格">
|
|
|
<a ng-if="x.list.length>1" ng-click="x.list=delSpecVal(x.list,$index)" class="layui-icon layui-icon-close font-s12 goods-spec-close"></a>
|
|
|
</label>
|
|
|
- <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-if="x.list.length<5" ng-click="addSpecVal(x.list)">增加</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
<a ng-if="isAddMode&&specs.length<3" class="layui-btn layui-btn-sm layui-btn-primary" ng-click="addSpecRow(specs)">增加分组</a>
|
|
@@ -83,10 +71,11 @@
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th ng-repeat="x in specsTreeNava track by $index" class="nowrap" ng-bind="x"></th>
|
|
|
- <th width="10%" class="text-center nowrap">快递数量 <a ng-click="batchSet('express',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
- <th width="10%" class="text-center nowrap">虚拟销量 <a ng-click="batchSet('virtual',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
+ <th width="10%" class="text-center nowrap">商品SKU <a ng-click="batchSet('sku',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
<th width="10%" class="text-center nowrap">市场价格 <a ng-click="batchSet('market',2)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
<th width="10%" class="text-center nowrap">销售价格 <a ng-click="batchSet('selling',2)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
+ <th width="10%" class="text-center nowrap">虚拟销量 <a ng-click="batchSet('virtual',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
+ <th width="10%" class="text-center nowrap">快递计件 <a ng-click="batchSet('express',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
|
|
<th width="10%" class="text-center nowrap">销售状态</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
@@ -95,22 +84,27 @@
|
|
|
<td class="layui-bg-gray" ng-if="td.show" rowspan="{{td.span}}" ng-repeat="td in rows" ng-bind="td.name"></td>
|
|
|
<td class="padding-0">
|
|
|
<label class="padding-0 margin-0">
|
|
|
- <input ng-blur="rows[0].express=setValue(rows[0].key,'express',$event.target.value,'(parseFloat(_)||0).toFixed(0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].express">
|
|
|
+ <input ng-blur="rows[0].sku=setValue(rows[0].key,'sku',$event.target.value,'(parseFloat(_)||0).toFixed(0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].sku">
|
|
|
</label>
|
|
|
</td>
|
|
|
<td class="padding-0">
|
|
|
<label class="padding-0 margin-0">
|
|
|
- <input ng-blur="rows[0].virtual=setValue(rows[0].key,'virtual',$event.target.value,'(parseInt(_)||0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].virtual">
|
|
|
+ <input ng-blur="rows[0].market=setValue(rows[0].key,'market',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].market">
|
|
|
</label>
|
|
|
</td>
|
|
|
<td class="padding-0">
|
|
|
<label class="padding-0 margin-0">
|
|
|
- <input ng-blur="rows[0].market=setValue(rows[0].key,'market',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].market">
|
|
|
+ <input ng-blur="rows[0].selling=setValue(rows[0].key,'selling',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].selling">
|
|
|
</label>
|
|
|
</td>
|
|
|
<td class="padding-0">
|
|
|
<label class="padding-0 margin-0">
|
|
|
- <input ng-blur="rows[0].selling=setValue(rows[0].key,'selling',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].selling">
|
|
|
+ <input ng-blur="rows[0].virtual=setValue(rows[0].key,'virtual',$event.target.value,'(parseInt(_)||0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].virtual">
|
|
|
+ </label>
|
|
|
+ </td>
|
|
|
+ <td class="padding-0">
|
|
|
+ <label class="padding-0 margin-0">
|
|
|
+ <input ng-blur="rows[0].express=setValue(rows[0].key,'express',$event.target.value,'(parseInt(_)||0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].express">
|
|
|
</label>
|
|
|
</td>
|
|
|
<td class="text-center layui-bg-gray">
|
|
@@ -119,12 +113,13 @@
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
+ <p class="color-desc">请从仓储平台获取商品SKU与商品条码,请注意尽量不要重复,也不能产生订单后再修改!</p>
|
|
|
<textarea class="layui-textarea layui-hide" name="specs">{{specs}}</textarea>
|
|
|
<textarea class="layui-textarea layui-hide" name="lists">{{specsTreeData}}</textarea>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item block">
|
|
|
- <h3 class="color-green"><sup class='color-red font-s14 absolute' style="margin-left:-10px">*</sup>商品内容</h3>
|
|
|
+ <span class="label-required-prev color-green">商品详细内容</span>
|
|
|
<textarea name="content">{$vo.content|default=''|raw}</textarea>
|
|
|
</div>
|
|
|
|
|
@@ -136,110 +131,22 @@
|
|
|
|
|
|
</div>
|
|
|
</form>
|
|
|
-
|
|
|
-<style>
|
|
|
-
|
|
|
- .inner-input {
|
|
|
- width: 80px;
|
|
|
- height: 14px;
|
|
|
- padding: 1px 5px;
|
|
|
- line-height: 12px;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-box {
|
|
|
- position: relative;
|
|
|
- margin: 0 10px 10px 0;
|
|
|
- vertical-align: middle;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-title {
|
|
|
- z-index: 2;
|
|
|
- width: 40px;
|
|
|
- color: #fff;
|
|
|
- height: 28px;
|
|
|
- position: absolute;
|
|
|
- background: #999;
|
|
|
- line-height: 28px;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-close {
|
|
|
- right: 8px;
|
|
|
- z-index: 2;
|
|
|
- line-height: 28px;
|
|
|
- position: absolute;
|
|
|
- display: inline-block
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-btn {
|
|
|
- height: 28px;
|
|
|
- margin-left: 5px !important;
|
|
|
- line-height: 26px !important;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-box input {
|
|
|
- z-index: 1;
|
|
|
- width: 120px;
|
|
|
- position: relative;
|
|
|
- border: 1px solid #999;
|
|
|
- padding: 5px 0 5px 45px;
|
|
|
- display: inline-block !important;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-box input[type=checkbox] {
|
|
|
- z-index: 2;
|
|
|
- width: 40px;
|
|
|
- height: 28px;
|
|
|
- border: none;
|
|
|
- cursor: pointer;
|
|
|
- appearance: none;
|
|
|
- position: absolute;
|
|
|
- -webkit-appearance: none;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-box input[type=checkbox]:before {
|
|
|
- top: 1px;
|
|
|
- left: 1px;
|
|
|
- width: 40px;
|
|
|
- height: 26px;
|
|
|
- content: ' ';
|
|
|
- position: absolute;
|
|
|
- background: #c9c9c9;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-box input[type=checkbox]:after {
|
|
|
- top: 1px;
|
|
|
- left: 1px;
|
|
|
- color: #999;
|
|
|
- width: 40px;
|
|
|
- height: 26px;
|
|
|
- content: '\e63f';
|
|
|
- font-size: 16px;
|
|
|
- line-height: 26px;
|
|
|
- position: absolute;
|
|
|
- text-align: center;
|
|
|
- font-family: 'layui-icon';
|
|
|
- }
|
|
|
-
|
|
|
- .goods-spec-box input[type=checkbox]:checked:after {
|
|
|
- color: #333;
|
|
|
- content: '\e605';
|
|
|
- }
|
|
|
-</style>
|
|
|
-
|
|
|
{/block}
|
|
|
|
|
|
{block name='script'}
|
|
|
+<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
|
|
|
+<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
|
|
|
<script>
|
|
|
window.form.render();
|
|
|
require(['ckeditor', 'angular'], function () {
|
|
|
window.createEditor('[name="content"]', {height: 500});
|
|
|
- let app = angular.module("GoodsForm", []).run(callback);
|
|
|
+ var app = angular.module("GoodsForm", []).run(callback);
|
|
|
angular.bootstrap(document.getElementById(app.name), [app.name]);
|
|
|
|
|
|
function callback($rootScope) {
|
|
|
$rootScope.isAddMode = parseInt('{$isAddMode|default=0}');
|
|
|
- let defaultValues = angular.fromJson('{$defaultValues|raw|default=0}') || {};
|
|
|
- $rootScope.specs = angular.fromJson('{$vo.specs|raw|default=0}') || [{name: '默认分组', list: [{name: '默认规格', check: true}]}];
|
|
|
+ $rootScope.maps = JSON.parse(angular.element('#goods-value').val() || '[]') || {};
|
|
|
+ $rootScope.specs = JSON.parse(angular.element('#goods-specs').val() || '[{"name":"默认分组","list":[{"name":"默认规格","check":true}]}]');
|
|
|
// 批量设置数值
|
|
|
$rootScope.batchSet = function (type, fixed) {
|
|
|
layer.prompt({title: '请输入数值', formType: 0}, function (value, index) {
|
|
@@ -260,72 +167,74 @@
|
|
|
};
|
|
|
// 设置默认值
|
|
|
$rootScope.setValue = function (key, type, value, call) {
|
|
|
- defaultValues[key] || (defaultValues[key] = {});
|
|
|
- return defaultValues[key][type] = eval(call.replace('_', "'" + value + "'"));
|
|
|
+ $rootScope.maps[key] || ($rootScope.maps[key] = {});
|
|
|
+ return $rootScope.maps[key][type] = eval(call.replace('_', "'" + value + "'"));
|
|
|
};
|
|
|
// 读取默认值
|
|
|
- let getValue = function (key, callback) {
|
|
|
- if (typeof callback === 'function') return callback(defaultValues[key] || {});
|
|
|
+ $rootScope.getValue = function (key, callback) {
|
|
|
+ if (typeof callback === 'function') {
|
|
|
+ return callback($rootScope.maps[key] || {});
|
|
|
+ }
|
|
|
+ return {};
|
|
|
+ };
|
|
|
+ // 去除空白字符
|
|
|
+ $rootScope.trimSpace = function (value) {
|
|
|
+ return (value + '').replace(/\s*/ig, '');
|
|
|
};
|
|
|
// 生成交叉表格数据
|
|
|
$rootScope.specsTreeData = [];
|
|
|
$rootScope.specsTreeNava = [];
|
|
|
// 当前商品规格发生变化时重新计算规格列表
|
|
|
$rootScope.$watch('specs', function () {
|
|
|
- let list = [], nava = [], table = [[]];
|
|
|
- let data = angular.fromJson(angular.toJson($rootScope.specs));
|
|
|
+ var data = $rootScope.specs, list = [], navs = [], table = [[]];
|
|
|
// 过滤无效记录
|
|
|
- for (let o of data) {
|
|
|
- let tmp = [];
|
|
|
- for (let x of o.list) (x.check && typeof x.name === 'string' && x.name.length > 0) && tmp.push(x);
|
|
|
- if (tmp.length > 0) for (let x of tmp) x.group = o.name, x.span = 1, x.show = true;
|
|
|
- if (tmp.length > 0) list.push(tmp), nava.push(o.name);
|
|
|
- $rootScope.specsTreeNava = nava;
|
|
|
+ for (var i in data) {
|
|
|
+ var tmp = [];
|
|
|
+ for (var j in data[i].list) if (data[i].list[j].check && data[i].list[j].name.length > 0) {
|
|
|
+ data[i].list[j].span = 1, data[i].list[j].show = true, data[i].list[j].group = data[i].name;
|
|
|
+ tmp.push(data[i].list[j]);
|
|
|
+ }
|
|
|
+ list.push(tmp), navs.push(data[i].name);
|
|
|
}
|
|
|
+ $rootScope.specsTreeNava = navs;
|
|
|
// 表格交叉
|
|
|
- for (let i in list) {
|
|
|
- let temp = [];
|
|
|
- for (let j in table) for (let k in list[i]) temp.push(table[j].concat(list[i][k]));
|
|
|
- table = temp;
|
|
|
+ for (var i in list) {
|
|
|
+ var tmp = [];
|
|
|
+ for (var j in table) for (var k in list[i]) tmp.push(table[j].concat(list[i][k]));
|
|
|
+ table = tmp;
|
|
|
}
|
|
|
// 表格合并
|
|
|
list = angular.fromJson(angular.toJson(table));
|
|
|
- for (let row in list) {
|
|
|
- let key = [], _key = '';
|
|
|
- for (let td in list[row]) key.push(list[row][td].group + '::' + list[row][td].name);
|
|
|
- for (let td in list[row]) {
|
|
|
- if (_key.length === 0) {
|
|
|
- list[row][0].key = _key = key.join(';;');
|
|
|
- list[row][0].express = getValue(_key, function (data) {
|
|
|
- return data.express || '1';
|
|
|
- });
|
|
|
- list[row][0].virtual = getValue(_key, function (data) {
|
|
|
- return data.virtual || '0';
|
|
|
- });
|
|
|
- list[row][0].market = getValue(_key, function (data) {
|
|
|
- return data.market || '0.00';
|
|
|
- });
|
|
|
- list[row][0].selling = getValue(_key, function (data) {
|
|
|
- return data.selling || '0.00';
|
|
|
- });
|
|
|
-
|
|
|
- list[row][0].status = getValue(_key, function (data) {
|
|
|
- return !!(typeof data.status !== 'undefined' ? data.status : true);
|
|
|
- });
|
|
|
- }
|
|
|
- // 表格TD处理
|
|
|
- for (let dow = 1 + parseInt(row); dow < list.length; dow++)
|
|
|
- if (list[row][td].name === list[dow][td].name) {
|
|
|
- list[row][td].span++;
|
|
|
- list[dow][td].show = false;
|
|
|
- } else break;
|
|
|
+ for (var i in list) {
|
|
|
+ var key = [], _key = '';
|
|
|
+ for (var td in list[i]) key.push(list[i][td].group + '::' + list[i][td].name);
|
|
|
+ for (var td in list[i]) if (_key.length === 0) {
|
|
|
+ list[i][0].key = _key = key.join(';;');
|
|
|
+ list[i][0].sku = $rootScope.getValue(_key, function (data) {
|
|
|
+ return data.sku || '0';
|
|
|
+ });
|
|
|
+ list[i][0].virtual = $rootScope.getValue(_key, function (data) {
|
|
|
+ return data.virtual || '0';
|
|
|
+ });
|
|
|
+ list[i][0].express = $rootScope.getValue(_key, function (data) {
|
|
|
+ return data.express || '1';
|
|
|
+ });
|
|
|
+ list[i][0].market = $rootScope.getValue(_key, function (data) {
|
|
|
+ return data.market || '0.00';
|
|
|
+ });
|
|
|
+ list[i][0].selling = $rootScope.getValue(_key, function (data) {
|
|
|
+ return data.selling || '0.00';
|
|
|
+ });
|
|
|
+ list[i][0].status = $rootScope.getValue(_key, function (data) {
|
|
|
+ return !!(typeof data.status !== 'undefined' ? data.status : true);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
$rootScope.specsTreeData = list;
|
|
|
}, true);
|
|
|
// 判断规则是否能取消选择
|
|
|
$rootScope.checkListChecked = function (list, check) {
|
|
|
- for (let o of list) if (o.check) return check;
|
|
|
+ for (var i in list) if (list[i].check) return check;
|
|
|
return true;
|
|
|
};
|
|
|
// 增加整行规格分组
|
|
@@ -334,9 +243,9 @@
|
|
|
};
|
|
|
// 下移整行规格分组
|
|
|
$rootScope.dnSpecRow = function (data, $index) {
|
|
|
- let tmp = [], cur = data[$index];
|
|
|
+ var tmp = [], cur = data[$index];
|
|
|
if ($index > data.length - 2) return false;
|
|
|
- for (let i in data) {
|
|
|
+ for (var i in data) {
|
|
|
(parseInt(i) !== parseInt($index)) && tmp.push(data[i]);
|
|
|
(parseInt(i) === parseInt($index) + 1) && tmp.push(cur);
|
|
|
}
|
|
@@ -344,9 +253,9 @@
|
|
|
};
|
|
|
// 上移整行规格分组
|
|
|
$rootScope.upSpecRow = function (data, $index) {
|
|
|
- let tmp = [], cur = data[$index];
|
|
|
+ var tmp = [], cur = data[$index];
|
|
|
if ($index < 1) return false;
|
|
|
- for (let i in data) {
|
|
|
+ for (var i in data) {
|
|
|
(parseInt(i) === parseInt($index) - 1) && tmp.push(cur);
|
|
|
(parseInt(i) !== parseInt($index)) && tmp.push(data[i]);
|
|
|
}
|
|
@@ -354,8 +263,8 @@
|
|
|
};
|
|
|
// 移除整行规格分组
|
|
|
$rootScope.delSpecRow = function (data, $index) {
|
|
|
- let tmp = [];
|
|
|
- for (let i in data) if (parseInt(i) !== parseInt($index)) tmp.push(data[i]);
|
|
|
+ var tmp = [];
|
|
|
+ for (var i in data) if (parseInt(i) !== parseInt($index)) tmp.push(data[i]);
|
|
|
return $rootScope.specs = tmp;
|
|
|
};
|
|
|
// 增加分组的属性
|
|
@@ -364,8 +273,8 @@
|
|
|
};
|
|
|
// 移除分组的属性
|
|
|
$rootScope.delSpecVal = function (data, $index) {
|
|
|
- let temp = [];
|
|
|
- for (let i in data) if (parseInt(i) !== parseInt($index)) temp.push(data[i]);
|
|
|
+ var temp = [];
|
|
|
+ for (var i in data) if (parseInt(i) !== parseInt($index)) temp.push(data[i]);
|
|
|
return temp;
|
|
|
};
|
|
|
}
|