This commit is contained in:
devil_gong 2018-09-29 18:32:31 +08:00
parent 6e30e405b2
commit a6a2b5fe4b
12 changed files with 527 additions and 25 deletions

View File

@ -1266,6 +1266,12 @@ function params_checked($data, $params)
if (!isset($data[$v['key_name']]) || !in_array($data[$v['key_name']], $v['checked_data'])) {
return $v['error_msg'];
}
case 'is_array' :
if (!isset($data[$v['key_name']]) || !is_array($data[$v['key_name']])) {
return $v['error_msg'];
}
break;
}
}
return true;

View File

@ -40,6 +40,48 @@ class OrderController extends CommonController
*/
public function Index()
{
// 参数
$params = array_merge($_POST, $_GET);
$params['user'] = $this->user;
// 分页
$number = 10;
// 条件
$where = OrderService::HomeOrderListWhere($params);
// 获取总数
$total = OrderService::OrderTotal($where);
// 分页
$page_params = array(
'number' => $number,
'total' => $total,
'where' => $params,
'url' => U('Home/Order/Index'),
);
$page = new \Library\Page($page_params);
$this->assign('page_html', $page->GetPageHtml());
// 获取列表
$data_params = array(
'limit_start' => $page->GetPageStarNumber(),
'limit_number' => $number,
'where' => $where,
);
$data = OrderService::OrderList($data_params);
$this->assign('data_list', $data['data']);
// 品牌分类
// $brand_category = M('BrandCategory')->where(['is_enable'=>1])->field('id,name')->select();
// $this->assign('brand_category', $brand_category);
// 参数
$this->assign('params', $params);
// 数据列表
$this->assign('list', $list);
$this->display('Index');
}

View File

@ -11,21 +11,21 @@ return array(
// 用户中心菜单, is_show = [0禁用, 1启用]
'user_left_menu' => array(
array(
'control' => 'Bubble',
'control' => 'User',
'action' => 'Index',
'name' => '冒泡广场',
'name' => '个人中心',
'is_show' => 1,
'icon' => 'am-icon-slideshare',
'icon' => 'am-icon-home',
),
array(
'name' => '学生信息',
'name' => '我的交易',
'is_show' => 1,
'icon' => 'am-icon-mortar-board fs-12',
'icon' => 'am-icon-mortar-board',
'item' => array(
array(
'control' => 'Student',
'control' => 'Order',
'action' => 'Index',
'name' => '学生列表',
'name' => '订单管理',
'is_show' => 1,
'icon' => 'am-icon-th-list',
)
@ -94,7 +94,7 @@ return array(
'action' => 'Index',
'name' => '学生',
'is_show' => 1,
'icon' => 'am-icon-mortar-board fs-12 w-14',
'icon' => 'am-icon-mortar-board',
),
array(
'control' => 'Safety',

View File

@ -13,12 +13,175 @@
<include file="Public/GoodsCategory" />
<!-- content -->
<div class="am-container category-list">
<notempty name="goods_category_list">
订单管理
<else />
<div class="table-no"><i class="am-icon-warning"></i> {{:L('common_not_data_tips')}}</div>
</notempty>
<div class="am-container user-main">
<!-- user menu start -->
<include file="Public/UserMenu" />
<!-- user menu end -->
<!-- content start -->
<div class="user-content">
<div class="user-content-body">
<form class="am-form form-validation" method="post" action="{{:U('Home/Order/Index')}}" request-type="form" novalidate="novalidate">
<div class="thin">
<div class="am-input-group am-input-group-sm am-fl so">
<input type="text" name="keywords" class="am-radius" placeholder="账单号或关键字" value="">
<span class="am-input-group-btn">
<button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
</span>
</div>
<label class="am-fl thin_sub">
更多筛选条件
<input type="checkbox" name="so_type" value="1" class="none am-field-valid">
<i class="am-icon-angle-up"></i>
</label>
</div>
<table class="so-list none">
<tbody><tr>
<td class="time">
<span>时间:</span>
<span class="am-form-group">
<input type="text" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"><i class="am-icon-calendar"></i>
</span>
<em class="text-grey">~</em>
<span class="am-form-group">
<input type="text" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"><i class="am-icon-calendar"></i>
</span>
</td>
<td class="price">
<span>价格:</span>
<span class="am-form-group">
<input type="text" name="price_start" class="am-form-field am-input-sm am-radius" placeholder="最小价格" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="价格0~9之间的数字" value="">
</span>
<em class="text-grey">~</em>
<span class="am-form-group">
<input type="text" name="price_end" class="am-form-field am-input-sm am-radius" placeholder="最大价格" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="价格0~9之间的数字" value="">
</span>
</td>
</tr>
<tr>
<td>
<span>支付:</span>
<select name="pay_id" class="chosen-select">
<option value="0" selected="">支付方式...</option>
<option value="1">现金</option>
<option value="2">账户余额</option>
<option value="3">支付宝</option>
<option value="4">会员卡消费</option>
<option value="5">微信</option>
</select>
</td>
<td>
<span>付款:</span>
<select name="pay_state" class="chosen-select">
<option value="-1">付款状态...</option>
<option value="0">待支付</option>
<option value="1">已支付</option>
<option value="2">已退款</option>
</select>
</td>
</tr>
<tr>
<td>
<span>状态:</span>
<select name="state" class="chosen-select">
<option value="-1">账单状态...</option>
<option value="0">未完成</option>
<option value="1">已完成</option>
</select>
</td>
</tr>
<tr>
<td>
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜 索</button>
<a href="{{:U('Home/Order/Index')}}" class="am-btn am-btn-danger am-radius am-btn-sm reset-submit">清除条件</a>
</td>
</tr>
</tbody></table>
</form>
<!-- 订单抬头 -->
<div class="am-alert am-alert-secondary meila-radius">
<table class="w100 content-title">
<tbody><tr>
<th class="row-content">商品</th>
<th class="row-price am-hide-sm-only">单价</th>
<th class="row-number am-hide-sm-only">数量</th>
<th class="row-total-price">合计</th>
<th class="row-status am-hide-sm-only">状态</th>
<th class="row-operate">操作</th>
</tr>
</tbody></table>
</div>
<!-- 订单列表 -->
<foreach name="data_list" item="order">
<table class="data-list <if condition="$order['status'] eq 1">data-ongoing</if>">
<tr class="content-hd">
<td colspan="6">
title
</td>
</tr>
<foreach name="order.items" key="keys" item="goods">
<tr id="data-list-{{$goods.goods_id}}" data-id="{{$goods.goods_id}}" data-goods-id="{{$goods.goods_id}}">
<td class="base row-content">
<div class="goods-detail">
<a href="{{$goods.goods_url}}" target="_blank">
<img src="{{$goods.images}}">
</a>
<div class="goods-base">
<a href="{{$goods.goods_url}}" target="_blank" class="goods-title">{{$goods.title}}</a>
<notempty name="goods.attribute">
<ul class="goods-attr">
<foreach name="goods.attribute" item="attr">
<li>{{$attr.attr_type_name}}{{$attr.attr_name}}</li>
</foreach>
</ul>
</notempty>
</div>
</div>
<div class="wap-base am-show-sm-only">
<if condition="$goods['original_price'] gt 0">
<span class="original-price">¥{{$goods.original_price}}</span>
</if>
<strong class="total-price-content">¥{{$goods.price}}</strong>
<span class="wap-number">x{{$goods.stock}}</span>
</div>
</td>
<td class="row-price am-hide-sm-only">
<if condition="$goods['original_price'] gt 0">
<p class="original-price">¥{{$goods.original_price}}</p>
</if>
<p class="line-price">¥{{$goods.price}}</p>
</td>
<td class="row-number am-hide-sm-only">
x{{$goods.buy_number}}
</td>
<if condition="$keys eq 0">
<td class="row-total-price" rowspan="{{$order.items_count}}">
<strong class="total-price-content">¥{{$order.total_price}}</strong>
</td>
<td class="row-status am-hide-sm-only" rowspan="{{$order.items_count}}"></td>
<td class="row-operate" rowspan="{{$order.items_count}}"></td>
</if>
<!-- <td class="total-price am-hide-sm-only">
<strong class="total-price-content">¥{{$goods.total_price}}</strong>
</td> -->
</tr>
</foreach>
</table>
</foreach>
<!-- 分页 -->
{{$page_html}}
</div>
</div>
<!-- content end -->
</div>
<!-- footer start -->

View File

@ -30,6 +30,9 @@
<!-- 颜色选择器 -->
<js href="__PUBLIC__/Common/Lib/colorpicker/jquery.colorpicker.js?v={{:MyC('home_static_cache_version')}}" />
<!-- 日期组件 -->
<js href="__PUBLIC__/Common/Lib/My97DatePicker/WdatePicker.js" />
<!-- 项目公共 -->
<js href="__PUBLIC__/Common/Js/Common.js?v={{:MyC('home_static_cache_version')}}" />
<js href="__PUBLIC__/Home/{{$default_theme}}/Js/Common.js?v={{:MyC('home_static_cache_version')}}" />

View File

@ -1,27 +1,32 @@
<include file="Public/Header" />
<!-- header nav start -->
<include file="Public/HeaderNav" />
<!-- header nav end -->
<!-- header top nav -->
<include file="Public/HeaderTopNav" />
<div class="am-cf user-main" <if condition="!empty($max_width_style)">style="{{$max_width_style}}"</if>>
<!-- search -->
<include file="Public/NavSearch" />
<!-- header nav -->
<include file="Public/HeaderNav" />
<!-- goods category -->
<include file="Public/GoodsCategory" />
<!-- content -->
<div class="am-container user-main">
<!-- user menu start -->
<include file="Public/UserMenu" />
<!-- user menu end -->
<!-- content start -->
<div class="user-content">
<div class="user-content-body p-10">
SchoolCMS
<div class="user-content-body">
ShopXO
</div>
</div>
<!-- content end -->
</div>
<!-- layuot common module start -->
<include file="Public/CommonModule" />
<!-- layuot common module end -->
<!-- footer start -->
<include file="Public/Footer" />
<!-- footer end -->

View File

@ -229,5 +229,116 @@ class OrderService
{
return substr($out_trade_no, 14);
}
/**
* 前端订单列表条件
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public static function HomeOrderListWhere($params = [])
{
$where = [
'is_delete_time' => 0,
];
// 用户id
if(!empty($params['user']))
{
$where['user_id'] = $params['user']['id'];
}
return $where;
}
/**
* 订单总数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $where [条件]
*/
public static function OrderTotal($where = [])
{
return (int) M('Order')->where($where)->count();
}
/**
* 订单列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-29
* @desc description
* @param [array] $params [输入参数]
*/
public static function OrderList($params = [])
{
// 请求参数
$p = [
[
'checked_type' => 'empty',
'key_name' => 'where',
'error_msg' => '条件不能为空',
],
[
'checked_type' => 'is_array',
'key_name' => 'where',
'error_msg' => '条件格式有误',
],
[
'checked_type' => 'isset',
'key_name' => 'limit_start',
'error_msg' => '分页起始值有误',
],
[
'checked_type' => 'isset',
'key_name' => 'limit_number',
'error_msg' => '分页数量不能为空',
],
];
$ret = params_checked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
$limit_start = max(0, intval($params['limit_start']));
$limit_number = max(1, intval($params['limit_number']));
$order_by = empty($params['$order_by']) ? 'id desc' : I('order_by', '', '', $params);
// 获取订单
$data = M('Order')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select();
if(!empty($data))
{
$detail_m = M('OrderDetail');
$detail_field = 'id,goods_id,title,images,original_price,price,attribute,buy_number';
$images_host = C('IMAGE_HOST');
$total_price = 0;
foreach($data as &$v)
{
$items = $detail_m->where(['order_id'=>$v['id']])->field($detail_field)->select();
if(!empty($items))
{
foreach($items as &$vs)
{
$vs['images'] = empty($vs['images']) ? null : $images_host.$vs['images'];
$vs['attribute'] = empty($vs['attribute']) ? null : json_decode($vs['attribute'], true);
$vs['goods_url'] = HomeUrl('Goods', 'Index', ['id'=>$vs['goods_id']]);
$total_price += $vs['buy_number']*$vs['price'];
}
}
$v['items'] = $items;
$v['items_count'] = count($items);
$v['total_price'] = $total_price;
}
}
return DataReturn('处理成功', 0, $data);
}
}
?>

View File

@ -352,6 +352,12 @@ function FromInit(form_name)
var request_value = $form.attr('request-value');
var ajax_all = ['ajax-reload', 'ajax-url', 'ajax-fun'];
// 不是form表单直接通过
if(request_type == 'form')
{
return true;
}
// 参数校验
if(ajax_all.indexOf(request_type) == -1 || action == undefined || action == '' || method == undefined || method == '')
{

View File

@ -48,7 +48,7 @@ a {
text-decoration: none;
}
a:link,a:visited,a:hover{ outline:none;}
a:hover, a:focus { color: #d2364c !important; text-decoration: underline; }
a:hover, a:focus { color: #d2364c; text-decoration: underline; }
.spatic{width:100%; height:16px;}
h5{float: right;color: #666;padding-right:20px;}
@ -556,3 +556,41 @@ background:url(../Images/ibar_sprites.png) no-repeat;background-position:0px -23
}
.am-popup-hd .am-popup-title { font-size: 18px; }
/**
* 用户中心布局样式
*/
.user-menu {position:fixed;z-index:10;bottom:30px;right:20px;}
.user-sidebar {width:145px;min-height:100%;float:left;}
.user-sidebar .am-active {z-index:1600;}
.user-sidebar .am-active a, .user-sidebar-list li a:hover {background:#fff1f5; text-decoration: none; color: #d2364c; }
.user-sidebar-list li a {color:#5c5c5c;padding-left:10px;padding: 0.8rem;}
.user-sidebar-list li:first-child {border-top:none;}
.user-offcanvas-bar .am-list > li { border: 1px solid #ffe8ef; }
.user-sidebar-sub {margin-top:0;margin-bottom:0;}
.user-sidebar-sub li { border-left: 0!important; border-right: 0!important; }
.user-sidebar-sub li a { padding-left:35px; }
.user-content {display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;background:#fff;}
.user-content-body {-webkit-box-flex:1;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;flex:1 0 auto; }
.user-offcanvas-bar { z-index: 900; }
@media only screen and (min-width:640px) {
.user-sidebar {display:block;position:static;background:none; border-top: 5px solid #f78590;}
.user-offcanvas-bar {position:static;width:auto;background:none;-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translate3d(0,0,0);overflow-y:hidden;}
.user-offcanvas-bar:after {content:none;}
.user-main { padding: 0 5px; }
.user-content-body { padding: 0 5px 5px 10px; }
}
@media only screen and (min-width: 1025px) {
.user-main { padding: 0; }
}
@media only screen and (max-width:640px) {
.user-sidebar {width:inherit;}
.user-offcanvas-bar {background:#f3f3f3;}
.user-offcanvas-bar:after {background:#BABABA;}
.user-sidebar-list a:hover,.user-sidebar-list a:active {-webkit-transition:background-color .3s ease;-moz-transition:background-color .3s ease;-ms-transition:background-color .3s ease;-o-transition:background-color .3s ease;transition:background-color .3s ease;background:#E4E4E4;}
.user-content-body { padding: 0 5px 5px 5px; }
}
.user-main { padding-top: 10px; }
.more-icon-rotate {-webkit-transform: rotate(-90deg);transform: rotate(-90deg);-webkit-transition: all 300ms;transition: all 300ms;}

View File

@ -0,0 +1,97 @@
/* 筛选 */
.thin, .pay-list { overflow:hidden; }
.thin .so { width:66%; }
.thin_sub { font-weight:100; margin:10px 0px 0px 10px; cursor: pointer; }
.so-list { width:100%; margin-top: 20px; }
.so-list * { font-size:1.2rem !important; }
.so-list span { color:#666; }
.so-list input { height:28px; display:inline !important; }
.time input, .so-list .chosen-container { background:#FFF !important; }
.time input { width:100px !important; }
.time i { position:absolute; margin:4px 0px 0px -15px; }
.price input { width:101px !important; }
.time, .time { width:50%; }
.so-list tr+tr>td:first-child { padding-top:10px; }
.so-list .chosen-container { border-radius:2px; }
.text-grey { color: #999; }
.chosen-container-single .chosen-single, .so-list select { height: 28px; line-height: 28px; width: 100%; }
.reset-submit { margin-left: 20px; }
.so-list select { padding: 0 0 0 8px; }
@media only screen and (min-width: 641px){
.so-list .chosen-container, .so-list select { width:217px !important; display: -webkit-inline-box; }
.thin_sub:hover { color:#F60; }
.row-content { width:30%; }
.row-price { width:15%; }
.row-number { width:15%; }
.row-total-price { width:15%; }
.row-status { width:15%; }
.row-operate { width:10%; }
}
@media only screen and (max-width: 641px){
.so-list input { width:40% !important; }
.so-list td { width:100%; display:block; }
.so-list tr td:last-child { margin-top:10px; }
.so-list .chosen-container { width:85%; }
.so-list .chosen-container { width:100%; }
.so-list tr td:last-child { padding-top:0px !important; }
.chosen-container-single .chosen-search input[type="text"] { width: 100% !important; }
.row-content { width:40%; }
.row-price { width:30%; }
.row-operate { width:10%; }
}
/**
* 订单列表
*/
/* 列表 */
table { width: 100%; }
table.data-list { margin-top: 10px; }
table.data-list-success, table.data-list-success td { border:1px solid #daf3ff; }
table.data-list { background:#FFF; border-radius:2px; -moz-border-radius:2px; -webkit-border-radius:2px; }
table.data-list * { font-size:12px; }
table.data-list td { padding:10px; }
.content-title th { text-align:center; }
.content img { width:80px; height:80px; }
.content p { margin:0px; }
.content a:hover { color:#F60; }
.row-content { min-width:102px; }
table.data-list tr td+td { text-align:center; }
.content-checkbox-operate { padding:3px 5px; }
/* 不在进行中 */
table.data-list { border-left: 1px solid #eee; border-right: 1px solid #eee; }
table.data-list td.row-number, table.data-list td.row-total-price, table.data-list td.row-status { border-right: 1px solid #eee; }
table.data-list td { border-bottom:1px solid #eee; }
table.data-list .content-hd td { background:#EEE; border-bottom-color:#EEE; }
table.data-list:hover { box-shadow:0 1px 1px #E4E4E4; background:#FCFCFC; }
/* 进行中 */
table.data-ongoing { border-left: 1px solid #daf3ff; border-right: 1px solid #daf3ff; }
table.data-ongoing td.row-number, table.data-ongoing td.row-total-price, table.data-ongoing td.row-status { border-right: 1px solid #daf3ff; }
table.data-ongoing td { border-bottom:1px solid #daf3ff; }
table.data-ongoing .content-hd td { background: #eaf8ff; border-bottom-color:#eaf8ff; }
table.data-ongoing:hover { box-shadow:0 1px 1px #9AD6F3; background:#F9FDFF; }
/**
* 商品列表
*/
.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; }

View File

@ -99,5 +99,11 @@ $(function()
}
});
// 用户中心菜单
$('.user-item-parent').on('click', function()
{
console.log(1)
$(this).find('.am-icon-angle-down').toggleClass('more-icon-rotate');
});
});

View File

@ -0,0 +1,25 @@
$(function()
{
/* 搜索切换 */
var $so_list = $('.so-list');
$thin_sub = $('.thin_sub');
$thin_sub.find('input[name="so_type"]').change(function()
{
if($thin_sub.find('i').hasClass('am-icon-angle-down'))
{
$thin_sub.find('i').removeClass('am-icon-angle-down');
$thin_sub.find('i').addClass('am-icon-angle-up');
} else {
$thin_sub.find('i').addClass('am-icon-angle-down');
$thin_sub.find('i').removeClass('am-icon-angle-up');
}
if($thin_sub.find('input[name="so_type"]:checked').val() == undefined)
{
$so_list.addClass('none');
} else {
$so_list.removeClass('none');
}
});
});