Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alading2018
ShopXO
提交
d865872b
ShopXO
项目概览
alading2018
/
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,发现更多精彩内容 >>
提交
d865872b
编写于
12月 25, 2018
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增规格重量,规格支持图片
上级
6a419a66
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
260 addition
and
161 deletion
+260
-161
application/admin/view/default/goods/save_info.html
application/admin/view/default/goods/save_info.html
+26
-17
application/admin/view/default/public/header.html
application/admin/view/default/public/header.html
+2
-2
application/index/view/default/goods/index.html
application/index/view/default/goods/index.html
+14
-15
application/index/view/default/public/header.html
application/index/view/default/public/header.html
+1
-1
application/service/GoodsService.php
application/service/GoodsService.php
+90
-31
application/service/ResourcesService.php
application/service/ResourcesService.php
+1
-1
public/install/shopxo_tp5.sql
public/install/shopxo_tp5.sql
+42
-20
public/static/admin/default/images/default-images.png
public/static/admin/default/images/default-images.png
+0
-0
public/static/admin/default/js/goods.js
public/static/admin/default/js/goods.js
+25
-11
public/static/index/default/css/goods.css
public/static/index/default/css/goods.css
+7
-2
public/static/index/default/js/goods.js
public/static/index/default/js/goods.js
+52
-61
未找到文件。
application/admin/view/default/goods/save_info.html
浏览文件 @
d865872b
...
@@ -169,15 +169,16 @@
...
@@ -169,15 +169,16 @@
{{foreach $specifications.type as $type_v}}
{{foreach $specifications.type as $type_v}}
<th
class=
"table-title table-title-{{$type_v.id}}"
>
<th
class=
"table-title table-title-{{$type_v.id}}"
>
<i
class=
"am-close am-close-spin title-nav-remove"
data-index=
"{{$type_v.id}}"
>
×
</i>
<i
class=
"am-close am-close-spin title-nav-remove"
data-index=
"{{$type_v.id}}"
>
×
</i>
<input
type=
"text"
name=
"specifications_name_{{$type_v.id}}"
placeholder=
"规格名"
value=
"{{$type_v.name}}"
/>
<input
type=
"text"
name=
"specifications_name_{{$type_v.id}}"
placeholder=
"规格名"
value=
"{{$type_v.name}}"
data-validation-message=
"请填写规格名"
required
/>
</th>
</th>
{{/foreach}}
{{/foreach}}
{{/if}}
{{/if}}
<th
class=
"title-start"
>
价格
(元)
</th>
<th
class=
"title-start"
>
价格
(元)
</th>
<th>
库存
</th>
<th>
库存
</th>
<th>
重量(kg)
</th>
<th>
规格编码
</th>
<th>
规格编码
</th>
<th>
条形码
</th>
<th>
条形码
</th>
<th>
原价
(元)
</th>
<th>
原价
(元)
</th>
<th
class=
"operation-btn"
>
操作
</th>
<th
class=
"operation-btn"
>
操作
</th>
</tr>
</tr>
</thead>
</thead>
...
@@ -191,7 +192,10 @@
...
@@ -191,7 +192,10 @@
<input
type=
"number"
name=
"specifications_number[]"
placeholder=
"库存"
class=
"am-radius"
min=
"1"
max=
"100000000"
pattern=
"^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$"
data-validation-message=
"库存数量 1~100000000"
required
/>
<input
type=
"number"
name=
"specifications_number[]"
placeholder=
"库存"
class=
"am-radius"
min=
"1"
max=
"100000000"
pattern=
"^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$"
data-validation-message=
"库存数量 1~100000000"
required
/>
</td>
</td>
<td>
<td>
<input
type=
"text"
name=
"specifications_coding[]"
placeholder=
"规格编码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"规格编码最多80个字符"
/>
<input
type=
"number"
name=
"specifications_weight[]"
placeholder=
"重量"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"请填写有效的规格重量"
/>
</td>
<td>
<input
type=
"text"
name=
"specifications_coding[]"
placeholder=
"编码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"规格编码最多80个字符"
/>
</td>
</td>
<td>
<td>
<input
type=
"text"
name=
"specifications_barcode[]"
placeholder=
"条形码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"条形码最多80个字符"
/>
<input
type=
"text"
name=
"specifications_barcode[]"
placeholder=
"条形码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"条形码最多80个字符"
/>
...
@@ -213,7 +217,7 @@
...
@@ -213,7 +217,7 @@
{{switch v.data_type}}
{{switch v.data_type}}
{{case spec}}
{{case spec}}
<td
class=
"table-value table-value-{{$v.data.key}}"
>
<td
class=
"table-value table-value-{{$v.data.key}}"
>
<input
type=
"text"
name=
"specifications_value_{{$v.data.key}}[]"
placeholder=
"规格值"
value=
"{{$v.data.value}}"
/>
<input
type=
"text"
name=
"specifications_value_{{$v.data.key}}[]"
placeholder=
"规格值"
value=
"{{$v.data.value}}"
data-validation-message=
"请填写规格值"
required
/>
</td>
</td>
{{/case}}
{{/case}}
...
@@ -225,7 +229,10 @@
...
@@ -225,7 +229,10 @@
<input
type=
"number"
name=
"specifications_number[]"
placeholder=
"库存"
class=
"am-radius"
min=
"0"
max=
"100000000"
data-validation-message=
"库存数量 0~100000000"
value=
"{{$v.data.inventory}}"
required
/>
<input
type=
"number"
name=
"specifications_number[]"
placeholder=
"库存"
class=
"am-radius"
min=
"0"
max=
"100000000"
data-validation-message=
"库存数量 0~100000000"
value=
"{{$v.data.inventory}}"
required
/>
</td>
</td>
<td>
<td>
<input
type=
"text"
name=
"specifications_coding[]"
placeholder=
"规格编码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"规格编码最多80个字符"
value=
"{{$v.data.coding}}"
/>
<input
type=
"number"
name=
"specifications_weight[]"
placeholder=
"重量"
class=
"am-radius"
min=
"0"
max=
"100000000"
data-validation-message=
"规格重量 0~100000000"
value=
"{{if $v['data']['weight'] gt 0}}{{$v.data.weight}}{{/if}}"
/>
</td>
<td>
<input
type=
"text"
name=
"specifications_coding[]"
placeholder=
"编码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"规格编码最多80个字符"
value=
"{{$v.data.coding}}"
/>
</td>
</td>
<td>
<td>
<input
type=
"text"
name=
"specifications_barcode[]"
placeholder=
"条形码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"条形码最多80个字符"
value=
"{{$v.data.barcode}}"
/>
<input
type=
"text"
name=
"specifications_barcode[]"
placeholder=
"条形码"
class=
"am-radius"
maxlength=
"80"
data-validation-message=
"条形码最多80个字符"
value=
"{{$v.data.barcode}}"
/>
...
@@ -252,16 +259,18 @@
...
@@ -252,16 +259,18 @@
</table>
</table>
<span
class=
"business-operations-submit specifications-nav-title-add"
>
+添加规格
</span>
<span
class=
"business-operations-submit specifications-nav-title-add"
>
+添加规格
</span>
<span
class=
"business-operations-submit specifications-line-add"
>
+添加一行
</span>
<span
class=
"business-operations-submit specifications-line-add"
>
+添加一行
</span>
<ul
class=
"spec-images-list"
>
<ul
class=
"spec-images-list"
{{
if
empty
($
specifications
['
images
'])}}
style=
"display: none"
{{/
if
}}
>
<!-- <li>
{{foreach $specifications.images as $spec_images}}
<ul class="plug-file-upload-view spec-images-view" data-form-name="spec_images[]" data-max-number="1" data-delete='0' data-dialog-type="images">
<li>
<li>
<ul
class=
"plug-file-upload-view spec-images-view-{{$spec_images.name}}"
data-form-name=
"spec_images[{{$spec_images.name}}]"
data-max-number=
"1"
data-delete=
'0'
data-dialog-type=
"images"
>
<input type="hidden" name="spec_images[]" value="" />
<li>
<img src="{{$image_host}}/static/admin/default/images/default-images.png" />
<input
type=
"hidden"
name=
"spec_images[{{$spec_images.name}}]"
value=
"{{$spec_images.images_old}}"
data-validation-message=
"请上传规格图片"
required
/>
</li>
<img
src=
"{{$spec_images.images}}"
/>
</ul>
</li>
<div class="plug-file-upload-submit" data-view-tag="ul.spec-images-view">+上传图片</div>
</ul>
</li> -->
<div
class=
"plug-file-upload-submit"
data-view-tag=
"ul.spec-images-view-{{$spec_images.name}}"
>
+上传图片
</div>
</li>
{{/foreach}}
</ul>
</ul>
</div>
</div>
</div>
</div>
...
@@ -333,7 +342,7 @@
...
@@ -333,7 +342,7 @@
{{/foreach}}
{{/foreach}}
{{/if}}
{{/if}}
</ul>
</ul>
<
label
class=
"business-operations-submit content-app-items-add-sub"
>
+添加手机详情
</label
>
<
span
class=
"business-operations-submit content-app-items-add-sub"
>
+添加手机详情
</span
>
</div>
</div>
<!-- web内容 -->
<!-- web内容 -->
...
...
application/admin/view/default/public/header.html
浏览文件 @
d865872b
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/common/lib/amazeui-chosen/amazeui.chosen.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/common/lib/amazeui-chosen/amazeui.chosen.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/common/lib/amazeui-tagsinput/amazeui.tagsinput.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/common/lib/amazeui-tagsinput/amazeui.tagsinput.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/common/css/common.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/common/css/common.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/
A
dmin/{{$default_theme}}/css/common.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/
a
dmin/{{$default_theme}}/css/common.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/
A
dmin/{{$default_theme}}/css/iconfontmenu.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/
a
dmin/{{$default_theme}}/css/iconfontmenu.css"
/>
{{if !empty($module_css)}}
{{if !empty($module_css)}}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/{{$module_css}}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{$Think.__MY_ROOT__}}static/{{$module_css}}"
/>
{{/if}}
{{/if}}
...
...
application/index/view/default/goods/index.html
浏览文件 @
d865872b
{{include file="public/header" /}}
{{include file="public/header" /}}
<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->
<!-- header top nav -->
<!-- header top nav -->
{{include file="public/header_top_nav" /}}
{{include file="public/header_top_nav" /}}
...
@@ -48,9 +44,7 @@
...
@@ -48,9 +44,7 @@
<div
class=
"box"
>
<div
class=
"box"
>
<div
class=
"tb-booth tb-pic tb-s310"
>
<div
class=
"tb-booth tb-pic tb-s310"
>
{{if !empty($goods['photo'][0])}}
{{if !empty($goods['photo'][0])}}
<a
href=
"{{$goods['photo'][0]['images']}}"
>
<img
src=
"{{$goods['photo'][0]['images']}}"
alt=
"{{$goods.title}}"
rel=
"{{$goods['photo'][0]['images']}}"
class=
"jqzoom"
/>
<img
src=
"{{$goods['photo'][0]['images']}}"
alt=
"{{$goods.title}}"
rel=
"{{:str_replace('compr', 'original', $goods['photo'][0]['images'])}}"
class=
"jqzoom"
/>
</a>
{{/if}}
{{/if}}
</div>
</div>
<ul
class=
"tb-thumb"
id=
"thumblist"
>
<ul
class=
"tb-thumb"
id=
"thumblist"
>
...
@@ -59,7 +53,7 @@
...
@@ -59,7 +53,7 @@
<li
class=
"{{if $photo_key eq 0}}tb-selected{{else /}} tb-pic{{/if}}"
>
<li
class=
"{{if $photo_key eq 0}}tb-selected{{else /}} tb-pic{{/if}}"
>
<div
class=
"tb-pic tb-s40"
>
<div
class=
"tb-pic tb-s40"
>
<a
href=
"javascript:;"
>
<a
href=
"javascript:;"
>
<img
src=
"{{$photo.images}}"
mid=
"{{$photo.images}}"
big=
"{{
:str_replace('compr', 'original', $photo.images)
}}"
class=
"tb-s40"
/>
<img
src=
"{{$photo.images}}"
mid=
"{{$photo.images}}"
big=
"{{
$photo.images
}}"
class=
"tb-s40"
/>
</a>
</a>
</div>
</div>
</li>
</li>
...
@@ -100,7 +94,7 @@
...
@@ -100,7 +94,7 @@
<dt>
促销价
</dt>
<dt>
促销价
</dt>
<dd>
<dd>
<em>
¥
</em>
<em>
¥
</em>
<b
class=
"sys_item_price"
>
{{$goods.price}}
</b>
<b
class=
"sys_item_price"
data-original-price=
"{{$goods.price}}"
>
{{$goods.price}}
</b>
</dd>
</dd>
</div>
</div>
<div
class=
"goods-qrcode am-hide-sm-only"
>
<div
class=
"goods-qrcode am-hide-sm-only"
>
...
@@ -143,14 +137,19 @@
...
@@ -143,14 +137,19 @@
<div
class=
"theme-popbod dform"
>
<div
class=
"theme-popbod dform"
>
<form
class=
"theme-signin"
name=
"loginform"
action=
"javascript:;"
>
<form
class=
"theme-signin"
name=
"loginform"
action=
"javascript:;"
>
<div
class=
"theme-signin-left"
>
<div
class=
"theme-signin-left"
>
{{if !empty($goods['specifications'])}}
{{if !empty($goods['specifications']
['type']
)}}
{{foreach $goods.specifications as $key=>$spec}}
{{foreach $goods.specifications
.type
as $key=>$spec}}
{{if !empty($spec['value'])}}
{{if !empty($spec['value'])}}
<div
class=
"theme-options sku-items"
>
<div
class=
"theme-options sku-items"
>
<div
class=
"cart-title"
>
{{$spec.name}}
</div>
<div
class=
"cart-title"
>
{{$spec.name}}
</div>
<ul>
<ul>
{{foreach $spec.value as $keys=>$specs}}
{{foreach $spec.value as $keys=>$specs}}
<li
class=
"sku-line {{if $key gt 0}} sku-dont-choose{{/if}}"
data-type-value=
"{{$spec.name}}"
data-value=
"{{$specs}}"
>
{{$specs}}
<i></i></li>
<li
class=
"sku-line {{if !empty($goods['specifications']['images'][$specs])}} sku-line-images{{/if}} {{if $key gt 0}} sku-dont-choose{{/if}}"
data-type-value=
"{{$spec.name}}"
data-value=
"{{$specs}}"
{{
if
!
empty
($
goods
['
specifications
']['
images
'][$
specs
])}}
data-type-images=
"{{$goods.specifications.images[$specs]}}"
{{/
if
}}
>
{{if !empty($goods['specifications']['images'][$specs])}}
<img
src=
"{{$goods.specifications.images[$specs]}}"
/>
{{/if}}
{{$specs}}
<i></i>
</li>
{{/foreach}}
{{/foreach}}
</ul>
</ul>
</div>
</div>
...
@@ -162,10 +161,10 @@
...
@@ -162,10 +161,10 @@
<dd>
<dd>
<div
class=
"am-input-group am-input-group-sm number-tag"
>
<div
class=
"am-input-group am-input-group-sm number-tag"
>
<button
class=
"am-input-group-label"
id=
"min"
type=
"button"
>
-
</button>
<button
class=
"am-input-group-label"
id=
"min"
type=
"button"
>
-
</button>
<input
type=
"number"
class=
"am-form-field"
value=
"1"
id=
"text_box"
min=
"1"
max=
"{{$goods.inventory}}"
/>
<input
type=
"number"
class=
"am-form-field"
value=
"1"
id=
"text_box"
min=
"1"
max=
"{{$goods.inventory}}"
data-original-max=
"{{$goods.inventory}}"
/>
<button
class=
"am-input-group-label"
id=
"add"
type=
"button"
>
+
</button>
<button
class=
"am-input-group-label"
id=
"add"
type=
"button"
>
+
</button>
</div>
</div>
<span
class=
"tb-hidden stock-tips"
>
库存
<span
class=
"stock"
>
{{$goods.inventory}}
</span>
{{$goods.inventory_unit}}
</span>
<span
class=
"tb-hidden stock-tips"
>
库存
<span
class=
"stock"
data-original-stock=
"{{$goods.inventory}}"
>
{{$goods.inventory}}
</span>
{{$goods.inventory_unit}}
</span>
</dd>
</dd>
</div>
</div>
...
@@ -179,7 +178,7 @@
...
@@ -179,7 +178,7 @@
<img
src=
"{{$goods.images}}"
/>
<img
src=
"{{$goods.images}}"
/>
</div>
</div>
<div
class=
"text-info"
>
<div
class=
"text-info"
>
<span
class=
"price-now"
>
¥{{$goods.price}}
</span>
<span
class=
"price-now"
data-original-price=
"{{$goods.price}}"
>
¥{{$goods.price}}
</span>
</div>
</div>
</div>
</div>
</form>
</form>
...
...
application/index/view/default/public/header.html
浏览文件 @
d865872b
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
var
__my_url__
=
'
{{:__MY_URL__}}
'
;
var
__my_url__
=
'
{{:__MY_URL__}}
'
;
var
__public__
=
'
{{$Think.__MY_ROOT__}}
'
;
var
__public__
=
'
{{$Think.__MY_ROOT__}}
'
;
var
__default_theme__
=
'
{{$default_theme}}
'
;
var
__default_theme__
=
'
{{$default_theme}}
'
;
var
__modal_login_url__
=
'
{{:Url(
'
index
/
User
/
ModalLoginI
nfo
'
)}}
'
;
var
__modal_login_url__
=
'
{{:Url(
'
index
/
user
/
modallogini
nfo
'
)}}
'
;
var
__user_id__
=
{{
if
empty
(
$user
[
'
id
'
])}}
0
{{
else
/}}{{$user.id}}{{/i
f
}};
var
__user_id__
=
{{
if
empty
(
$user
[
'
id
'
])}}
0
{{
else
/}}{{$user.id}}{{/i
f
}};
</script>
</script>
</head>
</head>
...
...
application/service/GoodsService.php
浏览文件 @
d865872b
...
@@ -106,19 +106,19 @@ class GoodsService
...
@@ -106,19 +106,19 @@ class GoodsService
{
{
if
(
!
empty
(
$data
)
&&
is_array
(
$data
))
if
(
!
empty
(
$data
)
&&
is_array
(
$data
))
{
{
$image
s
_host
=
config
(
'IMAGE_HOST'
);
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$data
as
&
$v
)
foreach
(
$data
as
&
$v
)
{
{
if
(
is_array
(
$v
))
if
(
is_array
(
$v
))
{
{
if
(
isset
(
$v
[
'icon'
]))
if
(
isset
(
$v
[
'icon'
]))
{
{
$v
[
'icon'
]
=
empty
(
$v
[
'icon'
])
?
null
:
$image
s
_host
.
$v
[
'icon'
];
$v
[
'icon'
]
=
empty
(
$v
[
'icon'
])
?
null
:
$image_host
.
$v
[
'icon'
];
}
}
if
(
isset
(
$v
[
'big_images'
]))
if
(
isset
(
$v
[
'big_images'
]))
{
{
$v
[
'big_images_old'
]
=
$v
[
'big_images'
];
$v
[
'big_images_old'
]
=
$v
[
'big_images'
];
$v
[
'big_images'
]
=
empty
(
$v
[
'big_images'
])
?
null
:
$image
s
_host
.
$v
[
'big_images'
];
$v
[
'big_images'
]
=
empty
(
$v
[
'big_images'
])
?
null
:
$image_host
.
$v
[
'big_images'
];
}
}
}
}
}
}
...
@@ -236,7 +236,7 @@ class GoodsService
...
@@ -236,7 +236,7 @@ class GoodsService
$is_category
=
(
isset
(
$params
[
'is_category'
])
&&
$params
[
'is_category'
]
==
true
)
?
true
:
false
;
$is_category
=
(
isset
(
$params
[
'is_category'
])
&&
$params
[
'is_category'
]
==
true
)
?
true
:
false
;
// 开始处理数据
// 开始处理数据
$image
s
_host
=
config
(
'IMAGE_HOST'
);
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$data
as
&
$v
)
foreach
(
$data
as
&
$v
)
{
{
// 商品url地址
// 商品url地址
...
@@ -249,21 +249,21 @@ class GoodsService
...
@@ -249,21 +249,21 @@ class GoodsService
if
(
isset
(
$v
[
'images'
]))
if
(
isset
(
$v
[
'images'
]))
{
{
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image
s
_host
.
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image_host
.
$v
[
'images'
];
}
}
// 视频
// 视频
if
(
isset
(
$v
[
'video'
]))
if
(
isset
(
$v
[
'video'
]))
{
{
$v
[
'video_old'
]
=
$v
[
'video'
];
$v
[
'video_old'
]
=
$v
[
'video'
];
$v
[
'video'
]
=
empty
(
$v
[
'video'
])
?
null
:
$image
s
_host
.
$v
[
'video'
];
$v
[
'video'
]
=
empty
(
$v
[
'video'
])
?
null
:
$image_host
.
$v
[
'video'
];
}
}
// 商品首页推荐图片,不存在则使用商品封面图片
// 商品首页推荐图片,不存在则使用商品封面图片
if
(
isset
(
$v
[
'home_recommended_images'
]))
if
(
isset
(
$v
[
'home_recommended_images'
]))
{
{
$v
[
'home_recommended_images_old'
]
=
$v
[
'home_recommended_images'
];
$v
[
'home_recommended_images_old'
]
=
$v
[
'home_recommended_images'
];
$v
[
'home_recommended_images'
]
=
empty
(
$v
[
'home_recommended_images'
])
?
(
empty
(
$v
[
'images'
])
?
null
:
$v
[
'images'
])
:
$image
s
_host
.
$v
[
'home_recommended_images'
];
$v
[
'home_recommended_images'
]
=
empty
(
$v
[
'home_recommended_images'
])
?
(
empty
(
$v
[
'images'
])
?
null
:
$v
[
'images'
])
:
$image_host
.
$v
[
'home_recommended_images'
];
}
}
// PC内容处理
// PC内容处理
...
@@ -305,7 +305,7 @@ class GoodsService
...
@@ -305,7 +305,7 @@ class GoodsService
foreach
(
$v
[
'photo'
]
as
&
$vs
)
foreach
(
$v
[
'photo'
]
as
&
$vs
)
{
{
$vs
[
'images_old'
]
=
$vs
[
'images'
];
$vs
[
'images_old'
]
=
$vs
[
'images'
];
$vs
[
'images'
]
=
$image
s
_host
.
$vs
[
'images'
];
$vs
[
'images'
]
=
$image_host
.
$vs
[
'images'
];
}
}
}
}
}
}
...
@@ -341,11 +341,11 @@ class GoodsService
...
@@ -341,11 +341,11 @@ class GoodsService
$data
=
Db
::
name
(
'GoodsContentApp'
)
->
where
([
'goods_id'
=>
$params
[
'goods_id'
]])
->
field
(
'id,images,content'
)
->
order
(
'sort asc'
)
->
select
();
$data
=
Db
::
name
(
'GoodsContentApp'
)
->
where
([
'goods_id'
=>
$params
[
'goods_id'
]])
->
field
(
'id,images,content'
)
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
))
if
(
!
empty
(
$data
))
{
{
$image
s
_host
=
config
(
'IMAGE_HOST'
);
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$data
as
&
$v
)
foreach
(
$data
as
&
$v
)
{
{
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image
s
_host
.
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image_host
.
$v
[
'images'
];
$v
[
'content_old'
]
=
$v
[
'content'
];
$v
[
'content_old'
]
=
$v
[
'content'
];
$v
[
'content'
]
=
empty
(
$v
[
'content'
])
?
null
:
explode
(
"
\n
"
,
$v
[
'content'
]);
$v
[
'content'
]
=
empty
(
$v
[
'content'
])
?
null
:
explode
(
"
\n
"
,
$v
[
'content'
]);
}
}
...
@@ -364,16 +364,32 @@ class GoodsService
...
@@ -364,16 +364,32 @@ class GoodsService
*/
*/
public
static
function
GoodsSpecifications
(
$params
=
[])
public
static
function
GoodsSpecifications
(
$params
=
[])
{
{
$data
=
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
$params
[
'goods_id'
]])
->
order
(
'id asc'
)
->
select
();
// 条件
if
(
!
empty
(
$data
))
$where
=
[
'goods_id'
=>
$params
[
'goods_id'
]];
// 规格类型
$type
=
Db
::
name
(
'GoodsSpecType'
)
->
where
(
$where
)
->
order
(
'id asc'
)
->
select
();
if
(
!
empty
(
$type
))
{
{
foreach
(
$
data
as
&
$v
)
foreach
(
$
type
as
&
$temp_type
)
{
{
$
v
[
'value'
]
=
json_decode
(
$v
[
'value'
],
true
);
$
temp_type
[
'value'
]
=
json_decode
(
$temp_type
[
'value'
],
true
);
$
v
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
);
$
temp_type
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
);
}
}
}
}
return
$data
;
// 规格图片
$images
=
Db
::
name
(
'GoodsSpecImages'
)
->
where
(
$where
)
->
column
(
'name,images'
);
if
(
!
empty
(
$images
))
{
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$images
as
&
$temp_iamges
)
{
$temp_iamges
=
$image_host
.
$temp_iamges
;
}
}
return
[
'type'
=>
$type
,
'images'
=>
$images
];
}
}
/**
/**
...
@@ -562,12 +578,12 @@ class GoodsService
...
@@ -562,12 +578,12 @@ class GoodsService
$data
=
Db
::
name
(
'GoodsFavor'
)
->
alias
(
'f'
)
->
join
([
'__GOODS__'
=>
'g'
],
'g.id=f.goods_id'
)
->
field
(
$field
)
->
where
(
$where
)
->
limit
(
$m
,
$n
)
->
order
(
$order_by
)
->
select
();
$data
=
Db
::
name
(
'GoodsFavor'
)
->
alias
(
'f'
)
->
join
([
'__GOODS__'
=>
'g'
],
'g.id=f.goods_id'
)
->
field
(
$field
)
->
where
(
$where
)
->
limit
(
$m
,
$n
)
->
order
(
$order_by
)
->
select
();
if
(
!
empty
(
$data
))
if
(
!
empty
(
$data
))
{
{
$image
s
_host
=
config
(
'IMAGE_HOST'
);
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$data
as
&
$v
)
foreach
(
$data
as
&
$v
)
{
{
// 图片
// 图片
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image
s
_host
.
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image_host
.
$v
[
'images'
];
$v
[
'goods_url'
]
=
HomeUrl
(
'goods'
,
'index'
,
[
'id'
=>
$v
[
'goods_id'
]]);
$v
[
'goods_url'
]
=
HomeUrl
(
'goods'
,
'index'
,
[
'id'
=>
$v
[
'goods_id'
]]);
}
}
...
@@ -709,11 +725,11 @@ class GoodsService
...
@@ -709,11 +725,11 @@ class GoodsService
$data
=
Db
::
name
(
'GoodsBrowse'
)
->
alias
(
'b'
)
->
join
([
'__GOODS__'
=>
'g'
],
'g.id=b.goods_id'
)
->
field
(
$field
)
->
where
(
$where
)
->
limit
(
$m
,
$n
)
->
order
(
$order_by
)
->
select
();
$data
=
Db
::
name
(
'GoodsBrowse'
)
->
alias
(
'b'
)
->
join
([
'__GOODS__'
=>
'g'
],
'g.id=b.goods_id'
)
->
field
(
$field
)
->
where
(
$where
)
->
limit
(
$m
,
$n
)
->
order
(
$order_by
)
->
select
();
if
(
!
empty
(
$data
))
if
(
!
empty
(
$data
))
{
{
$image
s
_host
=
config
(
'IMAGE_HOST'
);
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$data
as
&
$v
)
foreach
(
$data
as
&
$v
)
{
{
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images_old'
]
=
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image
s
_host
.
$v
[
'images'
];
$v
[
'images'
]
=
empty
(
$v
[
'images'
])
?
null
:
$image_host
.
$v
[
'images'
];
$v
[
'goods_url'
]
=
HomeUrl
(
'goods'
,
'index'
,
[
'id'
=>
$v
[
'goods_id'
]]);
$v
[
'goods_url'
]
=
HomeUrl
(
'goods'
,
'index'
,
[
'id'
=>
$v
[
'goods_id'
]]);
}
}
}
}
...
@@ -1069,6 +1085,7 @@ class GoodsService
...
@@ -1069,6 +1085,7 @@ class GoodsService
{
{
$data
=
[];
$data
=
[];
$title
=
[];
$title
=
[];
$images
=
[];
// 规格值
// 规格值
foreach
(
$params
as
$k
=>
$v
)
foreach
(
$params
as
$k
=>
$v
)
...
@@ -1092,7 +1109,7 @@ class GoodsService
...
@@ -1092,7 +1109,7 @@ class GoodsService
// 规格名称
// 规格名称
if
(
!
empty
(
$data
[
0
]))
if
(
!
empty
(
$data
[
0
]))
{
{
$count
=
count
(
$data
[
0
])
-
5
;
$count
=
count
(
$data
[
0
])
-
6
;
if
(
$count
>
0
)
if
(
$count
>
0
)
{
{
$names
=
array_slice
(
$data
[
0
],
0
,
$count
);
$names
=
array_slice
(
$data
[
0
],
0
,
$count
);
...
@@ -1130,7 +1147,14 @@ class GoodsService
...
@@ -1130,7 +1147,14 @@ class GoodsService
}
else
{
}
else
{
return
DataReturn
(
'请填写规格'
,
-
1
);
return
DataReturn
(
'请填写规格'
,
-
1
);
}
}
return
DataReturn
(
'success'
,
0
,
[
'data'
=>
$data
,
'title'
=>
$title
]);
// 规格图片
if
(
!
empty
(
$params
[
'spec_images'
]))
{
$images
=
$params
[
'spec_images'
];
}
return
DataReturn
(
'success'
,
0
,
[
'data'
=>
$data
,
'title'
=>
$title
,
'images'
=>
$images
]);
}
}
/**
/**
...
@@ -1310,6 +1334,7 @@ class GoodsService
...
@@ -1310,6 +1334,7 @@ class GoodsService
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecValue'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecValue'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecBase'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecBase'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecImages'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
// 类型
// 类型
if
(
!
empty
(
$data
[
'title'
]))
if
(
!
empty
(
$data
[
'title'
]))
...
@@ -1317,7 +1342,7 @@ class GoodsService
...
@@ -1317,7 +1342,7 @@ class GoodsService
foreach
(
$data
[
'title'
]
as
&
$v
)
foreach
(
$data
[
'title'
]
as
&
$v
)
{
{
$v
[
'goods_id'
]
=
$goods_id
;
$v
[
'goods_id'
]
=
$goods_id
;
$v
[
'value'
]
=
json_encode
(
$v
[
'value'
]
);
$v
[
'value'
]
=
json_encode
(
array_values
(
$v
[
'value'
])
);
$v
[
'add_time'
]
=
time
();
$v
[
'add_time'
]
=
time
();
}
}
if
(
Db
::
name
(
'GoodsSpecType'
)
->
insertAll
(
$data
[
'title'
])
<
count
(
$data
[
'title'
]))
if
(
Db
::
name
(
'GoodsSpecType'
)
->
insertAll
(
$data
[
'title'
])
<
count
(
$data
[
'title'
]))
...
@@ -1331,10 +1356,11 @@ class GoodsService
...
@@ -1331,10 +1356,11 @@ class GoodsService
{
{
// 基础字段
// 基础字段
$count
=
count
(
$data
[
'data'
][
0
]);
$count
=
count
(
$data
[
'data'
][
0
]);
$temp_key
=
[
'price'
,
'inventory'
,
'coding'
,
'barcode'
,
'original_price'
];
$temp_key
=
[
'price'
,
'inventory'
,
'weight'
,
'coding'
,
'barcode'
,
'original_price'
];
$key_count
=
count
(
$temp_key
);
// 等于
5
则只有一列基础规格
// 等于
key总数
则只有一列基础规格
if
(
$count
==
5
)
if
(
$count
==
$key_count
)
{
{
$temp_data
=
[
$temp_data
=
[
'goods_id'
=>
$goods_id
,
'goods_id'
=>
$goods_id
,
...
@@ -1352,7 +1378,7 @@ class GoodsService
...
@@ -1352,7 +1378,7 @@ class GoodsService
// 多规格操作
// 多规格操作
}
else
{
}
else
{
$base_start
=
$count
-
5
;
$base_start
=
$count
-
$key_count
;
$value
=
[];
$value
=
[];
$base
=
[];
$base
=
[];
foreach
(
$data
[
'data'
]
as
$v
)
foreach
(
$data
[
'data'
]
as
$v
)
...
@@ -1395,6 +1421,26 @@ class GoodsService
...
@@ -1395,6 +1421,26 @@ class GoodsService
}
}
}
}
}
}
// 规格图片
if
(
!
empty
(
$data
[
'images'
]))
{
$images
=
[];
foreach
(
$data
[
'images'
]
as
$k
=>
$v
)
{
$images
[]
=
[
'goods_id'
=>
$goods_id
,
'name'
=>
$k
,
'images'
=>
ResourcesService
::
AttachmentPathHandle
(
$v
),
'add_time'
=>
time
(),
];
}
if
(
Db
::
name
(
'GoodsSpecImages'
)
->
insertAll
(
$images
)
<
count
(
$images
))
{
return
DataReturn
(
'规格图片添加失败'
,
-
1
);
}
}
return
DataReturn
(
'添加成功'
,
0
);
return
DataReturn
(
'添加成功'
,
0
);
}
}
...
@@ -1556,7 +1602,7 @@ class GoodsService
...
@@ -1556,7 +1602,7 @@ class GoodsService
{
{
foreach
(
$value
as
$k
=>&
$v
)
foreach
(
$value
as
$k
=>&
$v
)
{
{
$base
=
Db
::
name
(
'GoodsSpecBase'
)
->
fi
eld
(
'price,inventory,coding,barcode,original_price'
)
->
fi
nd
(
$k
);
$base
=
Db
::
name
(
'GoodsSpecBase'
)
->
find
(
$k
);
$v
[]
=
[
$v
[]
=
[
'data_type'
=>
'base'
,
'data_type'
=>
'base'
,
'data'
=>
$base
,
'data'
=>
$base
,
...
@@ -1564,16 +1610,29 @@ class GoodsService
...
@@ -1564,16 +1610,29 @@ class GoodsService
}
}
}
}
}
else
{
}
else
{
$base
=
Db
::
name
(
'GoodsSpecBase'
)
->
where
(
$where
)
->
fi
eld
(
'price,inventory,coding,barcode,original_price'
)
->
fi
nd
();
$base
=
Db
::
name
(
'GoodsSpecBase'
)
->
where
(
$where
)
->
find
();
$value
[][]
=
[
$value
[][]
=
[
'data_type'
=>
'base'
,
'data_type'
=>
'base'
,
'data'
=>
$base
,
'data'
=>
$base
,
];
];
}
}
// 规格图片
$images
=
Db
::
name
(
'GoodsSpecImages'
)
->
where
(
$where
)
->
select
();
if
(
!
empty
(
$images
))
{
$image_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$images
as
&
$temp_iamges
)
{
$temp_iamges
[
'images_old'
]
=
$temp_iamges
[
'images'
];
$temp_iamges
[
'images'
]
=
$image_host
.
$temp_iamges
[
'images'
];
}
}
return
[
return
[
'type'
=>
$type
,
'type'
=>
$type
,
'value'
=>
array_values
(
$value
),
'value'
=>
array_values
(
$value
),
'images'
=>
$images
,
];
];
}
}
...
...
application/service/ResourcesService.php
浏览文件 @
d865872b
...
@@ -49,7 +49,7 @@ class ResourcesService
...
@@ -49,7 +49,7 @@ class ResourcesService
*/
*/
public
static
function
AttachmentPathHandle
(
$value
)
public
static
function
AttachmentPathHandle
(
$value
)
{
{
return
str_replace
([
__MY_URL__
,
__MY_ROOT__
],
DS
,
$value
);
return
empty
(
$value
)
?
''
:
str_replace
([
__MY_URL__
,
__MY_ROOT__
],
DS
,
$value
);
}
}
/**
/**
...
...
public/install/shopxo_tp5.sql
浏览文件 @
d865872b
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
public/static/admin/default/images/default-images.png
查看替换文件 @
6a419a66
浏览文件 @
d865872b
5.9 KB
|
W:
|
H:
5.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
public/static/admin/default/js/goods.js
浏览文件 @
d865872b
...
@@ -20,13 +20,13 @@ $(function()
...
@@ -20,13 +20,13 @@ $(function()
var
index
=
parseInt
(
Math
.
random
()
*
1000001
);
var
index
=
parseInt
(
Math
.
random
()
*
1000001
);
html
=
'
<th class="table-title table-title-
'
+
index
+
'
">
'
;
html
=
'
<th class="table-title table-title-
'
+
index
+
'
">
'
;
html
+=
'
<i class="am-close am-close-spin title-nav-remove" data-index="
'
+
index
+
'
">×</i>
'
;
html
+=
'
<i class="am-close am-close-spin title-nav-remove" data-index="
'
+
index
+
'
">×</i>
'
;
html
+=
'
<input type="text" name="specifications_name_
'
+
index
+
'
" placeholder="规格名" />
'
;
html
+=
'
<input type="text" name="specifications_name_
'
+
index
+
'
" placeholder="规格名"
class="am-radius" data-validation-message="请填写规格名" required
/>
'
;
html
+=
'
</th>
'
;
html
+=
'
</th>
'
;
$
(
'
.title-start
'
).
before
(
html
);
$
(
'
.title-start
'
).
before
(
html
);
// value
// value
html
=
'
<td class="table-value table-value-
'
+
index
+
'
">
'
;
html
=
'
<td class="table-value table-value-
'
+
index
+
'
">
'
;
html
+=
'
<input type="text" name="specifications_value_
'
+
index
+
'
[]" placeholder="规格值" />
'
;
html
+=
'
<input type="text" name="specifications_value_
'
+
index
+
'
[]" placeholder="规格值"
class="am-radius" data-validation-message="请填写规格值" required
/>
'
;
html
+=
'
</td>
'
;
html
+=
'
</td>
'
;
$
(
'
.value-start
'
).
before
(
html
);
$
(
'
.value-start
'
).
before
(
html
);
...
@@ -35,7 +35,7 @@ $(function()
...
@@ -35,7 +35,7 @@ $(function()
});
});
// 规格列移除
// 规格列移除
$
(
'
.specifications-table
'
).
on
(
'
click
'
,
'
.title-nav-remove
'
,
function
()
$
(
document
).
on
(
'
click
'
,
'
.specifications-table
.title-nav-remove
'
,
function
()
{
{
var
index
=
$
(
this
).
data
(
'
index
'
);
var
index
=
$
(
this
).
data
(
'
index
'
);
$
(
'
.table-title-
'
+
index
).
remove
();
$
(
'
.table-title-
'
+
index
).
remove
();
...
@@ -78,7 +78,7 @@ $(function()
...
@@ -78,7 +78,7 @@ $(function()
});
});
// 规格行复制
// 规格行复制
$
(
'
.specifications-table
'
).
on
(
'
click
'
,
'
.line-copy
'
,
function
()
$
(
document
).
on
(
'
click
'
,
'
.specifications-table
.line-copy
'
,
function
()
{
{
var
$parent
=
$
(
this
).
parents
(
'
tr
'
);
var
$parent
=
$
(
this
).
parents
(
'
tr
'
);
$parent
.
find
(
'
input
'
).
each
(
function
(
k
,
v
)
$parent
.
find
(
'
input
'
).
each
(
function
(
k
,
v
)
...
@@ -92,7 +92,7 @@ $(function()
...
@@ -92,7 +92,7 @@ $(function()
});
});
// 规格行移除
// 规格行移除
$
(
'
.specifications-table
'
).
on
(
'
click
'
,
'
.line-remove
'
,
function
()
$
(
document
).
on
(
'
click
'
,
'
.specifications-table
.line-remove
'
,
function
()
{
{
$
(
this
).
parents
(
'
tr
'
).
remove
();
$
(
this
).
parents
(
'
tr
'
).
remove
();
...
@@ -114,7 +114,7 @@ $(function()
...
@@ -114,7 +114,7 @@ $(function()
});
});
// 规格第一列输入事件
// 规格第一列输入事件
$
(
'
.specifications-table tbody tr
'
).
on
(
'
change
'
,
'
td:eq(0)
input
'
,
function
()
$
(
document
).
on
(
'
change
'
,
'
.specifications-table tbody tr td.table-value
input
'
,
function
()
{
{
// 规格图片
// 规格图片
SpecImagesHandle
();
SpecImagesHandle
();
...
@@ -125,25 +125,36 @@ $(function()
...
@@ -125,25 +125,36 @@ $(function()
{
{
if
(
$
(
'
.spec-images-tips input
'
).
prop
(
'
checked
'
))
if
(
$
(
'
.spec-images-tips input
'
).
prop
(
'
checked
'
))
{
{
// 清空规格
$
(
'
ul.spec-images-list
'
).
html
(
''
);
// 获取第一列数据值
var
temp_spec_all
=
{},
spec_all
=
[];
var
temp_spec_all
=
{},
spec_all
=
[];
$
(
'
.specifications-table tbody tr
'
).
each
(
function
(
k
,
v
)
$
(
'
.specifications-table tbody tr
'
).
each
(
function
(
k
,
v
)
{
{
var
value
=
$
(
this
).
find
(
'
td:eq(0) input
'
).
val
();
var
value
=
$
(
this
).
find
(
'
td.table-value:eq(0) input
'
).
val
();
temp_spec_all
[
value
]
=
value
;
if
((
value
||
null
)
!=
null
)
{
temp_spec_all
[
value
]
=
value
;
}
});
});
spec_all
=
Object
.
keys
(
temp_spec_all
);
spec_all
=
Object
.
keys
(
temp_spec_all
);
console
.
log
(
spec_all
)
// 添加规格图片
if
(
spec_all
.
length
>
0
)
if
(
spec_all
.
length
>
0
)
{
{
$
(
'
.spec-images-list
'
).
show
();
for
(
var
i
in
spec_all
)
for
(
var
i
in
spec_all
)
{
{
var
temp_class
=
'
spec-images-items-
'
+
spec_all
[
i
];
var
temp_class
=
'
spec-images-items-
'
+
spec_all
[
i
];
if
(
$
(
'
ul.spec-images-list
'
).
find
(
'
.
'
+
temp_class
).
length
<=
0
)
if
(
$
(
'
ul.spec-images-list
'
).
find
(
'
.
'
+
temp_class
).
length
<=
0
)
{
{
var
html
=
'
<li class="
'
+
temp_class
+
'
">
'
;
var
html
=
'
<li class="
'
+
temp_class
+
'
">
'
;
html
+=
'
<input type="text" value="
'
+
spec_all
[
i
]
+
'
" disabled="disabled" />
'
html
+=
'
<input type="text" value="
'
+
spec_all
[
i
]
+
'
"
class="am-radius t-c"
disabled="disabled" />
'
html
+=
'
<ul class="plug-file-upload-view spec-images-view-
'
+
spec_all
[
i
]
+
'
" data-form-name="spec_images[]" data-max-number="1" data-delete="0" data-dialog-type="images">
'
;
html
+=
'
<ul class="plug-file-upload-view spec-images-view-
'
+
spec_all
[
i
]
+
'
" data-form-name="spec_images[
'
+
spec_all
[
i
]
+
'
]" data-max-number="1" data-delete="0" data-dialog-type="images">
'
;
html
+=
'
<li>
'
;
html
+=
'
<li>
'
;
html
+=
'
<input type="
hidden" name="spec_images[]" value=""
/>
'
;
html
+=
'
<input type="
text" name="spec_images[
'
+
spec_all
[
i
]
+
'
]" value="" data-validation-message="请上传规格图片" required
/>
'
;
html
+=
'
<img src="
'
+
__image_host__
+
'
/static/admin/default/images/default-images.png" />
'
;
html
+=
'
<img src="
'
+
__image_host__
+
'
/static/admin/default/images/default-images.png" />
'
;
html
+=
'
</li>
'
;
html
+=
'
</li>
'
;
html
+=
'
</ul>
'
;
html
+=
'
</ul>
'
;
...
@@ -152,9 +163,12 @@ $(function()
...
@@ -152,9 +163,12 @@ $(function()
$
(
'
ul.spec-images-list
'
).
append
(
html
);
$
(
'
ul.spec-images-list
'
).
append
(
html
);
}
}
}
}
}
else
{
$
(
'
.spec-images-list
'
).
hide
();
}
}
}
else
{
}
else
{
$
(
'
ul.spec-images-list
'
).
html
(
''
);
$
(
'
ul.spec-images-list
'
).
html
(
''
);
$
(
'
.spec-images-list
'
).
hide
();
}
}
}
}
...
...
public/static/index/default/css/goods.css
浏览文件 @
d865872b
...
@@ -38,8 +38,10 @@ input{font-size:12px;font-size:100%;outline:none;line-height:normal;color:#444;}
...
@@ -38,8 +38,10 @@ input{font-size:12px;font-size:100%;outline:none;line-height:normal;color:#444;}
.theme-signin-left
{
padding-bottom
:
30px
;
max-height
:
250px
;
overflow-y
:
scroll
;
background
:
#fff
;}
.theme-signin-left
{
padding-bottom
:
30px
;
max-height
:
250px
;
overflow-y
:
scroll
;
background
:
#fff
;}
.theme-options
{
display
:
block
;
overflow
:
hidden
;
padding-left
:
10px
;
padding-right
:
10px
;
margin-bottom
:
5px
;}
.theme-options
{
display
:
block
;
overflow
:
hidden
;
padding-left
:
10px
;
padding-right
:
10px
;
margin-bottom
:
5px
;}
.theme-signin-left
.cart-title
{
font-size
:
14px
;
font-weight
:
600
;}
.theme-signin-left
.cart-title
{
font-size
:
14px
;
font-weight
:
600
;}
.theme-signin-left
.sku-line
{
float
:
left
;
margin
:
10px
;
margin-left
:
0
;
border-radius
:
3px
;
background
:
#efefef
;
padding
:
0px
8px
;
border
:
1px
solid
#efefef
;}
.theme-signin-left
.sku-line
{
float
:
left
;
margin
:
10px
;
margin-left
:
0
;
border-radius
:
3px
;
background
:
#efefef
;
padding
:
0px
8px
;
border
:
1px
solid
#d5d5d5
;}
.theme-signin-left
.sku-line.selected
{
background
:
#e23f36
;
color
:
#fff
;
border
:
1px
solid
#e33d2f
;}
.theme-signin-left
.sku-line.selected
{
background
:
#d2364c
;
color
:
#fff
;
border
:
1px
solid
#d2364c
;}
.sku-line-images
{
padding
:
3px
!important
;
}
.sku-line-images
img
{
width
:
30px
;
height
:
30px
;
}
.theme-signin
.btn
{
width
:
100%
;
font-size
:
16px
;
padding
:
5px
;}
.theme-signin
.btn
{
width
:
100%
;
font-size
:
16px
;
padding
:
5px
;}
.btn-op
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
z-index
:
3
;}
.btn-op
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
z-index
:
3
;}
...
@@ -463,4 +465,7 @@ li.am-comment{ width:100%}
...
@@ -463,4 +465,7 @@ li.am-comment{ width:100%}
/* 视频操作 */
/* 视频操作 */
.scoll
.goods-video-submit-close
{
bottom
:
50px
;
}
.scoll
.goods-video-submit-close
{
bottom
:
50px
;
}
/* 底部 */
.am-footer
{
padding-bottom
:
55px
;
}
}
}
\ No newline at end of file
public/static/index/default/js/goods.js
浏览文件 @
d865872b
// 规格弹窗PC显示
// 规格弹窗PC显示
function
poptit_pc_show
()
function
poptit_pc_show
()
{
{
$
(
document
.
body
).
css
(
"
position
"
,
"
static
"
);
$
(
document
.
body
).
css
(
'
position
'
,
'
static
'
);
$
(
'
.theme-signin-left
'
).
scrollTop
(
0
);
$
(
'
.theme-signin-left
'
).
scrollTop
(
0
);
$
(
'
.theme-popover-mask
'
).
hide
();
$
(
'
.theme-popover-mask
'
).
hide
();
$
(
'
.theme-popover
'
).
slideDown
(
0
);
$
(
'
.theme-popover
'
).
slideDown
(
0
);
...
@@ -11,7 +11,7 @@ function poptit_close()
...
@@ -11,7 +11,7 @@ function poptit_close()
{
{
if
(
$
(
window
).
width
()
<
1025
)
if
(
$
(
window
).
width
()
<
1025
)
{
{
$
(
document
.
body
).
css
(
"
position
"
,
"
static
"
);
$
(
document
.
body
).
css
(
'
position
'
,
'
static
'
);
$
(
'
.theme-signin-left
'
).
scrollTop
(
0
);
$
(
'
.theme-signin-left
'
).
scrollTop
(
0
);
$
(
'
.theme-popover-mask
'
).
hide
();
$
(
'
.theme-popover-mask
'
).
hide
();
$
(
'
.theme-popover
'
).
slideUp
(
100
);
$
(
'
.theme-popover
'
).
slideUp
(
100
);
...
@@ -161,7 +161,7 @@ function GoodsSpecDetail()
...
@@ -161,7 +161,7 @@ function GoodsSpecDetail()
$
.
AMUI
.
progress
.
done
();
$
.
AMUI
.
progress
.
done
();
if
(
result
.
code
==
0
)
if
(
result
.
code
==
0
)
{
{
$
(
'
.text-info .price-now
'
).
text
(
result
.
data
.
price
);
$
(
'
.text-info .price-now
'
).
text
(
'
¥
'
+
result
.
data
.
price
);
$
(
'
.sys_item_price
'
).
text
(
result
.
data
.
price
);
$
(
'
.sys_item_price
'
).
text
(
result
.
data
.
price
);
$
(
'
.number-tag input[type="number"]
'
).
attr
(
'
max
'
,
result
.
data
.
inventory
);
$
(
'
.number-tag input[type="number"]
'
).
attr
(
'
max
'
,
result
.
data
.
inventory
);
$
(
'
.stock-tips .stock
'
).
text
(
result
.
data
.
inventory
);
$
(
'
.stock-tips .stock
'
).
text
(
result
.
data
.
inventory
);
...
@@ -272,18 +272,34 @@ function GoodsSpecType()
...
@@ -272,18 +272,34 @@ function GoodsSpecType()
});
});
}
}
/**
* 商品基础数据恢复
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-25
* @desc description
*/
function
GoodsBaseRestore
()
{
$
(
'
.text-info .price-now
'
).
text
(
'
¥
'
+
$
(
'
.text-info .price-now
'
).
data
(
'
original-price
'
));
$
(
'
.sys_item_price
'
).
text
(
$
(
'
.sys_item_price
'
).
data
(
'
original-price
'
));
$
(
'
.number-tag input[type="number"]
'
).
attr
(
'
max
'
,
$
(
'
.number-tag input[type="number"]
'
).
data
(
'
original-max
'
));
$
(
'
.stock-tips .stock
'
).
text
(
$
(
'
.stock-tips .stock
'
).
data
(
'
original-stock
'
));
}
$
(
function
()
{
$
(
function
()
{
// 商品规格选择
// 商品规格选择
$
(
"
.theme-options
"
).
each
(
function
()
$
(
'
.theme-options
'
).
each
(
function
()
{
{
$
(
this
).
find
(
'
ul>li
'
).
on
(
'
click
'
,
function
()
$
(
this
).
find
(
'
ul>li
'
).
on
(
'
click
'
,
function
()
{
{
var
length
=
$
(
'
.theme-signin-left .sku-items
'
).
length
;
var
length
=
$
(
'
.theme-signin-left .sku-items
'
).
length
;
var
index
=
$
(
this
).
parents
(
'
.sku-items
'
).
index
();
var
index
=
$
(
this
).
parents
(
'
.sku-items
'
).
index
();
if
(
$
(
this
).
hasClass
(
"
selected
"
))
if
(
$
(
this
).
hasClass
(
'
selected
'
))
{
{
$
(
this
).
removeClass
(
"
selected
"
);
$
(
this
).
removeClass
(
'
selected
'
);
// 去掉元素之后的禁止
// 去掉元素之后的禁止
$
(
'
.theme-signin-left .sku-items
'
).
each
(
function
(
k
,
v
)
$
(
'
.theme-signin-left .sku-items
'
).
each
(
function
(
k
,
v
)
...
@@ -293,12 +309,16 @@ $(function() {
...
@@ -293,12 +309,16 @@ $(function() {
$
(
this
).
find
(
'
li
'
).
removeClass
(
'
sku-items-disabled
'
).
removeClass
(
'
selected
'
).
addClass
(
'
sku-dont-choose
'
);
$
(
this
).
find
(
'
li
'
).
removeClass
(
'
sku-items-disabled
'
).
removeClass
(
'
selected
'
).
addClass
(
'
sku-dont-choose
'
);
}
}
});
});
// 数据还原
GoodsBaseRestore
();
}
else
{
}
else
{
if
(
$
(
this
).
hasClass
(
'
sku-items-disabled
'
)
||
$
(
this
).
hasClass
(
'
sku-dont-choose
'
))
if
(
$
(
this
).
hasClass
(
'
sku-items-disabled
'
)
||
$
(
this
).
hasClass
(
'
sku-dont-choose
'
))
{
{
return
false
;
return
false
;
}
}
$
(
this
).
addClass
(
"
selected
"
).
siblings
(
"
li
"
).
removeClass
(
"
selected
"
);
$
(
this
).
addClass
(
'
selected
'
).
siblings
(
'
li
'
).
removeClass
(
'
selected
'
);
$
(
this
).
parents
(
'
.sku-items
'
).
removeClass
(
'
attr-not-active
'
);
$
(
this
).
parents
(
'
.sku-items
'
).
removeClass
(
'
attr-not-active
'
);
// 去掉元素之后的禁止
// 去掉元素之后的禁止
...
@@ -313,6 +333,22 @@ $(function() {
...
@@ -313,6 +333,22 @@ $(function() {
});
});
}
}
// 是否存在规格图片
var
spec_images
=
$
(
this
).
data
(
'
type-images
'
)
||
null
;
if
(
spec_images
!=
null
)
{
$
(
'
.jqzoom
'
).
attr
(
'
src
'
,
spec_images
);
$
(
'
.jqzoom
'
).
attr
(
'
rel
'
,
spec_images
);
$
(
'
.img-info img
'
).
attr
(
'
src
'
,
spec_images
);
}
// 后面是否还有未选择的规格
if
(
index
<
length
-
1
)
{
// 数据还原
GoodsBaseRestore
();
}
// 获取下一个规格类型
// 获取下一个规格类型
GoodsSpecType
();
GoodsSpecType
();
...
@@ -323,11 +359,11 @@ $(function() {
...
@@ -323,11 +359,11 @@ $(function() {
});
});
// 放大镜初始化
// 放大镜初始化
$
(
"
.jqzoom
"
).
imagezoom
();
$
(
'
.jqzoom
'
).
imagezoom
();
$
(
"
#thumblist li a
"
).
on
(
'
mouseover
'
,
function
()
{
$
(
'
#thumblist li a
'
).
on
(
'
mouseover
'
,
function
()
{
$
(
this
).
parents
(
"
li
"
).
addClass
(
"
tb-selected
"
).
siblings
().
removeClass
(
"
tb-selected
"
);
$
(
this
).
parents
(
'
li
'
).
addClass
(
'
tb-selected
'
).
siblings
().
removeClass
(
'
tb-selected
'
);
$
(
"
.jqzoom
"
).
attr
(
'
src
'
,
$
(
this
).
find
(
"
img
"
).
attr
(
"
mid
"
));
$
(
'
.jqzoom
'
).
attr
(
'
src
'
,
$
(
this
).
find
(
'
img
'
).
attr
(
'
mid
'
));
$
(
"
.jqzoom
"
).
attr
(
'
rel
'
,
$
(
this
).
find
(
"
img
"
).
attr
(
"
big
"
));
$
(
'
.jqzoom
'
).
attr
(
'
rel
'
,
$
(
this
).
find
(
'
img
'
).
attr
(
'
big
'
));
});
});
//弹出规格选择
//弹出规格选择
...
@@ -336,7 +372,7 @@ $(function() {
...
@@ -336,7 +372,7 @@ $(function() {
// 是否登录
// 是否登录
if
(
__user_id__
!=
0
)
if
(
__user_id__
!=
0
)
{
{
$
(
document
.
body
).
css
(
"
position
"
,
"
fixed
"
);
$
(
document
.
body
).
css
(
'
position
'
,
'
fixed
'
);
$
(
'
.theme-popover-mask
'
).
show
();
$
(
'
.theme-popover-mask
'
).
show
();
$
(
'
.theme-popover
'
).
slideDown
(
200
);
$
(
'
.theme-popover
'
).
slideDown
(
200
);
...
@@ -453,51 +489,6 @@ $(function() {
...
@@ -453,51 +489,6 @@ $(function() {
});
});
// 购买导航动画显示/隐藏
var
temp_scroll
=
0
;
var
scroll_type
=
-
1
;
var
location_scroll
=
0
;
var
nav_status
=
1
;
var
$buy_nav
=
$
(
"
div.buy-nav
"
);
$
(
window
).
scroll
(
function
()
{
if
(
$
(
window
).
width
()
<=
625
)
{
var
scroll
=
$
(
document
).
scrollTop
();
if
(
scroll
!=
temp_scroll
)
{
var
temp_scroll_type
=
(
scroll
>
temp_scroll
)
?
1
:
0
;
if
(
temp_scroll_type
!=
scroll_type
)
{
scroll_type
=
temp_scroll_type
;
location_scroll
=
scroll
;
}
if
(
scroll_type
==
1
)
{
if
(
nav_status
==
1
&&
scroll
>
location_scroll
+
200
)
{
nav_status
=
0
;
if
(
!
$buy_nav
.
is
(
"
:animated
"
))
{
$buy_nav
.
slideUp
(
500
);
}
}
}
else
{
if
(
nav_status
==
0
&&
scroll
<
location_scroll
-
50
)
{
nav_status
=
1
;
if
(
!
$buy_nav
.
is
(
"
:animated
"
))
{
$buy_nav
.
slideDown
(
500
);
}
}
}
temp_scroll
=
scroll
;
}
}
});
// 浏览器窗口实时事件
// 浏览器窗口实时事件
$
(
window
).
resize
(
function
()
$
(
window
).
resize
(
function
()
{
{
...
@@ -512,11 +503,11 @@ $(window).resize(function()
...
@@ -512,11 +503,11 @@ $(window).resize(function()
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
//获得文本框对象
//获得文本框对象
var
t
=
$
(
"
#text_box
"
);
var
t
=
$
(
'
#text_box
'
);
//初始化数量为1,并失效减
//初始化数量为1,并失效减
$
(
'
#min
'
).
attr
(
'
disabled
'
,
true
);
$
(
'
#min
'
).
attr
(
'
disabled
'
,
true
);
//数量增加操作
//数量增加操作
$
(
"
#add
"
).
on
(
'
click
'
,
function
()
{
$
(
'
#add
'
).
on
(
'
click
'
,
function
()
{
var
stock
=
parseInt
(
$
(
'
.stock-tips .stock
'
).
text
());
var
stock
=
parseInt
(
$
(
'
.stock-tips .stock
'
).
text
());
var
number
=
parseInt
(
t
.
val
());
var
number
=
parseInt
(
t
.
val
());
if
(
number
<
stock
)
if
(
number
<
stock
)
...
@@ -532,7 +523,7 @@ $(document).ready(function() {
...
@@ -532,7 +523,7 @@ $(document).ready(function() {
});
});
//数量减少操作
//数量减少操作
$
(
"
#min
"
).
on
(
'
click
'
,
function
()
{
$
(
'
#min
'
).
on
(
'
click
'
,
function
()
{
t
.
val
(
parseInt
(
t
.
val
())
-
1
);
t
.
val
(
parseInt
(
t
.
val
())
-
1
);
if
(
parseInt
(
t
.
val
())
==
1
)
{
if
(
parseInt
(
t
.
val
())
==
1
)
{
$
(
'
#min
'
).
attr
(
'
disabled
'
,
true
);
$
(
'
#min
'
).
attr
(
'
disabled
'
,
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录