完善功能

dev
曾超新 5 years ago
parent a0c3d5ea47
commit dfdd5364f1
  1. 47
      common/libs/MyLib.php
  2. 49
      common/models/GiftT.php
  3. 100
      common/models/GiftTicketTUse.php
  4. 22
      common/models/UserT.php
  5. 117
      common/models/ZhongjiTiaojian.php
  6. 159
      common/models/ZhongjiYingxiao.php
  7. 10
      frontend/controllers/CarController.php
  8. 19
      frontend/controllers/CommonController.php
  9. 221
      frontend/controllers/DatabaseController.php
  10. 461
      frontend/controllers/FinanceController.php
  11. 492
      frontend/controllers/GiftController.php
  12. 107
      frontend/controllers/MarketingStrategyController.php
  13. 61
      frontend/controllers/UserController.php
  14. 418
      frontend/views/car/edit.php
  15. 4
      frontend/views/common/index.php
  16. 121
      frontend/views/database/a-index-search.php
  17. 435
      frontend/views/database/a-index.php
  18. 43
      frontend/views/gift/ajax-car-index.php
  19. 46
      frontend/views/gift/ajax-company-index.php
  20. 223
      frontend/views/gift/edit.php
  21. 170
      frontend/views/gift/gift-out.php
  22. 96
      frontend/views/gift/gift-tj.php
  23. 172
      frontend/views/gift/gift-use.php
  24. 86
      frontend/views/gift/gift2-edit.php
  25. 78
      frontend/views/gift/gift2-list.php
  26. 86
      frontend/views/gift/gift3-edit.php
  27. 78
      frontend/views/gift/gift3-list.php
  28. 178
      frontend/views/gift/index.php
  29. 65
      frontend/views/gift/stastics.php
  30. 96
      frontend/views/gift/ticket-tj.php
  31. 4
      frontend/views/layouts/blue-main.php
  32. 95
      frontend/views/marketing-strategy/add.php
  33. 104
      frontend/views/marketing-strategy/edit.php
  34. 101
      frontend/views/marketing-strategy/index.php
  35. 8
      frontend/views/permissions/permission.php
  36. 464
      frontend/views/user/edit.php
  37. 303
      frontend/views/user/index.php
  38. BIN
      frontend/web/upload/images/201909/15686851959974.png
  39. BIN
      frontend/web/upload/images/201909/15686854453839.png
  40. BIN
      frontend/web/upload/images/201909/15686863351383.png
  41. BIN
      frontend/web/upload/images/201909/15686863679475.png
  42. BIN
      frontend/web/upload/images/201909/15686864234031.png
  43. BIN
      frontend/web/upload/images/201909/15686880989718.jpg

@ -40,50 +40,11 @@ class MyLib {
static public function substr_cut($str_cut,$length) static public function substr_cut($str_cut,$length)
{ {
$string = trim($str_cut); $string = trim($str_cut);
if($length && strlen($string) > $length) { $len = mb_strlen($string, 'utf-8');
//截断字符 if($length && $len > $length) {
$wordscut = '';
//utf8编码 //utf8编码
$n = 0; $wordscut = mb_substr($string, 0, $length);
$tn = 0;
$noc = 0;
while ($n < strlen($string)) {
$t = ord($string[$n]);
if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) {
$tn = 1;
$n++;
$noc++;
} elseif(194 <= $t && $t <= 223) {
$tn = 2;
$n += 2;
$noc += 2;
} elseif(224 <= $t && $t < 239) {
$tn = 3;
$n += 3;
$noc += 2;
} elseif(240 <= $t && $t <= 247) {
$tn = 4;
$n += 4;
$noc += 2;
} elseif(248 <= $t && $t <= 251) {
$tn = 5;
$n += 5;
$noc += 2;
} elseif($t == 252 || $t == 253) {
$tn = 6;
$n += 6;
$noc += 2;
} else {
$n++;
}
if ($noc >= $length) {
break;
}
}
if ($noc > $length) {
$n -= $tn;
}
$wordscut = substr($string, 0, $n);
$string = $wordscut.'...'; $string = $wordscut.'...';
} }
return trim($string); return trim($string);

@ -60,14 +60,53 @@ class GiftT extends \common\models\Base
]; ];
} }
public function getType() public function getShowType()
{ {
return $this->hasOne(GiftTypeT::className(),['id'=>'type_id']); if($this->type_id == 1) return '实名礼品';
if($this->type_id == 2) return '礼券';
return '';
} }
public function getStrategys() public function getTickets()
{ {
return $this->hasMany(StrategyT::className(),['id'=>'strategy_id']) return $this->hasMany(GiftTicketT::className(),['type_id'=>'id']);
->viaTable('gift_strategy_t',['gift_id'=>'id']); }
public function getTicketsUse()
{
return $this->hasMany(GiftTicketTUse::className(),['type_id'=>'id']);
}
public function getTicketsUseByDate($date_type,$begin_date,$end_date)
{
$query = GiftTicketTUse::find()
->leftJoin('order_t','order_t.id=gift_ticket_t_use.order_id')
->leftJoin('gift_t','gift_t.id=gift_ticket_t_use.type_id')
->where('gift_t.id='.$this->id)
->orderBy('id DESC');
if($date_type == 1) {
if($begin_date != '') {
$query = $query->andWhere('gift_ticket_t_use.finished_date>="' . $begin_date.'"');
}
if($end_date != '') {
$query = $query->andWhere('gift_ticket_t_use.finished_date<="' . $end_date.'"');
}
}elseif ($date_type == 2){
if($begin_date != '') {
$query = $query->andWhere('order_t.print_date>="' . $begin_date.'"');
}
if($end_date != '') {
$query = $query->andWhere('order_t.print_date<="' . $end_date.'"');
}
}elseif ($date_type == 3){
if($begin_date != '') {
$query = $query->andWhere('order_t.submit_date>="' . $begin_date.'"');
}
if($end_date != '') {
$query = $query->andWhere('order_t.submit_date<="' . $end_date.'"');
}
}
return $query;
} }
} }

@ -0,0 +1,100 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "gift_ticket_t_use".
*
* @property int $id
* @property string $code
* @property int $type_id
* @property int $group_id
* @property string $car_no
* @property string $input_date
* @property string $use_date
* @property string $end_date 有效期
* @property int $status
* @property int $op_id
* @property string $created_at
* @property string $updated_at
*/
class GiftTicketTUse extends \common\models\Base
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'gift_ticket_t_use';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['type_id'], 'required'],
[['type_id','status', 'op_id','gift_shuzi','order_id'], 'integer'],
[['input_date', 'use_date', 'end_date', 'created_at', 'updated_at'], 'safe'],
[['code'], 'string', 'max' => 100],
[['car_no'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'code' => 'Code',
'type_id' => 'Type ID',
'group_id' => 'Group ID',
'car_no' => 'Car No',
'input_date' => 'Input Date',
'use_date' => 'Use Date',
'end_date' => 'End Date',
'status' => 'Status',
'op_id' => 'Op ID',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
public function getStatus() {
$type_id = $this->typeNew->type_id;
$status = $this->status;
if($type_id == 1 && $status == 1) {
return '未出库';
}elseif($type_id == 1 && $status == 3) {
return '已出库';
}elseif($type_id == 2 && $status == 1){
return '未使用';
}elseif ($type_id == 2 && $status == 2){
return '使用中';
}elseif ($type_id == 2 && $status == 3){
return '使用完';
}else{
return '未定义';
}
}
public function getTypeNew() {
return $this->hasOne(GiftT::className(),['id'=>'type_id']);
}
public function getUser() {
return $this->hasOne(UserT::className(),['id'=>'user_id']);
}
public function getOp() {
return $this->hasOne(UserT::className(),['id'=>'op_id']);
}
public function getOrder(){
return $this->hasOne(OrderT::className(),['id'=>'order_id']);
}
}

@ -33,9 +33,6 @@ use Yii;
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property integer $is_double * @property integer $is_double
* @property string $business_group_id
* @property integer $department_id
* @property integer $company_id
* @property integer $is_outer * @property integer $is_outer
*/ */
class UserT extends \common\models\Base class UserT extends \common\models\Base
@ -55,7 +52,7 @@ class UserT extends \common\models\Base
{ {
return [ return [
[['username', 'password', 'salt','role_id'], 'required'], [['username', 'password', 'salt','role_id'], 'required'],
[['login_time', 'is_delete', 'is_locked', 'is_login', 'is_send', 'group_id','phone_server_id','role_id','worktype_id','is_leave','business_group_id', 'is_double','department_id','company_id'], 'integer'], [['login_time', 'is_delete', 'is_locked', 'is_login', 'is_send', 'group_id','phone_server_id','role_id','worktype_id','is_leave', 'is_double'], 'integer'],
[['created_at', 'updated_at'], 'safe'], [['created_at', 'updated_at'], 'safe'],
[['username', 'password', 'name'], 'string', 'max' => 100], [['username', 'password', 'name'], 'string', 'max' => 100],
[['salt'], 'string', 'max' => 4], [['salt'], 'string', 'max' => 4],
@ -92,10 +89,7 @@ class UserT extends \common\models\Base
'try_pay' => 'Try Pay', 'try_pay' => 'Try Pay',
'try_rate' => 'Try Rate', 'try_rate' => 'Try Rate',
'worktype_id' => 'Work Type', 'worktype_id' => 'Work Type',
'business_group_id' => 'Business Group Id',
'is_leave' => 'Is Leave', 'is_leave' => 'Is Leave',
'department_id' => 'Department ID',
'company_id' => 'Company ID',
'created_at' => 'Created At', 'created_at' => 'Created At',
'updated_at' => 'Updated At', 'updated_at' => 'Updated At',
]; ];
@ -250,20 +244,6 @@ class UserT extends \common\models\Base
return $user_ids; return $user_ids;
} }
public function getBusinessGroup()
{
return $this->hasOne(BusinessGroupT::className(),['id' => 'business_group_id']);
}
public function getDepartment()
{
return $this->hasOne(DepartmentT::className(),['id'=>'department_id']);
}
public function getCompany()
{
return $this->hasOne(CompanyT::className(),['id'=>'company_id']);
}
public function getChildrenClean($otherSql = '',$isAdmin=0) public function getChildrenClean($otherSql = '',$isAdmin=0)
{ {
if($otherSql != '') if($otherSql != '')

@ -0,0 +1,117 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "zhongji_tiaojian".
*
* @property int $id
* @property string $baofei 保费限制
* @property string $xianzhong_one n选一险种
* @property string $xianzhong_two n选2险种
* @property string $car_type_id 车辆类型
* @property string $car_use_id 车辆使用性质
* @property string $max_cashback 返现最大额度
* @property int $type 1返现2提成3礼品4礼券
* @property string $created_at
* @property string $updated_at
*/
class ZhongjiTiaojian extends \common\models\Base
{
/**
* {@inheritdoc}
*/
public $faxianxianzhong_arr;
public $faxianxianzhong_rate_arr;
public $faxianxianzhong2_arr;
public $faxianxianzhong1_arr;
public $tichengXianzhong_arr;
public $tichengXianzhong1_arr;
public $tichengXianzhong2_arr;
public $tichengXianzhong_rate_arr;
public $gift_none_arr;
public $gift_none_arr_two;
public $gift_none_arr_three;
public $gift_none_arr_four;
public $gift_free_arr;
public $gift_free_num_arr;
public $gift_money_arr;
public $gift_money_price_arr;
public $gift_money_num_arr;
public $quan_none_arr;
public $quan_none_arr_two;
public $quan_none_arr_three;
public $quan_none_arr_four;
public $quan_free_arr;
public $quan_free_num_arr;
public $quan_money_arr;
public $quan_money_price_arr;
public $quan_money_num_arr;
public $gift_none_arr_id;
public $gift_none_arr_two_id;
public $gift_none_arr_three_id;
public $gift_none_arr_four_id;
public $gift_free_arr_id;
public $gift_money_arr_id;
public $quan_none_arr_id;
public $quan_none_arr_two_id;
public $quan_none_arr_three_id;
public $quan_none_arr_four_id;
public $quan_free_arr_id;
public $quan_money_arr_id;
public $fanxian_kehu_id;
public $fanxian_zuigao_id;
public static function tableName()
{
return 'zhongji_tiaojian';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['celuo_id'], 'integer'],
[['baofei'], 'number'],
[['type'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['xianzhong_one', 'xianzhong_two', 'car_type_id', 'car_use_id'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'baofei' => 'Baofei',
'xianzhong_one' => 'Xianzhong One',
'xianzhong_two' => 'Xianzhong Two',
'car_type_id' => 'Car Type ID',
'car_use_id' => 'Car Use ID',
'type' => 'Type',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
public function getFanxian()
{
return $this->hasMany(ZhongjiFanxianT::className(),['tiaojian_id'=>'id']);
}
public function getTicheng()
{
return $this->hasMany(ZhongjiTichengT::className(),['tiaojian_id'=>'id']);
}
}

@ -0,0 +1,159 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "zhongji_yingxiao".
*
* @property int $id
* @property string $celuo_name 策略名字
* @property string $begin_date
* @property string $end_date
* @property string $baofei 保费额度
* @property int $xianzhong_one 险种n选1
* @property string $xianzhong_two 险种n选2
* @property int $car_type_id 车辆类型
* @property int $car_use_id 车辆使用性质
* @property string $created_at
* @property string $updated_at
*/
class ZhongjiYingxiao extends \common\models\Base
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'zhongji_yingxiao';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['begin_date', 'end_date', 'created_at', 'updated_at'], 'safe'],
[['baofei'], 'number'],
[['celuo_name','xianzhong_one', 'xianzhong_two', 'car_type_id', 'car_use_id'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'celuo_name' => 'Celuo Name',
'begin_date' => 'Begin Date',
'end_date' => 'End Date',
'baofei' => 'Baofei',
'xianzhong_one' => 'Xianzhong One',
'xianzhong_two' => 'Xianzhong Two',
'car_type_id' => 'Car Type ID',
'car_use_id' => 'Car Use ID',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
// public function getId()
// {
// return $this->id;
// }
public function getFanxian()
{
return $this->hasMany(ZhongjiFanxianT::className(),['celuo_id'=>'id']);
}
public function getKehufanxian()
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$this->id,'fanxian_type'=>1])->one();
}
public function getXianzhongfanxian($id)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>2])->all();
}
public function getXianzhongfanxianTwo($id)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>3])->one();
}
public function getXianzhongfanxianOne($id)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>5])->one();
}
public function getnogift($id = 0)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$this->id,'fanxian_type'=>4])->one();
}
public function getKehuticheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>1])->one();
}
public function getOnlineticheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>2])->one();
}
public function getXianzhongticheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>3])->all();
}
public function getXianzhongtichengTwo($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>4])->one();
}
public function getXianzhongtichengOne($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>5])->one();
}
public function getnogiftTicheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>6])->one();
}
public function getGiftNonetwo($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>4])->all();
}
public function getQuanNonetwo($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>4])->all();
}
public function getGiftNone($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>3])->all();
}
public function getQuanNone($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>3])->all();
}
public function getGiftfree($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>1])->all();
}
public function getQuanfree($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>1])->all();
}
public function getGiftMoney($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>2])->all();
}
public function getQuanMoney($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>2])->all();
}
}

@ -68,6 +68,9 @@ use yii\web\Response;
class CarController extends BaseController class CarController extends BaseController
{ {
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function actionIndex() public function actionIndex()
{ {
return $this->renderPartial('index'); return $this->renderPartial('index');
@ -550,7 +553,10 @@ class CarController extends BaseController
if($id > 0) { if($id > 0) {
$car_info = CarT::findOne(['id'=>$id]); $car_info = CarT::findOne(['id'=>$id]);
if($car_info->location != 1) {
$result['msg'] = '该车辆必须先回到A库,才能删除';
return $result;
}
//删除预约信息 //删除预约信息
AppointmentT::deleteAll('car_id='.$id); AppointmentT::deleteAll('car_id='.$id);
AppointmentHistoryT::deleteAll('car_id='.$id); AppointmentHistoryT::deleteAll('car_id='.$id);
@ -583,7 +589,7 @@ class CarController extends BaseController
} catch(\Exception $e) { } catch(\Exception $e) {
$tran->rollBack(); $tran->rollBack();
throw $e; $result['msg'] = $e->getMessage();
} }
} }
return $result; return $result;

@ -13,9 +13,11 @@ use common\models\GroupT;
use common\models\SysIpT; use common\models\SysIpT;
use Yii; use Yii;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use yii\helpers\FileHelper;
use yii\helpers\Json; use yii\helpers\Json;
use yii\web\Cookie; use yii\web\Cookie;
use yii\web\Response; use yii\web\Response;
use yii\web\UploadedFile;
use yii\web\User; use yii\web\User;
class CommonController extends \yii\web\Controller class CommonController extends \yii\web\Controller
@ -361,6 +363,21 @@ class CommonController extends \yii\web\Controller
} }
public function actionUpload(){
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$data = array();
$data['status'] = 'FAILSE';
$data['fileUrl'] = '';
if($request->isPost){
$img = UploadedFile::getInstanceByName('img');
$filename = 'upload/images/'.date('Ym').'/'.time().rand(1111,9999).'.'.$img->extension;
FileHelper::createDirectory(dirname($filename));
$img->saveAs($filename);
$data['status'] = 'SUCCESS';
$data['fileUrl'] = '/'.$filename;
}
return $data;
}
} }

@ -39,11 +39,14 @@ use common\models\UserT;
use common\models\InvalidNew; use common\models\InvalidNew;
use Yii; use Yii;
use yii\data\Pagination; use yii\data\Pagination;
use yii\db\Exception;
use yii\web\Response; use yii\web\Response;
use yii\db\Expression; use yii\db\Expression;
class DatabaseController extends BaseController class DatabaseController extends BaseController
{ {
public $enableCsrfValidation = false;
public $layout = 'blue-main';
//A库query //A库query
@ -51,7 +54,6 @@ class DatabaseController extends BaseController
private function getAQuery($request) private function getAQuery($request)
{ {
if($request->isPost) { if($request->isPost) {
$car_man = $request->post('car_man'); $car_man = $request->post('car_man');
$phone = $request->post('phone'); $phone = $request->post('phone');
$car_no = $request->post('car_no'); $car_no = $request->post('car_no');
@ -154,142 +156,112 @@ class DatabaseController extends BaseController
$libs[] = 1; $libs[] = 1;
} }
if(count($libs) > 0) if(count($libs) > 0)
$query = $query->andWhere(['in','location',$libs]); $query->andWhere(['in','location',$libs]);
if($car_man != '') { if($car_man != '') {
$query = $query->andWhere('car_man like "'.$car_man.'"'); $query->andWhere('car_man like "'.$car_man.'"');
} }
if($phone != '') { if($phone != '') {
$query = $query->andWhere('phone like "'.$phone.'"'); $query->andWhere('phone like "'.$phone.'"');
} }
if($car_no != '') { if($car_no != '') {
$query = $query->andWhere('car_no like "'.$car_no.'%"'); $query->andWhere('car_no like "'.$car_no.'%"');
} }
if($engine_no != '') { if($engine_no != '') {
$query = $query->andWhere('engine_no="'.$engine_no.'"'); $query->andWhere('engine_no="'.$engine_no.'"');
} }
if($car_frame_no != '') { if($car_frame_no != '') {
$query = $query->andWhere('car_frame_no="'.$car_frame_no.'"'); $query->andWhere('car_frame_no="'.$car_frame_no.'"');
} }
if($register_begin != '') { if($register_begin != '') {
$query = $query->andWhere('register_date>="'.$register_begin.'"'); $query->andWhere('register_date>="'.$register_begin.'"');
} }
if($register_end != '') { if($register_end != '') {
$query = $query->andWhere('register_date<="'.$register_end.'"'); $query->andWhere('register_date<="'.$register_end.'"');
} }
if($insurer1_begin != '') { if($insurer1_begin != '') {
$query = $query->andWhere('insurer1_date>="'.$insurer1_begin.'"'); $query->andWhere('insurer1_date>="'.$insurer1_begin.'"');
} }
if($insurer1_end != '') { if($insurer1_end != '') {
$query = $query->andWhere('insurer1_date<="'.$insurer1_end.'"'); $query->andWhere('insurer1_date<="'.$insurer1_end.'"');
} }
if($insurer1_month != '') { if($insurer1_month != '') {
$query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
} }
if($insurer1_day != '') { if($insurer1_day != '') {
$query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
} }
if($insurer1_month1 != '') { if($insurer1_month1 != '') {
$query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"'); $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
} }
if($insurer1_day1 != '') { if($insurer1_day1 != '') {
$query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"'); $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
} }
if($clean_right != '') { if($clean_right != '') {
$query = $query->andWhere('car_t.clean_right="'.$clean_right.'"'); $query->andWhere('car_t.clean_right="'.$clean_right.'"');
} }
if($biaozhu != '') { if($biaozhu != '') {
$query = $query->andWhere('car_t.biaozhu="'.$biaozhu.'"'); $query->andWhere('car_t.biaozhu="'.$biaozhu.'"');
} }
if($has_phone == 1) { if($has_phone == 1) {
$query = $query->andWhere('phone<>""'); $query->andWhere('phone<>""');
} }
if($no_insurerdate == 1) { if($no_insurerdate == 1) {
$query = $query->andWhere('insurer1_date="" or insurer1_date is null or insurer1_date="0000-00-00"'); $query->andWhere('insurer1_date="" or insurer1_date is null or insurer1_date="0000-00-00"');
} }
if($company != '') { if($company != '') {
$query = $query->andWhere('company like "'.$company.'%"'); $query->andWhere('company like "'.$company.'%"');
} }
if($user1 != '') { if($user1 != '') {
$query = $query->andWhere('op_user1 like "'.$user1.'%"'); $query->andWhere('op_user1 like "'.$user1.'%"');
} }
return ['query'=>$query,'params'=>$params]; return ['query'=>$query,'params'=>$params];
} }
public function actionAIndex() {
$invalid_items = InvalidT::getTree();
return $this->render('a-index',[
'invalid_items' => $invalid_items
]);
}
public function actionASearch() {
return $this->render('a-index-search');
}
// 2018.4.4 修改 A库浏览 // 2018.4.4 修改 A库浏览
public function actionAIndex() public function actionAIndexJson()
{ {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request; $request = Yii::$app->request;
$page = $request->get('page',1); $offset = $request->get('offset',0);
$op = $request->get('op',1); $limit = $request->get('limit', 10);
$data = $this->getAQuery($request); $data = $this->getAQuery($request);
$query = $data['query'];
$params = $data['params'];
$params['page'] = $page;
if($op==0) { $query = $data['query'];
$query = $query->andWhere('car_t.id=-1'); // $query->andWhere('location=1');
}
// echo $query->createCommand()->rawSql;
$total = $query->count(); $total = $query->count();
$pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); $query->orderBy('id desc');
$pagination->setPage($page-1); $query = $query->offset($offset)->limit($limit);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$items = $query->all(); $items = $query->all();
// foreach($items as $k=>$v){
// $car_content=CarInfoT::findOne(['car_id'=>$v->id]);
// if(!$car_content){
// $order=new CarInfoT();
// $order->car_id =$v->id;
// $order->car_no =$v->car_no;
// $order->engine_no =$k.$v->id;
// $order->car_frame_no =$k.$v->id;
// $order->register_date ='2019-04-11';
// $order->factory_model =$k.$v->id;
// $order->series_name =$k.$v->id;
// $order->cartype_name =$k.$v->id;
// $order->car_year =$k.$v->id;
// $order->displacement_name =$k.$v->id;
// $order->save();
// }
//
// $kehu_info=KehuT::findOne(['car_id'=>$v->id]);
// if(!$kehu_info){
// $kehu_info=new KehuT();
// $kehu_info->car_id=$v->id;
// $kehu_info->car_no=$v->car_no;
// $kehu_info->car_man_number=$v->id.$k;
// $kehu_info->car_phone=$v->id.$k;
// $kehu_info->car_now_addr=$v->id.$k;
// $kehu_info->car_id_addr=$v->id.$k;
// $kehu_info->id_man=$v->id.$k;
// $kehu_info->id_number=$v->id.$k;
// $kehu_info->id_phone=$v->id.$k;
// $kehu_info->id_now_addr=$v->id.$k;
// $kehu_info->id_addr=$v->id.$k;
// $kehu_info->save();
//
// }
// }
// die;
$page_info = MyLib::getPageInfo($pagination);
$invalid_items = InvalidT::getTree();
$params['items'] = $items;
$params['page_info'] = $page_info;
$params['invalid_items'] = $invalid_items;
// $params['month'] = CarT::MONTH;
// $params['days'] = CarT::DAYS;
$data = [];
return $this->render('a-index',$params); $data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['factory_model'] = MyLib::substr_cut($item->factory_model, 8);
$row['car_man'] = MyLib::substr_cut($item->car_man, 8);
$row['location'] = $item->getLocation();
$data['rows'][] = $row;
}
return $data;
} }
public function actionKufangIndex() public function actionKufangIndex()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;
@ -382,7 +354,7 @@ class DatabaseController extends BaseController
$result['msg'] = '操作失败'; $result['msg'] = '操作失败';
if($request->isPost) { if($request->isPost) {
$ids = $request->post('ids',array()); $ids = explode(',',$request->post('ids'));
if(count($ids) == 0) { if(count($ids) == 0) {
$result['msg'] = '请先钩选车辆'; $result['msg'] = '请先钩选车辆';
return $result; return $result;
@ -393,18 +365,19 @@ class DatabaseController extends BaseController
foreach($ids as $id) { foreach($ids as $id) {
$car_info = CarT::findOne(['id'=>$id]); $car_info = CarT::findOne(['id'=>$id]);
if($car_info->location == 1) { if($car_info->location == 1) {
// if($car_info->qiyong==2){
// continue;
// }
$car_info->location = 2; $car_info->location = 2;
$car_info->save(false); if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
$b_info = CarBT::findOne(['id'=>$car_info->id]); $b_info = CarBT::findOne(['id'=>$car_info->id]);
if(!$b_info) { if(!$b_info) {
$b_info = new CarBT(false); $b_info = new CarBT(false);
$b_info->id = $car_info->id; $b_info->id = $car_info->id;
$b_info->user_id = 0; $b_info->user_id = 0;
$b_info->save(); if(!$b_info->save(false)) {
throw new Exception(print_r($b_info->getFirstErrors(),true));
}
} }
$this->addLog($car_info->id,'从A库分配到B库',1); $this->addLog($car_info->id,'从A库分配到B库',1);
} }
@ -416,11 +389,57 @@ class DatabaseController extends BaseController
$tran->commit(); $tran->commit();
} catch (\Exception $e) { } catch (\Exception $e) {
$tran->rollBack(); $tran->rollBack();
echo $e->getMessage(); $result['msg'] = $e->getMessage();
}
}
return $result;
}
public function actionABAll()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '操作失败';
$data = $this->getAQuery($request);
$query = $data['query'];
// $query->andWhere('location=1');
$tran = CarT::getDb()->beginTransaction();
try {
foreach($query->each(1000) as $car_info) {
if($car_info->location == 1) {
$car_info->location = 2;
if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
$b_info = CarBT::findOne(['id'=>$car_info->id]);
if(!$b_info) {
$b_info = new CarBT(false);
$b_info->id = $car_info->id;
$b_info->user_id = 0;
if(!$b_info->save(false)) {
throw new Exception(print_r($b_info->getFirstErrors(),true));
} }
} }
$this->addLog($car_info->id,'从A库分配到B库',1);
}
}
$result['success'] = true;
$result['msg'] = '操作成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
$result['msg'] = $e->getMessage();
}
return $result; return $result;
} }
public function actionAClean() public function actionAClean()
{ {
Yii::$app->response->format = Response::FORMAT_JSON; Yii::$app->response->format = Response::FORMAT_JSON;
@ -627,8 +646,8 @@ class DatabaseController extends BaseController
$result['msg'] = '操作失败'; $result['msg'] = '操作失败';
if($request->isPost) { if($request->isPost) {
$ids = $request->post('ids',array()); $ids = explode(',', $request->post('ids'));
if(count($ids) == 0) { if (count($ids) == 0) {
$result['msg'] = '请先钩选车辆'; $result['msg'] = '请先钩选车辆';
return $result; return $result;
} }
@ -638,18 +657,19 @@ class DatabaseController extends BaseController
foreach($ids as $id) { foreach($ids as $id) {
$car_info = CarT::findOne(['id'=>$id]); $car_info = CarT::findOne(['id'=>$id]);
if($car_info->location == 1) { if($car_info->location == 1) {
if($car_info->qiyong==2){
continue;
}
$car_info->location = 3; $car_info->location = 3;
$car_info->save(); if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
$c_info = CarCT::findOne(['id'=>$car_info->id]); $c_info = CarCT::findOne(['id'=>$car_info->id]);
if(!$c_info) { if(!$c_info) {
$c_info = new CarCT(); $c_info = new CarCT(false);
$c_info->id = $car_info->id; $c_info->id = $car_info->id;
$c_info->user_id = 0; $c_info->user_id = 0;
$c_info->save(); if(!$c_info->save(false)) {
throw new Exception(print_r($c_info->getFirstErrors(),true));
}
} }
$this->addLog($car_info->id,'从A库分配到C库',1); $this->addLog($car_info->id,'从A库分配到C库',1);
} }
@ -661,11 +681,12 @@ class DatabaseController extends BaseController
$tran->commit(); $tran->commit();
} catch (\Exception $e) { } catch (\Exception $e) {
$tran->rollBack(); $tran->rollBack();
echo $e->getMessage(); $result['msg'] = $e->getMessage();
}
} }
return $result; return $result;
} }
}
public function actionCA() public function actionCA()

@ -43,16 +43,16 @@ use common\models\GiftType2T;
use common\models\SendLogT; use common\models\SendLogT;
use common\models\UserT; use common\models\UserT;
use common\models\WorkDayT; use common\models\WorkDayT;
use common\models\ZhongjiYingxiao;
use Yii; use Yii;
use yii\data\Pagination; use yii\data\Pagination;
use yii\web\Response; use yii\web\Response;
use yii\web\UploadedFile; use yii\web\UploadedFile;
class FinanceController extends \frontend\controllers\UserBaseController class FinanceController extends \frontend\controllers\UserBaseController
{ {
public $enableCsrfValidation = false; public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function actionReceipt() public function actionReceipt()
{ {
@ -3449,8 +3449,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
return $result; return $result;
} }
public function actionImports1() public function actionImports1()
{ {
// set_time_limit(0); // set_time_limit(0);
@ -3616,11 +3614,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
} }
public function actionReceiptInfo() public function actionReceiptInfo()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;
@ -4006,147 +3999,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
// 'sum_total' => $sum_total, // 'sum_total' => $sum_total,
]); ]);
} }
// public function actionReceipt2()
// {
// $request = Yii::$app->request;
// $page = $request->get('page', 1);
// $begin_date = $request->get('begin_date');
// $end_date = $request->get('end_date');
// $r_begin_date = $request->get('r_begin_date');
// $r_end_date = $request->get('r_end_date');
// $car_no = $request->get('car_no');
// $insurer_no = $request->get('insurer_no');
// $status = $request->get('status');
// $sort_key = $request->get('sort_key');
// $sort_value = $request->get('sort_value');
// if ($page < 1) $page = 1;
//
//// $query = OrderCaiwuT::find()
//// ->where('budian_rate>0');
// $query = CaiwuT::find()
// ->leftJoin(OrderCaiwuT::tableName(), "order_caiwu_t.order_id=caiwu_t.order_id")
// ->leftJoin(OrderT::tableName(), "order_caiwu_t.order_id=order_t.id")
// ->where('order_caiwu_t.budian_rate > 0');
//// ->orderBy('order_t.print_date DESC');
//
//// switch ($sort_key) {
//// case 'total':
//// $sort = 'caiwu_t.total ';
//// break;
//// case 'total_clear':
//// $sort = 'caiwu_t.total_clear ';
//// break;
//// case 'total_rate':
//// $sort = 'caiwu_t.total_rate ';
//// break;
//// case 'print_date'://默认按照print_date排序
//// default:
//// $sort = 'order_t.print_date ';
//// break;
//// }
//
//// switch ($sort_value) {
//// case 'ASC':
//// $sort .= 'ASC';
//// break;
//// case 'DESC':
//// default:
//// $sort .= 'DESC';
//// break;
//// }
//
//// $query = $query->orderBy($sort);
//
// if ($car_no != "") {
// $query = $query->andWhere('caiwu_t.car_no like "' . $car_no . '%"');
// }
// if ($insurer_no != "") {
// $query = $query->andWhere('caiwu_t.insurer_no like "' . $insurer_no . '%"');
// }
// if ($status > 0) {
// if ($status == 1) {
// $query = $query->andWhere('r_date=""');
// }
// if ($status == 2) {
// $query = $query->andWhere('r_date<>""');
// }
// }
// if ($begin_date != "") {
// $query = $query->andWhere('order_t.print_date>="' . $begin_date . '"');
// }
// if ($end_date != "") {
// $query = $query->andWhere('order_t.print_date<="' . $end_date . '"');
// }
// if ($r_begin_date != "") {
// $query = $query->andWhere('caiwu_t.r_date>="' . $r_begin_date . '"');
// }
// if ($r_end_date != "") {
// $query = $query->andWhere('caiwu_t.r_date<="' . $r_end_date . '"');
// }
//// echo $query->createCommand()->rawSql;
// $total = $query->count();
// $allitems = $query->all();
// //商业净保费综合
//
//
// $yd=0;
// $bd1=0;
// $bd2=0;
// $yh=0;
// $wh=0;
// foreach ($allitems as $item) {
// $order = $item->order;
// $caiwu = $order->caiwu;
// $yd += round($item->total_clear * $caiwu->budian_rate/100,2);
// $bd1+= $item->b1_total;
// $bd2+= $item->b2_total;
// $yh+= $item->b1_total+$item->b2_total+$item->b3_total;
// $wh+= round($item->total_clear * $caiwu->budian_rate/100,2)-($item->b1_total+$item->b2_total+$item->b3_total);
//
//
// }
//
//
//
// $pagination = new Pagination(['totalCount' => $total, 'pageSize' => 20]);
// $pagination->setPage($page - 1);
//
// $query = $query->offset($pagination->offset)->limit($pagination->limit);
// $items = $query->all();
//
//// $sum_r_total = $query->sum('r_total');
//
//
// //商业总保费
//// $sum_total = $query->sum('total');
//
// $page_info = MyLib::getPageInfo($pagination);
//
// return $this->render('receipt2', [
// 'items' => $items,
// 'page' => $page,
// 'car_no' => $car_no,
// 'insurer_no' => $insurer_no,
// 'status' => $status,
// 'begin_date' => $begin_date,
// 'end_date' => $end_date,
// 'r_begin_date' => $r_begin_date,
// 'r_end_date' => $r_end_date,
// 'page_info' => $page_info,
// 'sort_key' => $sort_key,
// 'sort_value' => $sort_value,
// 'yd' => $yd,
// 'bd1' => $bd1,
// 'bd2' => $bd2,
// 'yh' => $yh,
// 'wh' => $wh
//
//
//// 'sum_r_total' => $sum_r_total,
//// 'sum_total_clear' => $sum_total_clear,
//// 'sum_total' => $sum_total,
// ]);
// }
public function actionReceipt2Output() public function actionReceipt2Output()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;
@ -5352,87 +5204,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
* 财务工资-详情 * 财务工资-详情
* @return string * @return string
*/ */
// public function actionPay2Info()
// {
// $request = Yii::$app->request;
// $user_id = $request->get('id', 0);
// $pay_date = $request->get('pay_date', date('Y-m'));
// $back_params = $request->get('back_params');
//
// $user_info = UserT::findOne(['id' => $user_id]);
// $group_info = $user_info->group;
//
// $work_day = WorkDayT::findOne(['date' => $pay_date]);
//
// if (!$work_day) {
// echo $pay_date . '还没有开始统计';
// echo "[<a href='/finance/pay2-list?$back_params'>返回</a>]";
// die;
// }
//
// $pay_info = PayT::findOne(['user_id' => $user_id, 'pay_date' => $pay_date]);
// if (!$pay_info) {
// $pay_info = new PayT();
// $pay_info->user_id = $user_id;
// $pay_info->pay_date = $pay_date;
// if ($group_info) {
// $pay_info->should_pay = $group_info->base_pay + $group_info->job_pay + $group_info->station_pay + $user_info->ext_pay;
// } else {
// $pay_info->should_pay = $user_info->ext_pay;
// }
// if (!$pay_info->save()) {
// var_dump($pay_info->errors);
// exit;
// }
// }
// //内勤
// //核保
// $my_type5_query = PayOrderUserT::find()
// ->where('pay_date="' . $pay_date . '" and is_own=0 and type=5 and user_id=' . $user_id)
// ->orderBy('created_at asc');
//// echo $my_type5_query->createCommand()->rawSql;
// //正本
// $my_type6_query = PayOrderUserT::find()
// ->where('pay_date="' . $pay_date . '" and is_own=0 and type=6 and user_id=' . $user_id)
// ->orderBy('created_at asc');
//
//
// $my_type1_query = PayOrderUserT::find()
// ->where('pay_date="' . $pay_date . '" and is_own=1 and type=1 and user_id=' . $user_id)
// ->orderBy('created_at asc');
//// echo $my_type1_query->createCommand()->rawSql;
// $my_type3_query = PayOrderUserT::find()
// ->where('pay_date="' . $pay_date . '" and is_own=1 and type=3 and user_id=' . $user_id)
// ->orderBy('created_at asc');
//// echo $my_type3_query->createCommand()->rawSql;
// $type_query = PayOrderUserT::find()
// ->where('pay_date="' . $pay_date . '" and type<>4 and type<>5 and type<>6 and is_own=0 and user_id=' . $user_id)
// ->andWhere('should_pay>0')
// ->orderBy('created_at asc');
//// echo $type_query->createCommand()->rawSql;
// $type3_query = PayOrderUserT::find()
// ->where('pay_date="' . $pay_date . '" and type=4 and user_id=' . $user_id)
// ->orderBy('created_at asc');
// $pay_order_users = OrderT::find()
// ->where('print_date like "' . $pay_date . '-%"')
// ->andWhere('user_id=' . $this->my->id)
// ->orderBy('updated_at ASC');
//
// return $this->render('pay2-info', [
// 'pay_date' => $pay_date,
// 'user_info' => $user_info,
// 'group_info' => $group_info,
// 'pay_info' => $pay_info,
// 'my_type1_query' => $my_type1_query,
// 'my_type3_query' => $my_type3_query,
// 'my_type5_query' => $my_type5_query,
// 'my_type6_query' => $my_type6_query,
// 'type_query' => $type_query,
// 'type3_query' => $type3_query,
// 'back_params' => $back_params,
// 'pay_order_users' => $pay_order_users
// ]);
// }
public function actionPay2Info() public function actionPay2Info()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;
@ -5533,233 +5304,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
* @throws \Exception * @throws \Exception
* @throws \yii\db\Exception * @throws \yii\db\Exception
*/ */
// public function actionPay2Save()
// {
// Yii::$app->response->format = Response::FORMAT_JSON;
// $request = Yii::$app->request;
// $result = array();
// $result['success'] = false;
// $result['msg'] = '保存失败';
//
// $pay_id = $request->post('id', 0);
// $my_rate1 = $request->post('my_rate1', array());
// $my_rate2 = $request->post('my_rate2', array());
// $tc_my_payids_1 = $request->post('tc_my_payids_1', array());
// $tc_my_payids_2 = $request->post('tc_my_payids_2', array());
// $my_should_pays1 = $request->post('my_should_pays1', array());
// $my_should_pays2 = $request->post('my_should_pays2', array());
// $my_real_pays1 = $request->post('my_real_pays1', array());
// $my_real_pays2 = $request->post('my_real_pays2', array());
// $tc_payids_1 = $request->post('tc_payids_1', array());
// $tc_payids_2 = $request->post('tc_payids_2', array());
// $rate1 = $request->post('rate1', array());
// $rate2 = $request->post('rate2', array());
// $should_pays1 = $request->post('should_pays1', array());
// $should_pays2 = $request->post('should_pays2', array());
// $real_pays1 = $request->post('real_pays1', array());
// $real_pays2 = $request->post('real_pays2', array());
// $tc_send_payids = $request->post('tc_send_payids', array());
// $send_moneys = $request->post('send_moneys', array());
//
// //内勤核保
// $neqi_payids = $request->post('neqi_payids', array());
// $should_pays5 = $request->post('should_pays5', array());
// $rate5 = $request->post('rate5', array());
//// var_dump($rate5);
////
//// var_dump($should_pays5);
//// die;
//// echo '<br>';
// //内勤正本
// $zhengben = $request->post('zhengben', array());
// $should_pays6 = $request->post('should_pays6', array());
// $rate6 = $request->post('rate6', array());
//// var_dump($zhengben);
//// var_dump($should_pays6);
//// die;
//
//
//
// $calls = $request->post('calls', 0);
// $bus = $request->post('bus', 0);
// $bonus = $request->post('bonus', 0);
// $turnover = $request->post('turnover', 0);
// $driver_num = $request->post('driver_num', 0);
// $driver_price = $request->post('driver_price', 0);
// $fix_total = $request->post('fix_total', 0);
// $fix_rate = $request->post('fix_rate', 0);
// $tax = $request->post('tax', 0);
//
// $pay_info = PayT::findOne(['id' => $pay_id]);
// if ($pay_info) {
// $tran = PayT::getDb()->beginTransaction();
// try {
// //保存我的新保
// foreach ($tc_my_payids_1 as $index => $id) {
// $rate = $my_rate1[$index];
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '我的新保错误:' . $id . '=>' . $rate;
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// $caiwu_info->rate1 = $rate;
// $caiwu_info->money1 = $my_should_pays1[$index];
// $caiwu_info->save();
// }
// $pay_order->should_pay = $my_should_pays1[$index];
// $pay_order->real_pay = $my_real_pays1[$index];
// $pay_order->save();
// }
// //我的续保
// foreach ($tc_my_payids_2 as $index => $id) {
// $rate = $my_rate2[$index];
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '我的续保错误:' . $id . '=>' . $rate;
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// $caiwu_info->rate3 = $rate;
// $caiwu_info->money3 = $my_should_pays2[$index];
// $caiwu_info->save();
// }
// $pay_order->should_pay = $my_should_pays2[$index];
// $pay_order->real_pay = $my_real_pays2[$index];
// $pay_order->save();
// }
// //我的提成
// foreach ($tc_payids_1 as $index => $id) {
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '我的提成错误1:' . $id . '=>' . $rate1[$index];
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// $caiwu_info->rate1 = $rate1[$index];
// $caiwu_info->money1 = $should_pays1[$index];
// $caiwu_info->save();
// }
// $pay_order->should_pay = $should_pays1[$index];
// $pay_order->real_pay = $real_pays1[$index];
// $pay_order->save();
// }
// foreach ($tc_payids_2 as $index => $id) {
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '我的提成错误2:' . $id . '=>' . $rate2[$index];
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// $caiwu_info->rate2 = $rate2[$index];
// $caiwu_info->money2 = $should_pays2[$index];
// $caiwu_info->save();
// }
// $pay_order->should_pay = $should_pays2[$index];
// $pay_order->real_pay = $real_pays2[$index];
// $pay_order->save();
// }
// //送单提成
// foreach ($tc_send_payids as $index => $id) {
// $send_money = $send_moneys[$index];
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '送单提成错误:' . $id . '=>' . $send_money;
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// if ($order_info->total1_clear == 0) {
// $caiwu_info->send_rate = 0;
// } else {
// $caiwu_info->send_rate = round($send_money / $order_info->total1_clear * 100, 2);
// }
// $caiwu_info->send_money = $send_money;
// $caiwu_info->save();
// }
// $pay_order->should_pay = $send_money;
// $pay_order->real_pay = $send_money;
// $pay_order->save();
// }
//
// //核保
// foreach ($neqi_payids as $index => $id) {
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '我的提成错误2:' . $id . '=>' . $rate5[$index];
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// if(!isset($rate5[$index])) continue;
// $caiwu_info->rate4 = $rate5[$index];
// $caiwu_info->money4 = $should_pays5[$index];
// $caiwu_info->save();
// }
// $pay_order->should_pay = $should_pays5[$index];
// $pay_order->real_pay = $should_pays5[$index];
// $pay_order->save();
// }
// //正本$neqi_payids1
// foreach ($zhengben as $index => $id) {
// $pay_order = PayOrderUserT::findOne(['id' => $id]);
// if (!$pay_order) {
// $result['msg'] = '我的提成错误2:' . $id . '=>' . $rate6[$index];
// return $result;
// }
// $order_info = $pay_order->order;
// $caiwu_info = $order_info->caiwu;
// if ($caiwu_info) {
// if(!isset($rate6[$index])) continue;
// $caiwu_info->rate5 = $rate6[$index];
// $caiwu_info->money5 = $should_pays6[$index];
// $caiwu_info->save();
// }
// $pay_order->should_pay = $should_pays6[$index];
// $pay_order->real_pay = $should_pays6[$index];
// $pay_order->save();
// }
//
//
//
//
// $pay_info->calls = $calls;
// $pay_info->bus = $bus;
// $pay_info->bonus = $bonus;
// $pay_info->turnover = $turnover;
// $pay_info->driver_num = $driver_num;
// $pay_info->driver_price = $driver_price;
// $pay_info->fix_total = $fix_total;
// $pay_info->fix_rate = $fix_rate;
// $pay_info->tax = $tax;
// $pay_info->save();
// $pay_info->calPay();
//// $pay_info->save();
//
// $content = $this->my->showName . '修改' . $pay_info->pay_date . '工资';
// $this->addUserLog($pay_info->user_id, $content);
//
// $tran->commit();
// } catch (\Exception $e) {
// $tran->rollBack();
// throw $e;
// }
//
// $result['success'] = true;
// $result['msg'] = '保存成功';
// }
// return $result;
// }
public function actionPay2Save() public function actionPay2Save()
{ {
Yii::$app->response->format = Response::FORMAT_JSON; Yii::$app->response->format = Response::FORMAT_JSON;
@ -6815,7 +6359,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
} }
public function actionCarUpdateFrame() public function actionCarUpdateFrame()
{ {
return $this->render('car-update-frame', []); return $this->render('car-update-frame', []);

@ -6,6 +6,7 @@ use common\libs\MyLib;
use common\models\CarGiftT; use common\models\CarGiftT;
use common\models\EmsT; use common\models\EmsT;
use common\models\GiftT; use common\models\GiftT;
use common\models\GiftTicketTUse;
use common\models\GiftTypeT; use common\models\GiftTypeT;
use common\models\GroupT; use common\models\GroupT;
use common\models\InsurerTypeT; use common\models\InsurerTypeT;
@ -19,6 +20,9 @@ use yii\web\Response;
class GiftController extends \yii\web\Controller class GiftController extends \yii\web\Controller
{ {
public $my = null; public $my = null;
public $enableCsrfValidation = false;
public $layout = 'blue-main';
private $_outEncoding = "GB2312";
public function init() public function init()
{ {
@ -38,19 +42,43 @@ class GiftController extends \yii\web\Controller
public function actionIndex() public function actionIndex()
{ {
return $this->render('index');
}
public function actionIndexJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request; $request = Yii::$app->request;
$type_id = $request->get('type_id');
$name = $request->get('name'); $name = $request->get('name');
$query = GiftT::find(); $offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = GiftT::find()
->where('is_delete=0');
if($type_id > 0) {
$query = $query->andWhere('typeid='.$type_id);
}
if($name != '') { if($name != '') {
$query = $query->andWhere(['like','name',$name]); $query = $query->andWhere('name like "'.$name.'"');
} }
$query = $query->orderBy('id desc');
$total = $query->count();
$query = $query->offset($offset)->limit($limit);
$items = $query->all(); $items = $query->all();
return $this->render('index',[ $data = [];
'items' => $items, $data['total'] = $total;
'name' => $name $data['rows'] = [];
]); foreach($items as $item) {
$row = $item->toArray();
$row['type'] = $item->getShowType();
$data['rows'][] = $row;
}
return $data;
} }
public function actionEdit() public function actionEdit()
@ -63,12 +91,8 @@ class GiftController extends \yii\web\Controller
$info = new GiftT(); $info = new GiftT();
} }
$type_items = GiftTypeT::find()
->all();
return $this->render('edit',[ return $this->render('edit',[
'info' => $info, 'info' => $info
'type_items' => $type_items
]); ]);
} }
@ -84,16 +108,19 @@ class GiftController extends \yii\web\Controller
$id = $request->post('id',0); $id = $request->post('id',0);
$type_id = $request->post('type_id'); $type_id = $request->post('type_id');
$name = $request->post('name'); $name = $request->post('name');
$img = $request->post('img');
$price = $request->post('price'); $price = $request->post('price');
$remark = $request->post('remark'); $remark = $request->post('remark');
$total = (int)$request->post('total'); $total = (int)$request->post('total');
$total_lock = (int)$request->post('total_lock'); $use_num = (int)$request->post('use_num');
if($name == '') { if($name == '') {
$result['msg'] = '请输入名称!'; $result['msg'] = '请输入名称!';
return $result; return $result;
} }
$pin_name=trim($this->getPinyin($name),' ');
$row = null; $row = null;
if($id > 0) { if($id > 0) {
$row = GiftT::findOne(['id'=>$id]); $row = GiftT::findOne(['id'=>$id]);
@ -103,9 +130,11 @@ class GiftController extends \yii\web\Controller
$row->type_id = $type_id; $row->type_id = $type_id;
$row->name = $name; $row->name = $name;
$row->price = $price; $row->price = $price;
$row->original_img = $img;
$row->remark = $remark; $row->remark = $remark;
$row->total = $total; $row->total = $total;
$row->total_lock = $total_lock; $row->use_num = $use_num;
$row->pinyin_name = $pin_name;
$row->save(); $row->save();
$result['success'] = true; $result['success'] = true;
@ -127,8 +156,8 @@ class GiftController extends \yii\web\Controller
if($id > 0) { if($id > 0) {
$row = GiftT::findOne(['id'=>$id]); $row = GiftT::findOne(['id'=>$id]);
$row->unlinkAll('strategys',true); $row->is_delete = 1;
$row->delete(); $row->save();
$result['success'] = true; $result['success'] = true;
$result['msg'] = '删除成功'; $result['msg'] = '删除成功';
@ -506,4 +535,437 @@ class GiftController extends \yii\web\Controller
} }
return $result; return $result;
} }
public function getPinyin($str,$pix=' ',$code = 'gb2312'){
$_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" . "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|" . "cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er" . "|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui" . "|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang" . "|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang" . "|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue" . "|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne" . "|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen" . "|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang" . "|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao|" . "she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai|" . "tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu" . "|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you" . "|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong|" . "zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo";
$_DataValue = "-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990" . "|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725" . "|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263" . "|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003" . "|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697" . "|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211" . "|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922" . "|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468" . "|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664" . "|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407" . "|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959" . "|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652" . "|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369" . "|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128" . "|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914" . "|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645" . "|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149" . "|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087" . "|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658" . "|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340" . "|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888" . "|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585" . "|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847" . "|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055" . "|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780" . "|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274" . "|-10270|-10262|-10260|-10256|-10254";
$_TDataKey = explode ( '|', $_DataKey );
$_TDataValue = explode ( '|', $_DataValue );
$data = (PHP_VERSION >= '5.0') ? array_combine ( $_TDataKey, $_TDataValue ) : $this->_Array_Combine( $_TDataKey, $_TDataValue );
arsort ( $data );
reset ( $data );
$str = $this->safe_encoding ( $str );
$_Res = '';
for($i = 0; $i < strlen ( $str ); $i ++) {
$_P = ord ( substr ( $str, $i, 1 ) );
if ($_P > 160) {
$_Q = ord ( substr ( $str, ++ $i, 1 ) );
$_P = $_P * 256 + $_Q - 65536;
}
$_Res .= $this->_Pinyin ( $_P, $data ).$pix;
}
return preg_replace ( "/[^a-z0-9".$pix."]*/", '', $_Res );
}
private function _Pinyin($_Num, $_Data) {
if ($_Num > 0 && $_Num < 160)
return chr ( $_Num );
elseif ($_Num < - 20319 || $_Num > - 10247)
return '';
else {
foreach ( $_Data as $k => $v ) {
if ($v <= $_Num)
break;
}
return $k;
}
}
public function getFirstChar($str=''){
if( !$str ) return null;
$fchar=ord($str{0});
if($fchar>=ord("A") and $fchar<=ord("z") )return strtoupper($str{0});
$s= $this->safe_encoding($str);
$asc=ord($s{0})*256+ord($s{1})-65536;
if($asc>=-20319 and $asc<=-20284)return "A";
if($asc>=-20283 and $asc<=-19776)return "B";
if($asc>=-19775 and $asc<=-19219)return "C";
if($asc>=-19218 and $asc<=-18711)return "D";
if($asc>=-18710 and $asc<=-18527)return "E";
if($asc>=-18526 and $asc<=-18240)return "F";
if($asc>=-18239 and $asc<=-17923)return "G";
if($asc>=-17922 and $asc<=-17418)return "H";
if($asc>=-17417 and $asc<=-16475)return "J";
if($asc>=-16474 and $asc<=-16213)return "K";
if($asc>=-16212 and $asc<=-15641)return "L";
if($asc>=-15640 and $asc<=-15166)return "M";
if($asc>=-15165 and $asc<=-14923)return "N";
if($asc>=-14922 and $asc<=-14915)return "O";
if($asc>=-14914 and $asc<=-14631)return "P";
if($asc>=-14630 and $asc<=-14150)return "Q";
if($asc>=-14149 and $asc<=-14091)return "R";
if($asc>=-14090 and $asc<=-13319)return "S";
if($asc>=-13318 and $asc<=-12839)return "T";
if($asc>=-12838 and $asc<=-12557)return "W";
if($asc>=-12556 and $asc<=-11848)return "X";
if($asc>=-11847 and $asc<=-11056)return "Y";
if($asc>=-11055 and $asc<=-10247)return "Z";
return null;
}
function safe_encoding($string) {
$encoding="UTF-8";
for($i=0;$i<strlen($string);$i++) {
if(ord($string{$i})<128) continue;
if((ord($string{$i})&224)==224) { //第一个字节判断通过
$char=$string{++$i};
if((ord($char)&128)==128) { //第二个字节判断通过
$char=$string{++$i};
if((ord($char)&128)==128) {
$encoding="UTF-8";
break;
}
}
}
if((ord($string{$i})&192)==192) { //第一个字节判断通过
$char=$string{++$i};
if((ord($char)&128)==128) { //第二个字节判断通过
$encoding="GB2312";
break;
}
}
}
if(strtoupper($encoding)==strtoupper($this->_outEncoding))
return $string;
else
return iconv($encoding,$this->_outEncoding,$string);
}
private function _Array_Combine($_Arr1, $_Arr2){
$_Res=array();
for($i = 0; $i < count ( $_Arr1 ); $i ++)
$_Res [$_Arr1 [$i]] = $_Arr2 [$i];
return $_Res;
}
public function actionStastics() {
return $this->render('stastics');
}
public function actionStasticsJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = GiftT::find()
->where('is_delete=0');
$query = $query->orderBy('id desc');
$total = $query->count();
$query = $query->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['total'] = $item->getTicketsUse()->count();
$type_id = $item->type_id;
if($type_id ==1){//礼品
$row['out_total'] = $item->getTicketsUse()->where('status=3')->count();
$row['use_total'] = $item->getTicketsUse()->where('status=3')->count();
}elseif ($type_id==2){
$row['out_total'] = $item->getTicketsUse()->count();
$row['use_total'] = $item->getTicketsUse()->where('status>1')->count();
}
$data['rows'][] = $row;
}
return $data;
}
public function actionGiftOut() {
$type_items = GiftT::find()
->where(['type_id'=>1,'is_delete'=>0])
->all();
return $this->render('gift-out', [
'type_items' => $type_items
]);
}
public function actionGiftOutJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$code = $request->get('code');
$car_no = $request->get('car_no');
$username = $request->get('username');
$s_begin_date = $request->get('s_begin_date');
$s_end_date = $request->get('s_end_date');
$p_begin_date = $request->get('p_begin_date');
$p_end_date = $request->get('p_end_date');
$status = $request->get('status');
$frame_no = $request->get('frame_no');
$engine_no = $request->get('engine_no');
$insurer1_no = $request->get('insurer1_no');
$type_id = $request->get('type_id');
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = GiftTicketTUse::find()
->leftJoin('order_t','order_t.id=gift_ticket_t_use.order_id')
->leftJoin('gift_t','gift_t.id=gift_ticket_t_use.type_id')
->leftJoin('user_t','user_t.id=gift_ticket_t_use.user_id')
->where('gift_t.type_id=1')
->orderBy('id DESC');
if($code != '') {
$query = $query->andWhere('gift_ticket_t_use.code="'.$code.'"');
}
if($car_no != '') {
$query = $query->andWhere('gift_ticket_t_use.car_no like "'.$car_no.'"');
}
if($username != ''){
$user = UserT::find()->where('username="'.$username.'"')->andWhere('is_delete=0')->one();
$query = $query->andWhere('gift_ticket_t_use.op_id='.$user->id);
}
if($s_begin_date != ''){
$query = $query->andWhere('order_t.submit_date>="'.$s_begin_date.'"');
}
if($s_end_date != ''){
$query = $query->andWhere('order_t.submit_date<="'.$s_begin_date.'"');
}
if($p_begin_date != ''){
$query = $query->andWhere('order_t.print_date>="'.$p_begin_date.'"');
}
if($p_end_date != ''){
$query = $query->andWhere('order_t.print_date<="'.$p_begin_date.'"');
}
if ($status == 1) {//礼券未使用
$query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=1');
} elseif ($status == 2) {//礼券使用中
$query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=2');
}
if ($status == 3) {//礼券使用完
$query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=3');
}
if ($status == 4) {//礼品未出库
$query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=1');
}
if ($status == 5) {//礼品已出库
$query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=3');
}
if($frame_no != '') {
$query = $query->andWhere('order_t.car_frame_no="'.$frame_no.'"');
}
if($engine_no != '') {
$query = $query->andWhere('order_t.engine_no="'.$engine_no.'"');
}
if($insurer1_no != '') {
$query = $query->andWhere('order_t.insurer1_no='.$insurer1_no);
}
if($type_id > 0) {
$query = $query->andWhere('gift_ticket_t_use.type_id='.$type_id);
}
// echo $query->createCommand()->rawSql;
$total = $query->count();
$items = $query->offset($offset)->limit($limit)->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$order_info = $item->order;
$gift_info = $item->typeNew;
$row = $item->toArray();
$row['name'] = $gift_info->name;
$row['car_no'] = $item->car_no;
$row['car_frame_no'] = $order_info->car_no;
$row['op'] = $item->op?$item->op->getShowName():'';
$row['finished_date'] = $item->finished_date != '0000-00-00'?$item->finished_date:'';
$row['user'] = ($item->user && $item->status > 0)?$item->user->getShowName():'';
$row['status'] = $item->getStatus();
$row['use_num'] = $gift_info->use_num;
$data['rows'][] = $row;
}
return $data;
}
public function actionGiftUse() {
$type_items = GiftT::find()
->where(['type_id'=>2,'is_delete'=>0])
->all();
return $this->render('gift-use', [
'type_items' => $type_items
]);
}
public function actionGiftUseJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$code = $request->get('code');
$car_no = $request->get('car_no');
$username = $request->get('username');
$s_begin_date = $request->get('s_begin_date');
$s_end_date = $request->get('s_end_date');
$p_begin_date = $request->get('p_begin_date');
$p_end_date = $request->get('p_end_date');
$status = $request->get('status');
$frame_no = $request->get('frame_no');
$engine_no = $request->get('engine_no');
$insurer1_no = $request->get('insurer1_no');
$type_id = $request->get('type_id');
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = GiftTicketTUse::find()
->leftJoin('order_t','order_t.id=gift_ticket_t_use.order_id')
->leftJoin('gift_t','gift_t.id=gift_ticket_t_use.type_id')
->leftJoin('user_t','user_t.id=gift_ticket_t_use.user_id')
->where('gift_t.type_id=2')
->orderBy('id DESC');
if($code != '') {
$query = $query->andWhere('gift_ticket_t_use.code="'.$code.'"');
}
if($car_no != '') {
$query = $query->andWhere('gift_ticket_t_use.car_no like "'.$car_no.'"');
}
if($username != ''){
$user = UserT::find()->where('username="'.$username.'"')->andWhere('is_delete=0')->one();
$query = $query->andWhere('gift_ticket_t_use.op_id='.$user->id);
}
if($s_begin_date != ''){
$query = $query->andWhere('order_t.submit_date>="'.$s_begin_date.'"');
}
if($s_end_date != ''){
$query = $query->andWhere('order_t.submit_date<="'.$s_begin_date.'"');
}
if($p_begin_date != ''){
$query = $query->andWhere('order_t.print_date>="'.$p_begin_date.'"');
}
if($p_end_date != ''){
$query = $query->andWhere('order_t.print_date<="'.$p_begin_date.'"');
}
if ($status == 1) {//礼券未使用
$query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=1');
} elseif ($status == 2) {//礼券使用中
$query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=2');
}
if ($status == 3) {//礼券使用完
$query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=3');
}
if ($status == 4) {//礼品未出库
$query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=1');
}
if ($status == 5) {//礼品已出库
$query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=3');
}
if($frame_no != '') {
$query = $query->andWhere('order_t.car_frame_no="'.$frame_no.'"');
}
if($engine_no != '') {
$query = $query->andWhere('order_t.engine_no="'.$engine_no.'"');
}
if($insurer1_no != '') {
$query = $query->andWhere('order_t.insurer1_no='.$insurer1_no);
}
if($type_id > 0) {
$query = $query->andWhere('gift_ticket_t_use.type_id='.$type_id);
}
// echo $query->createCommand()->rawSql;
$total = $query->count();
$items = $query->offset($offset)->limit($limit)->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$order_info = $item->order;
$gift_info = $item->typeNew;
$row = $item->toArray();
$row['name'] = $gift_info->name;
$row['car_no'] = $item->car_no;
$row['car_frame_no'] = $order_info->car_no;
$row['op'] = $item->op?$item->op->getShowName():'';
$row['finished_date'] = $item->finished_date != '0000-00-00'?$item->finished_date:'';
$row['user'] = ($item->user && $item->status > 0)?$item->user->getShowName():'';
$row['status'] = $item->getStatus();
$row['use_num'] = $gift_info->use_num;
$data['rows'][] = $row;
}
return $data;
}
public function actionGiftTj() {
return $this->render('gift-tj');
}
public function actionGiftTjJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$date_type = $request->get('date_type');
$begin_date = $request->get('begin_date');
$end_date = $request->get('end_date');
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = GiftT::find()->where(['type_id'=>1, 'is_delete'=>0]);
// echo $query->createCommand()->rawSql;
$total = $query->count();
$items = $query->offset($offset)->limit($limit)->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->count();
$out_total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->andWhere('gift_ticket_t_use.status=3')->count();
$row = $item->toArray();
$row['total'] = $total;
$row['unout_total'] = $total - $out_total;
$row['out_total'] = $out_total;
$data['rows'][] = $row;
}
return $data;
}
public function actionTicketTj() {
return $this->render('ticket-tj');
}
public function actionTicketTjJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$date_type = $request->get('date_type');
$begin_date = $request->get('begin_date');
$end_date = $request->get('end_date');
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = GiftT::find()->where(['type_id'=>2, 'is_delete'=>0]);
// echo $query->createCommand()->rawSql;
$total = $query->count();
$items = $query->offset($offset)->limit($limit)->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->count();
$use_total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->andWhere('gift_ticket_t_use.status=3')->count();
$row = $item->toArray();
$row['total'] = $total;
$row['unuse_total'] = $total - $use_total;
$row['use_total'] = $use_total;
$data['rows'][] = $row;
}
return $data;
}
} }

@ -0,0 +1,107 @@
<?php
namespace frontend\controllers;
use common\models\ZhongjiYingxiao;
use yii\web\Response;
use Yii;
class MarketingStrategyController extends UserBaseController
{
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function actionIndex() {
return $this->render('index');
}
public function actionIndexJson() {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$query = ZhongjiYingxiao::find()
->where('is_delete=0')
->orderBy('id desc');
$total = $query->count();
$query = $query->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$data['rows'][] = $row;
}
return $data;
}
public function actionAdd() {
return $this->render('add');
}
public function actionEdit() {
$request = Yii::$app->request;
$id = $request->get('id');
$info = ZhongjiYingxiao::findOne(['id'=>$id]);
return $this->render('edit', [
'info' => $info
]);
}
public function actionSave() {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$op = $request->post('op', 'add');
$name = $request->post('name');
$begin_date = $request->post('begin_date');
$begin_time = $request->post('begin_time');
$end_date = $request->post('end_date');
$end_time = $request->post('end_time');
$remark = $request->post('remark');
if($op == 'add') {
$item = new ZhongjiYingxiao();
$item->celuo_name = $name;
$item->begin_date = $begin_date.' '.$begin_time.':00';
$item->end_date = $end_date.' '.$end_time.':00';
$item->is_delete = 0;
$item->remark = $remark;
$item->save();
$result['success'] = true;
$result['msg'] = '保存成功';
return $result;
} else {
$id = $request->post('id');
$item = ZhongjiYingxiao::findOne(['id'=>$id]);
if($item) {
$item->celuo_name = $name;
$item->begin_date = $begin_date.' '.$begin_time.':00';
$item->end_date = $end_date.' '.$end_time.':00';
$item->remark = $remark;
$item->save();
$result['success'] = true;
$result['msg'] = '保存成功';
return $result;
}
}
}
return $result;
}
}

@ -16,11 +16,14 @@ use common\models\UserT;
use common\models\WorktypeT; use common\models\WorktypeT;
use Yii; use Yii;
use yii\data\Pagination; use yii\data\Pagination;
use yii\web\Request;
use yii\web\Response; use yii\web\Response;
class UserController extends \frontend\controllers\UserBaseController class UserController extends \frontend\controllers\UserBaseController
{ {
public $my = null; public $my = null;
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function init() public function init()
{ {
@ -40,12 +43,22 @@ class UserController extends \frontend\controllers\UserBaseController
public function actionIndex() public function actionIndex()
{ {
$group_items = GroupT::getTree();
return $this->render('index',[
'group_items' => $group_items
]);
}
public function actionIndexJson() {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request; $request = Yii::$app->request;
$username = $request->get('username'); $username = $request->get('username');
$name = $request->get('name'); $name = $request->get('name');
$phone = $request->get('phone'); $phone = $request->get('phone');
$group_id = $request->get('group_id',0); $group_id = $request->get('group_id',0);
$page = $request->get('page',1); $offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$is_leave = $request->get('is_leave'); $is_leave = $request->get('is_leave');
$query = UserT::find() $query = UserT::find()
@ -68,27 +81,23 @@ class UserController extends \frontend\controllers\UserBaseController
$query = $query->orderBy('username ASC,id ASC'); $query = $query->orderBy('username ASC,id ASC');
$total = $query->count(); $total = $query->count();
$pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); $query = $query->offset($offset)->limit($limit);
$pagination->setPage($page-1);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$items = $query->all(); $items = $query->all();
$page_info = MyLib::getPageInfo($pagination); $data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['is_login'] = $item->is_login ? '是':'';
$row['group_name'] = $item->group ? $item->group->getPath():'';
$row['role_name'] = $item->role ? $item->role->name : '';
$row['is_leave'] = $item->is_leave ? '已离职':'';
$data['rows'][] = $row;
}
$group_items = GroupT::getTree(); return $data;
return $this->render('index',[
'group_items' => $group_items,
'items' => $items,
'page_info' => $page_info,
'page' => $page,
'username' => $username,
'name' => $name,
'phone' => $phone,
'group_id' => $group_id,
'is_leave' => $is_leave
]);
} }
public function actionEdit() public function actionEdit()
@ -101,7 +110,6 @@ class UserController extends \frontend\controllers\UserBaseController
} else { } else {
$info = new UserT(); $info = new UserT();
$info->is_login = true; $info->is_login = true;
$info->company_id = 0;
} }
$phone_server_items = PhoneServerT::find()->all(); $phone_server_items = PhoneServerT::find()->all();
@ -110,10 +118,6 @@ class UserController extends \frontend\controllers\UserBaseController
$permissions = PermissionsT::find() $permissions = PermissionsT::find()
->all(); ->all();
$worktypes = WorktypeT::find()->all(); $worktypes = WorktypeT::find()->all();
$business_group = BusinessGroupT::find()->all();
$company_items = CompanyT::find()->all();
$department_items = DepartmentT::getTree($info->company_id);
return $this->render('edit',[ return $this->render('edit',[
'info' => $info, 'info' => $info,
@ -122,10 +126,7 @@ class UserController extends \frontend\controllers\UserBaseController
'role_items' => $role_items, 'role_items' => $role_items,
'permissions' => $permissions, 'permissions' => $permissions,
'worktypes' => $worktypes, 'worktypes' => $worktypes,
'back_params' => $back_params, 'back_params' => $back_params
'business_group' => $business_group,
'company_items' => $company_items,
'department_items' => $department_items
]); ]);
} }
@ -158,10 +159,7 @@ class UserController extends \frontend\controllers\UserBaseController
$try_rate = $request->post('try_rate'); $try_rate = $request->post('try_rate');
$worktype_id = $request->post('worktype_id',0); $worktype_id = $request->post('worktype_id',0);
$is_leave = $request->post('is_leave',0); $is_leave = $request->post('is_leave',0);
$business_group_id = $request->post('business_group_id');
$is_double = $request->post('is_double', 0); $is_double = $request->post('is_double', 0);
$company_id = $request->post('company_id',0);
$department_id = $request->post('department_id',0);
$permissions = $request->post('permissions',array()); $permissions = $request->post('permissions',array());
$menus = $request->post('menus',array()); $menus = $request->post('menus',array());
@ -210,9 +208,6 @@ class UserController extends \frontend\controllers\UserBaseController
$row->worktype_id = $worktype_id; $row->worktype_id = $worktype_id;
$row->is_leave = $is_leave; $row->is_leave = $is_leave;
$row->is_double = $is_double; $row->is_double = $is_double;
$row->business_group_id = $business_group_id;
$row->company_id = $company_id;
$row->department_id = $department_id;
$row->save(); $row->save();
//处理权限 //处理权限

@ -1,52 +1,63 @@
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <?php
<form id="theFrm"> use \common\libs\MyLib;
<input type="hidden" name="id" value="<?=$info->id?>"> ?>
<tr> <?php $this->beginBlock('header_css'); ?>
<td width="100" height="25" class="bg_tr">车牌号</td> <link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<td height="25" class="td_bg"> <?php $this->endBlock(); ?>
<input name="car_no" type="text" id="car_no" value="<?=$info->car_no?>" style="width:200px;"/>
</td> <div class="wrapper wrapper-content animated fadeInRight">
<td width="100" height="25" class="bg_tr">厂牌型号</td> <div class="ibox float-e-margins">
<td height="25" class="td_bg"> <div class="ibox-content">
<input name="factory_model" type="text" id="factory_model" value="<?=$info->factory_model?>" style="width:200px;"/> <div class="row">
</td> <div class="col-md-12">
<td width="100" height="25" class="bg_tr">发动机号</td> <form role="form" class="form-horizontal data-from" id="theFrm">
<td height="25" class="td_bg"> <input type="hidden" name="id" value="<?=intval($info->id)?>">
<input name="engine_no" type="text" id="engine_no" value="<?=$info->engine_no?>" style="width:200px;"/> <div class="form-group">
</td> <label class="col-sm-1 control-label">车牌号</label>
</tr> <div class="col-sm-3">
<tr> <input type="text" name="car_no" value="<?=$info->car_no?>" class="form-control">
<td width="100" height="25" class="bg_tr">车主</td> </div>
<td height="25" class="td_bg"> <label class="col-sm-1 control-label">车架号</label>
<input type="text" id="car_man" name="car_man" value="<?=$info->car_man?>" style="width:200px;" > <div class="col-sm-3">
</td> <input type="text" name="car_frame_no" value="<?=$info->car_frame_no?>" class="form-control">
<td width="100" height="25" class="bg_tr">联系电话</td> </div>
<td height="25" class="td_bg"> <label class="col-sm-1 control-label">发动机号</label>
<input type="text" id="phone" name="phone" value="<?=$info->phone?>" style="width:200px;" > <div class="col-sm-3">
</td> <input type="text" name="engine_no" value="<?=$info->engine_no?>" class="form-control">
<td width="100" height="25" class="bg_tr">证件号码</td> </div>
<td height="25" class="td_bg"> </div>
<input type="text" name="car_man_number" id="car_man_number" value="<?=$info->car_man_number?>" style="width:200px;"> <div class="form-group">
</td> <label class="col-sm-1 control-label">车主</label>
</tr> <div class="col-sm-3">
<tr> <input type="text" name="car_man" value="<?=$info->car_man?>" class="form-control">
<td width="100" height="25" class="bg_tr">年份</td> </div>
<td height="25" class="td_bg"> <label class="col-sm-1 control-label">联系电话</label>
<input type="text" id="car_year" name="car_year" value="<?=$info->car_year?>" style="width:100px;"> <div class="col-sm-3">
</td> <input type="text" name="phone" value="<?=$info->phone?>" class="form-control">
<td width="100" height="25" class="bg_tr">车架号</td> </div>
<td height="25" class="td_bg"> <label class="col-sm-1 control-label">证件号码</label>
<input name="car_frame_no" type="text" id="car_frame_no" value="<?=$info->car_frame_no?>" style="width:200px;"/> <div class="col-sm-3">
</td> <input type="text" name="car_man_number" value="<?=$info->car_man_number?>" class="form-control">
<td width="100" height="25" class="bg_tr">初登日期</td> </div>
<td height="25" class="td_bg"> </div>
<input class="act_date" name="register_date" type="text" id="register_date" value="<?=$info->register_date?>" onclick="WdatePicker()"/> <div class="form-group">
</td> <label class="col-sm-1 control-label">厂牌型号</label>
</tr> <div class="col-sm-3">
<tr> <input type="text" name="factory_model" value="<?=$info->factory_model?>" class="form-control">
<td width="100" height="25" class="bg_tr">车辆类型</td> </div>
<td height="25" class="td_bg"> <label class="col-sm-1 control-label">初登日期</label>
<select id="car_type_id" name="car_type_id"> <div class="col-sm-3">
<input type="text" name="register_date" value="<?=$info->register_date?>" class="form-control date" autocomplete="off">
</div>
<label class="col-sm-1 control-label">座位数</label>
<div class="col-sm-3">
<input type="text" name="seats" value="<?=$info->seats?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">车辆类型</label>
<div class="col-sm-3">
<select name="car_type_id" class="form-control">
<option value="0">---请选择---</option> <option value="0">---请选择---</option>
<?php <?php
foreach($car_type_items as $item) { foreach($car_type_items as $item) {
@ -57,10 +68,10 @@
} }
?> ?>
</select> </select>
</td> </div>
<td width="100" height="25" class="bg_tr">运营性质</td> <label class="col-sm-1 control-label">运营性质</label>
<td height="25" class="td_bg"> <div class="col-sm-3">
<select name="car_use_id" id="car_use_id"> <select name="car_use_id" class="form-control">
<option value="0">---请选择---</option> <option value="0">---请选择---</option>
<?php <?php
foreach($car_use_items as $item) { foreach($car_use_items as $item) {
@ -71,273 +82,60 @@
} }
?> ?>
</select> </select>
</td> </div>
<td width="100" height="25" class="bg_tr">座位数</td> </div>
<td height="25" class="td_bg"> <div class="form-group">
<input name="seats" type="text" id="seats" value="<?=$info->seats?>" style="width:50px;"/> <label class="col-sm-1 control-label">备注</label>
</td> <div class="col-sm-11">
</tr> <textarea name="remark" class="form-control"><?=$info->remark?></textarea>
<tr> </div>
<td width="100" height="25" class="bg_tr">品牌</td> </div>
<td height="25" class="td_bg"> <div>
<select id="brand_id" name="brand_id"> <div class="row">
<option value="0">---请选择---</option> <div class="col-md-5 col-md-offset-5">
<?php <button class="btn btn-primary btn-save" type="button">
foreach($brand_items as $item) { <strong><?=$info ? '保 存':'添 加'?></strong>
echo '<option value="'.$item->id.'"'; </button>
if($info->brand_id == $item->id) </div>
echo ' selected '; </div>
echo '>'.$item->name.'</option>'; </div>
}
?>
</select>
</td>
<td width="100" height="25" class="bg_tr">厂家</td>
<td height="25" class="td_bg">
<select name="factory_id" id="factory_id">
<option value="0">---请选择---</option>
<?php
foreach($factory_items as $item) {
echo '<option value="'.$item->id.'"';
if($info->factory_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
<td width="100" height="25" class="bg_tr">车型</td>
<td height="25" class="td_bg">
<select name="model_id" id="model_id">
<option value="0">---请选择---</option>
<?php
foreach($model_items as $item) {
echo '<option value="'.$item->id.'"';
if($info->id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<!-- <td width="100" height="25" class="bg_tr">排量</td>-->
<!-- <td height="25" class="td_bg">-->
<!-- <select name="displacement_id" id="displacement_id">-->
<!-- <option value="0">---请选择---</option>-->
<!-- -
// foreach($displacement_items as $item) {
// echo '<option value="'.$item->id.'"';
// if($info->displacement_id == $item->id)
// echo ' selected ';
// echo '>'.$item->name.'</option>';
// }
// ?>
<!-- </select>-->
<!-- </td>-->
<!-- <td width="100" height="25" class="bg_tr">年份</td>-->
<!-- <td height="25" class="td_bg">-->
<!-- <select id="year_id" name="year_id">-->
<!-- <option value="0">---请选择---</option>-->
<!-- --
// foreach($year_items as $item) {
// echo '<option value="'.$item->id.'"';
// if($info->year_id == $item->id)
// echo ' selected ';
// echo '>'.$item->name.'</option>';
// }
// ?>
<!-- </select>-->
<!-- </td>-->
<td width="100" height="25" class="bg_tr">车系</td>
<td height="25" class="td_bg">
<select name="series_id" id="series_id">
<option value="0">---请选择---</option>
<?php
foreach($series_items as $item) {
echo '<option value="'.$item->id.'"';
if($info->series_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
<td width="100" height="25" class="bg_tr">新保业务员</td>
<td height="25" class="td_bg">
<input type="text" id="op_user1" name="op_user1" value="<?=$info->op_user1?>" style="width:200px;" >
</td>
<!-- <td width="100" height="25" class="bg_tr">跟踪业务员</td>-->
<!-- <td height="25" class="td_bg">-->
<!-- <input type="text" id="op_user2" name="op_user2" value="-//=$info->op_user2?><!--" style="width:200px;" >-->
<!-- </td>-->
<td width="100" height="25" class="bg_tr">续保业务员</td>
<td height="25" class="td_bg">
<input type="text" id="op_user3" name="op_user3" value="<?=$info->op_user3?>" style="width:200px;" >
</td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">备注</td>
<td colspan="5" height="25" class="td_bg">
<textarea style="width:97%; height: 50px;" name="remark" id="remark"><?=$info->remark?></textarea>
</td>
</tr>
</form> </form>
<tr> </div>
<td height="22" colspan="6" align="center" class="td_bg"> </div>
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/> </div>
&nbsp;&nbsp; </div>
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 "> </div>
</td>
</tr> <?php $this->beginBlock('footer_js'); ?>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$(function () { $(function () {
$('.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true
});
//提交按钮 //提交按钮
$("#submit-btn").click(function(){ $(".btn-save").click(function(){
if(confirm('是否确认提交?')) { parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize(); var params = $("#theFrm").serialize();
$.post('/car/save',params,function(obj){ $.post('/car/save',params,function(obj){
alert(obj.msg);
if(obj.success) { if(obj.success) {
$('#back-btn').click(); parent.layer.msg('保存成功');
parent.refreshList();
layer_close();
} else {
parent.layer.msg(data.msg);
} }
},'json'); },'json');
} }, function(){
}); //
//返回按钮
$('#back-btn').click(function(){
window.location.href='/database/a-index?<?=$back_params?>';
}); });
//品牌选择
$('#brand_id').change(function(){
var brand_id = $(this).val();
$('#factory_id').html('<option value="0">---请选择---</option>');
$('#series_id').html('<option value="0">---请选择---</option>');
$('#displacement_id').html('<option value="0">---请选择---</option>');
$('#year_id').html('<option value="0">---请选择---</option>');
$('#model_id').html('<option value="0">---请选择---</option>');
if(brand_id > 0) {
$.get('/car/factories',{brand_id:brand_id},function(obj){
if(obj.success) {
$('#factory_id').html(obj.html);
}
},'json');
}
});
//选择厂家
$('#factory_id').change(function(){
$('#series_id').html('<option value="0">---请选择---</option>');
$('#displacement_id').html('<option value="0">---请选择---</option>');
$('#year_id').html('<option value="0">---请选择---</option>');
$('#model_id').html('<option value="0">---请选择---</option>');
var factory_id = $(this).val();
if(factory_id > 0){
$.get('/car/series',{factory_id:factory_id},function(obj){
if(obj.success){
$('#series_id').html(obj.html);
}
},'json');
$.get('/car/models',{factory_id:factory_id},function(obj) {
$('#model_id').html(obj.html);
});
}
});
//选择车系
$('#series_id').change(function(){
$('#displacement_id').html('<option value="0">---请选择---</option>');
$('#year_id').html('<option value="0">---请选择---</option>');
// $('#model_id').html('<option value="0">---请选择---</option>');
var series_id = $(this).val();
if(series_id > 0) {
$.get('/car/displacements',{series_id:series_id},function(obj){
if(obj.success){
//判断当前车系是否有排量
if(obj.html.length == '36'){
//不存在排量 获取年份
var displacement_id = $('#displacement_id').val();
$.get('/car/years',{series_id:series_id,displacement_id:displacement_id},function(obj){
//不存在年份获取车型
if(obj.html.length == '36'){
var year_id = $('#year_id').val();
// $.get('/car/models',{series_id:series_id,displacement_id:displacement_id,year_id:year_id},function(obj){
// $('#model_id').html(obj.html);
// },'json');
}else{
$('#year_id').html(obj.html);
}
},'json');
}else{
//返回值带36个字符
$('#displacement_id').html(obj.html);
}
}
},'json');
}
});
//选择排量
$('#displacement_id').change(function(){
$('#year_id').html('<option value="0">---请选择---</option>');
$('#model_id').html('<option value="0">---请选择---</option>');
var displacement_id = $('#displacement_id').val();
var series_id = $('#series_id').val();
if(displacement_id > 0){
$.get('/car/years',{displacement_id:displacement_id,series_id:series_id},function(obj){
if(obj.success) {
//判断当前排量是否有对应年份
if(obj.html.length == '36'){
var year_id = $('#year_id').val();
$.get('/car/models',{year_id:year_id,displacement_id:displacement_id,series_id:series_id},function(obj){
if(obj.success){
$('#model_id').html(obj.html);
}
},'json');
}else{
$('#year_id').html(obj.html);
}
}
},'json');
}
});
//选择年份
$('#year_id').change(function(){
$('#model_id').html('<option value="0">---请选择---</option>');
var displacement_id = $('#displacement_id').val();
var series_id = $('#series_id').val();
var year_id = $('#year_id').val();
if(year_id > 0){
$.get('/car/models',{displacement_id:displacement_id,series_id:series_id,year_id:year_id},function(obj){
if(obj.success){
$('#model_id').html(obj.html);
}
},'json');
}
}); });
}) })
</script> </script>
<?php $this->endBlock('footer_js'); ?>

@ -86,7 +86,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<a href="login.html" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a> <a href="/common/logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
<a class="navbar-minimalize minimalize-styl-2 btn btn-success roll-right" href="#" style="position:fixed;bottom:50%;"> <a class="navbar-minimalize minimalize-styl-2 btn btn-success roll-right" href="#" style="position:fixed;bottom:50%;">
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</a> </a>
@ -95,7 +95,7 @@
<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/common/welcome" frameborder="0" data-id="index_v1.html" seamless></iframe> <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/common/welcome" frameborder="0" data-id="index_v1.html" seamless></iframe>
</div> </div>
<div class="footer"> <div class="footer">
<div class="pull-right">&copy; 2014-2017 <a href="http://www.zi-han.net/" target="_blank">zihan's blog</a> <div class="pull-right">&copy; 2014-<?=date('Y')?> <a href="#" target="_blank">汇盈百顺</a>
</div> </div>
</div> </div>
</div> </div>

@ -0,0 +1,121 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form role="form" class="form-horizontal" id="searchFrm" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-sm-1">车牌</label>
<div class="col-sm-3">
<input type="text" id="car_no" name="car_no" class="form-control">
</div>
<label class="control-label col-sm-1">发动机号</label>
<div class="col-sm-3">
<input type="text" id="engine_no" name="engine_no" class="form-control">
</div>
<label class="control-label col-sm-1">车架号</label>
<div class="col-sm-3">
<input type="text" id="car_frame_no" name="car_frame_no" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">车主</label>
<div class="col-sm-3">
<input type="text" id="car_man" name="car_man" class="form-control">
</div>
<label class="control-label col-sm-1">联系电话</label>
<div class="col-sm-3">
<input type="text" id="phone" name="phone" class="form-control">
</div>
<label class="control-label col-sm-1">保险公司</label>
<div class="col-sm-3">
<input type="text" id="company" name="company" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">初登日期</label>
<div class="col-sm-3">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="register_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" name="register_end" value="" autocomplete="off" />
</div>
</div>
<label class="control-label col-sm-1">保险日期</label>
<div class="col-sm-3">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="insurer1_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" name="insurer1_end" value="" autocomplete="off" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">范围</label>
<div class="col-sm-11">
<div class="checkbox checkbox-inline">
<input type="checkbox" name="b_lib" id="b_lib" value="1">
<label for="b_lib">B库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="c_lib" id="c_lib" value="1">
<label for="c_lib">C库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="d_lib" id="d_lib" value="1">
<label for="d_lib">D库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="e_lib" id="e_lib" value="1">
<label for="e_lib">E库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="invalid_lib" id="invalid_lib" value="1">
<label for="invalid_lib">无效库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="unsel_lib" id="unsel_lib" value="1">
<label for="unsel_lib">未分配</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="has_phone" id="has_phone" value="1">
<label for="has_phone">有电话号码</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-3 col-sm-offset-5">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
function search() {
var o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
parent.o = o;
parent.refreshList();
layer_close();
}
$(function () {
$('.input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -1,302 +1,193 @@
<?php <?php
use \common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<style> <?php $this->beginBlock('header_css'); ?>
.act_btn1{ <link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
width: 120px; <?php $this->endBlock(); ?>
background-repeat: round;
}
</style>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
//编辑
function edit(id) {
var params = $('#searchForm').serialize();
window.location.href = '/car/edit?id=' + id + '&back_params=' + encodeURIComponent(params);
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/car/delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){ <div class="wrapper wrapper-content animated fadeInRight">
$("#search-btn").click(function(){ <div class="ibox float-e-margins">
$('#page').val(0); <div class="ibox-title">
var params = $('#searchForm').serialize(); <h5>A库</h5>
window.location.href = "/database/a-index?" + params; <div class="ibox-tools">
}); <a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
$('#add-btn').click(function(){ <i class="fa fa-plus"></i> 添加
edit(0); </a>
}); <a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="searchDlg()">
$('#move-b-btn').click(function(){ <i class="fa fa-search"></i> 搜索
var unsel_lib = $('#unsel_lib').attr('checked'); </a>
if(unsel_lib != 'checked') { <a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
alert('请先选择未分配选项'); <i class="fa fa-refresh"></i> 刷新
return; </a>
} </div>
if(confirm('是否确认批量分配操作?')) { </div>
var params = $('#searchForm').serialize(); <div class="ibox-content">
$.post('/database/a-move-b',params,function(obj){ <form role="form" class="form-horizontal" onsubmit="return search();">
alert(obj.msg); <div class="form-group">
if(obj.success) { <div class="col-sm-8">
window.location.reload(); <button type="button" class="btn btn-primary btn-a-b">勾选A-&gt;B</button>
<button type="button" class="btn btn-primary btn-a-c">勾选A-&gt;C</button>
<button type="button" class="btn btn-primary btn-a-b-all">批量A-&gt;B</button>
<button type="button" class="btn btn-danger btn-clear">清空搜索条件</button>
</div>
<div class="col-sm-4">
<div class="col-sm-8">
<select class="form-control">
<option value="0">请先把无效理由</option>
<?php foreach($invalid_items as $item) {
echo '<option value="'.$item->id.'">'.$item->name.'</option>';
} }
},'json'); ?>
</select>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary">无效数据</button>
</div>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th width="50" data-field="id">ID</th>
<th data-field="car_no">车牌</th>
<th data-field="factory_model">车型</th>
<th data-field="car_man">车主</th>
<th data-field="phone">联系电话</th>
<th data-field="register_date">初登日期</th>
<th data-field="insurer1_date">保险日期</th>
<th data-field="company">保险公司</th>
<th data-field="engine_no">发动机号</th>
<th data-field="car_frame_no">车架号</th>
<th data-field="location">位置</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
var o = {};
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
return opStr.join(' ');
} }
}); function create() {
$('#move-e-btn').click(function(){ title = '新增车辆';
var unsel_lib = $('#unsel_lib').attr('checked'); layer_show(title, '/car/edit?id=0');
if(unsel_lib != 'checked') {
alert('请先选择未分配选项');
return;
} }
if(confirm('是否确认批量分配操作?')) { function searchDlg() {
var params = $('#searchForm').serialize(); title = '综合搜索';
$.post('/database/a-move-e',params,function(obj){ layer_show(title, '/database/a-search');
alert(obj.msg);
if(obj.success) {
window.location.reload();
} }
},'json'); function edit(id) {
var title = '编辑车辆';
layer_show(title, '/car/edit?id=' + id);
} }
function del(id) {
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/car/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
if(data.success == true) {
refreshList();
}
}, 'json');
}, function(){
//
}); });
$('#move-right-btn').click(function(){
var unsel_lib = $('#unsel_lib').attr('checked');
if(unsel_lib != 'checked') {
alert('请先选择未分配选项');
return;
} }
if(confirm('是否确认批量分配操作?')) {
var params = $('#searchForm').serialize(); function refreshList() {
$.post('/database/a-move-clean',params,function(obj){ $('#listTable').bootstrapTable('refresh');
alert(obj.msg);
if(obj.success) {
window.location.reload();
} }
},'json');
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/database/a-index-json",
pagination: true,
sidePagination: 'server',
multipleSelectRow: true,
queryParams: function(params) {
o['limit'] = params['limit'];
o['offset'] = params['offset'];
return o;
} }
}); });
$('#move-btn').click(function(){
if(confirm('是否确认 A->B 操作?')) {
var params = $('#listFrm').serialize();
$.post('/database/a-b',params,function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
} }
$(function() {
search();
$('.btn-a-b').click(function(){
var rows = $('#listTable').bootstrapTable('getSelections');
var params = [];
rows.forEach(function(item,index,array){
params.push(item.id);
}); });
$('#clean-btn').click(function(){ $.post('/database/a-b', {ids:params.join(',')}, function(data) {
if(confirm('是否确认 A->清洗库 操作?')) { parent.layer.msg(data.msg);
var params = $('#listFrm').serialize(); if(data.success == true) {
$.post('/database/a-clean',params,function(obj){ refreshList();
alert(obj.msg);
if(obj.success) {
window.location.reload();
} }
},'json'); },'json');
}
}); });
$('#move-a2c-btn').click(function(){ $('.btn-a-b-all').click(function() {
if(confirm('是否确认 A->C 操作?')) { layer.confirm('是否确认批量移动?', {
var params = $('#listFrm').serialize(); btn: ['确认','取消'], //按钮
$.post('/database/a-c',params,function(obj){ shade: false //不显示遮罩
alert(obj.msg); }, function(){
var params = o;
$.post('/database/a-b-all',params,function(obj){
layer.msg(obj.msg);
if(obj.success) { if(obj.success) {
window.location.reload(); layer.msg('保存成功');
search();
} }
},'json'); },'json');
} }, function(){
//
}); });
$('#move-a2e-btn').click(function(){
if(confirm('是否确认 A->E 操作?')) {
var params = $('#listFrm').serialize();
$.post('/database/a-e',params,function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}); });
$('.invalid-btn').click(function(){ $('.btn-a-c').click(function() {
if(confirm('是否确认无效?')) { var rows = $('#listTable').bootstrapTable('getSelections');
var params = $('#listFrm').serialize(); var params = [];
var invalid_id = $('#invalid_id').val(); rows.forEach(function(item,index,array){
params = params + '&invalid_id=' + invalid_id; params.push(item.id);
$.post('/database/invalid',params,function(obj){ });
alert(obj.msg); $.post('/database/a-c', {ids:params.join(',')}, function(data) {
if(obj.success) { parent.layer.msg(data.msg);
window.location.reload(); if(data.success == true) {
refreshList();
} }
},'json'); },'json');
}
});
/*
$("#output-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.open("/database/a-index-output?" + params);
});
*/
$('#all').click(function(){
if($(this).prop('checked')==true) {
$('.item').each(function() {
$(this).prop('checked', true);
}); });
} else { $('.btn-clear').click(function() {
$('.item').each(function () { o = {};
$(this).prop('checked',false); search();
});
}
}); });
}); });
</script> </script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <?php $this->endBlock(); ?>
<form id="searchForm">
<input type="hidden" id="page" name="page" value="<?=$page?>">
<tr>
<td class="td_bg">
车牌:<input name="car_no" type="text" value="<?=$car_no?>" style="width:100px;">
发动机号:<input name="engine_no" type="text" value="<?=$engine_no?>" style="width:100px;">
车架号:<input name="car_frame_no" type="text" value="<?=$car_frame_no?>" style="width:100px;">
车主:<input name="car_man" type="text" value="<?=$car_man?>" style="width:100px;">
联系电话:<input name="phone" type="text" value="<?=$phone?>" style="width:100px;">
</td>
</tr>
<tr>
<td class="td_bg">
初登日期:从<input class="act_date" name="register_begin" type="text" value="<?=$register_begin?>" onclick="WdatePicker()"><input class="act_date" name="register_end" type="text" value="<?=$register_end?>" onclick="WdatePicker()">截止
<!-- 保险日期:从<input class="act_date" name="insurer1_begin" type="text" value="--><?//=$insurer1_begin?><!--" onclick="WdatePicker()">至<input class="act_date" name="insurer1_end" type="text" value="--><?//=$insurer1_end?><!--" onclick="WdatePicker()">截止-->
保险日期:
<input name="insurer1_month" class="day_date" type="text" value="<?=$insurer1_month?>" style="width:30px;" placeholder="月份">
<input name="insurer1_day" class="day_date" type="text" value="<?=$insurer1_day?>" style="width:30px;" placeholder="天数">
<input name="insurer1_month1" class="day_date" type="text" value="<?=$insurer1_month1?>" style="width:30px;" placeholder="月份">
<input name="insurer1_day1" class="day_date" type="text" value="<?=$insurer1_day1?>" style="width:30px;" placeholder="天数">
<!-- 从<input class="act_date" name="insurer1_begin" type="text" value="--><?//=$insurer1_begin?><!--" onclick="WdatePicker()">至<input class="act_date" name="insurer1_end" type="text" value="--><?//=$insurer1_end?><!--" onclick="WdatePicker()">截止-->
保险公司:<input name="company" type="text" value="<?=$company?>" style="width:100px;">
<!-- <input type="checkbox" name="clean_right" value="1" --=$lean_right?'checked':'清洗岗准确-->
<!-- <input type="checkbox" name="biaozhu" value="2019417" --//=$biaozhu?'checked':''--特殊数据-->
</td>
</tr>
<tr>
<td class="td_bg">
范围:
<label>
<input type="checkbox" name="b_lib" value="1" <?=$b_lib?'checked':''?>>B库
</label>
<label>
<input type="checkbox" name="c_lib" value="1" <?=$c_lib?'checked':''?>>C库
</label>
<label>
<input type="checkbox" name="d_lib" value="1" <?=$d_lib?'checked':''?>>D库
</label>
<!-- <label>-->
<!-- <input type="checkbox" name="e_lib" value="1" --/=$e_lib?'checked':''-E库-->
<!-- </label>-->
<label>
<input type="checkbox" name="invalid_lib" value="1" <?=$invalid_lib?'checked':''?>>无效库
</label>
<label>
<input type="checkbox" name="unsel_lib" id="unsel_lib" value="1" <?=$unsel_lib?'checked':''?>>未分配
</label>
<label>
<input type="checkbox" name="has_phone" value="1" <?=$has_phone==1?'checked':''?>>有电话号码
</label>
<label>
<input type="checkbox" name="no_insurerdate" value="1" <?=$no_insurerdate==1?'checked':''?>>无保险日期
</label>
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
</td>
</tr>
<tr>
<td class="td_bg">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
<input type="button" class="act_btn" id="move-btn" name="move-btn" value="勾选A库到B库">
<input type="button" class="act_btn" id="move-a2c-btn" name="move-a2c-btn" value="勾选A库到C库">
<!-- <input type="button" class="act_btn" id="move-a2e-btn" name="move-a2e-btn" value="勾选A库到E库">-->
<input type="button" class="act_btn" id="move-b-btn" name="move-b-btn" value="批量移到B库">
<!-- <input type="button" class="act_btn" id="move-e-btn" name="move-e-btn" value="批量移到E库">-->
<!-- <input type="button" class="act_btn" id="move-right-btn" name="move-right-btn" value="批量移到清洗库">-->
<!-- <input type="button" class="act_btn act_btn1" id="clean-btn" name="clean-btn" value="勾选A库到清洗库">-->
<select name="invalid_id" id="invalid_id">
<option value="0">请选择无效理由</option>
<?php
foreach($invalid_items as $item) {
echo '<option value="'.$item->id.'">'.$item->name.'</option>';
}
?>
</select>
<input type=button class="ACT_btn invalid-btn" name="invalid-btn" value=" 无效数据 "/>
</td>
</tr>
</form>
</table>
<form id="listFrm">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td align="center" width="24" align="center" class="bg_tr"><input type="checkbox" id="all"></td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>车牌</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>车型</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>车主</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>联系电话</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>初登日期</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>保险日期</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>保险公司</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>发动机号</td>
<td width="96" align="center" align="center" class="bg_tr" nowrap>车架号</td>
<td width="78" align="center" align="center" class="bg_tr" nowrap>位置</td>
<td width="50" align="center" align="center" class="bg_tr" nowrap>操作</td>
</tr>
<?php
foreach($items as $index => $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg"nowrap ><input class="item" type="checkbox" name="ids[]" value="<?=$item->id?>"></td>
<td align="left" class="td_bg"nowrap><?=$item->car_no?></td>
<td align="left" class="td_bg"nowrap ><?=MyLib::substr_cut($item->factory_model,10)?></td>
<td align="left" class="td_bg"nowrap ><?=MyLib::substr_cut($item->car_man,10)?></td>
<td align="left" class="td_bg"nowrap ><?=$item->phone?></td>
<td align="left" class="td_bg"nowrap ><?=$item->register_date?></td>
<td align="left" class="td_bg"nowrap ><?=$item->insurer1_date?></td>
<td align="left" class="td_bg"nowrap ><?=$item->company?></td>
<td align="left" class="td_bg"nowrap ><?=$item->engine_no?></td>
<td align="left" class="td_bg"nowrap ><?=$item->car_frame_no?></td>
<td align="center" class="td_bg"nowrap ><?=$item->getLocation()?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">修改</a>]
<?php
if($item->location == 1) {
?>
[<a href="javascript:void(0);" onclick="del(<?=$item->id?>)">删除</a>]
<?php
}
?>
</td>
</tr>
<?php
}
?>
<tr >
<td height="25" colspan="12" align="center" class="td_bg"><?=$page_info?></td>
</tr>
</table>
</form>
<script>
function test() {
alert(1);
}
</script>

@ -1,43 +0,0 @@
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="50" align="center" class="bg_tr" nowrap>序号</td>
<td width="80" align="center" class="bg_tr" nowrap>礼品名称</td>
<td width="80" align="center" class="bg_tr" nowrap>类型</td>
<td width="50%" align="center" class="bg_tr" nowrap>描述</td>
<td width="80" align="center" class="bg_tr" nowrap>分类</td>
<td width="80" align="center" class="bg_tr" nowrap>添加者</td>
<td width="50" align="center" class="bg_tr" nowrap>操作时间</td>
<td width="50" align="center" class="bg_tr" nowrap>状态</td>
<td width="70" align="center" class="bg_tr" nowrap>相关操作</td>
</tr>
<?php
foreach($items as $index => $item) {
if(!$item->gift) continue;
?>
<tr>
<td align="center" class="td_bg"nowrap ><?=$index+1?></td>
<td class="td_bg" nowrap><?=$item->gift->name?></td>
<td align="center" class="td_bg" nowrap><?=$item->gift->type->name?></td>
<td class="td_bg" nowrap><?=$item->gift->remark?></td>
<td align="center" class="td_bg" nowrap><?=$item->strategy_id>0?'公司礼品':'自费礼品'?></td>
<td class="td_bg" nowrap><?=$item->user?$item->user->getShowName():''?></td>
<td align="center" class="td_bg" nowrap><?=date('Y-m-d H:i:s',$item->submit_time)?></td>
<td align="center" class="td_bg" nowrap><?php
if($item->status == 0) echo '未出库';
if($item->status == 1) echo '已出库';
if($item->status == 2) echo '正在退换';
?></td>
<td align="center" class="td_bg" nowrap>
<?php
if($item->strategy_id > 0 || $item->status > 0) {
echo '';
} else {
echo '[<a href="javascript:void();" onclick="deleteGift('.$item->id.')">删除</a>]';
}
?>
</td>
</tr>
<?php
}
?>
</table>

@ -1,46 +0,0 @@
<?php
use common\models\CarGiftT;
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" style="table-layout: fixed;">
<?php
foreach($items as $item) {
?>
<tr>
<td width="200" height="25" class="bg_tr"><?=$item->name?></td>
<td height="25" class="td_bg">
<?php
$my_gifts = CarGiftT::find()
->where('order_id='.$order_id.' and strategy_id='.$item->id)
->all();
$tmp_ids = array();
foreach($my_gifts as $my_gift) {
$tmp_ids[] = $my_gift->gift_id;
}
$my_gift_total = count($tmp_ids);
for($i = 0; $i < $item->sel_count; $i++) {
echo '礼品: ';
echo '<select name="gifts[]">';
echo '<option value="0">请选择</option>';
$gift_items = $item->gifts;
$flag = false;
foreach($gift_items as $gift_item) {
echo '<option value="'.$item->id.'-'.$gift_item->id.'"';
for($j = 0; $j < $my_gift_total; $j++) {
if(!$flag && $tmp_ids[$j] == $gift_item->id) {
echo ' selected ';
$tmp_ids[$j] = '';
$flag = true;
}
}
echo '>'.$gift_item->name.'</option>';
}
echo '</select>';
}
?>
</td>
</tr>
<?php
}
?>
</table>

@ -1,82 +1,173 @@
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <?php
<form id="theFrm"> use \common\libs\MyLib;
<input type="hidden" name="id" value="<?=$info->id?>"> ?>
<tr> <?php $this->beginBlock('header_css'); ?>
<td width="100" height="25" class="td_bg">名称</td> <link rel="stylesheet" type="text/css" href="/assets/css/plugins/webuploader/webuploader.css">
<td height="25" class="td_bg"> <?php $this->endBlock(); ?>
<input name="name" type="text" id="name" value="<?=$info->name?>" style="width:400px;"/>
</td> <div class="wrapper wrapper-content animated fadeInRight">
</tr> <div class="ibox float-e-margins">
<tr> <div class="ibox-content">
<td width="100" height="25" class="td_bg">所属分类</td> <div class="row">
<td height="25" class="td_bg"> <div class="col-md-12">
<select name="type_id"> <form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=intval($info->id)?>">
<div class="form-group">
<label class="col-md-1 control-label">名称</label>
<div class="col-md-3">
<input type="text" name="name" value="<?=$info->name?>" class="form-control">
</div>
<label class="col-md-1 control-label">所属分类</label>
<div class="col-md-3">
<select name="type_id" class="form-control">
<option value="0">---请选择---</option> <option value="0">---请选择---</option>
<?php <option value="1" <?=$info->type_id==1?'selected':''?>>实物礼品</option>
foreach($type_items as $item) { <option value="2" <?=$info->type_id==2?'selected':''?>>礼券</option>
echo '<option value="'.$item->id.'"';
if($info->type_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select> </select>
</td> </div>
</tr> </div>
<tr> <div class="form-group">
<td width="100" height="25" class="td_bg">价格</td> <label class="control-label col-sm-1">图片</label>
<td height="25" class="td_bg"> <div id="uploader" class="wu-example col-sm-10 col-md-6">
<input name="price" type="text" id="price" value="<?=$info->price?>" style="width:50px;"/> <input type="hidden" name="img" id="img" value="<?=$info->original_img?>">
</td> <!--预览-->
</tr> <div id="preview" class="uploader-list" style="margin-bottom: 3px"><img src="<?=$info->original_img?>" alt="" class="img-responsive"></div>
<tr> <div id="picker" class="col-sm-5 col-md-3">选择文件</div>
<td width="100" height="25" class="td_bg">描述</td> <div id="ctlBtn" class="btn btn-primary" style="height: 40px">开始上传</div>
<td height="25" class="td_bg">   <span class="require_red font-size">图片尺寸255x255,透明背景</span>
<textarea name="remark" id="remark" style="width: 400px; height: 50px;"><?=$info->remark?></textarea> </div>
</td> </div>
</tr> <div class="form-group">
<tr> <label class="col-md-1 control-label">价格</label>
<td width="100" height="25" class="td_bg">总数量</td> <div class="col-md-3">
<td height="25" class="td_bg"> <input type="text" name="price" value="<?=$info->price?>" class="form-control">
<input name="total" type="text" id="total" value="<?=$info->total?>" style="width:50px;"/> </div>
</td> <label class="col-md-1 control-label">使用次数</label>
</tr> <div class="col-md-3">
<tr> <input type="text" name="use_num" value="<?=$info->use_num?>" class="form-control">
<td width="100" height="25" class="td_bg">锁定量</td> </div>
<td height="25" class="td_bg"> <label class="col-md-1 control-label">总数量</label>
<input name="total_lock" type="text" id="total_lock" value="<?=$info->total_lock?>" style="width:50px;"/> <div class="col-md-3">
</td> <input type="text" name="total" value="<?=$info->total?>" class="form-control">
</tr> </div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">描述</label>
<div class="col-md-6">
<textarea name="remark" class="form-control"><?=$info->remark?></textarea>
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong><?=$info ? '保 存':'添 加'?></strong>
</button>
</div>
</div>
</div>
</form> </form>
<tr> </div>
<td height="22" colspan="2" align="center" class="td_bg"> </div>
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/> </div>
&nbsp;&nbsp; </div>
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 "> </div>
</td>
</tr> <?php $this->beginBlock('footer_js'); ?>
</table> <script src="/assets/js/plugins/webuploader/webuploader.min.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$(function () { $(function () {
//提交按钮 //提交按钮
$("#submit-btn").click(function(){ $(".btn-save").click(function(){
if(confirm('是否确认提交?')) { parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize(); var params = $("#theFrm").serialize();
$.post('/gift/save',params,function(obj){ $.post('/gift/save',params,function(obj){
alert(obj.msg);
if(obj.success) { if(obj.success) {
$('#back-btn').click(); parent.layer.msg('保存成功');
parent.refreshList();
layer_close();
} else {
parent.layer.msg(data.msg);
} }
},'json'); },'json');
} }, function(){
//
});
}); });
})
var uploader = WebUploader.create({
auto:false,
// swf文件路径
swf: "/assets/js/plugins/webuploader/Uploader.swf) ",
//返回按钮 // 文件接收服务端。
$('#back-btn').click(function(){ server: "/common/upload",
window.location.href='/gift/index';
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: {
id:'#picker',
multiple:false //限制多文件上传
},
accept:{
title:'Images',
extentions: "png,jpeg,jpg",
mimeTypes: 'image/jpg,image/jpeg,image/png'
},
formData:{
'_token':'{{csrf_token()}}'//laravel框架必不可少的
},
fileVal:"img",
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
resize: false,
fileNumLimit: 1
});
uploader.on( 'fileQueued', function( file ) {
// 创建缩略图
// 如果为非图片文件,可以不用调用此方法。
uploader.makeThumb( file, function( error, src ) {
if ( error ) {
layer.msg('不能预览');
return;
}
$("#preview").html("<img src='"+src+"'>");
}, 100, 100 );
//删除错误的第一个文件
$("#picker").on("click",function () {
uploader.removeFile(file);
})
}); });
//点击上传
$("#ctlBtn").on("click",function () {
uploader.upload();
}) })
// 文件上传成功,给item添加成功class, 用样式标记上传成功。
uploader.on( 'uploadSuccess', function( file , msg ) {
$( '#'+file.id ).addClass('upload-state-done');
// 把服务器返回的图片地址保存到隐藏域
if(msg.status ="SUCCESS"){
layer.msg('上传成功',{icon:1,time:2000});
$('input[name=img]').val( msg.fileUrl );
}else{
layer.msg("上传失败",{icon:2,time:3000});
}
});
// 文件上传失败,显示上传出错。
uploader.on( 'uploadError', function( file ) {
var $li = $( '#'+file.id ),
$error = $li.find('div.error');
// 避免重复创建
if ( !$error.length ) {
$error = $('<div class="error"></div>').appendTo( $li );
}
$error.text('上传失败');
});
</script> </script>
<?php $this->endBlock('footer_js'); ?>

@ -0,0 +1,170 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼品出库</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-horizontal" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-md-1">礼品编号</label>
<div class="col-md-2">
<input type="text" id="code" name="code" class="form-control">
</div>
<label class="control-label col-md-1">车牌</label>
<div class="col-md-2">
<input type="text" id="car_no" name="car_no" class="form-control">
</div>
<label class="control-label col-md-1">车架号</label>
<div class="col-md-2">
<input type="text" id="frame_no" name="frame_no" class="form-control">
</div>
<label class="control-label col-md-1">发动机号</label>
<div class="col-md-2">
<input type="text" id="engine_no" name="engine_no" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1">状态</label>
<div class="col-md-2">
<select name="status" class="form-control">
<option value="0" >全部</option>
<option value="4">未出库</option>
<option value="5">已出库</option>
</select>
</div>
<label class="control-label col-md-1">分类</label>
<div class="col-md-2">
<select name="type_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($type_items as $item) {
echo '<option value="'.$item->id.'"';
echo '>'.$item->name.'</option>';
}
?>
</select>
</div>
<label class="control-label col-md-1">业务工号</label>
<div class="col-md-2">
<input type="text" id="username" name="username" class="form-control">
</div>
<label class="control-label col-md-1">商业保单号</label>
<div class="col-md-2">
<input type="text" id="insurer1_no" name="insurer1_no" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1">提单日期</label>
<div class="col-md-2">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" id="s_start_date" name="s_start_date" autocomplete="off" value="" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="s_end_date" name="s_end_date" autocomplete="off" value="" />
</div>
</div>
<label class="control-label col-md-1">正本日期</label>
<div class="col-md-2">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" id="p_start_date" name="p_start_date" autocomplete="off" value="" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="p_end_date" name="p_end_date" autocomplete="off" value="" />
</div>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th width="50" data-field="id">ID</th>
<th data-field="code">礼品编号</th>
<th data-field="name">礼品</th>
<th data-field="car_no">车牌号</th>
<th data-field="car_frame_no">车架号</th>
<th data-field="use_total">提单人</th>
<th data-field="use_total">出库时间</th>
<th data-field="use_total">状态</th>
<th data-field="use_total">操作员</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
if(row.use_num > row.finish_num) {
opStr.push('<i class="fa fa-edit" title="出库"></i>');
} else {
opStr.push('<i class="fa fa-file-o" title="详情"></i>');
}
opStr.push('</a>');
return opStr.join(' ');
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/gift-out-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.code = $('#code').val();
params.car_no = $('#car_no').val();
params.frame_no = $('#frame_no').val();
params.engine_no = $('#engine_no').val();
params.status = $('#status').val();
params.type_id = $('#type_id').val();
params.username = $('#username').val();
params.insurer1_no = $('#insurer1_no').val();
params.s_start_date = $('#s_start_date').val();
params.s_end_date = $('#s_end_date').val();
params.p_start_date = $('#p_start_date').val();
params.p_end_date = $('#p_end_date').val();
return params;
}
});
return false;
}
$(function() {
$('.input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
search();
});
</script>
<?php $this->endBlock(); ?>

@ -0,0 +1,96 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼品统计</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-horizontal" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-md-1">范围</label>
<div class="col-md-2">
<select id="date_type" name="date_type" class="form-control">
<option value="0">全部</option>
<option value="1">出库时间</option>
<option value="2">正本生成时间</option>
<option value="3">提单时间</option>
</select>
</div>
<div class="col-md-2">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" id="begin_date" name="begin_date" autocomplete="off" value="" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="end_date" name="end_date" autocomplete="off" value="" />
</div>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th width="50" data-field="id">ID</th>
<th data-field="name">名称</th>
<th data-field="total">库存</th>
<th data-field="unout_total">待出库</th>
<th data-field="out_total">已出库</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/gift-tj-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.date_type = $('#date_type').val();
params.begin_date = $('#begin_date').val();
params.end_date = $('#end_date').val();
return params;
}
});
return false;
}
$(function() {
$('.input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
search();
});
</script>
<?php $this->endBlock(); ?>

@ -0,0 +1,172 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼券使用</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-horizontal" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-md-1">礼券编号</label>
<div class="col-md-2">
<input type="text" id="code" name="code" class="form-control">
</div>
<label class="control-label col-md-1">车牌</label>
<div class="col-md-2">
<input type="text" id="car_no" name="car_no" class="form-control">
</div>
<label class="control-label col-md-1">车架号</label>
<div class="col-md-2">
<input type="text" id="frame_no" name="frame_no" class="form-control">
</div>
<label class="control-label col-md-1">发动机号</label>
<div class="col-md-2">
<input type="text" id="engine_no" name="engine_no" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1">状态</label>
<div class="col-md-2">
<select name="status" class="form-control">
<option value="0" >全部</option>
<option value="4">未出库</option>
<option value="5">已出库</option>
</select>
</div>
<label class="control-label col-md-1">分类</label>
<div class="col-md-2">
<select name="type_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($type_items as $item) {
echo '<option value="'.$item->id.'"';
echo '>'.$item->name.'</option>';
}
?>
</select>
</div>
<label class="control-label col-md-1">业务工号</label>
<div class="col-md-2">
<input type="text" id="username" name="username" class="form-control">
</div>
<label class="control-label col-md-1">商业保单号</label>
<div class="col-md-2">
<input type="text" id="insurer1_no" name="insurer1_no" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1">提单日期</label>
<div class="col-md-2">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" id="s_start_date" name="s_start_date" autocomplete="off" value="" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="s_end_date" name="s_end_date" autocomplete="off" value="" />
</div>
</div>
<label class="control-label col-md-1">正本日期</label>
<div class="col-md-2">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" id="p_start_date" name="p_start_date" autocomplete="off" value="" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="p_end_date" name="p_end_date" autocomplete="off" value="" />
</div>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th width="50" data-field="id">ID</th>
<th data-field="code">礼券编号</th>
<th data-field="name">礼品</th>
<th data-field="car_no">车牌号</th>
<th data-field="car_frame_no">车架号</th>
<th data-field="use_total">发放日期</th>
<th data-field="use_total">有效期日期</th>
<th data-field="use_total">提单人</th>
<th data-field="use_total">使用日期</th>
<th data-field="use_total">状态</th>
<th data-field="use_total">操作员</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
if(row.use_num > row.finish_num) {
opStr.push('<i class="fa fa-edit" title="出库"></i>');
} else {
opStr.push('<i class="fa fa-file-o" title="详情"></i>');
}
opStr.push('</a>');
return opStr.join(' ');
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/gift-use-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.code = $('#code').val();
params.car_no = $('#car_no').val();
params.frame_no = $('#frame_no').val();
params.engine_no = $('#engine_no').val();
params.status = $('#status').val();
params.type_id = $('#type_id').val();
params.username = $('#username').val();
params.insurer1_no = $('#insurer1_no').val();
params.s_start_date = $('#s_start_date').val();
params.s_end_date = $('#s_end_date').val();
params.p_start_date = $('#p_start_date').val();
params.p_end_date = $('#p_end_date').val();
return params;
}
});
return false;
}
$(function() {
$('.input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
search();
});
</script>
<?php $this->endBlock(); ?>

@ -1,86 +0,0 @@
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="theFrm">
<input type="hidden" name="id" value="<?=$info->id?>">
<tr>
<td width="100" height="25" class="td_bg">编号</td>
<td height="25" class="td_bg">
<input name="code" type="text" id="code" value="<?=$info->code?>" style="width:400px;"/>
</td>
<td width="100" height="25" class="td_bg">名称</td>
<td height="25" class="td_bg">
<input name="name" type="text" id="name" value="<?=$info->name?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">车牌号</td>
<td height="25" class="td_bg">
<input name="car_no" type="text" id="car_no" value="<?=$info->car_no?>" style="width:400px;"/>
</td>
<td width="100" height="25" class="td_bg">联系电话</td>
<td height="25" class="td_bg">
<input name="phone" type="text" id="phone" value="<?=$info->phone?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">商业保单号</td>
<td height="25" class="td_bg">
<input name="insurer1_no" type="text" id="insurer1_no" value="<?=$info->insurer1_no?>" style="width:400px;"/>
</td>
<td width="100" height="25" class="td_bg">交强保单号</td>
<td height="25" class="td_bg">
<input name="insurer2_no" type="text" id="insurer2_no" value="<?=$info->insurer2_no?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">状态</td>
<td colspan="3" height="25" class="td_bg">
<input type="radio" name="status" value="0" <?=$info->status==0?'checked':''?>>未使用
<input type="radio" name="status" value="1" <?=$info->status==1?'checked':''?>>出库
<input type="radio" name="status" value="2" <?=$info->status==2?'checked':''?>>回收
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">入库时间</td>
<td colspan="3" height="25" class="td_bg"><?=$info->input_time?></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">出库时间</td>
<td colspan="3" height="25" class="td_bg"><?=$info->output_time?></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">回收时间</td>
<td colspan="3" height="25" class="td_bg"><?=$info->return_time?></td>
</tr>
</form>
<tr>
<td height="22" colspan="4" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
&nbsp;&nbsp;
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
</tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
var params = $("#theFrm").serialize();
$.post('/gift/gift2-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/gift/gift2-list';
});
})
</script>

@ -1,78 +0,0 @@
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
//详情
function edit(id) {
window.location.href = '/gift/gift2-edit?id=' + id;
}
$(function(){
$("#search-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/gift/gift2-list?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<form id="searchForm">
<input type="hidden" id="page" name="page" value="<?=$page?>">
<tr>
<td class="td_bg">
编号:<input name="code" type="text" value="<?=$code?>">
名称:<input name="name" type="text" value="<?=$name?>">
电话:<input name="phone" type="text" value="<?=$phone?>">
车牌:<input name="car_no" type="text" value="<?=$car_no?>">
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="30" align="center" class="bg_tr" nowrap>序号</td>
<td width="50" align="center" class="bg_tr" nowrap>编号</td>
<td width="60" align="center" class="bg_tr" nowrap>名称</td>
<td width="60" align="center" class="bg_tr" nowrap>车牌号</td>
<td width="60" align="center" class="bg_tr" nowrap>入库时间</td>
<td width="60" align="center" class="bg_tr" nowrap>出库时间</td>
<td width="60" align="center" class="bg_tr" nowrap>回收时间</td>
<td width="60" align="center" class="bg_tr" nowrap>状态</td>
<td width="60" align="center" class="bg_tr" nowrap>操作员</td>
<td width="60" align="center" class="bg_tr" nowrap>操作时间</td>
<td width="30" align="center" class="bg_tr" nowrap>操作</td>
</tr>
<?php
foreach($items as $index => $item) {
$start_index = ($page - 1) * 20 + $index;
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg"n owrap ><?=$start_index + 1?></td>
<td class="td_bg" nowrap><?=$item->code?></td>
<td class="td_bg" nowrap><?=$item->name?></td>
<td class="td_bg" nowrap><?=$item->car_no?></td>
<td class="td_bg" nowrap><?=$item->input_time?></td>
<td class="td_bg" nowrap><?=$item->output_time?></td>
<td class="td_bg" nowrap><?=$item->return_time?></td>
<td class="td_bg" ><?=$item->getStatus()?>&nbsp;</td>
<td class="td_bg" ><?=$item->user?$item->user->getShowName():''?></td>
<td class="td_bg" ><?=$item->updated_at?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">详情</a>]
</td>
</tr>
<?php
}
?>
<tr >
<td height="25" colspan="14" align="center" class="td_bg"><?=$page_info?></td>
</tr>
</table>

@ -1,86 +0,0 @@
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="theFrm">
<input type="hidden" name="id" value="<?=$info->id?>">
<tr>
<td width="100" height="25" class="td_bg">礼券编号</td>
<td height="25" class="td_bg">
<input name="code" type="text" id="code" value="<?=$info->code?>" style="width:400px;"/>
</td>
<td width="100" height="25" class="td_bg">礼品名称</td>
<td height="25" class="td_bg">
<input name="name" type="text" id="name" value="<?=$info->name?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">车牌号</td>
<td height="25" class="td_bg">
<input name="car_no" type="text" id="car_no" value="<?=$info->car_no?>" style="width:400px;"/>
</td>
<td width="100" height="25" class="td_bg">联系电话</td>
<td height="25" class="td_bg">
<input name="phone" type="text" id="phone" value="<?=$info->phone?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">商业保单号</td>
<td height="25" class="td_bg">
<input name="insurer1_no" type="text" id="insurer1_no" value="<?=$info->insurer1_no?>" style="width:400px;"/>
</td>
<td width="100" height="25" class="td_bg">交强保单号</td>
<td height="25" class="td_bg">
<input name="insurer2_no" type="text" id="insurer2_no" value="<?=$info->insurer2_no?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">状态</td>
<td colspan="3" height="25" class="td_bg">
<input type="radio" name="status" value="0" <?=$info->status==0?'checked':''?>>未使用
<input type="radio" name="status" value="1" <?=$info->status==1?'checked':''?>>出库
<input type="radio" name="status" value="2" <?=$info->status==2?'checked':''?>>回收
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">入库时间</td>
<td colspan="3" height="25" class="td_bg"><?=$info->input_time?></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">出库时间</td>
<td colspan="3" height="25" class="td_bg"><?=$info->output_time?></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">回收时间</td>
<td colspan="3" height="25" class="td_bg"><?=$info->return_time?></td>
</tr>
</form>
<tr>
<td height="22" colspan="4" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
&nbsp;&nbsp;
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
</tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
var params = $("#theFrm").serialize();
$.post('/gift/gift3-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/gift/gift3-list';
});
})
</script>

@ -1,78 +0,0 @@
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
//详情
function edit(id) {
window.location.href = '/gift/gift3-edit?id=' + id;
}
$(function(){
$("#search-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/gift/gift3-list?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<form id="searchForm">
<input type="hidden" id="page" name="page" value="<?=$page?>">
<tr>
<td class="td_bg">
礼券编号:<input name="code" type="text" value="<?=$code?>">
名称:<input name="name" type="text" value="<?=$name?>">
电话:<input name="phone" type="text" value="<?=$phone?>">
车牌:<input name="car_no" type="text" value="<?=$car_no?>">
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="30" align="center" class="bg_tr" nowrap>序号</td>
<td width="50" align="center" class="bg_tr" nowrap>礼券编号</td>
<td width="60" align="center" class="bg_tr" nowrap>名称</td>
<td width="60" align="center" class="bg_tr" nowrap>车牌号</td>
<td width="60" align="center" class="bg_tr" nowrap>入库时间</td>
<td width="60" align="center" class="bg_tr" nowrap>出库时间</td>
<td width="60" align="center" class="bg_tr" nowrap>回收时间</td>
<td width="60" align="center" class="bg_tr" nowrap>状态</td>
<td width="60" align="center" class="bg_tr" nowrap>操作员</td>
<td width="60" align="center" class="bg_tr" nowrap>操作时间</td>
<td width="30" align="center" class="bg_tr" nowrap>操作</td>
</tr>
<?php
foreach($items as $index => $item) {
$start_index = ($page - 1) * 20 + $index;
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg"n owrap ><?=$start_index + 1?></td>
<td class="td_bg" nowrap><?=$item->code?></td>
<td class="td_bg" nowrap><?=$item->name?></td>
<td class="td_bg" nowrap><?=$item->car_no?></td>
<td class="td_bg" nowrap><?=$item->input_time?></td>
<td class="td_bg" nowrap><?=$item->output_time?></td>
<td class="td_bg" nowrap><?=$item->return_time?></td>
<td class="td_bg" ><?=$item->getStatus()?>&nbsp;</td>
<td class="td_bg" ><?=$item->user?$item->user->getShowName():''?></td>
<td class="td_bg" ><?=$item->updated_at?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">详情</a>]
</td>
</tr>
<?php
}
?>
<tr >
<td height="25" colspan="14" align="center" class="td_bg"><?=$page_info?></td>
</tr>
</table>

@ -1,76 +1,124 @@
<?php <?php
use common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> <?php $this->beginBlock('header_css'); ?>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script> <link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<script type="text/javascript" language="javascript" src="/js/func.js"></script> <?php $this->endBlock(); ?>
<script type="text/javascript" language="javascript">
//编辑 <div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼品管理</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-horizontal" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-md-1">礼品类型</label>
<div class="col-md-2">
<select id="is_leave" name="is_leave" class="form-control">
<option value="">全部</option>
<option value="1">实名礼品</option>
<option value="2">礼券</option>
</select>
</div>
<label class="control-label col-md-1">名称</label>
<div class="col-md-2">
<input type="text" id="name" name="name" class="form-control">
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">名称</th>
<th data-field="type">所属类型</th>
<th data-field="price">价格</th>
<th data-field="use_num">使用次数</th>
<th data-field="remark">描述</th>
<th data-field="original_img">商品图片</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function create() {
title = '新增礼品';
layer_show(title, '/gift/edit?id=0');
}
function edit(id) { function edit(id) {
window.location.href = '/gift/edit?id=' + id; var title = '编辑礼品';
layer_show(title, '/gift/edit?id=' + id);
} }
//删除
function del(id) { function del(id) {
if(confirm('是否确认删除?')) { parent.layer.confirm('是否确认删除?', {
$.post('/gift/delete',{id:id},function(obj){ btn: ['删除','取消'], //按钮
alert(obj.msg); shade: false //不显示遮罩
if(obj.success) { }, function(){
window.location.reload(); $.post('/gift/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
});
} }
},'json'); function refreshList() {
$('#listTable').bootstrapTable('refresh');
} }
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/index-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.type_id = $('#type_id').val();
params.name = $('#name').val();
return params;
} }
$(function(){
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/gift/index?" + params;
});
$('#add-btn').click(function(){
edit(0);
}); });
return false;
}
$(function() {
search();
}); });
</script> </script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <?php $this->endBlock(); ?>
<form id="searchForm">
<tr>
<td class="td_bg">
名称:<input name="name" type="text" value="<?=$name?>">
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="50" align="center" align="center" class="bg_tr" nowrap>序号</td>
<td width="150" align="center" align="center" class="bg_tr">名称</td>
<td width="50" align="center" align="center" class="bg_tr" nowrap>所属类型</td>
<td width="50" align="center" align="center" class="bg_tr" nowrap>价格</td>
<td width="50%" align="center" align="center" class="bg_tr">描述</td>
<td width="50" align="center" align="center" class="bg_tr" nowrap>总数量</td>
<td width="70" align="center" align="center" class="bg_tr" nowrap>锁定量</td>
<td width="30" align="center" class="bg_tr">操作</td>
</tr>
<?php
foreach($items as $index => $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap ><?=$index+1?></td>
<td align="left" class="td_bg" nowrap ><?=$item->name?></td>
<td align="center" class="td_bg" nowrap ><?=$item->type?$item->type->name:''?></td>
<td align="left" class="td_bg" nowrap ><?=$item->price?></td>
<td align="left" class="td_bg" nowrap ><?=MyLib::substr_cut($item->remark,70)?></td>
<td align="left" class="td_bg" nowrap ><?=$item->total?></td>
<td align="left" class="td_bg" nowrap ><?=$item->total_lock?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">修改</a>]
<!--
[<a href="javascript:void(0);" onclick="del(<?=$item->id?>)">删除</a>]
//-->
</td>
</tr>
<?php
}
?>
</table>

@ -0,0 +1,65 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼品盘库</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th width="50" data-field="id">ID</th>
<th data-field="name">名称</th>
<th data-field="total">总数量</th>
<th data-field="out_total">已出库</th>
<th data-field="use_total">已使用</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/stastics-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
return params;
}
});
return false;
}
$(function() {
search();
});
</script>
<?php $this->endBlock(); ?>

@ -0,0 +1,96 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼券统计</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-horizontal" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-md-1">范围</label>
<div class="col-md-2">
<select id="date_type" name="date_type" class="form-control">
<option value="0">全部</option>
<option value="1">出库时间</option>
<option value="2">正本生成时间</option>
<option value="3">提单时间</option>
</select>
</div>
<div class="col-md-2">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" id="begin_date" name="begin_date" autocomplete="off" value="" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="end_date" name="end_date" autocomplete="off" value="" />
</div>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th width="50" data-field="id">ID</th>
<th data-field="name">名称</th>
<th data-field="total">库存</th>
<th data-field="unuse_total">待出库</th>
<th data-field="use_total">已出库</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/ticket-tj-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.date_type = $('#date_type').val();
params.begin_date = $('#begin_date').val();
params.end_date = $('#end_date').val();
return params;
}
});
return false;
}
$(function() {
$('.input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
search();
});
</script>
<?php $this->endBlock(); ?>

@ -15,6 +15,9 @@ use yii\helpers\Html;
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="favicon.ico">
<link href="/assets/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> <link href="/assets/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="/assets/css/font-awesome.css?v=4.4.0" rel="stylesheet"> <link href="/assets/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/assets/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
<link href="/assets/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
<?php if (isset($this->blocks['header_css'])): ?> <?php if (isset($this->blocks['header_css'])): ?>
<?= $this->blocks['header_css'] ?> <?= $this->blocks['header_css'] ?>
<?php endif; ?> <?php endif; ?>
@ -28,6 +31,7 @@ use yii\helpers\Html;
<script src="/assets/js/jquery.min.js?v=2.1.4"></script> <script src="/assets/js/jquery.min.js?v=2.1.4"></script>
<script src="/assets/js/bootstrap.min.js?v=3.3.6"></script> <script src="/assets/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/assets/js/plugins/iCheck/icheck.min.js"></script> <script src="/assets/js/plugins/iCheck/icheck.min.js"></script>
<script src="/assets/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="/assets/js/plugins/layer/layer.min.js"></script> <script src="/assets/js/plugins/layer/layer.min.js"></script>
<!-- 自定义js --> <!-- 自定义js -->
<script src="/assets/js/content.js?v=1.0.0"></script> <script src="/assets/js/content.js?v=1.0.0"></script>

@ -0,0 +1,95 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="op" value="add" />
<div class="form-group">
<label class="col-md-1 control-label">名称</label>
<div class="col-md-11">
<input type="text" name="name" value="" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">开始</label>
<div class="col-md-5">
<div class="input-group">
<span class="input-group-addon">日期</span>
<input type="text" class="input-date form-control" id="begin_date" name="begin_date" autocomplete="off" value="" />
<span class="input-group-addon">时间</span>
<input type="text" class="form-control clockpicker" data-autoclose="true" id="begin_time" name="begin_time" autocomplete="off" value="" />
</div>
</div>
<label class="col-md-1 control-label">结束</label>
<div class="col-md-5">
<div class="input-group">
<span class="input-group-addon">日期</span>
<input type="text" class="input-date form-control" id="end_date" name="end_date" autocomplete="off" value="" />
<span class="input-group-addon">时间</span>
<input type="text" class="form-control clockpicker" data-autoclose="true" id="end_time" name="end_time" autocomplete="off" value="" />
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">备注</label>
<div class="col-md-11">
<textarea class="form-control" name="remark" id="remark"></textarea>
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>添 加</strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
$('.input-date').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
$('.clockpicker').clockpicker();
//提交按钮
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/marketing-strategy/save',params,function(obj){
if(obj.success) {
parent.layer.msg('保存成功');
parent.refreshList();
layer_close();
} else {
parent.layer.msg(data.msg);
}
},'json');
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -0,0 +1,104 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title fixed">
<h5>营销策略 - 编辑 - <?=$info->celuo_name?></h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs btn-users" data-id="0" href="javascript:void(0);">
<i class="fa fa-users"></i> 员工
</a>
<a class="btn btn-primary btn-xs btn-save" data-id="0" href="javascript:void(0);">
<i class="fa fa-save"></i> 保存
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="history.go(-1)">
<i class="fa fa-backward"></i> 返回
</a>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="op" value="edit" />
<input type="hidden" name="id" value="<?=$info->id?>" />
<div class="form-group">
<label class="col-md-1 control-label">名称</label>
<div class="col-md-11">
<input type="text" name="name" value="<?=$info->celuo_name?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">开始</label>
<div class="col-md-5">
<div class="input-group">
<span class="input-group-addon">日期</span>
<input type="text" class="input-date form-control" id="begin_date" name="begin_date" autocomplete="off" value="<?=substr($info->begin_date,0,10)?>" />
<span class="input-group-addon">时间</span>
<input type="text" class="form-control clockpicker" data-autoclose="true" id="begin_time" name="begin_time" autocomplete="off" value="<?=substr($info->begin_date,10,6)?>" />
</div>
</div>
<label class="col-md-1 control-label">结束</label>
<div class="col-md-5">
<div class="input-group">
<span class="input-group-addon">日期</span>
<input type="text" class="input-date form-control" id="end_date" name="end_date" autocomplete="off" value="<?=substr($info->end_date,0,10)?>" />
<span class="input-group-addon">时间</span>
<input type="text" class="form-control clockpicker" data-autoclose="true" id="end_time" name="end_time" autocomplete="off" value="<?=substr($info->end_date,10,6)?>" />
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">备注</label>
<div class="col-md-11">
<textarea class="form-control" name="remark" id="remark"><?=$info->remark?></textarea>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
function create() {
title = '员工管理';
layer_show(title, '/marketing-strategy/users');
}
$('.input-date').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
$('.clockpicker').clockpicker();
//提交按钮
$(".btn-save").click(function(){
layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/marketing-strategy/save',params,function(obj){
if(obj.success) {
layer.msg('保存成功');
location.href = '/marketing-strategy/index';
} else {
layer.msg(data.msg);
}
},'json');
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -0,0 +1,101 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>营销策略</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="celuo_name">策略名字</th>
<th data-field="begin_date">开始日期</th>
<th data-field="end_date">截止日期</th>
<th data-field="remark">策略描述</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function create() {
title = '新增营销策略';
layer_show(title, '/marketing-strategy/add');
}
function edit(id) {
var title = '编辑营销策略';
window.location.href = '/marketing-strategy/edit?id=' + id;
}
function del(id) {
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/marketing-strategy/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
});
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/marketing-strategy/index-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
return params;
}
});
return false;
}
$(function() {
search();
});
</script>
<?php $this->endBlock(); ?>

@ -15,17 +15,23 @@ use \common\libs\MyLib;
<div class="col-md-2"> <div class="col-md-2">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<div class="row">
<div class="col-md-12">
<label class="i-checks"> <label class="i-checks">
<input type="checkbox" name="menu_ids[]" value="<?=$item->id?>" <?=in_array($item->id, $menu_ids)?'checked':''?>><i></i> <?=$item->name?> <input type="checkbox" name="menu_ids[]" value="<?=$item->id?>" <?=in_array($item->id, $menu_ids)?'checked':''?>><i></i> <?=$item->name?>
</label> </label>
</div> </div>
</div>
</div>
<div class="panel-body"> <div class="panel-body">
<?php foreach($item->menus as $sub_item) { ?> <?php foreach($item->menus as $sub_item) { ?>
<div> <div class="row">
<div class="col-md-12">
<label class="i-checks"> <label class="i-checks">
<input type="checkbox" name="menu_ids[]" value="<?=$sub_item->id?>" <?=in_array($sub_item->id, $menu_ids)?'checked':''?>><i></i> <?=$sub_item->name?> <input type="checkbox" name="menu_ids[]" value="<?=$sub_item->id?>" <?=in_array($sub_item->id, $menu_ids)?'checked':''?>><i></i> <?=$sub_item->name?>
</label> </label>
</div> </div>
</div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>

@ -1,102 +1,45 @@
<?php <?php
use \common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<link href="/css/tabs.css" rel="stylesheet" type="text/css"> <?php $this->beginBlock('header_css'); ?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> <?php $this->endBlock(); ?>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript" src="/js/common2.js"></script>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <div class="wrapper wrapper-content animated fadeInRight">
<tr> <div class="ibox float-e-margins">
<td height="22" colspan="2" class="td_bg"> <div class="ibox-content">
<form id="theFrm"> <form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=$info->id?>"> <input type="hidden" name="id" value="<?=intval($info->id)?>">
<table width="100%" align="center" height="120" border="0" cellpadding="0" cellspacing="0" id="mainTable"> <div class="tabs-container">
<tr> <ul class="nav nav-tabs">
<td height="120" valign="top" class="td_bg"> <li class="active"><a data-toggle="tab" href="#tab-1"> 员工信息</a></li>
<!--员工信息--> <li class=""><a data-toggle="tab" href="#tab-2"> 薪酬信息</a></li>
<table> <li class=""><a data-toggle="tab" href="#tab-3"> 权限信息</a></li>
<tbody> </ul>
<tr> <div class="tab-content ">
<TD height="30" align="center" class=tab-on id=navcell onclick=open_up(1) name="navcell">▼员工信息</TD> <div id="tab-1" class="tab-pane active">
</tr> <div class="panel-body">
</tbody> <div class="form-group">
</table> <label class="col-md-1 control-label">工号</label>
<TABLE id=tb1 cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb"> <div class="col-md-3">
<tr> <input type="text" name="username" value="<?=$info->username?>" class="form-control">
<td width="100" height="25" class="bg_tr">工号</td> </div>
<td height="25" class="td_bg"><?php <label class="col-md-1 control-label">登录密码</label>
if($info->id == 1) { <div class="col-md-3">
echo $info->username; <input type="text" name="password" value="" class="form-control">
} else { </div>
echo '<input name="username" type="text" value="'.$info->username.'" style="width:300px;"/>'; <label class="col-md-1 control-label">姓名</label>
} <div class="col-md-3">
?></td> <input type="text" name="name" value="<?=$info->name?>" class="form-control">
<td width="100" height="25" class="bg_tr">登录密码</td> </div>
<td height="25" class="td_bg"><input name="password" type="text" value="" style="width:300px;"/></td> </div>
</tr> <div class="form-group">
<tr> <label class="col-md-1 control-label">联系电话</label>
<td width="100" height="25" class="bg_tr">姓名</td> <div class="col-md-3">
<td height="25" class="td_bg"><input name="name" type="text" value="<?=$info->name?>" style="width:300px;"/></td> <input type="text" name="phone" value="<?=$info->phone?>" class="form-control">
<td width="100" height="25" class="bg_tr">联系电话</td> </div>
<td height="25" class="td_bg"><input name="phone" type="text" value="<?=$info->phone?>" style="width:300px;"/></td> <label class="col-md-1 control-label">所属岗位</label>
</tr> <div class="col-md-3">
<tr> <select name="group_id" class="form-control">
<td width="100" height="25" class="bg_tr">电话分机</td>
<td height="25" class="td_bg">
<input name="ext_phone" type="text" value="<?=$info->ext_phone?>" style="width:300px;"/>
</td>
<td width="100" height="25" class="bg_tr">电话服务器</td>
<td height="25" class="td_bg">
<select name="phone_server_id" style="width:200px;">
<option value="0">&nbsp;</option>
<?php
foreach($phone_server_items as $phone_server) {
echo '<option value="'.$phone_server->id.'"';
if($phone_server->id == $info->phone_server_id)
echo ' selected ';
echo '>'.$phone_server->name.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">所属公司</td>
<td height="25" class="td_bg">
<select name="company_id" id="company_id" style="width:200px;">
<option value="0">&nbsp;</option>
<?php
foreach($company_items as $company) {
echo '<option value="'.$company->id.'"';
if($company->id == $info->company_id)
echo ' selected ';
echo '>'.$company->name.'</option>';
}
?>
</select>
</td>
<td width="100" height="25" class="bg_tr">所属部门</td>
<td height="25" class="td_bg">
<select name="department_id" id="department_id" style="width:200px;">
<option value="0">&nbsp;</option>
<?php
foreach($department_items as $department) {
echo '<option value="'.$department->id.'"';
if($department->id == $info->department_id)
echo ' selected ';
echo '>'.$department->name.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">所属岗位</td>
<td height="25" class="td_bg">
<select name="group_id" style="width:200px;">
<option value="0">&nbsp;</option> <option value="0">&nbsp;</option>
<?php <?php
foreach($group_items as $group) { foreach($group_items as $group) {
@ -107,18 +50,10 @@ use \common\libs\MyLib;
} }
?> ?>
</select> </select>
</td> </div>
<td width="100" height="25" class="bg_tr">允许登录</td> <label class="col-md-1 control-label">角色</label>
<td height="25" class="td_bg"> <div class="col-md-3">
<label> <select name="role_id" class="form-control">
<input name="is_login" type="checkbox" value="1" <?=$info->is_login==1?'checked':''?>/>
</label>
</td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">角色</td>
<td height="25" class="td_bg">
<select name="role_id" style="width:200px;">
<?php <?php
foreach($role_items as $role) { foreach($role_items as $role) {
echo '<option value="'.$role->id.'"'; echo '<option value="'.$role->id.'"';
@ -128,85 +63,70 @@ use \common\libs\MyLib;
} }
?> ?>
</select> </select>
</td> </div>
<td width="100" height="25" class="bg_tr">允许外网登陆</td> </div>
<td height="25" class="td_bg"> <div class="form-group">
<label> <label class="col-md-1 control-label">允许登录</label>
<input name="is_outer" type="checkbox" value="1" <?= $info->is_outer==1?'checked':'' ?> /> <div class="checkbox col-md-3">
<label class="i-checks">
<input name="is_login" type="checkbox" value="1" <?=$info->is_login==1?'checked':''?>/>
</label> </label>
</td> </div>
</tr> <label class="col-md-1 control-label">外网登陆</label>
<tr> <div class="checkbox col-md-3">
<td width="100" height="25" class="bg_tr">业务分组</td> <label class="i-checks">
<td height="25" class="td_bg"> <input name="is_outer" type="checkbox" value="1" <?= $info->is_outer==1?'checked':'' ?> />允许
<select name="business_group_id">
<option value="0">请选择</option>
<?php
foreach ($business_group as $index => $item){
echo '<option value="'.$item->id.'"';
echo $item->id == $info->business_group_id ? 'selected' : '';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
<td width="100" height="25" class="bg_tr">是否离职</td>
<td height="25" class="td_bg">
<label>
<input name="is_leave" type="checkbox" value="1" <?= $info->is_leave==1?'checked':'' ?> />
</label> </label>
</td> </div>
</tr> <label class="col-md-1 control-label">是否离职</label>
<tr> <div class="checkbox col-md-3">
<td width="100" height="25" class="bg_tr"></td> <label class="i-checks">
<td height="25" class="td_bg"></td> <input name="is_leave" type="checkbox" value="1" <?= $info->is_leave==1?'checked':'' ?> />
<td width="100" height="25" class="bg_tr">是否送单</td>
<td height="25" class="td_bg">
<label>
<input name="is_send" type="checkbox" value="1" <?= $info->is_send==1?'checked':'' ?> />
</label> </label>
</td> </div>
</tr> </div>
</table> </div>
<!--薪酬信息--> </div>
<table> <div id="tab-2" class="tab-pane">
<tbody> <div class="panel-body">
<tr> <div class="form-group">
<TD height="30" align="center" class=tab-off id=navcell onclick=switchCell(2) name="navcell">▲薪酬信息</TD> <label class="col-md-1 control-label">入职日期</label>
</tr> <div class="col-md-3">
</tbody> <div class="input-group date">
</table> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<TABLE id=tb2 cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb" class="hide-table"> <input type="text" name="enter_date" class="form-control" value="<?=$info->enter_date?>">
<tr> </div>
<td width="100" height="25" class="bg_tr">入职日期</td> </div>
<td width="200" height="25" class="td_bg"> <label class="col-md-1 control-label">转正时间</label>
<input class="act_date" name="enter_date" type="text" value="<?=$info->enter_date?>" style="width:120px;" onclick="WdatePicker()"/> <div class="col-md-3">
</td> <div class="input-group date">
<td width="100" height="25" class="bg_tr">转正时间</td> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<td height="25" class="td_bg"> <input type="text" name="job_date" class="form-control" value="<?=$info->job_date?>">
<input name="job_date" type="text" value="<?=$info->job_date?>" style="width:120px;" onclick="WdatePicker()"/> </div>
</td> </div>
</tr> <label class="col-md-1 control-label">调整工资</label>
<tr> <div class="col-md-3">
<td width="100" height="25" class="bg_tr">调整工资</td> <input type="text" name="ext_pay" value="<?=$info->ext_pay?>" class="form-control">
<td height="25" class="td_bg"><input name="ext_pay" type="text" value="<?=$info->ext_pay?>" style="width:120px;"/></td> </div>
<td width="100" height="25" class="bg_tr">总工资</td> </div>
<td height="25" class="td_bg"><span id="total_pay">0.00</span></td> <div class="form-group">
</tr> <label class="col-md-1 control-label">总工资</label>
<tr> <div class="col-md-3">
<td width="100" height="25" class="bg_tr">试用工资(%)</td> <label class="form-control-static"><span id="total_pay">0.00</span></label>
<td height="25" class="td_bg"> </div>
<input name="try_rate" type="text" value="<?=$info->try_rate?>" style="width:120px;"/>% <label class="col-md-1 control-label">试用工资(%)</label>
</td> <div class="col-md-3">
<td width="100" height="25" class="bg_tr">试用工资</td> <input type="text" name="try_rate" value="<?=$info->try_rate?>" class="form-control">
<td height="25" class="td_bg"> </div>
<input name="try_pay" type="text" value="<?=$info->try_pay?>" style="width:120px;"/> <label class="col-md-1 control-label">试用工资</label>
</td> <div class="col-md-3">
</tr> <input type="text" name="try_pay" value="<?=$info->try_pay?>" class="form-control">
<tr> </div>
<td width="100" height="25" class="bg_tr">工作制</td> </div>
<td height="25" class="td_bg"> <div class="form-group">
<select name="worktype_id"> <label class="col-md-1 control-label">工作制</label>
<div class="col-md-3">
<select name="worktype_id" class="form-control">
<option value="0">请选择</option> <option value="0">请选择</option>
<?php <?php
foreach($worktypes as $worktype) { foreach($worktypes as $worktype) {
@ -217,28 +137,26 @@ use \common\libs\MyLib;
} }
?> ?>
</select> </select>
</td> </div>
<td width="100" height="25" class="bg_tr">是否双休</td> <label class="col-md-1 control-label">是否双休</label>
<td height="25" class="td_bg"> <div class="checkbox col-md-3">
<label> <label class="i-checks">
<input type="checkbox" name="is_double" value="1" <?=$info->is_double == 1 ? 'checked' : ''?> /> <input type="checkbox" name="is_double" value="1" <?=$info->is_double == 1 ? 'checked' : ''?> />
</label> </label>
</td> </div>
</tr> </div>
</table> </div>
<!--权限分配--> </div>
<table> <div id="tab-3" class="tab-pane">
<tbody> <div class="panel-body">
<tr> <TABLE id=tb3 name="tb" class="table table-bordered">
<TD height="30" align="center" class=tab-off id=navcell onclick=switchCell(3) name="navcell">▲权限分配</TD> <thead>
</tr>
</tbody>
</table>
<TABLE id=tb3 cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb" class="hide-table">
<tr> <tr>
<td width="100" height="25" class="bg_tr">权限</td> <th width="100">权限</th>
<td height="25" class="bg_tr">一级菜单(二级菜单)</td> <th>一级菜单(二级菜单)</th>
</tr> </tr>
</thead>
<tbody>
<?php <?php
foreach($permissions as $permission) { foreach($permissions as $permission) {
$parent_menus = $permission->getMenus() $parent_menus = $permission->getMenus()
@ -248,7 +166,7 @@ use \common\libs\MyLib;
<tr> <tr>
<td width="100" height="25" class="bg_tr"> <td width="100" height="25" class="bg_tr">
<?php <?php
echo '<label>'; echo '<label class="i-checks">';
echo '<input class="checkbox" type="checkbox" name="permissions[]" value="'.$permission->id.'"'; echo '<input class="checkbox" type="checkbox" name="permissions[]" value="'.$permission->id.'"';
if($info->getPermissions()->where('id='.$permission->id)->count() > 0) if($info->getPermissions()->where('id='.$permission->id)->count() > 0)
echo ' checked '; echo ' checked ';
@ -261,20 +179,20 @@ use \common\libs\MyLib;
foreach ($parent_menus as $parent_menu) { foreach ($parent_menus as $parent_menu) {
echo '<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" id="mainTable">'; echo '<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" id="mainTable">';
echo '<tr>'; echo '<tr>';
echo '<td width="100" height="25" class="bg_tr">'; echo '<td width="100">';
echo '<label>'; echo '<label class="i-checks">';
echo '<input class="checkbox" type="checkbox" name="menus[]" value="'.$parent_menu->id.'"'; echo '<input class="checkbox" type="checkbox" name="menus[]" value="'.$parent_menu->id.'"';
if($info->getMenus()->where('id='.$parent_menu->id)->count() > 0) if($info->getMenus()->where('id='.$parent_menu->id)->count() > 0)
echo ' checked '; echo ' checked ';
echo '>' . $parent_menu->name; echo '>' . $parent_menu->name;
echo '</label>'; echo '</label>';
echo '</td>'; echo '</td>';
echo '<td height="25" class="td_bg">'; echo '<td>';
$child_menus = $permission->getMenus() $child_menus = $permission->getMenus()
->where('parent_id=' . $parent_menu->id) ->where('parent_id=' . $parent_menu->id)
->all(); ->all();
foreach ($child_menus as $child_menu) { foreach ($child_menus as $child_menu) {
echo '<label>'; echo '<label class="i-checks">';
echo '<input class="checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"'; echo '<input class="checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"';
if($info->getMenus()->where('id='.$child_menu->id)->count() > 0) if($info->getMenus()->where('id='.$child_menu->id)->count() > 0)
echo ' checked '; echo ' checked ';
@ -291,118 +209,54 @@ use \common\libs\MyLib;
<?php <?php
} }
?> ?>
</tbody>
</table> </table>
</td> </div>
</table> </div>
</div>
</div>
<div>
<div class="row" style="margin-top: 8px;">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong><?=$info ? '保 存':'添 加'?></strong>
</button>
</div>
</div>
</div>
</form> </form>
</td> </div>
</tr> </div>
<tr> </div>
<td height="22" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
&nbsp;&nbsp;
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
</tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
//点击折叠页面
function switchCell(n){
var obj = $('#tb'+n);
var title = obj.prev().find('td').html();
obj.toggle();
if(obj.is(":hidden"))
obj.prev().find('td').html(title.replace(/▼/, "▲"));
else
obj.prev().find('td').html(title.replace(/▲/, "▼"));
}
//点击效果
$('input[name="permissions[]"]').change(function(){
var b = $(this).parent().parent().next().find('input');
//获取状态
var st = $(this).attr('checked');
if(st == 'checked'){ <?php $this->beginBlock('footer_js'); ?>
b.attr('checked',true); <script type="text/javascript" language="javascript">
}else{ $(function () {
b.attr('checked',false); $('.i-checks').iCheck({
} checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
}); });
$('.input-group.date').datepicker({
$('input[name="menus[]"]').change(function(){ todayBtn: "linked",
//获取一级菜单 keyboardNavigation: false,
var top = $(this).parents().eq(5).prev().find('input'); forceParse: false,
//判断当前是几级菜单 calendarWeeks: true,
var who = $(this).parents().eq(1).nextAll().length; autoclose: true
//当前的状态
var st = $(this).attr('checked');
//三级菜单
if(who == '0'){
var _prev = $(this).parent().parent().prev().find('input');
if(st == 'checked'){
top.attr('checked',true);
_prev.attr('checked',true);
}else{
var _list = $(this).parent().parent().children().find('input');
for(var i = 0; i < _list.length; i++){
if(_list.eq(i).attr('checked') == 'checked'){
return;
}
}
//判断是否有其他的二级菜单
// top.attr('checked',false);
// _prev.attr('checked',false);
}
}else{
var _next = $(this).parent().parent().next().find('input');
if(st == 'checked') {
top.attr('checked', true);
_next.attr('checked', true);
}else{
// top.attr('checked',false);
_next.attr('checked',false);
}
}
}); });
//提交按钮 //提交按钮
$("#submit-btn").click(function(){ $(".btn-save").click(function(){
if(confirm('是否确认提交?')) { if(confirm('是否确认提交?')) {
var params = $("#theFrm").serialize(); var params = $("#theFrm").serialize();
$.post('/user/save',params,function(obj){ $.post('/user/save',params,function(obj){
alert(obj.msg); parent.layer.msg(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/user/index?<?=$back_params?>';
});
//公司选择
$('#company_id').change(function(){
var company_id = $(this).val();
$('#department_id').html('<option value="0">---请选择---</option>');
if(company_id > 0) {
$.get('/company/departments',{company_id:company_id},function(obj){
if(obj.success) { if(obj.success) {
$('#department_id').html(obj.html); parent.refreshList();
layer_close();
} }
},'json'); },'json');
} }
}); });
})
</script> </script>
<?php $this->endBlock('footer_js'); ?>

@ -1,192 +1,147 @@
<?php <?php
use \common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> <?php $this->beginBlock('header_css'); ?>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script> <link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<script type="text/javascript" language="javascript" src="/js/func.js"></script> <?php $this->endBlock(); ?>
<script type="text/javascript" language="javascript">
//编辑
function edit(id) {
var params = $('#searchForm').serialize();
window.location.href = '/user/edit?id=' + id + '&back_params=' + encodeURIComponent(params);
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/user/delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){
$("#search-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/user/index?" + params;
});
$('#add-btn').click(function(){
window.location.href = "/user/edit?id=0";
});
$('#del-btn').click(function(){
if(confirm('是否确认删除?')) {
var params = $('#delFrm').serialize();
$.post('/user/all-delete',params,function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
});
$('#all').click(function(){
if($(this).prop('checked')==true) {
$('input:checkbox').each(function() {
$(this).prop('checked', true);
});
} else {
$('input:checkbox').each(function () {
$(this).prop('checked',false);
});
}
});
//未删除,不让登陆的,可以说是异常
$(".abnormal").click(function(){
alert('异常,请联系管理员!');
return false;
});
});
</script> <div class="wrapper wrapper-content animated fadeInRight">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <div class="ibox float-e-margins">
<form id="searchForm"> <div class="ibox-title">
<input type="hidden" id="page" name="page" value="<?=$page?>"> <h5>员工管理</h5>
<tr> <div class="ibox-tools">
<td class="td_bg"> <a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
工号:<input name="username" type="text" value="<?=$username?>"> <i class="fa fa-plus"></i> 添加
真实姓名:<input name="name" type="text" value="<?=$name?>"> </a>
电话:<input name="phone" type="text" value="<?=$phone?>"> <a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
是否离职: <i class="fa fa-refresh"></i> 刷新
<select name="is_leave"> </a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-horizontal" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-md-1">工号</label>
<div class="col-md-2">
<input type="text" id="username" name="username" class="form-control">
</div>
<label class="control-label col-md-1">真实姓名</label>
<div class="col-md-2">
<input type="text" id="name" name="name" class="form-control">
</div>
<label class="control-label col-md-1">电话</label>
<div class="col-md-2">
<input type="text" id="phone" name="phone" class="form-control">
</div>
<label class="control-label col-md-1">是否离职</label>
<div class="col-md-2">
<select id="is_leave" name="is_leave" class="form-control">
<option value="">全部</option> <option value="">全部</option>
<option value="1" <?=$is_leave == '1' ? 'selected' : ''?>></option> <option value="0">在职</option>
<option value="0" <?=$is_leave == '0' ? 'selected' : ''?>></option> <option value="1">已离职</option>
</select> </select>
分组:<select name="group_id"> </div>
<option value="0">全部</option> </div>
<?php <div class="form-group">
foreach($group_items as $group) { <label class="control-label col-md-1">岗位</label>
echo '<option value="'.$group->id.'"'; <div class="col-md-3">
if($group->id == $group_id) <select id="group_id" name="group_id" class="form-control">
echo ' selected '; <option value="">全部</option>
echo '>'.$group->name.'</option>'; <?php foreach($group_items as $item) { ?>
} <option value="<?=$item->id?>"><?=$item->name?></option>
?> <?php } ?>
</select> </select>
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索"> </div>
</td> <div class="col-md-3">
</tr> <button type="submit" class="btn btn-primary">搜索</button>
<tr> </div>
<td class="td_bg"> </div>
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
<input type="button" class="act_btn" id="del-btn" name="del-btn" value="批量删除">
</td>
</tr>
</form> </form>
</table> <div class="row">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <div class="col-md-12">
<table id="listTable">
<thead>
<tr> <tr>
<td align="center" width="24" align="center" class="bg_tr"> <th data-field="id">ID</th>
<input type="checkbox" id="all"> <th data-field="username">工号</th>
</td> <th data-field="name">真实姓名</th>
<td width="100" align="center" align="center" class="bg_tr">工号</td> <th data-field="phone">联系电话</th>
<td align="center" class="bg_tr">真实姓名</td> <th data-field="is_login">允许登录</th>
<td width="100" align="center" class="bg_tr">联系电话</td> <th data-field="group_name">所属岗位</th>
<td width="60" align="center" class="bg_tr">允许登录</td> <th data-field="role_name">角色</th>
<td align="center" class="bg_tr">所属岗位</td> <th data-field="is_leave">是否离职</th>
<td width="60" align="center" class="bg_tr">角色</td> <th data-formatter="opFormatter">操作</th>
<td width="60" align="center" class="bg_tr">是否离职</td>
<td width="60" align="center" class="bg_tr">状态</td>
<td width="30" align="center" class="bg_tr">操作</td>
</tr>
<form id="delFrm">
<?php
foreach($items as $index => $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap ><input type="checkbox" name="ids[]" value="<?=$item->id?>"></td>
<td align="left" class="td_bg" nowrap ><?=$item->username?></td>
<td class="td_bg" nowrap><?=$item->name?></td>
<td class="td_bg" nowrap><?=$item->phone?></td>
<td align="center" class="td_bg" nowrap><?=$item->is_login==1?'是':''?></td>
<td align="left" class="td_bg" nowrap><?=$item->group?$item->group->getPath():''?></td>
<td class="td_bg" nowrap><?=$item->role?$item->role->name:''?></td>
<td class="td_bg" nowrap><?=$item->is_leave?'已离职':''?></td>
<td align="center" class="td_bg" nowrap data="<?=$item->id?>">
<?php
if(($item->is_delete === 0) && ($item->is_login === 1)){
echo '<a href="javascript:;"><span style="color:#fff;font-size:14px;background:green;padding:0px 25px;" onclick="changeState(0,$(this))"></span></a>';
}else if(($item->is_delete === 1) && ($item->is_login === 0)){
echo '<a href="javascript:;"><span style="color:#fff;font-size:14px;background:red;padding:0px 25px;" onclick="changeState(1,$(this))">×</span></a>';
}else{
echo '<a href="javascript:;"><span style="color:#fff;font-size:14px;background:#b5b5b5;padding:0px 25px;" class="abnormal">?</span></a>';
}
?>
</td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">修改</a>]
<?php
if($item->username != 'admin') {
?>
[<a href="javascript:void(0);" onclick="del(<?= $item->id ?>)">删除</a>]
<?php
}
?>
</td>
</tr>
<?php
}
?>
</form>
<tr >
<td height="25" colspan="11" align="center" class="td_bg"><?=$page_info?></td>
</tr> </tr>
</table> </thead>
<script type="text/javascript" language="javascript" src="/js/common2.js"></script> </table>
<script> </div>
/** </div>
* 改变状态 </div>
*/ </div>
function changeState(state,this_dom){ </div>
var this_text = this_dom.parents("td");
var father = this_text.parents("tr");
var id = this_text.attr("data");
$.post("/user/deal-state",{id:id,state:state},function(obj){ <?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
if(obj.success) { return opStr.join(' ');
if(state == 1){
this_text.html('<a href="javascript:;"><span style="color:#fff;font-size:14px;background:green;padding:0px 25px;" onclick="changeState(0,$(this))"></span></a>');
father.find("td").eq(4).html('是');
}else{
this_text.html('<a href="javascript:;"><span style="color:#fff;font-size:14px;background:red;padding:0px 25px;" onclick="changeState(1,$(this))">×</span></a>');
father.find("td").eq(4).html('');
} }
}else{ function create() {
alert(obj.msg); title = '新增员工';
window.location.reload(); layer_show(title, '/user/edit?id=0');
} }
},'json'); function edit(id) {
var title = '编辑员工';
layer_show(title, '/user/edit?id=' + id);
}
function del(id) {
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/user/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
});
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
} }
//回车搜索 function search() {
mySearch('username', 'search-btn'); $('#listTable').bootstrapTable('destroy');
mySearch('name', 'search-btn'); $('#listTable').bootstrapTable({
mySearch('phone', 'search-btn'); url: "/user/index-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.username = $('#username').val();
params.name = $('#name').val();
params.phone = $('#phone').val();
params.group_id = $('#group_id').val();
params.is_leave = $('#is_leave').val();
return params;
}
});
return false;
}
$(function() {
search();
});
</script> </script>
<?php $this->endBlock(); ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Loading…
Cancel
Save