多样青春夜校

对接可对每个已对接流程接口
部分接口微调
改造课程录入流程(进行中)
This commit is contained in:
15090180611 2024-11-28 18:47:18 +08:00
parent a2198685da
commit 4c5f3f4b38
33 changed files with 1705 additions and 498 deletions

View File

@ -38,7 +38,7 @@ class Index extends Backend
//不用审核允许修改的字段
protected $no_auth_fields = [ "name",'image','images','address_city','province',"city","district","address","address_detail",
protected $no_auth_fields = [ "yyzzdm","yyzz_images","front_idcard_image", "reverse_idcard_image","name",'image','images','address_city','province',"city","district","address","address_detail",
"longitude","latitude","content","desc"
];
@ -221,9 +221,9 @@ class Index extends Backend
protected function updateCheck($id,$params=[],$shop=[],$row=null){
if($shop && $row){
if(!$this->no_auth_fields_check($shop,$row)){
// if(!$this->no_auth_fields_check($shop,$row)){
return true;
}
// }
}
// 课程存在未完成订单则不允许操作

View File

@ -56,6 +56,12 @@ class ClassesLib extends Backend
$this->view->assign("hotList", $this->model->getHotList());
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
$this->view->assign("specStatusList", (new \app\admin\model\school\classes\ClassesSpec)->getStatusList());
}
@ -205,144 +211,37 @@ class ClassesLib extends Backend
protected function update_check(&$params,$row=null)
{
try {
$classesLib = new \app\common\model\school\classes\ClassesLib();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->classesCheck($params,$shop_id=null,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
$shop_id = $params["shop_id"];
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
$this->error("店铺不存在");
}
if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))$this->error("对方的认证信息未完善,请您先去帮忙完善!");
$params["manystore_id"] = $manystore["id"];
//验证老师id
$teacher_id = $params['teacher_id'];
$teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find();
if(!$teacher){
$this->error("老师不存在");
}
if(!$teacher["user_id"]){
$this->error("当前老师没有前端用户!请换一个!");
}
//老师与当前机构id不一致
if($teacher["manystore_id"] != $manystore["id"]){
$this->error("当前老师与当前机构不匹配,请换一个老师!");
}catch (\Exception $e){
$this->error($e->getMessage());
}
$params["user_id"] = $teacher["user_id"];
//课时必须大于等于1
if($params["classes_num"] < 1) $this->error("课时必须大于等于1");
if($params["price"] < 0) $this->error("售价必须大于0");
//独立地点需传定位信息
if($params["address_type"] == "2"){
if(empty($params["address_city"])
|| empty($params["province"])
|| empty($params["city"])
|| empty($params["district"])
|| empty($params["longitude"])
|| empty($params["latitude"])
|| empty($params["address"])
|| empty($params["address_detail"])
) $this->error("独立地点需传定位信息");
}else{
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
$this->error("店铺不存在");
}
if(empty($shop["address_city"])
|| empty($shop["province"])
|| empty($shop["city"])
|| empty($shop["district"])
|| empty($shop["longitude"])
|| empty($shop["latitude"])
|| empty($shop["address"])
|| empty($shop["address_detail"])
) $this->error("当前机构地址并未完善,请在机构处完善!");
$params["address_city"] = $shop["address_city"];
$params["province"] = $shop["province"];
$params["city"] = $shop["city"];
$params["district"] = $shop["district"];
$params["longitude"] = $shop["longitude"];
$params["latitude"] = $shop["latitude"];
$params["address"] = $shop["address"];
$params["address_detail"] = $shop["address_detail"];
//address
// var_dump($params);
}
//特有认证判断
$this->authClasses($params,$row);
// var_dump($row);die;
//收费免费判断
if($params["price"]==0){
$params["feel"] = "1";
}else{
//个人认证无法下付费课程
$shop = ManystoreShop::where("id",$shop_id)->find();
if($shop["type"]=="1"){
$this->error("这个机构属于个人认证,无法发布付费课程!");
}
$params["feel"] = "0";
}
//更新
if($row){
$this->have_auth = false;
if($this->need_auth){
//判断更新的变动数据
$this->no_auth_fields_check($params,$row);
if($this->have_auth){
$params['status'] = "3";
$params['auth_status'] = "0";
}
}
$this->updateCheck($row->id,$params,$row);
//名称title不能与其他课程重复
$check_title = $this->model->where('id','<>',$row["id"])->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}else{
//新增
//新增
$params["add_type"] = '2';
$params["add_id"] = $this->auth->id;
//名称title不能重复
$check_title = $this->model->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}
//如果是上架,判断是否拥有课时规格,没有则无法上架
if($params["status"]=="1"){
if(!$row)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count();
if(!$check_spec)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
}
}
@ -419,6 +318,74 @@ class ClassesLib extends Backend
$this->success();
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function addnew()
{
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);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_need_after', $data);
}
if($this->success_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_success_after', $data);
}
if($this->error_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_fail_after', $data);
}
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 编辑
*

View File

@ -133,80 +133,20 @@ class ClassesSpec extends Backend
protected function update_check(&$params,$row=null)
{
//开始和结束时间不能为空
$start_time = $params["start_time"];
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
$this->error("请选择开始和结束时间");
}
//转化时间戳
$start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
$end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
$this->error("结束时间不能小于开始时间");
//限定人数必须大于0
try {
(new \app\common\model\school\classes\ClassesSpec)->specCheck($params,$shop_id=null,$row);
}catch (\Exception $e){
$this->error($e->getMessage());
}
//结束时间不能是已经过去的时间
$now_time = time();
if($end_time<=$now_time){
$this->error("结束时间不能是已经过去的时间");
}
$orderTimeTableName = $this->model->getWithAlisaName();
//修改
if($row){
$this->updateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->where("id","<>",$row->id)->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
$this->updateCheck($row->id,$params,$row);
}else{
//新增
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}

View File

@ -26,8 +26,8 @@ return [
'Yyzz_images' => '营业执照照片(个人认证不需要)',
'hidden' => '禁用',
'Front_idcard_image' => '身份证面',
'Reverse_idcard_image' => '身份证面',
'Front_idcard_image' => '身份证人像面',
'Reverse_idcard_image' => '身份证国徽面',
'Tel' => '服务电话',
'Content' => '详情',
'Status' => '账号状态',

View File

@ -3,9 +3,10 @@
return [
'Classes_lib_id' => '课程id',
'Name' => '规格名',
'Time' => '课时开始结束时间',
'Start_time' => '开始时间',
'End_time' => '结束时间',
'Limit_num' => '本课时限定人数0不限制',
'Limit_num' => '本课时限定人数',
'Sign_num' => '已报名人数',
'Verification_num' => '已核销人数',
'Status' => '状态',

View File

@ -267,36 +267,36 @@
<input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <div class="radio">-->
<!-- {foreach name="statusList" item="vo"}-->
<!-- <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label> -->
<!-- {/foreach}-->
<!-- </div>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="authStatusList" item="vo"}
<label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <div class="radio">-->
<!-- {foreach name="authStatusList" item="vo"}-->
<!-- <label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> -->
<!-- {/foreach}-->
<!-- </div>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-reason" class="form-control" name="row[reason]" type="text" value="">
</div>
</div>
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-reason" class="form-control" name="row[reason]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->

View File

@ -0,0 +1,419 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Manystore_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-manystore_id" data-rule="required" data-source="manystore/index" data-field="id" class="form-control selectpage" name="row[manystore_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$q_shop_id}">
<span style="color: red">
(没找到机构则点击按钮创建机构后重新下拉框选机构)
<a href="javascript:;" data-url="manystore/index/add" class="btn btn-success btn-changeuser {:$auth->check('manystore/index/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('讲师id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-teacher_id" data-rule="required" data-source="school/classes/teacher/index" data-field="name" class="form-control selectpage" name="row[teacher_id]" type="text" value="{$q_teacher_id}">
<span style="color: red">
(没找到讲师则点击按钮创建讲师后重新下拉框选讲师)
<a href="javascript:;" data-url="school/classes/teacher/add?shop_id={$q_shop_id}" class="btn btn-success btn-changeuser {:$auth->check('school/classes/teacher/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_cate_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_cate_ids" data-rule="required" data-source="school/classes/cate/index" data-multiple="true" class="form-control selectpage" name="row[classes_cate_ids]" type="text" value="">
<span style="color: red">
(没找到分类则点击按钮创建分类后重新下拉框选分类)
<a href="javascript:;" data-url="school/classes/cate/index" class="btn btn-success btn-changeuser {:$auth->check('school/classes/cate/index')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_label_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_label_ids" data-rule="required" data-source="school/classes/label/index" data-multiple="true" class="form-control selectpage" name="row[classes_label_ids]" type="text" value="">
<span style="color: red">
(没找到标签则点击按钮创建标签后重新下拉框选标签)
<a href="javascript:;" data-url="school/classes/label/index" class="btn btn-success btn-changeuser {:$auth->check('school/classes/label/index')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Self_label_tag')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-self_label_tag" class="form-control" data-role="tagsinput" name="row[self_label_tag]" type="text">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Add_type')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <select id="c-add_type" class="form-control selectpicker" name="row[add_type]">-->
<!-- {foreach name="addTypeList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="2"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Add_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-add_id" data-rule="required" data-source="add/index" class="form-control selectpage" name="row[add_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" class="form-control" data-rule="required" name="row[title]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Headimage')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-headimage" class="form-control" data-rule="required" size="50" name="row[headimage]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-headimage" class="btn btn-danger faupload" data-input-id="c-headimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-headimage" class="btn btn-primary fachoose" data-input-id="c-headimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-headimage"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-headimage"></ul>
</div>
</div>
<div class="form-group">
<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" data-rule="required" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" 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>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="in"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_num" class="form-control" data-rule="required" name="row[classes_num]" type="number">
<span style="color: red">(填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数)</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('课时规格信息')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[spec]" data-template="testtpl" data-tag="tr">
<tr>
<td>规格名</td>
<td>开始结束时间</td>
<td>限定人数</td>
<!-- <td>权重</td>-->
<td>上架状态</td>
<td></td>
</tr>
<tr>
<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></td>
</tr>
<textarea name="row[spec]" id="spec" class="form-control hide" cols="30" rows="5">[{"name":"{:date('m-d号')} 上午课(名师巡讲!)","time":"{:date('Y/m/d 0:01')} - {:date('Y/m/d H:i')}","limit_num":"30","weigh":"0","status":"1"}]</textarea>
</table>
<span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,后续有变更将触发审核机制!)</span>
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td><input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="20" placeholder="课时名"></td>
<td>
<input type="text" name="row[<%=name%>][<%=index%>][time]" data-rule="required" class="form-control datetimerange" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" value="<%=row['time']%>" size="20" />
<!--<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">-->
</td>
<td><input type="text" name="row[<%=name%>][<%=index%>][limit_num]" data-rule="required" class="form-control" value="<%=row['limit_num']%>" placeholder="课时限制人数" size="2" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>
<!-- <td><input type="text" name="row[<%=name%>][<%=index%>][weigh]" data-rule="required" class="form-control" value="<%=row['weigh']%>" size="2" placeholder="课时排序权重" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>-->
<td>
<select id="c-status" class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="specStatusList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['status']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></td>
</tr>
</script>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_type')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
</div>
</div>
</div>
<div id="c_position">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="" >
<input type="hidden" id="city" name="row[city]" value="" >
<input type="hidden" id="district" name="row[district]" value="" >
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address" class="form-control form-control"
data-lat-id="c-latitude" data-lng-id="c-longitude" readonly data-input-id="c-address" data-toggle="addresspicker" name="row[address]" value="" type="text" placeholder="请地图选址。如调起地图失败请检查插件《地图位置(经纬度)选择》是否安装">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="" placeholder="请输入{:__('Address_detail')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="">
</div>
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_date_text')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_date_text" class="form-control" name="row[classes_date_text]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_time_text')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_time_text" class="form-control" name="row[classes_time_text]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Notice')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-notice" class="form-control editor" rows="5" name="row[notice]" cols="50"></textarea>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('虚拟参与人数')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_people" class="form-control" name="row[virtual_people]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sale')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sale" class="form-control" name="row[sale]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
<span style="color: red">( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! )</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Underline_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-underline_price" class="form-control" step="0.01" name="row[underline_price]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_collect')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="0">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <div class="radio">-->
<!-- {foreach name="statusList" item="vo"}-->
<!-- <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label> -->
<!-- {/foreach}-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <div class="radio">-->
<!-- {foreach name="authStatusList" item="vo"}-->
<!-- <label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> -->
<!-- {/foreach}-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-reason" class="form-control" name="row[reason]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-auth_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[auth_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-recommend" class="form-control selectpicker" name="row[recommend]">
{foreach name="recommendList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Hot')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-hot" class="form-control selectpicker" name="row[hot]">
{foreach name="hotList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('New')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-new" class="form-control selectpicker" name="row[new]">
{foreach name="newList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Selfhot')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-selfhot" class="form-control selectpicker" name="row[selfhot]">
{foreach name="selfhotList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@ -177,6 +177,8 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_num" class="form-control" data-rule="required" name="row[classes_num]" type="number" value="{$row.classes_num|htmlentities}">
<span style="color: red">(填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数)</span>
</div>
</div>
@ -264,12 +266,12 @@
<textarea id="c-notice" class="form-control editor" rows="5" name="row[notice]" cols="50">{$row.notice|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number" value="{$row.virtual_num|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number" value="{$row.virtual_num|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sale')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->

View File

@ -21,6 +21,10 @@
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/classes_lib/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" data-url="school/classes/classes_lib/addnew" class="btn btn-success btn-changeuser {:$auth->check('school/classes/classes_lib/addnew')?'':'hide'}" title="{:__('新版添加')}" ><i class="fa fa-plus"></i> {:__('新版添加')}(开发中)</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/classes_lib/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('school/classes/classes_lib/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>

View File

@ -9,25 +9,34 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text">
<input id="c-name" class="form-control" data-rule="required" name="row[name]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
<input id="c-time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[time]" type="text" value="{:date('Y-m-d 0:01')} - {:date('Y-m-d H:i')}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="0">
<input id="c-limit_num" class="form-control" data-rule="required" name="row[limit_num]" type="number" value="0">
</div>
</div>
<!-- <div class="form-group">-->

View File

@ -9,25 +9,34 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
<input id="c-name" class="form-control" data-rule="required" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):''}">
<input id="c-time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[time]" type="text" value="{:$row.start_time?datetime($row.start_time):''} - {:$row.end_time?datetime($row.end_time):''}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):''}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):''}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="{$row.limit_num|htmlentities}">
<input id="c-limit_num" class="form-control" data-rule="required" name="row[limit_num]" type="number" value="{$row.limit_num|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->

View File

@ -111,10 +111,12 @@ class Classes extends Base
* @ApiRoute(/api/school/classes/people)
* @ApiMethod(GET)
* @ApiParams(name = "id", type = "int",required=true,description = "课程id")
* @ApiParams(name = "have_real", type = "int",required=true,description = "是否只查真實的 1是 0否")
* @ApiReturn({ unpaid_user_data 参与中 paid_user_data 已报名 })
*/
public function people(){
$id = $this->request->get('id/d','');
$have_real = $this->request->get('have_real/d','');
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
@ -123,7 +125,7 @@ class Classes extends Base
}
try {
$res = $this->model->virtualParticipants($id,$user_id);
$res = $this->model->virtualParticipants($id,$user_id,$have_real);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);

View File

@ -49,6 +49,7 @@ class Order extends Base
try {
$res = OrderModel::getDetail($id,$this->classes_lib_ids);
if(!$res)throw new \Exception('您无操作权限!',40003);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);

View File

@ -23,6 +23,12 @@ class BaseModel extends Model
//更新数据是否需要触发审核开关
public $have_auth = false;
//更新数据是否需要触发审核开关
public $need_auth = false;
public $success_auth = false;
public $error_auth = false;

View File

@ -368,7 +368,7 @@ class ManystoreShop extends BaseModel
*
* @throws \think\exception\DbException
*/
public function getDefaultPassword($type,$user_id,$params){
public static function getDefaultPassword($type,$user_id,$params){
$user = User::get($user_id);
$defaultPassword = null;
switch ($type) {

View File

@ -314,7 +314,8 @@ class Message extends BaseModel
];
$alisa = (new self)->getWithAlisaName();
$sort = "field({$alisa}.type,'1','2') asc,{$alisa}.weigh desc,{$alisa}.id desc";
$sort = "{$alisa}.weigh desc,{$alisa}.id desc";
// $sort = "field({$alisa}.type,'1','2') asc,{$alisa}.weigh desc,{$alisa}.id desc";
$serch_where = ["to_id"=>$to_id,'platform'=>"user",'status'=>$status,'keywords'=>$keywords,"mini_type"=>$mini_type,"type"=>$type];
// if($type)$serch_where['type'] = $type;
return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field);

View File

@ -7,6 +7,7 @@ use app\common\model\BaseModel;
use app\common\model\dyqc\ManystoreShop;
use app\common\model\school\classes\lib\Spec;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
@ -260,6 +261,21 @@ class ClassesLib extends BaseModel
public function setImagesAttr($value, $data)
{
$imagesArray = $value;
if (!empty($value) && is_array($value)) {
//转成逗号拼接字符串
$imagesArray = implode(',', $value);
}
return $imagesArray;
}
public function manystore()
{
return $this->belongsTo('app\admin\model\Manystore', 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
@ -345,7 +361,7 @@ class ClassesLib extends BaseModel
* @param $id
*
*/
public function virtualParticipants($id,$user_id=0){
public function virtualParticipants($id,$user_id=0,$have_real=false){
//虚拟用户生成数量
$v_num = 10;
$unpaid_user_data = $paid_user_data = [];
@ -415,7 +431,7 @@ $user_unpaid_order = $user_paid_order =null;
//计算需要生成的虚拟用户数量
$v_num = $v_num - count($user_ids);
if($v_num<0)$v_num =0;
if($v_num){
if($v_num && !$have_real){
$unpaid_user = VirtualUser::where("classes_lib_id",$id)->where("jointype",'1')->order("time desc")->limit($v_num)->select();
$unpaid_user_data = array_merge($unpaid_user_data,$unpaid_user);
}
@ -443,7 +459,7 @@ $user_unpaid_order = $user_paid_order =null;
$v_num = 10;
$v_num = $v_num - count($user_ids);
if($v_num<0)$v_num =0;
if($v_num){
if($v_num && !$have_real){
$unpaid_user = VirtualUser::where("classes_lib_id",$id)->where("havetype",'1')->order("time desc")->limit($v_num)->select();
$paid_user_data = array_merge($paid_user_data,$unpaid_user);
}
@ -758,7 +774,7 @@ $user_unpaid_order = $user_paid_order =null;
foreach ($order as $row){
$update = $classes_lib->toArray();
$update_data = $row->checkAssemblyParameters($update,["id","createtime","updatetime"]);
$update_data = $row->checkAssemblyParameters($update,["id","status","auth_status","createtime","updatetime"]);
$row->save($update_data);
}
//同步更新订单课时信息
@ -767,7 +783,7 @@ $user_unpaid_order = $user_paid_order =null;
$hourorders = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec->id)->select();
foreach ($hourorders as $hourorder){
$update = $spec->toArray();
$update_data = $hourorder->checkAssemblyParameters($update,["id","createtime","updatetime"]);
$update_data = $hourorder->checkAssemblyParameters($update,["id","status","auth_status","createtime","updatetime"]);
$hourorder->save($update_data);
}
}
@ -797,6 +813,9 @@ $user_unpaid_order = $user_paid_order =null;
/**设置收藏
* @param $id
* @param int $user_id
@ -847,5 +866,169 @@ $user_unpaid_order = $user_paid_order =null;
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在未完成订单则不允许操作
$order = Order::where("classes_lib_id",$id)->where("status","in","0,3")->find();
if($order)$this->error("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!");
// 课程存在售后订单则不允许操作
}
//不用审核允许修改的字段
public $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"];
public function classesCheck(&$params,$shop_id=null,$row=null)
{
$params["auth_status"] = $params["auth_status"] ?? '0';
$params["status"] = $params["status"] ?? '3';
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
throw new \Exception("店铺不存在");
}
if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))throw new \Exception("对方的认证信息未完善,请您先去帮忙完善!");
$params["manystore_id"] = $manystore["id"];
//验证老师id
$teacher_id = $params['teacher_id'];
$teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find();
if(!$teacher){
throw new \Exception("老师不存在");
}
if(!$teacher["user_id"]){
throw new \Exception("当前老师没有前端用户!请换一个!");
}
//老师与当前机构id不一致
if($teacher["manystore_id"] != $manystore["id"]){
throw new \Exception("当前老师与当前机构不匹配,请换一个老师!");
}
$params["user_id"] = $teacher["user_id"];
//课时必须大于等于1
if($params["classes_num"] < 1) throw new \Exception("课时必须大于等于1");
if($params["price"] < 0) throw new \Exception("售价必须大于0");
//独立地点需传定位信息
if($params["address_type"] == "2"){
if(empty($params["address_city"])
|| empty($params["province"])
|| empty($params["city"])
|| empty($params["district"])
|| empty($params["longitude"])
|| empty($params["latitude"])
|| empty($params["address"])
|| empty($params["address_detail"])
) throw new \Exception("独立地点需传定位信息");
}else{
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
throw new \Exception("店铺不存在");
}
if(empty($shop["address_city"])
|| empty($shop["province"])
|| empty($shop["city"])
|| empty($shop["district"])
|| empty($shop["longitude"])
|| empty($shop["latitude"])
|| empty($shop["address"])
|| empty($shop["address_detail"])
) throw new \Exception("当前机构地址并未完善,请在机构处完善!");
$params["address_city"] = $shop["address_city"];
$params["province"] = $shop["province"];
$params["city"] = $shop["city"];
$params["district"] = $shop["district"];
$params["longitude"] = $shop["longitude"];
$params["latitude"] = $shop["latitude"];
$params["address"] = $shop["address"];
$params["address_detail"] = $shop["address_detail"];
//address
// var_dump($params);
}
;
//收费免费判断
if($params["price"]==0){
$params["feel"] = "1";
}else{
//个人认证无法下付费课程
$shop = ManystoreShop::where("id",$shop_id)->find();
if($shop["type"]=="1"){
throw new \Exception("这个机构属于个人认证,无法发布付费课程!");
}
$params["feel"] = "0";
}
//更新
if($row){
$this->have_auth = false;
if($this->need_auth){
//判断更新的变动数据
$this->no_auth_fields_check($params,$row);
if($this->have_auth){
$params['status'] = "3";
$params['auth_status'] = "0";
}
}
$this->updateCheck($row->id,$params,$row);
//名称title不能与其他课程重复
$check_title = self::where('id','<>',$row["id"])->where('title',$params["title"])->find();
if($check_title){
throw new \Exception("课程名称已存在或被其他机构占用,请更改!");
}
}else{
//新增
//名称title不能重复
$check_title = $this->model->where('title',$params["title"])->find();
if($check_title){
throw new \Exception("课程名称已存在或被其他机构占用,请更改!");
}
}
//如果是上架,判断是否拥有课时规格,没有则无法上架
if($params["status"]=="1" && empty($params["spec"])){
if(!$row)throw new \Exception("新添加的课程请先至少添加一个课时规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count();
if(!$check_spec)throw new \Exception("新添加的课程请先至少添加一个课时规格后再上架!");
}
}
}

View File

@ -85,4 +85,119 @@ class ClassesSpec extends BaseModel
{
return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
protected function specupdateCheck($id,$params=[],$row=null){
if($params && $row){
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = \app\common\model\school\classes\hour\Order::where("classes_lib_spec_id",$id)->where("status","in","-1,0")->find();
if($order)throw new \Exception("存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!");
}
public function specCheck(&$params,$shop_id=null,$row=null)
{
//限定人数必须大于0
$limit_num = $params["limit_num"];
if($limit_num<=0){
throw new \Exception("限定人数必须大于0");
}
//开始和结束时间不能为空
$time = $params["time"];
if(empty($time))throw new \Exception("请选择开始和结束时间");
$split_line = " - ";
$time_arr = explode($split_line,$time);
$params["start_time"] = $time_arr[0];
$params["end_time"] = $time_arr[1];
unset($params["time"]);
$start_time = $params["start_time"];
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
throw new \Exception("请选择开始和结束时间");
}
//转化时间戳
$start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
$end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
throw new \Exception("结束时间不能小于开始时间");
}
//结束时间不能是已经过去的时间
$now_time = time();
if($end_time<=$now_time){
throw new \Exception("结束时间不能是已经过去的时间");
}
$orderTimeTableName = (new ClassesSpec)->getWithAlisaName();
//修改
if($row){
$this->specupdateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = ClassesSpec::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find();
if($spec_name_exist){
throw new \Exception("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = ClassesSpec::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->where("id","<>",$row->id)->find();
if($spec_time_exist){
throw new \Exception("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}else{
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = ClassesSpec::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find();
if($spec_name_exist){
throw new \Exception("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = ClassesSpec::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->find();
if($spec_time_exist){
throw new \Exception("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}
}
}

View File

@ -8,5 +8,41 @@ class Detail extends Model
{
// 表名
protected $name = 'school_classes_order_detail';
public function setImagesAttr($value, $data)
{
$imagesArray = $value;
if (!empty($value) && is_array($value)) {
//转成逗号拼接字符串
$imagesArray = implode(',', $value);
}
return $imagesArray;
}
public function getHeadimageAttr($value, $data)
{
if (!empty($value)) return cdnurl($value, true);
}
public function getImagesAttr($value, $data)
{
$imagesArray = [];
if (!empty($value)) {
$imagesArray = explode(',', $value);
foreach ($imagesArray as &$v) {
$v = cdnurl($v, true);
}
return $imagesArray;
}
return $imagesArray;
}
}

View File

@ -924,12 +924,14 @@ class Order extends BaseModel
$lib->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","in",["-1","0"])->count();
$lib->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","=","3")->count();
$lib->save();
}
//检测订单完成状态
self::statisticsAndUpdateOrderFinish($order->id);
//将课程信息和课时信息同步到所有已下单的订单信息中
ClassesLib::orderInfoSync($order["classes_lib_id"]);
return $order;
}

View File

@ -31,7 +31,30 @@ class OrderDetail extends BaseModel
'type_text',
'address_type_text'
];
public function getHeadimageAttr($value, $data)
{
if (!empty($value)) return cdnurl($value, true);
}
public function getImagesAttr($value, $data)
{
$imagesArray = [];
if (!empty($value)) {
$imagesArray = explode(',', $value);
foreach ($imagesArray as &$v) {
$v = cdnurl($v, true);
}
return $imagesArray;
}
return $imagesArray;
}
public function getAddTypeList()
@ -74,6 +97,16 @@ class OrderDetail extends BaseModel
}
public function setImagesAttr($value, $data)
{
$imagesArray = $value;
if (!empty($value) && is_array($value)) {
//转成逗号拼接字符串
$imagesArray = implode(',', $value);
}
return $imagesArray;
}
public function classorder()

View File

@ -56,6 +56,11 @@ class ClassesLib extends ManystoreBase
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
$this->view->assign("specStatusList", (new \app\manystore\model\school\classes\ClassesSpec)->getStatusList());
}
public function import()
@ -197,97 +202,29 @@ class ClassesLib extends ManystoreBase
protected function update_check(&$params,$row=null)
{
unset($params["auth_status"]);
if(!isset($params['status']))$params['status'] = "3";
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
$this->error("店铺不存在");
}
$params["manystore_id"] = $manystore["id"];
if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))$this->error("您的认证信息未完善,请您先去完善!");
//验证老师id
$teacher_id = $params['teacher_id'];
$teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find();
if(!$teacher){
$this->error("老师不存在");
}
if(!$teacher["user_id"]){
$this->error("当前老师没有前端用户!请换一个!");
}
//老师与当前机构id不一致
if($teacher["manystore_id"] != $manystore["id"]){
$this->error("当前老师与当前机构不匹配,请换一个老师!");
try {
$classesLib = new \app\common\model\school\classes\ClassesLib();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->classesCheck($params,$shop_id,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
$params["user_id"] = $teacher["user_id"];
//课时必须大于等于1
if($params["classes_num"] < 1) $this->error("课时必须大于等于1");
//售价必须大于0
if($params["price"] < 0) $this->error("售价必须大于0");
//独立地点需传定位信息
if($params["address_type"] == "2"){
if(empty($params["address_city"])
|| empty($params["province"])
|| empty($params["city"])
|| empty($params["district"])
|| empty($params["longitude"])
|| empty($params["address"])
|| empty($params["address_detail"])
|| empty($params["latitude"])) $this->error("独立地点需传定位信息");
}else{
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
$this->error("店铺不存在");
}
if(empty($shop["address_city"])
|| empty($shop["province"])
|| empty($shop["city"])
|| empty($shop["district"])
|| empty($shop["longitude"])
|| empty($shop["address"])
|| empty($shop["address_detail"])
|| empty($shop["latitude"])) $this->error("当前机构地址并未完善!请去【个人资料】完善信息");
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
$this->error("店铺不存在");
}
$params["address_city"] = $shop["address_city"];
$params["province"] = $shop["province"];
$params["city"] = $shop["city"];
$params["district"] = $shop["district"];
$params["longitude"] = $shop["longitude"];
$params["latitude"] = $shop["latitude"];
$params["address"] = $shop["address"];
$params["address_detail"] = $shop["address_detail"];
}
//收费免费判断
if($params["price"]==0){
$params["feel"] = "1";
}else{
//个人认证无法下付费课程
$shop = ManystoreShop::where("id",$shop_id)->find();
if($shop["type"]=="1"){
$this->error("当前属于个人认证,无法发布付费课程!");
}
$params["feel"] = "0";
}
//特有认证判断
// $this->authClasses($params,$row);
// var_dump($row);die;
@ -298,19 +235,6 @@ class ClassesLib extends ManystoreBase
$this->error("平台下架审核的课程无法上架!");
}
$this->have_auth = false;
if($this->need_auth){
//判断更新的变动数据
$this->no_auth_fields_check($params,$row);
if($this->have_auth){
$params['status'] = "3";
$params['auth_status'] = 0;
$params["reason"] = "";
}
}
$this->updateCheck($row->id,$params,$row);
//如果是审核失败,提交后自动更新成审核中
if($row['auth_status'] == 2){
@ -320,12 +244,6 @@ class ClassesLib extends ManystoreBase
}
//名称title不能与其他课程重复
$check_title = $this->model->where('id','<>',$row["id"])->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}else{
//新增(需审核)
$params["add_type"] = '1';
@ -333,23 +251,10 @@ class ClassesLib extends ManystoreBase
$params['status'] = "3";//平台下架
$params['auth_status'] = 0;
//名称title不能重复
$check_title = $this->model->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
$this->have_auth = true;
}
//如果是上架,判断是否拥有课时规格,没有则无法上架
if($params["status"]=="1"){
if(!$row)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count();
if(!$check_spec)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
}
@ -360,6 +265,73 @@ class ClassesLib extends ManystoreBase
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function addnew()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_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(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_need_after', $data);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 添加
*

View File

@ -133,86 +133,17 @@ class ClassesSpec extends ManystoreBase
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id", $shop_id)->find();
if (!$manystore) {
$this->error("店铺不存在");
try {
(new \app\common\model\school\classes\ClassesSpec)->specCheck($params,SHOP_ID,$row);
}catch (\Exception $e){
$this->error($e->getMessage());
}
//开始和结束时间不能为空
$start_time = $params["start_time"];
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
$this->error("请选择开始和结束时间");
}
//转化时间戳
$start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
$end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
$this->error("结束时间不能小于开始时间");
}
//结束时间不能是已经过去的时间
$now_time = time();
if($end_time<=$now_time){
$this->error("结束时间不能是已经过去的时间");
}
$orderTimeTableName = $this->model->getWithAlisaName();
//修改
if($row){
$this->updateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->where("id","<>",$row->id)->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}else{
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}

View File

@ -8,8 +8,8 @@ return [
'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线',
'Please input length nickname' => '昵称请最多填写10个字符',
'Front_idcard_image' => '身份证面',
'Reverse_idcard_image' => '身份证面',
'Front_idcard_image' => '身份证人像面',
'Reverse_idcard_image' => '身份证国徽面',
'Auth_time' => '审核时间',
'Admin_id' => '审核管理员id',
'Type' => '认证类型',

View File

@ -3,9 +3,10 @@
return [
'Classes_lib_id' => '课程id',
'Name' => '规格名',
'Time' => '课时开始结束时间',
'Start_time' => '开始时间',
'End_time' => '结束时间',
'Limit_num' => '本课时限定人数0不限制',
'Limit_num' => '本课时限定人数',
'Sign_num' => '已报名人数',
'Verification_num' => '已核销人数',
'Status' => '状态',

View File

@ -240,12 +240,12 @@
<!-- <input id="c-underline_price" class="form-control" step="0.01" name="row[underline_price]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_collect')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="0">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_collect')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->

View File

@ -0,0 +1,415 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Manystore_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-manystore_id" data-rule="required" data-source="manystore/index" data-field="id" class="form-control selectpage" name="row[manystore_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('讲师id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-teacher_id" data-rule="required" data-source="school/classes/teacher/index" data-field="name" class="form-control selectpage" name="row[teacher_id]" type="text" value="">
<span style="color: red">
<br><br>
(没找到讲师则点击按钮创建讲师后重新下拉框选讲师)
<a href="javascript:;" data-url="school/classes/teacher/add" class="btn btn-success btn-changeuser {:$auth->check('school/classes/teacher/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_cate_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_cate_ids" data-rule="required" data-source="school/classes/cate/index" data-multiple="true" class="form-control selectpage" name="row[classes_cate_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_label_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_label_ids" data-rule="required" data-source="school/classes/label/index" data-multiple="true" class="form-control selectpage" name="row[classes_label_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Self_label_tag')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-self_label_tag" class="form-control" data-role="tagsinput" name="row[self_label_tag]" type="text">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Add_type')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <select id="c-add_type" class="form-control selectpicker" name="row[add_type]">-->
<!-- {foreach name="addTypeList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="2"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Add_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-add_id" data-rule="required" data-source="add/index" class="form-control selectpage" name="row[add_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" class="form-control" data-rule="required" name="row[title]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Headimage')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-headimage" class="form-control" data-rule="required" size="50" name="row[headimage]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-headimage" class="btn btn-danger faupload" data-input-id="c-headimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-headimage" class="btn btn-primary fachoose" data-input-id="c-headimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-headimage"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-headimage"></ul>
</div>
</div>
<div class="form-group">
<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" data-rule="required" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" 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>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="in"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_num" class="form-control" data-rule="required" name="row[classes_num]" type="number">
<span style="color: red">(填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数)</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('课时规格信息')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[spec]" data-template="testtpl" data-tag="tr">
<tr>
<td>规格名</td>
<td>开始结束时间</td>
<td>限定人数</td>
<!-- <td>权重</td>-->
<td>上架状态</td>
<td></td>
</tr>
<tr>
<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></td>
</tr>
<textarea name="row[spec]" id="spec" class="form-control hide" cols="30" rows="5">[{"name":"{:date('m-d号')} 上午课(名师巡讲!)","time":"{:date('Y/m/d 0:01')} - {:date('Y/m/d H:i')}","limit_num":"30","weigh":"0","status":"1"}]</textarea>
</table>
<span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,后续有变更将触发审核机制!)</span>
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td><input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="20" placeholder="课时名"></td>
<td>
<input type="text" name="row[<%=name%>][<%=index%>][time]" data-rule="required" class="form-control datetimerange" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" value="<%=row['time']%>" size="20" />
<!--<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">-->
</td>
<td><input type="text" name="row[<%=name%>][<%=index%>][limit_num]" data-rule="required" class="form-control" value="<%=row['limit_num']%>" placeholder="课时限制人数" size="2" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>
<!-- <td><input type="text" name="row[<%=name%>][<%=index%>][weigh]" data-rule="required" class="form-control" value="<%=row['weigh']%>" size="2" placeholder="课时排序权重" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>-->
<td>
<select id="c-status" class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="specStatusList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['status']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></td>
</tr>
</script>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_type')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
</div>
</div>
</div>
<div id="c_position">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="" >
<input type="hidden" id="city" name="row[city]" value="" >
<input type="hidden" id="district" name="row[district]" value="" >
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address" class="form-control form-control"
data-lat-id="c-latitude" data-lng-id="c-longitude" readonly data-input-id="c-address" data-toggle="addresspicker" name="row[address]" value="" type="text" placeholder="请地图选址。如调起地图失败请检查插件《地图位置(经纬度)选择》是否安装">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="" placeholder="请输入{:__('Address_detail')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="">
</div>
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_date_text')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_date_text" class="form-control" name="row[classes_date_text]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_time_text')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_time_text" class="form-control" name="row[classes_time_text]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Notice')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-notice" class="form-control editor" rows="5" name="row[notice]" cols="50"></textarea>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('虚拟参与人数')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_people" class="form-control" name="row[virtual_people]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sale')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sale" class="form-control" name="row[sale]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
<span style="color: red">( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! )</span>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Underline_price')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-underline_price" class="form-control" step="0.01" name="row[underline_price]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_collect')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="radio">-->
<!-- {foreach name="statusList" item="vo"}-->
<!-- <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}"-->
<!-- {in name="key" value="1"}checked{/in}-->
<!-- {in name="key" value="3"} disabled {/in}-->
<!-- />-->
<!-- {$vo}-->
<!-- </label>-->
<!-- {/foreach}-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="radio">-->
<!-- {foreach name="authStatusList" item="vo"}-->
<!-- <label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>-->
<!-- {/foreach}-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--用php标签判断 如果不通过,展示原因-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-reason" class="form-control" name="row[reason]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-auth_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[auth_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <select id="c-recommend" class="form-control selectpicker" name="row[recommend]">-->
<!-- {foreach name="recommendList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Hot')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <select id="c-hot" class="form-control selectpicker" name="row[hot]">-->
<!-- {foreach name="hotList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('New')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <select id="c-new" class="form-control selectpicker" name="row[new]">-->
<!-- {foreach name="newList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Selfhot')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-selfhot" class="form-control selectpicker" name="row[selfhot]">
{foreach name="selfhotList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('提价审核')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<script>
var shop_id = {$shop_id};
var store_id = {$store_id};
var shop_user_id = {$shop_user_id};
</script>

View File

@ -159,6 +159,8 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_num" class="form-control" data-rule="required" name="row[classes_num]" type="number" value="{$row.classes_num|htmlentities}">
<span style="color: red">(填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数)</span>
</div>
</div>
@ -246,12 +248,12 @@
<textarea id="c-notice" class="form-control editor" rows="5" name="row[notice]" cols="50">{$row.notice|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number" value="{$row.virtual_num|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number" value="{$row.virtual_num|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sale')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
@ -271,19 +273,19 @@
<!-- <input id="c-underline_price" class="form-control" step="0.01" name="row[underline_price]" type="number" value="{$row.underline_price|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_collect')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="{$row.virtual_collect|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_collect')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="{$row.virtual_collect|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('虚拟参与人数')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_people" class="form-control" name="row[virtual_people]" type="number" value="{$row.virtual_people|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('虚拟参与人数')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_people" class="form-control" name="row[virtual_people]" type="number" value="{$row.virtual_people|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->

View File

@ -28,6 +28,10 @@
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/classes_lib/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" data-url="school/classes/classes_lib/addnew" class="btn btn-success btn-changeuser {:$auth->check('school/classes/classes_lib/addnew')?'':'hide'}" title="{:__('新版添加')}" ><i class="fa fa-plus"></i> {:__('新版添加')}(开发中)</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/classes_lib/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('school/classes/classes_lib/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>

View File

@ -9,25 +9,37 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text">
<input id="c-name" class="form-control" data-rule="required" name="row[name]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<!-- //class="form-control datetimerange" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间"-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
<input id="c-time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[time]" type="text" value="{:date('Y-m-d 0:01')} - {:date('Y-m-d H:i')}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="0">
<input id="c-limit_num" class="form-control" data-rule="required" name="row[limit_num]" type="number" value="0">
</div>
</div>
<!-- <div class="form-group">-->

View File

@ -9,25 +9,34 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
<input id="c-name" class="form-control" data-rule="required" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):''}">
<input id="c-time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[time]" type="text" value="{:$row.start_time?datetime($row.start_time):''} - {:$row.end_time?datetime($row.end_time):''}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):''}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):''}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="{$row.limit_num|htmlentities}">
<input id="c-limit_num" class="form-control" data-rule="required" name="row[limit_num]" type="number" value="{$row.limit_num|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->

View File

@ -7,6 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
extend: {
index_url: 'school/classes/classes_lib/index' + location.search,
add_url: 'school/classes/classes_lib/add'+ location.search,
addnew_url: 'school/classes/classes_lib/addnew'+ location.search,
edit_url: 'school/classes/classes_lib/edit'+ location.search,
del_url: 'school/classes/classes_lib/del',
multi_url: 'school/classes/classes_lib/multi',
@ -203,6 +204,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
]
]
});
$(document).on('click', '.btn-changeuser', function (event) {
var url = $(this).attr('data-url');
if(!url) return false;
var title = $(this).attr('title');
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
// var ids = $(this).attr('data-id');
var area = ['95%','95%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
callback:function(ret){//回调方法需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
Fast.api.close(ret);
}
};
Fast.api.open(url,title,options);
});
Form.api.bindevent($("form[role=form]"));
// 为表格绑定事件
Table.api.bindevent(table);
@ -266,12 +287,47 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
generrate.setOfflineType($("input:radio[name='row[address_type]']").val());
},
addnew: function () {
//因为日期选择框不会触发change事件导致无法刷新textarea所以加上判断
$(document).on("dp.change", "#add-form .datetimerange", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#add-form .datetimepicker", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("fa.event.appendfieldlist", "#add-form .btn-append", function (e, obj) {
// Form.api.bindevent($("form[role=form]"));
// // //绑定动态下拉组件
Form.events.selectpage(obj);
// // //绑定日期组件
Form.events.daterangepicker(obj);
Form.events.datetimepicker(obj);
// // Form.events.datetimerange(obj);
// Form.api.bindevent(this);
// //绑定上传组件
// Form.events.faupload(obj);
// //上传成功回调事件,变更按钮的背景
// $(".upload-image", obj).data("upload-success", function (data) {
// $(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')");
// })
});
generrate.setOfflineType($("input:radio[name='row[address_type]']").val());
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
@ -317,7 +373,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
// var ids = $(this).attr('data-id');
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
var area = ['95%','95%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
@ -341,6 +397,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var generrate = {
listen:function () {
this.offlineListen();
this.priceListen();
},
offlineListen:function () {
var that = this;
@ -360,6 +417,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
break;
}
},
priceListen:function () {
$('#spec').bind('input propertychange', function(){
var length = $("#spec").val().length;
console.log(length);
});
}
}

View File

@ -7,6 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
extend: {
index_url: 'school/classes/classes_lib/index' + location.search,
add_url: 'school/classes/classes_lib/add'+ location.search,
addnew_url: 'school/classes/classes_lib/addnew'+ location.search,
edit_url: 'school/classes/classes_lib/edit'+ location.search,
del_url: 'school/classes/classes_lib/del',
multi_url: 'school/classes/classes_lib/multi',
@ -202,6 +203,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
]
});
$(document).on('click', '.btn-changeuser', function (event) {
var url = $(this).attr('data-url');
if(!url) return false;
var title = $(this).attr('title');
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
// var ids = $(this).attr('data-id');
var area = ['95%','95%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
callback:function(ret){//回调方法需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
Fast.api.close(ret);
}
};
Fast.api.open(url,title,options);
});
Form.api.bindevent($("form[role=form]"));
// 为表格绑定事件
Table.api.bindevent(table);
},
@ -264,8 +288,45 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 为表格绑定事件
Table.api.bindevent(table);
},
addnew: function () {
//因为日期选择框不会触发change事件导致无法刷新textarea所以加上判断
$(document).on("dp.change", "#add-form .datetimerange", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#add-form .datetimepicker", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("fa.event.appendfieldlist", "#add-form .btn-append", function (e, obj) {
// Form.api.bindevent($("form[role=form]"));
// // //绑定动态下拉组件
Form.events.selectpage(obj);
// // //绑定日期组件
Form.events.daterangepicker(obj);
Form.events.datetimepicker(obj);
// // Form.events.datetimerange(obj);
// Form.api.bindevent(this);
// //绑定上传组件
// Form.events.faupload(obj);
// //上传成功回调事件,变更按钮的背景
// $(".upload-image", obj).data("upload-success", function (data) {
// $(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')");
// })
});
generrate.setOfflineType($("input:radio[name='row[address_type]']").val());
Controller.api.bindevent();
},
add: function () {
Controller.api.bindevent();
generrate.setOfflineType($("input:radio[name='row[address_type]']").val());
@ -314,8 +375,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
// var ids = $(this).attr('data-id');
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
var options = {
var area = ['95%','95%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
@ -336,6 +397,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var generrate = {
listen:function () {
this.offlineListen();
this.priceListen();
},
offlineListen:function () {
var that = this;
@ -355,6 +417,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
break;
}
},
priceListen:function () {
$('#spec').bind('input propertychange', function(){
var length = $("#spec").val().length;
console.log(length);
});
}
}
var classes_spec_url = function (row,dom) {