|
|
@@ -26,17 +26,16 @@ class ImportList extends Backend
|
|
|
use Actions {
|
|
|
index as private _index;
|
|
|
del as private _del;
|
|
|
-
|
|
|
}
|
|
|
- private $typeList=null;
|
|
|
- private $tabValue=null;
|
|
|
-
|
|
|
+ private $typeList = null;
|
|
|
+ private $tabValue = null;
|
|
|
+
|
|
|
protected function _initialize()
|
|
|
{
|
|
|
parent::_initialize();
|
|
|
$this->model = new ImportListModel();
|
|
|
- $this->typeList=StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title', 'id');
|
|
|
- $this->tabValue=array_keys($this->typeList)[0]?? null;
|
|
|
+ $this->typeList = StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title', 'id');
|
|
|
+ $this->tabValue = array_keys($this->typeList)[0] ?? null;
|
|
|
// $this->assign('shopList', ShopList::where('status', 1)->column('name', 'id'));
|
|
|
$this->assign('typeList', $this->typeList);
|
|
|
$this->assign('packingList', StockConfig::where('type_id', 'packing_box')->column('title', 'id'));
|
|
|
@@ -102,7 +101,15 @@ class ImportList extends Backend
|
|
|
|
|
|
return $item;
|
|
|
});
|
|
|
- $result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
|
+
|
|
|
+ $shops_num = $this->model
|
|
|
+ ->where('status', 1)
|
|
|
+ ->sum('status');
|
|
|
+ $specs_num = $this->model
|
|
|
+ ->where('status', 2)
|
|
|
+ ->sum('status');
|
|
|
+
|
|
|
+ $result = ['total' => $list->total(), 'rows' => $list->items(), 'shops_num' => $shops_num, 'specs_num' => $specs_num];
|
|
|
return json($result);
|
|
|
}
|
|
|
|
|
|
@@ -193,20 +200,20 @@ class ImportList extends Backend
|
|
|
$shopListModel = new ShopListModel();
|
|
|
|
|
|
$rows = $shopListModel::where('shop_id', $shop_id)->where('status', 1)->find();
|
|
|
-
|
|
|
+
|
|
|
//修改规格
|
|
|
$importSku = new ImportSku();
|
|
|
$sql_data = $importSku->where(['shop_id' => $row['shop_id'], 'sku_id' => $row['sku_id']])->find();
|
|
|
- $spec_id=0;
|
|
|
- if(!empty($sql_data)){
|
|
|
- $this->tabValue=$sql_data['variety_id'];
|
|
|
- $spec_id=$sql_data['spec_id'];
|
|
|
+ $spec_id = 0;
|
|
|
+ if (!empty($sql_data)) {
|
|
|
+ $this->tabValue = $sql_data['variety_id'];
|
|
|
+ $spec_id = $sql_data['spec_id'];
|
|
|
}
|
|
|
- $this->assign('tabValue',$this->tabValue.'');
|
|
|
- $this->assign('spec_id',$spec_id);
|
|
|
+ $this->assign('tabValue', $this->tabValue . '');
|
|
|
+ $this->assign('spec_id', $spec_id);
|
|
|
$this->assign('rows', $rows->type_spec ?? '');
|
|
|
$this->assign('row', $row);
|
|
|
-
|
|
|
+
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
$params = $this->request->post("");
|
|
|
@@ -222,13 +229,13 @@ class ImportList extends Backend
|
|
|
$productConfig = new ProductConfig();
|
|
|
$shopDelivery = new ShopDelivery();
|
|
|
$customerSpec = new CustomerSpec();
|
|
|
-
|
|
|
+
|
|
|
$shopDelivery_list = [];
|
|
|
$import_list = [];
|
|
|
|
|
|
- $shopDelivery_updata_list=[];
|
|
|
+ $shopDelivery_updata_list = [];
|
|
|
$todayStart = date('Y-m-d', $time);
|
|
|
- $todayStart=$todayStart.' 00:00:00';
|
|
|
+ $todayStart = $todayStart . ' 00:00:00';
|
|
|
switch ($status) {
|
|
|
case 2:
|
|
|
//插入规格
|
|
|
@@ -279,18 +286,18 @@ class ImportList extends Backend
|
|
|
]);
|
|
|
if (!$result) $this->error(__('没有数据被更新'));
|
|
|
//查看有多少规格
|
|
|
- $where=[];
|
|
|
+ $where = [];
|
|
|
$where[] = ['shop_id', '=', $row['shop_id']];
|
|
|
$where[] = ['sku_id', '=', $row['sku_id']];
|
|
|
- $where[] = ['consign_time','>=',$todayStart];
|
|
|
+ $where[] = ['consign_time', '>=', $todayStart];
|
|
|
|
|
|
- $whereOr=[];
|
|
|
+ $whereOr = [];
|
|
|
$whereOr[] = ['shop_id', '=', $row['shop_id']];
|
|
|
$whereOr[] = ['sku_id', '=', $row['sku_id']];
|
|
|
- $whereOr[] = ['status','=',2];
|
|
|
+ $whereOr[] = ['status', '=', 2];
|
|
|
|
|
|
$list = $this->model::where($where)->whereOr($whereOr)->select();
|
|
|
-
|
|
|
+
|
|
|
foreach ($list as $item) {
|
|
|
//插入发货数据
|
|
|
$res = JuShuiTanService::setAdditionalPrice(
|
|
|
@@ -307,19 +314,18 @@ class ImportList extends Backend
|
|
|
$item
|
|
|
);
|
|
|
$getPackSpecsFee = $res['getPackSpecsFee'];
|
|
|
-
|
|
|
|
|
|
- if($item['status']==2){
|
|
|
+
|
|
|
+ if ($item['status'] == 2) {
|
|
|
$shopDelivery_list[] = $res['shopDelivery'];
|
|
|
- }else if($item['status']==3){
|
|
|
- $waybill_no=$res['shopDelivery']['waybill_no'];
|
|
|
- $shopDelivery_id=JuShuiTanService::get_shopDelivery_id($waybill_no);
|
|
|
- if($shopDelivery_id>0){
|
|
|
- $res['shopDelivery']['id']=$shopDelivery_id;
|
|
|
- $res['shopDelivery']['updatetime']=$time;
|
|
|
- $shopDelivery_updata_list[]=$res['shopDelivery'];
|
|
|
+ } else if ($item['status'] == 3) {
|
|
|
+ $waybill_no = $res['shopDelivery']['waybill_no'];
|
|
|
+ $shopDelivery_id = JuShuiTanService::get_shopDelivery_id($waybill_no);
|
|
|
+ if ($shopDelivery_id > 0) {
|
|
|
+ $res['shopDelivery']['id'] = $shopDelivery_id;
|
|
|
+ $res['shopDelivery']['updatetime'] = $time;
|
|
|
+ $shopDelivery_updata_list[] = $res['shopDelivery'];
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
$import_list_item = [
|
|
|
@@ -330,14 +336,14 @@ class ImportList extends Backend
|
|
|
'two_surcharge_money' => $getPackSpecsFee['two_surcharge_money'],
|
|
|
'status' => 3
|
|
|
];
|
|
|
-
|
|
|
+
|
|
|
$import_list[] = $import_list_item;
|
|
|
$count++;
|
|
|
}
|
|
|
$this->model->saveAll($import_list);
|
|
|
$shopDelivery->saveAll($shopDelivery_list);
|
|
|
$shopDelivery->saveAll($shopDelivery_updata_list);
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
default:
|
|
|
# code...
|