Преглед изворни кода

项目管理新需求与部分BUG解决

Zhouzhendong пре 5 година
родитељ
комит
c68fabef5f

+ 6 - 4
app/Console/Commands/BeforeCreateOwnerReport.php

@@ -24,6 +24,7 @@ class BeforeCreateOwnerReport extends Command
     protected $description = 'Create owner report in advance and build cache';
 
 
+    const TTL = 2764800;
     /**
      * Execute the console command.
      *
@@ -42,10 +43,11 @@ class BeforeCreateOwnerReport extends Command
                     "counting_month" => date("Y-m-d"),
                     "created_at"     => $date
                 ];
-                //B:business C:customer D:date
-                Cache::put(date("Y-m")."|B|".$owner->id,0,2764800);
-                Cache::put(date("Y-m")."|C|".$owner->id,0,2764800);
-                Cache::put(date("Y-m")."|D|".$owner->id,time(),2764800);
+                //A:件 B:business C:customer D:date
+                Cache::put(date("Y-m")."|B|".$owner->id,0,self::TTL);
+                Cache::put(date("Y-m")."|C|".$owner->id,0,self::TTL);
+                Cache::put(date("Y-m")."|D|".$owner->id,time(),self::TTL);
+                Cache::put(date("Y-m")."|A|".$owner->id,0,self::TTL);
             }
             OwnerReport::query()->insert($insert);
         }

+ 6 - 1
app/Feature.php

@@ -25,9 +25,11 @@ class Feature extends Model
         5 => "商品备注",  //二级
         6 => "长",       //二级
         7 => "订单备注",
+        10=> "订单商品数",//二级
+        11=> "属性仓",
     ];
     //额外定义 8:商品数量 9:商品
-    const TYPE_NODE = [0,5,6,8,9]; //标注二级类型
+    const TYPE_NODE = [0,5,6,8,9,10]; //标注二级类型
     const MAPPING = [
         "store" => [
             0 => "storeItems.name",
@@ -37,6 +39,8 @@ class Feature extends Model
             7 => "remark",
             8 => "storeItems.amount",
             9 => "storeItems.commodity",
+            10=> "storeItems.total",
+            11=> "warehouse.name",
         ],
         "order" => [
             0 => "packages.commodities.commodity.name",
@@ -49,6 +53,7 @@ class Feature extends Model
             7 => "remark",
             8 => 'packages.commodities.amount',
             9 => 'packages.commodities.commodity',
+            10=> 'packages.commodities.total',
         ]
     ];
 }

+ 5 - 1
app/Http/Controllers/PriceModelController.php

@@ -1164,6 +1164,8 @@ class PriceModelController extends Controller
             "strategy"          => request("strategy"),
             "feature"           => request("feature"),
             "type_mark"         => request()->has("type_mark") ? \request("type_mark") : null,
+            "surcharge"         => request("surcharge") ? request("surcharge") : null,
+            "surcharge_unit_id" => request("surcharge_unit_id") ? request("surcharge_unit_id") : null,
             "remark"            => request("remark"),
             "discount_count"    => implode(",",request("discount_count")),
             "total_price"       => request("total_price"),
@@ -1174,7 +1176,7 @@ class PriceModelController extends Controller
             if ($model->operation){
                 app('OwnerPriceOperationService')->findUpdate($model,$operation);
                 $delete = [];//需要删除子项
-                $update = [["id","strategy","amount","unit_id","unit_price","feature","discount_price"]];//需要更新子项
+                $update = [["id","strategy","amount","unit_id","unit_price","feature","discount_price","odd_price"]];//需要更新子项
                 $insert = [];//需要新增子项
                 foreach ($params["items"] as $item){
                     $obj = [
@@ -1183,6 +1185,7 @@ class PriceModelController extends Controller
                         "unit_id"   => $item["unit_id"],
                         "unit_price"=> $item["unit_price"],
                         "feature"   => $item["feature"] ?? null,
+                        "odd_price" => $item["odd_price"] ?? null,
                         "discount_price"   => implode(",",$item["discount_price"] ?? []),
                     ];
                     if (isset($item["id"])){
@@ -1209,6 +1212,7 @@ class PriceModelController extends Controller
                     $temp["discount_price"]  = implode(",",$item["discount_price"] ?? []);
                     $temp["owner_price_operation_id"] = $model->id;
                     $temp["feature"] = $item["feature"] ?? null;
+                    $temp["odd_price"] = $item["odd_price"] ?? null;
                     $temp["strategy"] = $item["strategy"];
                     $temp["amount"] = $item["amount"];
                     $temp["unit_id"] = $item["unit_id"];

+ 2 - 2
app/Http/Controllers/TestController.php

@@ -82,6 +82,7 @@ use App\Services\CacheService;
 use App\Services\CommodityService;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
+use App\Services\common\QueryService;
 use App\Services\DocWaveHeaderService;
 use App\Services\FeatureService;
 use App\Services\InventoryCompareService;
@@ -159,8 +160,7 @@ class TestController extends Controller
 
     public function test()
     {
-        $a = [[1,2,3]];
-        dd(array_unshift($a,["code","name","type"]),$a);
+        dd(50%30);
         return view("test");
     }
     public function handle()

+ 1 - 0
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -82,6 +82,7 @@ class WaybillController extends Controller
                 'recipient'=>$receiveInputting['ConsigneeName']??'',
                 'recipient_mobile'=>$recipient_mobile??'',
                 'source_bill'=>$receiveInputting['ReservedField01']??'',
+                'is_to_pay'=>strstr($receiveInputting['CarrierID']??'','DF')===false ? 0 : 1,
                 'destination_city_id'=>app(RegionService::class)->getCity($receiveInputting['C_City']),
             ]);
             $dflist=config('merchantsInfo.waybill.DFList');

+ 2 - 1
app/Imports/ExpressImport.php

@@ -100,11 +100,12 @@ class ExpressImport implements WithMultipleSheets,ToArray
             }else $item[0] = $map[$province];
             $sign = false;
             for($i=1;$i<count($item);$i++){
-                if (($item[$i] && !is_numeric($item[$i]))||$item[$i]<=0){
+                if (($item[$i] && !is_numeric($item[$i])) || ($item[$i]!==null && $item[$i]<=0)){
                     $this->errors[] = "“".$province."”非法价格";
                     $sign = true;
                     break;
                 }
+                if ($item[$i]===null && $i>3)break;
             }
             if ($sign)continue;
             $result[] = $item;

+ 2 - 0
app/OwnerPriceOperation.php

@@ -23,6 +23,8 @@ class OwnerPriceOperation extends Model
         "operation",        //操作
         "target_id",        //目标ID
         "type_mark",        //类型标记
+        "surcharge",        //附加费
+        "surcharge_unit_id",//附加费单位
     ];
     public static $features = null;
     public static $columnMapping = null;

+ 1 - 0
app/OwnerPriceOperationItem.php

@@ -19,6 +19,7 @@ class OwnerPriceOperationItem extends Model
         "feature",                          //特征
         "priority",                         //优先级 值越大越高
         "discount_price",                   //减免单价
+        "odd_price",                        //零头价
     ];
     public $timestamps=false;
 

+ 38 - 22
app/Services/OwnerPriceOperationService.php

@@ -83,7 +83,7 @@ class OwnerPriceOperationService
             $model->load("items");
             /** @var \stdClass $model */
             foreach ($model->items as $item){
-                $columns = ["strategy","amount","unit_id","unit_price","feature","priority","discount_price"];
+                $columns = ["strategy","amount","unit_id","unit_price","feature","priority","discount_price","odd_price"];
                 if ($items[$item->id] ?? false){
                     foreach ($columns as $column){
                         if (!array_key_exists($column,$items[$item->id]))$items[$item->id][$column] = $item[$column];
@@ -107,6 +107,7 @@ class OwnerPriceOperationService
                 $arr["unit_id"] = $item["unit_id"];
                 $arr["unit_price"] = $item["unit_price"];
                 $arr["feature"] = $item["feature"] ?? null;
+                $arr["odd_price"] = $item["odd_price"] ?? null;
                 $arr["priority"] = $item["priority"] ?? 0;
                 $arr["discount_price"] = isset($item["discount_price"]) ? (is_array($item["discount_price"]) ? implode(",",$item["discount_price"]) : $item["discount_price"]) : null;
                 $insert[] = $arr;
@@ -287,7 +288,7 @@ class OwnerPriceOperationService
      *
      *  2:没有总数量存在,都为子项内数量
      *
-     * @param array|object $matchObject  key-val
+     * @param array|object|Model $matchObject  key-val
      * @param array $columnMapping       key-val
      * @param string $ownerId
      * @param string $type
@@ -307,13 +308,16 @@ class OwnerPriceOperationService
      *      区分单据类型,增加字段
      * 六. 2021-03-23 zzd
      *      不严格区分入库出库差异 统一模型
+     * 七. 2021-03-30 zzd
+     *      增加一级二级特征,零头价,满减按总件,附加费用等
      */
     public function matching($matchObject, $columnMapping, $ownerId, $type = '出库', $typeMark = null)
     {
         $units = app("UnitService")->getUnitMapping(["件","箱"]); //获取单位映射集
         $rules = $this->getOwnerPriceOperation($ownerId,$type,$typeMark);//货主下的全部规则
         if (!$rules)return -2;  //规则不存在跳出
-        $total = app("OrderService")->getOrderQuantity($ownerId);//获取该货主本月C端单量
+        if ($type == '出库') $total = app("OrderService")->getOrderQuantity($ownerId);//获取该货主本月C端单量
+        else $total = app("StoreService")->getStoreAmount($ownerId);//获取该货主本月入库件数
         foreach ($rules as $rule){
             if (!$rule->items)continue; //不存在子规则跳出
 
@@ -323,34 +327,32 @@ class OwnerPriceOperationService
             if ($rule->strategy == '特征'){
                 if (app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject)){
                     if ($rule->total_price)return ["id"=>$rule->id,"money"=>$result ? explode(",",$rule->total_discount_price)[key($result)] : $rule->total_price];//按单计价存在,直接返回单总价或减免总价
-                    $money = $this->matchItem($rule->items,$columnMapping,$matchObject,$units,$ownerId,$result);
+                    $money = $this->matchItem($rule,$columnMapping,$matchObject,$units,$ownerId,$result);
                     if ($money>0)return ["id"=>$rule->id,"money"=>$money];
                 };
             }else{
                 if ($rule->total_price)return ["id"=>$rule->id,"money"=>$result ? explode(",",$rule->total_discount_price)[key($result)] : $rule->total_price]; //按单计价存在,直接返回单总价或减免总价
-                $money = $this->matchItem($rule->items,$columnMapping,$matchObject,$units,$ownerId,$result);
+                $money = $this->matchItem($rule,$columnMapping,$matchObject,$units,$ownerId,$result);
                 if ($money>0)return ["id"=>$rule->id,"money"=>$money];
             };
         }
         return $money ?? -7;
     }
     /**
-     * 根据货主 sku寻找箱规并将指定数量切换为箱
-     *      不满一箱视为一箱
+     * 根据货主 sku寻找箱规并将指定数量切换为箱 返回箱规
      *
-     * @param integer $amount
      * @param integer $ownerId
      * @param null|object $commodity
      *
      * @return int
      */
-    private function changeUnit($amount,$ownerId,$commodity)
+    private function changeUnit($ownerId,$commodity)
     {
         if (!$commodity)return -4;
-        if ($commodity->pack_spec)return ceil($amount/$commodity->pack_spec);
+        if ($commodity->pack_spec)return $commodity->pack_spec;
         $pack = app("CommodityService")->getPack($ownerId,$commodity->sku);
         if (!$pack)return -6;
-        return ceil($amount/$pack);
+        return $pack;
     }
 
     /**
@@ -384,23 +386,28 @@ class OwnerPriceOperationService
     /**
      * 匹配子策略
      *
-     * @param array $rules 策略对象组
+     * @param Model|\stdClass $obj 策略对象
      * @param array $columnMapping 映射对象
-     * @param array $matchObject 被匹配对象
+     * @param Model $matchObject 被匹配对象
      * @param array $units 单位集
      * @param integer $ownerId 货主ID
      * @param bool|array $result 满减信息
      *
      * @return double
      */
-    private function matchItem($rules, $columnMapping, $matchObject, $units, $ownerId, $result)
+    private function matchItem($obj, $columnMapping, $matchObject, $units, $ownerId, $result)
     {
-        /** @var Collection $matchObject */
         $matchObject = $this->resetChildNodeMapping($matchObject->toArray(),$columnMapping);
         if (!$matchObject)return -1;
-
+        $total = 0; //商品总数
+        foreach ($matchObject as $commodity)$total += $commodity[$columnMapping[8]]; //取对象内商品数量总数将其当作子属性插入原对象
+        $surcharge = 0;
         $unitName = "";
-        foreach ($rules as $rule){
+        if ($obj->surcharge_unit_id && $obj->surcharge && isset($units[$rule->surcharge_unit_id])){
+            if ($units[$obj->surcharge_unit_id] == '件')$surcharge += $obj->surcharge*$total;
+            else $surcharge += $obj->surcharge;
+        }//耗材附加费
+        foreach ($obj->items as $rule){
             if ($result)$rule->unit_price = explode(",",$rule->discount_price)[key($result)]; //满足满减条件,单价调整为满减单价
 
             if ($rule->strategy=='起步'){
@@ -410,25 +417,34 @@ class OwnerPriceOperationService
                 if ($startNumber)$matchObject=$this->settingCount($matchObject,$columnMapping[8],$startNumber);
                 if ($matchObject)foreach ($matchObject as $package)$money += $package[$columnMapping[8]] * $package["price"];
                 if (!$startNumber && $money<$rule->unit_price)$money = $rule->unit_price;
-                return $money;
+                return $money+$surcharge;
             }
             foreach ($matchObject as &$package){
                 if ($package["price"] ?? false)continue;
                 if (!isset($units[$rule->unit_id]))return -3;
                 if (!$unitName)$unitName = $units[$rule->unit_id];
                 else if ($unitName != $units[$rule->unit_id]) return -3;
-                if ($rule->strategy=='特征')if (!app("FeatureService")->matchFeature($rule->feature,$columnMapping,$package)) continue;
+                if ($rule->strategy=='特征'){
+                    $package[$columnMapping[10]] = $total; //设置一个不存在的总数进入原对象
+                    if (!app("FeatureService")->matchFeature($rule->feature,$columnMapping,$package)) continue;
+                }
                 $package["price"] = $rule->unit_price;
             }
             if ($units[$rule->unit_id] == '箱'){ //为箱时同步商品寻找箱规
                 $amount = 0;
-                foreach ($matchObject as $commodity)$amount += $this->changeUnit($commodity[$columnMapping[8]],$ownerId,$commodity[$columnMapping[9]]);
+                foreach ($matchObject as $commodity){
+                    $pack = $this->changeUnit($ownerId,$commodity[$columnMapping[9]]);
+                    if ($rule->odd_price){
+                        $amount += floor($amount/$pack);
+                        $surcharge += $rule->odd_price * ($amount%$pack); //零头附加费
+                    }else$amount += ceil($amount/$pack);
+                }
                 if ($amount<0)return $amount;
                 $package[$columnMapping[8]] = $amount;
             }
         }
         if ($matchObject){
-            $money = 0;
+            $money = $surcharge;
             foreach ($matchObject as $package)if ($package["price"])$money += $package[$columnMapping[8]] * $package["price"];
         }
         return $money ?? -7;
@@ -481,7 +497,7 @@ class OwnerPriceOperationService
                 $logistic_fee = 0;
                 if ($logistic_fee!==null && $logistic_fee<0)$logistic_fee = null;
 
-                $money = $this->matchItem($rule->items,Feature::MAPPING["order"],$order,$units,$owner,[$discountIndex=>true]);
+                $money = $this->matchItem($rule,Feature::MAPPING["order"],$order,$units,$owner,[$discountIndex=>true]);
                 if ($money>0)$detail->update(["work_fee"=>$money]);
                 else LogService::log(__CLASS__,"处理历史即时账单时发生匹配错误","账单主键:".$detail->id."; 错误代码".$money);
             };

+ 44 - 1
app/Services/StoreService.php

@@ -17,6 +17,7 @@ use Carbon\Carbon;
 use Illuminate\Support\Facades\Cache;
 
 use App\Traits\ServiceAppAop;
+use Illuminate\Support\Facades\DB;
 
 
 class StoreService
@@ -322,8 +323,11 @@ class StoreService
         /** @var \stdClass $store */
         if (!$store || $store->status != "已入库") return false;
         if (OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->first())return false;
-        $store->loadMissing("storeItems");
+        $store->loadMissing(["storeItems","warehouse"]);
 
+        $amount = 0;
+        if ($store->storeItems)foreach ($store->storeItems as $item)$amount += $item->amount;
+        $this->setStoreAmount($store->owner_id,$amount);
         /** @var OwnerPriceOperationService $service */
         $service = app("OwnerPriceOperationService");
 
@@ -370,4 +374,43 @@ class StoreService
         }
         if (count($insert_param)>0) StoreRejected::query()->insert($insert_param);
     }
+
+    /**
+     * 入库件数丢失补偿逻辑
+     *
+     * @param int $owner
+     */
+    private function storeAmountCompensationLogic($owner)
+    {
+        $query = DB::raw("SELECT sum(amount) total FROM `store_items` WHERE created_at LIKE ?");
+        $statistics = DB::selectOne($query,[$owner,date("Y-m")."%"]);
+        Cache::put(date("Y-m")."|A|".$owner,$statistics->total,2764800);
+    }
+
+    /**
+     * 设置货主下的本月入库件数
+     *
+     * @param int $owner
+     * @param int $amount
+     */
+    public function setStoreAmount($owner, $amount)
+    {
+        $date = date("Y-m");
+        if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);//补偿逻辑
+        Cache::increment($date."|A|".$owner,$amount);
+    }
+
+    /**
+     * 获取货主下的本月入库件数
+     *
+     * @param int $owner
+     *
+     * @return int
+     */
+    public function getStoreAmount($owner)
+    {
+        $date = date("Y-m");
+        if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);
+        return Cache::get($date."|A|".$owner);
+    }
 }

+ 1 - 1
app/Services/common/QueryService.php

@@ -97,7 +97,7 @@ class QueryService
                     $delete[] = $model->id;
                     continue;
                 }
-                if ($model->operation == "U")$delete[] = $model->target_id;
+                if ($model->operation == "U" && $model->target_id)$delete[] = $model->target_id;
                 $update[] = $model->id;
             }
         }else{

+ 2 - 1
app/Waybill.php

@@ -58,7 +58,8 @@ class Waybill extends Model
         'other_charge_remark',
         'deliver_at',
         "district_id",
-        "order_id"
+        "order_id",
+        "is_to_pay" //0否 1是
     ];
 
     public function district()

+ 46 - 0
database/migrations/2021_03_30_135555_change_owner_operation_price_table_add_odd_price_column.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeOwnerOperationPriceTableAddOddPriceColumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_price_operation_items', function (Blueprint $table) {
+            $table->decimal("odd_price")->nullable()->comment("零头价");
+        });
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->decimal("is_to_pay")->default(0)->comment("是否到付");
+        });
+        Schema::table('owner_price_operations', function (Blueprint $table) {
+            $table->decimal("surcharge")->nullable()->comment("附加费");
+            $table->bigInteger("surcharge_unit_id")->nullable()->comment("附加费单位");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_price_operation_items', function (Blueprint $table) {
+            $table->dropColumn("odd_price");
+        });
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->dropColumn("is_to_pay");
+        });
+        Schema::table('owner_price_operations', function (Blueprint $table) {
+            $table->dropColumn("surcharge");
+            $table->dropColumn("surcharge_unit_id");
+        });
+    }
+}

+ 24 - 3
resources/views/customer/project/create.blade.php

@@ -176,7 +176,7 @@
                     discount_type:[
                         "无减免","按单减免","固定减免"
                     ],
-                    feature_type:{!! json_encode(\App\Feature::TYPE,JSON_UNESCAPED_UNICODE) !!},
+                    feature_type:[],
                     logic : ['包含','不包含','等于',"大于","大于等于","小于","小于等于"],
                 },
                 poolMapping:{},//基础数据选择池的映射对象 供展示使用
@@ -721,7 +721,7 @@
                             return;
                         }
                     }
-                    if (this.model.operation.strategy === '特征' && !this.model.operation.feature){
+                    if (!this.model.operation.isRejected && this.model.operation.strategy === '特征' && !this.model.operation.feature){
                         this.$set(this.errors,"feature",["特征未填写"]);
                         return;
                     }
@@ -738,6 +738,14 @@
                             if (i!==0 && !item)this.model.operation.total_discount_price[i] =  this.model.operation.total_discount_price[i-1];
                         })
                     }
+                    if (this.model.operation.surcharge && !this.model.operation.surcharge_unit_id){
+                        this.$set(this.errors,"surcharge_unit_id",["耗材附加费单位未选择"]);
+                        return;
+                    }
+                    if (this.model.operation.surcharge_unit_id && !this.model.operation.surcharge){
+                        this.$set(this.errors,"surcharge_unit_id",["耗材附加费未填写"]);
+                        return;
+                    }
                     if (!this.model.operation.isSingle){
                         for (let i=0;i<this.model.operation.items.length;i++){
                             if (this._verifyOperationItem(i))return;
@@ -786,7 +794,7 @@
                 _verifyOperationItem(itemIndex){//验证作业费子项信息完整
                     let obj = this.model.operation.items[itemIndex];
                     let sign = false;
-                    if (obj.strategy === '特征' && !obj.feature) {
+                    if (!this.model.operation.isRejected && obj.strategy === '特征' && !obj.feature) {
                         this.errors['items.' + itemIndex + '.feature'] = ["必须选择特征"];
                         sign = true;
                     }
@@ -990,6 +998,19 @@
                 },
                 //显示特征选择modal
                 showAddFeatureModal(index){
+                    let types = {!! json_encode(\App\Feature::TYPE,JSON_UNESCAPED_UNICODE) !!};
+                    let typeIn = {!! json_encode(array_keys(\App\Feature::MAPPING['store'])) !!};
+                    let typeOut = {!! json_encode(array_keys(\App\Feature::MAPPING['order'])) !!};
+                    let node = {!! json_encode(\App\Feature::TYPE_NODE) !!};
+                    let temp = [];
+                    if (this.model.operation.operation_type==='入库'){
+                        if (index === -1)typeIn.forEach(t=>{if (types[t] && node.indexOf(t)===-1) temp.push(types[t]);});
+                        else typeIn.forEach(t=>{if (types[t] && node.indexOf(t)!==-1) temp.push(types[t]);});
+                    }else{
+                        if (index === -1)typeOut.forEach(t=>{if (types[t] && node.indexOf(t)===-1) temp.push(types[t]);});
+                        else typeOut.forEach(t=>{if (types[t] && node.indexOf(t)!==-1) temp.push(types[t]);});
+                    }
+                    this.pool.feature_type = temp;
                     if (index === -1){
                         if (!this.model.operation.feature){
                             this.model.operation.features = this._createFeature();

+ 1 - 4
resources/views/customer/project/part/_addFeature.blade.php

@@ -25,10 +25,7 @@
                         </label>
                         <label class="col-2">
                             <select class="form-control form-control-sm" v-model="feature.type">
-                                <option v-for="t in pool.feature_type" :value="t"
-                                        v-if="((thisOperationItemIndex===-1 && (t!=='商品名称' && t!=='长' && t!=='商品备注')) || (thisOperationItemIndex!==-1
-                                        && (t=='商品名称' || t=='长' || t=='商品备注'))) && ((model.operation.operation_type=='入库' && t!=='波次类型') || model.operation.operation_type=='出库')">
-                                    @{{ t }}</option>
+                                <option v-for="t in pool.feature_type" :value="t">@{{ t }}</option>
                             </select>
                         </label>
                         <label class="col-2">

+ 13 - 1
resources/views/customer/project/part/_operation.blade.php

@@ -120,9 +120,13 @@
             </div>
             <div class="row mt-2" v-if="item.strategy!='起步' || (item.strategy=='起步' && item.type==0)">
                 <label class="col-3">单位</label>
-                <label class="col-6 mb-0"><select v-model="item.unit_id" class="form-control" :class="errors['items.'+i+'.unit_id'] ? 'is-invalid' : ''">
+                <label class="col-3 mb-0"><select v-model="item.unit_id" class="form-control" :class="errors['items.'+i+'.unit_id'] ? 'is-invalid' : ''">
                     <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='箱'">@{{ unit.name }}</option>
                 </select></label>
+                <label class="col-2 text-right" v-if="model.operation.operation_type=='出库' && poolMapping.units[item.unit_id]=='箱'">零头价</label>
+                <label class="col-3 mb-0" v-if="model.operation.operation_type=='出库' && poolMapping.units[item.unit_id]=='箱'">
+                    <input class="form-control" :class="errors['items.'+i+'.odd_price'] ? 'is-invalid' : ''" v-model="item.odd_price" type="number" step="0.01" min="0">
+                </label>
             </div>
             <div class="row mt-0" v-if="errors['items.'+i+'.unit_id']">
                 <div class="offset-3"><small class="text-danger font-weight-bold ml-3">单位为必选项</small></div>
@@ -162,6 +166,14 @@
         </div>
     </div>
 </div>
+<div class="row mt-3" v-if="model.operation.operation_type=='出库'">
+    <label for="surcharge" class="col-2">耗材附加费</label>
+    <input id="surcharge" type="number" step="0.01" min="0" class="form-control col-3" :class="errors.surcharge ? 'is-invalid' : ''" v-model="model.operation.surcharge">
+    <label for="surcharge_unit_id" class="col-2 text-right">单位</label>
+    <select id="surcharge_unit_id" v-model="model.operation.surcharge_unit_id" class="form-control col-2" :class="errors.surcharge_unit_id ? 'is-invalid' : ''">
+            <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='单'">@{{ unit.name }}</option>
+    </select>
+</div>
 <div class="row mt-3">
     <label for="remark" class="col-2">备注</label>
     <textarea id="remark" class="col-6 form-control" v-model="model.operation.remark"></textarea>

+ 3 - 0
resources/views/customer/project/part/_three.blade.php

@@ -75,6 +75,7 @@
                                     </label>
                                     <label>@{{ operation.name }}</label><span class="badge badge-pill badge-danger" v-if="operation.isRejected">退</span>
                                     <label v-if="operation.remark" class="text-secondary">&nbsp;&nbsp;(@{{ operation.remark }})</label>
+                                    <label v-if="operation.surcharge">耗材附加费:<b>@{{ operation.surcharge }}</b>/@{{ poolMapping.units ? poolMapping.units[operation.surcharge_unit_id] : '' }}</label>
                                 </div>
                                 <div class="col-1">
                                     <span class="cursor-pointer text-danger font-weight-bold"
@@ -121,6 +122,7 @@
                                     </label>
                                     <label>@{{ operation.name }}</label>
                                     <label v-if="operation.remark" class="text-secondary">&nbsp;&nbsp;(@{{ operation.remark }})</label>
+                                    <label v-if="operation.surcharge">耗材附加费:<b>@{{ operation.surcharge }}</b>/@{{ poolMapping.units ? poolMapping.units[operation.surcharge_unit_id] : '' }}</label>
                                 </div>
                                 <div class="col-1">
                                     <span class="cursor-pointer text-danger font-weight-bold"
@@ -143,6 +145,7 @@
                                         <div class="col-10">
                                             <label>@{{ item.strategy }}<span v-if="item.strategy!='起步'">续费</span></label>:
                                             <span v-if="item.amount > 0"><b>@{{ item.amount }}</b>&nbsp;@{{ poolMapping.units ? poolMapping.units[item.unit_id] : '' }} /</span><b>&nbsp;@{{ item.unit_price }}</b>元
+                                            <span class="badge badge-secondary" v-if="item.odd_price">零头价:@{{ item.odd_price }}元</span>
                                             <span v-if="operation.isDiscount">&nbsp;(满减单价:
                                                 <span v-for="(value,k) in item.discount_price">
                                                     <span v-if="k!=0">,</span>

+ 2 - 1
resources/views/waybill/index.blade.php

@@ -124,7 +124,7 @@
                             </table>
                         </div>
                     </td>
-                    <td class="td-warm">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="waybill.collect_fee && waybill.collect_fee>0">到付</span></td>
+                    <td class="td-warm">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="(waybill.collect_fee && waybill.collect_fee>0) || waybill.is_to_pay">到付</span></td>
                     <td class="td-warm">@{{waybill.owner}}</td>
                     <td class="td-warm toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
                     <td class="td-warm">
@@ -352,6 +352,7 @@
                         city:'{{$waybill->order_city ?? ($waybill->destinationCity->name ?? '')}}',
                         district:'{{$waybill->order_district ?? ($waybill->district->name ?? '')}}',
                         order_status:'{{$waybill->order->wms_status ?? ''}}',
+                        is_to_pay:'{{ $waybill->is_to_pay }}',
                     },
                     @endforeach
                 ],