Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
72a5b777
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
72a5b777
编写于
1月 23, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品规格只有一列的情况逻辑优化
上级
bf4b3337
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
6 deletion
+44
-6
application/index/view/default/goods/index.html
application/index/view/default/goods/index.html
+1
-1
application/index/view/default/personal/save_info.html
application/index/view/default/personal/save_info.html
+1
-1
application/service/GoodsService.php
application/service/GoodsService.php
+20
-0
application/service/UserService.php
application/service/UserService.php
+5
-4
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
+7
-0
public/appmini/old/weixin/pages/goods-detail/goods-detail.js
public/appmini/old/weixin/pages/goods-detail/goods-detail.js
+6
-0
public/static/index/default/js/goods.js
public/static/index/default/js/goods.js
+4
-0
未找到文件。
application/index/view/default/goods/index.html
浏览文件 @
72a5b777
...
...
@@ -144,7 +144,7 @@
<div
class=
"cart-title"
>
{{$spec.name}}
</div>
<ul>
{{foreach $spec.value as $keys=>$specs}}
<li
class=
"sku-line {{if !empty($specs['images'])}} sku-line-images{{/if}} {{if $key gt 0}} sku-dont-choose{{/if}}"
data-type-value=
"{{$spec.name}}"
data-value=
"{{$specs.name}}"
{{
if
!
empty
($
specs
['
images
'])}}
data-type-images=
"{{$specs.images}}"
{{/
if
}}
>
<li
class=
"sku-line {{if !empty($specs['images'])}} sku-line-images{{/if}} {{if $key gt 0}} sku-dont-choose{{/if}}
{{if isset($specs['is_only_level_one']) and isset($specs['inventory']) and $specs['inventory'] elt 0}}sku-items-disabled{{/if}}
"
data-type-value=
"{{$spec.name}}"
data-value=
"{{$specs.name}}"
{{
if
!
empty
($
specs
['
images
'])}}
data-type-images=
"{{$specs.images}}"
{{/
if
}}
>
{{if !empty($specs['images'])}}
<img
src=
"{{$specs.images}}"
/>
{{/if}}
...
...
application/index/view/default/personal/save_info.html
浏览文件 @
72a5b777
...
...
@@ -35,7 +35,7 @@
{{include file="lib/gender" /}}
<div
class=
"am-form-group"
>
<label>
生日
</label>
<input
type=
"text"
name=
"birthday"
class=
"am-form-field am-input-sm am-radius Wdate"
placeholder=
"生日"
data-validation-message=
"生日格式有误"
{{
if
!
empty
($
data
)}}
value=
"{{$data.birthday_text}}"
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
{{/
if
}}
autocomplete=
"off"
required
/>
<input
type=
"text"
name=
"birthday"
class=
"am-form-field am-input-sm am-radius Wdate"
placeholder=
"生日"
data-validation-message=
"生日格式有误"
{{
if
!
empty
($
data
)}}
value=
"{{$data.birthday_text}}"
onclick=
"WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
{{/
if
}}
autocomplete=
"off"
/>
</div>
<div
class=
"am-form-group"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
...
...
application/service/GoodsService.php
浏览文件 @
72a5b777
...
...
@@ -388,6 +388,26 @@ class GoodsService
$temp_type
[
'value'
]
=
$temp_type_value
;
$temp_type
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
);
}
// 只有一个规格的时候直接获取规格值的库存数
if
(
count
(
$choose
)
==
1
)
{
foreach
(
$choose
[
0
][
'value'
]
as
&
$temp_spec
)
{
$temp_spec_params
=
[
'id'
=>
$params
[
'goods_id'
],
'spec'
=>
[
[
'type'
=>
$choose
[
0
][
'name'
],
'value'
=>
$temp_spec
[
'name'
]]
],
];
$temp
=
self
::
GoodsSpecDetail
(
$temp_spec_params
);
if
(
$temp
[
'code'
]
==
0
)
{
$temp_spec
[
'is_only_level_one'
]
=
1
;
$temp_spec
[
'inventory'
]
=
$temp
[
'data'
][
'inventory'
];
}
}
}
}
return
[
'choose'
=>
$choose
];
}
...
...
application/service/UserService.php
浏览文件 @
72a5b777
...
...
@@ -1323,14 +1323,15 @@ class UserService
'error_msg'
=>
'昵称 2~16 个字符之间'
,
],
[
'checked_type'
=>
'
empty
'
,
'checked_type'
=>
'
isset
'
,
'key_name'
=>
'birthday'
,
'error_msg'
=>
'请填写生日'
,
],
[
'checked_type'
=>
'isset'
,
'checked_type'
=>
'in'
,
'checked_data'
=>
[
0
,
1
,
2
],
'key_name'
=>
'gender'
,
'error_msg'
=>
'
请选择性别
'
,
'error_msg'
=>
'
性别选择有误
'
,
],
[
'checked_type'
=>
'empty'
,
...
...
@@ -1346,7 +1347,7 @@ class UserService
// 更新数据库
$data
=
[
'birthday'
=>
strtotime
(
$params
[
'birthday'
]),
'birthday'
=>
empty
(
$params
[
'birthday'
])
?
''
:
strtotime
(
$params
[
'birthday'
]),
'nickname'
=>
$params
[
'nickname'
],
'gender'
=>
intval
(
$params
[
'gender'
]),
'upd_time'
=>
time
(),
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
浏览文件 @
72a5b777
...
...
@@ -157,8 +157,15 @@ Page({
temp_data
[
i
][
'
value
'
][
k
][
'
is_disabled
'
]
=
''
;
temp_data
[
i
][
'
value
'
][
k
][
'
is_active
'
]
=
''
;
}
// 当只有一个规格的时候
if
(
key
==
0
&&
temp_data
.
length
==
1
)
{
temp_data
[
i
][
'
value
'
][
k
][
'
is_disabled
'
]
=
((
temp_data
[
i
][
'
value
'
][
k
][
'
is_only_level_one
'
]
||
null
)
!=
null
&&
(
temp_data
[
i
][
'
value
'
][
k
][
'
inventory
'
]
||
0
)
<=
0
)
?
'
spec-items-disabled
'
:
''
;
}
}
}
this
.
setData
({
goods_specifications_choose
:
temp_data
});
},
...
...
public/appmini/old/weixin/pages/goods-detail/goods-detail.js
浏览文件 @
72a5b777
...
...
@@ -154,6 +154,12 @@ Page({
temp_data
[
i
][
'
value
'
][
k
][
'
is_disabled
'
]
=
''
;
temp_data
[
i
][
'
value
'
][
k
][
'
is_active
'
]
=
''
;
}
// 当只有一个规格的时候
if
(
key
==
0
&&
temp_data
.
length
==
1
)
{
temp_data
[
i
][
'
value
'
][
k
][
'
is_disabled
'
]
=
((
temp_data
[
i
][
'
value
'
][
k
][
'
is_only_level_one
'
]
||
null
)
!=
null
&&
(
temp_data
[
i
][
'
value
'
][
k
][
'
inventory
'
]
||
0
)
<=
0
)
?
'
spec-items-disabled
'
:
''
;
}
}
}
this
.
setData
({
goods_specifications_choose
:
temp_data
});
...
...
public/static/index/default/js/goods.js
浏览文件 @
72a5b777
...
...
@@ -294,6 +294,10 @@ $(function() {
{
$
(
this
).
find
(
'
ul>li
'
).
on
(
'
click
'
,
function
()
{
// 切换规格购买数量清空
$
(
'
#text_box
'
).
val
(
1
);
// 规格处理
var
length
=
$
(
'
.theme-signin-left .sku-items
'
).
length
;
var
index
=
$
(
this
).
parents
(
'
.sku-items
'
).
index
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录