Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
37543934
ShopXO
项目概览
jcy2004x
/
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,发现更多精彩内容 >>
提交
37543934
编写于
10月 10, 2019
作者:
D
Devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
购物车商品错误处理
上级
4727b294
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
76 addition
and
29 deletion
+76
-29
application/index/view/default/cart/index.html
application/index/view/default/cart/index.html
+2
-8
application/service/BuyService.php
application/service/BuyService.php
+20
-0
public/appmini/old/alipay/images/default-select-disabled-icon.png
...ppmini/old/alipay/images/default-select-disabled-icon.png
+0
-0
public/appmini/old/alipay/pages/cart/cart.acss
public/appmini/old/alipay/pages/cart/cart.acss
+4
-0
public/appmini/old/alipay/pages/cart/cart.axml
public/appmini/old/alipay/pages/cart/cart.axml
+4
-2
public/appmini/old/alipay/pages/cart/cart.js
public/appmini/old/alipay/pages/cart/cart.js
+9
-3
public/appmini/old/baidu/images/default-select-disabled-icon.png
...appmini/old/baidu/images/default-select-disabled-icon.png
+0
-0
public/appmini/old/baidu/pages/cart/cart.css
public/appmini/old/baidu/pages/cart/cart.css
+4
-2
public/appmini/old/baidu/pages/cart/cart.js
public/appmini/old/baidu/pages/cart/cart.js
+11
-5
public/appmini/old/baidu/pages/cart/cart.swan
public/appmini/old/baidu/pages/cart/cart.swan
+4
-2
public/appmini/old/weixin/app.json
public/appmini/old/weixin/app.json
+2
-2
public/appmini/old/weixin/images/default-select-disabled-icon.png
...ppmini/old/weixin/images/default-select-disabled-icon.png
+0
-0
public/appmini/old/weixin/pages/cart/cart.js
public/appmini/old/weixin/pages/cart/cart.js
+8
-2
public/appmini/old/weixin/pages/cart/cart.wxml
public/appmini/old/weixin/pages/cart/cart.wxml
+4
-2
public/appmini/old/weixin/pages/cart/cart.wxss
public/appmini/old/weixin/pages/cart/cart.wxss
+4
-1
未找到文件。
application/index/view/default/cart/index.html
浏览文件 @
37543934
...
...
@@ -72,14 +72,8 @@
<input
type=
"number"
class=
"am-form-field"
value=
"{{$goods.stock}}"
{{
if
$
goods
['
is_shelves
']
neq
1
or
$
goods
['
is_delete_time
']
neq
0}}
disabled
{{/
if
}}
/>
<span
class=
"am-input-group-label {{if $goods['is_shelves'] eq 1 and $goods['is_delete_time'] eq 0}}stock-submit{{/if}}"
data-type=
"add"
>
+
</span>
</div>
{{if $goods['is_shelves'] neq 1}}
<p
class=
"am-text-danger"
>
商品已下架
</p>
{{/if}}
{{if $goods['is_delete_time'] neq 0}}
<p
class=
"am-text-danger"
>
商品已作废
</p>
{{/if}}
{{if isset($goods['is_invalid']) and $goods['is_invalid'] eq 1}}
<p
class=
"am-text-danger"
>
商品已失效
</p>
{{if !empty($goods['error_msg'])}}
<p
class=
"am-text-danger"
>
{{$goods.error_msg}}
</p>
{{/if}}
</td>
<td
class=
"total-price am-hide-sm-only"
>
...
...
application/service/BuyService.php
浏览文件 @
37543934
...
...
@@ -205,6 +205,7 @@ class BuyService
// 获取商品基础信息
$goods_base
=
GoodsService
::
GoodsSpecDetail
([
'id'
=>
$v
[
'goods_id'
],
'spec'
=>
$v
[
'spec'
]]);
$v
[
'is_invalid'
]
=
0
;
if
(
$goods_base
[
'code'
]
==
0
)
{
$v
[
'inventory'
]
=
$goods_base
[
'data'
][
'spec_base'
][
'inventory'
];
...
...
@@ -227,6 +228,25 @@ class BuyService
$v
[
'images'
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$v
[
'images'
]);
$v
[
'total_price'
]
=
$v
[
'stock'
]
*
((
float
)
$v
[
'price'
]);
$v
[
'buy_max_number'
]
=
(
$v
[
'buy_max_number'
]
<=
0
)
?
$v
[
'inventory'
]
:
$v
[
'buy_max_number'
];
// 错误处理
$v
[
'is_error'
]
=
0
;
$v
[
'error_msg'
]
=
''
;
if
(
$v
[
'is_delete_time'
]
!=
0
)
{
$v
[
'is_error'
]
=
1
;
$v
[
'error_msg'
]
=
'商品已作废'
;
}
if
(
empty
(
$v
[
'error_msg'
])
&&
$v
[
'is_invalid'
]
==
1
)
{
$v
[
'is_error'
]
=
1
;
$v
[
'error_msg'
]
=
'商品已失效'
;
}
if
(
empty
(
$v
[
'error_msg'
])
&&
$v
[
'is_shelves'
]
!=
1
)
{
$v
[
'is_error'
]
=
1
;
$v
[
'error_msg'
]
=
'商品已下架'
;
}
}
}
...
...
public/appmini/old/alipay/images/default-select-disabled-icon.png
0 → 100644
浏览文件 @
37543934
4.6 KB
public/appmini/old/alipay/pages/cart/cart.acss
浏览文件 @
37543934
...
...
@@ -38,6 +38,10 @@
.goods-item .selected {
margin-top: 60rpx;
}
.goods-item .error-msg {
color: #f00;
margin-left: 15rpx;
}
/**
* 数量操作
...
...
public/appmini/old/alipay/pages/cart/cart.axml
浏览文件 @
37543934
...
...
@@ -3,8 +3,7 @@
<swipe-action index="{{index}}" restore="{{swipe_index === null || swipe_index !== index}}" right="{{item.right}}" onRightItemClick="right_item_event" onSwipeStart="swipe_start_event" extra="{{index}}">
<!-- 选择 -->
<view onTap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
<image a:if="{{(item.selected || false)}}" class="icon" src="/images/default-select-active-icon.png" mode="widthFix" />
<image a:else class="icon" src="/images/default-select-icon.png" mode="widthFix" />
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
</view>
<view class="bg-white items">
...
...
@@ -33,6 +32,9 @@
<text class="sales-price">¥{{item.price}}</text>
<text a:if="{{item.original_price > 0}}" class="original-price">¥{{item.original_price}}</text>
<text class="buy-number cr-888">x{{item.stock}}</text>
<!-- 错误 -->
<text a:if="{{(item.is_error || 0) == 1}}" class="error-msg">{{item.error_msg}}</text>
</view>
</view>
</swipe-action>
...
...
public/appmini/old/alipay/pages/cart/cart.js
浏览文件 @
37543934
...
...
@@ -278,14 +278,20 @@ Page({
case
'
all
'
:
temp_is_selected_all
=
(
temp_is_selected_all
==
true
)
?
false
:
true
;
for
(
var
i
in
temp_data_list
)
{
temp_data_list
[
i
][
'
selected
'
]
=
temp_is_selected_all
;
if
(
temp_data_list
[
i
][
'
is_error
'
]
!=
1
)
{
temp_data_list
[
i
][
'
selected
'
]
=
temp_is_selected_all
;
}
}
break
;
// 节点操作
case
'
node
'
:
var
index
=
e
.
target
.
dataset
.
index
||
0
;
temp_data_list
[
index
][
'
selected
'
]
=
(
temp_data_list
[
index
][
'
selected
'
]
==
true
)
?
false
:
true
;
var
index
=
e
.
currentTarget
.
dataset
.
index
||
0
;
if
(
temp_data_list
[
index
][
'
is_error
'
]
!=
1
)
{
temp_data_list
[
index
][
'
selected
'
]
=
(
temp_data_list
[
index
][
'
selected
'
]
==
true
)
?
false
:
true
;
}
break
;
}
...
...
public/appmini/old/baidu/images/default-select-disabled-icon.png
0 → 100644
浏览文件 @
37543934
4.6 KB
public/appmini/old/baidu/pages/cart/cart.css
浏览文件 @
37543934
...
...
@@ -40,9 +40,11 @@
}
.goods-item
.remove
{
color
:
#e00303
;
margin-right
:
10
rpx
;
}
.goods-item
.error-msg
{
color
:
#f00
;
margin-left
:
15
rpx
;
}
/**
* 数量操作
*/
...
...
public/appmini/old/baidu/pages/cart/cart.js
浏览文件 @
37543934
...
...
@@ -254,17 +254,23 @@ Page({
var
temp_is_selected_all
=
this
.
data
.
is_selected_all
;
switch
(
type
)
{
// 批量操作
case
'
all
'
:
temp_is_selected_all
=
temp_is_selected_all
==
true
?
false
:
true
;
case
'
all
'
:
temp_is_selected_all
=
(
temp_is_selected_all
==
true
)
?
false
:
true
;
for
(
var
i
in
temp_data_list
)
{
temp_data_list
[
i
][
'
selected
'
]
=
temp_is_selected_all
;
if
(
temp_data_list
[
i
][
'
is_error
'
]
!=
1
)
{
temp_data_list
[
i
][
'
selected
'
]
=
temp_is_selected_all
;
}
}
break
;
// 节点操作
case
'
node
'
:
case
'
node
'
:
var
index
=
e
.
currentTarget
.
dataset
.
index
||
0
;
temp_data_list
[
index
][
'
selected
'
]
=
temp_data_list
[
index
][
'
selected
'
]
==
true
?
false
:
true
;
if
(
temp_data_list
[
index
][
'
is_error
'
]
!=
1
)
{
temp_data_list
[
index
][
'
selected
'
]
=
(
temp_data_list
[
index
][
'
selected
'
]
==
true
)
?
false
:
true
;
}
break
;
}
...
...
public/appmini/old/baidu/pages/cart/cart.swan
浏览文件 @
37543934
...
...
@@ -2,8 +2,7 @@
<view s-for="item, index in data_list" s-key="key" class="goods-item oh bg-white">
<!-- 选择 -->
<view bindtap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
<image s-if="(item.selected || false)" class="icon" src="/images/default-select-active-icon.png" mode="widthFix" />
<image s-else class="icon" src="/images/default-select-icon.png" mode="widthFix" />
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
</view>
<view class="bg-white items">
...
...
@@ -33,6 +32,9 @@
<text s-if="item.original_price > 0" class="original-price">¥{{item.original_price}}</text>
<text class="buy-number cr-888">x{{item.stock}}</text>
<!-- 错误 -->
<text s-if="(item.is_error || 0) == 1" class="error-msg">{{item.error_msg}}</text>
<!-- 删除操作 -->
<view class="fr remove" data-id="{{item.id}}" data-goodsid="{{item.goods_id}}" data-index="{{index}}" bindtap="cart_remove_event">移除</view>
</view>
...
...
public/appmini/old/weixin/app.json
浏览文件 @
37543934
{
"pages"
:
[
"pages/user-order-comments/user-order-comments"
,
"pages"
:
[
"pages/
cart/cart"
,
"pages/
user-order-comments/user-order-comments"
,
"pages/index/index"
,
"pages/goods-category/goods-category"
,
"pages/cart/cart"
,
"pages/user/user"
,
"pages/web-view/web-view"
,
"pages/login/login"
,
...
...
public/appmini/old/weixin/images/default-select-disabled-icon.png
0 → 100644
浏览文件 @
37543934
4.6 KB
public/appmini/old/weixin/pages/cart/cart.js
浏览文件 @
37543934
...
...
@@ -259,14 +259,20 @@ Page({
case
'
all
'
:
temp_is_selected_all
=
(
temp_is_selected_all
==
true
)
?
false
:
true
;
for
(
var
i
in
temp_data_list
)
{
temp_data_list
[
i
][
'
selected
'
]
=
temp_is_selected_all
;
if
(
temp_data_list
[
i
][
'
is_error
'
]
!=
1
)
{
temp_data_list
[
i
][
'
selected
'
]
=
temp_is_selected_all
;
}
}
break
;
// 节点操作
case
'
node
'
:
var
index
=
e
.
currentTarget
.
dataset
.
index
||
0
;
temp_data_list
[
index
][
'
selected
'
]
=
(
temp_data_list
[
index
][
'
selected
'
]
==
true
)
?
false
:
true
;
if
(
temp_data_list
[
index
][
'
is_error
'
]
!=
1
)
{
temp_data_list
[
index
][
'
selected
'
]
=
(
temp_data_list
[
index
][
'
selected
'
]
==
true
)
?
false
:
true
;
}
break
;
}
...
...
public/appmini/old/weixin/pages/cart/cart.wxml
浏览文件 @
37543934
...
...
@@ -2,8 +2,7 @@
<view wx:for="{{data_list}}" wx:key="key" class="goods-item oh bg-white">
<!-- 选择 -->
<view bindtap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
<image wx:if="{{(item.selected || false)}}" class="icon" src="/images/default-select-active-icon.png" mode="widthFix" />
<image wx:else class="icon" src="/images/default-select-icon.png" mode="widthFix" />
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
</view>
<view class="bg-white items">
...
...
@@ -33,6 +32,9 @@
<text wx:if="{{item.original_price > 0}}" class="original-price">¥{{item.original_price}}</text>
<text class="buy-number cr-888">x{{item.stock}}</text>
<!-- 错误 -->
<text wx:if="{{(item.is_error || 0) == 1}}" class="error-msg">{{item.error_msg}}</text>
<!-- 移除 -->
<view class="fr remove" data-id="{{item.id}}" data-goodsid="{{item.goods_id}}" data-index="{{index}}" bindtap="cart_remove_event">移除</view>
</view>
...
...
public/appmini/old/weixin/pages/cart/cart.wxss
浏览文件 @
37543934
...
...
@@ -40,7 +40,10 @@
}
.goods-item .remove {
color: #e00303;
margin-right: 10rpx;
}
.goods-item .error-msg {
color: #f00;
margin-left: 15rpx;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录