优化主理人后台逻辑

This commit is contained in:
qinzexin 2025-06-27 18:37:08 +08:00
parent a57eb0ff06
commit 28c957163b
21 changed files with 327 additions and 21 deletions

View File

@ -62,7 +62,7 @@ class Index extends Backend
protected $error_auth = false;
protected $qSwitch = true;
protected $qFields = ["user_id","name","address_detail","type","tel","legal_entity","shop_apply_id"];
protected $qFields = ["images","image","logo","user_id","name","address_detail","type","tel","legal_entity","shop_apply_id"];
protected function checkAssemblyParameters(){

View File

@ -24,6 +24,13 @@ class ShopApply extends Backend
$this->model = new \app\admin\model\manystore\ShopApply;
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("default_data_json", json_encode( [
// 'name' => '默认机构名称',
'logo' => config("site.shop_default_image"),
'image' => config("site.shop_default_timage"),
'images' => config("site.shop_default_images"),
], JSON_UNESCAPED_UNICODE) );
}

View File

@ -3,6 +3,10 @@
namespace app\admin\controller\user\invoice;
use app\common\controller\Backend;
use think\Db;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 个人发票抬头管理
@ -73,4 +77,109 @@ class Header extends Backend
return $this->view->fetch();
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$params["is_default"] = $params["is_default"] ?? '0';
if($params["is_default"] == '1'){
$this->model::where('user_id',$params['user_id'])->update(['is_default'=>'0']);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$params["is_default"] = $params["is_default"] ?? '0';
if($params["is_default"] == '1'){
$this->model::where('user_id',$params['user_id'])->update(['is_default'=>'0']);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@ -203,7 +203,7 @@ return [
'Third group' => '三级管理组',
'Second group 2' => '二级管理组2',
'Third group 2' => '三级管理组2',
'Dashboard tips' => '用于展示当前系统中的统计数据、统计报表及重要实时数据',
'Dashboard tips' => '',
'Config tips' => '可以在此增改系统的变量和分组,也可以自定义分组和变量',
'Category tips' => '分类类型请在常规管理->系统配置->字典配置中添加',
'Attachment tips' => '主要用于管理上传到服务器或第三方存储的数据',

View File

@ -102,7 +102,7 @@
</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-logo" class="form-control" size="50" name="shop[logo]" type="text" value="" placeholder="请上传{:__('logo')}" >
<input id="c-logo" class="form-control" size="50" name="shop[logo]" type="text" value="{$q_logo}" placeholder="请上传{:__('logo')}" >
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-logo" class="btn btn-danger plupload cropper" data-input-id="c-logo" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-logo"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-logo" class="btn btn-primary fachoose" data-input-id="c-logo" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
@ -117,7 +117,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" class="form-control" size="50" name="shop[image]" type="text" value="" placeholder="请上传{:__('Image')}" >
<input id="c-image" class="form-control" size="50" name="shop[image]" type="text" value="{$q_image}" placeholder="请上传{:__('Image')}" >
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload cropper" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
@ -131,7 +131,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" class="form-control" name="shop[images]" type="text" value="" placeholder="请上传{:__('Images')}">
<input id="c-images" class="form-control" name="shop[images]" type="text" value="{$q_images}" placeholder="请上传{:__('Images')}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" data-maxcount="6" id="plupload-images" class="btn btn-danger plupload cropper" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" data-maxcount="6" id="fachoose-imagess" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>

View File

@ -27,3 +27,6 @@
</div>
</div>
</div>
<script>
var default_data_json = {$default_data_json};
</script>

View File

@ -42,6 +42,8 @@
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text">
</div>
</div>
<span id="enterprise_data">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -72,6 +74,10 @@
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text">
</div>
</div>
</span>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -45,6 +45,9 @@
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text" value="{$row.invoice_header|htmlentities}">
</div>
</div>
<span id="enterprise_data">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -75,6 +78,9 @@
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text" value="{$row.enterprise_phone|htmlentities}">
</div>
</div>
</span>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -219,10 +219,22 @@ class ManystoreShop extends BaseModel
if($id && $this->checkFull($id)){
//必要信息已完善
return '<div class="alert alert-success-light">
<b >必要展示信息已完善!可正常上架课程!</b></div>';
<!--增加关闭按钮-->
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<b >必要展示信息已完善!可正常上架活动!</b></div>';
}else{
//必要信息未完善
return "<div class='alert alert-danger-light'><b>必要展示信息未完善,请先在机构完善展示信息</b><br><br>
return "<div class='alert alert-danger-light'>
<!--增加关闭按钮-->
<button type='button' class='close' data-dismiss='alert'>
<span aria-hidden='true'>&times;</span>
<span class='sr-only'>Close</span>
</button>
<b>必要展示信息未完善,请先在机构完善展示信息</b><br><br>
<span>必要展示信息为: </span><br><br><br>
<span>1:地址信息:包括详细地址、所在城市、所在省、所在市、所在县、经纬度</span><br>
@ -232,7 +244,7 @@ class ManystoreShop extends BaseModel
<span>5:环境图片</span><br>
<span>6:服务电话</span><br>
<span>7:详情</span><br><br><br>
<b>请您确保上述信息均已完善后才能正常上架课程</b><br><br>
<b>请您确保上述信息均已完善后才能正常上架活动</b><br><br>
<b>若已完善请您刷新页面。 </b><br><br>
</div>
";

View File

@ -21,7 +21,7 @@ class ShopApply extends BaseModel
protected $name = 'manystore_shop_apply';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
protected $autoWriteTimestamp = true;
// 定义时间戳字段名
protected $createTime = "create_time";

View File

@ -107,6 +107,11 @@ class Header extends ManystoreBase
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$params["is_default"] = $params["is_default"] ?? '0';
if($params["is_default"] == '1'){
$this->model::where('user_id',$params['user_id'])->update(['is_default'=>'0']);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
@ -160,6 +165,11 @@ class Header extends ManystoreBase
}
$params['user_id'] = SHOP_USER_ID;
$params["is_default"] = $params["is_default"] ?? '0';
if($params["is_default"] == '1'){
$this->model::where('user_id',$params['user_id'])->update(['is_default'=>'0']);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {

View File

@ -171,7 +171,7 @@ return [
'Third group' => '三级管理组',
'Second group 2' => '二级管理组2',
'Third group 2' => '三级管理组2',
'Dashboard tips' => '用于展示当前系统中的统计数据、统计报表及重要实时数据',
'Dashboard tips' => '',
'Config tips' => '提示:修改相关配置后,点击【确认】才会保存生效',
'Category tips' => '用于统一管理网站的所有分类,分类可进行无限级分类,分类类型请在常规管理->系统配置->字典配置中添加',
'Attachment tips' => '主要用于管理上传到服务器或第三方存储的数据',

View File

@ -155,7 +155,7 @@
{:build_heading(null, false)}
<ul class="nav nav-tabs">
<li class="active"><a href="#one" data-toggle="tab">{:__('Dashboard')}</a></li>
<li><a href="#two" data-toggle="tab">{:__('Custom')}</a></li>
<!-- <li><a href="#two" data-toggle="tab">{:__('Custom')}</a></li>-->
</ul>
</div>
<div class="panel-body">
@ -164,6 +164,11 @@
<div class="alert alert-success-light">
<!--增加关闭按钮-->
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<b>温馨提示:</b><br><br>
尊敬的用户您好,欢迎登录我们的后台管理系统!在您开始使用各项功能之前,我们特此提醒您注意以下几点重要事项:<br>
<br>
@ -384,13 +389,13 @@
</div>
</div>
</div>
<div class="tab-pane fade" id="two">
<div class="row">
<div class="col-xs-12">
{:__('Custom zone')}
</div>
</div>
</div>
<!-- <div class="tab-pane fade" id="two">-->
<!-- <div class="row">-->
<!-- <div class="col-xs-12">-->
<!-- {:__('Custom zone')}-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>

View File

@ -77,6 +77,9 @@
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text" value="{$row.invoice_header|htmlentities}">
</div>
</div>
<span id="enterprise_data">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -107,6 +110,8 @@
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text" value="{$row.enterprise_phone|htmlentities}">
</div>
</div>
</span>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -36,6 +36,10 @@
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text">
</div>
</div>
<span id="enterprise_data">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -66,6 +70,10 @@
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text">
</div>
</div>
</span>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -36,6 +36,10 @@
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text" value="{$row.invoice_header|htmlentities}">
</div>
</div>
<span id="enterprise_data">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -66,6 +70,9 @@
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text" value="{$row.enterprise_phone|htmlentities}">
</div>
</div>
</span>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -25,7 +25,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
fixedColumns: true,
fixedRightNumber: 2,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
@ -84,7 +84,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
// {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'operate', title: __('Operate'),width:180, table: table , buttons: [
{name: 'url',
text: '查看小程序链接',

View File

@ -112,7 +112,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'manystore/index/add?user_id='+row.user_id
+ '&type='+row.type
+ '&name=' + (row.name || row.realname)
+ '&logo='+encodeURIComponent( row.user.avatar ? row.user.avatar : default_data_json.logo)
+ '&image='+ encodeURIComponent(default_data_json.image)
+ '&images='+ encodeURIComponent(default_data_json.images)
+ '&name=' + encodeURIComponent(row.name || row.realname)
+ '&tel='+row.mobile
+ '&shop_apply_id='+row.id
+ '&address_detail='+row.address + '&legal_entity='+row.realname;

View File

@ -61,9 +61,50 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
bindevent: function () {
shop_apply.listen();
Form.api.bindevent($("form[role=form]"));
}
}
};
var shop_apply = {
listen:function () {
this.setOfflineType($("select[name='row[head_type]']").val());
this.offlineListen();
},
offlineListen:function () {
var that = this;
// console.log($("input:radio[name='row[address_type]']").val())
// this.setOfflineType($("input:radio[name='row[address_type]']").val());
// $("input:radio[name='row[head_type]']").change(function (){
//
// console.log(1111111);
// that.setOfflineType($(this).val());
// });
//改成下拉
$("select[name='row[head_type]']").change(function (){
that.setOfflineType($(this).val());
});
},
setOfflineType:function (val) {
switch (val) {
case 'personal': //个人
$('#enterprise_data').hide();
break;
case 'corporate': //企业
$('#enterprise_data').show();
break;
}
},
}
return Controller;
});

View File

@ -77,9 +77,50 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
bindevent: function () {
shop_apply.listen();
Form.api.bindevent($("form[role=form]"));
}
}
};
var shop_apply = {
listen:function () {
this.setOfflineType($("select[name='row[head_type]']").val());
this.offlineListen();
},
offlineListen:function () {
var that = this;
// console.log($("input:radio[name='row[address_type]']").val())
// this.setOfflineType($("input:radio[name='row[address_type]']").val());
// $("input:radio[name='row[head_type]']").change(function (){
//
// console.log(1111111);
// that.setOfflineType($(this).val());
// });
//改成下拉
$("select[name='row[head_type]']").change(function (){
that.setOfflineType($(this).val());
});
},
setOfflineType:function (val) {
switch (val) {
case 'personal': //个人
$('#enterprise_data').hide();
break;
case 'corporate': //企业
$('#enterprise_data').show();
break;
}
},
}
return Controller;
});

View File

@ -59,9 +59,52 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
bindevent: function () {
shop_apply.listen();
Form.api.bindevent($("form[role=form]"));
}
}
};
var shop_apply = {
listen:function () {
this.setOfflineType($("select[name='row[head_type]']").val());
this.offlineListen();
},
offlineListen:function () {
var that = this;
// console.log($("input:radio[name='row[address_type]']").val())
// this.setOfflineType($("input:radio[name='row[address_type]']").val());
// $("input:radio[name='row[head_type]']").change(function (){
//
// console.log(1111111);
// that.setOfflineType($(this).val());
// });
//改成下拉
$("select[name='row[head_type]']").change(function (){
that.setOfflineType($(this).val());
});
},
setOfflineType:function (val) {
switch (val) {
case 'personal': //个人
$('#enterprise_data').hide();
break;
case 'corporate': //企业
$('#enterprise_data').show();
break;
}
},
}
return Controller;
});