|
@@ -128,7 +128,7 @@ class Filing
|
|
|
{
|
|
|
|
|
|
$rs = Db::name('filing')
|
|
|
- ->field('id,status')
|
|
|
+ ->field('id,status,is_determine_price,price,cgd_charge')
|
|
|
->where(['is_del' => 0, 'id' => $data['id']])
|
|
|
->whereIn('status', [0, 2])
|
|
|
->findOrEmpty();
|
|
@@ -145,13 +145,18 @@ class Filing
|
|
|
->findOrEmpty();
|
|
|
if (empty($tmp)) return json_show(1005, '该平台不存在');
|
|
|
|
|
|
+ $update = array_merge($data, [
|
|
|
+ 'companyName' => $companyName,
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s'),
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if ($rs['is_determine_price'] == 1) $update['cgd_charge'] = round(bcsub($rs['price'], $data['service_charge'], 3), 2);//确定售价时,采购价=售价-服务费
|
|
|
+ else $update['price'] = round(bcadd($rs['cgd_charge'], $data['service_charge'], 3), 2);//不确定售价时,售价=采购价+服务费
|
|
|
+
|
|
|
$res = Db::name('filing')
|
|
|
->where(['is_del' => 0, 'id' => $data['id']])
|
|
|
->whereIn('status', [0, 2])
|
|
|
- ->update(array_merge($data, [
|
|
|
- 'companyName' => $companyName,
|
|
|
- 'updatetime' => date('Y-m-d H:i:s')
|
|
|
- ]));
|
|
|
+ ->update($update);
|
|
|
return $res ? json_show(0, '操作成功') : json_show(1004, '操作失败');
|
|
|
|
|
|
|