|
@@ -109,20 +109,63 @@ class Orders extends Backend
|
|
|
|
|
|
$data=input('row/a');
|
|
|
$this->validate($data,[
|
|
|
- 'address_id|发货地'=>['require',],
|
|
|
- 'com_id|物流公司'=>['require',],
|
|
|
+ 'address_id|发货地址'=>['require',],
|
|
|
+ 'province|发货方式'=>['require',],
|
|
|
'remark|备注'=>['max:100'],
|
|
|
]);
|
|
|
- Db::startTrans();
|
|
|
- $address=\app\admin\model\Address::lock(true)->find($data['address_id']);
|
|
|
+
|
|
|
+ $address=\app\admin\model\Address::lock(true)->find($data['address_id'])->toArray();
|
|
|
if(!$address){
|
|
|
- $this->error('地址不存在');
|
|
|
+ $this->error('发货地址不存在');
|
|
|
}
|
|
|
- $order->makeSendSelf($address,$data['remark']??'',$data['com_id']);
|
|
|
+ $kuayue = [1=>'次日达',2=>'隔日达',3=>'陆运件',4=>'省内次日',5=>'同城次日'];
|
|
|
+ $debangkuaidi = [6=>'大件快递360',7=>'重包入户'];
|
|
|
+ $shunfeng = [8=>'顺丰标快',9=>'顺丰特快'];
|
|
|
+ $kuaidi = [23=>'跨越速运','15'=>'德邦快递','1'=>'顺丰速运'];
|
|
|
+ if(in_array($data['province'],$kuayue)){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Db::startTrans();
|
|
|
+
|
|
|
+ $order->makeSendSelf($address,$data['remark']??'',$data['province']);
|
|
|
Db::commit();
|
|
|
$this->success();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断是否是同城
|
|
|
+ **/
|
|
|
+ public function is_same_city(){
|
|
|
+ $address_id = $this->request->request("address_id");
|
|
|
+ $order_id = $this->request->request("order_id");
|
|
|
+
|
|
|
+ $address = \app\admin\model\Address::lock(true)->find($address_id)->toArray();
|
|
|
+ if(!$address){
|
|
|
+ $this->error('发货地址不存在');
|
|
|
+ }
|
|
|
+ $order_address = \app\common\model\OrderAddress::where(['order_id'=>$order_id])->find()->toArray();
|
|
|
+ if(!$order_address){
|
|
|
+ $this->error('订单地址不存在');
|
|
|
+ }
|
|
|
+ $cityId = explode(',',$order_address['area']);
|
|
|
+ $to_city = \app\common\model\Area::where(['id'=>$cityId[1]])->value('name');
|
|
|
+ if(!$to_city){
|
|
|
+ $this->error('未获取订单地址');
|
|
|
+ }
|
|
|
+ $from_city = explode("/",$address['area']);
|
|
|
+ if(isset($from_city[1])){
|
|
|
+ $type = '0';
|
|
|
+ if($to_city == $from_city[1]){
|
|
|
+ $type = '1';
|
|
|
+ }
|
|
|
+ $this->success('获取成功','',['type'=>$type]);
|
|
|
+ }
|
|
|
+ $this->error('发货地址格式错误');
|
|
|
+ }
|
|
|
+
|
|
|
#详情
|
|
|
public function detail($ids){
|
|
|
$voucher=input('voucher');
|