课程活动审核

This commit is contained in:
15090180611 2024-12-24 18:27:48 +08:00
parent 3f08145276
commit 26971126ba
39 changed files with 3424 additions and 1011 deletions

View File

@ -28,6 +28,10 @@ class Message extends Backend
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("miniTypeList", $this->model->getMiniTypeList());
$this->view->assign("statusListJson", json_encode($this->model->getStatusList(), JSON_UNESCAPED_UNICODE));
$this->view->assign("miniTypeListJson", json_encode($this->model->getMiniTypeList(), JSON_UNESCAPED_UNICODE));
}

View File

@ -77,11 +77,33 @@ class Activity extends Backend
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
$as = (new \app\common\model\school\classes\activity\Activity)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$expireWhere = [[]];
}
$list = $this->model
->with(['manystore','shop'])
->where($where)
->where(...$expireWhere)
->order($sort, $order)
->paginate($limit);
@ -296,7 +318,7 @@ class Activity extends Backend
foreach ($delete_spec_ids as $k=>$delete_spec){
// (new \app\common\model\school\classes\activity\ActivityItem)->updateCheck($delete_spec["id"]);
(new \app\common\model\school\classes\activity\ActivityItem)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
@ -357,6 +379,10 @@ class Activity extends Backend
foreach ($list as $item) {
//删除课程规格
\app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$item->id)->delete();
//删除课程规格
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_id",$item->id)->delete();
\app\common\model\school\classes\activity\ActivityAuth::where("classes_activity_id",$item->id)->delete();
$count += $item->delete();
}

View File

@ -3,6 +3,14 @@
namespace app\admin\controller\school\classes\activity;
use app\common\controller\Backend;
use app\common\model\school\classes\activity\order\Order;
use think\Db;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\Exception;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程活动审核
@ -17,11 +25,24 @@ class ActivityAuth extends Backend
* @var \app\admin\model\school\classes\activity\ActivityAuth
*/
protected $model = null;
protected $itemmodel = null;
protected $qSwitch = true;
protected $qFields = ["user_id","shop_id","manystore_id"];
protected $success_auth = false;
protected $error_auth = false;
//不用审核允许修改的字段
protected $no_auth_fields = ['headimage','images','content',"price"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\school\classes\activity\ActivityAuth;
$this->itemmodel = new \app\admin\model\school\classes\activity\ActivityItemAuth();
parent::_initialize();
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("recommendList", $this->model->getRecommendList());
@ -31,6 +52,14 @@ class ActivityAuth extends Backend
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
$this->view->assign("expirestatusList", $this->model->getExpirestatusList());
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->getCity();
$this->getAuthMsg();
$this->view->assign("itemStatusList", $this->itemmodel->getStatusList());
$this->view->assign("sexList", $this->itemmodel->getSexList());
}
@ -56,16 +85,38 @@ class ActivityAuth extends Backend
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
$as = (new \app\common\model\school\classes\activity\ActivityAuth)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$expireWhere = [[]];
}
$list = $this->model
->with(['activity','manystore','shop'])
->where($where)
->order($sort, $order)
->paginate($limit);
->with(['activity','manystore','shop'])
->where($where)
->where(...$expireWhere)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('activity')->visible(['id']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('shop')->visible(['name','logo']);
@ -78,4 +129,344 @@ class ActivityAuth extends Backend
return $this->view->fetch();
}
protected function update_classes($classes_activity_id,$row=null){
if($classes_activity_id && $row){
$activity = \app\common\model\school\classes\activity\Activity::where("id",$classes_activity_id)->find();
if($activity && in_array($row["auth_status"],[0,2])){
$activity["classes_activity_auth_id"] = $row["id"];
$activity->save();
}
}
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_item_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("{$order['name']}存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
protected function update_check(&$params,$row=null)
{
$params["classes_activity_id"] = $params["classes_activity_id"] ?? 0;
if($row){
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
$activity = \app\common\model\school\classes\activity\Activity::where("id",$row["classes_activity_id"])->find();
if($activity && empty($params["classes_activity_id"])){
$params["classes_activity_id"] = $activity["id"];
}
}
//审核失败需填写原因
if($params["auth_status"] == '2' && empty($params["reason"])){
$this->error("审核失败需填写原因");
}
//
try {
$classesLib = new \app\common\model\school\classes\activity\ActivityAuth();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->activityCheck($params,null,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
//修改
if($row){
// if($params["auth_status"] != '1' && $row["auth_status"] == '1'){
// $this->error("审核已通过的课程不允许再修改审核状态!");
// }
if($params["auth_status"] != '0' && $row["auth_status"] == '0'){
//填写审核时间和审核人
$params["auth_time"] = time();
$params["admin_id"] = $this->auth->id;
if($params["auth_status"] == '1'){
//审核通过
$this->success_auth = true;
}
if($params["auth_status"] == '2'){
//审核通过
$this->error_auth = true;
}
}
}else{
//新增
//新增
$params["add_type"] = '2';
$params["add_id"] = $this->auth->id;
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
$this->error(__('添加功能已被禁用!', ''));
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);
$spec = $params["item_json"];
unset($params["item_json"]);
$result = $this->model->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $this->model["id"];
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($this->model->classes_activity_id ?? 0);
$v["manystore_id"] = $this->model["manystore_id"];
$v["shop_id"] = $this->model["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItemAuth())->allowField(true)->save($v);
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$this->model["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
$this->update_classes($this->model["classes_activity_id"] ?? 0,$this->model);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage().$e->getFile().$e->getLine());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$spec = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->field("id,classes_activity_id,name,price,age,sex,limit_num,status,weigh")->order('weigh desc,id desc')->select();
$row["item_json"] = json_encode($spec);
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$this->update_check($params,$row);
$spec = $params["item_json"] ?? [];
// var_dump($spec);
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["item_json"]);
unset($params["delete_spec_ids"]);
$result = $row->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $row["id"];
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($row->classes_activity_id ?? 0);
$v["manystore_id"] = $row["manystore_id"];
$v["shop_id"] = $row["shop_id"];
//有id更新否则新增
if(isset($v["id"]) && $v["id"]){
\app\common\model\school\classes\activity\ActivityItemAuth::update((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
}else{
\app\common\model\school\classes\activity\ActivityItemAuth::create((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
}
}
//删除规格
foreach ($delete_spec_ids as $k=>$delete_spec){
(new \app\common\model\school\classes\activity\ActivityItemAuth)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
$this->update_classes($row["classes_activity_id"] ?? 0 ,$row);
if($this->success_auth){
$activity = (new \app\common\model\school\classes\activity\Activity)->successAuth($row["id"]);
$this->update_classes($activity["id"] ?? 0 ,$row);
//调用通过事件
$data = ['activity' => $row];
\think\Hook::listen('activity_auth_success_after', $data);
}
if($this->error_auth){
(new \app\common\model\school\classes\activity\Activity)->errorAuth($row["id"]);
//调用通过事件
$data = ['activity' => $row];
\think\Hook::listen('activity_auth_fail_after', $data);
}
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
/**
* 删除
*
* @param $ids
* @return void
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function del($ids = null)
{
if (false === $this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ?: $this->request->post("ids");
if (empty($ids)) {
$this->error(__('Parameter %s can not be empty', 'ids'));
}
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $item) {
//删除课程规格
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$item->id)->delete();
// \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$item->classes_activity_id)->delete();
$count += $item->delete();
}
Db::commit();
} catch (PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
}
$this->error(__('No rows were deleted'));
}
}

View File

@ -68,4 +68,7 @@ return [
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
];

View File

@ -68,5 +68,15 @@ return [
'Deletetime' => '删除时间',
'Manystore.nickname' => '昵称',
'Shop.name' => '店铺名称',
'Shop.logo' => '品牌LOGO'
'Shop.logo' => '品牌LOGO',
'Sex' => '性别限制',
'Sex 1' => '男',
'Sex 2' => '女',
'Sex 3' => '男女不限',
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
];

View File

@ -45,5 +45,7 @@ return [
'Admin.nickname' => '昵称',
'Admin.avatar' => '头像',
'User.nickname' => '昵称',
'User.avatar' => '头像'
'User.avatar' => '头像',
'Status activity' => '课程活动消息',
'Mini_type activity_apply' => '课程活动审核',
];

View File

@ -77,12 +77,12 @@ class Message extends BaseModel
public function getStatusList()
{
return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order')];
return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order'),'activity' => __('Status activity')];
}
public function getMiniTypeList()
{
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply') ,'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
}

View File

@ -38,9 +38,28 @@ class Activity extends Model
'new_text',
'selfhot_text',
'expirestatus_text',
'add_type_text'
'add_type_text',
'has_expire',
];
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
public function getHasExpireAttr($value, $data)
{
$end_time = (isset($data['end_time']) ? $data['end_time'] : '');
if(!$end_time) return '2';
if( $end_time < time()) {
return '1';
}else{
return '2';
}
}
protected static function init()
{

View File

@ -40,8 +40,28 @@ class ActivityAuth extends Model
'auth_status_text',
'expirestatus_text',
'add_type_text',
'auth_time_text'
'auth_time_text',
'has_expire',
];
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
public function getHasExpireAttr($value, $data)
{
$end_time = (isset($data['end_time']) ? $data['end_time'] : '');
if(!$end_time) return '2';
if( $end_time < time()) {
return '1';
}else{
return '2';
}
}
protected static function init()

View File

@ -1,21 +1,18 @@
<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">{:__('Classes_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="school/classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="">
</div>
</div>
<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" 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="manystore/shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="">
<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">
@ -52,90 +49,149 @@
<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">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<!-- <td>开始结束时间</td>-->
<td>限定人数</td>
<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[item_json]" id="item_json" class="form-control hide" cols="30" rows="8"></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="15" 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="25" />-->
<!-- &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->
<!-- </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%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></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 class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['status']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['sex']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></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">
<select id="c-address_type" data-rule="required" class="form-control selectpicker" name="row[address_type]">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
<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}
</select>
<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="{$q_address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$q_province_code}" >
<input type="hidden" id="city" name="row[city]" value="{$q_city_code}" >
<input type="hidden" id="district" name="row[district]" value="{$q_area_code}" >
</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">{:__('Address_city')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('活动开始结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-address_city" class="form-control" data-toggle="city-picker" name="row[address_city]" type="text"></div>
<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">{:__('Province')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" class="form-control" name="row[province]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-city" class="form-control" name="row[city]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" class="form-control" name="row[district]" type="number">
</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">
<input id="c-address" class="form-control" name="row[address]" type="text">
</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="">
</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-8">
<input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="">
</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">{:__('Sign_start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_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">{:__('Sign_end_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
<input id="c-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_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">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
@ -160,14 +216,22 @@
<textarea id="c-content" data-rule="required" 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">{:__('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}
{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>
@ -181,10 +245,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -193,10 +257,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -205,10 +269,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -217,87 +281,18 @@
<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>
<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">{:__('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">{:__('Sale')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale" class="form-control" name="row[sale]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-stock" class="form-control" name="row[stock]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Expirestatus')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="expirestatusList" item="vo"}
<label for="row[expirestatus]-{$key}"><input id="row[expirestatus]-{$key}" name="row[expirestatus]" 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">{:__('Add_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-add_type" data-rule="required" 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">{:__('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 layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">

View File

@ -1,23 +1,44 @@
<form id="edit-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">{:__('Classes_activity_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="school/classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="{$row.classes_activity_id|htmlentities}">
<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="$row.auth_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Manystore_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-manystore_id" data-rule="required" data-source="manystore/index" class="form-control selectpage" name="row[manystore_id]" type="text" value="{$row.manystore_id|htmlentities}">
<input id="c-reason" class="form-control" name="row[reason]" type="text" value="{$row.reason|htmlentities}">
</div>
</div>
<br> <br> <br>
{eq name="check_auth_data.address_citys" value="*"}
<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="manystore/shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">
<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="{$row.shop_id|htmlentities}">
<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>
{/eq}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
@ -52,90 +73,142 @@
<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">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<!-- <td>开始结束时间</td>-->
<td>限定人数</td>
<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[item_json]" id="item_json" class="form-control hide" cols="30" rows="8">{$row.item_json|htmlentities}</textarea>
</table>
<!-- <span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)</span>-->
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td>
<input type="hidden" name="row[<%=name%>][<%=index%>][id]" class="form-control" value="<%=row['id']%>" size="20" >
<input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="15" 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="25" />-->
<!-- &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->
<!-- </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%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></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 class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" <%if(row.status=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" <%if(row.sex=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></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">
<select id="c-address_type" data-rule="required" class="form-control selectpicker" name="row[address_type]">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.address_type"}selected{/in}>{$vo}</option>
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
{/foreach}
</select>
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
</div>
</div>
</div>
<div id="c_position" {eq name="$row.address_type" value="1"} style="display: none" {/eq} >
<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" data-toggle="city-picker" name="row[address_city]" type="text" value="{$row.address_city|htmlentities}"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" class="form-control" name="row[province]" type="number" value="{$row.province|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-city" class="form-control" name="row[city]" type="number" value="{$row.city|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" class="form-control" name="row[district]" type="number" value="{$row.district|htmlentities}">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="{$row.address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$row.province}" >
<input type="hidden" id="city" name="row[city]" value="{$row.city}" >
<input type="hidden" id="district" name="row[district]" value="{$row.district}" >
</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">
<input id="c-address" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}">
<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="{$row.address}" 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="{$row.address_detail|htmlentities}">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="{$row.address_detail}" 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-8">
<input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="{$row.longitude|htmlentities}">
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="{$row.longitude}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="{$row.latitude|htmlentities}">
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="{$row.latitude}">
</div>
</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">{:__('活动开始结束时间')}:</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):''}">
<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">{:__('End_time')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</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">{:__('Sign_start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_start_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_end_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_end_time]" type="text" value="{:$row.sign_end_time?datetime($row.sign_end_time):''}">
<input id="c-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''} - {:$row.sign_end_time?datetime($row.sign_end_time):''}">
</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">
@ -160,14 +233,19 @@
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</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="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
{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="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
@ -181,10 +259,10 @@
<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="$row.recommend"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.recommend"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -193,10 +271,10 @@
<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="$row.hot"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.hot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -205,10 +283,10 @@
<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="$row.new"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.new"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -217,87 +295,16 @@
<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="$row.selfhot"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.selfhot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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="$row.auth_status"}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="{$row.reason|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">
<input id="c-sale" class="form-control" name="row[sale]" type="number" value="{$row.sale|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-stock" class="form-control" name="row[stock]" type="number" value="{$row.stock|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="{$row.views|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Expirestatus')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="expirestatusList" item="vo"}
<label for="row[expirestatus]-{$key}"><input id="row[expirestatus]-{$key}" name="row[expirestatus]" type="radio" value="{$key}" {in name="key" value="$row.expirestatus"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</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" data-rule="required" class="form-control selectpicker" name="row[add_type]">
{foreach name="addTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.add_type"}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="{$row.add_id|htmlentities}">
</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="{:$row.auth_time?datetime($row.auth_time):''}">
</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">

View File

@ -17,19 +17,19 @@
<div class="widget-body no-padding">
<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/activity/activity_auth/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/activity/activity_auth/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/activity/activity_auth/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/activity/activity_auth/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('school/classes/activity/activity_auth/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
{foreach name="authStatusList" item="vo"}
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="auth_status={$key}">{:__('Set auth_status to ' . $key)}</a></li>
{/foreach}
</ul>
</div>
<!-- <div class="dropdown btn-group {:$auth->check('school/classes/activity/activity_auth/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- {foreach name="authStatusList" item="vo"}-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="auth_status={$key}">{:__('Set auth_status to ' . $key)}</a></li>-->
<!-- {/foreach}-->
<!-- </ul>-->
<!-- </div>-->
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('school/classes/activity/activity_auth/recyclebin')?'':'hide'}" href="school/classes/activity/activity_auth/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
</div>

View File

@ -44,3 +44,7 @@
</div>
</div>
</div>
<script>
var statusListJson = {$statusListJson};
var miniTypeListJson = {$miniTypeListJson};
</script>

View File

@ -169,6 +169,28 @@ $serviceHooks = [
];
//活动审核事件钩子
$activityHooks = [
// 订单创建
'activity_auth_need_after' => [ // 活动审核提交
'app\\common\\listener\\classes\\ActivityHook'
],
'activity_auth_success_after' => [ // 活动审核通过后
'app\\common\\listener\\classes\\ActivityHook'
],
'activity_auth_fail_after' => [ // 活动审核失败后
'app\\common\\listener\\classes\\ActivityHook'
],
'activity_view_after' => [ // 活动触发浏览后
'app\\common\\listener\\classes\\ActivityHook'
],
];
//
//if (file_exists(ROOT_PATH . 'addons/shopro/listener/commission')) {
// $defaultHooks = array_merge_recursive($defaultHooks, $commissionHooks);
@ -179,4 +201,7 @@ $defaultHooks = array_merge_recursive($defaultHooks, $classesHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $userHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $serviceHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $activityHooks);
return $defaultHooks;

View File

@ -0,0 +1,115 @@
<?php
namespace app\common\listener\classes;
use app\common\model\manystore\Shop;
use app\common\model\school\Message;
class ActivityHook
{
// 课程审核提交
public function activityAuthNeedAfter(&$params)
{
['activity' => $activity] = $params;
$shop = Shop::where("id",$activity['shop_id'])->find();
if($shop && $shop['user_id']){
//课程推送给老师
$desc = "您的新课程活动{$activity['title']}已提交审核审核时间为1-3日内,请耐心等待审核结果";
$title = "新课程活动审核";
$mini_type = "activity_apply";
$to_type="user";
$to_id = $shop["user_id"];
$status ="activity";
$platform="user";
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"activity_auth_need_after",
"classes_lib_id"=>$activity["id"],
];
Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
}
// 课程审核通过后
public function activityAuthSuccessAfter(&$params)
{
['activity' => $activity] = $params;
$shop = Shop::where("id",$activity['shop_id'])->find();
if($shop && $shop['user_id']){
//课程推送给老师
$desc = "您的新课程活动{$activity['title']}已审核通过,可以在后台操作课程活动上架!";
$title = "新课程活动审核成功";
$mini_type = "activity_apply";
$to_type="user";
$to_id = $shop["user_id"];
$status ="activity";
$platform="user";
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"activity_auth_success_after",
"classes_activity_id"=>$activity["id"],
];
Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
}
// 课程审核失败后
public function activityAuthFailAfter(&$params)
{
['activity' => $activity] = $params;
$shop = Shop::where("id",$activity['shop_id'])->find();
if($shop && $shop['user_id']){
//课程推送给老师
$desc = "您的新课程活动{$activity['title']}审核未通过,未通过原因为:{$activity['reason']},整改后,可以在后台重新提交!";
$title = "新课程活动审核不通过";
$mini_type = "activity_apply";
$to_type="user";
$to_id = $shop["user_id"];
$status ="activity";
$platform="user";
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"activity_auth_fail_after",
"classes_activity_id"=>$activity["id"],
];
Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
}
public function activityViewAfter(&$params)
{
['classes' => $classes,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}
}

View File

@ -78,7 +78,7 @@ class ClassesHook
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"classes_auth_success_after",
"event"=>"classes_auth_fail_after",
"classes_lib_id"=>$classes["id"],
];
Message::$event_name = $params["event"];

View File

@ -242,4 +242,25 @@ class BaseModel extends Model
}
public function demo($id,$trans=false){
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
}
return $res;
}
}

View File

@ -75,12 +75,12 @@ class Message extends BaseModel
public function getStatusList()
{
return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order')];
return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order'),'activity' => __('Status activity')];
}
public function getMiniTypeList()
{
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply') , 'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
}

View File

@ -43,8 +43,28 @@ class Activity extends BaseModel
'new_text',
'selfhot_text',
'expirestatus_text',
'add_type_text'
'add_type_text',
'has_expire',
];
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
public function getHasExpireAttr($value, $data)
{
$end_time = (isset($data['end_time']) ? $data['end_time'] : '');
if(!$end_time) return '2';
if( $end_time < time()) {
return '1';
}else{
return '2';
}
}
protected static function init()
@ -222,6 +242,10 @@ class Activity extends BaseModel
return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function items()
{
return $this->hasMany(ActivityItem::class,'classes_activity_id')->order("weigh desc,id desc");
}
public function activityCheck(&$params,$shop_id=null,$row=null,$oper_type='user',$oper_id=0)
@ -435,16 +459,16 @@ class Activity extends BaseModel
//更新
if($row){
// $this->have_auth = false;
// if($this->need_auth){
// //判断更新的变动数据
// $this->no_auth_fields_check($params,$row);
// if($this->have_auth){
$this->have_auth = false;
if($this->need_auth){
//判断更新的变动数据
$this->no_auth_fields_check($params,$row);
if($this->have_auth){
// $params['status'] = "3";
// }
// }
}
}
// $this->updateCheck($row->id,$params,$row);
$this->updateCheck($row->id,$params,$row);
//名称title不能与其他课程重复
@ -557,5 +581,271 @@ class Activity extends BaseModel
}
//审核通过后
public function successAuth($id,$trans=false){
$activityAuth = ActivityAuth::where("id",$id)->find();
if(!$activityAuth)throw new \Exception("未找到该记录");
$itemauths = $activityAuth->itemauths;
if(!$itemauths)throw new \Exception("规格不全");
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
$need_create=false;
if(!$activityAuth["classes_activity_id"]){
$need_create=true;
}else{
$activity = self::get($activityAuth["classes_activity_id"]);
if(!$activity)$need_create=true;
}
if($need_create){ //创建:创建活动
//如果未创建则创建活动
$activityData = $activityAuth->toArray();
unset($activityData["id"]);
$activity = new self;
$activity->allowField(true)->save($activityData);
//添加活动规格
foreach ($itemauths as $k=>$itemauth){
$itemauthData = $itemauth->toArray();
unset($itemauthData["id"]);
$itemauthData["classes_activity_id"] = $activity->id;
$item = new ActivityItem;
$item->allowField(true)->save($itemauthData);
$itemauth["classes_activity_item_id"] = $item->id;
$itemauth->save();
}
}else{
//更新活动
$activityData = $activityAuth->toArray();
unset($activityData["id"]);
$activity->allowField(true)->save($activityData);
$delete_spec_ids = [];
//按前端顺序分配显示权重
//数组倒过来
$insert_auth_spec = [];
$update_ids = [];
$update_spec = [];
$delete_spec = [];
foreach ($itemauths as $k=>$v){
if(!empty($v["classes_activity_item_id"])){
$update_ids[] = $v["classes_activity_item_id"];
}else{
$insert_auth_spec[] = $v;
}
}
if($update_ids){
$update_spec = ActivityItem::where("id","in",$update_ids)->select();
$delete_spec_ids = ActivityItem::where("classes_activity_id",$activity->id)->where("id","not in",$update_ids)->column("id");
}else{
$delete_spec_ids = ActivityItem::where("classes_activity_id",$activity->id)->column("id");
}
//存在需要删除的规格则判断规格是否能删除
if($delete_spec_ids){
$check_spec = ActivityItem::where("classes_activity_id",$activity->id)->where("id","in",$delete_spec_ids)->select();
foreach ($check_spec as $k=>$vv){
(new ActivityItem)->updateCheck($vv->id);
}
$delete_spec = $check_spec;
}
//需要新增的项
foreach ($insert_auth_spec as $k=>$itemauth){
$itemauthData = $itemauth->toArray();
unset($itemauthData["id"]);
$itemauthData["classes_activity_id"] = $activity->id;
$item = new ActivityItem;
$item->allowField(true)->save($itemauthData);
$itemauth["classes_activity_item_id"] = $item->id;
$itemauth->save();
}
//需要更新的项
foreach ($update_spec as $k=>$item){
foreach ($itemauths as $j=>$v){
if($v["classes_activity_item_id"] == $item->id){
$itemData = $v->toArray();
unset($itemData["id"]);
$item->allowField(true)->save($itemData);
}
}
}
//需要删除的项
foreach ($delete_spec as $k=>$item){
$item->delete();
}
}
$activityAuth["classes_activity_id"] = $activity->id;
$activityAuth->save();
//activity置空
$activity["classes_activity_auth_id"] = 0;
$activity->save();
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
}
return $activity;
}
//审核不通过后
public function errorAuth($id,$trans=false){
$activityAuth = ActivityAuth::where("id",$id)->find();
if(!$activityAuth)throw new \Exception("未找到该记录");
$itemauths = $activityAuth->itemauths;
$activity = null;
if(!$itemauths)throw new \Exception("规格不全");
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
$need_create=false;
if(!$activityAuth["classes_activity_id"]){
$need_create=true;
}else{
$activity = self::get($activityAuth["classes_activity_id"]);
if(!$activity)$need_create=true;
}
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
}
return $activity;
}
/** 提交申请认证
* @param $id
* @param $trans
* @return true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function applyAuth($id,$params,$trans=false){
$activity = self::where("id",$id)->find();
if(!$activity)throw new \Exception("未找到该记录");
//尝试找出classes_activity_auth_id 指向最新的审核记录
if($activity['classes_activity_auth_id']){
$activityAuth = ActivityAuth::where("id",$activity['classes_activity_auth_id'])->find();
if(!$activityAuth || $activityAuth['auth_status']==2){ //不存在或状态为不通过
$activity['classes_activity_auth_id'] = 0;
}
}
$spec = $params["item_json"] ?? [];
// var_dump($spec);
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["item_json"]);
unset($params["delete_spec_ids"]);
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
//如果没有则创建新的记录
if(!$activity['classes_activity_auth_id']){
//创建新的审核记录
$activityAuth = new ActivityAuth;
$activityAuthData = $activity->toArray();
$activityAuthData = array_merge($activityAuthData,$params);
$activityAuthData["auth_status"] = 0;
$activityAuthData["classes_activity_id"] = $activity["id"];
unset($activityAuthData["id"]);
$activityAuth->allowField(true)->save($activityAuthData);
//创建审核的项
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $activityAuth["id"];
$v["classes_activity_id"] = $activity["id"];
$v["classes_activity_item_id"] = $v["id"] ?? 0;
$v["manystore_id"] = $params["manystore_id"];
$v["shop_id"] = $params["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItemAuth())->allowField(true)->save($v);
}
//并更新activity的classes_activity_auth_id 指向最新的审核记录
$activity["classes_activity_auth_id"] = $activityAuth["id"];
$activity->save();
}else{
//如果存在记录,则更新旧纪录信息为最新提交的认证信息
$activityAuthData = $activity->toArray();
$activityAuthData = array_merge($activityAuthData,$params);
$activityAuthData["auth_status"] = 0;
$activityAuthData["classes_activity_id"] = $activity["id"];
unset($activityAuthData["id"]);
$activityAuth->allowField(true)->save($activityAuthData);
//为了方便直接删除旧数据里的所有规格再添加新的规格因为只要classes_activity_id不变不会影响原订单
ActivityItemAuth::where( "classes_activity_auth_id",$activityAuth["id"])->delete();
//创建审核的项
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $activityAuth["id"];
$v["classes_activity_id"] = $activity["id"];
$v["classes_activity_item_id"] = $v["id"] ?? 0;
$v["manystore_id"] = $params["manystore_id"];
$v["shop_id"] = $params["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItemAuth())->allowField(true)->save($v);
}
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$activityAuth["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
}
return $res;
}
}

View File

@ -3,21 +3,25 @@
namespace app\common\model\school\classes\activity;
use app\admin\model\manystore\Shop;
use app\common\model\school\classes\activity\order\Order;
use app\common\model\BaseModel;
use app\common\model\dyqc\ManystoreShop;
use app\common\model\school\Area;
use app\common\model\school\classes\ClassesSpec;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
class ActivityAuth extends Model
class ActivityAuth extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_auth';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
@ -41,9 +45,29 @@ class ActivityAuth extends Model
'auth_status_text',
'expirestatus_text',
'add_type_text',
'auth_time_text'
'auth_time_text',
'has_expire',
];
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
public function getHasExpireAttr($value, $data)
{
$end_time = (isset($data['end_time']) ? $data['end_time'] : '');
if(!$end_time) return '2';
if( $end_time < time()) {
return '1';
}else{
return '2';
}
}
protected static function init()
{
@ -55,7 +79,7 @@ class ActivityAuth extends Model
});
}
public function getAddressTypeList()
{
return ['1' => __('Address_type 1'), '2' => __('Address_type 2')];
@ -240,6 +264,8 @@ class ActivityAuth extends Model
}
public function manystore()
{
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
@ -250,4 +276,354 @@ class ActivityAuth extends Model
{
return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function items()
{
return $this->hasMany(ActivityItem::class,'classes_activity_id', 'classes_activity_id')->order("weigh desc,id desc");
}
public function itemauths()
{
return $this->hasMany(ActivityItemAuth::class,'classes_activity_auth_id')->order("weigh desc,id desc");
}
public function activityCheck(&$params,$shop_id=null,$row=null,$oper_type='user',$oper_id=0)
{
$params["status"] = $params["status"] ?? '3';
if(!$shop_id)$shop_id = $params["shop_id"] ?? 0;
if(empty($params["weigh"]))$params["weigh"] = 0;
$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"];
//开始和结束时间不能为空
$time = $params["time"];
if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
$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("{$params["title"]}请选择开始和结束时间".$time);
}
//转化时间戳
$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("{$params["title"]}结束时间不能小于开始时间");
}
//开始和结束时间不能为空
$time = $params["sign_time"];
if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
$split_line = " - ";
$time_arr = explode($split_line,$time);
$params["sign_start_time"] = $time_arr[0] ;
$params["sign_end_time"] = $time_arr[1];
unset($params["sign_time"]);
$start_time = $params["sign_start_time"];
$end_time = $params["sign_end_time"];
if(empty($start_time) || empty($end_time)){
throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
}
//转化时间戳
$start_time = $params["sign_start_time"] && !is_numeric($params["sign_start_time"]) ? strtotime($params["sign_start_time"]) : $params["sign_start_time"];
$end_time = $params["sign_end_time"] && !is_numeric($params["sign_end_time"]) ? strtotime($params["sign_end_time"]) : $params["sign_end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
throw new \Exception("{$params["title"]}结束时间不能小于开始时间");
}
//课时必须大于等于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"])){
$province_name = Area::where("id" ,$params['province'])->value("name");
if(!$province_name) throw new \Exception("省份不存在");
$city_name = Area::where("id" ,$params['city'])->value("name");
if(!$city_name) throw new \Exception("市不存在");
$district_name = Area::where("id" ,$params['district'])->value("name");
if(!$district_name) throw new \Exception("区县不存在");
$params['address_city'] = $province_name."/".$city_name."/".$district_name;
}
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";
}
$rule = [
'manystore_id'=>'require',
'shop_id'=>'require',
'headimage' => 'require',
'title' => 'require',
'images' => 'require',
'address' => 'require',
'address_detail' => 'require',
'longitude' => 'require',
'latitude' => 'require',
'province' => 'require',
'city' => 'require',
'district' => 'require',
'address_city' => 'require',
'address_type' => 'require',
'content' => 'require',
'price' => 'require',
];
$rule_msg = [
"manystore_id.require"=>'机构id必填',
"shop_id.require"=>'机构id必填',
"headimage.require"=>'课程活动头图必填',
'title.require' => '活动名称必须填写',
'images.require' => '活动轮播图必须上传',
'address.require' => '地址必填',
'address_detail.require' => '详细地址必填',
'longitude.require' => '经度必填',
'latitude.require' => '纬度必填',
'province.require' => '省编号必填',
'city.require' => '市编号必填',
'district.require' => '县区编号必填',
'address_city.require' => '城市选择必填',
'address_type.require'=> '地址类型必填',
'content.require'=> '活动详情必填',
'price.require'=> '活动售价必填',
];
self::check($params,$rule,$rule_msg);
//更新
if($row){
// $this->have_auth = false;
// if($this->need_auth){
// //判断更新的变动数据
// $this->no_auth_fields_check($params,$row);
// if($this->have_auth){
// $params['status'] = "3";
// }
// }
// $this->updateCheck($row->id,$params,$row);
//名称title不能与其他课程重复
$check_title = self::where('id','<>',$row["id"])->where('classes_activity_id','<>',$row["classes_activity_id"])->where('title',$params["title"])->find();
if($check_title){
throw new \Exception("活动名称已存在或被其他机构占用,请更改!");
}
//如果存在课程规格,验证每个课时规格的合法性
if(isset($params["item_json"])){
//如果存在&quot;的HTML转义字符先反转义再解析json
$params["item_json"] = html_entity_decode($params["item_json"]);
$spec = json_decode($params["item_json"],true);
if(empty($spec))throw new \Exception("请至少添加一个课时规格");
foreach ($spec as $k=>&$v){
unset($v["limit"]);
unset($v["status_name"]);
unset($v["visible"]);
$v["classes_activity_auth_id"] = $row->id;
$v["classes_activity_id"] = $row->classes_activity_id ?? ($params["classes_activity_id"] ?? 0);
$v["manystore_id"] = $params["manystore_id"];
$v["shop_id"] = $shop_id;
//先不进行判定,交给提交后再判定
$classesSpec = new ActivityItemAuth();
$classesSpec->specCheck($v,$shop_id,empty($v["id"])? null : ActivityItemAuth::get($v["id"]),false,$oper_type,$oper_id);
}
$params["item_json"] = $spec;
}
}else{
//新增
//名称title不能重复
$check_title = self::where('title',$params["title"])->find();
if($check_title){
throw new \Exception("活动名称已存在或被其他机构占用,请更改!");
}
//如果存在课程规格,验证每个课时规格的合法性
if(isset($params["item_json"])){
//如果存在&quot;的HTML转义字符先反转义再解析json
$params["item_json"] = html_entity_decode($params["item_json"]);
$spec = json_decode($params["item_json"],true);
if(empty($spec))throw new \Exception("请至少添加一个课时规格");
foreach ($spec as $k=>&$v){
unset($v["limit"]);
unset($v["status_name"]);
unset($v["id"]);
$v["classes_activity_auth_id"] = 0;
$v["classes_activity_id"] = $params["classes_activity_id"] ?? 0;
$v["manystore_id"] = $params["manystore_id"];
$v["shop_id"] = $shop_id;
(new ActivityItemAuth)->specCheck($v,$shop_id,null,true,$oper_type,$oper_id);
}
$params["item_json"] = $spec;
}
}
$params["delete_spec_ids"] = [];
//按前端顺序分配显示权重
if(isset($params["item_json"]) && $params["item_json"]){
//数组倒过来
$params["item_json"] = array_reverse($params["item_json"]);
$insert_spec = [];
foreach ($params["item_json"] as $k=>&$v){
$v["weigh"] = $k + 1;
if(!empty($v["id"]))$insert_spec[] = $v["id"];
}
if($insert_spec && $row){
$params["delete_spec_ids"] = ActivityItemAuth::where("classes_activity_auth_id",$row->id)->where("id","not in",$insert_spec)->column("id");
}
}
//存在需要删除的规格则判断规格是否能删除
if($params["delete_spec_ids"] && $row){
$check_spec = ActivityItemAuth::where("classes_activity_auth_id",$row->id)->where("id","in",$params["delete_spec_ids"])->select();
foreach ($check_spec as $k=>$vv){
(new ActivityItemAuth)->updateCheck($vv->id);
}
$params["delete_spec_ids"] = $check_spec;
}
//如果是上架,判断是否拥有课时规格,没有则无法上架
if(empty($params["item_json"])){
if(!$row)throw new \Exception("新添加的活动请先至少添加一个活动规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = ActivityItemAuth::where("classes_activity_auth_id",$row->id)->count();
if(!$check_spec)throw new \Exception("新添加的活动请先至少添加一个活动规格后再上架!");
}
}
public function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_item_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("{$order['name']}存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
}

View File

@ -3,21 +3,24 @@
namespace app\common\model\school\classes\activity;
use app\admin\model\manystore\Shop;
use app\admin\model\school\classes\activity\Order;
use app\common\model\BaseModel;
use app\common\model\dyqc\ManystoreShop;
use app\common\model\school\classes\ClassesSpec;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
class ActivityItemAuth extends Model
class ActivityItemAuth extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_item_auth';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
@ -31,7 +34,7 @@ class ActivityItemAuth extends Model
'status_text',
'sex_text'
];
protected static function init()
{
@ -43,7 +46,7 @@ class ActivityItemAuth extends Model
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
@ -89,4 +92,172 @@ class ActivityItemAuth extends Model
{
return $this->belongsTo(Activity::class, 'classes_activity_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function activityauth()
{
return $this->belongsTo(Activity::class, 'classes_activity_auth_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function specCheck(&$params,$shop_id=null,$row=null,$check=true,$oper_type='user',$oper_id=0)
{
//限定人数必须大于0
$limit_num = $params["limit_num"];
if($limit_num<=0){
throw new \Exception("{$params["name"]}限定人数必须大于0");
}
//收费免费判断
if($params["price"]==0){
$params["feel"] = "1";
}else{
//个人认证无法下付费课程
$shop = ManystoreShop::where("id",$params["shop_id"] )->find();
if($shop["type"]=="1"){
throw new \Exception("这个机构属于个人认证,无法发布付费活动!");
}
$params["feel"] = "0";
}
//开始和结束时间不能为空
// $time = $params["time"];
//
// if(empty($time))throw new \Exception("{$params["name"]}请选择开始和结束时间".$time);
// $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("{$params["name"]}请选择开始和结束时间".$time);
// }
// //转化时间戳
// $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("{$params["name"]}结束时间不能小于开始时间");
// }
//
// //结束时间不能是已经过去的时间
// $now_time = time();
// if($end_time<=$now_time){
// throw new \Exception("{$params["name"]}结束时间不能是已经过去的时间");
// }
// //如果是员工操作则结束时间必须大于当前时间n秒
// if($oper_type == "user" && $oper_id){
// $classes_timeout_time = config("site.classes_timeout_time") ?:0;
// if($classes_timeout_time > 0) {
// $now_times = time() + $classes_timeout_time;
// if($start_time<=$now_times){
// //$now_time时间格式化
// $now_time_text = date("Y-m-d H:i",$now_times);
// throw new \Exception("{$params["name"]}开始时间必须在{$now_time_text}之后");
// }
// }
//
// }
//开始和结束时间必须是同一天
// $start_time_date = date("Y-m-d",$start_time);
// $end_time_date = date("Y-m-d",$end_time);
// if($start_time_date!=$end_time_date){
// throw new \Exception("{$params["name"]}开始和结束时间必须是同一天");
// }
//
// $params["start_time"] = $start_time;
// $params["end_time"] = $end_time;
// $orderTimeTableName = (new ClassesSpec)->getWithAlisaName();
//修改
if($row){
//修复旧数据时间戳
// $row["start_time"]= strtotime(date("Y-m-d H:i",$row["start_time"]));
// $row["end_time"]= strtotime(date("Y-m-d H:i",$row["end_time"]));
//
$this->updateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_activity_auth_id"];
$spec_name_exist = self::where("name",$spec_name)->where("classes_activity_auth_id",$classes_lib_id)->where("id","<>",$row->id)->find();
if($spec_name_exist){
throw new \Exception("该活动下已存在该课时规格名称请重新输入1");
}
// //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
// $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($check && $spec_time_exist){
// throw new \Exception("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
// }
}else{
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_activity_auth_id"];
$spec_name_exist = self::where("name",$spec_name)->where("classes_activity_auth_id",$classes_lib_id)->find();
if($spec_name_exist){
throw new \Exception("该活动下已存在该课时规格名称请重新输入2");
}
// //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
// $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($check && $spec_time_exist){
// throw new \Exception("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
// }
}
}
public function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_item_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("{$order['name']}存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
}

View File

@ -4,6 +4,7 @@ namespace app\manystore\controller\school\classes\activity;
use app\common\controller\ManystoreBase;
use app\common\model\manystore\UserAuth;
use app\common\model\school\classes\activity\order\Order;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
@ -28,6 +29,10 @@ class Activity extends ManystoreBase
protected $qSwitch = true;
protected $qFields = ["user_id","shop_id","manystore_id"];
//不用审核允许修改的字段
protected $no_auth_fields = ['headimage','images',"status"];
protected $need_auth = true;
public function _initialize()
{
@ -79,11 +84,33 @@ class Activity extends ManystoreBase
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
$as = (new \app\common\model\school\classes\activity\Activity)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$expireWhere = [[]];
}
$list = $this->model
->with(['manystore','manystoreshop'])
->where($where)
->where(...$expireWhere)
->order($sort, $order)
->paginate($limit);
@ -108,7 +135,16 @@ class Activity extends ManystoreBase
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_item_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("{$order['name']}存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
@ -116,68 +152,42 @@ class Activity extends ManystoreBase
{
//开始和结束时间不能为空
$time = $params["time"];
try {
if($row){
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
if($params["status"] != '3' && $row["status"] == '3'){
throw new \Exception("已被平台下架!无法操作上架状态!");
}
}
if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
$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("{$params["title"]}请选择开始和结束时间".$time);
}
//转化时间戳
$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("{$params["title"]}结束时间不能小于开始时间");
$classesLib = new \app\common\model\school\classes\activity\Activity();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->activityCheck($params,null,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
//开始和结束时间不能为空
$time = $params["sign_time"];
if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
$split_line = " - ";
$time_arr = explode($split_line,$time);
$params["sign_start_time"] = $time_arr[0] ;
$params["sign_end_time"] = $time_arr[1];
unset($params["sign_time"]);
$start_time = $params["sign_start_time"];
$end_time = $params["sign_end_time"];
if(empty($start_time) || empty($end_time)){
throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
}
//转化时间戳
$start_time = $params["sign_start_time"] && !is_numeric($params["sign_start_time"]) ? strtotime($params["sign_start_time"]) : $params["sign_start_time"];
$end_time = $params["sign_end_time"] && !is_numeric($params["sign_end_time"]) ? strtotime($params["sign_end_time"]) : $params["sign_end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
throw new \Exception("{$params["title"]}结束时间不能小于开始时间");
}
//修改
if($row){
}else{
//新增
//新增
$params["add_type"] = '1';
$params["add_id"] = $this->auth->id;
}
}
@ -204,11 +214,7 @@ class Activity extends ManystoreBase
$params['shop_id'] = SHOP_ID;
}
try {
$this->update_check($params,$row=null);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
$result = false;
Db::startTrans();
try {
@ -219,7 +225,28 @@ class Activity extends ManystoreBase
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$spec = $params["item_json"];
unset($params["item_json"]);
$result = $this->model->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_id"] = $this->model["id"];
$v["manystore_id"] = $this->model["manystore_id"];
$v["shop_id"] = $this->model["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItem())->allowField(true)->save($v);
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$this->model["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItem)->specCheck($params,null,$specs);
}
$this->update_classes($this->model["id"]);
Db::commit();
} catch (ValidateException $e) {
@ -262,12 +289,6 @@ class Activity extends ManystoreBase
$params = $this->preExcludeFields($params);
$result = false;
try {
$this->update_check($params,$row);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
Db::startTrans();
try {
@ -278,9 +299,53 @@ class Activity extends ManystoreBase
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
if($this->have_auth){
(new \app\common\model\school\classes\activity\Activity)->applyAuth($row["id"],$params);
$result = true;
}else{
$spec = $params["item_json"] ?? [];
// var_dump($spec);
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["item_json"]);
unset($params["delete_spec_ids"]);
$result = $row->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_id"] = $row["id"];
$v["manystore_id"] = $row["manystore_id"];
$v["shop_id"] = $row["shop_id"];
//有id更新否则新增
if(isset($v["id"]) && $v["id"]){
\app\common\model\school\classes\activity\ActivityItem::update((new \app\common\model\school\classes\activity\ActivityItem)->checkAssemblyParameters($v));
}else{
\app\common\model\school\classes\activity\ActivityItem::create((new \app\common\model\school\classes\activity\ActivityItem)->checkAssemblyParameters($v));
}
}
//删除规格
foreach ($delete_spec_ids as $k=>$delete_spec){
(new \app\common\model\school\classes\activity\ActivityItem)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$row["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItem)->specCheck($params,null,$specs);
}
}
$this->update_classes($row["id"]);
Db::commit();
} catch (ValidateException $e) {
@ -303,9 +368,15 @@ class Activity extends ManystoreBase
}
$user = User::where("id", $row["user_id"])->find();
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
// $user = User::where("id", $row["user_id"])->find();
//// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
// $row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$spec = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$row["id"])->field("id,classes_activity_id,name,price,age,sex,limit_num,status,weigh")->order('weigh desc,id desc')->select();
$row["item_json"] = json_encode($spec);
$this->view->assign("row", $row);
return $this->view->fetch();
}
@ -332,6 +403,12 @@ class Activity extends ManystoreBase
Db::startTrans();
try {
foreach ($list as $k => $v) {
//删除课程规格
\app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$item->id)->delete();
//删除课程规格
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_id",$item->id)->delete();
\app\common\model\school\classes\activity\ActivityAuth::where("classes_activity_id",$item->id)->delete();
$count += $v->delete();
}
Db::commit();

View File

@ -3,6 +3,12 @@
namespace app\manystore\controller\school\classes\activity;
use app\common\controller\ManystoreBase;
use app\common\model\school\classes\activity\order\Order;
use app\common\model\User;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程活动审核
@ -17,11 +23,17 @@ class ActivityAuth extends ManystoreBase
* @var \app\manystore\model\school\classes\activity\ActivityAuth
*/
protected $model = null;
protected $itemmodel = null;
//不用审核允许修改的字段
protected $no_auth_fields = ['headimage','images','content',"price"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\ActivityAuth;
$this->itemmodel = new \app\manystore\model\school\classes\activity\ActivityItemAuth();
parent::_initialize();
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("recommendList", $this->model->getRecommendList());
@ -31,6 +43,15 @@ class ActivityAuth extends ManystoreBase
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
$this->view->assign("expirestatusList", $this->model->getExpirestatusList());
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->getCity();
$this->view->assign("itemStatusList", $this->itemmodel->getStatusList());
$this->view->assign("sexList", $this->itemmodel->getSexList());
}
public function import()
@ -59,16 +80,38 @@ class ActivityAuth extends ManystoreBase
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
$as = (new \app\common\model\school\classes\activity\ActivityAuth)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$expireWhere = [[]];
}
$list = $this->model
->with(['schoolclassesactivity','manystore','manystoreshop'])
->where($where)
->where(...$expireWhere)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesactivity')->visible(['id']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
@ -81,4 +124,324 @@ class ActivityAuth extends ManystoreBase
return $this->view->fetch();
}
protected function update_classes($classes_activity_id,$row=null){
if($classes_activity_id && $row){
$activity = \app\common\model\school\classes\activity\Activity::where("id",$classes_activity_id)->find();
if($activity && in_array($row["auth_status"],[0,2])){
$activity["classes_activity_auth_id"] = $row["id"];
$activity->save();
}
}
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_item_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("{$order['name']}存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
protected function update_check(&$params,$row=null)
{
//只要提交,就审核
$params["auth_status"] = 0;
$params["classes_activity_id"] = $params["classes_activity_id"] ?? 0;
if($row){
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
//查询是否存在活动如果存在附上活动id
$activity = \app\common\model\school\classes\activity\Activity::where("id",$row["classes_activity_id"])->find();
if($activity && empty($params["classes_activity_id"])){
$params["classes_activity_id"] = $activity["id"];
}
}
try {
$classesLib = new \app\common\model\school\classes\activity\ActivityAuth();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->activityCheck($params,null,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
//修改
if($row){
}else{
//新增
//新增
$params["add_type"] = '1';
$params["add_id"] = $this->auth->id;
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
// $this->error(__('添加功能已被禁用!', ''));
$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);
$spec = $params["item_json"];
unset($params["item_json"]);
$result = $this->model->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $this->model["id"];
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($this->model->classes_activity_id ?? 0);
$v["manystore_id"] = $this->model["manystore_id"];
$v["shop_id"] = $this->model["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItemAuth())->allowField(true)->save($v);
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$this->model["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
$this->update_classes($this->model["classes_activity_id"] ?? 0,$this->model);
//调用事件
$data = ['activity' => $this->model];
\think\Hook::listen('activity_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();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
$spec = $params["item_json"] ?? [];
// var_dump($spec);
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["item_json"]);
unset($params["delete_spec_ids"]);
$result = $row->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $row["id"];
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($row->classes_activity_id ?? 0);
$v["manystore_id"] = $row["manystore_id"];
$v["shop_id"] = $row["shop_id"];
//有id更新否则新增
if(isset($v["id"]) && $v["id"]){
\app\common\model\school\classes\activity\ActivityItemAuth::update((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
}else{
\app\common\model\school\classes\activity\ActivityItemAuth::create((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
}
}
//删除规格
foreach ($delete_spec_ids as $k=>$delete_spec){
(new \app\common\model\school\classes\activity\ActivityItemAuth)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs;
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
$this->update_classes($row["classes_activity_id"],$row);
//调用事件
$data = ['activity' => $row];
\think\Hook::listen('activity_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 updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$spec = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->field("id,classes_activity_id,name,price,age,sex,limit_num,status,weigh")->order('weigh desc,id desc')->select();
$row["item_json"] = json_encode($spec);
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
//删除课程规格
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$item->id)->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -65,4 +65,8 @@ return [
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
'OK' => '确认提交审核',
];

View File

@ -65,5 +65,16 @@ return [
'Deletetime' => '删除时间',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO'
'Manystoreshop.logo' => '品牌LOGO',
'Sex' => '性别限制',
'Sex 1' => '男',
'Sex 2' => '女',
'Sex 3' => '男女不限',
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
'OK' => '确认提交重新审核',
];

View File

@ -51,12 +51,12 @@ class Message extends Model
public function getStatusList()
{
return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order')];
return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order'),'activity' => __('Status activity')];
}
public function getMiniTypeList()
{
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'),'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
}

View File

@ -38,8 +38,28 @@ class Activity extends Model
'new_text',
'selfhot_text',
'expirestatus_text',
'add_type_text'
'add_type_text',
'has_expire',
];
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
public function getHasExpireAttr($value, $data)
{
$end_time = (isset($data['end_time']) ? $data['end_time'] : '');
if(!$end_time) return '2';
if( $end_time < time()) {
return '1';
}else{
return '2';
}
}
protected static function init()

View File

@ -40,8 +40,28 @@ class ActivityAuth extends Model
'auth_status_text',
'expirestatus_text',
'add_type_text',
'auth_time_text'
'auth_time_text',
'has_expire',
];
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
public function getHasExpireAttr($value, $data)
{
$end_time = (isset($data['end_time']) ? $data['end_time'] : '');
if(!$end_time) return '2';
if( $end_time < time()) {
return '1';
}else{
return '2';
}
}
protected static function init()

View File

@ -1,11 +1,7 @@
<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" 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">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
@ -18,7 +14,7 @@
<div class="input-group">
<input id="c-headimage" data-rule="required" class="form-control" 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" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -32,7 +28,7 @@
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" 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" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -40,90 +36,149 @@
<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">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<!-- <td>开始结束时间</td>-->
<td>限定人数</td>
<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[item_json]" id="item_json" class="form-control hide" cols="30" rows="8"></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="15" 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="25" />-->
<!-- &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->
<!-- </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%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></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 class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['status']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['sex']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></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">
<select id="c-address_type" data-rule="required" class="form-control selectpicker" name="row[address_type]">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
<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}
</select>
<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="{$q_address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$q_province_code}" >
<input type="hidden" id="city" name="row[city]" value="{$q_city_code}" >
<input type="hidden" id="district" name="row[district]" value="{$q_area_code}" >
</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">{:__('Address_city')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('活动开始结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-address_city" class="form-control" data-toggle="city-picker" name="row[address_city]" type="text"></div>
<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">{:__('Province')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" class="form-control" name="row[province]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-city" class="form-control" name="row[city]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" class="form-control" name="row[district]" type="number">
</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">
<input id="c-address" class="form-control" name="row[address]" type="text">
</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="">
</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-8">
<input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="">
</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">{:__('Sign_start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_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">{:__('Sign_end_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
<input id="c-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_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">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
@ -148,14 +203,22 @@
<textarea id="c-content" data-rule="required" 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">{:__('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}
{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>
@ -169,10 +232,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -181,10 +244,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -193,10 +256,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -205,63 +268,18 @@
<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>
<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">{:__('Sale')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale" class="form-control" name="row[sale]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-stock" class="form-control" name="row[stock]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Expirestatus')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="expirestatusList" item="vo"}
<label for="row[expirestatus]-{$key}"><input id="row[expirestatus]-{$key}" name="row[expirestatus]" 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">{:__('Add_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-add_type" data-rule="required" 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 layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">

View File

@ -1,11 +1,6 @@
<form id="edit-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" class="form-control selectpage" name="row[manystore_id]" type="text" value="{$row.manystore_id|htmlentities}">
</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">
@ -18,7 +13,7 @@
<div class="input-group">
<input id="c-headimage" data-rule="required" class="form-control" size="50" name="row[headimage]" type="text" value="{$row.headimage|htmlentities}">
<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" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -32,7 +27,7 @@
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<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" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -40,90 +35,142 @@
<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">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<!-- <td>开始结束时间</td>-->
<td>限定人数</td>
<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[item_json]" id="item_json" class="form-control hide" cols="30" rows="8">{$row.item_json|htmlentities}</textarea>
</table>
<!-- <span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)</span>-->
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td>
<input type="hidden" name="row[<%=name%>][<%=index%>][id]" class="form-control" value="<%=row['id']%>" size="20" >
<input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="15" 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="25" />-->
<!-- &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->
<!-- </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%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></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 class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" <%if(row.status=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" <%if(row.sex=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></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">
<select id="c-address_type" data-rule="required" class="form-control selectpicker" name="row[address_type]">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.address_type"}selected{/in}>{$vo}</option>
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
{/foreach}
</select>
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
</div>
</div>
</div>
<div id="c_position" {eq name="$row.address_type" value="1"} style="display: none" {/eq} >
<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" data-toggle="city-picker" name="row[address_city]" type="text" value="{$row.address_city|htmlentities}"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" class="form-control" name="row[province]" type="number" value="{$row.province|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-city" class="form-control" name="row[city]" type="number" value="{$row.city|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" class="form-control" name="row[district]" type="number" value="{$row.district|htmlentities}">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="{$row.address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$row.province}" >
<input type="hidden" id="city" name="row[city]" value="{$row.city}" >
<input type="hidden" id="district" name="row[district]" value="{$row.district}" >
</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">
<input id="c-address" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}">
<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="{$row.address}" 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="{$row.address_detail|htmlentities}">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="{$row.address_detail}" 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-8">
<input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="{$row.longitude|htmlentities}">
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="{$row.longitude}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="{$row.latitude|htmlentities}">
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="{$row.latitude}">
</div>
</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">{:__('活动开始结束时间')}:</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):''}">
<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">{:__('End_time')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</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">{:__('Sign_start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_start_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_end_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_end_time]" type="text" value="{:$row.sign_end_time?datetime($row.sign_end_time):''}">
<input id="c-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''} - {:$row.sign_end_time?datetime($row.sign_end_time):''}">
</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">
@ -148,14 +195,19 @@
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</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="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
{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="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
@ -169,10 +221,10 @@
<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="$row.recommend"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.recommend"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -181,10 +233,10 @@
<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="$row.hot"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.hot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -193,10 +245,10 @@
<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="$row.new"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.new"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -205,63 +257,16 @@
<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="$row.selfhot"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.selfhot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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" value="{$row.sale|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-stock" class="form-control" name="row[stock]" type="number" value="{$row.stock|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="{$row.views|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Expirestatus')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="expirestatusList" item="vo"}
<label for="row[expirestatus]-{$key}"><input id="row[expirestatus]-{$key}" name="row[expirestatus]" type="radio" value="{$key}" {in name="key" value="$row.expirestatus"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</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" data-rule="required" class="form-control selectpicker" name="row[add_type]">
{foreach name="addTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.add_type"}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="{$row.add_id|htmlentities}">
</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">

View File

@ -1,17 +1,7 @@
<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">{:__('Classes_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="">
</div>
</div>
<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" 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">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
@ -24,7 +14,7 @@
<div class="input-group">
<input id="c-headimage" data-rule="required" class="form-control" 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" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -38,7 +28,7 @@
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" 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" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -46,90 +36,149 @@
<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">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<!-- <td>开始结束时间</td>-->
<td>限定人数</td>
<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[item_json]" id="item_json" class="form-control hide" cols="30" rows="8"></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="15" 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="25" />-->
<!-- &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->
<!-- </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%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></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 class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['status']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['sex']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></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">
<select id="c-address_type" data-rule="required" class="form-control selectpicker" name="row[address_type]">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
<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}
</select>
<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="{$q_address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$q_province_code}" >
<input type="hidden" id="city" name="row[city]" value="{$q_city_code}" >
<input type="hidden" id="district" name="row[district]" value="{$q_area_code}" >
</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">{:__('Address_city')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('活动开始结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-address_city" class="form-control" data-toggle="city-picker" name="row[address_city]" type="text"></div>
<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">{:__('Province')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" class="form-control" name="row[province]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-city" class="form-control" name="row[city]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" class="form-control" name="row[district]" type="number">
</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">
<input id="c-address" class="form-control" name="row[address]" type="text">
</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="">
</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-8">
<input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="">
</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">{:__('Sign_start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_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">{:__('Sign_end_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
<input id="c-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_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">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
@ -154,14 +203,22 @@
<textarea id="c-content" data-rule="required" 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">{:__('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}
{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>
@ -175,10 +232,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -187,10 +244,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -199,10 +256,10 @@
<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>
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -211,93 +268,18 @@
<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>
<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">{:__('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">{:__('Sale')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale" class="form-control" name="row[sale]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-stock" class="form-control" name="row[stock]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Expirestatus')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="expirestatusList" item="vo"}
<label for="row[expirestatus]-{$key}"><input id="row[expirestatus]-{$key}" name="row[expirestatus]" 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">{:__('Add_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-add_type" data-rule="required" 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">{:__('Admin_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-admin_id" data-rule="required" data-source="auth/admin/selectpage" class="form-control selectpage" name="row[admin_id]" 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 layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">

View File

@ -1,17 +1,25 @@
<form id="edit-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">{:__('Classes_activity_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="{$row.classes_activity_id|htmlentities}">
</div>
</div>
<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" class="form-control selectpage" name="row[manystore_id]" type="text" value="{$row.manystore_id|htmlentities}">
<div class="radio">
{foreach name="authStatusList" item="vo"}
<label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" disabled type="radio" value="{$key}" {in name="key" value="$row.auth_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
{if ( $row.auth_status == 2) }
<span style="color: red">(不通过原因:{$row.reason})</span>
{else /}
{/if}
</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">
@ -24,7 +32,7 @@
<div class="input-group">
<input id="c-headimage" data-rule="required" class="form-control" size="50" name="row[headimage]" type="text" value="{$row.headimage|htmlentities}">
<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" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -38,7 +46,7 @@
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<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" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<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>
@ -46,90 +54,142 @@
<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">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<!-- <td>开始结束时间</td>-->
<td>限定人数</td>
<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[item_json]" id="item_json" class="form-control hide" cols="30" rows="8">{$row.item_json|htmlentities}</textarea>
</table>
<!-- <span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)</span>-->
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td>
<input type="hidden" name="row[<%=name%>][<%=index%>][id]" class="form-control" value="<%=row['id']%>" size="20" >
<input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="15" 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="25" />-->
<!-- &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->
<!-- </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%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></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 class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" <%if(row.status=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" <%if(row.sex=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></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">
<select id="c-address_type" data-rule="required" class="form-control selectpicker" name="row[address_type]">
<div class="radio">
{foreach name="addressTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.address_type"}selected{/in}>{$vo}</option>
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
{/foreach}
</select>
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
</div>
</div>
</div>
<div id="c_position" {eq name="$row.address_type" value="1"} style="display: none" {/eq} >
<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" data-toggle="city-picker" name="row[address_city]" type="text" value="{$row.address_city|htmlentities}"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" class="form-control" name="row[province]" type="number" value="{$row.province|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-city" class="form-control" name="row[city]" type="number" value="{$row.city|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" class="form-control" name="row[district]" type="number" value="{$row.district|htmlentities}">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="{$row.address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$row.province}" >
<input type="hidden" id="city" name="row[city]" value="{$row.city}" >
<input type="hidden" id="district" name="row[district]" value="{$row.district}" >
</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">
<input id="c-address" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}">
<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="{$row.address}" 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="{$row.address_detail|htmlentities}">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="{$row.address_detail}" 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-8">
<input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="{$row.longitude|htmlentities}">
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="{$row.longitude}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="{$row.latitude|htmlentities}">
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="{$row.latitude}">
</div>
</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">{:__('活动开始结束时间')}:</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):''}">
<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">{:__('End_time')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</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">{:__('Sign_start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_start_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_end_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[sign_end_time]" type="text" value="{:$row.sign_end_time?datetime($row.sign_end_time):''}">
<input id="c-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''} - {:$row.sign_end_time?datetime($row.sign_end_time):''}">
</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">
@ -154,14 +214,19 @@
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</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="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
{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="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
@ -175,10 +240,10 @@
<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="$row.recommend"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.recommend"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -187,10 +252,10 @@
<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="$row.hot"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.hot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -199,10 +264,10 @@
<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="$row.new"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.new"}selected{/in}>{$vo}</option>
{/foreach}
</select>
@ -211,93 +276,16 @@
<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="$row.selfhot"}selected{/in}>{$vo}</option>
<option value="{$key}" {in name="key" value="$row.selfhot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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="$row.auth_status"}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="{$row.reason|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">
<input id="c-sale" class="form-control" name="row[sale]" type="number" value="{$row.sale|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-stock" class="form-control" name="row[stock]" type="number" value="{$row.stock|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="{$row.views|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Expirestatus')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="expirestatusList" item="vo"}
<label for="row[expirestatus]-{$key}"><input id="row[expirestatus]-{$key}" name="row[expirestatus]" type="radio" value="{$key}" {in name="key" value="$row.expirestatus"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</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" data-rule="required" class="form-control selectpicker" name="row[add_type]">
{foreach name="addTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.add_type"}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="{$row.add_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Admin_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-admin_id" data-rule="required" data-source="auth/admin/selectpage" class="form-control selectpage" name="row[admin_id]" type="text" value="{$row.admin_id|htmlentities}">
</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="{:$row.auth_time?datetime($row.auth_time):''}">
</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">

View File

@ -17,17 +17,17 @@
<div class="widget-body no-padding">
<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/activity/activity_auth/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/activity/activity_auth/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/activity/activity_auth/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/activity/activity_auth/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('school/classes/activity/activity_auth/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
<!-- <div class="dropdown btn-group {:$auth->check('school/classes/activity/activity_auth/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('school/classes/activity/activity_auth/recyclebin')?'':'hide'}" href="school/classes/activity/activity_auth/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
</div>

View File

@ -33,6 +33,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'has_expire', title: __('Has_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费活动'),"1":__('免费活动')}, formatter: Table.api.formatter.normal},
{field: 'address_type', title: __('Address_type'), searchList: {"1":__('Address_type 1'),"2":__('Address_type 2')}, formatter: Table.api.formatter.normal},
{field: 'address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'province', title: __('Province')},
@ -49,8 +57,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'people_num', title: __('People_num')},
{field: 'item', title: __('Item'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'recommend', title: __('Recommend'), searchList: {"0":__('Recommend 0'),"1":__('Recommend 1')}, formatter: Table.api.formatter.normal},
{field: 'hot', title: __('Hot'), searchList: {"0":__('Hot 0'),"1":__('Hot 1')}, formatter: Table.api.formatter.normal},
{field: 'new', title: __('New'), searchList: {"0":__('New 0'),"1":__('New 1')}, formatter: Table.api.formatter.normal},
@ -66,7 +73,60 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
{field: 'shop.logo', title: __('Shop.logo'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'activity_auth',
text: __('审核记录'),
title: __('审核记录'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar-check-o',
dropdown : '更多',
url: activity_auth_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
{
name: 'activity',
text: __('有审核!'),
title: __('有审核!'),
classname: 'btn btn-xs btn-danger btn-dialog',
icon: 'fa fa-sign-in',
url: activity_url,
callback: function (data) {
},
visible: function (row) {
return row.classes_activity_auth_id;
}
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
@ -289,5 +349,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var activity_auth_url = function (row,dom) {
return 'school/classes/activity/activity_auth/index?classes_activity_id='+row.id;
}
var activity_url = function (row,dom) {
return 'school/classes/activity/activity_auth/edit/ids/'+row.classes_activity_auth_id;
}
return Controller;
});

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/activity/activity_auth/index' + location.search,
add_url: 'school/classes/activity/activity_auth/add',
edit_url: 'school/classes/activity/activity_auth/edit',
add_url: 'school/classes/activity/activity_auth/add'+ location.search,
edit_url: 'school/classes/activity/activity_auth/edit'+ location.search,
del_url: 'school/classes/activity/activity_auth/del',
multi_url: 'school/classes/activity/activity_auth/multi',
import_url: 'school/classes/activity/activity_auth/import',
@ -34,6 +34,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'has_expire', title: __('Has_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费活动'),"1":__('免费活动')}, formatter: Table.api.formatter.normal},
{field: 'address_type', title: __('Address_type'), searchList: {"1":__('Address_type 1'),"2":__('Address_type 2')}, formatter: Table.api.formatter.normal},
{field: 'address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'province', title: __('Province')},
@ -50,14 +58,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'people_num', title: __('People_num')},
{field: 'item', title: __('Item'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'recommend', title: __('Recommend'), searchList: {"0":__('Recommend 0'),"1":__('Recommend 1')}, formatter: Table.api.formatter.normal},
{field: 'hot', title: __('Hot'), searchList: {"0":__('Hot 0'),"1":__('Hot 1')}, formatter: Table.api.formatter.normal},
{field: 'new', title: __('New'), searchList: {"0":__('New 0'),"1":__('New 1')}, formatter: Table.api.formatter.normal},
{field: 'selfhot', title: __('Selfhot'), searchList: {"0":__('Selfhot 0'),"1":__('Selfhot 1')}, formatter: Table.api.formatter.normal},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'reason', title: __('Reason'), operate: 'LIKE'},
{field: 'reason', title: __('Reason'), operate: 'LIKE'},
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
@ -77,6 +83,25 @@ 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 = ['98%','98%'];
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);
});
// 为表格绑定事件
Table.api.bindevent(table);
},
@ -143,15 +168,139 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
add: function () {
Controller.api.bindevent();
generrate.setOfflineType($("input:radio[name='row[address_type]']").val());
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$(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("dp.change", "#edit-form .datetimerange", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#edit-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) + "')");
// })
});
$(document).on("fa.event.appendfieldlist", "#edit-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) + "')");
// })
});
$("#c-address_city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var province = citypicker.getCode("province");
var city = citypicker.getCode("city");
var district = citypicker.getCode("district");
if(province){
$("#province").val(province);
}
if(city){
$("#city").val(city);
}
if(district){
$("#district").val(district);
}
$(this).blur();
});
generrate.listen();
$(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 = ['98%','98%'];
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]"));
}
}
};
var generrate = {
listen:function () {
this.offlineListen();
this.priceListen();
},
offlineListen:function () {
var that = this;
// console.log($("input:radio[name='row[address_type]']").val())
// this.setOfflineType($("input:radio[name='row[address_type]']").val());
$("input:radio[name='row[address_type]']").change(function (){
that.setOfflineType($(this).val());
});
},
setOfflineType:function (val) {
switch (val) {
case '1':
$('#c_position').hide();
break;
case '2':
$('#c_position').show();
break;
}
},
priceListen:function () {
$('#spec').bind('input propertychange', function(){
var length = $("#spec").val().length;
console.log(length);
});
}
}
return Controller;
});

View File

@ -596,7 +596,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
return 'manystore/index/index?id='+row.classes_activity_auth_id;
}

View File

@ -33,8 +33,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'messageevent.logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"system":__('Status system'),"classes":__('Status classes'),"order":__('Status order')}, formatter: Table.api.formatter.status},
{field: 'mini_type', title: __('Mini_type'), searchList: {"order_notice":__('Mini_type order_notice'),"classes_auth":__('Mini_type classes_auth'),"classes_apply":__('Mini_type classes_apply'),"shop_apply":__('Mini_type shop_apply'),"classes_order_notice":__('Mini_type classes_order_notice'),"user_auth":__('Mini_type user_auth'),"aftercare":__('Mini_type aftercare'),"other":__('Mini_type other')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: statusListJson, formatter: Table.api.formatter.status},
{field: 'mini_type', title: __('Mini_type'), searchList:miniTypeListJson, formatter: Table.api.formatter.normal},
{field: 'event', title: __('Event'),visible:false, operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},

View File

@ -6,7 +6,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/activity/activity/index' + location.search,
add_url: 'school/classes/activity/activity/add' + location.search,
add_url: 'school/classes/activity/activity_auth/add'+ location.search,
edit_url: 'school/classes/activity/activity/edit' + location.search,
del_url: 'school/classes/activity/activity/del',
multi_url: 'school/classes/activity/activity/multi',
@ -22,6 +22,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
@ -31,6 +33,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'has_expire', title: __('Has_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费活动'),"1":__('免费活动')}, formatter: Table.api.formatter.normal},
{field: 'address_type', title: __('Address_type'), searchList: {"1":__('Address_type 1'),"2":__('Address_type 2')}, formatter: Table.api.formatter.normal},
{field: 'address_city', title: __('Address_city'), operate: 'LIKE'},
{field: 'province', title: __('Province')},
@ -47,7 +60,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'people_num', title: __('People_num')},
{field: 'item', title: __('Item'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'recommend', title: __('Recommend'), searchList: {"0":__('Recommend 0'),"1":__('Recommend 1')}, formatter: Table.api.formatter.normal},
{field: 'hot', title: __('Hot'), searchList: {"0":__('Hot 0'),"1":__('Hot 1')}, formatter: Table.api.formatter.normal},
@ -64,7 +76,58 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
{field: 'manystoreshop.logo', title: __('Manystoreshop.logo'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'activity_auth',
text: __('审核记录'),
title: __('审核记录'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar-check-o',
dropdown : '更多',
url: activity_auth_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
{
name: 'activity',
text: __('有审核!'),
title: __('有审核!'),
classname: 'btn btn-xs btn-danger btn-dialog',
icon: 'fa fa-sign-in',
url: activity_url,
callback: function (data) {
},
visible: function (row) {
return row.classes_activity_auth_id;
}
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
@ -287,5 +350,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var activity_auth_url = function (row,dom) {
return 'school/classes/activity/activity_auth/index?classes_activity_id='+row.id;
}
var activity_url = function (row,dom) {
return 'school/classes/activity/activity_auth/edit/ids/'+row.classes_activity_auth_id;
}
return Controller;
});

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/activity/activity_auth/index' + location.search,
add_url: 'school/classes/activity/activity_auth/add',
edit_url: 'school/classes/activity/activity_auth/edit',
add_url: 'school/classes/activity/activity_auth/add'+ location.search,
edit_url: 'school/classes/activity/activity_auth/edit'+ location.search,
del_url: 'school/classes/activity/activity_auth/del',
multi_url: 'school/classes/activity/activity_auth/multi',
import_url: 'school/classes/activity/activity_auth/import',
@ -32,6 +32,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'has_expire', title: __('Has_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费活动'),"1":__('免费活动')}, formatter: Table.api.formatter.normal},
{field: 'address_type', title: __('Address_type'), searchList: {"1":__('Address_type 1'),"2":__('Address_type 2')}, formatter: Table.api.formatter.normal},
{field: 'address_city', title: __('Address_city'), operate: 'LIKE'},
{field: 'province', title: __('Province')},
@ -48,14 +57,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'people_num', title: __('People_num')},
{field: 'item', title: __('Item'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'recommend', title: __('Recommend'), searchList: {"0":__('Recommend 0'),"1":__('Recommend 1')}, formatter: Table.api.formatter.normal},
{field: 'hot', title: __('Hot'), searchList: {"0":__('Hot 0'),"1":__('Hot 1')}, formatter: Table.api.formatter.normal},
{field: 'new', title: __('New'), searchList: {"0":__('New 0'),"1":__('New 1')}, formatter: Table.api.formatter.normal},
{field: 'selfhot', title: __('Selfhot'), searchList: {"0":__('Selfhot 0'),"1":__('Selfhot 1')}, formatter: Table.api.formatter.normal},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'reason', title: __('Reason'), operate: 'LIKE'},
{field: 'reason', title: __('Reason'), operate: 'LIKE'},
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
@ -75,6 +82,25 @@ 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 = ['98%','98%'];
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);
});
// 为表格绑定事件
Table.api.bindevent(table);
},
@ -140,15 +166,138 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
add: function () {
Controller.api.bindevent();
generrate.setOfflineType($("input:radio[name='row[address_type]']").val());
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$(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("dp.change", "#edit-form .datetimerange", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#edit-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) + "')");
// })
});
$(document).on("fa.event.appendfieldlist", "#edit-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) + "')");
// })
});
$("#c-address_city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var province = citypicker.getCode("province");
var city = citypicker.getCode("city");
var district = citypicker.getCode("district");
if(province){
$("#province").val(province);
}
if(city){
$("#city").val(city);
}
if(district){
$("#district").val(district);
}
$(this).blur();
});
generrate.listen();
$(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 = ['98%','98%'];
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]"));
}
}
};
var generrate = {
listen:function () {
this.offlineListen();
this.priceListen();
},
offlineListen:function () {
var that = this;
// console.log($("input:radio[name='row[address_type]']").val())
// this.setOfflineType($("input:radio[name='row[address_type]']").val());
$("input:radio[name='row[address_type]']").change(function (){
that.setOfflineType($(this).val());
});
},
setOfflineType:function (val) {
switch (val) {
case '1':
$('#c_position').hide();
break;
case '2':
$('#c_position').show();
break;
}
},
priceListen:function () {
$('#spec').bind('input propertychange', function(){
var length = $("#spec").val().length;
console.log(length);
});
}
}
return Controller;
});