diff --git a/app/controller/manager/account/Index.php b/app/controller/manager/account/Index.php index d20be97..16800c2 100755 --- 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 100755 --- 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 100755 --- 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 100755 --- 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 100755 --- 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<thisids.length;aa++){ + $.ajax('/manager/mall/order/export-order-info', { + data: {id: thisids[aa],type:"zip"}, + async: false, + dataType: 'json',//服务器返回json格式数据 + type: 'post',//HTTP请求类型 + timeout: 10000,//超时时间设置为10秒; + success: function (res) { + // console.log(res) + if (res.code === 0) { + excelUrls.push(res.data.url); + }else{ + layer.msg("导出订单失败id:"+thisids[aa]); + } + }, + error: function (xhr, type, errorThrown) { + layer.msg("导出订单失败id:"+thisids[aa]); + } + }); + } + layer.close(index_layer) + window.open("/manager/mall/order/export-order-info-zip?urls="+excelUrls.join(",")); + return false; default: if (layEvent !== 'LAYTABLE_COLS' && layEvent !== 'LAYTABLE_EXPORT') { @@ -246,6 +287,8 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate' type: 'datetime', }); + + } if ($('.location-operate-page').length > 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 100755 --- a/view/manager/mall/order/index.html +++ b/view/manager/mall/order/index.html @@ -104,6 +104,7 @@ <!-- toolbar --> <script type="text/html" id="toolbar-tpl"> <a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh lay-event="refresh"><i class="fa fa-refresh"></i></a> + <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="export-zip">批量导出</a> <!-- <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="export-list">导出待发货物流</a>--> <!-- <a class="layui-btn layui-btn-warm layui-btn-sm" id="upload-order" href="javascript:;">导入待发货物流</a>--> </script> diff --git a/view/manager/mall/order/info.html b/view/manager/mall/order/info.html index 14761d5..5485de3 100755 --- a/view/manager/mall/order/info.html +++ b/view/manager/mall/order/info.html @@ -8,7 +8,7 @@ <fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;"> <legend>订单信息</legend> </fieldset> - <div> + <div class="layui-form"> <table class="layui-table" lay-even="" lay-skin="nob"> <tbody> <tr> @@ -16,7 +16,12 @@ <td>订单状态:{$statusList[$item['status']] ?? ''}</td> </tr> <tr> - <td>应付总价(元):<span id="order_original_price">{$item.original_price ?? 0}</span></td> + <td>应付总价(元): + <div class="layui-input-inline"> + <input id="order_original_price" type="text" class="layui-input " name="item[original_price]" value="{$item.original_price ?? ''}"> + </div> + </td> + <td>下单时间:{$item.created_at ?? ''}</td> <!-- <td>实付总价(元):{$item.price ?? 0}</td>--> </tr> <!-- <tr>--> @@ -34,12 +39,16 @@ {/if} </tr> <tr> - <td>下单时间:{$item.created_at ?? ''}</td> -<!-- <td>付款时间:{$item.paid_at ?? ''}</td>--> - </tr> - <tr> - <td>发货时间:{$item.shipped_at ?? ''}</td> - <td>确认收货时间:{$item.accepted_at ?? ''}</td> + <td>发货时间: + <div class="layui-input-inline"> + <input type="text" class="layui-input layui-datetime" name="item[shipped_at]" value="{$item.shipped_at ?? ''}"> + </div> + </td> + <td>确认收货时间: + <div class="layui-input-inline"> + <input type="text" class="layui-input layui-datetime" name="item[accepted_at]" value="{$item.accepted_at ?? ''}"> + </div> + </td> </tr> <!-- <tr>--> <!-- <td>物流方式:{$item.pick_self == 1 ? '自提' : '邮寄'}</td>--> @@ -62,15 +71,35 @@ <!-- </tr>--> {/if} <tr> - <td>婚期:{$item.wedding_date ?? ''}</td> - <td>期望送达日期:{$item.expected_delivery_date ?? ''}</td> + <td>婚期 : + <div class="layui-input-inline"> + <input type="text" class="layui-input layui-date" name="item[wedding_date]" value="{$item.wedding_date ?? ''}"> + </div> + </td> + <td>期望送达日期: + <div class="layui-input-inline"> + <input type="text" class="layui-input layui-date" name="item[expected_delivery_date]" value="{$item.expected_delivery_date ?? ''}"> + </div> + </td> </tr> <tr> - <td>收货地址:{$item.address ?? ''}</td> - <td>联系人:{$item.contacts ?? ''}</td> + <td>收货地址: + <div class="layui-input-inline"> + <input type="text" class="layui-input" name="item[address]" value="{$item.address ?? ''}"> + </div> + </td> + <td>联系人 : + <div class="layui-input-inline"> + <input type="text" name="item[contacts]" class="layui-input" value="{$item.contacts ?? ''}"> + </div> + </td> </tr> <tr> - <td>联系电话:{$item.phone ?? ''}</td> + <td>联系电话: + <div class="layui-input-inline"> + <input type="text" name="item[phone]" class="layui-input" value="{$item.phone ?? ''}"> + </div> + </td> </tr> <tr> {if $item.pick_self != 1} @@ -80,6 +109,16 @@ <!-- <tr>--> <!-- <td>买家备注:{$item.remarks ?? ''}</td>--> <!-- </tr>--> + <tr> + <td> + <div class="layui-form-item"> + <div class="layui-input-block"> + <button class="layui-btn layui-btn-normal" data-url="/manager/mall/order/info?id={$item.id}" lay-submit lay-filter="saveBtn">确认保存</button> + </div> + </div> + </td> + </tr> + </tbody> </table> </div> diff --git a/view/manager/slide/add.html b/view/manager/slide/add.html index 5cf1599..4118c5b 100755 --- a/view/manager/slide/add.html +++ b/view/manager/slide/add.html @@ -31,7 +31,7 @@ <div class="layui-row upload-file-div"> <div class=" layui-col-xs12 layui-col-md8"> <input class="layui-input upload-file-value" name="item[src]" type="text" value=""> - <div class="layui-form-mid layui-word-aux">图片尺寸:最低高度为200px</div> + <div class="layui-form-mid layui-word-aux">图片尺寸:710px*400px</div> </div> <div class="layui-col-xs12 layui-col-md3"> <span> diff --git a/view/manager/slide/edit.html b/view/manager/slide/edit.html index a954acb..2f6d722 100755 --- a/view/manager/slide/edit.html +++ b/view/manager/slide/edit.html @@ -31,7 +31,7 @@ <div class="layui-row upload-file-div"> <div class=" layui-col-xs12 layui-col-md8"> <input class="layui-input upload-file-value" name="item[src]" type="text" value="{$item.src ?? ''}"> - <div class="layui-form-mid layui-word-aux">图片尺寸:最低高度为200px</div> + <div class="layui-form-mid layui-word-aux">图片尺寸:710px*400px</div> </div> <div class="layui-col-xs12 layui-col-md3"> <span>