mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 10:59:47 +08:00
购物车商品错误处理
This commit is contained in:
parent
4727b294eb
commit
3754393462
@ -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">
|
||||
|
@ -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'] = '商品已下架';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
@ -38,6 +38,10 @@
|
||||
.goods-item .selected {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
.goods-item .error-msg {
|
||||
color: #f00;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数量操作
|
||||
|
@ -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>
|
||||
|
@ -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) {
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
BIN
public/appmini/old/baidu/images/default-select-disabled-icon.png
Normal file
BIN
public/appmini/old/baidu/images/default-select-disabled-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
@ -40,9 +40,11 @@
|
||||
}
|
||||
.goods-item .remove {
|
||||
color: #e00303;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.goods-item .error-msg {
|
||||
color: #f00;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
/**
|
||||
* 数量操作
|
||||
*/
|
||||
|
@ -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) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"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",
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
@ -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) {
|
||||
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;
|
||||
if (temp_data_list[index]['is_error'] != 1)
|
||||
{
|
||||
temp_data_list[index]['selected'] = (temp_data_list[index]['selected'] == true) ? false : true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -40,7 +40,10 @@
|
||||
}
|
||||
.goods-item .remove {
|
||||
color: #e00303;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.goods-item .error-msg {
|
||||
color: #f00;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user