|
@@ -35,7 +35,7 @@ class ConstructionService extends Service
|
|
|
$model->handover_time = $data['handover_time'] ?? 0;
|
|
|
$model->urgency = $data['urgency'] ?? 0;
|
|
|
$model->mark = $data['mark'] ?? '';
|
|
|
- $model->address1 = $data['address1'] ?? '';
|
|
|
+ $model->address1 = $data['address1'] ? json_encode($data['address1']) : '';
|
|
|
$model->address2 = $data['address2'] ?? '';
|
|
|
$model->introduction = $data['introduction'] ?? '';
|
|
|
$model->depart_id = $data['depart_id'] ?? 0;
|
|
@@ -83,7 +83,7 @@ class ConstructionService extends Service
|
|
|
$insert[] = [
|
|
|
'construction_id' => $model->id,
|
|
|
'product_id' => $value['product_id'],
|
|
|
- 'price' => $value['price'],
|
|
|
+ 'price' => $value['retail_price'],
|
|
|
'number' => $value['number'],
|
|
|
'mark' => $value['mark'] ?? '',
|
|
|
'crt_time' => $time,
|
|
@@ -123,7 +123,7 @@ class ConstructionService extends Service
|
|
|
$model->handover_time = $data['handover_time'] ?? 0;
|
|
|
$model->urgency = $data['urgency'] ?? 0;
|
|
|
$model->mark = $data['mark'] ?? '';
|
|
|
- $model->address1 = $data['address1'] ?? '';
|
|
|
+ $model->address1 = $data['address1'] ? json_encode($data['address1']) : '';
|
|
|
$model->address2 = $data['address2'] ?? '';
|
|
|
$model->introduction = $data['introduction'] ?? '';
|
|
|
$model->crt_id = $user['id'];
|
|
@@ -165,7 +165,7 @@ class ConstructionService extends Service
|
|
|
$insert[] = [
|
|
|
'construction_id' => $model->id,
|
|
|
'product_id' => $value['product_id'],
|
|
|
- 'price' => $value['price'],
|
|
|
+ 'price' => $value['retail_price'],
|
|
|
'number' => $value['number'],
|
|
|
'mark' => $value['mark']?? '',
|
|
|
'crt_time' => $time,
|
|
@@ -216,6 +216,15 @@ class ConstructionService extends Service
|
|
|
->first();
|
|
|
if(empty($construction)) return [false,'施工订单不存在或已被删除'];
|
|
|
$construction = $construction->toArray();
|
|
|
+ $address = '';
|
|
|
+ if(! empty($construction['address1'])) {
|
|
|
+ $tmp = json_decode($construction['address1'],true);
|
|
|
+ $construction['address1'] = $tmp;
|
|
|
+ $tmp = implode(' ',$tmp);
|
|
|
+ $tmp .= ' ' . $construction['address2'];
|
|
|
+ $address = $tmp;
|
|
|
+ }
|
|
|
+ $construction['address'] = $address;
|
|
|
$sales = SalesOrder::where('id',$construction['sales_order_id'])->value('order_number');
|
|
|
$construction['sales_order_number'] = $sales;
|
|
|
$customer_title = Customer::where('id',$construction['customer_id'])->value('title');
|
|
@@ -272,7 +281,7 @@ class ConstructionService extends Service
|
|
|
$construction['product'][] = [
|
|
|
'product_id' => $value['product_id'],
|
|
|
'mark' => $value['mark'],
|
|
|
- 'price' => $value['price'],
|
|
|
+ 'retail_price' => $value['price'],
|
|
|
'number' => $value['number'],
|
|
|
];
|
|
|
}
|
|
@@ -309,11 +318,10 @@ class ConstructionService extends Service
|
|
|
$res = $this->checkNumber($value['number']);
|
|
|
if(! $res) return [false,'请输入正确的产品数量'];
|
|
|
|
|
|
- if(empty($value['price'])) return [false,'产品价格不能为空'];
|
|
|
- $res = $this->checkNumber($value['price']);
|
|
|
+ if(empty($value['retail_price'])) return [false,'产品价格不能为空'];
|
|
|
+ $res = $this->checkNumber($value['retail_price']);
|
|
|
if(! $res) return [false,'产品价格请输入不超过两位小数并且大于0的数值'];
|
|
|
}
|
|
|
- if(empty($data['construction_contact'])) return [false,'联系方式不能为空'];
|
|
|
if(! empty($data['construction_fee'])){
|
|
|
$res = $this->checkNumber($data['construction_fee']);
|
|
|
if(! $res) return [false,'施工费用请输入不超过两位小数并且大于0的数值'];
|
|
@@ -327,6 +335,7 @@ class ConstructionService extends Service
|
|
|
if(empty($data['install_method'])) return [false,'安装方式不能为空'];
|
|
|
if(empty($data['install_position'])) return [false,'安装地点不能为空'];
|
|
|
}else{
|
|
|
+ if(empty($data['construction_contact'])) return [false,'联系方式不能为空'];
|
|
|
if(empty($data['address1']) || empty($data['address2'])) return [false,'地址不能为空'];
|
|
|
}
|
|
|
//所属部门 以及 顶级部门
|
|
@@ -358,6 +367,14 @@ class ConstructionService extends Service
|
|
|
->toArray();
|
|
|
|
|
|
foreach ($data['data'] as $key => $value){
|
|
|
+ $address = '';
|
|
|
+ if(! empty($value['address1'])) {
|
|
|
+ $tmp = json_decode($value['address1'],true);
|
|
|
+ $tmp = implode(' ',$tmp);
|
|
|
+ $tmp .= ' ' . $value['address2'];
|
|
|
+ $address = $tmp;
|
|
|
+ }
|
|
|
+ $data['data'][$key]['address'] = $address;
|
|
|
$data['data'][$key]['install_method_title'] = $basic_map[$value['install_method']] ?? '';
|
|
|
$data['data'][$key]['urgency_title'] = $basic_map[$value['urgency']] ?? '';
|
|
|
$data['data'][$key]['customer_title'] = $customer[$value['customer_id']] ?? '';
|