am-warning am-danger">
+
+ am-warning am-danger">
|
- disabled />
+ disabled />
-
- ¥{{$cart.original_price}}
+
+ ¥{{$goods.original_price}}
- ¥{{$cart.price}}
- x{{$cart.stock}}
+ ¥{{$goods.price}}
+ x{{$goods.stock}}
|
-
- ¥{{$cart.original_price}}
+
+ ¥{{$goods.original_price}}
- ¥{{$cart.price}}
+ ¥{{$goods.price}}
|
- |
- ¥{{$cart.total_price}}
+ ¥{{$goods.total_price}}
|
- 删除
+ 删除
|
@@ -94,10 +94,14 @@
清空
- 已选商品 0 件
- 合计:
- ¥0.00
-
+
diff --git a/service/Application/Home/View/Default/Goods/Index.html b/service/Application/Home/View/Default/Goods/Index.html
index 014fc568c..c2daed84d 100755
--- a/service/Application/Home/View/Default/Goods/Index.html
+++ b/service/Application/Home/View/Default/Goods/Index.html
@@ -184,6 +184,15 @@
+
+
+
商品已下架
@@ -214,7 +223,7 @@
-
+
diff --git a/service/Application/Service/BuyService.class.php b/service/Application/Service/BuyService.class.php
index 1865d715b..f785360fa 100644
--- a/service/Application/Service/BuyService.class.php
+++ b/service/Application/Service/BuyService.class.php
@@ -2,6 +2,8 @@
namespace Service;
+use Service\GoodsService;
+
/**
* 购买服务层
* @author Devil
@@ -55,24 +57,7 @@ class BuyService
}
// 属性处理
- $attr = [];
- if(!empty($params['attr']) && is_array($params['attr']))
- {
- foreach($params['attr'] as $k=>$v)
- {
- $attr_type_name = M('GoodsAttributeType')->where(['goods_id'=>$goods_id, 'id'=>$k])->getField('name');
- $attr_name = M('GoodsAttribute')->where(['goods_id'=>$goods_id, 'id'=>$v])->getField('name');
- if(!empty($attr_type_name) && !empty($attr_name))
- {
- $attr[] = [
- 'attr_type_id' => $k,
- 'attr_type_name' => $attr_type_name,
- 'attr_id' => $v,
- 'attr_name' => $attr_name,
- ];
- }
- }
- }
+ $attr = self::GoodsAttrParsing($params);
// 添加购物车
$data = [
@@ -109,6 +94,38 @@ class BuyService
return DataReturn(L('common_join_error'), -100);
}
+ /**
+ * 商品属性解析
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-21
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ private static function GoodsAttrParsing($params = [])
+ {
+ $data = [];
+ if(!empty($params['attr']) && is_array($params['attr']) && !empty($params['goods_id']))
+ {
+ foreach($params['attr'] as $k=>$v)
+ {
+ $attr_type_name = M('GoodsAttributeType')->where(['goods_id'=>$params['goods_id'], 'id'=>$k])->getField('name');
+ $attr_name = M('GoodsAttribute')->where(['goods_id'=>$params['goods_id'], 'id'=>$v])->getField('name');
+ if(!empty($attr_type_name) && !empty($attr_name))
+ {
+ $data[] = [
+ 'attr_type_id' => $k,
+ 'attr_type_name' => $attr_type_name,
+ 'attr_id' => $v,
+ 'attr_name' => $attr_name,
+ ];
+ }
+ }
+ }
+ return $data;
+ }
+
/**
* 获取购物车列表
* @author Devil
@@ -134,10 +151,10 @@ class BuyService
return DataReturn($ret, -1);
}
- $where = [
- 'c.user_id'=>$params['user']['id'],
- ];
- $field = 'c.*, g.title, g.images, g.original_price, g.price, g.inventory, g.is_shelves, g.is_delete_time';
+ $where = (!empty($params['where']) && is_array($params['where'])) ? $params['where'] : [];
+ $where['c.user_id'] = $params['user']['id'];
+
+ $field = 'c.*, g.title, g.images, g.original_price, g.price, g.inventory, g.inventory_unit, g.is_shelves, g.is_delete_time';
$data = M('Cart')->alias('c')->join(' __GOODS__ AS g ON g.id=c.goods_id')->where($where)->field($field)->select();
if(!empty($data) && is_array($data))
{
@@ -251,5 +268,113 @@ class BuyService
}
return DataReturn(L('common_operation_update_error'), -100);
}
+
+ /**
+ * 下订单 - 正常购买
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-21
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function BuyGoods($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'stock',
+ 'error_msg' => '购买数量有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'goods_id',
+ 'error_msg' => '商品id有误',
+ ],
+ [
+ 'checked_type' => 'isset',
+ 'key_name' => 'attr',
+ 'error_msg' => '属性参数有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'user',
+ 'error_msg' => '用户信息有误',
+ ],
+ ];
+ $ret = params_checked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 获取商品
+ $p = [
+ 'where' => [
+ 'g.id' => intval($params['goods_id']),
+ 'g.is_delete_time' => 0,
+ 'g.is_shelves' => 1,
+ ],
+ 'field' => 'g.id, g.id AS goods_id, g.title, g.images, g.original_price, g.price, g.inventory, g.inventory_unit',
+ ];
+ $goods = GoodsService::GoodsList($p);
+ if(empty($goods[0]))
+ {
+ return DataReturn(L('common_data_no_exist_error'), -10);
+ }
+
+ // 数量/小计
+ $goods[0]['stock'] = $params['stock'];
+ $goods[0]['total_price'] = $params['stock']*$goods[0]['price'];
+
+ // 属性
+ if(!empty($params['attr']))
+ {
+ $params['attr'] = json_decode($params['attr'], true);
+ }
+ $goods[0]['attribute'] = self::GoodsAttrParsing($params);
+
+ return DataReturn(L('common_operation_success'), 0, $goods);
+ }
+
+ /**
+ * 下订单 - 购物车
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-21
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function BuyCart($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'ids',
+ 'error_msg' => '购物车id有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'user',
+ 'error_msg' => '用户信息有误',
+ ],
+ ];
+ $ret = params_checked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 获取购物车数据
+ $params['where'] = [
+ 'g.is_delete_time' => 0,
+ 'g.is_shelves' => 1,
+ 'c.id' => ['in', explode(',', $params['ids'])],
+ ];
+ return self::CartList($params);
+ }
}
?>
\ No newline at end of file
diff --git a/service/Application/Service/ResourcesService.class.php b/service/Application/Service/ResourcesService.class.php
new file mode 100644
index 000000000..d4b5af9cd
--- /dev/null
+++ b/service/Application/Service/ResourcesService.class.php
@@ -0,0 +1,76 @@
+where(['id'=>intval($params['region_id'])])->getField('name');
+ }
+
+ /**
+ * 快递列表
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-19
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function ExpressList($params = [])
+ {
+ $where = ['is_enable'=>1];
+ $data = M('Express')->where($where)->field('id,icon,name,sort')->order('sort asc')->select();
+ if(!empty($data) && is_array($data))
+ {
+ $images_host = C('IMAGE_HOST');
+ foreach($data as &$v)
+ {
+ $v['icon'] = empty($v['icon']) ? null : $images_host.$v['icon'];
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * 支付方式列表
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-19
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function PaymentList($params = [])
+ {
+ $where = ['is_enable'=>1];
+ $data = M('Payment')->where($where)->field('id,logo,name,sort,payment')->order('sort asc')->select();
+ if(!empty($data) && is_array($data))
+ {
+ $images_host = C('IMAGE_HOST');
+ foreach($data as &$v)
+ {
+ $v['logo'] = empty($v['logo']) ? null : $images_host.$v['logo'];
+ }
+ }
+ return $data;
+ }
+}
+?>
\ No newline at end of file
diff --git a/service/Application/Service/UserService.class.php b/service/Application/Service/UserService.class.php
new file mode 100644
index 000000000..25976eafe
--- /dev/null
+++ b/service/Application/Service/UserService.class.php
@@ -0,0 +1,95 @@
+ 'empty',
+ 'key_name' => 'user',
+ 'error_msg' => '用户信息有误',
+ ],
+ ];
+ $ret = params_checked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ $where = (!empty($params['where']) && is_array($params['where'])) ? $params['where'] : [];
+ $where['user_id'] = $params['user']['id'];
+ $where['is_delete_time'] = 0;
+
+ // 获取用户地址
+ $field = 'id,alias,name,tel,province,city,county,address,lng,lat,is_default';
+ $data = M('UserAddress')->where($where)->field($field)->order('id desc')->select();
+ if(!empty($data))
+ {
+ foreach($data as &$v)
+ {
+ $v['province_name'] = ResourcesService::RegionName(['region_id'=>$v['province']]);
+ $v['city_name'] = ResourcesService::RegionName(['region_id'=>$v['city']]);
+ $v['county_name'] = ResourcesService::RegionName(['region_id'=>$v['county']]);
+ }
+ }
+ return DataReturn(L('common_operation_success'), 0, $data);
+ }
+
+ /**
+ * 用户默认地址
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-08-29
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function UserDefaultAddress($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'user',
+ 'error_msg' => '用户信息有误',
+ ],
+ ];
+ $ret = params_checked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 获取用户地址
+ $params['where'] = ['is_default'=>1];
+ $ret = self::UserAddressList($params);
+ if(!empty($ret['data'][0]))
+ {
+ $ret['data'] = $ret['data'][0];
+ }
+ return $ret;
+ }
+}
+?>
\ No newline at end of file
diff --git a/service/Public/Home/Default/Css/Buy.css b/service/Public/Home/Default/Css/Buy.css
new file mode 100644
index 000000000..86cc1795b
--- /dev/null
+++ b/service/Public/Home/Default/Css/Buy.css
@@ -0,0 +1,211 @@
+.hidden { display: none !important;}
+.address-default { display:block !important;}
+/*地址管理*/
+.concent h3,.business-item h3{border-bottom: 2px solid #e7c3c8; margin-top:15px;}
+h3 { font-size: 14px;font-weight: 700;}
+.address h3 { border-bottom:none;}
+ul.address-list li{display:none;width:100%;padding:10px;position: relative;min-height:80px;}
+.address-left{ width:90%;float:left;position: relative;}
+.user.DefaultAddr {font-size: 14px;font-weight: 700;}
+.address-right{ float:right; margin-right:5px;padding-top:15px ;}
+.deftip {position: absolute;top: 0px;right: 0px;padding: 0px 2px;text-decoration: none;opacity: 0.7; z-index: 3;background: #CCC none repeat scroll 0% 0%;
+color: #FFF;}
+
+/*地址操作-编辑删除*/
+.new-addr-btn {display:none;font-size: 12px;color: #282828;text-align: right; padding-right:5px ;}
+.new-addr-bar {padding: 0px 5px;vertical-align: top;}
+
+/*物流*/
+.business-item ul li { border:1px solid transparent ;overflow: hidden; }
+ul.logistics-list li.selected, ul.payment-list li.selected {border-color:#d2364c ;position:relative ;}
+ul.logistics-list li.selected i.icon-active, ul.payment-list li.selected i.icon-active {
+ position: absolute;
+ width: 10px;
+ height: 10px;
+ font-size: 0;
+ line-height: 0;
+ right: 0px;
+ bottom: 0px;
+ background: url(../images/sys_item_selected.gif) no-repeat right bottom;
+}
+.business-item ul { padding: 10px 3px 5px 5px;}
+.business-item ul li { float: left; cursor: pointer; padding: 5px; border: 1px solid #eee; }
+ul.logistics-list li img, ul.payment-list li img { width: 36px; height: 36px; }
+.business-item ul li { margin: 0 10px 10px 0; }
+
+/*运费、留言*/
+.buy-message{padding:0px 5px}
+.td.td-oplist .pay-logis,.td.td-bonus select{position:absolute;top:6px;right:0;}
+.memo-input{width:calc(100% - 64px);border: 1px solid #ccc;padding: 5px;outline:none;border-radius: 2px;}
+
+/*合计*/
+.buy-point-discharge{font-size:14px ;font-weight: 700;padding:10px 0px;text-align: right;}
+.pay-sum{color:#F64000;margin-left:5px ;}
+
+.pay-confirm.clearfix{width: 100%;}
+.box{float:left;width:70%;height:40px ;line-height:40px ;font-size: 14px;text-align: right;padding-right:10px ;}
+.pay-address{display: none;}
+.submitOrder a{float:left;width:30%;color:#fff ;background:#f40 ;text-align: center;height:40px ;line-height:40px ;font-size: 14px;}
+
+.td.td-coupon select, .td.td-bonus select{border-color:#CCC;line-height: 24px;height:24px;margin-top:4px;}
+.coupon-title,.bonus-title{line-height: 24px;height:24px}
+.order-go{position: fixed;bottom: 0;width:100% ;background: #fff;border-top:1px solid #F5F5F5 ;}
+
+.theme-popover{display: none;}
+
+.link-list h3 { padding: 0 0 5px 5px; }
+ul.address-list, .business-item ul { overflow: hidden; }
+
+@media only screen and (min-width:640px)
+{
+ .pay-way{float: right;}
+ #payTable .th{border-top: none;}
+ .th .td-inner{padding-left:0px ;}
+ .wp{padding: 0px 10px;background: #F5F5F5;}
+ /*地址操作*/
+ .address { padding: 0 1px 0 5px; }
+ .address .control { margin-bottom: 10px; }
+ .address .control h3{ display: -webkit-inline-box; border: none;margin-top:20px; }
+ .am-form-content {margin-left:75px;}
+ .am-form-label {width:60px;float: left;}
+ .link-list{ margin:10px; }
+ .link-list h3 {padding-bottom:5px;}
+
+ /*物流*/
+ .business-item ul li {width:calc(25% - 8px); }
+ .business-item ul li:nth-child(4n) { margin-right: 0; }
+
+
+ /*订单管理*/
+
+ .td.td-info {width: 50%;}
+ .pay-phone{overflow:visible;padding-bottom:0px;margin-bottom:0px;}
+ .th.th-item,.td.td-amount .amount-wrapper .sl{text-align: center;width: auto;}
+ .item-content .price-now {line-height:18px ;font-size:12px ;font-weight: 100;}
+
+ .th.th-item{width:50%;margin-right:0;}
+ .th.th-price, .td.td-price ,.th.th-sum, .td.td-sum {width: 10%;}
+ .th.th-amount, .td.td-amount {width:20%;}
+ .th.th-oplist,.td.td-oplist{width:10%;text-align: center;padding-left:0 ;}
+
+ /*文字说明布局*/
+ .td.td-amount .phone-title,.td.td-oplist .phone-title{display: none;}
+ .td.td-oplist .pay-logis,.td.td-amount .sl,.td.td-coupon select,.td.td-bonus select{position: static;}
+ .td.td-amount .amount-wrapper, .td.td-oplist{padding:0px ; border: none;}
+
+ /*留言*/
+ .buy-message{border:1px solid #eee; overflow: hidden;padding: 10px; margin: 0 5px;}
+ .order-extra{border: none;float: left;width: 60%;}
+ .memo-input{min-width:280px ;width:80%; }
+
+ /*带个人信息的结算*/
+ .box ,.submitOrder a{float:right;width:auto;height:auto;padding:10px 10px;}
+ .pay-address{display:block;}
+ .box{font-size:12px;overflow: hidden;border: 2px solid #f40;}
+
+ .order-go {clear: both;text-align: right;position: relative;margin-top: 10px;border: none;}
+ .order-go .address-confirm .box{position: relative;float: right;z-index: 100;padding-right:2%; padding-bottom:10px;border: 1px solid #f50;font-family: tahoma;display: inline-block;right: 0;background-color: #fff0e8;}
+
+ .submitOrder .go-btn-wrap {width:100%;overflow: hidden;padding-top:10px;margin-bottom: 10px;}
+ .submitOrder .btn-go {display: block;padding: 0 26px;height: 36px;font: 400 18px/36px arial;font-size: 18px;background-color: #f50;color: #fff;text-align: center;cursor: pointer;outline: 0; z-index:999;}
+ .realPay {line-height: 16px;margin: 0px 0px 15px;position: relative;}
+ .realPay .g_price span {font-size: 26px;}
+ .price .style-large-bold-red {color: #FF4200;font: 700 26px tahoma;}
+ .order-go .buy-footer-address .buy-line-title {color: #404040;font-weight: 700;}
+ .td.td-coupon select, .td.td-bonus select {margin-top:0 ;}
+
+
+ .theme-popover-mask{z-index:10000000;position:fixed;left:0;top:0;width:100%;height:100%;background:#000;opacity:0.5;filter:alpha(opacity=50);-moz-opacity:0.5;display:none;}
+ .theme-popover{z-index:10000009;position:fixed;bottom:50%;left:50%;width:500px;height:400px;margin-bottom:-200px;margin-left:-250px;display:none;background:#fff;overflow: hidden;}
+ .theme-poptit{padding:12px;position:relative;}
+ .theme-poptit .close:hover{color:#444;}
+
+ .theme-popover .am-form-content.address select{width:32.3333%;margin-right:1%;float: left;}
+ .am-padding { padding: 10px 10px;}
+ hr {margin: 5px 0px;}
+ .am-form-group {margin-bottom: 10px}
+
+
+ .td.td-amount{margin-top: 15px}
+
+
+ .link-list{margin:0px auto;}
+ /*地址管理*/
+ .address ul{margin-top:10px ;}
+ ul.address-list li{display:block; width: calc(33% - 5px);height: 150px;float: left;background-image: url(../images/peraddbg.png); background-repeat: no-repeat; background-size: 100% 100%; margin:0 10px 10px 0 ;padding:10px;}
+ ul.address-list li.address-default{background-image: url(../images/peraddressbg.png);}
+ ul.address-list li:nth-child(3n) { margin-right: 0; }
+ .address-left{ width:100%;position: relative;}
+ .th .td-inner{padding-left:0 ;}
+
+ /*地址操作*/
+ .new-addr-btn {display:block;position: absolute;bottom:25px ;right:10px ;}
+ .new-addr-bar {padding: 0px 5px;vertical-align: top;}
+
+ .td.td-item ,.td.td-info{width: 50%;}
+ .td.td-info{position: absolute;margin-top:0px;}
+ .td.td-info .item-props{text-align: left;padding-top:0px ;}
+ .address-right .am-icon-angle-right { display: none; }
+}
+
+@media only screen and (min-width:1025px)
+{
+ .link-list{ margin:0; }
+ ul.address-list li { width: calc(25% - 8px); }
+ ul.address-list li:nth-child(4n) { margin-right: 0; }
+ ul.address-list li:nth-child(3n) { margin-right: 10px; }
+ .address { padding: 0; }
+
+ .business-item ul li { width: calc(20% - 8px); }
+ .business-item ul li:nth-child(5n) { margin-right: 0; }
+ .business-item ul li:nth-child(4n) { margin-right: 10px; }
+ .business-item ul { padding: 10px 0 0 0; }
+ .link-list h3 { padding: 0 0 5px 0; }
+ .buy-message { margin: 0; }
+}
+
+@media only screen and (max-width:640px)
+{
+ .address { margin-top: 10px; padding-top: 10px; }
+ .address, .buy-message { border-top: 1px solid #eee; }
+ .address .control { display: none; }
+ .address-default {background: url(../images/peraddress.png) repeat-x; background-position: bottom; }
+ ul.address-list li { padding: 0 5px; min-height: 65px; }
+
+ .business-item ul li { width: calc(50% - 6px); }
+ .business-item ul li:nth-child(2n) { margin-right: 0; }
+ .buy-message { padding-top: 10px; }
+}
+
+
+/**
+ * 商品列表
+ */
+.goods-detail img { width: 80px; height: 80px; }
+.goods-detail { position: relative; }
+.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
+.goods-title:hover { text-decoration: underline; }
+.goods-base { position: absolute; top: 0; left: 85px; }
+.goods-attr { margin-top: 5px; }
+.goods-attr li { color: #888; line-height: 16px; }
+.original-price, .line-price { font-family: Verdana,Tahoma,arial; }
+.original-price { color: #9c9c9c; text-decoration: line-through; }
+.line-price { color: #3c3c3c; }
+.line-price, strong.total-price-content { font-weight: 700; }
+strong.total-price-content { color: #d2364c; font-size: 16px; }
+.am-table { margin-bottom: 10px; }
+.am-table > tbody > tr > td { border-top: 1px solid #F5F5F5; }
+.am-table > thead > tr > th { border-bottom: 1px solid #f7f7f7; }
+@media only screen and (min-width:640px) {
+ .cart-content table tr .base { width: 40%; }
+ .cart-content table tr .price { width: 20%; }
+ .cart-content table tr .number { width: 20%; }
+ .cart-content table tr .total-price { width: 20%; }
+ .cart-content { margin-top: 20px; }
+}
+
+@media only screen and (max-width:640px) {
+ .cart-content table tr .base { width: 100%; }
+}
+
+
diff --git a/service/Public/Home/Default/Css/Goods.css b/service/Public/Home/Default/Css/Goods.css
index ea6461694..1626925bf 100755
--- a/service/Public/Home/Default/Css/Goods.css
+++ b/service/Public/Home/Default/Css/Goods.css
@@ -21,7 +21,7 @@ input{font-size:12px;font-size:100%;outline:none;line-height:normal;color:#444;}
.scoll { margin-bottom: 10px; }
/*内容布局*/
-.theme-popover .theme-poptit h3,.btn.close,i.buy-event{display:none}
+.theme-popover .theme-poptit h3,.btn.close,i.buy-event, form.buy-form {display:none}
.theme-span{width:100%;background:transparent;height: 15px;}
.theme-popbod.dform{background:#fff;}
/*商品信息*/
diff --git a/service/Public/Home/Default/Js/Buy.js b/service/Public/Home/Default/Js/Buy.js
new file mode 100644
index 000000000..7716d409c
--- /dev/null
+++ b/service/Public/Home/Default/Js/Buy.js
@@ -0,0 +1,47 @@
+$(function() {
+ // 地址选择
+ $('ul.address-list li').click(function() {
+ $(this).addClass("address-default").siblings().removeClass("address-default");
+ });
+
+ // 混合列表选择
+ $('.business-item ul li').on('click', function() {
+ if ($(this).hasClass('selected')) {
+ $(this).removeClass('selected');
+ } else {
+ $(this).addClass('selected').siblings("li").removeClass('selected');
+ }
+ });
+
+
+
+// 弹出地址选择
+
+
+ var $ww = $(window).width();
+
+ $('.address-submit').click(function() {
+// 禁止遮罩层下面的内容滚动
+ $(document.body).css("overflow","hidden");
+
+ $(this).addClass("selected");
+ $(this).parent().addClass("selected");
+
+
+ $('.theme-popover-mask').show();
+ $('.theme-popover-mask').height($(window).height());
+ $('.theme-popover').slideDown(200);
+
+ })
+
+ $('.theme-poptit .close,.btn-op .close').click(function() {
+
+ $(document.body).css("overflow","visible");
+ $('.address-submit').removeClass("selected");
+ $('.item-props-can').removeClass("selected");
+ $('.theme-popover-mask').hide();
+ $('.theme-popover').slideUp(200);
+ });
+
+
+});
\ No newline at end of file
diff --git a/service/Public/Home/Default/Js/Cart.js b/service/Public/Home/Default/Js/Cart.js
index a46aa2485..0ab5eeeb8 100644
--- a/service/Public/Home/Default/Js/Cart.js
+++ b/service/Public/Home/Default/Js/Cart.js
@@ -5,6 +5,7 @@ $(function()
{
var total_stock = 0;
var total_price = 0.00;
+ var ids = [];
$('.am-table input[type="checkbox"]').each(function(k, v)
{
if($(this).prop('checked'))
@@ -13,11 +14,12 @@ $(function()
var price = parseFloat($(this).parents('tr').find('.stock-tag').data('price'));
total_stock += stock;
total_price += stock*price;
+ ids.push($(this).val());
}
});
$('.cart-nav .selected-tips strong').text(total_stock);
$('.cart-nav .nav-total-price').text('¥'+FomatFloat(total_price));
- console.log(total_stock, total_price)
+ $('.cart-nav input[name="ids"]').val(ids.toString() || 0);
}
// 购物车数量操作
@@ -140,4 +142,19 @@ $(function()
cart_nav_pop();
});
+ // 结算事件
+ $('.separate-submit').on('click', function()
+ {
+ // 计算选择的商品总数和总价
+ cart_base_total();
+
+ // 获取购物车id
+ var ids = $(this).parents('form').find('input[name="ids"]').val() || 0;
+ if(ids == 0)
+ {
+ Prompt('请选择商品');
+ return false;
+ }
+ });
+
});
\ No newline at end of file
diff --git a/service/Public/Home/Default/Js/Goods.js b/service/Public/Home/Default/Js/Goods.js
index a4ea0f23b..12a1c59dd 100755
--- a/service/Public/Home/Default/Js/Goods.js
+++ b/service/Public/Home/Default/Js/Goods.js
@@ -61,7 +61,10 @@ function CartAdd(e)
{
// 立即购买
case 'buy' :
- alert('buy - stock:'+stock+' , attr:'+ JSON.stringify(attr));
+ var $form_buy = $('form.buy-form');
+ $form_buy.find('input[name="attr"]').val(JSON.stringify(attr));
+ $form_buy.find('input[name="stock"]').val(stock);
+ $form_buy.find('button[type="submit"]').trigger('click');
break;
// 加入购物车