添加退货管理
This commit is contained in:
parent
d11611dce7
commit
1e942e0486
@ -4,80 +4,83 @@ return [
|
||||
'mmdb_path' => storage_path('app/files/GeoLite2-City.mmdb'),
|
||||
|
||||
'actions' => [
|
||||
// Account
|
||||
'api.accounts.create' => '创建账号',
|
||||
'api.accounts.destroy' => '删除账号',
|
||||
'api.accounts.update' => '修改账号',
|
||||
// Account
|
||||
'api.accounts.create' => '创建账号',
|
||||
'api.accounts.destroy' => '删除账号',
|
||||
'api.accounts.update' => '修改账号',
|
||||
|
||||
// App
|
||||
'api.apps.create' => '创建应用',
|
||||
'api.apps.destroy' => '删除应用',
|
||||
'api.apps.update' => '修改应用',
|
||||
// App
|
||||
'api.apps.create' => '创建应用',
|
||||
'api.apps.destroy' => '删除应用',
|
||||
'api.apps.update' => '修改应用',
|
||||
|
||||
// Auth
|
||||
'api.auth.admin.login' => '登录账号',
|
||||
'api.auth.admin.logout' => '登出账号',
|
||||
'api.auth.user.login' => '用户登录',
|
||||
'api.auth.user.logout' => '用户登出',
|
||||
// Auth
|
||||
'api.auth.admin.login' => '登录账号',
|
||||
'api.auth.admin.logout' => '登出账号',
|
||||
'api.auth.user.login' => '用户登录',
|
||||
'api.auth.user.logout' => '用户登出',
|
||||
|
||||
// Category
|
||||
'api.categories.create' => '创建分类',
|
||||
'api.categories.destroy' => '删除分类',
|
||||
'api.categories.update' => '修改分类',
|
||||
// Category
|
||||
'api.categories.create' => '创建分类',
|
||||
'api.categories.destroy' => '删除分类',
|
||||
'api.categories.update' => '修改分类',
|
||||
|
||||
// Config
|
||||
'api.configs.set' => '修改配置',
|
||||
// Config
|
||||
'api.configs.set' => '修改配置',
|
||||
|
||||
// File
|
||||
'api.files.destroy' => '删除文件',
|
||||
'api.files.upload' => '上传文件',
|
||||
// File
|
||||
'api.files.destroy' => '删除文件',
|
||||
'api.files.upload' => '上传文件',
|
||||
|
||||
// Log
|
||||
'api.logs.destroy' => '删除日志',
|
||||
// Log
|
||||
'api.logs.destroy' => '删除日志',
|
||||
|
||||
// Permission
|
||||
'api.permissions.create' => '添加权限',
|
||||
'api.permissions.destroy' => '删除权限',
|
||||
'api.permissions.update' => '修改权限',
|
||||
// Permission
|
||||
'api.permissions.create' => '添加权限',
|
||||
'api.permissions.destroy' => '删除权限',
|
||||
'api.permissions.update' => '修改权限',
|
||||
|
||||
// Role
|
||||
'api.roles.create' => '创建角色',
|
||||
'api.roles.destroy' => '删除角色',
|
||||
'api.roles.sync_permissions' => '角色分配权限',
|
||||
'api.roles.sync_roles' => '分配角色',
|
||||
'api.roles.update' => '修改角色',
|
||||
// Role
|
||||
'api.roles.create' => '创建角色',
|
||||
'api.roles.destroy' => '删除角色',
|
||||
'api.roles.sync_permissions' => '角色分配权限',
|
||||
'api.roles.sync_roles' => '分配角色',
|
||||
'api.roles.update' => '修改角色',
|
||||
|
||||
// SMS
|
||||
'api.sms.index' => '发送短信',
|
||||
// SMS
|
||||
'api.sms.index' => '发送短信',
|
||||
|
||||
// User
|
||||
'api.users.create' => '创建用户',
|
||||
'api.users.destroy' => '删除用户',
|
||||
'api.users.update' => '修改用户',
|
||||
// User
|
||||
'api.users.create' => '创建用户',
|
||||
'api.users.destroy' => '删除用户',
|
||||
'api.users.update' => '修改用户',
|
||||
|
||||
// 企业管理
|
||||
'api.virtual.companies.create' => '创建企业',
|
||||
'api.virtual.companies.destroy' => '删除企业',
|
||||
'api.virtual.companies.update' => '修改企业',
|
||||
// 企业管理
|
||||
'api.virtual.companies.create' => '创建企业',
|
||||
'api.virtual.companies.destroy' => '删除企业',
|
||||
'api.virtual.companies.update' => '修改企业',
|
||||
|
||||
// 企业账号
|
||||
'api.virtual.company.accounts.create' => '创建企业账号',
|
||||
'api.virtual.company.accounts.destroy' => '删除企业账号',
|
||||
'api.virtual.company.accounts.update' => '修改企业账号',
|
||||
'api.virtual.company.accounts.create' => '创建企业账号',
|
||||
'api.virtual.company.accounts.destroy' => '删除企业账号',
|
||||
'api.virtual.company.accounts.update' => '修改企业账号',
|
||||
|
||||
// 订单管理
|
||||
'api.virtual.orders.create' => '创建订单',
|
||||
'api.virtual.orders.destroy' => '删除订单',
|
||||
'api.virtual.orders.update' => '修改订单',
|
||||
'api.virtual.orders.create' => '创建订单',
|
||||
'api.virtual.orders.destroy' => '删除订单',
|
||||
'api.virtual.orders.update' => '修改订单',
|
||||
|
||||
// 退货管理
|
||||
'api.virtual.refunds.create' => '添加退货',
|
||||
|
||||
// 套餐管理
|
||||
'api.virtual.packages.create' => '创建订单',
|
||||
'api.virtual.packages.destroy' => '删除订单',
|
||||
'api.virtual.packages.update' => '修改订单',
|
||||
'api.virtual.packages.create' => '创建订单',
|
||||
'api.virtual.packages.destroy' => '删除订单',
|
||||
'api.virtual.packages.update' => '修改订单',
|
||||
|
||||
// 定价管理
|
||||
'api.virtual.products.create' => '创建定价',
|
||||
'api.virtual.products.destroy' => '删除定价',
|
||||
'api.virtual.products.update' => '修改定价',
|
||||
'api.virtual.products.create' => '创建定价',
|
||||
'api.virtual.products.destroy' => '删除定价',
|
||||
'api.virtual.products.update' => '修改定价',
|
||||
],
|
||||
];
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Virtual\Http\Controllers;
|
||||
|
||||
use App\Dicts;
|
||||
@ -78,8 +79,8 @@ class OrderController extends Controller
|
||||
'transaction_status' => $item->transaction_status,
|
||||
'transaction_status_name' => $transactionStatuses[$item->transaction_status],
|
||||
'remark' => $item->remark ?? '',
|
||||
'order_at' => (string)$item->order_at,
|
||||
'deleted_at' => (string)$item->deleted_at,
|
||||
'order_at' => (string) $item->order_at,
|
||||
'deleted_at' => (string) $item->deleted_at,
|
||||
'area' => $item->area ?? [],
|
||||
'address' => $item->address ?? '',
|
||||
'contacts' => $item->contacts,
|
||||
|
87
app/Domains/Virtual/Http/Controllers/RefundController.php
Normal file
87
app/Domains/Virtual/Http/Controllers/RefundController.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Virtual\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Core\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exceptions\InvalidArgumentException;
|
||||
use App\Domains\Virtual\Services\OrderService;
|
||||
|
||||
class RefundController extends Controller
|
||||
{
|
||||
protected $request;
|
||||
protected $orderService;
|
||||
|
||||
/**
|
||||
* 构造函数,自动注入.
|
||||
*/
|
||||
public function __construct(Request $request, OrderService $orderService)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->orderService = $orderService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$conditions = $this->request->all();
|
||||
$conditions['limit'] = $this->request->get('limit', 20);
|
||||
|
||||
$refunds = $this->orderService->refundedList($conditions);
|
||||
|
||||
return res($refunds, '退货列表', 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查退货.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$sim = $this->request->get('sim');
|
||||
|
||||
if (empty($sim)) {
|
||||
throw new InvalidArgumentException('sim卡号不能为空');
|
||||
}
|
||||
|
||||
$sim = array_map('intval', array_map('trim', str_to_array($sim, "\n")));
|
||||
|
||||
$refunded_at = $this->request->get('refunded_at', date('Y-m-d H:i:s'));
|
||||
|
||||
$refunded_at = Carbon::parse($refunded_at);
|
||||
|
||||
$res = $this->orderService->refundedCheck($sim, $refunded_at);
|
||||
|
||||
return res($res, '检查退货', 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加退货.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$sim = $this->request->get('sim');
|
||||
|
||||
if (empty($sim)) {
|
||||
throw new InvalidArgumentException('sim卡号不能为空');
|
||||
}
|
||||
|
||||
$sim = array_map('intval', array_map('trim', str_to_array($sim, "\n")));
|
||||
|
||||
$refunded_at = $this->request->get('refunded_at', date('Y-m-d H:i:s'));
|
||||
|
||||
$refunded_at = Carbon::parse($refunded_at);
|
||||
|
||||
$this->orderService->refundedCreate($sim, $refunded_at);
|
||||
|
||||
return res(true, '退货成功');
|
||||
}
|
||||
}
|
@ -96,6 +96,14 @@ trait OrderCardConcern
|
||||
$query->where('service_end_at', '<=', Carbon::parse($conditions['service_end_endtime']));
|
||||
}
|
||||
|
||||
if (isset($conditions['refunded_starttime'])) {
|
||||
$query->where('refunded_at', '>=', Carbon::parse($conditions['refunded_starttime']));
|
||||
}
|
||||
|
||||
if (isset($conditions['refunded_endtime'])) {
|
||||
$query->where('refunded_at', '<=', Carbon::parse($conditions['refunded_endtime']));
|
||||
}
|
||||
|
||||
if (isset($conditions['month'])) {
|
||||
$time = Carbon::parse($conditions['month'])->format('Y-m-d H:i:s');
|
||||
$query->where(function ($subQuery) use ($time) {
|
||||
@ -109,7 +117,7 @@ trait OrderCardConcern
|
||||
if (isset($conditions['activated_starttime']) && isset($conditions['activated_endtime'])) {
|
||||
$query->whereHas('card', function ($relation) use ($conditions) {
|
||||
$relation->where('activated_at', '>=', Carbon::parse($conditions['activated_starttime']))
|
||||
->where('activated_at', '<=', Carbon::parse($conditions['activated_endtime']));
|
||||
->where('activated_at', '<=', Carbon::parse($conditions['activated_endtime']));
|
||||
});
|
||||
}
|
||||
|
||||
@ -124,6 +132,10 @@ trait OrderCardConcern
|
||||
$relation->where('transaction_no', 'like', "%{$conditions['transaction_no']}%");
|
||||
});
|
||||
}
|
||||
|
||||
if (isset($conditions['is_refunded'])) {
|
||||
$query->whereNotNull('refunded_at');
|
||||
}
|
||||
});
|
||||
|
||||
if (isset($conditions['card_status'])) {
|
||||
@ -144,20 +156,20 @@ trait OrderCardConcern
|
||||
$havingRaw = sprintf("MAX(service_end_at) >= '%s'", date('Y-m-d H:i:s'));
|
||||
|
||||
$this->model = $this->model->whereNotNull('service_start_at')
|
||||
->groupBy('sim')->havingRaw($havingRaw)
|
||||
->whereHas('card', function ($relation) {
|
||||
$relation->whereNull('cancelled_at');
|
||||
});
|
||||
->groupBy('sim')->havingRaw($havingRaw)
|
||||
->whereHas('card', function ($relation) {
|
||||
$relation->whereNull('cancelled_at');
|
||||
});
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$havingRaw = sprintf("MAX(service_end_at) < '%s'", date('Y-m-d H:i:s'));
|
||||
|
||||
$this->model = $this->model->whereNotNull('service_start_at')
|
||||
->groupBy('sim')->havingRaw($havingRaw)
|
||||
->whereHas('card', function ($relation) {
|
||||
$relation->whereNull('cancelled_at');
|
||||
});
|
||||
->groupBy('sim')->havingRaw($havingRaw)
|
||||
->whereHas('card', function ($relation) {
|
||||
$relation->whereNull('cancelled_at');
|
||||
});
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
@ -63,6 +63,11 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
||||
$router->post('/orders/ship', ['as' => 'orders.ship', 'uses' => 'OrderController@ship']);
|
||||
$router->post('/orders/ship-not-base', ['as' => 'orders.shipNotBase', 'uses' => 'OrderController@shipNotBase']);
|
||||
|
||||
// 退货管理
|
||||
$router->get('/refunds/index', ['as' => 'refunds.index', 'uses' => 'RefundController@index']);
|
||||
$router->post('/refunds/check', ['as' => 'refunds.check', 'uses' => 'RefundController@check']);
|
||||
$router->post('/refunds/create', ['as' => 'refunds.create', 'uses' => 'RefundController@create']);
|
||||
|
||||
// 客户管理
|
||||
$router->addRoute(['GET', 'POST'], '/cards/index', ['as' => 'cards.index', 'uses' => 'CardController@index']);
|
||||
$router->get('/cards/export', ['as' => 'cards.export', 'uses' => 'CardController@export']);
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Virtual\Services;
|
||||
|
||||
use App\Dicts;
|
||||
@ -1018,4 +1019,88 @@ class OrderService extends Service
|
||||
$simArray = array_pluck($data, 'sim');
|
||||
MongoCardJob::dispatch($simArray)->onQueue('sync');
|
||||
}
|
||||
|
||||
public function refundedList(array $conditions = [])
|
||||
{
|
||||
$conditions['type'] = 0;
|
||||
$conditions['is_refunded'] = true;
|
||||
$limit = $conditions['limit'] ?? 35;
|
||||
|
||||
$res = $this->orderCardPartitionRepository->withRefunded()
|
||||
->withConditions($conditions)->applyConditions()->orderBy('refunded_at', 'desc')->paginate($limit);
|
||||
|
||||
$orders = $this->orderRepository->withConditions(['id' => $res->pluck('order_id')->unique()->toArray()])->get()->keyBy('id');
|
||||
$carrierOperators = app(Dicts::class)->get('carrier_operator');
|
||||
|
||||
|
||||
$res->map(function ($item) use ($orders, $carrierOperators) {
|
||||
$package = PackageService::load($item->package_id);
|
||||
$item->company_name = CompanyService::load($item->company_id)['name'];
|
||||
$item->package_name = $package['name'];
|
||||
$item->carrier_operator = $carrierOperators[$package['carrier_operator']];
|
||||
$item->order_sn = $orders[$item['order_id']]['sn'];
|
||||
});
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function refundedCheck(array $sim = [], $refunded_at)
|
||||
{
|
||||
$errors = [];
|
||||
|
||||
$res = $this->orderCardPartitionRepository->withRefunded()->select('sim', 'type', 'refunded_at', 'service_start_at', 'service_end_at')
|
||||
->withConditions(['sim' => $sim, 'endtime' => $refunded_at])->get();
|
||||
|
||||
// 检查卡是否存在
|
||||
$notExists = array_diff($sim, $res->where('type', 0)->pluck('sim')->unique()->toArray());
|
||||
foreach ($notExists as $value) {
|
||||
$errors[$value] = isset($errors[$value]) ? $errors[$value] . ' | ' . '不存在' : '不存在';
|
||||
}
|
||||
|
||||
// 检查已退货过
|
||||
$refunds = $res->where('type', 0)->where('refunded_at', '<>', '')->pluck('sim')->unique()->toArray();
|
||||
foreach ($refunds as $value) {
|
||||
$errors[$value] = isset($errors[$value]) ? $errors[$value] . ' | ' . '已退货' : '已退货';
|
||||
}
|
||||
|
||||
// 检查卡是否已激活
|
||||
$activates = $res->where('type', 0)->where('service_start_at', '<>', '')->pluck('sim')->unique()->toArray();
|
||||
foreach ($activates as $value) {
|
||||
$errors[$value] = isset($errors[$value]) ? $errors[$value] . ' | ' . '已激活' : '已激活';
|
||||
}
|
||||
|
||||
// 检查是否有其他订单
|
||||
$otherOrders = $res->where('type', '<>', 0)->pluck('sim')->unique()->toArray();
|
||||
foreach ($otherOrders as $value) {
|
||||
$errors[$value] = isset($errors[$value]) ? $errors[$value] . ' | ' . '存在其他订单' : '存在其他订单';
|
||||
}
|
||||
|
||||
$return = [];
|
||||
|
||||
foreach ($errors as $key => $value) {
|
||||
array_push($return, ['sim' => $key, 'errors' => $value]);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function refundedCreate(array $sim = [], $refunded_at)
|
||||
{
|
||||
$sql = "
|
||||
UPDATE virtual_order_cards_partition AS v
|
||||
SET refunded_at = '%s'
|
||||
FROM cards AS c
|
||||
WHERE c.sim = v.sim
|
||||
AND v.sim IN (%s)
|
||||
AND v.created_at <= '%s'
|
||||
";
|
||||
|
||||
$simArrayText = implode(',', $sim);
|
||||
|
||||
DB::update(sprintf($sql, $refunded_at, $simArrayText, $refunded_at));
|
||||
|
||||
$this->orderCardPartitionRepository->forgetCached();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ class PermissionSeeder extends Seeder
|
||||
[
|
||||
'name' => 'logs', 'title' => '日志管理', 'path' => '/logs', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'logs.show','title' => '查看','description' => 'show','type' => 1],
|
||||
['name' => 'logs.destroy','title' => '删除','description' => 'destroy','type' => 1],
|
||||
['name' => 'logs.show', 'title' => '查看', 'description' => 'show', 'type' => 1],
|
||||
['name' => 'logs.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
],
|
||||
@ -229,6 +229,16 @@ class PermissionSeeder extends Seeder
|
||||
['name' => 'virtual.orders.3.locked', 'title' => '解锁', 'description' => 'locked', 'type' => 1],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'virtual.refunds.index', 'title' => '退货管理', 'path' => '/refunds', 'icon' => 'md-undo', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'virtual.refunds.show', 'title' => '查看', 'description' => 'show', 'type' => 1],
|
||||
['name' => 'virtual.refunds.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'virtual.refunds.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'virtual.refunds.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
['name' => 'virtual.refunds.output', 'title' => '导出', 'description' => 'output', 'type' => 1],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
32
frontend/src/api/virtual/refunds.js
Normal file
32
frontend/src/api/virtual/refunds.js
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 退货管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* [index 退货列表]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function index(data) {
|
||||
return service.get("api/virtual/refunds/index", {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* [check 检查退货]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function check(data) {
|
||||
return service.post("api/virtual/refunds/check", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* [create 添加退货]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function create(data) {
|
||||
return service.post("api/virtual/refunds/create", data);
|
||||
}
|
@ -24,6 +24,7 @@ const routes = [
|
||||
{ path: '/properties', name: 'Properties', component: load('virtual/properties/index'), meta: { title: '属性管理' } },
|
||||
{ path: '/cards', name: 'Cards', component: load('virtual/cards/index'), meta: { title: '客户列表' } },
|
||||
{ path: '/orders/:type', name: 'Orders', component: load('virtual/orders/index'), meta: { title: '订单列表' } },
|
||||
{ path: '/refunds', name: 'Refunds', component: load('virtual/refunds/index'), meta: { title: '退货管理' } },
|
||||
{ path: '/exports', name: 'StatsExports', component: load('exports/index'), meta: { title: '导出记录' } },
|
||||
{ path: '/stats/company-count', name: 'StatsCompanyCount', component: load('stats/company-count/index'), meta: { title: '企业统计' } },
|
||||
{ path: '/stats/order/:type', name: 'StatsOrder', component: load('stats/order/index'), meta: { title: '订单统计' } },
|
||||
|
@ -137,7 +137,7 @@
|
||||
</AutoComplete>
|
||||
</li>
|
||||
<li class="handle-item w-250">
|
||||
<Input placeholder="SIM" type="textarea" v-model="params.sim"/>
|
||||
<Input placeholder="SIM" type="textarea" v-model="params.sim" />
|
||||
</li>
|
||||
|
||||
<li class="f-r">
|
||||
|
59
frontend/src/views/virtual/refunds/edit.vue
Normal file
59
frontend/src/views/virtual/refunds/edit.vue
Normal file
@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<Drawer
|
||||
:closable="false"
|
||||
:mask-closable="false"
|
||||
:title="'添加退货'"
|
||||
@on-visible-change="visibleChange"
|
||||
v-model="my_show"
|
||||
width="500"
|
||||
>
|
||||
<div class="page-edit-wrap uinn-lr20">
|
||||
<ui-loading :show="page_loading.show"></ui-loading>
|
||||
|
||||
<ul>
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require"></span>退货时间:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="退货时间"
|
||||
placement="bottom-start"
|
||||
type="date"
|
||||
v-model.trim="params.refunded_at"
|
||||
></DatePicker>
|
||||
</p>
|
||||
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">未填写将使用当前时间, 注意退货时间须大于销售订单时间</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require"></span>退货卡号:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Input placeholder="SIM" type="textarea" v-model="params.sim" />
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">请输入要退货的SIM卡号,一卡一行</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ta-c">
|
||||
<Button @click="clear" class="w-80 umar-r5" ghost type="primary">取消</Button>
|
||||
<Button :loading="loading" @click="ok" class="w-80" type="primary">提交</Button>
|
||||
</div>
|
||||
</Drawer>
|
||||
</template>
|
||||
|
||||
<script src="./js/edit.js"></script>
|
126
frontend/src/views/virtual/refunds/index.vue
Normal file
126
frontend/src/views/virtual/refunds/index.vue
Normal file
@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<div class="page-wrap">
|
||||
<ui-loading :show="page_loading.show"></ui-loading>
|
||||
|
||||
<div class="page-handle-wrap">
|
||||
<ul class="handle-wraper bd-b">
|
||||
<li class="f-l">
|
||||
<div class="text-exp">
|
||||
<b>全部信息</b>
|
||||
</div>
|
||||
</li>
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="openEdit(true, null)" icon="md-add" type="primary" v-has="'create'">添加退货</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button @click="search.show=!search.show" ghost icon="ios-search" type="primary">搜索</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" icon="md-refresh">刷新</Button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="search-wrap" v-show="search.show">
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-200">
|
||||
<Input clearable placeholder="订单编号" v-model.trim="params.sn"></Input>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-200">
|
||||
<Select clearable placeholder="运营商" v-model="params.carrier_operator">
|
||||
<Option :value="0">联通</Option>
|
||||
<Option :value="1">移动</Option>
|
||||
<Option :value="2">电信</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="订单时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
v-model.trim="params.time"
|
||||
:options="datePickerOptionsMonth"
|
||||
></DatePicker>
|
||||
</li>
|
||||
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" ghost type="primary">立即搜索</Button>
|
||||
</div>
|
||||
<div class="handle-item">
|
||||
<Button @click="resetSearch" ghost type="warning">重置搜索</Button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete
|
||||
@on-search="handleCompleteCompanies"
|
||||
icon="ios-search"
|
||||
placeholder="企业名称"
|
||||
v-model.trim="params.company_name"
|
||||
>
|
||||
<Option
|
||||
:key="item.id"
|
||||
:value="item.name"
|
||||
v-for="item in completeHandledCompanies"
|
||||
>{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-200">
|
||||
<AutoComplete
|
||||
@on-search="handleCompletePackages(type, $event)"
|
||||
icon="ios-search"
|
||||
placeholder="套餐名称"
|
||||
v-model.trim="params.package_name"
|
||||
>
|
||||
<Option
|
||||
:key="item.id"
|
||||
:value="item.name"
|
||||
v-for="item in completeHandledPackages"
|
||||
>{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="退货时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
v-model.trim="params.refunded_time"
|
||||
:options="datePickerOptionsMonth"
|
||||
></DatePicker>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-list-wrap">
|
||||
<Table :columns="table_titles" :data="list_data ? list_data.data : []"></Table>
|
||||
</div>
|
||||
|
||||
<div class="page-turn-wrap" v-if="list_data">
|
||||
<Page
|
||||
:current="Number(list_data.current_page)"
|
||||
:page-size="Number(list_data.per_page)"
|
||||
:total="Number(list_data.total)"
|
||||
@on-change="index"
|
||||
show-elevator
|
||||
show-total
|
||||
></Page>
|
||||
</div>
|
||||
|
||||
<ui-edit :type="type" :show.sync="editObj.show" @add-success="index"></ui-edit>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./js/index.js"></script>
|
106
frontend/src/views/virtual/refunds/js/edit.js
Normal file
106
frontend/src/views/virtual/refunds/js/edit.js
Normal file
@ -0,0 +1,106 @@
|
||||
import * as API from "api/virtual/refunds";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
my_show: false,
|
||||
loading: false,
|
||||
params: {
|
||||
sim: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show(bool) {
|
||||
this.my_show = bool;
|
||||
if (bool) {
|
||||
if (this.data) {
|
||||
for (let k in this.data) {
|
||||
if (k in this.params) {
|
||||
this.params[k] = this.data[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
ok() {
|
||||
if (!this.params.sim) {
|
||||
this.$Message.info("请输入SIM卡号");
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加
|
||||
API.check(this.params)
|
||||
.then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
if (res.data.length) {
|
||||
this.$Modal.confirm({
|
||||
title: "提示: 存在问题, 请确认是否继续操作",
|
||||
render: h => {
|
||||
return h("Table", {
|
||||
props: {
|
||||
columns: [
|
||||
{
|
||||
title: "SIM",
|
||||
key: "sim"
|
||||
},
|
||||
{
|
||||
title: "错误",
|
||||
key: "errors"
|
||||
}
|
||||
],
|
||||
data: res.data
|
||||
}
|
||||
});
|
||||
},
|
||||
onOk: () => {
|
||||
this.createRefund();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(2);
|
||||
this.createRefund();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
createRefund() {
|
||||
API.check(this.params)
|
||||
.then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.$emit("add-success");
|
||||
this.$Message.success("添加成功");
|
||||
this.clear();
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
visibleChange(bool) {
|
||||
if (!bool) {
|
||||
this.$emit("update:show", false);
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
for (let k in this.params) {
|
||||
this.params[k] = "";
|
||||
}
|
||||
|
||||
this.my_show = false;
|
||||
}
|
||||
}
|
||||
};
|
150
frontend/src/views/virtual/refunds/js/index.js
Normal file
150
frontend/src/views/virtual/refunds/js/index.js
Normal file
@ -0,0 +1,150 @@
|
||||
import * as API from "api/virtual/refunds";
|
||||
export default {
|
||||
name: "Companies",
|
||||
components: {
|
||||
UiEdit: resolve => require(["views/virtual/refunds/edit"], resolve)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
sn: "",
|
||||
carrier_operator: "",
|
||||
company_name: "",
|
||||
package_name: "",
|
||||
time: [],
|
||||
refunded_time: []
|
||||
},
|
||||
type: 0,
|
||||
trashed: null,
|
||||
list_data: null,
|
||||
editObj: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
table_titles: [
|
||||
{
|
||||
title: "ID",
|
||||
key: "id",
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: "SIM",
|
||||
key: "sim",
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: "订单编号",
|
||||
key: "order_sn",
|
||||
minWidth: 210
|
||||
},
|
||||
{
|
||||
title: "原企业名",
|
||||
key: "company_name",
|
||||
minWidth: 170
|
||||
},
|
||||
{
|
||||
title: "原套餐名",
|
||||
key: "package_name",
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
title: "原运营商",
|
||||
key: "carrier_operator",
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: "订单时间",
|
||||
key: "created_at",
|
||||
width: 170
|
||||
},
|
||||
{
|
||||
title: "退货时间",
|
||||
key: "refunded_at",
|
||||
width: 170
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.index(1);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* [index 列表]
|
||||
* @param {Number} page [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
index(page = 1) {
|
||||
let params = JSON.parse(JSON.stringify(this.params));
|
||||
|
||||
if (
|
||||
this.params.refunded_time.length &&
|
||||
this.params.refunded_time[0] &&
|
||||
this.params.refunded_time[1]
|
||||
) {
|
||||
let refunded_time = this.parseTime(this.params.refunded_time);
|
||||
params.refunded_starttime = refunded_time.starttime;
|
||||
params.refunded_endtime = refunded_time.endtime;
|
||||
}
|
||||
|
||||
params.refunded_time = undefined;
|
||||
|
||||
let data = this.searchDataHandle({}, { page }, params);
|
||||
this.isShowLoading(true);
|
||||
API.index(data)
|
||||
.then(res => {
|
||||
this.isShowLoading(false);
|
||||
if (res.code == 0) {
|
||||
this.list_data = res.data;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.isShowLoading(false);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* [openEdit 打开编辑弹窗]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openEdit(bool, data = null) {
|
||||
this.editObj = {
|
||||
show: bool,
|
||||
data
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* [request 刷新]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
request() {
|
||||
const result = this.list_data;
|
||||
let page = result.current_page;
|
||||
|
||||
if (this.list_data.data.length == 1) {
|
||||
page = this.returnPage(
|
||||
result.total,
|
||||
result.current_page,
|
||||
result.per_page
|
||||
);
|
||||
}
|
||||
|
||||
this.index(page);
|
||||
},
|
||||
|
||||
resetSearch() {
|
||||
for (let k in this.params) {
|
||||
if (k === "time" || k === "refund_tim") {
|
||||
this.params[k] = [];
|
||||
} else {
|
||||
this.params[k] = "";
|
||||
}
|
||||
}
|
||||
this.index(1);
|
||||
}
|
||||
}
|
||||
};
|
2
public/css/chunk-058111f8.53f21a89.css
Normal file
2
public/css/chunk-058111f8.53f21a89.css
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.f774c5c0.js
Normal file
1
public/js/app.f774c5c0.js
Normal file
File diff suppressed because one or more lines are too long
14
public/js/chunk-058111f8.e043dbc1.js
Normal file
14
public/js/chunk-058111f8.e043dbc1.js
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-61be388a.e222bb72.css rel=prefetch><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-61be388a.d90b0494.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.7cfc2f1f.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.7cfc2f1f.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-058111f8.53f21a89.css rel=prefetch><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-058111f8.e043dbc1.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.f774c5c0.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.f774c5c0.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user