Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wds12580
ShopXO
提交
f69c77c9
ShopXO
项目概览
wds12580
/
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,发现更多精彩内容 >>
提交
f69c77c9
编写于
12月 27, 2018
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支付宝小程序-商品详情规格
上级
570399b8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
117 addition
and
18 deletion
+117
-18
application/service/GoodsService.php
application/service/GoodsService.php
+5
-6
public/appmini/old/alipay/app.json
public/appmini/old/alipay/app.json
+2
-2
public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
...c/appmini/old/alipay/pages/goods-detail/goods-detail.acss
+29
-6
public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
...c/appmini/old/alipay/pages/goods-detail/goods-detail.axml
+18
-2
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
+63
-2
未找到文件。
application/service/GoodsService.php
浏览文件 @
f69c77c9
...
...
@@ -1647,12 +1647,6 @@ class GoodsService
'is_checked'
=>
1
,
'error_msg'
=>
'请选择规格'
,
],
[
'checked_type'
=>
'is_array'
,
'key_name'
=>
'spec'
,
'is_checked'
=>
1
,
'error_msg'
=>
'规格有误'
,
],
];
$ret
=
ParamsChecked
(
$params
,
$p
);
if
(
$ret
!==
true
)
...
...
@@ -1670,6 +1664,11 @@ class GoodsService
if
(
!
empty
(
$params
[
'spec'
]))
{
$value
=
[];
// 规格不为数组则为json字符串
if
(
!
is_array
(
$params
[
'spec'
]))
{
$params
[
'spec'
]
=
json_decode
(
$params
[
'spec'
],
true
);
}
foreach
(
$params
[
'spec'
]
as
$v
)
{
$value
[]
=
$v
[
'value'
];
...
...
public/appmini/old/alipay/app.json
浏览文件 @
f69c77c9
{
"pages"
:
[
"pages"
:
[
"pages/goods-detail/goods-detail"
,
"pages/index/index"
,
"pages/goods-category/goods-category"
,
"pages/cart/cart"
,
...
...
@@ -8,7 +8,7 @@
"pages/login/login"
,
"pages/paytips/paytips"
,
"pages/goods-search/goods-search"
,
"pages/goods-detail/goods-detail"
,
"pages/goods-attribute/goods-attribute"
,
"pages/buy/buy"
,
"pages/user-address/user-address"
,
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
浏览文件 @
f69c77c9
...
...
@@ -10,15 +10,38 @@
}
.goods-popup {
padding: 20rpx 10rpx;
position: relative;
}
.goods-popup .close {
margin-right: 10rpx;
position: absolute;
top: 20rpx;
right: 20rpx;
z-index: 2;
}
.goods-popup-base {
height: 220rpx;
position: relative;
}
.goods-popup-base image {
width: 200rpx;
height: 200rpx;
position: absolute;
left: 0;
top: 0;
}
.goods-popup-base-content {
position: absolute;
left: 220rpx;
bottom: 20rpx;
}
.goods-popup-base-content .goods-price {
margin-bottom: 10rpx;
}
.goods-popup-content {
max-height: 50vh;
overflow-y: scroll;
overflow-x: hidden;
margin-top:
3
0rpx;
margin-top:
2
0rpx;
}
.goods-attr-choose .item {
margin-bottom: 30rpx;
...
...
@@ -33,7 +56,7 @@
padding: 0 30rpx;
background-color: #f5f5f5;
color: #666;
line-height: 2
7
px;
line-height: 2
5
px;
height: 27px;
border: 1px solid #d5d5d5;
}
...
...
@@ -44,9 +67,9 @@
margin-right: 10rpx;
}
.spec-active {
background: #
d2364c
!important;
color: #
fff
!important;
border: 1px solid #
b91d33
!important;
background: #
fff
!important;
color: #
d2364c
!important;
border: 1px solid #
d2364c
!important;
}
.spec-dont-choose {
color: #b4b3b3 !important;
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
浏览文件 @
f69c77c9
...
...
@@ -28,7 +28,7 @@
</view>
<view class="goods-price">
<text class="sales-price">¥{{goods.price}}</text>
<text a:if="{{
goods.original_price > 0
}}" class="original-price">¥{{goods.original_price}}</text>
<text a:if="{{
(goods.original_price || null) != null
}}" class="original-price">¥{{goods.original_price}}</text>
<view class="fr cr-ccc">
<text>销量 {{goods.sales_count}}</text>
</view>
...
...
@@ -79,11 +79,27 @@
<!-- 弹层 -->
<popup show="{{popup_status}}" position="bottom" onClose="popup_close_event">
<view class="goods-popup bg-white">
<view class="close
tr dis-block
oh">
<view class="close
fr
oh">
<view class="fr" catchTap="popup_close_event">
<icon type="clear" size="20" />
</view>
</view>
<!-- 规格基础信息 -->
<view class="goods-popup-base oh br-b">
<image src="{{goods_spec_base_images}}" mode="scaleToFill" class="br" />
<view class="goods-popup-base-content">
<view class="goods-price">
<view class="sales-price">¥{{goods_spec_base_price}}</view>
<view a:if="{{(goods_spec_base_original_price || null) != null}}" class="original-price">¥{{goods_spec_base_original_price}}</view>
</view>
<view class="inventory">
<text class="cr-888">库存</text>
<text class="cr-666">{{goods_spec_base_inventory}}</text>
<text class="cr-888">{{goods.inventory_unit}}</text>
</view>
</view>
</view>
<view class="goods-popup-content">
<!-- 商品属性 -->
<view a:if="{{goods_specifications_choose.length > 0}}" class="goods-attr-choose">
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
浏览文件 @
f69c77c9
...
...
@@ -23,10 +23,15 @@ Page({
buy_event_type
:
'
buy
'
,
nav_submit_text
:
'
立即购买
'
,
nav_submit_is_disabled
:
true
,
goods_spec_base_price
:
0
,
goods_spec_base_original_price
:
0
,
goods_spec_base_inventory
:
0
,
goods_spec_base_images
:
''
,
},
onLoad
(
params
)
{
//params['goods_id']=16
;
params
[
'
goods_id
'
]
=
12
;
this
.
setData
({
params
:
params
});
this
.
init
();
},
...
...
@@ -84,6 +89,11 @@ Page({
data_bottom_line_status
:
true
,
data_list_loding_status
:
3
,
nav_submit_is_disabled
:
(
data
.
goods
.
is_shelves
==
1
&&
data
.
goods
.
inventory
>
0
)
?
false
:
true
,
goods_spec_base_price
:
data
.
goods
.
price
,
goods_spec_base_original_price
:
data
.
goods
.
original_price
,
goods_spec_base_inventory
:
data
.
goods
.
inventory
,
goods_spec_base_images
:
data
.
goods
.
images
});
// 不能选择规格处理
...
...
@@ -300,6 +310,7 @@ Page({
var
key
=
e
.
currentTarget
.
dataset
.
key
||
0
;
var
keys
=
e
.
currentTarget
.
dataset
.
keys
||
0
;
var
temp_data
=
this
.
data
.
goods_specifications_choose
;
var
temp_images
=
this
.
data
.
goods_spec_base_images
;
// 不能选择和禁止选择跳过
if
((
temp_data
[
key
][
'
value
'
][
keys
][
'
is_dont
'
]
||
null
)
==
null
&&
(
temp_data
[
key
][
'
value
'
][
keys
][
'
is_disabled
'
]
||
null
)
==
null
)
...
...
@@ -316,6 +327,10 @@ Page({
if
(
keys
==
k
&&
(
temp_data
[
i
][
'
value
'
][
k
][
'
is_active
'
]
||
null
)
==
null
)
{
temp_data
[
i
][
'
value
'
][
k
][
'
is_active
'
]
=
'
spec-active
'
;
if
((
temp_data
[
i
][
'
value
'
][
k
][
'
images
'
]
||
null
)
!=
null
)
{
temp_images
=
temp_data
[
i
][
'
value
'
][
k
][
'
images
'
];
}
}
else
{
temp_data
[
i
][
'
value
'
][
k
][
'
is_active
'
]
=
''
;
}
...
...
@@ -323,7 +338,7 @@ Page({
}
}
}
this
.
setData
({
goods_specifications_choose
:
temp_data
});
this
.
setData
({
goods_specifications_choose
:
temp_data
,
goods_spec_base_images
:
temp_images
});
// 不能选择规格处理
this
.
goods_specifications_choose_handle_dont
(
key
);
...
...
@@ -424,7 +439,53 @@ Page({
// 获取规格详情
get_goods_specifications_detail
()
{
// 是否全部选中
var
temp_data
=
this
.
data
.
goods_specifications_choose
;
var
sku_count
=
temp_data
.
length
;
var
active_count
=
0
;
// 获取规格值
var
spec
=
[];
for
(
var
i
in
temp_data
)
{
for
(
var
k
in
temp_data
[
i
][
'
value
'
])
{
if
((
temp_data
[
i
][
'
value
'
][
k
][
'
is_active
'
]
||
null
)
!=
null
)
{
active_count
++
;
spec
.
push
({
"
type
"
:
temp_data
[
i
][
'
name
'
],
"
value
"
:
temp_data
[
i
][
'
value
'
][
k
][
'
name
'
]});
break
;
}
}
}
if
(
spec
.
length
<=
0
||
active_count
<
sku_count
)
{
return
false
;
}
// 获取数据
my
.
httpRequest
({
url
:
app
.
get_request_url
(
'
specdetail
'
,
'
goods
'
),
method
:
'
POST
'
,
data
:
{
"
id
"
:
this
.
data
.
goods
.
id
,
"
spec
"
:
JSON
.
stringify
(
spec
)
},
dataType
:
'
json
'
,
success
:
(
res
)
=>
{
if
(
res
.
data
.
code
==
0
)
{
}
else
{
my
.
showToast
({
type
:
'
fail
'
,
content
:
res
.
data
.
msg
});
}
},
fail
:
()
=>
{
my
.
showToast
({
type
:
'
fail
'
,
content
:
'
服务器请求出错
'
});
}
});
},
// 数量输入事件
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录