Pārlūkot izejas kodu

checkredis

undefined
娄梦宁 pirms 4 gadiem
vecāks
revīzija
ffbb8e0c18
5 mainītis faili ar 110 papildinājumiem un 29 dzēšanām
  1. +65
    -0
      application/admin/controller/unishop/market/FlashSale.php
  2. +1
    -0
      application/admin/view/user/user/index.html
  3. +11
    -0
      public/assets/js/backend/unishop/market/flash_sale.js
  4. +33
    -29
      public/assets/js/backend/unishop/order.js
  5. Binārs
      public/uploads/file/员工账号导入模板.xls

+ 65
- 0
application/admin/controller/unishop/market/FlashSale.php Parādīt failu

@@ -500,4 +500,69 @@ class FlashSale extends Backend
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}

public function export(){
$id=input("id");
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$title1=["商品名称","件数","单价","总价"];
$product=new \app\admin\model\unishop\OrderProduct();
$product_list = $product->alias("p")
->join("unishop_order","p.order_id = unishop_order.id")
->where([
'p.flash_id'=>$id
])
->field('
p.title,
SUM(p.number) num,
p.price,
SUM(p.number)*p.price as total,
p.product_id')
->group("p.id")
->select();
$product_list = collection($product_list)->toArray();
$product_arr=[];
foreach ($product_list as $tmp_product){
if (isset($product_arr[$tmp_product['product_id']])){
$product_arr[$tmp_product['product_id']]["num"]+=$tmp_product['num'];
$product_arr[$tmp_product['product_id']]["total"]+=$tmp_product['total'];
}else{
$product_arr[$tmp_product['product_id']]=$tmp_product;
}
}

foreach ($title1 as $key => $value) {
// 单元格内容写入
$sheet->setCellValueByColumnAndRow($key + 1, 1, $value);
}
$row=2;
foreach ($product_arr as $item) {
unset($item['product_id']);
$column = 1;
foreach ($item as $value) {
// 单元格内容写入
$sheet->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;
}
}

+ 1
- 0
application/admin/view/user/user/index.html Parādīt failu

@@ -7,6 +7,7 @@
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,edit,del,import')}
<a href="/uploads/file/员工账号导入模板.xls" class="btn btn-success btn-finish title="{:__('下载')}" ><i class="fa fa-export"></i> {:__('下载')}</a>
<div class="dropdown btn-group {:$auth->check('user/user/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">


+ 11
- 0
public/assets/js/backend/unishop/market/flash_sale.js Parādīt failu

@@ -49,6 +49,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
icon: 'fa fa-info',
url: 'unishop/market/flash_sale/done',
refresh: true
},
{
name: 'done',
text: __('导出'),
classname: 'btn btn-xs btn-info btn-export',
icon: 'fa',
url:function (row) {
return '/admin.php/unishop/market/flash_sale/export?id='+row.ids;
} ,

refresh: true
}
]
}


+ 33
- 29
public/assets/js/backend/unishop/order.js Parādīt failu

@@ -79,25 +79,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin

// 初始化表格
table.bootstrapTable({
pageSize: 20,
pageList: [20, 50, 100],
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
showExport: false,
commonSearch: false,
commonSearch: true,
showToggle: false,
columns: [
[
{checkbox: true},
// {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: 'user.username', title: __('User name'),operate: 'LIKE'},
{field: 'user.nickname', title: __('工号'),visible:false,operate: 'LIKE'},
{field: 'out_trade_no', title: __('Out_trade_no'),operate:false},
{field: 'order_price', title: __('Order_price'), operate:false},
// {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: 'total_price', title: __('Total_price'), operate:false},
{field: 'status', title: __('Status'),operate:false, searchList: {"-1":__('Refund'),"0":__('Cancel'),"1":__('Normal')}, formatter: Table.api.formatter.status},
{field: 'pay_type', title: __('Pay_type'),operate:false, 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},
@@ -108,9 +111,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {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: 'createtime', title: __('Createtime'),operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'remark', title: __('Remark'),operate:false},
{field: 'updatetime', title: __('Updatetime'),operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{
field: 'operate',
title: __('Operate'),
@@ -178,37 +181,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
});

var table = $("#table");

// 初始化表格
table.bootstrapTable({
url: 'unishop/order/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
pageSize: 20,
pageList: [20, 50, 100],
columns: [
[
{checkbox: true},
{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: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
{field: 'pay_type', title: __('Pay_type'), searchList: {"1":__('Online'),"2":__('Offline'),"3":__('wxPay'),"4":__('aliPay')}, formatter: Table.api.formatter.normal},
{field: 'out_trade_no', title: __('Out_trade_no'),operate:false},
{field: 'order_price', title: __('Order_price'), operate:false},
{field: 'discount_price', title: __('Discount_price'), operate:false},
{field: 'delivery_price', title: __('Delivery_price'), operate:false},
{field: 'total_price', title: __('Total_price'),operate:false},
{field: 'pay_type', title: __('Pay_type'), searchList: {"1":__('Online'),"2":__('Offline'),"3":__('wxPay'),"4":__('aliPay')},operate:false, formatter: Table.api.formatter.normal},
{field: 'ip', title: __('Ip'), visible:false},
{field: 'status', title: __('Status'), searchList: {"-1":__('Refund'),"0":__('Cancel'),"1":__('Normal')}, formatter: Table.api.formatter.status},
{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: 'status', title: __('Status'), searchList: {"-1":__('Refund'),"0":__('Cancel'),"1":__('Normal')},operate:false, formatter: Table.api.formatter.status},
{field: 'have_paid_status', title: __('Have_paid'), searchList: {"0":__('No'),"1":__('Yes')},operate:false, formatter: Table.api.formatter.statusCustom},
{field: 'have_delivered_status', title: __('Have_delivered'),searchList: {"0":__('No'),"1":__('Yes')},operate:false, formatter: Table.api.formatter.statusCustom},
{field: 'have_received_status', title: __('Have_received'),searchList: {"0":__('No'),"1":__('Yes')},operate:false, formatter: Table.api.formatter.statusCustom},
{field: 'have_commented_status', title: __('Have_commented'),searchList: {"0":__('No'),"1":__('Yes')},operate:false, formatter: Table.api.formatter.statusCustom},
{field: 'refund_status',operate:false, 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:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_delivered', title: __('Delivered time'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_received', title: __('Received time'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'have_commented', title: __('Commented time'),operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime,visible:false},
{field: 'createtime', title: __('Createtime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'remark', title: __('Remark'), operate:false, placeholder: '模糊搜索,*表示任意字符'},
{
field: 'deletetime',
title: __('Deletetime'),


Binārs
public/uploads/file/员工账号导入模板.xls Parādīt failu


Notiek ielāde…
Atcelt
Saglabāt