作者 刘朕
1 个管道 的构建 通过 耗费 25 秒

合并分支 'Branch_liuzhen' 到 'master'

购物车下单流程调试



查看合并请求 !9
... ... @@ -18,6 +18,14 @@ class Car extends Frontend
protected $noNeedLogin = [''];
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize(); // TODO: Change the autogenerated stub
$this->view->assign('is_search', 0);
$this->view->assign('is_active', 0);
$this->view->assign('title', '购物车');
}
/**
* 购物车页面
* @return mixed
... ...
... ... @@ -33,12 +33,12 @@ class Order extends Frontend
public function confirm(){
$user_id = $this->auth->id;
// $car_ids = $this->request->param('car_ids');
$data = $this->request->param('data');
$car_data = $this->request->param('data');
$province_id = $this->request->param('province_id',0,'intval');
if(empty($data) || empty($province_id)){
if(empty($car_data) || empty($province_id)){
$this->error('缺少必要参数');
}
$data = json_decode($data,true);
// $data = json_decode($data,true);
/*if(!empty($car_ids)){
$car_ids = explode(',',$car_ids);
$carModel = new \app\index\model\Car();
... ... @@ -47,6 +47,8 @@ class Order extends Frontend
$this->error('sql执行失败');
}
}*/
$car_model = new \app\index\model\Car();
$data = $car_model->field('id,store_id,goods_id,number')->whereIn('id',$car_data)->select();
$goodsModel = new \app\index\model\Goods();
$goods_price = [];
$store_ids = [];
... ... @@ -123,7 +125,8 @@ class Order extends Frontend
$this->assign('goods_total',$goods_total1);
$this->assign('postage_total',$postage_total1);
$this->assign('address',$address);
$this->assign('data',json_encode($data));
// $this->assign('data',json_encode($data));
$this->assign('data',$car_data);
$this->assign('province_id',$province_id);
$this->assign('title','确认订单');
return $this->fetch();
... ... @@ -227,7 +230,7 @@ class Order extends Frontend
$express = $this->request->param('express',0,'intval');
$address_id = $this->request->param('address_id',0,'intval');
$pay_type = $this->request->param('pay_type',0,'intval');
$car_ids = $this->request->param('car_ids');
$car_ids = $this->request->param('data');
$province_id = $this->request->param('province_id',0,'intval');
if(empty($data) || empty($express) || empty($pay_type) || empty($province_id)){
$this->error('缺少必要参数');
... ... @@ -239,12 +242,14 @@ class Order extends Frontend
$addressModel = new Address();
$address = $addressModel->findData(['id'=>$address_id]);
}
$data = json_decode($data,true);
$car_model = new \app\index\model\Car();
$data = $car_model->field('id,store_id,goods_id,number')->whereIn('id',$car_ids)->select();
// $data = json_decode($data,true);
Db::startTrans();
if(!empty($car_ids)){
$car_ids = explode(',',$car_ids);
$carModel = new \app\index\model\Car();
$result = $carModel->where(['id'=>$car_ids])->delete();
$result = $carModel->whereIn('id',$car_ids)->delete();
if(empty($result)){
$this->error('sql执行失败');
}
... ...
... ... @@ -158,7 +158,7 @@
}
.content .shopListBox .shopBox ul li .commodityNameBox{
width: 416px;
width: 412px;
height: 100%;
}
.content .shopListBox .shopBox ul li .commodityNameBox p{
... ... @@ -284,16 +284,7 @@
{include file="public/header"/}
<!--主要内容-->
<div class="content">
<div class="navBarBox">
<ul>
<li><a href="{:url('index/index')}">首页</a></li>
<li><a href="{:url('goods/index')}">采购中心</a></li>
<li><a href="">帮买服务</a></li>
<li><a href="">产品维修</a></li>
<li><a href="">关于我们</a></li>
</ul>
</div>
{include file="public/nav"}
<div class="shoppingCartBox">
<!--购物车头部部分-->
<div class="shoppingCartTitleBox">
... ... @@ -338,7 +329,7 @@
<ul>
{foreach name="$vo.car" item="c"}
<li>
<div class="radioBox"><input class="commodityCheck" type="checkbox" data-goods_id="{$c.goods_id}" data-number="{$c.number}" value="{$c.id}"></div>
<div class="radioBox"><input class="commodityCheck" type="checkbox" data-car_id="{$c.id}" data-goods_id="{$c.goods_id}" data-number="{$c.number}" value="{$c.id}"></div>
<div class="borderBox">
<div class="imgBox">
<img src="{$c.goods.thumbnail}" alt="img">
... ... @@ -443,16 +434,20 @@
}
var data = [];
for(var i=0;i<$("input[class='commodityCheck']:checked").length;i++){
var obj = {};
var goods_id = $("input[class='commodityCheck']:checked").eq(i).attr('data-goods_id');
var number = $("input[class='commodityCheck']:checked").eq(i).attr('data-number');
obj.goods_id = goods_id;
obj.number = number;
data.push(obj);
// var obj = {};
// var goods_id = $("input[class='commodityCheck']:checked").eq(i).attr('data-goods_id');
// var number = $("input[class='commodityCheck']:checked").eq(i).attr('data-number');
// obj.goods_id = goods_id;
// obj.number = number;
// data.push(obj);
var car_id = $("input[class='commodityCheck']:checked").eq(i).attr('data-car_id');
data.push(car_id);
}
data = JSON.stringify(data);
// data = JSON.stringify(data);
var str = "{:url('index/order/confirm',array('data'=>'DATA','province_id'=>'PROVINCE_ID'))}";
window.location.href = str.replace("DATA",data).replace("PROVINCE_ID",province_id);
// window.location.href = str.replace("DATA",data).replace("PROVINCE_ID",province_id);
var car_ids = data.join(',');
window.location.href = str.replace("DATA",car_ids).replace("PROVINCE_ID",province_id);
}
//单个删除按钮
... ... @@ -688,11 +683,9 @@
totalPrice -= totalFreight;
}
}
$('#totalCount').html(totalCount.toFixed(0));
$('#totalPrice').html(totalPrice.toFixed(2));
}
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -547,16 +547,7 @@
{include file="public/header"/}
<!--主要内容-->
<div class="content">
<div class="navBarBox">
<ul>
<li><a href="{:url('index/index/index')}">首页</a></li>
<li><a href="{:url('index/goods/index')}">采购中心</a></li>
<li><a href="">帮买服务</a></li>
<li><a href="">产品维修</a></li>
<li><a href="">关于我们</a></li>
</ul>
</div>
{include file="public/nav"}
<!--面包屑-->
<div class="crumbsBox">
<div class="crumbsMain">
... ...
... ... @@ -324,15 +324,7 @@
{include file="public/header"/}
<!--主要内容-->
<div class="content">
<div class="navBarBox">
<ul>
<li><a href="{:url('index/index/index')}">首页</a></li>
<li class="active"><a href="{:url('index/goods/index')}">采购中心</a></li>
<li><a href="">帮买服务</a></li>
<li><a href="">产品维修</a></li>
<li><a href="">关于我们</a></li>
</ul>
</div>
{include file="public/nav"}
<!--轮播图-->
<div class="bannerBox">
<div id="banner-container" class="swiper-container">
... ...
... ... @@ -418,7 +418,7 @@
<div class="bestSellersList goods_dom">
{foreach name="$goods" item="g"}
<div class="commodityBox">
<a href="{:url('index/goods/detail',array('goods_id'=>$g.id))}">
<a href="{:url('index/goods/detail',array('goods_id'=>$g.id))}" target="_blank">
<div class="imgBox">
<img src="{$g.thumbnail}" alt="img">
<span>{$g.store_name}</span>
... ... @@ -506,7 +506,7 @@
var clearance_goods_html = "";
$(res.data).each(function (key, vo) {
var str = "<div class=\"swiper-slide\">\n" +
" <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\">\n" +
" <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\" target='_blank'>\n" +
" <img src=\""+vo.thumbnail+"\" alt=\"img\">\n" +
" <p class=\"commodityTitle\">"+vo.goodsname+"</p>\n" +
" <div class=\"priceBox\">\n" +
... ... @@ -553,7 +553,7 @@
insurance = "<img class=\"insurance_icon\" src=\"__CDN__/assets/store/images/insurance_icon.png\" alt=\"img\">"
}
var str = "<div class=\"commodityBox\">\n" +
" <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\">\n" +
" <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\" target='_blank'>\n" +
" <div class=\"imgBox\">\n" +
" <img src=\""+vo.thumbnail+"\" alt=\"img\">\n" +
" <span>"+vo.store_name+"</span>\n" +
... ...
<!DOCTYPE html>
<html lang="zh">
{include file="public/head"}
<!--图片上传-->
<script type="text/javascript" src="__CDN__/assets/store/js/fileupLoad/imgFileupload.js"></script>
<link rel="stylesheet" href="__CDN__/assets/store/js/fileupLoad/imgFileupload.css">
<!--swiper引入-->
<link rel="stylesheet" href="__CDN__/assets/store/js/Swiper-3.4.2/css/swiper.min.css">
<script type="text/javascript" src="__CDN__/assets/store/js/Swiper-3.4.2/js/swiper.min.js"></script>
<style>
li{
list-style-type: none;
... ... @@ -73,10 +79,14 @@
-webkit-background-size: 26px;
}
.swiper-button-next, .swiper-container-rtl .swiper-button-prev{
background-image: url("images/right_icon.png");
background-image: url("/assets/store/images/right_icon.png");
}
.swiper-button-prev, .swiper-container-rtl .swiper-button-next{
background-image: url("images/left_icon.png");
background-image: url("/assets/store/images/left_icon.png");
}
.swiper-slide img {
width: 175px;
height: 175px;
}
/*title样式*/
... ... @@ -381,7 +391,6 @@
{include file="public/footer"}
<script>
$(function () {
getPersonalIntroduction();
initSwiper();
initUploadImg();
});
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'link/index' + location.search,
add_url: 'link/add',
edit_url: 'link/edit',
del_url: 'link/del',
table: 'link',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name')},
{field: 'href', title: __('Href'),formatter: Table.api.formatter.url},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...