Commit 10b71f03 by 孙龙
parents aa344e0e c8dbb5a1
......@@ -32,7 +32,7 @@ class AssignUserHandle extends Form implements LazyRenderable
->refresh();
} catch (\Throwable $throwable) {
// var_dump((string)$throwable);
return $this->response()->error(trans('admin.update_failed'));
return $this->response()->error(trans('admin.update_failed').": {$throwable->getMessage()}");
}
}
......
......@@ -28,8 +28,12 @@ class EditUserHandle extends Form implements LazyRenderable
// $userList = User::getListByIdArr($ids);
$userInfo = User::getInfoByUserId($id);
if (!$userInfo) {
throw new \Exception('客户不存在');
throw new \Exception("Record not found");
}
$input = array_filter($input, function ($value) {
return $value !== null;
});
User::updateById($id, $input);
return $this
->response()
......@@ -37,7 +41,7 @@ class EditUserHandle extends Form implements LazyRenderable
->refresh();
} catch (\Throwable $throwable) {
// var_dump((string)$throwable);
return $this->response()->error(trans('admin.update_failed'));
return $this->response()->error(trans('admin.update_failed')." :{$throwable->getMessage()}");
}
}
......@@ -50,7 +54,7 @@ class EditUserHandle extends Form implements LazyRenderable
$this->hidden('id')->attribute('id', 'id')->width(4);
$this->row(function (Row $form) {
$form->width(5)->text('company_name')->required();
$form->width(5)->text('user_sn');
$form->width(5)->text('user_sn')->disable();
});
$this->row(function (Row $form) {
$form->width(5)->text('first_name')->required();
......@@ -61,7 +65,7 @@ class EditUserHandle extends Form implements LazyRenderable
$form->width(5)->text('email');
});
$this->row(function (Row $form) {
$form->width(5)->select('reg_source')->options(admin_trans('user.options.reg_source'))->required();
$form->width(5)->select('account_properties')->options(admin_trans('user.options.account_properties'))->required();
$form->width(5)->text('remark');
});
}
......
......@@ -32,7 +32,7 @@ class TransferUserHandle extends Form implements LazyRenderable
->refresh();
} catch (\Throwable $throwable) {
// var_dump((string)$throwable);
return $this->response()->error(trans('admin.update_failed'));
return $this->response()->error(trans('admin.update_failed').": {$throwable->getMessage()}");
}
}
......
......@@ -38,6 +38,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable
if ($input['is_default'] == 1) {
UserAddress::updateByUserId($address['user_id'], ['is_default' => 0]);
}
$input['consignee'] = $input['first_name'] . ' ' . $input['last_name'];
UserAddress::updateById($addressId, $input);
} else {
$userId = $this->payload['user_id'] ?? 0;
......
......@@ -5,6 +5,7 @@ namespace App\Admin\Service;
use App\Admin\Actions\User\UserAssignAction;
use App\Admin\Actions\User\UserStatusAction;
use App\Admin\Actions\User\UserTransferAction;
use App\Models\Country;
use App\Models\User;
use Dcat\Admin\Grid;
......@@ -18,9 +19,9 @@ class UserAddressService
$grid->column('phone');
$grid->column('detail_address');
$grid->column('city');
$grid->column('address_type');
$grid->column('address_type')->using(admin_trans('user-address.options.address_type'));
$grid->column('post_code');
$grid->column('country');
$grid->column('country')->using(Country::getCountryMap());
$grid->column('province');
}
}
......@@ -177,6 +177,7 @@ class UserService
"create_time" => time(),
"update_time" => time(),
];
$addressData['consignee'] = $addressData['first_name'] . " " . $addressData['last_name'];
UserAddress::insertData($addressData);
}
......@@ -204,6 +205,13 @@ class UserService
}
//更新客户的数据
$userList = User::getListByIdArr($ids);
//判断客户状态
foreach ($userList as $user) {
if ($user['status'] != User::STATUS_NORMAL) {
throw new \Exception("user:[{$user['user_sn']}] status is not normal");
}
}
$userIds = array_column($userList, "id");
$update = [
"sale_id" => $saleId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment