feat(api): 添加预订单记录查看和审核功能
- 新增 view_beforehand_order_record 和 view_beforehand_order_record_enter 方法 - 实现预订单记录查看页面和审核功能 - 添加微信企业号消息发送测试代码 - 优化订单价格计算逻辑
This commit is contained in:
parent
994050d437
commit
b93ee02d31
@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\admin\logic\beforehand_order\BeforehandOrderLogic;
|
||||
use app\admin\logic\store_branch_product\StoreBranchProductLogic;
|
||||
use app\common\logic\StoreFinanceFlowLogic;
|
||||
use app\admin\logic\store_product\StoreProductLogic;
|
||||
@ -10,14 +11,18 @@ use app\admin\logic\tools\GeneratorLogic;
|
||||
use app\api\logic\order\OrderLogic as OrderOrderLogic;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\logic\store_order\StoreOrderLogic;
|
||||
use app\common\model\beforehand_order_record\BeforehandOrderRecord;
|
||||
use app\common\model\Config as ModelConfig;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\system_store_storage\SystemStoreStorage;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\warehouse_product\WarehouseProduct;
|
||||
use app\common\service\Curl;
|
||||
use app\common\service\pay\PayService;
|
||||
use app\common\service\PushService;
|
||||
use app\common\service\wechat\WechatTemplate;
|
||||
@ -44,10 +49,40 @@ use PhpOffice\PhpWord\Style\Font;
|
||||
|
||||
class IndexController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config', 'push'];
|
||||
public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config', 'push', 'view_beforehand_order_record', 'view_beforehand_order_record_enter'];
|
||||
|
||||
public function index()
|
||||
{
|
||||
d(1);
|
||||
|
||||
$arr=StoreOrder::where('store_id',8)->where('paid',1)->field('id,pay_price')->select()->toArray();
|
||||
$data=[];
|
||||
foreach ($arr as $k => $v) {
|
||||
$total_price=StoreOrderCartInfo::where('oid', $v['id'])->sum('total_price');
|
||||
if($total_price != $v['pay_price']){
|
||||
$s=$v;
|
||||
$s['total_price']=$total_price;
|
||||
$data[] = $s;
|
||||
}
|
||||
}
|
||||
d($data);
|
||||
|
||||
|
||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b538e44b-940b-445f-afe0-97320942d959';
|
||||
|
||||
$arr = ["msgtype" => "template_card", "template_card" => [
|
||||
'card_type' => 'text_notice',
|
||||
'main_title' => [
|
||||
'title' => '测试标题',
|
||||
'desc' => '分单'
|
||||
],
|
||||
'card_action' => [
|
||||
'type' => 1,
|
||||
'url' => 'https://admin-multi-store.lihaink.cn/admin'
|
||||
]
|
||||
]];
|
||||
$a = (new Curl())->postJson($url, json_encode($arr, true));
|
||||
d($a);
|
||||
return json(1);
|
||||
|
||||
$financeFlow = new StoreFinanceFlow();
|
||||
@ -181,4 +216,56 @@ class IndexController extends BaseApiController
|
||||
$a = PushService::push($name, $uid, ['type' => $type, 'msg' => '支付超时,订单已被取消,请重新提交订单', 'data' => ['id' => 5]]);
|
||||
return $this->success('ok', ['data' => $a]);
|
||||
}
|
||||
|
||||
public function view_beforehand_order_record()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$is_xlsx = $this->request->get('is_xlsx');
|
||||
if ($is_xlsx == 1) {
|
||||
$xlsx_name = '清单';
|
||||
} elseif ($is_xlsx == 2) {
|
||||
$xlsx_name = '分单';
|
||||
} elseif ($is_xlsx == 3) {
|
||||
$xlsx_name = '采购';
|
||||
} elseif ($is_xlsx == 4) {
|
||||
$xlsx_name = '出库';
|
||||
}
|
||||
return view('beforehand_order/record', ['id' => $id, 'is_xlsx' => $is_xlsx, 'xlsx_name' => $xlsx_name]);
|
||||
}
|
||||
public function view_beforehand_order_record_enter()
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
$check = $this->request->post('check');
|
||||
$is_xlsx = $this->request->post('is_xlsx', 0);
|
||||
if ($is_xlsx) {
|
||||
if ($is_xlsx == 1) {
|
||||
$file_path = BeforehandOrderLogic::OrderList(['id' => $id]);
|
||||
return $this->success('导出成功', ['url' => $file_path]);
|
||||
} elseif ($is_xlsx == 2) {
|
||||
$file_path = BeforehandOrderLogic::OrderAllocation(['id' => $id]);
|
||||
return $this->success('导出成功', ['url' => $file_path]);
|
||||
} elseif ($is_xlsx == 3) {
|
||||
$file_path = BeforehandOrderLogic::OrderInfo(['id' => $id]);
|
||||
return $this->success('导出成功', ['url' => $file_path]);
|
||||
} elseif ($is_xlsx == 4) {
|
||||
$file_path = BeforehandOrderLogic::OrderOutbound(['id' => $id]);
|
||||
return $this->success('导出成功', ['url' => $file_path]);
|
||||
} else {
|
||||
return $this->fail('导出失败');
|
||||
}
|
||||
}
|
||||
$check_id = 0;
|
||||
if ($check == '001') {
|
||||
$check_id = 14;
|
||||
}
|
||||
if ($check == '002') {
|
||||
$check_id = 6;
|
||||
}
|
||||
$res = BeforehandOrderRecord::where(['id' => $id])->update(['check_user_id' => $check_id, 'status' => 1]);
|
||||
if ($res) {
|
||||
return $this->success('审核通过');
|
||||
} else {
|
||||
return $this->fail('审核失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user