Merge pull request 'dev' (#141) from dev into main
Reviewed-on: https://gitea.lihaink.cn/mkm/multi-store/pulls/141
This commit is contained in:
commit
9847f9fa12
@ -154,22 +154,22 @@ class StoreOrderController extends BaseAdminController
|
|||||||
$id = $this->request->post('id');
|
$id = $this->request->post('id');
|
||||||
$system_store = $this->request->post('system_store');
|
$system_store = $this->request->post('system_store');
|
||||||
$xlsx = new OrderDetail();
|
$xlsx = new OrderDetail();
|
||||||
|
$order=StoreOrder::where('id',$id)->findOrEmpty();
|
||||||
|
$time= strtotime('+1 day', $order['pay_time']);
|
||||||
|
$order['pay_time']=date('Y-m-d H:i:s',$order['pay_time']);
|
||||||
|
$order['delivery_time']=date('Y-m-d', $time);
|
||||||
$data = StoreOrderCartInfo::where('oid', $id)->select();
|
$data = StoreOrderCartInfo::where('oid', $id)->select();
|
||||||
$total_num=0;
|
|
||||||
$total_price=0;
|
|
||||||
foreach ($data as $key => &$value) {
|
foreach ($data as $key => &$value) {
|
||||||
$find=StoreProduct::where('id',$value->product_id)->find();
|
$find=StoreProduct::where('id',$value->product_id)->find();
|
||||||
$value->store_name=$find['store_name']??'';
|
$value->store_name=$find['store_name']??'';
|
||||||
$value->store_info=$find['store_info']??'';
|
$value->store_info=$find['store_info']??'';
|
||||||
if(!empty($find['unit_id'])){
|
if(!empty($find['unit'])){
|
||||||
$value->unit_name=StoreProductUnit::where('id',$find['unit_id'])->value('name');
|
$value->unit_name=StoreProductUnit::where('id',$find['unit'])->value('name');
|
||||||
}else{
|
}else{
|
||||||
$value->unit_name='';
|
$value->unit_name='';
|
||||||
}
|
}
|
||||||
$total_num+=$value->cart_num;
|
|
||||||
$total_price+=$value->total_price;
|
|
||||||
}
|
}
|
||||||
$file_path = $xlsx->export($data,$system_store,$total_num,$total_price);
|
$file_path = $xlsx->export($data,$system_store,$order);
|
||||||
|
|
||||||
return $this->success('导出成功', ['url' => $file_path]);
|
return $this->success('导出成功', ['url' => $file_path]);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ use app\admin\controller\BaseAdminController;
|
|||||||
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoLists;
|
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoLists;
|
||||||
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoTwoLists;
|
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoTwoLists;
|
||||||
use app\admin\logic\store_order_cart_info\StoreOrderCartInfoLogic;
|
use app\admin\logic\store_order_cart_info\StoreOrderCartInfoLogic;
|
||||||
|
use app\common\model\store_order\StoreOrder;
|
||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
@ -80,22 +81,27 @@ class StoreOrderCartInfoController extends BaseAdminController
|
|||||||
$data = StoreOrderCartInfo::where($where)->select();
|
$data = StoreOrderCartInfo::where($where)->select();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$order['pay_time']='';
|
||||||
|
$order['delivery_time']='';
|
||||||
|
$order['order_id']='';
|
||||||
|
|
||||||
$total_num=0;
|
$total_num=0;
|
||||||
$total_price=0;
|
$total_price=0;
|
||||||
foreach ($data as $key => &$value) {
|
foreach ($data as $key => &$value) {
|
||||||
$find=StoreProduct::where('id',$value->product_id)->find();
|
$find=StoreProduct::where('id',$value->product_id)->find();
|
||||||
$value->store_name=$find['store_name']??'';
|
$value->store_name=$find['store_name']??'';
|
||||||
$value->store_info=$find['store_info']??'';
|
$value->store_info=$find['store_info']??'';
|
||||||
if(!empty($find['unit_id'])){
|
if(!empty($find['unit'])){
|
||||||
$value->unit_name=StoreProductUnit::where('id',$find['unit_id'])->value('name');
|
$value->unit_name=StoreProductUnit::where('id',$find['unit'])->value('name');
|
||||||
}else{
|
}else{
|
||||||
$value->unit_name='';
|
$value->unit_name='';
|
||||||
}
|
}
|
||||||
$total_num+=$value->cart_num;
|
$total_num+=$value->cart_num;
|
||||||
$total_price+=$value->total_price;
|
$total_price+=$value->total_price;
|
||||||
}
|
}
|
||||||
$file_path = $xlsx->export($data,$system_store,$total_num,$total_price);
|
$order['total_num']=$total_num;
|
||||||
|
$order['total_price']=$total_price;
|
||||||
|
$file_path = $xlsx->export($data,$system_store,$order);
|
||||||
return $this->success('导出成功', ['url' => $file_path]);
|
return $this->success('导出成功', ['url' => $file_path]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -58,7 +58,7 @@ class StoreBranchProductExchangeLists extends BaseAdminDataLists implements List
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return StoreBranchProductExchange::where($this->searchWhere)->where($where)
|
return StoreBranchProductExchange::where($this->searchWhere)->where($where)
|
||||||
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status'])
|
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'bar_code','status'])
|
||||||
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
||||||
$query->where('store_id', $this->adminInfo['store_id']);
|
$query->where('store_id', $this->adminInfo['store_id']);
|
||||||
})
|
})
|
||||||
|
@ -81,7 +81,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
$this->searchWhere[] = $where;
|
$this->searchWhere[] = $where;
|
||||||
}
|
}
|
||||||
return StoreBranchProduct::where($this->searchWhere)
|
return StoreBranchProduct::where($this->searchWhere)
|
||||||
->field(['id', 'store_id', 'product_id', 'image', 'store_name', 'store_info', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'purchase', 'status', 'batch', 'vip_price', 'manufacturer_information'])
|
->field(['id', 'store_id', 'product_id', 'image', 'store_name', 'store_info', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'purchase', 'status', 'batch', 'vip_price','bar_code', 'manufacturer_information'])
|
||||||
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
||||||
$query->where('store_id', $this->adminInfo['store_id']);
|
$query->where('store_id', $this->adminInfo['store_id']);
|
||||||
})
|
})
|
||||||
|
@ -197,7 +197,7 @@ class OrderController extends BaseApiController
|
|||||||
Db::name('wechat_micropay')->insert(['order_id' => $order['order_id'], 'create_time' => time(), 'update_time' => time()]);
|
Db::name('wechat_micropay')->insert(['order_id' => $order['order_id'], 'create_time' => time(), 'update_time' => time()]);
|
||||||
Redis::send('send-code-pay', ['order_id' => $order['order_id']]);
|
Redis::send('send-code-pay', ['order_id' => $order['order_id']]);
|
||||||
try{
|
try{
|
||||||
$arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的条码支付订单"]];
|
$arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的条码支付订单|".$order['order_id']]];
|
||||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b538e44b-940b-445f-afe0-97320942d959';
|
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b538e44b-940b-445f-afe0-97320942d959';
|
||||||
(new Curl())->postJson($url, json_encode($arr));
|
(new Curl())->postJson($url, json_encode($arr));
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
@ -315,7 +315,7 @@ class OrderController extends BaseApiController
|
|||||||
Db::name('wechat_micropay')->insert(['order_id' => $order['order_id'], 'create_time' => time(), 'update_time' => time()]);
|
Db::name('wechat_micropay')->insert(['order_id' => $order['order_id'], 'create_time' => time(), 'update_time' => time()]);
|
||||||
Redis::send('send-code-pay', ['order_id' => $order['order_id']]);
|
Redis::send('send-code-pay', ['order_id' => $order['order_id']]);
|
||||||
try{
|
try{
|
||||||
$arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的条码支付订单"]];
|
$arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的条码支付订单|".$order['order_id']]];
|
||||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b538e44b-940b-445f-afe0-97320942d959';
|
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b538e44b-940b-445f-afe0-97320942d959';
|
||||||
(new Curl())->postJson($url, json_encode($arr));
|
(new Curl())->postJson($url, json_encode($arr));
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
|
@ -14,9 +14,9 @@ class OrderDetail
|
|||||||
public $company='共投里海';
|
public $company='共投里海';
|
||||||
public $address='泸州龙马潭区海吉星122栋';
|
public $address='泸州龙马潭区海吉星122栋';
|
||||||
public $phone='08302669767';
|
public $phone='08302669767';
|
||||||
public $tel='08302669767';
|
public $tel='17309099881';
|
||||||
|
|
||||||
public function export($data,$system_store,$total_num,$total_price)
|
public function export($data,$system_store,$order)
|
||||||
{
|
{
|
||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
@ -32,8 +32,11 @@ class OrderDetail
|
|||||||
$sheet->setCellValue('A2', '店铺名称');
|
$sheet->setCellValue('A2', '店铺名称');
|
||||||
$sheet->setCellValue('B2', $system_store);
|
$sheet->setCellValue('B2', $system_store);
|
||||||
$sheet->setCellValue('F2', '送货时间');
|
$sheet->setCellValue('F2', '送货时间');
|
||||||
|
$sheet->setCellValue('G2', $order['delivery_time']??'');
|
||||||
$sheet->setCellValue('A3', '开单日期');
|
$sheet->setCellValue('A3', '开单日期');
|
||||||
|
$sheet->setCellValue('B3', $order['pay_time']??'');
|
||||||
$sheet->setCellValue('F3', '单号');
|
$sheet->setCellValue('F3', '单号');
|
||||||
|
$sheet->setCellValue('G3', $order['order_id']??'');
|
||||||
$sheet->setCellValue('A4', '序号');
|
$sheet->setCellValue('A4', '序号');
|
||||||
$sheet->setCellValue('B4', '商品名称');
|
$sheet->setCellValue('B4', '商品名称');
|
||||||
$sheet->setCellValue('D4', '规格');
|
$sheet->setCellValue('D4', '规格');
|
||||||
@ -71,10 +74,10 @@ class OrderDetail
|
|||||||
|
|
||||||
$sheet->mergeCells('B' . ($count + 6) . ':E' . $count + 6);
|
$sheet->mergeCells('B' . ($count + 6) . ':E' . $count + 6);
|
||||||
$sheet->setCellValue('A' . $count + 6, '合计数量');
|
$sheet->setCellValue('A' . $count + 6, '合计数量');
|
||||||
$sheet->setCellValue('B' . $count + 6,$total_num);
|
$sheet->setCellValue('B' . $count + 6,$order['total_num']);
|
||||||
$sheet->mergeCells('G' . ($count + 6) . ':J' . $count + 6);
|
$sheet->mergeCells('G' . ($count + 6) . ':J' . $count + 6);
|
||||||
$sheet->setCellValue('F' . $count + 6, '合计价格');
|
$sheet->setCellValue('F' . $count + 6, '合计价格');
|
||||||
$sheet->setCellValue('G' . $count + 6, $total_price);
|
$sheet->setCellValue('G' . $count + 6, $order['total_price']);
|
||||||
|
|
||||||
$sheet->mergeCells('A' . ($count + 7) . ':J' . $count + 7);
|
$sheet->mergeCells('A' . ($count + 7) . ':J' . $count + 7);
|
||||||
|
|
||||||
@ -97,7 +100,7 @@ class OrderDetail
|
|||||||
$sheet->mergeCells('A' . ($count + 10) . ':J' . $count + 10);
|
$sheet->mergeCells('A' . ($count + 10) . ':J' . $count + 10);
|
||||||
|
|
||||||
$sheet->setCellValue('A' . $count + 11, '仓库',);
|
$sheet->setCellValue('A' . $count + 11, '仓库',);
|
||||||
$sheet->setCellValue('B' . $count + 11, $this->warehouse);
|
// $sheet->setCellValue('B' . $count + 11, $this->warehouse);
|
||||||
$sheet->mergeCells('B' . ($count + 11) . ':C' . $count + 11);
|
$sheet->mergeCells('B' . ($count + 11) . ':C' . $count + 11);
|
||||||
$sheet->setCellValue('D' . $count + 11, '送货');
|
$sheet->setCellValue('D' . $count + 11, '送货');
|
||||||
$sheet->mergeCells('E' . ($count + 11) . ':F' . $count + 11);
|
$sheet->mergeCells('E' . ($count + 11) . ':F' . $count + 11);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user