From 956e673f25930f85f33fc14849c01be1faf2518e Mon Sep 17 00:00:00 2001 From: denghy Date: Tue, 16 Apr 2019 11:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E5=85=AC=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Dicts.php | 1 + .../Real/Commands/Sync/AddedOrderSync.php | 6 ++ .../Real/Http/Controllers/OrderController.php | 2 + app/Domains/Real/Services/OrderService.php | 5 +- ...10601_add_business_type_to_real_orders.php | 32 +++++++ frontend/src/views/layout/index.vue | 22 ++--- frontend/src/views/virtual/orders/cards.vue | 85 ++++++++++--------- frontend/src/views/virtual/orders/js/cards.js | 48 ++++++++++- frontend/src/views/virtual/orders/js/edit.js | 4 +- public/css/chunk-2cc41ab2.bcb99373.css | 2 + public/js/app.aa6d2b39.js | 1 + public/js/chunk-2cc41ab2.617b73d2.js | 14 +++ resources/views/index.blade.php | 2 +- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + 15 files changed, 167 insertions(+), 59 deletions(-) create mode 100644 database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php create mode 100644 public/css/chunk-2cc41ab2.bcb99373.css create mode 100644 public/js/app.aa6d2b39.js create mode 100644 public/js/chunk-2cc41ab2.617b73d2.js diff --git a/app/Dicts.php b/app/Dicts.php index 7af6f0cd..1240a55c 100644 --- a/app/Dicts.php +++ b/app/Dicts.php @@ -30,6 +30,7 @@ class Dicts extends Repository 'logistics' => ['sf' => '顺丰速运', 'sto' => '申通快递','yto' => '圆通速递', 'zto' => '中通快递', 'best' => '百世快递', 'yunda' => '韵达快递', 'ttkd'=> '天天快递', 'ems' => 'EMS邮政特快专递'], 'export_status' => ['准备中', '写入中', '保存中', '已完成', '导出失败', '文件丢失'], 'shares' => ['未知', '纵向共享', '横向共享'], + 'business_type' => ['对私', '对公'], ]; public function __construct() diff --git a/app/Domains/Real/Commands/Sync/AddedOrderSync.php b/app/Domains/Real/Commands/Sync/AddedOrderSync.php index 90bc5a7e..99f7c25d 100644 --- a/app/Domains/Real/Commands/Sync/AddedOrderSync.php +++ b/app/Domains/Real/Commands/Sync/AddedOrderSync.php @@ -20,6 +20,8 @@ class AddedOrderSync extends Command protected $chunks = 1000; + protected $business_type = ['3875569' => 0, '9632627' => 1]; + protected $types; protected $tables = [ @@ -123,6 +125,7 @@ class AddedOrderSync extends Command $select = [ 'sn', + 'account_no', 'status', 'custom_no as company_id', 'transaction_no', @@ -133,6 +136,7 @@ class AddedOrderSync extends Command $orders = DB::connection('real')->table('jxc_custom_order')->select($select)->whereIn('status', [3, 7, 8]) ->whereIn('custom_no', $this->companies->keys()) + ->whereIn('account_no', array_keys($this->business_type)) ->where('create_time', '>=', $starttime->timestamp) ->where('create_time', '<=', $endtime->timestamp) ->orderBy('create_time')->get()->collect()->toArray(); @@ -140,12 +144,14 @@ class AddedOrderSync extends Command $array = []; foreach ($orders as $item) { + $item['business_type'] = $this->business_type[$item['account_no']]; $item['company_id'] = $this->companies[$item['company_id']]['id'] ?? 0; $item['pay_channel'] = CommonService::transformerPayChannel($item['pay_channel']); $item['order_at'] = date('Y-m-d H:i:s', $item['order_at']); $item['created_at'] = $item['order_at']; $item['updated_at'] = ($item['updated_at'] == '0000-00-00 00:00:00') ? $item['order_at'] : $item['updated_at']; $item['deleted_at'] = $item['status'] === 3 ? null : $item['updated_at']; + unset($item['account_no']); unset($item['status']); $array[] = $item; } diff --git a/app/Domains/Real/Http/Controllers/OrderController.php b/app/Domains/Real/Http/Controllers/OrderController.php index 45af773a..6dae1cb1 100644 --- a/app/Domains/Real/Http/Controllers/OrderController.php +++ b/app/Domains/Real/Http/Controllers/OrderController.php @@ -40,6 +40,8 @@ class OrderController extends Controller return $item->only([ 'id', 'sn', + 'business_type', + 'business_type_name', 'company_id', 'package_id', 'carrier_operator', diff --git a/app/Domains/Real/Services/OrderService.php b/app/Domains/Real/Services/OrderService.php index 41c4629e..01b5cb02 100644 --- a/app/Domains/Real/Services/OrderService.php +++ b/app/Domains/Real/Services/OrderService.php @@ -39,6 +39,7 @@ class OrderService extends Service $limit = $conditions['limit'] ?? 10; $carrierOperators = app(Dicts::class)->get('carrier_operator'); + $businessTypes = app(Dicts::class)->get('business_type'); $res = $this->orderRepository->withConditions($conditions)->applyConditions()->paginate($limit); @@ -52,7 +53,8 @@ class OrderService extends Service ->groupBy('order_id')->get()->keyBy('order_id')->toArray(); } - $res->map(function ($item) use ($carrierOperators, $cards) { + $res->map(function ($item) use ($carrierOperators, $businessTypes, $cards) { + $item->business_type_name = $businessTypes[$item->business_type] ?? ''; $item->pay_channel_name = CommonService::namePayChannel($item->pay_channel); $item->company_name = CommonService::company($item->company_id)['name']; $item->package = CommonService::package($item->package_id); @@ -121,6 +123,7 @@ class OrderService extends Service $item['company_name'] = !$item['company_id'] ? '' : $companyService->load($item['company_id'])['name'] ?? ''; $item['package_name'] = !$item['package_id'] ? '' : $packageService->load($item['package_id'])['name'] ?? ''; + $item['package_sn'] = !$item['package_id'] ? '' : $packageService->load($item['package_id'])['sn'] ?? ''; } return array_values(array_sort($cards, function ($value) { diff --git a/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php b/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php new file mode 100644 index 00000000..b64c37f1 --- /dev/null +++ b/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php @@ -0,0 +1,32 @@ +tinyInteger('business_type')->unsigned()->default(0)->comment('业务类型(0:对私 1:对公)')->after('type'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('real_orders', function (Blueprint $table) { + $table->dropColumn('business_type'); + }); + } +} diff --git a/frontend/src/views/layout/index.vue b/frontend/src/views/layout/index.vue index 69d07381..515923c1 100644 --- a/frontend/src/views/layout/index.vue +++ b/frontend/src/views/layout/index.vue @@ -5,8 +5,8 @@
\ No newline at end of file +
\ No newline at end of file diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 21f3e073..7bffec67 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'AccountSeeder' => $baseDir . '/database/seeds/AccountSeeder.php', + 'AddBusinessTypeToRealOrders' => $baseDir . '/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php', 'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php', 'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php', 'CompanyAccountSeeder' => $baseDir . '/database/seeds/CompanyAccountSeeder.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index b0b9825c..982dcc18 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -726,6 +726,7 @@ class ComposerStaticInite79258a3e34ad3e251999111d9f334d9 public static $classMap = array ( 'AccountSeeder' => __DIR__ . '/../..' . '/database/seeds/AccountSeeder.php', + 'AddBusinessTypeToRealOrders' => __DIR__ . '/../..' . '/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php', 'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php', 'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php', 'CompanyAccountSeeder' => __DIR__ . '/../..' . '/database/seeds/CompanyAccountSeeder.php',