Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
1947136d
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,发现更多精彩内容 >>
提交
1947136d
编写于
12月 27, 2018
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
goods
上级
ed4c41e1
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
163 addition
and
33 deletion
+163
-33
application/api/controller/Banner.php
application/api/controller/Banner.php
+1
-1
application/api/controller/Goods.php
application/api/controller/Goods.php
+100
-0
application/api/controller/Index.php
application/api/controller/Index.php
+1
-1
application/api/controller/Navigation.php
application/api/controller/Navigation.php
+1
-1
application/index/view/default/goods/index.html
application/index/view/default/goods/index.html
+2
-2
application/service/GoodsService.php
application/service/GoodsService.php
+4
-4
public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
...c/appmini/old/alipay/pages/goods-detail/goods-detail.acss
+7
-3
public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
...c/appmini/old/alipay/pages/goods-detail/goods-detail.axml
+15
-9
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
+32
-12
未找到文件。
application/api/controller/Banner.php
浏览文件 @
1947136d
...
...
@@ -13,7 +13,7 @@ use app\service\BannerService;
class
Banner
extends
Common
{
/**
* [_
initialize 前置操作-继承公共前置
方法]
* [_
_construct 构造
方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
...
...
application/api/controller/Goods.php
0 → 100644
浏览文件 @
1947136d
<?php
namespace
app\api\controller
;
use
app\service\GoodsService
;
/**
* 商品
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Goods
extends
Common
{
/**
* [__construct 构造方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public
function
__construct
()
{
// 调用父类前置方法
parent
::
__construct
();
}
/**
* 获取商品详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-12
* @desc description
*/
public
function
Detail
()
{
// 参数
if
(
empty
(
$this
->
data_post
[
'goods_id'
]))
{
return
json
(
DataReturn
(
'参数有误'
,
-
1
));
}
// 获取商品
$goods_id
=
intval
(
$this
->
data_post
[
'goods_id'
]);
$params
=
[
'where'
=>
[
'id'
=>
$goods_id
,
'is_delete_time'
=>
0
,
],
'is_photo'
=>
true
,
'is_spec'
=>
true
,
'is_content_app'
=>
true
,
];
$goods
=
GoodsService
::
GoodsList
(
$params
);
if
(
empty
(
$goods
[
0
])
||
$goods
[
0
][
'is_delete_time'
]
!=
0
)
{
return
json
(
DataReturn
(
'商品不存在或已删除'
,
-
1
));
}
unset
(
$goods
[
0
][
'content_web'
]);
// 当前登录用户是否已收藏
$ret_favor
=
GoodsService
::
IsUserGoodsFavor
([
'goods_id'
=>
$goods_id
,
'user'
=>
$this
->
user
]);
$goods
[
0
][
'is_favor'
]
=
(
$ret_favor
[
'code'
]
==
0
)
?
$ret_favor
[
'data'
]
:
0
;
// 商品访问统计
GoodsService
::
GoodsAccessCountInc
([
'goods_id'
=>
$goods_id
]);
// 用户商品浏览
GoodsService
::
GoodsBrowseSave
([
'goods_id'
=>
$goods_id
,
'user'
=>
$this
->
user
]);
// 数据返回
$result
=
[
'goods'
=>
$goods
[
0
],
'common_order_is_booking'
=>
(
int
)
MyC
(
'common_order_is_booking'
,
0
),
];
return
json
(
DataReturn
(
'success'
,
0
,
$result
));
}
/**
* 用户商品收藏
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-17
* @desc description
*/
public
function
Favor
()
{
// 登录校验
$this
->
Is_Login
();
// 开始操作
$params
=
$this
->
data_post
;
$params
[
'user'
]
=
$this
->
user
;
$ret
=
GoodsService
::
GoodsFavor
(
$params
);
return
json
(
$ret
);
}
}
?>
\ No newline at end of file
application/api/controller/Index.php
浏览文件 @
1947136d
...
...
@@ -13,7 +13,7 @@ use app\service\GoodsService;
class
Index
extends
Common
{
/**
* [_
initialize 前置操作-继承公共前置
方法]
* [_
_construct 构造
方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
...
...
application/api/controller/Navigation.php
浏览文件 @
1947136d
...
...
@@ -13,7 +13,7 @@ use app\service\AppNavService;
class
Navigation
extends
Common
{
/**
* [_
initialize 前置操作-继承公共前置
方法]
* [_
_construct 构造
方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
...
...
application/index/view/default/goods/index.html
浏览文件 @
1947136d
...
...
@@ -137,8 +137,8 @@
<div
class=
"theme-popbod dform"
>
<form
class=
"theme-signin"
name=
"loginform"
action=
"javascript:;"
>
<div
class=
"theme-signin-left"
>
{{if !empty($goods['specifications']['
typ
e'])}}
{{foreach $goods.specifications.
typ
e as $key=>$spec}}
{{if !empty($goods['specifications']['
choos
e'])}}
{{foreach $goods.specifications.
choos
e as $key=>$spec}}
{{if !empty($spec['value'])}}
<div
class=
"theme-options sku-items"
>
<div
class=
"cart-title"
>
{{$spec.name}}
</div>
...
...
application/service/GoodsService.php
浏览文件 @
1947136d
...
...
@@ -368,12 +368,12 @@ class GoodsService
$where
=
[
'goods_id'
=>
$params
[
'goods_id'
]];
// 规格类型
$
typ
e
=
Db
::
name
(
'GoodsSpecType'
)
->
where
(
$where
)
->
order
(
'id asc'
)
->
select
();
if
(
!
empty
(
$
typ
e
))
$
choos
e
=
Db
::
name
(
'GoodsSpecType'
)
->
where
(
$where
)
->
order
(
'id asc'
)
->
select
();
if
(
!
empty
(
$
choos
e
))
{
// 数据处理
$images_host
=
config
(
'images_host'
);
foreach
(
$
typ
e
as
&
$temp_type
)
foreach
(
$
choos
e
as
&
$temp_type
)
{
$temp_type_value
=
json_decode
(
$temp_type
[
'value'
],
true
);
foreach
(
$temp_type_value
as
&
$vs
)
...
...
@@ -384,7 +384,7 @@ class GoodsService
$temp_type
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
);
}
}
return
[
'
type'
=>
$typ
e
];
return
[
'
choose'
=>
$choos
e
];
}
/**
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
浏览文件 @
1947136d
...
...
@@ -30,14 +30,18 @@
.goods-attr-choose .item .attribute button {
margin-top: 20rpx;
margin-right: 25rpx;
}
.goods-attr-choose .item .attribute button {
padding: 0 30rpx;
background: #eee;
color: #666;
line-height: 2
8
px;
line-height: 2
7
px;
height: 27px;
}
.goods-attr-choose .item .attribute button image {
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 10rpx;
}
.goods-attr-choose .item .attribute button,
.goods-popup-submit
{
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
浏览文件 @
1947136d
...
...
@@ -10,7 +10,7 @@
a:if="{{goods_photo.length > 0}}">
<block a:for="{{goods_photo}}">
<swiper-item>
<image class="swiper-item wh-auto" onTap="goods_photo_view_event" data-index="{{index}}" src="{{item}}" mode="aspectFit" onTap="banner_event" />
<image class="swiper-item wh-auto" onTap="goods_photo_view_event" data-index="{{index}}" src="{{item
.images
}}" mode="aspectFit" onTap="banner_event" />
</swiper-item>
</block>
</swiper>
...
...
@@ -36,11 +36,11 @@
</view>
<!-- 属性导航 -->
<
view a:if="{{goods_attribute_show.length > 0
}}" class="spacing">
<
!-- <view a:if="{{false
}}" class="spacing">
<view class="goods-attr-show-title bg-white arrow-right cr-666" onTap="good_attribute_nav_event">
属性
</view>
</view>
</view>
-->
<!-- 商品详情 -->
<view a:if="{{goods_content_app.length > 0}}" class="goods-detail spacing">
...
...
@@ -86,13 +86,19 @@
</view>
<view class="goods-popup-content">
<!-- 商品属性 -->
<view a:if="{{goods_
attribute
_choose.length > 0}}" class="goods-attr-choose">
<view a:for="{{goods_
attribute_choose}}" a:for-index="key" a:if="{{item.type == 'choose'}}
" class="item br-b">
<view a:if="{{goods_
specifications
_choose.length > 0}}" class="goods-attr-choose">
<view a:for="{{goods_
specifications_choose}}" a:for-index="key
" class="item br-b">
<view class="title">{{item.name}}</view>
<view a:if="{{item.find.length > 0}}" class="attribute">
<block a:for="{{item.find}}" a:for-index="keys" a:for-item="items">
<button a:if="{{temp_attribute_active[key] == keys}}" catchTap="goods_attribute_event" data-key="{{key}}" data-keys="{{keys}}" class="bg-active-main" type="default" size="mini" hover-class="none">{{items.name}}</button>
<button a:else catchTap="goods_attribute_event" data-key="{{key}}" data-keys="{{keys}}" type="default" size="mini" hover-class="none">{{items.name}}</button>
<view a:if="{{item.value.length > 0}}" class="attribute">
<block a:for="{{item.value}}" a:for-index="keys" a:for-item="items">
<button a:if="{{temp_attribute_active[key] == keys}}" catchTap="goods_attribute_event" data-key="{{key}}" data-keys="{{keys}}" class="bg-active-main" type="default" size="mini" hover-class="none">
<image a:if="{{(items.images || null) != null}}" src="{{items.images}}" mode="scaleToFill" />
{{items.name}}
</button>
<button a:else catchTap="goods_attribute_event" data-key="{{key}}" data-keys="{{keys}}" type="default" size="mini" hover-class="none">
<image a:if="{{(items.images || null) != null}}" src="{{items.images}}" mode="scaleToFill" />
{{items.name}}
</button>
</block>
</view>
</view>
...
...
public/appmini/old/alipay/pages/goods-detail/goods-detail.js
浏览文件 @
1947136d
...
...
@@ -13,8 +13,7 @@ Page({
goods
:
null
,
goods_photo
:
[],
goods_attribute_show
:
[],
goods_attribute_choose
:
[],
goods_specifications_choose
:
[],
goods_content_app
:
[],
popup_status
:
false
,
...
...
@@ -63,7 +62,7 @@ Page({
});
my
.
httpRequest
({
url
:
app
.
get_request_url
(
"
Detail
"
,
"
G
oods
"
),
url
:
app
.
get_request_url
(
"
detail
"
,
"
g
oods
"
),
method
:
"
POST
"
,
data
:
{
goods_id
:
this
.
data
.
params
.
goods_id
},
dataType
:
"
json
"
,
...
...
@@ -77,8 +76,6 @@ Page({
indicator_dots
:
(
data
.
goods
.
photo
.
length
>
1
),
autoplay
:
(
data
.
goods
.
photo
.
length
>
1
),
goods_photo
:
data
.
goods
.
photo
,
goods_attribute_show
:
data
.
goods
.
attribute
.
show
||
[],
goods_attribute_choose
:
data
.
goods
.
attribute
.
choose
||
[],
goods_content_app
:
data
.
goods
.
content_app
,
temp_buy_number
:
(
data
.
goods
.
buy_min_number
)
||
1
,
goods_favor_text
:
(
data
.
goods
.
is_favor
==
1
)
?
'
已收藏
'
:
'
收藏
'
,
...
...
@@ -89,6 +86,9 @@ Page({
nav_submit_is_disabled
:
(
data
.
goods
.
is_shelves
==
1
&&
data
.
goods
.
inventory
>
0
)
?
false
:
true
,
});
// 规格处理
this
.
goods_specifications_choose_handle_dont
(
data
.
goods
.
specifications
.
choose
,
0
);
if
(
data
.
goods
.
is_shelves
!=
1
)
{
this
.
setData
({
nav_submit_text
:
'
商品已下架
'
,
...
...
@@ -128,6 +128,26 @@ Page({
}
},
// 规格处理
goods_specifications_choose_handle_dont
(
data
,
key
)
{
if
((
data
||
null
)
==
null
)
{
this
.
setData
({
goods_specifications_choose
:
[]});
return
false
;
}
// 是否不能选择
for
(
var
i
in
data
)
{
for
(
var
k
in
data
[
i
][
'
value
'
])
{
data
[
i
][
'
value
'
][
k
][
'
is_dont
'
]
=
(
key
>
0
)
?
'
spec-dont
'
:
''
,
data
[
i
][
'
value
'
][
k
][
'
is_disabled
'
]
=
''
;
}
}
this
.
setData
({
goods_specifications_choose
:
data
});
},
// 下拉刷新
onPullDownRefresh
()
{
this
.
init
();
...
...
@@ -178,7 +198,7 @@ Page({
my
.
showLoading
({
content
:
'
处理中...
'
});
my
.
httpRequest
({
url
:
app
.
get_request_url
(
'
Favor
'
,
'
G
oods
'
),
url
:
app
.
get_request_url
(
'
favor
'
,
'
g
oods
'
),
method
:
'
POST
'
,
data
:
{
"
id
"
:
this
.
data
.
goods
.
id
},
dataType
:
'
json
'
,
...
...
@@ -231,15 +251,15 @@ Page({
var
temp_attribute_active
=
this
.
data
.
temp_attribute_active
;
if
(
app
.
get_length
(
temp_attribute_active
)
>
0
)
{
var
goods_
attribute_choose
=
this
.
data
.
goods_attribute
_choose
;
var
goods_
specifications_choose
=
this
.
data
.
goods_specifications
_choose
;
for
(
var
i
in
temp_attribute_active
)
{
attribute_all_cart
[
goods_
attribute_choose
[
i
][
'
id
'
]]
=
goods_attribute
_choose
[
i
][
'
find
'
][
temp_attribute_active
[
i
]][
'
id
'
];
attribute_all_cart
[
goods_
specifications_choose
[
i
][
'
id
'
]]
=
goods_specifications
_choose
[
i
][
'
find
'
][
temp_attribute_active
[
i
]][
'
id
'
];
}
}
my
.
showLoading
({
content
:
'
处理中...
'
});
my
.
httpRequest
({
url
:
app
.
get_request_url
(
'
Save
'
,
'
C
art
'
),
url
:
app
.
get_request_url
(
'
save
'
,
'
c
art
'
),
method
:
'
POST
'
,
data
:
{
"
goods_id
"
:
this
.
data
.
goods
.
id
,
"
stock
"
:
this
.
data
.
temp_buy_number
,
"
attr
"
:
JSON
.
stringify
(
attribute_all_cart
)
},
dataType
:
'
json
'
,
...
...
@@ -346,9 +366,9 @@ Page({
return
false
;
}
else
{
// 属性
var
goods_
attribute_choose
=
this
.
data
.
goods_attribute
_choose
;
var
goods_
specifications_choose
=
this
.
data
.
goods_specifications
_choose
;
var
temp_attribute_active
=
this
.
data
.
temp_attribute_active
;
var
attr_count
=
goods_
attribute
_choose
.
length
;
var
attr_count
=
goods_
specifications
_choose
.
length
;
var
attribute_all
=
{};
if
(
attr_count
>
0
)
{
...
...
@@ -363,7 +383,7 @@ Page({
}
else
{
for
(
var
i
in
temp_attribute_active
)
{
attribute_all
[
goods_
attribute_choose
[
i
][
'
id
'
]]
=
goods_attribute
_choose
[
i
][
'
find
'
][
temp_attribute_active
[
i
]][
'
id
'
];
attribute_all
[
goods_
specifications_choose
[
i
][
'
id
'
]]
=
goods_specifications
_choose
[
i
][
'
find
'
][
temp_attribute_active
[
i
]][
'
id
'
];
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录