You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

647 lines
24 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  2. <title>确认订单</title><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
  3. <link href="<?php echo env('APP_URL'); ?>/css/weixin/style.css" type="text/css" rel="stylesheet">
  4. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/jquery.min.js"></script>
  5. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/weixin/mobile.js"></script>
  6. <link href="<?php echo env('APP_URL'); ?>/css/font-awesome.min.css" type="text/css" rel="stylesheet">
  7. <meta name="keywords" content="关键词"><meta name="description" content="描述"></head><body style="background-color:#f1f1f1;">
  8. <!-- 订单确认信息-start -->
  9. <div id="checkout_info">
  10. <div class="classreturn loginsignup">
  11. <div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div>
  12. <div class="ds-in-bl tit center"><span>确认订单</span></div>
  13. <div class="ds-in-bl nav_menu"><a href="javascript:void(0);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/class1.png" alt="菜单"></a></div>
  14. </div>
  15. @include('weixin.common.headerNav')
  16. <form action="<?php echo route('weixin_cart_done'); ?>" method="post" id="myform">
  17. <input type="hidden" name="cartids" id="cartids" value="<?php echo $cartids; ?>">
  18. <!-- 选择收货地址-start -->
  19. <a href="javascript:;" onclick="selectaddress();">
  20. <div class="checkout-addr">
  21. <input name="default_address_id" type="hidden" id="default_address_id" value="<?php if($user_default_address){echo $user_default_address['id'];} ?>">
  22. <p class="title"><span class="name" id="default_consignee"><?php if($user_default_address){echo $user_default_address['name'];} ?></span> <span class="tel" id="default_phone"><?php if($user_default_address){echo $user_default_address['mobile'];} ?></span></p>
  23. <p class="des" id="default_address"><?php if($user_default_address){ ?><?php echo $user_default_address['province_name']; ?><?php echo $user_default_address['city_name']; ?><?php echo $user_default_address['district_name']; ?> <?php echo $user_default_address['address']; ?><?php }else{ ?>请添加收货地址<?php } ?></p>
  24. <i></i>
  25. </div>
  26. </a>
  27. <style>
  28. .checkout-addr{position: relative;/* border-top: 1px solid #e3e3e3;border-bottom: 1px solid #e3e3e3; */background: #fff;margin-top:10px;padding:10px;}
  29. .checkout-addr p{margin-right:20px;}.checkout-addr .title{font-size:18px;color:#353535;}.checkout-addr .des{color:#9b9b9b;}
  30. .checkout-addr i{position: absolute;top: 50%;right:12px;margin-top:-6px;color:#bbb;display:inline-block;border-right:2px solid;border-bottom:2px solid;width:12px;height:12px;transform:rotate(-45deg);}
  31. </style>
  32. <script>
  33. function selectaddress()
  34. {
  35. $('#addressList').show();
  36. $('#checkout_info').hide();
  37. }
  38. </script>
  39. <!-- 选择收货地址-end -->
  40. <!-- 订单商品列表-start -->
  41. <ul class="goodslist">
  42. <?php if($checkout_goods['list']){foreach($checkout_goods['list'] as $k=>$v){ ?>
  43. <li>
  44. <img src="<?php echo $v['litpic']; ?>">
  45. <p><b><?php echo $v['title']; ?></b><span>¥<?php echo $v['final_price']; ?><i>x<?php echo $v['goods_number']; ?></i></span></p>
  46. </li>
  47. <?php }} ?>
  48. </ul>
  49. <style>
  50. .goodslist{background-color:#fff;margin-top:10px;}
  51. .goodslist li{display:-webkit-box;margin:0 10px;padding:10px;border-bottom: 1px solid #f1f1f1;}
  52. .goodslist li img{margin-right:10px;display:block;width:78px;height:78px;border: 1px solid #e1e1e1;}
  53. .goodslist li p {display: block;-webkit-box-flex: 1;width: 100%;}
  54. .goodslist li p b {display:block;font-size:16px;font-weight:400;line-height: 28px;color:#333;}
  55. .goodslist li p span {color:#f23030;font-size:18px;display: block;padding-top:8px;}
  56. .goodslist li p i{color:#666;float:right;font-size:14px;}
  57. </style>
  58. <!-- 订单商品列表-end -->
  59. <div class="floor">
  60. <ul class="fui-list mt10">
  61. <!-- <a href="javascript:update_pay_mode_layer();"><li>
  62. <div class="ui-list-info">
  63. <h4 class="ui-nowrap">支付方式</h4>
  64. <div class="ui-txt-info"><span id="paytext">微信支付</span> &nbsp;</div>
  65. <input type="hidden" name="payid" id="payid" value="2">
  66. </div>
  67. <i class="fa fa-angle-right" aria-hidden="true"></i>
  68. </li></a>
  69. <script>
  70. function update_pay_mode_layer()
  71. {
  72. //询问框
  73. layer.open({
  74. content: '<div style="padding:15px;"><?php if($is_balance_enough){ ?><a style="margin-bottom:10px;background-color:#1aad19;border:1px solid #179e16;color:white;border-radius:2px;text-align:center;" class="bottoma" onclick="layer.closeAll();" href="javascript:update_pay_mode(1,\'余额支付\');">账户余额 <?php echo $user_info['money']; ?>元</a><?php }else{ ?><a style="margin-bottom:10px;background-color:#999;border:1px solid #999;color:white;border-radius:2px;text-align:center;" class="bottoma" href="javascript:;">余额不足 <?php echo $user_info['money']; ?>元</a><?php } ?><a style="background-color:#ea5a3d;border:1px solid #dd2727;color:white;border-radius:2px;text-align:center;" class="bottoma" onclick="layer.closeAll();" href="javascript:update_pay_mode(2,\'微信支付\');">微信支付</a></div>'
  75. });
  76. }
  77. function update_pay_mode(id,name)
  78. {
  79. $("#paytext").html(name);
  80. $("#payid").val(id);
  81. }
  82. </script> -->
  83. <a href="javascript:select_bonus_layer();"><li>
  84. <div class="ui-list-info">
  85. <h4 class="ui-nowrap">优惠券</h4>
  86. <div class="ui-txt-info"><span id="bonustext">请选择优惠券</span> &nbsp;</div>
  87. <input type="hidden" name="user_bonus_id" id="user_bonus_id" value="0">
  88. </div>
  89. <i class="fa fa-angle-right" aria-hidden="true"></i>
  90. </li></a>
  91. <script>
  92. function select_bonus_layer()
  93. {
  94. //询问框
  95. layer.open({
  96. title: [
  97. '请选择优惠券',
  98. 'background-color: #FF4351; color:#fff;'
  99. ]
  100. ,content: '<div><?php if($bonus_list){foreach($bonus_list as $k=>$v){ ?><a style="margin-bottom:10px;background-color:#1aad19;border:1px solid #179e16;color:white;border-radius:2px;text-align:center;" class="bottoma" onclick="layer.closeAll();" href="javascript:select_bonus(<?php echo $v['user_bonus_id']; ?>,\'省<?php echo $v['money']; ?>元\',<?php echo $v['money']; ?>);">省<?php echo $v['money']; ?>元</a><?php }} ?><a style="background-color:#ea5a3d;border:1px solid #dd2727;color:white;border-radius:2px;text-align:center;" class="bottoma" onclick="layer.closeAll();" href="javascript:select_bonus(0,\'不使用优惠\',0);">不使用优惠</a></div>'
  101. });
  102. }
  103. function select_bonus(id,name,money)
  104. {
  105. $("#bonustext").html(name);
  106. $("#user_bonus_id").val(id);
  107. //更改总计价格
  108. change_totalamount(money);
  109. }
  110. function change_totalamount(discount)
  111. {
  112. totalamount = $("#product_total_price").val(); //商品总价
  113. shipping_costs = $("#shipping_costs").val(); //运费
  114. totalamount = parseFloat(totalamount) + parseFloat(shipping_costs) - parseFloat(discount);
  115. $("#totalamount").html(totalamount.toFixed(2));
  116. }
  117. function submit_form()
  118. {
  119. //payid = $("#payid").val();
  120. //if(payid==''){alert("请选择支付方式");}
  121. default_address_id = $("#default_address_id").val();
  122. if(default_address_id==''){alert("请选择收货地址");}
  123. var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字
  124. /* if (!re.test(payid))
  125. {
  126. alert("支付方式格式不正确");
  127. return false;
  128. } */
  129. if (!re.test(default_address_id))
  130. {
  131. alert("收货地址格式不正确");
  132. return false;
  133. }
  134. //询问框
  135. layer.open({
  136. content: '您确定要提交吗?'
  137. ,btn: ['确定', '取消']
  138. ,yes: function(index){
  139. document.getElementById("myform").submit();
  140. }
  141. });
  142. }
  143. </script>
  144. </ul></div>
  145. <div class="floor" style="background-color:#fff;margin-top:10px;padding:10px;">
  146. <div class="buy_note">
  147. <div class="buy_note_tit"><span>备注</span></div>
  148. <textarea name="message" rows="3" placeholder="给卖家留言"></textarea>
  149. </div>
  150. <div class="order_check_info">
  151. <p><?php echo $checkout_goods['total_goods']; ?>件商品</p>
  152. <!-- <p>运费:¥0</p> -->
  153. <input type="hidden" name="shipping_costs" id="shipping_costs" value="0">
  154. <input type="hidden" name="product_total_price" id="product_total_price" value="<?php echo $checkout_goods['total_price']; ?>">
  155. <p>应付款金额:<span class="red">¥<i id="totalamount"><?php echo $checkout_goods['total_price']; ?></i></span></p>
  156. </div>
  157. </div>
  158. <style>
  159. .buy_note{margin:5px 0 15px 0;}
  160. .buy_note_tit{font-size:16px;margin-bottom:15px;}
  161. .buy_note textarea{display:block;font-size: 14px;border:1px solid #e1e1e1;width: 100%;padding:10px;box-sizing: border-box;}
  162. .order_check_info p{text-align:right;line-height:22px;color: #666;font-size:14px;}
  163. .order_check_info p .red{color:#ff5500;font-size:18px;}
  164. </style>
  165. <div class="setting"><div class="close"><a href="javascript:submit_form();" id="logout">提交</a></div></div>
  166. </form>
  167. </div>
  168. <!-- 订单确认信息-end -->
  169. <!-- 收货地址选择-start -->
  170. <div id="addressList" style="display:none;">
  171. <div class="classreturn loginsignup">
  172. <div class="ds-in-bl return"><a href="javascript:addressback();"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div>
  173. <div class="ds-in-bl tit center"><span>选择收货地址</span></div>
  174. </div>
  175. <script>
  176. function addressback()
  177. {
  178. $('#checkout_info').show();
  179. $('#addressList').hide();
  180. }
  181. function defaultback(id)
  182. {
  183. setdefault(id);
  184. addressback();
  185. //var url = "";
  186. //location.href = url;
  187. }
  188. function setdefault(id)
  189. {
  190. var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
  191. var url = '<?php echo env('APP_API_URL').'/user_address_setdefault'; ?>';
  192. $.post(url,{access_token:access_token,id:id},function(res)
  193. {
  194. if (res.code == 0)
  195. {
  196. //订单确认页面
  197. $("#default_address_id").val(id);
  198. $("#default_consignee").html($("#consignee"+id).html());
  199. $("#default_phone").html($("#con_phone"+id).html());
  200. $("#default_address").html($("#con_address"+id).html());
  201. }
  202. else
  203. {
  204. //提示
  205. layer.open({
  206. content: res.msg
  207. ,skin: 'msg'
  208. ,time: 2 //2秒后自动关闭
  209. });
  210. }
  211. }, 'json');
  212. }
  213. </script>
  214. <!-- 收货地址列表-start -->
  215. <div class="address_list mt10">
  216. <style>
  217. .address_list .flow-have-adr{padding:15px;margin-bottom:10px;background-color:#fff;}
  218. .address_list .ect-colory{color:#e23435;}
  219. .address_list .f-h-adr-title label{font-size:18px;color:#000;margin-right:5px;}
  220. .address_list .f-h-adr-con{color:#777;margin-top:5px;margin-bottom:5px;}
  221. </style>
  222. <?php if($address_list){foreach($address_list as $k=>$v){ ?>
  223. <div class="flow-have-adr" onclick="defaultback('<?php echo $v['id']; ?>')">
  224. <p class="f-h-adr-title"><label id="consignee<?php echo $v['id']; ?>"><?php echo $v['name']; ?></label><span class="ect-colory fr" id="con_phone<?php echo $v['id']; ?>"><?php echo $v['mobile']; ?></span></p>
  225. <p class="f-h-adr-con"><span class="ect-colory"><?php if($v['is_default']==1){ ?>[默认地址]<?php } ?></span><span id="con_address<?php echo $v['id']; ?>"><?php echo $v['province_name'].$v['city_name'].$v['district_name'].' '.$v['address']; ?></span></p>
  226. </div>
  227. <?php }}else{ ?>
  228. <div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
  229. <?php } ?>
  230. </div>
  231. <!-- 收货地址列表-end -->
  232. <!-- 添加收货地址-start -->
  233. <style>
  234. .adr_add{padding:0 10px;background-color:#fff;}
  235. .adr-form-group{margin-top:10px;}
  236. .adr-form-group input[type=text],.adr-form-group textarea{display: block;width: 100%;font-size:16px;padding:10px;color: #777;vertical-align: middle;background-color: #fff;background-image: none;border: 1px solid #ddd;border-radius: 0;box-sizing:border-box;}
  237. .adr-form-group select{padding:5px;margin-right:10px;}
  238. .bottoma{display:block;font-size:18px;padding:10px;color:white;background-color:#f23030;text-align:center;}
  239. </style>
  240. <div class="adr_add">
  241. <div style="font-size:18px;padding-top:10px;text-align:center;">添加新的收货地址</div>
  242. <div class="adr-form-group">
  243. <label for="doc-ipt-email-1">收货人</label>
  244. <input name="name" type="text" class="" id="name" placeholder="输入姓名">
  245. </div>
  246. <div class="adr-form-group">
  247. <label for="doc-ipt-email-1">手机号码</label>
  248. <input type="text" name="mobile" class="" id="mobile" placeholder="输入手机号码">
  249. </div>
  250. <div class="adr-form-group">
  251. 地区: <select id='sheng'></select><select id='shi'></select><select id='qu'></select>
  252. <script>
  253. // JavaScript Document
  254. $(document).ready(function(e) {
  255. //加载省的数据
  256. LoadSheng();
  257. //加载市的数据
  258. LoadShi();
  259. //加载区的数据
  260. LoadQu();
  261. //给省的下拉加点击事件
  262. $("#sheng").change(function(){
  263. //重新加载市
  264. LoadShi();
  265. //重新加载区
  266. LoadQu();
  267. });
  268. //给市的下拉加点击事件
  269. $("#shi").change(function(){
  270. //重新加载区
  271. LoadQu();
  272. });
  273. });
  274. //加载省份的方法
  275. function LoadSheng(parent_id,select_id)
  276. {
  277. //省的父级代号
  278. parent_id = parent_id || '86';
  279. select_id = select_id || 0;
  280. $.ajax({
  281. async:false,
  282. url:'<?php echo env('APP_API_URL')."/region_list"; ?>',
  283. data:{id:parent_id},
  284. type:"GET",
  285. dataType:"json",
  286. success: function(res){
  287. var hang = res.data;
  288. var str = "";
  289. for(var i=0;i<hang.length;i++)
  290. {
  291. if(select_id != 0 && select_id == hang[i].id)
  292. {
  293. str = str+"<option selected='selected' value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  294. }
  295. else
  296. {
  297. str = str+"<option value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  298. }
  299. }
  300. $("#sheng").html(str);
  301. }
  302. });
  303. }
  304. //加载市的方法
  305. function LoadShi(parent_id,select_id)
  306. {
  307. //找市的父级代号
  308. parent_id = parent_id || $("#sheng").val();
  309. select_id = select_id || 0;
  310. $.ajax({
  311. async:false,
  312. url:'<?php echo env('APP_API_URL')."/region_list"; ?>',
  313. data:{id:parent_id},
  314. type:"GET",
  315. dataType:"json",
  316. success: function(res){
  317. var hang = res.data;
  318. var str = "";
  319. for(var i=0;i<hang.length;i++)
  320. {
  321. if(select_id != 0 && select_id == hang[i].id)
  322. {
  323. str = str+"<option selected='selected' value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  324. }
  325. else
  326. {
  327. str = str+"<option value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  328. }
  329. }
  330. $("#shi").html(str);
  331. }
  332. });
  333. }
  334. //加载区的方法
  335. function LoadQu(parent_id,select_id)
  336. {
  337. //找区的父级代号
  338. parent_id = parent_id || $("#shi").val();
  339. select_id = select_id || 0;
  340. $.ajax({
  341. url:'<?php echo env('APP_API_URL')."/region_list"; ?>',
  342. data:{id:parent_id},
  343. type:"GET",
  344. dataType:"json",
  345. success: function(res){
  346. var hang = res.data;
  347. var str = "";
  348. for(var i=0;i<hang.length;i++)
  349. {
  350. if(select_id != 0 && select_id == hang[i].id)
  351. {
  352. str = str+"<option selected='selected' value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  353. }
  354. else
  355. {
  356. str = str+"<option value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  357. }
  358. }
  359. $("#qu").html(str);
  360. }
  361. });
  362. }
  363. </script>
  364. </div>
  365. <div class="adr-form-group">
  366. <label for="doc-ta-1">详细地址</label>
  367. <textarea name="address" class="" rows="3" id="address"></textarea>
  368. </div>
  369. <a style="margin:10px;" class="bottoma" href="javascript:adr_dosubmit();">提交</a>
  370. <br><br>
  371. </div>
  372. <!-- 添加收货地址-start -->
  373. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
  374. <script>
  375. function adr_dosubmit()
  376. {
  377. var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
  378. var url = '<?php echo env('APP_API_URL').'/user_address_add'; ?>';
  379. var name = $("#name").val();
  380. var mobile = $("#mobile").val();
  381. var address = $("#address").val();
  382. var province = $("#sheng").val();
  383. var city = $("#shi").val();
  384. var district = $("#qu").val();
  385. var is_default = 0;
  386. //if(document.getElementById("is_default").checked){is_default = 1;}
  387. if(name == '')
  388. {
  389. //提示
  390. layer.open({
  391. content: '姓名不能为空'
  392. ,skin: 'msg'
  393. ,time: 2 //2秒后自动关闭
  394. });
  395. return false;
  396. }
  397. if(mobile == '')
  398. {
  399. //提示
  400. layer.open({
  401. content: '手机号不能为空'
  402. ,skin: 'msg'
  403. ,time: 2 //2秒后自动关闭
  404. });
  405. return false;
  406. }
  407. if(validatemobile(mobile) == false)
  408. {
  409. //提示
  410. layer.open({
  411. content: '手机号格式不正确'
  412. ,skin: 'msg'
  413. ,time: 2 //2秒后自动关闭
  414. });
  415. return false;
  416. }
  417. if(address == '')
  418. {
  419. //提示
  420. layer.open({
  421. content: '地址不能为空'
  422. ,skin: 'msg'
  423. ,time: 2 //2秒后自动关闭
  424. });
  425. return false;
  426. }
  427. $.post(url,{access_token:access_token,name:name,mobile:mobile,address:address,province:province,city:city,district:district,is_default:is_default},function(res)
  428. {
  429. if(res.code==0)
  430. {
  431. setdefault(res.data.id);
  432. window.location.reload();
  433. }
  434. else
  435. {
  436. //提示
  437. layer.open({
  438. content: res.msg
  439. ,skin: 'msg'
  440. ,time: 2 //2秒后自动关闭
  441. });
  442. }
  443. },'json');
  444. }
  445. </script>
  446. </div>
  447. <!-- 收货地址选择-end -->
  448. <script>
  449. function cart_submit()
  450. {
  451. var cart_goods_ids = '';
  452. $('[name="checkItem"][checked]').each(function(){
  453. var goods_id = $(this).attr('data-cart-id');
  454. if(cart_goods_ids){cart_goods_ids = cart_goods_ids+'_'+goods_id;}else{cart_goods_ids = cart_goods_ids+goods_id;}
  455. });
  456. if(cart_goods_ids == '')
  457. {
  458. layer.open({
  459. content: '请选择商品'
  460. ,skin: 'msg'
  461. ,time: 2 //2秒后自动关闭
  462. });
  463. return false;
  464. }
  465. location.href = '<?php echo substr(route('weixin_cart_checkout',array('ids'=>1)), 0, -1); ?>' + cart_goods_ids;
  466. }
  467. function change_goods_number(type, id)
  468. {
  469. var goods_number = document.getElementById('goods_number'+id).value;
  470. if(type != 2)
  471. {
  472. var goods_number = document.getElementById('goods_number'+id).value;
  473. document.getElementById('goods_number'+id).value = goods_number;
  474. }
  475. if(type == 1){goods_number--;}
  476. if(type == 3){goods_number++;}
  477. if(goods_number <= 0){goods_number=1;}
  478. if(!/^[0-9]*$/.test(goods_number)){goods_number = document.getElementById('goods_number'+id).value;}
  479. document.getElementById('goods_number'+id).value = goods_number;
  480. var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
  481. var url = '<?php echo env('APP_API_URL').'/cart_add'; ?>';
  482. $.post(url,{access_token:access_token,goods_id:id,goods_number:goods_number},function(res)
  483. {
  484. if (res.code == 0)
  485. {
  486. changeCartTotalPrice();
  487. }
  488. else if (res.msg != '')
  489. {
  490. //提示
  491. layer.open({
  492. content: '姓名不能为空'
  493. ,skin: 'msg'
  494. ,time: 2 //2秒后自动关闭
  495. });
  496. var goods_number = document.getElementById('goods_number'+id).value;
  497. document.getElementById('goods_number'+id).value = goods_number;
  498. }
  499. }, 'json');
  500. }
  501. //删除购物车商品
  502. $(function () {
  503. //删除购物车商品事件
  504. $(document).on("click", '.deleteGoods', function (e) {
  505. var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
  506. var cart_ids = new Array();
  507. cart_ids.push($(this).attr('data-cart-id'));
  508. layer.open({
  509. content: '确定要删除此商品吗'
  510. ,btn: ['确定', '取消']
  511. ,yes: function(index){
  512. layer.close(index);
  513. $.ajax({
  514. type : "POST",
  515. url:"<?php echo env('APP_API_URL').'/cart_delete'; ?>",
  516. dataType:'json',
  517. data: {access_token:access_token,id:cart_ids},
  518. success: function(res){
  519. layer.open({
  520. content: res.msg
  521. ,skin: 'msg'
  522. ,time: 2 //2秒后自动关闭
  523. });
  524. window.location.reload();
  525. }
  526. });
  527. }
  528. });
  529. })
  530. });
  531. //勾选商品
  532. function checkGoods(obj)
  533. {
  534. if($(obj).hasClass('check_t'))
  535. {
  536. //改变颜色
  537. $(obj).removeClass('check_t');
  538. //取消选中
  539. $(obj).find('input').attr('checked',false);
  540. }
  541. else
  542. {
  543. //改变颜色
  544. $(obj).addClass('check_t');
  545. //勾选选中
  546. $(obj).find('input').attr('checked',true);
  547. }
  548. //选中全选多选框
  549. if($(obj).hasClass('checkFull'))
  550. {
  551. if($(obj).hasClass('check_t'))
  552. {
  553. $(".che").each(function(i,o){
  554. $(this).addClass('check_t');
  555. $(this).find('input').attr('checked',true);
  556. });
  557. }
  558. else
  559. {
  560. $(".che").each(function(i,o){
  561. $(this).removeClass('check_t');
  562. $(this).find('input').attr('checked',false);
  563. });
  564. }
  565. }
  566. changeCartTotalPrice();
  567. }
  568. //修改选中商品总价
  569. function changeCartTotalPrice()
  570. {
  571. var total_price = 0;
  572. $('[name="checkItem"][checked]').each(function(){
  573. var goods_id = $(this).attr('data-goods-id');
  574. total_price = total_price + $('#goods_number'+goods_id).val() * $('#goods_price'+goods_id).text();
  575. });
  576. $('#total_fee').text(total_price);
  577. }
  578. </script>
  579. <script>
  580. function unshow(id)
  581. {
  582. $(id).hide();
  583. }
  584. function showmask(id)
  585. {
  586. $(id).show();
  587. }
  588. </script>
  589. </body></html>