From a17bb70b5691ac2dd72b10776767c1fe77de9b43 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 8 Jun 2022 17:25:42 +0800 Subject: [PATCH] setter --- app/controller/manager/account/Index.php | 2 +- app/controller/manager/mall/Category.php | 1 + app/controller/manager/mall/Order.php | 55 ++++++++++++++++---- app/repository/OrderRepository.php | 1 + public/static/manager/js/mall/order.js | 60 +++++++++++++++++++++- view/manager/mall/order/index.html | 1 + view/manager/mall/order/info.html | 65 +++++++++++++++++++----- view/manager/slide/add.html | 2 +- view/manager/slide/edit.html | 2 +- 9 files changed, 163 insertions(+), 26 deletions(-) diff --git a/app/controller/manager/account/Index.php b/app/controller/manager/account/Index.php index d20be97..16800c2 100644 --- a/app/controller/manager/account/Index.php +++ b/app/controller/manager/account/Index.php @@ -173,7 +173,7 @@ class Index extends Base } } - $search[] = ['phone_active', '=', AccountModel::COMMON_ON]; + try { $items = AccountRepository::getInstance()->getAndHandleAccountList($search, [], $page, $size, function ($q) use ($other) { diff --git a/app/controller/manager/mall/Category.php b/app/controller/manager/mall/Category.php index 8b91691..5853e87 100644 --- a/app/controller/manager/mall/Category.php +++ b/app/controller/manager/mall/Category.php @@ -164,6 +164,7 @@ class Category extends Base Db::startTrans(); try { $item['path'] = CategoryModel::getPath($item['pid']); + $item['name'] = "name"; (new CategoryModel())->create($item); Db::commit(); return $this->json(); diff --git a/app/controller/manager/mall/Order.php b/app/controller/manager/mall/Order.php index 56cfe8f..af97512 100644 --- a/app/controller/manager/mall/Order.php +++ b/app/controller/manager/mall/Order.php @@ -297,10 +297,8 @@ class Order extends Base }); if ($this->request->isPost()) { - $businessRemarks = trim(input('business_remarks/s', '')); - - $item->save(['business_remarks' => $businessRemarks]); - + $data = input("item/a",[]); + $item->save($data); return $this->json(); } @@ -582,6 +580,7 @@ class Order extends Base public function exportOrderInfo() { $id = input("id/d"); + $type = input("type/s","save"); $order = OrderModel::findById($id, [], function ($q) { return $q->with([ 'skus']); }); @@ -697,18 +696,56 @@ class Order extends Base //第一种保存方式 $writer = new Xlsx($spreadsheet); //保存的路径可自行设置 - $path = public_path()."storage/order_excel/" ; + $path = "storage/order_excel/" ; if(!is_writable($path)){ return $this->json(4001,"上传文件夹需要写入权限"); } $path.=date("Ymd")."/"; - if(!is_dir($path)){ - mkdir($path); + if(!is_dir(public_path().$path)){ + mkdir(public_path().$path); } $downloadFileName = $order->contacts . "_" . $order->phone . "_" . $order->coding ; $fileName = $downloadFileName . ".xlsx"; - $filepath = $path. $fileName; + $filepath = public_path().$path. $fileName; $writer->save($filepath); - return download($filepath,$downloadFileName ); + if($type =="save"){ + return download($filepath,$downloadFileName ); + }else{ + return $this->json(0,"success",["url"=>$path.$fileName]); + } + + } + + /** + * 导出订单信息 + * */ + public function exportOrderInfoZip() + { + $urls = input("urls/s",''); + $urls = array_filter(explode(",", $urls)); + if(empty($urls)){ + return $this->json("4001","空的文件"); + } if(count($urls)>10){ + return $this->json("4001","最多支持10个文件"); + } + $zipdir = date("Ymd_His_") .randomStr(); + $downloadZipFilename = $zipdir. '.zip'; + $zipFilename = public_path() . 'storage/order_excel_zip/' . $downloadZipFilename; + $zip = new \ZipArchive(); + // 打开一个zip文档,ZipArchive::OVERWRITE:如果存在这样的文档,则覆盖;ZipArchive::CREATE:如果不存在,则创建 + $res = $zip->open($zipFilename, $zip::OVERWRITE | $zip::CREATE); + $zip->addEmptyDir($zipdir); + if($res){ + foreach ($urls as $url) { + $filrnamearr = explode("/",$url); + $filrname = end($filrnamearr); + $zip->addFile(public_path() . $url, $zipdir . "/" . $filrname); + } + $zip->close(); + + return download($zipFilename, $downloadZipFilename); + } + return $this->json(5001,"创建压缩文件失败"); + } } \ No newline at end of file diff --git a/app/repository/OrderRepository.php b/app/repository/OrderRepository.php index b5c7215..1bbe196 100644 --- a/app/repository/OrderRepository.php +++ b/app/repository/OrderRepository.php @@ -469,6 +469,7 @@ class OrderRepository extends Repository $arr['is_activity'] = $sku->is_activity; $arr['activity_type'] = $sku->activity_type; $arr['sku_unit'] = $sku->unit; + $arr['subtotal'] = $sku->original_price*$dataSku[$sku->coding]; $insert[] = $arr; if ($sku->is_virtual > 0) { diff --git a/public/static/manager/js/mall/order.js b/public/static/manager/js/mall/order.js index 5d30672..02fd9cb 100644 --- a/public/static/manager/js/mall/order.js +++ b/public/static/manager/js/mall/order.js @@ -209,6 +209,47 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate' exportFile(type, ids, isScore); } + return false; + + // toolbar 导出物流 + case 'export-zip': + + let thischeckStatus = table.checkStatus('table-container'); //idTest 即为基础参数 id 对应的值 + let thisids = []; + $(thischeckStatus.data).each(function (i, item) { + thisids.push(item.id); + }); + if(thisids.length==0){ + layer.msg("请勾选数据"); + return false; + } + let index_layer = layer.msg("导出中",{icon: 16,time: 100000,shade : [0.5 , '#000' , true]}); + //console.log(thisids); + let excelUrls = []; + + for(let aa =0;aa 0) { @@ -282,6 +325,21 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate' if ($('.location-detail-page').length > 0) { miniTab.listen(); + $(".layui-datetime").each(function () { + laydate.render({ + elem: this, + type: 'datetime', + }); + }) + $(".layui-date").each(function () { + laydate.render({ + elem: this, + type: 'date', + }); + }) + + + //监听行工具条 table.on('tool(table-container)', function (obj) { let layEvent = obj.event; @@ -385,7 +443,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate' layer.close(indexLoad); layer.msg(res.msg) if (res.code === 0) { - $("#order_original_price").text(res.data.original_price); + $("#order_original_price").val(res.data.original_price); insTb.refresh(); } }); diff --git a/view/manager/mall/order/index.html b/view/manager/mall/order/index.html index d36b757..95bbfce 100644 --- a/view/manager/mall/order/index.html +++ b/view/manager/mall/order/index.html @@ -104,6 +104,7 @@ diff --git a/view/manager/mall/order/info.html b/view/manager/mall/order/info.html index 14761d5..5485de3 100644 --- a/view/manager/mall/order/info.html +++ b/view/manager/mall/order/info.html @@ -8,7 +8,7 @@
订单信息
-
+
@@ -16,7 +16,12 @@ - + + @@ -34,12 +39,16 @@ {/if} - - - - - - + + @@ -62,15 +71,35 @@ {/if} - - + + - - + + - + {if $item.pick_self != 1} @@ -80,6 +109,16 @@ + + + +
订单状态:{$statusList[$item['status']] ?? ''}
应付总价(元):{$item.original_price ?? 0}应付总价(元): +
+ +
+
下单时间:{$item.created_at ?? ''}
下单时间:{$item.created_at ?? ''}
发货时间:{$item.shipped_at ?? ''}确认收货时间:{$item.accepted_at ?? ''}发货时间: +
+ +
+
确认收货时间: +
+ +
+
婚期:{$item.wedding_date ?? ''}期望送达日期:{$item.expected_delivery_date ?? ''}婚期       : +
+ +
+
期望送达日期: +
+ +
+
收货地址:{$item.address ?? ''}联系人:{$item.contacts ?? ''}收货地址: +
+ +
+
联系人           : +
+ +
+
联系电话:{$item.phone ?? ''}联系电话: +
+ +
+
+
+
+ +
+
+
diff --git a/view/manager/slide/add.html b/view/manager/slide/add.html index 5cf1599..4118c5b 100644 --- a/view/manager/slide/add.html +++ b/view/manager/slide/add.html @@ -31,7 +31,7 @@
-
图片尺寸:最低高度为200px
+
图片尺寸:710px*400px
diff --git a/view/manager/slide/edit.html b/view/manager/slide/edit.html index a954acb..2f6d722 100644 --- a/view/manager/slide/edit.html +++ b/view/manager/slide/edit.html @@ -31,7 +31,7 @@
-
图片尺寸:最低高度为200px
+
图片尺寸:710px*400px