jh-admin/addon/store/shop/controller/Config.php

71 lines
3.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* SaaSMall商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 成都SAAS云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.gobuysaas.com
* =========================================================
*/
namespace addon\store\shop\controller;
use addon\store\model\Config as ConfigModel;
use app\shop\controller\BaseShop;
/**
* 门店设置控制器
*/
class Config extends BaseShop
{
protected $replace = []; //视图输出字符串内容替换 相当于配置文件中的'view_replace_str'
public function __construct()
{
parent::__construct();
$this->replace = [
'STORE_IMG' => __ROOT__ . '/addon/store/shop/view/public/img',
'STORE_JS' => __ROOT__ . '/addon/store/shop/view/public/js',
'STORE_CSS' => __ROOT__ . '/addon/store/shop/view/public/css',
];
}
/**
* 门店结算周期配置
*/
public function index()
{
$config_model = new ConfigModel();
if (request()->isAjax()) {
//门店结算与提现设置
$withdraw_config = [
'is_settlement' => input('is_settlement', 0), // 是否进行门店结算
'period_type' => input('period_type', 4), // 结算方式 1 按天 2. 按周 3. 按月 4. 门店申请结算
'settlement_rate' => input('settlement_rate', 0), // 结算比率
'settlement_cost' => input('settlement_cost', ''), // 结算成本控制 coupon,point,balance,fenxiao_commission
'is_withdraw' => input('is_withdraw', 0), // 是否允许提现
'is_audit' => input('is_audit', 0), // 是否需要提现审核
'withdraw_type' => input('withdraw_type', ''), // 可提现账户类型 wechatalipay bank
'withdraw_least' => input('withdraw_least', 0), // 提现最低金额
];
$config_model->setStoreWithdrawConfig($this->site_id, $withdraw_config);
$business_config = [
'store_business' => input('store_business', 'shop'), // 门店运营模式 shop店铺整体运营 store连锁门店运营模式
'is_allow_change' => input('is_allow_change', 1), // 是否允许切换门店
'confirm_popup_control' => input('confirm_popup_control', 0), // 门店确认弹窗
'store_auth' => input('store_auth', ''), // 门店控制权限
'is_goods_auditing' => input('is_goods_auditing', 0), // 是否门店商品审核
'open_store' => input('open_store', 0), // 是否开启门店能力
];
$res = $config_model->setStoreBusinessConfig($this->site_id, $business_config);
return $res;
} else {
$business_config = $config_model->getStoreBusinessConfig($this->site_id)['data']['value'];
$this->assign('business_config', $business_config);
$withdraw_config = $config_model->getStoreWithdrawConfig($this->site_id)['data']['value'];
$this->assign('withdraw_config', $withdraw_config);
return $this->fetch("config/index", [], $this->replace);
}
}
}