Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
74dae375
ShopXO
项目概览
starsw001
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
74dae375
编写于
9月 23, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品规格快捷操作
上级
89912973
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
113 addition
and
28 deletion
+113
-28
application/admin/view/default/goods/save_info.html
application/admin/view/default/goods/save_info.html
+30
-2
application/service/GoodsService.php
application/service/GoodsService.php
+42
-2
config/app.php
config/app.php
+1
-1
config/shopxo.sql
config/shopxo.sql
+33
-18
public/static/admin/default/js/goods.js
public/static/admin/default/js/goods.js
+7
-5
未找到文件。
application/admin/view/default/goods/save_info.html
浏览文件 @
74dae375
...
...
@@ -168,10 +168,14 @@
<!-- 规格 -->
<div
id=
"goods-nav-operations"
class=
"division-block"
data-spec-add-max-number=
"{{:MyC('common_spec_add_max_number', 3, true)}}"
>
<label
class=
"block nav-detail-title"
>
商品规格
</label>
<!-- 规格快捷操作 -->
<div
class=
"spec-quick am-margin-bottom-lg"
>
<div
class=
"am-alert am-alert-warning am-radius"
data-am-alert
>
快捷操作可以快速创建商品SKU,大量节省SKU编辑时间,快捷操作数据不影响SKU数据,仅生成的时候重新覆盖SKU。
</div>
<span
class=
"business-operations-submit quick-spec-title-add"
>
+快捷操作
</span>
<span
class=
"business-operations-submit am-margin-left-sm am-icon-gg quick-spec-created"
>
生成规格
</span>
<div
class=
"goods-specifications"
style=
"display: none;"
>
<div
class=
"goods-specifications"
{{
if
empty
($
data
['
spec_base
'])}}
style=
"display: none;"
{{/
if
}}
>
<table
class=
"am-table am-table-bordered am-table-centered"
>
<thead>
<tr>
...
...
@@ -179,11 +183,35 @@
<th
class=
"spec-quick-th-value"
>
规格值
</th>
</tr>
</thead>
<tbody></tbody>
<tbody>
{{if !empty($data['spec_base'])}}
{{foreach $data.spec_base as $spec_base_key=>$spec_base}}
<tr>
<td
class=
"am-text-middle"
>
<i
class=
"am-close am-close-spin quick-title-remove"
>
×
</i>
<input
type=
"text"
value=
"{{$spec_base.title}}"
name=
"spec_base_title_{{$spec_base_key}}"
placeholder=
"规格名"
/>
</td>
<td
class=
"spec-quick-td-value am-cf"
>
{{if !empty($spec_base['value'])}}
{{foreach $spec_base.value as $value}}
<div
class=
"am-fl am-margin-xs value-item"
>
<input
type=
"text"
class=
"am-fl"
name=
"spec_base_value_{{$spec_base_key}}[]"
value=
"{{$value}}"
placeholder=
"规格值"
/>
<i
class=
"am-close am-close-spin quick-value-remove"
>
×
</i>
</div>
{{/foreach}}
{{/if}}
<div
class=
"am-fl am-margin-xs value-item am-text-left"
><span
class=
"business-operations-submit quick-spec-value-add"
data-index=
"{{$spec_base_key}}"
>
+添加规格值
</span>
</div>
</td>
</tr>
{{/foreach}}
{{/if}}
</tbody>
</table>
</div>
</div>
<!-- 规格常规操作 -->
<span
class=
"business-operations-submit specifications-nav-title-add"
>
+添加规格
</span>
<div
class=
"goods-specifications"
>
<!-- 规格批量操作弹层 -->
...
...
application/service/GoodsService.php
浏览文件 @
74dae375
...
...
@@ -396,6 +396,12 @@ class GoodsService
}
}
// 规格基础
if
(
isset
(
$v
[
'spec_base'
]))
{
$v
[
'spec_base'
]
=
empty
(
$v
[
'spec_base'
])
?
''
:
json_decode
(
$v
[
'spec_base'
],
true
);
}
// 获取规格
if
(
$is_spec
&&
!
empty
(
$v
[
'id'
]))
{
...
...
@@ -1064,7 +1070,14 @@ class GoodsService
return
DataReturn
(
$ret
,
-
1
);
}
// 规格
// 规格基础
$specifications_base
=
self
::
GetFormGoodsSpecificationsBaseParams
(
$params
);
if
(
$specifications_base
[
'code'
]
!=
0
)
{
return
$specifications_base
;
}
// 规格值
$specifications
=
self
::
GetFormGoodsSpecificationsParams
(
$params
);
if
(
$specifications
[
'code'
]
!=
0
)
{
...
...
@@ -1120,6 +1133,7 @@ class GoodsService
'seo_keywords'
=>
empty
(
$params
[
'seo_keywords'
])
?
''
:
$params
[
'seo_keywords'
],
'seo_desc'
=>
empty
(
$params
[
'seo_desc'
])
?
''
:
$params
[
'seo_desc'
],
'is_exist_many_spec'
=>
empty
(
$specifications
[
'data'
][
'title'
])
?
0
:
1
,
'spec_base'
=>
empty
(
$specifications_base
[
'data'
])
?
''
:
json_encode
(
$specifications_base
[
'data'
]),
];
// 商品保存处理钩子
...
...
@@ -1245,7 +1259,7 @@ class GoodsService
}
/**
* 获取规格参数
* 获取规格
值
参数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
...
...
@@ -1416,6 +1430,32 @@ class GoodsService
return
DataReturn
(
'success'
,
0
,
[
'data'
=>
$data
,
'title'
=>
$title
,
'images'
=>
$images
]);
}
/**
* 获取规格基础参数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-09-23
* @desc description
* @param [array] $params [输入参数]
*/
private
static
function
GetFormGoodsSpecificationsBaseParams
(
$params
=
[])
{
$result
=
[];
foreach
(
$params
as
$k
=>
$v
)
{
if
(
substr
(
$k
,
0
,
16
)
==
'spec_base_title_'
)
{
$key
=
substr
(
$k
,
16
);
$result
[]
=
[
'title'
=>
$v
,
'value'
=>
isset
(
$params
[
'spec_base_value_'
.
$key
])
?
$params
[
'spec_base_value_'
.
$key
]
:
[],
];
}
}
return
DataReturn
(
'success'
,
0
,
$result
);
}
/**
* 获取商品相册
* @author Devil
...
...
config/app.php
浏览文件 @
74dae375
...
...
@@ -19,7 +19,7 @@ return [
// 应用地址
'app_host'
=>
''
,
// 应用调试模式
'app_debug'
=>
fals
e
,
'app_debug'
=>
tru
e
,
// 应用Trace
'app_trace'
=>
false
,
// 是否支持多模块
...
...
config/shopxo.sql
浏览文件 @
74dae375
此差异已折叠。
点击以展开。
public/static/admin/default/js/goods.js
浏览文件 @
74dae375
...
...
@@ -307,14 +307,15 @@ $(function()
return
false
;
}
var
index
=
parseInt
(
Math
.
random
()
*
1000001
);
var
html
=
'
<tr>
'
;
html
+=
'
<td class="am-text-middle">
'
;
html
+=
'
<i class="am-close am-close-spin quick-title-remove"
data-index="168"
>×</i>
'
;
html
+=
'
<input type="text" name="spec_
quick_title_0
" placeholder="规格名" />
'
;
html
+=
'
<i class="am-close am-close-spin quick-title-remove">×</i>
'
;
html
+=
'
<input type="text" name="spec_
base_title_
'
+
index
+
'
" placeholder="规格名" />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td class="spec-quick-td-value am-cf">
'
;
html
+=
'
<div class="am-fl am-margin-xs value-item am-text-left">
'
;
html
+=
'
<span class="business-operations-submit quick-spec-value-add">+添加规格值</span>
'
;
html
+=
'
<span class="business-operations-submit quick-spec-value-add"
data-index="
'
+
index
+
'
"
>+添加规格值</span>
'
;
html
+=
'
</div>
'
;
html
+=
'
</td>
'
;
html
+=
'
</tr>
'
;
...
...
@@ -325,9 +326,10 @@ $(function()
// 添加规格值
$
(
document
).
on
(
'
click
'
,
'
.spec-quick table .quick-spec-value-add
'
,
function
()
{
var
index
=
$
(
this
).
data
(
'
index
'
);
var
html
=
'
<div class="am-fl am-margin-xs value-item">
'
;
html
+=
'
<input type="text" class="am-fl" name="spec_
quick_value_0
" placeholder="规格值" />
'
;
html
+=
'
<i class="am-close am-close-spin quick-value-remove"
data-index="168"
>×</i>
'
;
html
+=
'
<input type="text" class="am-fl" name="spec_
base_value_
'
+
index
+
'
[]
" placeholder="规格值" />
'
;
html
+=
'
<i class="am-close am-close-spin quick-value-remove">×</i>
'
;
html
+=
'
</div>
'
;
$
(
this
).
parent
().
before
(
html
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录