导入模板
This commit is contained in:
parent
0cb9e3d513
commit
e81521e899
@ -31,6 +31,7 @@ class AddedOrderSync extends Command
|
|||||||
'real_order_flows_package_cards',
|
'real_order_flows_package_cards',
|
||||||
'real_order_optional_package_cards',
|
'real_order_optional_package_cards',
|
||||||
'real_order_additional_package_cards',
|
'real_order_additional_package_cards',
|
||||||
|
'real_order_group_package_cards',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
@ -88,25 +89,31 @@ class AddedOrderSync extends Command
|
|||||||
|
|
||||||
$virtualTable = str_replace('real_', 'virtual_', $table);
|
$virtualTable = str_replace('real_', 'virtual_', $table);
|
||||||
|
|
||||||
if (!in_array($virtualTable, ['virtual_order_optional_package_cards', 'virtual_order_additional_package_cards'])) {
|
if (in_array($virtualTable, ['virtual_order_optional_package_cards', 'virtual_order_additional_package_cards'])) {
|
||||||
$starttime = $this->datetime->copy()->startOfMonth()->startOfDay();
|
$virtualTable = 'virtual_order_flows_package_cards';
|
||||||
$endtime = $this->datetime->copy()->endOfMonth()->endOfDay();
|
}
|
||||||
|
|
||||||
$orders = DB::table($virtualTable)->selectRaw('sim, order_id')
|
if (in_array($virtualTable, ['virtual_order_group_package_cards'])) {
|
||||||
->where('created_at', '>=', $starttime->format('Y-m-d H:i:s'))
|
$virtualTable = 'virtual_order_renewal_cards';
|
||||||
->where('created_at', '<=', $endtime->format('Y-m-d H:i:s'))
|
}
|
||||||
->whereIn('sim', array_pluck($data, 'sim'))
|
|
||||||
->whereNull('deleted_at')
|
|
||||||
->orderBy('created_at')
|
|
||||||
->get()
|
|
||||||
->collect()
|
|
||||||
->groupBy('sim')->toArray();
|
|
||||||
|
|
||||||
foreach ($data as &$value) {
|
$starttime = $this->datetime->copy()->startOfMonth()->startOfDay();
|
||||||
$i = array_count_values($simArray)[$value['sim']] ?? 0;
|
$endtime = $this->datetime->copy()->endOfMonth()->endOfDay();
|
||||||
array_push($simArray, $value['sim']);
|
|
||||||
$value['virtual_order_id'] = $orders[$value['sim']][$i]['order_id'] ?? 0;
|
$orders = DB::table($virtualTable)->selectRaw('sim, order_id')
|
||||||
}
|
->where('created_at', '>=', $starttime->format('Y-m-d H:i:s'))
|
||||||
|
->where('created_at', '<=', $endtime->format('Y-m-d H:i:s'))
|
||||||
|
->whereIn('sim', array_pluck($data, 'sim'))
|
||||||
|
->whereNull('deleted_at')
|
||||||
|
->orderBy('created_at')
|
||||||
|
->get()
|
||||||
|
->collect()
|
||||||
|
->groupBy('sim')->toArray();
|
||||||
|
|
||||||
|
foreach ($data as &$value) {
|
||||||
|
$i = array_count_values($simArray)[$value['sim']] ?? 0;
|
||||||
|
array_push($simArray, $value['sim']);
|
||||||
|
$value['virtual_order_id'] = $orders[$value['sim']][$i]['order_id'] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MongoCardJob::dispatch(array_pluck($data, 'sim'));
|
MongoCardJob::dispatch(array_pluck($data, 'sim'));
|
||||||
@ -184,7 +191,7 @@ class AddedOrderSync extends Command
|
|||||||
];
|
];
|
||||||
|
|
||||||
$cards = DB::connection('real')->table('jxc_custom_order_item')->select($select)
|
$cards = DB::connection('real')->table('jxc_custom_order_item')->select($select)
|
||||||
->whereIn('sn', array_keys($orders))->where('goods_type', '<', 6)->get()->collect()->toArray();
|
->whereIn('sn', array_keys($orders))->where('goods_type', '<=', 6)->get()->collect()->toArray();
|
||||||
|
|
||||||
$array = [];
|
$array = [];
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class PackageSync extends Command
|
|||||||
$flowPackages = $this->getFlowPackages();
|
$flowPackages = $this->getFlowPackages();
|
||||||
$optionalPackages = $this->getOptionalPackages();
|
$optionalPackages = $this->getOptionalPackages();
|
||||||
$additionalPackages = $this->getAdditionalPackages();
|
$additionalPackages = $this->getAdditionalPackages();
|
||||||
$groupPackages = $this->getGroupPackages();
|
$groupPackages = $this->getGroupPackages($basePackages);
|
||||||
|
|
||||||
$packages = array_merge($renewalPackages, $flowPackages, $optionalPackages, $additionalPackages, $groupPackages);
|
$packages = array_merge($renewalPackages, $flowPackages, $optionalPackages, $additionalPackages, $groupPackages);
|
||||||
|
|
||||||
@ -206,28 +206,45 @@ class PackageSync extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 组合包
|
// 组合包
|
||||||
protected function getGroupPackages()
|
protected function getGroupPackages($basePackages)
|
||||||
{
|
{
|
||||||
|
$basePackages = array_keyBy($basePackages, 'sn');
|
||||||
|
|
||||||
$select = [
|
$select = [
|
||||||
DB::raw('6 as type'),
|
DB::raw('6 as type'),
|
||||||
'jxc_package_addoptional.bag_number as sn',
|
'jxc_package_group.sn as sn',
|
||||||
'jxc_package_addoptional.name as name',
|
'jxc_package_group.name as name',
|
||||||
DB::raw('"qw" as carrier_operator'),
|
'jxc_package_group_item.package_sn as parent_sn',
|
||||||
DB::raw('0 as cost_price'),
|
'jxc_package_group.price as cost_price',
|
||||||
'jxc_package_addoptional.guide_price as guide_price',
|
'jxc_package_group.price as guide_price',
|
||||||
DB::raw('0 as flows'),
|
'jxc_package_group.createtime as created_at',
|
||||||
'jxc_package_addoptional.content_count as messages',
|
'jxc_package_group.del',
|
||||||
'jxc_package_addoptional.reset_cycle as reset_months',
|
|
||||||
'jxc_package_addoptional.service_cycle as service_months',
|
|
||||||
'jxc_package_addoptional.create_time as created_at',
|
|
||||||
'jxc_package_addoptional.del',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$packages = DB::connection('real')->table('jxc_package_addoptional')->join('jxc_package_value_add_relation', function ($join) {
|
$packages = DB::connection('real')->table('jxc_package_group')->join('jxc_package_group_item', function ($join) {
|
||||||
$join->on('jxc_package_value_add_relation.value_add_number', '=', 'jxc_package_addoptional.bag_number')
|
$join->on('jxc_package_group_item.sn', '=', 'jxc_package_group.sn')
|
||||||
->whereIn('jxc_package_value_add_relation.custom_no', $this->companies)
|
->where('jxc_package_group_item.type', 1);
|
||||||
->where('jxc_package_value_add_relation.type', 4);
|
})->select($select)->get();
|
||||||
})->select($select)->where('jxc_package_addoptional.tid', 1)->get();
|
|
||||||
|
$packages->map(function ($item, $index) use ($basePackages, &$packages) {
|
||||||
|
$basePackage = $basePackages[$item->parent_sn];
|
||||||
|
|
||||||
|
if (!$basePackage) {
|
||||||
|
unset($packages[$index]);
|
||||||
|
return;
|
||||||
|
throw new InvalidArgumentException('组合包未找到对应基础套餐 #:'.$item->sn);
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->parent_id = $basePackage['id'];
|
||||||
|
$item->carrier_operator = array_flip(self::$carrier_operator)[$basePackage['carrier_operator']] ?? 'qw';
|
||||||
|
$item->flows = $basePackage['flows'];
|
||||||
|
$item->voices = $basePackage['voices'];
|
||||||
|
$item->messages = $basePackage['messages'];
|
||||||
|
$item->has_messages = $basePackage['has_messages'];
|
||||||
|
$item->has_lbs = $basePackage['has_lbs'];
|
||||||
|
$item->reset_months = $basePackage['reset_months'];
|
||||||
|
$item->service_months = $basePackage['service_months'];
|
||||||
|
});
|
||||||
|
|
||||||
return $this->transform($packages);
|
return $this->transform($packages);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ class OrderController extends Controller
|
|||||||
$orders->transform(function ($item) {
|
$orders->transform(function ($item) {
|
||||||
return $item->only([
|
return $item->only([
|
||||||
'id',
|
'id',
|
||||||
|
'type',
|
||||||
'sn',
|
'sn',
|
||||||
'business_type',
|
'business_type',
|
||||||
'business_type_name',
|
'business_type_name',
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
namespace App\Domains\Virtual\Services;
|
namespace App\Domains\Virtual\Services;
|
||||||
|
|
||||||
use App\Dicts;
|
use App\Dicts;
|
||||||
|
use Carbon\Carbon;
|
||||||
use App\Core\Service;
|
use App\Core\Service;
|
||||||
use App\Models\Card\Card;
|
use App\Models\Card\Card;
|
||||||
use App\Models\Virtual\Order;
|
use App\Models\Virtual\Order;
|
||||||
@ -183,45 +184,6 @@ class OrderService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 改企业的卡新增一批虚拟卡,并替换原有订单里的卡
|
|
||||||
if (isset($attributes['sign']) && $attributes['sign'] == 2) {
|
|
||||||
$simArray = implode(',', array_pluck($attributes['selected'], 'sim'));
|
|
||||||
try {
|
|
||||||
DB::statement("select change_cards('{{$simArray}}'::INT8[]);");
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
throw $th;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转销售和改企业的都立即激活卡
|
|
||||||
if (isset($attributes['sign']) && in_array($attributes['sign'], [1, 2])) {
|
|
||||||
$array = array_map(function ($item) use ($attributes) {
|
|
||||||
return ['sim' => $item['sim'], 'virtual_activated_at' => $attributes['order_at']];
|
|
||||||
}, $attributes['selected']);
|
|
||||||
|
|
||||||
Card::upsert($array, 'sim', ['virtual_activated_at']);
|
|
||||||
|
|
||||||
$attributes['type'] = 0;
|
|
||||||
$originType = $attributes['type'];
|
|
||||||
|
|
||||||
// 销售订单,如果单卡使用多次,仅第一次为销售,其他改续费。
|
|
||||||
$extras = [];
|
|
||||||
$selected = $attributes['selected'];
|
|
||||||
$attributes['counts'] = count($selected);
|
|
||||||
|
|
||||||
foreach ($selected as &$card) {
|
|
||||||
if ($card['counts'] > 1) {
|
|
||||||
array_push($extras, [
|
|
||||||
'sim' => $card['sim'],
|
|
||||||
'counts' => $card['counts'] - 1,
|
|
||||||
]);
|
|
||||||
$card['counts'] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$attributes['selected'] = $selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($attributes['id']) {
|
if ($attributes['id']) {
|
||||||
if (!$node = $this->orderRepository->find($attributes['id'])) {
|
if (!$node = $this->orderRepository->find($attributes['id'])) {
|
||||||
throw new NotExistException('订单不存在或已删除');
|
throw new NotExistException('订单不存在或已删除');
|
||||||
@ -265,36 +227,148 @@ class OrderService extends Service
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$maxId = Order::withTrashed()->max('id');
|
|
||||||
$attributes['id'] = ++$maxId;
|
|
||||||
|
|
||||||
if ($product->company_id != $attributes['company_id']) {
|
if ($product->company_id != $attributes['company_id']) {
|
||||||
throw new NotAllowedException('非法操作');
|
throw new NotAllowedException('非法操作');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$maxId = Order::withTrashed()->max('id');
|
||||||
|
|
||||||
if (isset($attributes['selected']) && count($attributes['selected']) === $attributes['counts']) {
|
if ($attributes['type'] !== 0) {
|
||||||
$attributes['order_status'] = 5;
|
$simArray = array_unique(array_pluck($attributes['selected'], 'sim'));
|
||||||
$attributes['transaction_status'] = 1;
|
$simCompany = $this->orderCardPartitionRepository->select(['sim', 'company_id'])
|
||||||
|
->where('type', 0)->whereIn('sim', $simArray)
|
||||||
|
->get()->pluck('company_id', 'sim')->toArray();
|
||||||
|
|
||||||
|
$news = [];
|
||||||
|
$extras = [];
|
||||||
|
|
||||||
|
foreach ($simArray as $value) {
|
||||||
|
if (!in_array($value, array_keys($simCompany))) {
|
||||||
|
array_push($news, $value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($simCompany[$value] !== $attributes['company_id']) {
|
||||||
|
array_push($extras, $value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($news)) {
|
||||||
|
// 按订单时间激活
|
||||||
|
$array = array_map(function ($item) use ($newOrderData) {
|
||||||
|
return ['sim' => $item, 'virtual_activated_at' => $newOrderData['order_at']];
|
||||||
|
}, $news);
|
||||||
|
|
||||||
|
Card::upsert($array, 'sim', ['virtual_activated_at']);
|
||||||
|
|
||||||
|
// 创建订单
|
||||||
|
$newOrderData = array_except($attributes, ['selected', 'sign']);
|
||||||
|
$newOrderData['id'] = ++$maxId;
|
||||||
|
$newOrderData['sn'] = $this->generateSn();
|
||||||
|
$newOrderData['type'] = 0;
|
||||||
|
$newOrderData['order_status'] = 5;
|
||||||
|
$newOrderData['transaction_status'] = 1;
|
||||||
|
$newOrderData['counts'] = count($news);
|
||||||
|
$newOrderData['total_price'] = $attributes['unit_price'] * count($news);
|
||||||
|
$newOrderData['custom_price'] = $attributes['unit_price'] * count($news);
|
||||||
|
$newOrderData['order_at'] = $attributes['order_at'] ?? date('Y-m-d H:i:s');
|
||||||
|
$newOrderData['package_id'] = $attributes['package_id'] ?? $product->package_id;
|
||||||
|
|
||||||
|
$newOrder = $this->orderRepository->create($newOrderData);
|
||||||
|
|
||||||
|
// 创建订单卡关联
|
||||||
|
$this->upsertOrderCards(array_map(function ($item) {
|
||||||
|
return ['sim' => $item, 'counts' => 1];
|
||||||
|
}, $news), $newOrder);
|
||||||
|
|
||||||
|
// 剩下需要续费的卡
|
||||||
|
$selected = $attributes['selected'];
|
||||||
|
$selectedNews = [];
|
||||||
|
|
||||||
|
foreach ($selected as $key => $item) {
|
||||||
|
if (isset($selectedNews[$item['sim']])) {
|
||||||
|
$selectedNews[$item['sim']]['counts'] += $item['counts'];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($item['sim'], $news)) {
|
||||||
|
$counts = $item['counts'] - 1;
|
||||||
|
$selectedNews[$item['sim']] = [
|
||||||
|
'sim' => $item['sim'],
|
||||||
|
'counts' => $counts
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectedNews[$item['sim']] = [
|
||||||
|
'sim' => $item['sim'],
|
||||||
|
'counts' => $item['counts'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectedNews = array_filter($selectedNews, function ($item) {
|
||||||
|
return $item['counts'] > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
$attributes['counts'] = array_sum(array_pluck($selectedNews, 'counts'));
|
||||||
|
$attributes['selected'] = array_values($selectedNews);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($extras)) {
|
||||||
|
$attributes['package_id'] = $attributes['package_id'] ?? $product->package_id;
|
||||||
|
|
||||||
|
$having = "MAX(service_end_at) < '%s'";
|
||||||
|
$having = sprintf($having, Carbon::now()->subMonths(6)->endOfMonth());
|
||||||
|
|
||||||
|
$replacement = $this->orderCardPartitionRepository->select(['sim'])
|
||||||
|
->where('company_id', $attributes['company_id'])
|
||||||
|
->where('package_id', $attributes['package_id'])
|
||||||
|
->whereIn('type', [0, 1])
|
||||||
|
->groupBy('sim')
|
||||||
|
->havingRaw($having)
|
||||||
|
->get()->pluck('sim')->toArray();
|
||||||
|
|
||||||
|
if (count($replacement) !== count($extras)) {
|
||||||
|
throw new NotAllowedException('可替换的卡量不足,不能进行转销售操作');
|
||||||
|
}
|
||||||
|
|
||||||
|
$updates = [];
|
||||||
|
foreach ($extras as $key => $value) {
|
||||||
|
$updates[] = [
|
||||||
|
'sim' => $value,
|
||||||
|
'original_sim' => $replacement[$key],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->orderCardPartitionRepository->updateBatch($updates, 'sim');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$attributes['total_price'] = $attributes['unit_price'] * $attributes['counts'];
|
if ($attributes['counts'] !== 0) {
|
||||||
$attributes['custom_price'] = $attributes['unit_price'] * $attributes['counts'];
|
$attributes['id'] = ++$maxId;
|
||||||
$attributes['order_at'] = $attributes['order_at'] ?? date('Y-m-d H:i:s');
|
|
||||||
$attributes['package_id'] = $attributes['package_id'] ?? $product->package_id;
|
|
||||||
|
|
||||||
$node = $this->orderRepository->create($attributes);
|
if (isset($attributes['selected']) && count($attributes['selected']) === $attributes['counts']) {
|
||||||
|
$attributes['order_status'] = 5;
|
||||||
|
$attributes['transaction_status'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attributes['total_price'] = $attributes['unit_price'] * $attributes['counts'];
|
||||||
|
$attributes['custom_price'] = $attributes['unit_price'] * $attributes['counts'];
|
||||||
|
$attributes['order_at'] = $attributes['order_at'] ?? date('Y-m-d H:i:s');
|
||||||
|
$attributes['package_id'] = $attributes['package_id'] ?? $product->package_id;
|
||||||
|
|
||||||
|
$node = $this->orderRepository->create($attributes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($attributes['selected']) {
|
if (isset($attributes['selected']) && is_array($attributes['selected']) && count($attributes['selected'])) {
|
||||||
if ($attributes['type'] === 0) {
|
if ($attributes['type'] === 0) {
|
||||||
$exists = $this->orderCardPartitionRepository->withConditions([
|
$exists = $this->orderCardPartitionRepository->withConditions([
|
||||||
'type' => 0,
|
'type' => 0,
|
||||||
'sim' => array_pluck($attributes['selected'], 'sim')
|
'sim' => array_pluck($attributes['selected'], 'sim')
|
||||||
])->count();
|
])->count();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
$simArray = implode(',', array_pluck($attributes['selected'], 'sim'));
|
$simArray = implode(',', array_pluck($attributes['selected'], 'sim'));
|
||||||
@ -304,24 +378,11 @@ class OrderService extends Service
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->upsertOrderCards($attributes['selected'], $node);
|
$this->upsertOrderCards($attributes['selected'], $node);
|
||||||
$this->orderRepository->forgetCached();
|
|
||||||
$this->orderCardPartitionRepository->forgetCached();
|
|
||||||
app(RealOrderCardPartitionRepository::class)->forgetCached();
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($extras)) {
|
|
||||||
$extraOrderData = $attributes;
|
|
||||||
$extraOrderData['type'] = $originType;
|
|
||||||
$extraOrderData['counts'] = array_sum(array_pluck($extras, 'counts'));
|
|
||||||
$extraOrderData['total_price'] = $attributes['unit_price'] * $extraOrderData['counts'];
|
|
||||||
$extraOrderData['custom_price'] = $attributes['unit_price'] * $extraOrderData['counts'];
|
|
||||||
$extraOrder = $this->orderRepository->create($attributes);
|
|
||||||
$this->upsertOrderCards($extras, $extraOrder);
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
throw $e;
|
throw $e;
|
||||||
@ -329,6 +390,10 @@ class OrderService extends Service
|
|||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
|
$this->orderRepository->forgetCached();
|
||||||
|
$this->orderCardPartitionRepository->forgetCached();
|
||||||
|
app(RealOrderCardPartitionRepository::class)->forgetCached();
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,7 +650,7 @@ class OrderService extends Service
|
|||||||
if ($node->type === 0) {
|
if ($node->type === 0) {
|
||||||
$sql = 'SELECT COUNT(*) as counts FROM virtual_order_cards_partition WHERE type != 0 AND sim In (
|
$sql = 'SELECT COUNT(*) as counts FROM virtual_order_cards_partition WHERE type != 0 AND sim In (
|
||||||
SELECT sim FROM virtual_order_cards_partition WHERE order_id = ?
|
SELECT sim FROM virtual_order_cards_partition WHERE order_id = ?
|
||||||
)';
|
) AND deleted_at IS NULL';
|
||||||
|
|
||||||
$counts = DB::select($sql, [$id])[0]->counts;
|
$counts = DB::select($sql, [$id])[0]->counts;
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ class CreateRealOrderCardsTable extends Migration
|
|||||||
$table->addPartition('real_order_flows_package_cards', 'list', [3]);
|
$table->addPartition('real_order_flows_package_cards', 'list', [3]);
|
||||||
$table->addPartition('real_order_optional_package_cards', 'list', [4]);
|
$table->addPartition('real_order_optional_package_cards', 'list', [4]);
|
||||||
$table->addPartition('real_order_additional_package_cards', 'list', [5]);
|
$table->addPartition('real_order_additional_package_cards', 'list', [5]);
|
||||||
$table->addPartition('real_order_group_package_cards', 'list', [6]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('real_order_cards', function (Blueprint $table) {
|
Schema::table('real_order_cards', function (Blueprint $table) {
|
||||||
@ -63,14 +62,6 @@ class CreateRealOrderCardsTable extends Migration
|
|||||||
Schema::table('real_order_optional_package_cards', function (Blueprint $table) {
|
Schema::table('real_order_optional_package_cards', function (Blueprint $table) {
|
||||||
$table->unique(['sim', 'order_id', 'deleted_at']);
|
$table->unique(['sim', 'order_id', 'deleted_at']);
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('real_order_additional_package_cards', function (Blueprint $table) {
|
|
||||||
$table->unique(['sim', 'order_id', 'deleted_at']);
|
|
||||||
});
|
|
||||||
|
|
||||||
Schema::table('real_order_group_package_cards', function (Blueprint $table) {
|
|
||||||
$table->unique(['sim', 'order_id', 'deleted_at']);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddRealOrderGroupPackageCardsPartition extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('real_order_cards_partition', function (Blueprint $table) {
|
||||||
|
$table->addPartition('real_order_group_package_cards', 'list', [6]);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('real_order_group_package_cards', function (Blueprint $table) {
|
||||||
|
$table->unique(['sim', 'order_id', 'deleted_at']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('real_order_group_package_cards');
|
||||||
|
}
|
||||||
|
}
|
@ -721,7 +721,7 @@ export default {
|
|||||||
this.cloneColumns.forEach(col => (col._filterVisible = false));
|
this.cloneColumns.forEach(col => (col._filterVisible = false));
|
||||||
},
|
},
|
||||||
handleBodyScroll(event) {
|
handleBodyScroll(event) {
|
||||||
if (this.showHeader)
|
if (this.showHeader && this.$refs.header)
|
||||||
this.$refs.header.scrollLeft = event.target.scrollLeft;
|
this.$refs.header.scrollLeft = event.target.scrollLeft;
|
||||||
if (this.isLeftFixed)
|
if (this.isLeftFixed)
|
||||||
this.$refs.fixedBody.scrollTop = event.target.scrollTop;
|
this.$refs.fixedBody.scrollTop = event.target.scrollTop;
|
||||||
|
@ -67,6 +67,18 @@
|
|||||||
</Select>
|
</Select>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="handle-item w-200" v-if="[1, 3].indexOf(type) !== -1">
|
||||||
|
<Select clearable placeholder="订单类型" v-model="params.order_type">
|
||||||
|
<Option :value="0" v-if="type === 0">销售</Option>
|
||||||
|
<Option :value="1" v-if="type === 1">续费</Option>
|
||||||
|
<Option :value="2" v-if="type === 2">续费包</Option>
|
||||||
|
<Option :value="3" v-if="type === 3">加油包</Option>
|
||||||
|
<Option :value="4" v-if="type === 3">可选包</Option>
|
||||||
|
<Option :value="5" v-if="type === 3">附加包</Option>
|
||||||
|
<Option :value="6" v-if="type === 1">组合包</Option>
|
||||||
|
</Select>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="handle-item w-200">
|
<li class="handle-item w-200">
|
||||||
<Select clearable placeholder="支付方式" v-model="params.pay_channel_name">
|
<Select clearable placeholder="支付方式" v-model="params.pay_channel_name">
|
||||||
<Option :value="'银行转账'">银行转账</Option>
|
<Option :value="'银行转账'">银行转账</Option>
|
||||||
|
@ -64,8 +64,18 @@ export default {
|
|||||||
limit: 10,
|
limit: 10,
|
||||||
page: 1
|
page: 1
|
||||||
},
|
},
|
||||||
|
orderTypes: [
|
||||||
|
"销售",
|
||||||
|
"续费",
|
||||||
|
"续费包",
|
||||||
|
"加油包",
|
||||||
|
"可选包",
|
||||||
|
"附加包",
|
||||||
|
"组合包"
|
||||||
|
],
|
||||||
params: {
|
params: {
|
||||||
sn: "",
|
sn: "",
|
||||||
|
order_type: "",
|
||||||
company_name: "",
|
company_name: "",
|
||||||
package_name: "",
|
package_name: "",
|
||||||
carrier_operator: "",
|
carrier_operator: "",
|
||||||
@ -224,6 +234,14 @@ export default {
|
|||||||
width: 80,
|
width: 80,
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "订单类型",
|
||||||
|
key: "",
|
||||||
|
width: 90,
|
||||||
|
render: (h, context) => {
|
||||||
|
return h("span", this.orderTypes[context.row.type]);
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "企业名称",
|
title: "企业名称",
|
||||||
key: "company_name",
|
key: "company_name",
|
||||||
@ -291,8 +309,8 @@ export default {
|
|||||||
|
|
||||||
let value = select.length
|
let value = select.length
|
||||||
? select.reduce((acc, cur) => {
|
? select.reduce((acc, cur) => {
|
||||||
return acc + cur.counts;
|
return acc + cur.counts;
|
||||||
}, 0)
|
}, 0)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
return h("InputNumber", {
|
return h("InputNumber", {
|
||||||
@ -475,6 +493,7 @@ export default {
|
|||||||
if (this.params.sim !== "") {
|
if (this.params.sim !== "") {
|
||||||
params.sim = this.params.sim;
|
params.sim = this.params.sim;
|
||||||
let cardParams = { type: this.type, sim: this.params.sim };
|
let cardParams = { type: this.type, sim: this.params.sim };
|
||||||
|
cardParams = this.transformerParams(cardParams);
|
||||||
this.params.time = [];
|
this.params.time = [];
|
||||||
this.cardLoading = true;
|
this.cardLoading = true;
|
||||||
this.$store
|
this.$store
|
||||||
@ -488,6 +507,8 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
params = this.transformerParams(params);
|
||||||
|
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch("getOrders", params)
|
.dispatch("getOrders", params)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -580,6 +601,15 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.params.order_type !== "" &&
|
||||||
|
this.params.order_type !== undefined
|
||||||
|
) {
|
||||||
|
filterOrders = filterOrders.filter(el => {
|
||||||
|
return el.type === this.params.order_type;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.params.carrier_operator !== "" &&
|
this.params.carrier_operator !== "" &&
|
||||||
this.params.carrier_operator !== undefined
|
this.params.carrier_operator !== undefined
|
||||||
@ -663,6 +693,7 @@ export default {
|
|||||||
exportOrders() {
|
exportOrders() {
|
||||||
let columns = [
|
let columns = [
|
||||||
{ title: "订单编号", key: "sn" },
|
{ title: "订单编号", key: "sn" },
|
||||||
|
{ title: "订单类型", key: "order_type" },
|
||||||
{ title: "企业名称", key: "company_name" },
|
{ title: "企业名称", key: "company_name" },
|
||||||
{ title: "运营商", key: "carrier_operator_name" },
|
{ title: "运营商", key: "carrier_operator_name" },
|
||||||
{ title: "套餐名称", key: "package_name" },
|
{ title: "套餐名称", key: "package_name" },
|
||||||
@ -702,6 +733,7 @@ export default {
|
|||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
sn: order.sn + "\t",
|
sn: order.sn + "\t",
|
||||||
|
order_type: this.orderTypes[order.type],
|
||||||
company_name: order.company_name,
|
company_name: order.company_name,
|
||||||
carrier_operator_name: order.carrier_operator_name,
|
carrier_operator_name: order.carrier_operator_name,
|
||||||
package_name: order.package_name,
|
package_name: order.package_name,
|
||||||
@ -766,6 +798,7 @@ export default {
|
|||||||
this.cardLoading = true;
|
this.cardLoading = true;
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let params = { order_id: order_id, type: this.type };
|
let params = { order_id: order_id, type: this.type };
|
||||||
|
params = this.transformerParams(params);
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch("getCards", params)
|
.dispatch("getCards", params)
|
||||||
.then(cards => {
|
.then(cards => {
|
||||||
@ -788,7 +821,6 @@ export default {
|
|||||||
this.getCards(order_id).then(cards => {
|
this.getCards(order_id).then(cards => {
|
||||||
cards = this.getFilterUsedCards(cards);
|
cards = this.getFilterUsedCards(cards);
|
||||||
cards = this.getFilterDiffComPacCards(cards);
|
cards = this.getFilterDiffComPacCards(cards);
|
||||||
console.log(cards);
|
|
||||||
|
|
||||||
if (!cards.length) {
|
if (!cards.length) {
|
||||||
return this.$Message.error("所有卡都不可使用");
|
return this.$Message.error("所有卡都不可使用");
|
||||||
@ -1006,6 +1038,15 @@ export default {
|
|||||||
},
|
},
|
||||||
getFilterDiffComPacCards(cards) {
|
getFilterDiffComPacCards(cards) {
|
||||||
return cards.filter(item => !this.isDiffCompany(item));
|
return cards.filter(item => !this.isDiffCompany(item));
|
||||||
|
},
|
||||||
|
transformerParams(params) {
|
||||||
|
if (params.type === 1) {
|
||||||
|
params.type = [1, 6];
|
||||||
|
} else if (params.type === 3) {
|
||||||
|
params.type = [3, 5, 6];
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -517,6 +517,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
handelSuccess() {
|
handelSuccess() {
|
||||||
|
this.$Message.info("操作成功");
|
||||||
if (Object.keys(this.order_group).length >= 1) {
|
if (Object.keys(this.order_group).length >= 1) {
|
||||||
let mapped = JSON.parse(JSON.stringify(this.order_group));
|
let mapped = JSON.parse(JSON.stringify(this.order_group));
|
||||||
this.$store.dispatch("removeSelected", mapped[this.groupIndex]);
|
this.$store.dispatch("removeSelected", mapped[this.groupIndex]);
|
||||||
@ -524,10 +525,11 @@ export default {
|
|||||||
this.$store.commit("SET_ORDER_GROUP", mapped);
|
this.$store.commit("SET_ORDER_GROUP", mapped);
|
||||||
|
|
||||||
let nextIndex = Object.keys(this.order_group)[0];
|
let nextIndex = Object.keys(this.order_group)[0];
|
||||||
this.selectGroup(this.order_group[nextIndex], nextIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$Message.info("操作成功");
|
if (nextIndex !== undefined) {
|
||||||
|
this.selectGroup(this.order_group[nextIndex], nextIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.order_group || Object.keys(this.order_group).length < 1) {
|
if (!this.order_group || Object.keys(this.order_group).length < 1) {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
@ -1045,6 +1045,7 @@ export default {
|
|||||||
handleOrderSuccess(value) {
|
handleOrderSuccess(value) {
|
||||||
let page = value ? this.list_data.current_page : 1;
|
let page = value ? this.list_data.current_page : 1;
|
||||||
this.cardsObj.show = false;
|
this.cardsObj.show = false;
|
||||||
|
this.editObj.show = false;
|
||||||
this.shipObj.show = false;
|
this.shipObj.show = false;
|
||||||
this.orderConfirmShow = false;
|
this.orderConfirmShow = false;
|
||||||
this.$store.dispatch("initOrder");
|
this.$store.dispatch("initOrder");
|
||||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -8,6 +8,7 @@ $baseDir = dirname($vendorDir);
|
|||||||
return array(
|
return array(
|
||||||
'AccountSeeder' => $baseDir . '/database/seeds/AccountSeeder.php',
|
'AccountSeeder' => $baseDir . '/database/seeds/AccountSeeder.php',
|
||||||
'AddBusinessTypeToRealOrders' => $baseDir . '/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php',
|
'AddBusinessTypeToRealOrders' => $baseDir . '/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php',
|
||||||
|
'AddRealOrderGroupPackageCardsPartition' => $baseDir . '/database/migrations/2019_04_17_161638_add_real_order_group_package_cards_partition.php',
|
||||||
'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
|
'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
|
||||||
'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
||||||
'CompanyAccountSeeder' => $baseDir . '/database/seeds/CompanyAccountSeeder.php',
|
'CompanyAccountSeeder' => $baseDir . '/database/seeds/CompanyAccountSeeder.php',
|
||||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -727,6 +727,7 @@ class ComposerStaticInite79258a3e34ad3e251999111d9f334d9
|
|||||||
public static $classMap = array (
|
public static $classMap = array (
|
||||||
'AccountSeeder' => __DIR__ . '/../..' . '/database/seeds/AccountSeeder.php',
|
'AccountSeeder' => __DIR__ . '/../..' . '/database/seeds/AccountSeeder.php',
|
||||||
'AddBusinessTypeToRealOrders' => __DIR__ . '/../..' . '/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php',
|
'AddBusinessTypeToRealOrders' => __DIR__ . '/../..' . '/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php',
|
||||||
|
'AddRealOrderGroupPackageCardsPartition' => __DIR__ . '/../..' . '/database/migrations/2019_04_17_161638_add_real_order_group_package_cards_partition.php',
|
||||||
'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
|
'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
|
||||||
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
||||||
'CompanyAccountSeeder' => __DIR__ . '/../..' . '/database/seeds/CompanyAccountSeeder.php',
|
'CompanyAccountSeeder' => __DIR__ . '/../..' . '/database/seeds/CompanyAccountSeeder.php',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user