6
0
Fork 0

调整添加公司收款信息返回

release
vine_liutk 2022-01-15 16:42:09 +08:00 committed by 李静
parent d165c68b63
commit 17e2aeb42e
4 changed files with 148 additions and 0 deletions

View File

@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
use App\Admin\Forms\Settings\Android;
use App\Admin\Forms\Settings\App;
use App\Admin\Forms\Settings\Dealer;
use App\Admin\Forms\Settings\Distribution;
use App\Admin\Forms\Settings\Ios;
use App\Admin\Forms\Settings\Kuaidi100;
@ -111,6 +112,7 @@ class SettingController extends AdminController
case 'app':
$tab->add('系统配置', new App(), true);
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'ios']));
@ -120,6 +122,17 @@ class SettingController extends AdminController
case 'distribution':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->add('会员奖励配置', new Distribution(), true);
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
break;
case 'dealer':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->add('经销商配置', new Dealer(), true);
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
@ -129,6 +142,7 @@ class SettingController extends AdminController
case 'withdraw':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->add('提现配置', new Withdraw(), true);
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
@ -138,6 +152,7 @@ class SettingController extends AdminController
case 'ios':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->add('Ios配置', new Ios(), true);
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
@ -147,6 +162,7 @@ class SettingController extends AdminController
case 'android':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->add('Android配置', new Android(), true);
@ -156,6 +172,7 @@ class SettingController extends AdminController
case 'kuaidi100':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));

View File

@ -0,0 +1,89 @@
<?php
namespace App\Admin\Forms\Settings;
use App\Models\Setting;
use App\Services\SettingService;
use Carbon\Carbon;
use Dcat\Admin\Widgets\Form;
class Dealer extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
Setting::where('key', 'dealer')->updateOrCreate([
'key' => 'dealer',
], ['value' => $input]);
//清配置缓存
app(SettingService::class)->cleanCache('dealer');
return $this
->response()
->success('配置更新成功!')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->currency('fee_rate', '手续费比例(百分比)')->symbol('%');
$this->table('purchase_rules', '进货补贴规则', function ($table) {
$table->number('price', '阶梯(万)');
$table->currency('rate', '比例(百分比)')->symbol('%');
})->disableCreate()->disableDelete();
// $this->embeds('pay_info', '公司收款信息', function ($form) {
$this->divider('银行账号收款');
$this->text('bank.user_name', '收款人名称');
$this->text('bank.bank_name', '银行名称');
$this->text('bank.bank_number', '银行名称');
$this->text('bank.bank_description', '开户行');
$this->divider('支付宝收款');
$this->text('alipay.user_name', '收款人名称');
$this->text('alipay.ali_name', '收款账号');
$this->image('alipay.image', '收款码')
->move('dealer/settings/'.Carbon::now()->toDateString())
->saveFullUrl()
->removable(false)
->retainable()
->autoUpload();
$this->divider('微信收款');
$this->text('wechat.user_name', '收款人名称');
$this->text('wechat.wechat_name', '微信ID');
$this->image('wechat.image', '收款码')
->move('dealer/settings/'.Carbon::now()->toDateString())
->saveFullUrl()
->removable(false)
->retainable()
->autoUpload();
// })->saving(function ($v) {
// // 转化为json格式存储
// dd($v);
// return json_encode($v);
// })->customFormat(function () use ($dealerSettings) {
// return $dealerSettings['pay_info']??[];
// });
}
public function default()
{
$dealerSettings = (array) Setting::where('key', 'dealer')->value('value');
return [
'fee_rate'=>$dealerSettings['fee_rate'] ?? '',
'bank'=>$dealerSettings['bank'] ?? [],
'alipay'=>$dealerSettings['alipay'] ?? [],
'wechat' =>$dealerSettings['wechat'] ?? [],
'purchase_rules'=>$dealerSettings['purchase_rules'] ?? [],
];
}
}

View File

@ -220,6 +220,9 @@ class DealerOrder extends Model
} else {
$payInfo = [
//todo-公司的收款信息
'bank'=>app_settings('dealer.bank'),
'alipay'=>app_settings('dealer.alipay'),
'wechat'=>app_settings('dealer.wechat'),
];
}
} elseif ($this->isPending() || $this->isCancelled()) {//如果是已取消订单或者待确认订单不显示收款信息

View File

@ -176,6 +176,45 @@ class AppSettingSeeder extends Seeder
'dealer' => [
'value' => [
'fee_rate' => '6', // 手续费比例(百分比)
'purchase_rules'=>[
['price' => '1', 'rate' => '2.00'],
['price' => '2', 'rate' => '3.00'],
['price' => '3', 'rate' => '4.00'],
['price' => '5', 'rate' => '5.00'],
['price' => '8', 'rate' => '6.00'],
['price' => '11', 'rate' => '7.00'],
['price' => '15', 'rate' => '8.00'],
['price' => '20', 'rate' => '9.00'],
['price' => '30', 'rate' => '10.00'],
['price' => '40', 'rate' => '11.00'],
['price' => '55', 'rate' => '12.00'],
['price' => '70', 'rate' => '13.00'],
['price' => '90', 'rate' => '14.00'],
['price' => '115', 'rate' => '15.00'],
['price' => '145', 'rate' => '16.00'],
['price' => '185', 'rate' => '17.00'],
['price' => '230', 'rate' => '18.00'],
['price' => '280', 'rate' => '19.00'],
['price' => '340', 'rate' => '20.00'],
['price' => '400', 'rate' => '21.00'],
['price' => '500', 'rate' => '22.00'],
],
'bank'=>[ //银行卡收款
'user_name' => '收款人名称', //收款人
'bank_name' => '银行名称',
'bank_number' => '银行卡号',
'bank_description'=>'开户行',
],
'alipay' => [ //支付宝收款
'user_name' => '收款人姓名',
'ali_name'=> '收款账号',
'image' => '',
],
'wechat' => [ //微信收款
'user_name' => '收款人姓名',
'wechat_name'=>'微信id',
'image' => '',
],
],
'remarks' => '经销商配置',
],