浏览代码

产品价格编辑计算

xialei 1 年之前
父节点
当前提交
a0211a23e7
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      app/common/repositories/store/product/ProductRepository.php

+ 6 - 0
app/common/repositories/store/product/ProductRepository.php

@@ -381,6 +381,12 @@ class ProductRepository extends BaseRepository
381
         $pric = $stock = $ot_price = $cost = $dc_price = $concession_pri = 0;
381
         $pric = $stock = $ot_price = $cost = $dc_price = $concession_pri = 0;
382
         if (isset($data['attrValue']) && is_array($data['attrValue'])) {
382
         if (isset($data['attrValue']) && is_array($data['attrValue'])) {
383
             foreach ($data['attrValue'] as $value) {
383
             foreach ($data['attrValue'] as $value) {
384
+
385
+                $value['cost'] = bcsub($value['price'], bcmul($value['price'], $value['extension_one'] / 100, 2), 2);
386
+                $value['gong_mer_profit'] = bcmul($value['price'], $value['extension_one'] / 100, 2);
387
+                $value['gong_market_price'] = bcadd($value['cost'], $value['gong_mer_profit'], 2);
388
+                $value['plate_mer_profit'] = $value['gong_mer_profit'];
389
+
384
                 $sku = '';
390
                 $sku = '';
385
                 if (isset($value['detail']) && is_array($value['detail'])) {
391
                 if (isset($value['detail']) && is_array($value['detail'])) {
386
                     $sku = implode(',', $value['detail']);
392
                     $sku = implode(',', $value['detail']);