Browse Source

checkredis

undefined
娄梦宁 4 years ago
parent
commit
5226a88fe7
7 changed files with 207 additions and 85 deletions
  1. +91
    -0
      addons/unishop/application/admin/controller/unishop/Order.php
  2. +3
    -1
      addons/unishop/application/admin/view/unishop/order/index.html
  3. +26
    -0
      addons/unishop/controller/Order.php
  4. +28
    -28
      addons/unishop/public/assets/js/backend/unishop/order.js
  5. +11
    -11
      addons/unishop/public/assets/js/backend/unishop/product.js
  6. +17
    -17
      application/admin/view/unishop/order/index.html
  7. +31
    -28
      public/assets/js/backend/unishop/order.js

+ 91
- 0
addons/unishop/application/admin/controller/unishop/Order.php View File

@@ -506,4 +506,95 @@ class Order extends Backend
}
return $this->view->fetch();
}

public function export(){
$order_model=New \app\admin\model\unishop\Order();
$list = $order_model
->alias('o')
->join('user', 'user.id = o.user_id')
->join('unishop_order_product', 'unishop_order_product.order_id = o.id')
->where(['o.have_received'=>[">",0]])
->field('
user.username,
user.nickname,
user.floor,
user.email,
GROUP_CONCAT(unishop_order_product.title) as title,
o.total_price,
SUM(unishop_order_product.number) as number,
o.remark')
->group("o.id")
->select();
$list = collection($list)->toArray();
$title = ['工号','姓名','楼层','邮箱','商品','金额','购买数量','备注'];
// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle("订单信息");
// 方法一,使用 setCellValueByColumnAndRow
//表头
//设置单元格内容
foreach ($title as $key => $value) {
// 单元格内容写入
$sheet->setCellValueByColumnAndRow($key + 1, 1, $value);
}
$row = 2; // 从第二行开始
foreach ($list as $item) {
$column = 1;
foreach ($item as $value) {
// 单元格内容写入
$sheet->setCellValueByColumnAndRow($column, $row, $value);
$column++;
}
$row++;
}
$sheet_two = $spreadsheet->createSheet(2)->setTitle('商品信息');
$title1=["商品名称","件数","单价","总价"];
$product=new \app\admin\model\unishop\OrderProduct();
$product_list = $product->alias("p")
->join("unishop_order","p.order_id = unishop_order.id")
->where(['unishop_order.have_received'=>[">",0]])
->field('
p.title,
SUM(p.number) num,
p.price,
SUM(p.number)*p.price')
->group("p.id")
->select();
$product_list = collection($product_list)->toArray();

foreach ($title1 as $key => $value) {
// 单元格内容写入
$sheet_two->setCellValueByColumnAndRow($key + 1, 1, $value);
}
$row=2;
foreach ($product_list as $item) {
$column = 1;
foreach ($item as $value) {
// 单元格内容写入
$sheet_two->setCellValueByColumnAndRow($column, $row, $value);
$column++;
}
$row++;
}

$file_name="导出订单.xlsx";
// Redirect output to a client’s web browser (Xlsx)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename='.$file_name);
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');

// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0

$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output');
exit;
}

}

+ 3
- 1
addons/unishop/application/admin/view/unishop/order/index.html View File

@@ -30,7 +30,9 @@
</ul>
</div>

<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('unishop/order/recyclebin')?'':'hide'}" href="unishop/order/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
<!-- <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('unishop/order/recyclebin')?'':'hide'}" href="unishop/order/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>-->
<!-- <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('unishop/order/recyclebin')?'':'hide'}" href="unishop/order/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>-->
<!-- <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('unishop/order/recyclebin')?'':'hide'}" href="unishop/order/export" title="{:__('导出')}"><i class="fa fa-recycle"></i> {:__('导出')}</a>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('unishop/order/edit')}"


+ 26
- 0
addons/unishop/controller/Order.php View File

@@ -582,6 +582,32 @@ class Order extends Base
}
}

public function doRefund(){
$order_id = $this->request->post('order_id');
$order_id = Hashids::decodeHex($order_id);
$orderModel = new \addons\unishop\model\Order();
$order = $orderModel->where([
'id' => $order_id,
'user_id' => $this->auth->id,
'status'=>1,//订单状态正常
'have_paid'=>[">",0],//已支付
'have_received'=>0,//订单完成前
'had_refund'=>0
])->find();
if (!$order){
$this->error("订单信息错误");
}
$order->status = \addons\unishop\model\Order::STATUS_REFUND;
$order->refund_status = \addons\unishop\model\Order::REFUND_STATUS_AGREE;
$result = $order->save();
Hook::add('order_refund', 'addons\\unishop\\behavior\\Order');
if ($result !== false){
Hook::listen('order_refund', $row);
$this->success();
}
$this->error("订单信息错误");
}

/**
* 售后发货
*/


+ 28
- 28
addons/unishop/public/assets/js/backend/unishop/order.js View File

@@ -86,28 +86,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id'),visible:false},
{field: 'user_id', title: __('User_id')},
// {field: 'user_id', title: __('User_id')},
{field: 'user.username', title: __('User name')},
{field: 'out_trade_no', title: __('Out_trade_no')},
{field: 'order_price', title: __('Order_price'), operate:'BETWEEN'},
{field: 'discount_price', title: __('Discount_price'), operate:'BETWEEN'},
{field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},
// {field: 'discount_price', title: __('Discount_price'), operate:'BETWEEN'},
// {field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},
{field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
{field: 'status', title: __('Status'), searchList: {"-1":__('Refund'),"0":__('Cancel'),"1":__('Normal')}, formatter: Table.api.formatter.status},
{field: 'pay_type', title: __('Pay_type'), searchList: {"1":__('Online'),"2":__('Offline'),"3":__('wxPay'),"4":__('aliPay')}, formatter: Table.api.formatter.normal},
{field: 'ip', title: __('Ip'), visible:false},
{field: 'have_paid_status', title: __('Have_paid'), searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'have_delivered_status', title: __('Have_delivered'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'have_received_status', title: __('Have_received'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'have_commented_status', title: __('Have_commented'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'refund_status', title: __('Refund status'),searchList: {"0":__('None'),"1":__('Apply'),"2":__('Waiting for shipment'),"3":__('Pass'),"4":__('Refuse')}, formatter: Table.api.formatter.status},
{field: 'have_paid', title: __('Pay time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_delivered', title: __('Delivered time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_received', title: __('Received time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_commented', title: __('Commented time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'ip', title: __('Ip'), visible:false},
// {field: 'have_paid_status', title: __('Have_paid'), searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'have_delivered_status', title: __('Have_delivered'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'have_received_status', title: __('Have_received'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'have_commented_status', title: __('Have_commented'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'refund_status', title: __('Refund status'),searchList: {"0":__('None'),"1":__('Apply'),"2":__('Waiting for shipment'),"3":__('Pass'),"4":__('Refuse')}, formatter: Table.api.formatter.status},
// {field: 'have_paid', title: __('Pay time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'have_delivered', title: __('Delivered time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'have_received', title: __('Received time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'have_commented', title: __('Commented time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'remark', title: __('Remark'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符'},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{
field: 'operate',
title: __('Operate'),
@@ -115,20 +115,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name: 'refund',
text: __('Refund'),
classname: 'btn btn-xs btn-info btn-refund',
extend: 'data-toggle="tooltip"',
icon: 'fa fa-handshake-o'
},
{
name: 'delivere',
text: __('Delivere'),
classname: 'btn btn-xs btn-info btn-delivere',
extend: 'data-toggle="tooltip"',
icon: 'fa fa-plane'
},
// {
// name: 'refund',
// text: __('Refund'),
// classname: 'btn btn-xs btn-info btn-refund',
// extend: 'data-toggle="tooltip"',
// icon: 'fa fa-handshake-o'
// },
// {
// name: 'delivere',
// text: __('Delivere'),
// classname: 'btn btn-xs btn-info btn-delivere',
// extend: 'data-toggle="tooltip"',
// icon: 'fa fa-plane'
// },
{
name: 'product',
text: __('Product'),


+ 11
- 11
addons/unishop/public/assets/js/backend/unishop/product.js View File

@@ -550,13 +550,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload', 'plupload',
},
{field: 'sales_price', title: __('Lower price')},
{field: 'stock', title: __('Stock')},
{field: 'look', title: __('Look')},
{field: 'sales', title: __('Sales')},
// {field: 'look', title: __('Look')},
// {field: 'sales', title: __('Sales')},
{field: 'real_sales', title: __('Real sales')},
{field: 'no_buy_yet', title: __('No buy yet')},
{field: 'real_look', title: __('Real look')},
{field: 'delivery_id', title: __('Delivery_id'), visible: false},
{field: 'delivery.name', title: __('Delivery_id'), visible: false},
// {field: 'delivery_id', title: __('Delivery_id'), visible: false},
// {field: 'delivery.name', title: __('Delivery_id'), visible: false},
{
field: 'updatetime',
title: __('Updatetime'),
@@ -581,13 +581,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload', 'plupload',
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name: 'evaluate',
text: __('Evaluate'),
classname: 'btn btn-xs btn-info btn-evaluate',
extend: 'data-toggle="tooltip"',
icon: 'fa fa-commenting'
},
// {
// name: 'evaluate',
// text: __('Evaluate'),
// classname: 'btn btn-xs btn-info btn-evaluate',
// extend: 'data-toggle="tooltip"',
// icon: 'fa fa-commenting'
// },
{
name: 'copy',
text: __('Copy'),


+ 17
- 17
application/admin/view/unishop/order/index.html View File

@@ -1,14 +1,14 @@
<div class="panel panel-default panel-intro">

<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="status">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="statusList" item="vo"}
<li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<!-- <div class="panel-heading">-->
<!-- {:build_heading(null,FALSE)}-->
<!-- <ul class="nav nav-tabs" data-field="status">-->
<!-- <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>-->
<!-- {foreach name="statusList" item="vo"}-->
<!-- <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>-->
<!-- {/foreach}-->
<!-- </ul>-->
<!-- </div>-->


<div class="panel-body">
@@ -22,15 +22,15 @@
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('unishop/order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('unishop/order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->

<div class="dropdown btn-group {:$auth->check('unishop/order/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
<!-- <div class="dropdown btn-group {:$auth->check('unishop/order/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->

<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('unishop/order/recyclebin')?'':'hide'}" href="unishop/order/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
<!-- <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('unishop/order/recyclebin')?'':'hide'}" href="unishop/order/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('unishop/order/edit')}"


+ 31
- 28
public/assets/js/backend/unishop/order.js View File

@@ -82,29 +82,32 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
showExport: false,
commonSearch: false,
showToggle: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'),visible:false},
{field: 'user_id', title: __('User_id')},
// {field: 'id', title: __('Id'),visible:false},
// {field: 'user_id', title: __('User_id')},
{field: 'user.username', title: __('User name')},
{field: 'out_trade_no', title: __('Out_trade_no')},
{field: 'order_price', title: __('Order_price'), operate:'BETWEEN'},
{field: 'discount_price', title: __('Discount_price'), operate:'BETWEEN'},
{field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},
// {field: 'discount_price', title: __('Discount_price'), operate:'BETWEEN'},
// {field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},
{field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
{field: 'status', title: __('Status'), searchList: {"-1":__('Refund'),"0":__('Cancel'),"1":__('Normal')}, formatter: Table.api.formatter.status},
{field: 'pay_type', title: __('Pay_type'), searchList: {"1":__('Online'),"2":__('Offline'),"3":__('wxPay'),"4":__('aliPay')}, formatter: Table.api.formatter.normal},
{field: 'ip', title: __('Ip'), visible:false},
{field: 'have_paid_status', title: __('Have_paid'), searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'have_delivered_status', title: __('Have_delivered'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'have_received_status', title: __('Have_received'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'have_commented_status', title: __('Have_commented'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
{field: 'refund_status', title: __('Refund status'),searchList: {"0":__('None'),"1":__('Apply'),"2":__('Waiting for shipment'),"3":__('Pass'),"4":__('Refuse')}, formatter: Table.api.formatter.status},
{field: 'have_paid', title: __('Pay time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_delivered', title: __('Delivered time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_received', title: __('Received time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_commented', title: __('Commented time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'ip', title: __('Ip'), visible:false},
// {field: 'have_paid_status', title: __('Have_paid'), searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'have_delivered_status', title: __('Have_delivered'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'have_received_status', title: __('Have_received'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'have_commented_status', title: __('Have_commented'),searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},
// {field: 'refund_status', title: __('Refund status'),searchList: {"0":__('None'),"1":__('Apply'),"2":__('Waiting for shipment'),"3":__('Pass'),"4":__('Refuse')}, formatter: Table.api.formatter.status},
// {field: 'have_paid', title: __('Pay time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'have_delivered', title: __('Delivered time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'have_received', title: __('Received time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
// {field: 'have_commented', title: __('Commented time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'remark', title: __('Remark'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符'},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
@@ -115,20 +118,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name: 'refund',
text: __('Refund'),
classname: 'btn btn-xs btn-info btn-refund',
extend: 'data-toggle="tooltip"',
icon: 'fa fa-handshake-o'
},
{
name: 'delivere',
text: __('Delivere'),
classname: 'btn btn-xs btn-info btn-delivere',
extend: 'data-toggle="tooltip"',
icon: 'fa fa-plane'
},
// {
// name: 'refund',
// text: __('Refund'),
// classname: 'btn btn-xs btn-info btn-refund',
// extend: 'data-toggle="tooltip"',
// icon: 'fa fa-handshake-o'
// },
// {
// name: 'delivere',
// text: __('Delivere'),
// classname: 'btn btn-xs btn-info btn-delivere',
// extend: 'data-toggle="tooltip"',
// icon: 'fa fa-plane'
// },
{
name: 'product',
text: __('Product'),


Loading…
Cancel
Save