更新功能

dev
曾超新 5 years ago
parent 80d6ccb647
commit a08c0ff170
  1. 2
      common/models/CarT.php
  2. 3
      composer.json
  3. 103
      composer.lock
  4. 40
      frontend/controllers/CarController.php
  5. 20
      frontend/controllers/FinanceController.php
  6. 591
      frontend/controllers/Gift2Controller.php
  7. 120
      frontend/controllers/GiftController.php
  8. 141
      frontend/controllers/GiftGroupController.php
  9. 298
      frontend/controllers/GiftTypeController.php
  10. 15
      frontend/controllers/MarketingStrategyController.php
  11. 35
      frontend/views/car/edit.php
  12. 2
      frontend/views/common/index.php
  13. 10
      frontend/views/finance/car-update-frame.php
  14. 84
      frontend/views/gift-group/edit.php
  15. 79
      frontend/views/gift-group/index.php
  16. 42
      frontend/views/gift-type/edit.php
  17. 64
      frontend/views/gift-type/index.php
  18. 42
      frontend/views/gift-type/type2-edit.php
  19. 64
      frontend/views/gift-type/type2-list.php
  20. 65
      frontend/views/gift-type/type3-edit.php
  21. 70
      frontend/views/gift-type/type3-list.php
  22. 167
      frontend/views/gift/gift-use.php
  23. 4
      frontend/views/gift/index.php

@ -62,7 +62,7 @@ class CarT extends \common\models\Base
public function rules()
{
return [
[['user_id', 'car_type_id', 'car_use_id'], 'required'],
[['user_id', 'car_use_id'], 'required'],
[['user_id', 'car_type_id', 'car_use_id','seats','brand_id','series_id','displacement_id','location','invalid_id','invalid_flag','is_track','times','biaozhu','hiddenes'], 'integer'],
[['register_date', 'insurer1_date', 'insurer2_date','id_man','id_number','print_date','car_man_number', 'created_at', 'updated_at'], 'safe'],
[['car_no', 'factory_model', 'car_model', 'engine_no', 'car_frame_no','old_user','id_phone'], 'string', 'max' => 50],

@ -20,7 +20,8 @@
"yiisoft/yii2-swiftmailer": "*",
"phpoffice/phpspreadsheet": "^1.9",
"codeception/codeception": "^3.1",
"yiisoft/yii2-imagine": "^2.2"
"yiisoft/yii2-imagine": "^2.2",
"phpoffice/phpexcel": "^1.8"
},
"require-dev": {
"yiisoft/yii2-debug": "*",

103
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b5a4d09fa55d0deca37e307ccb669e36",
"content-hash": "4e10a054c08f42ba7431449d509147d7",
"packages": [
{
"name": "behat/gherkin",
@ -2227,6 +2227,75 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"time": "2019-08-22T18:11:29+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": "^5.2|^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Erik Tilt"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
},
{
"name": "Mark Baker",
"homepage": "http://markbakeruk.net"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PHPExcel",
"keywords": [
"OpenXML",
"excel",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"abandoned": "phpoffice/phpspreadsheet",
"time": "2018-11-22T23:07:24+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.9.0",
@ -5235,7 +5304,13 @@
"type": "zip",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de",
"reference": "f72816b43e74063c8b10357394b6bba8cb1c10de",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.3.3 || ^7.0"
@ -5285,7 +5360,13 @@
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/60a97fff133b1669a5b1776aa8ab06db3f3962b7",
"reference": "60a97fff133b1669a5b1776aa8ab06db3f3962b7",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.4 || ^7.0"
@ -5346,7 +5427,13 @@
"type": "zip",
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a",
"reference": "0464787bfa7cd13576c5a1e318709768798bec6a",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"type": "library",
"extra": {
@ -5448,7 +5535,13 @@
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/3df62b1dcb272a8413f9c6e532c9d73f325ccde1",
"reference": "3df62b1dcb272a8413f9c6e532c9d73f325ccde1",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"fzaninotto/faker": "~1.4",

@ -454,26 +454,14 @@ class CarController extends BaseController
$car_frame_no = $request->post('car_frame_no');
$factory_model = $request->post('factory_model');
$seats = $request->post('seats');
$car_type_id = $request->post('car_type_id');
$car_use_id = $request->post('car_use_id');
$register_date = $request->post('register_date');
$car_year = $request->post('car_year');
$brand_id = $request->post('brand_id',0);
$factory_id = $request->post('factory_id',0);
$series_id = $request->post('series_id',0);
$displacement_id = $request->post('displacement_id',0);
$year_id = $request->post('year_id',0);
$model_id = $request->post('model_id',0);
$car_man = $request->post('car_man');
$car_man_type = $request->post('car_man_type');
$phone = $request->post('phone');
$car_man_number = $request->post('car_man_number');
$insurer1_date = $request->post('insurer1_date');
$insurer2_date = $request->post('insurer2_date');
$company = $request->post('company');
$purchase_price = $request->post('purchase_price');
$remark = $request->post('remark');
$op_user1 = $request->post('op_user1');
$op_user2 = $request->post('op_user2');
$op_user3 = $request->post('op_user3');
if($car_no == '') {
$result['msg'] = '请输入车牌号码!';
@ -498,30 +486,18 @@ class CarController extends BaseController
$row->factory_model = $factory_model;
$row->car_model = $factory_model;
$row->seats = $seats;
$row->car_type_id = $car_type_id;
$row->purchase_price = $purchase_price;
$row->car_use_id = $car_use_id;
$row->register_date = $register_date;
$row->car_year = $car_year;
$row->brand_id = $brand_id;
$row->factory_id = $factory_id;
$row->series_id = $series_id;
$row->displacement_id = $displacement_id;
$row->year_id = $year_id;
$row->model_id = $model_id;
$row->car_man = $car_man;
$row->phone = $phone;
$row->car_man_number = $car_man_number;
$row->remark = $remark;
if($insurer1_date != '')
$row->insurer1_date = $insurer1_date;
if($insurer2_date != '')
$row->insurer2_date = $insurer2_date;
if($company != '')
$row->company = $company;
$row->op_user1 = $op_user1;
$row->op_user2 = $op_user2;
$row->op_user3 = $op_user3;
$row->save();
$row->car_man_type = $car_man_type;
if(!$row->save()) {
$result['msg'] = print_r($row->getErrors(), true);
return $result;
}
$result['success'] = true;
$result['msg'] = '保存成功';

@ -6464,17 +6464,11 @@ class FinanceController extends \frontend\controllers\UserBaseController
if($car_man_phone != ''){
$car_info->phone = $car_man_phone;
}
// $car_info->save();
if(!$car_info->save(false)) {
if(!$car_info->save(false)) {
var_dump($car_info->errors);
exit;
}
$insert_total++;
}
@ -6528,9 +6522,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
if($car_man_phone != ''){
$car_info->phone = $car_man_phone;
}
// $car_info->save();
if(!$car_info->save(false)) {
var_dump($car_info->errors);
exit;
@ -6539,13 +6530,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
}
}
// $log = new ImportLogT();
// $datacount=$rowCount;
// $log->filename = $base_filename;
// $log->total = $datacount;
// $log->success = $insert_total;
// $log->success_rate = ($insert_total/$datacount) * 100;
// $log->save();
$result['success'] = true;
$result['msg'] = '操作成功';

@ -1,591 +0,0 @@
<?php
namespace frontend\controllers;
use common\libs\MyLib;
use common\models\CarGiftT;
use common\models\EmsT;
use common\models\Gift2T;
use common\models\GiftGroupT;
use common\models\GiftT;
use common\models\GiftTicket2T;
use common\models\GiftTicketT;
use common\models\GiftType2T;
use common\models\GiftTypeT;
use common\models\GroupT;
use common\models\InsurerTypeT;
use common\models\OrderT;
use common\models\StrategyT;
use common\models\UserT;
use Yii;
use yii\data\Pagination;
use yii\web\Response;
class Gift2Controller extends \yii\web\Controller
{
public $my = null;
public function init()
{
parent::init();
$cookie = Yii::$app->request->cookies;
$user_id = MyLib::encrypt($cookie->get('aid'),'DECODE');
if($user_id != 0)
{
$this->my = UserT::findOne(['id'=>$user_id]);
} else {
Yii::$app->response->redirect('/common/login')->send();
exit;
}
}
public function actionGift1Index()
{
$request = Yii::$app->request;
$code = $request->get('code');
$car_no = $request->get('car_no');
$status = $request->get('status',6);
$type_id = $request->get('type_id',0);
$page = $request->get('page',1);
if($page < 1) $page = 1;
$query = GiftTicketT::find()
->orderBy('id DESC');
if($code != '') {
$query = $query->andWhere('code="'.$code.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_no like "'.$car_no.'"');
}
if($status != '' && $status != 6) {
$query = $query->andWhere('status='.$status);
}
if($type_id > 0) {
$query = $query->andWhere('type_id='.$type_id);
}
// echo $query->createCommand()->rawSql;
$total = $query->count();
$pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
$pagination->setPage($page-1);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$items = $query->all();
$type_items = GiftType2T::find()->all();
$page_info = MyLib::getPageInfo($pagination);
return $this->render('gift1-index',[
'items' => $items,
'code' => $code,
'car_no' => $car_no,
'page' => $page,
'page_info' => $page_info,
'status' => $status,
'type_items' => $type_items,
'type_id' => $type_id,
]);
}
public function actionGift2Index()
{
return $this->render('gift2-index');
}
public function actionIndex()
{
$request = Yii::$app->request;
$code = $request->get('code');
$car_no = $request->get('car_no');
$page = $request->get('page',1);
if($page < 1) $page = 1;
$query = GiftTicketT::find()
->orderBy('id DESC');
if($code != '') {
$query = $query->andWhere('code="'.$code.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_no="'.$car_no.'"');
}
// echo $query->createCommand()->rawSql;
$total = $query->count();
$pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
$pagination->setPage($page-1);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$items = $query->all();
$page_info = MyLib::getPageInfo($pagination);
return $this->render('index',[
'items' => $items,
'code' => $code,
'car_no' => $car_no,
'page' => $page,
'page_info' => $page_info
]);
}
public function actionAdd()
{
$request = Yii::$app->request;
$type_items = GiftType2T::find()->all();
return $this->render('add',[
'type_items' => $type_items,
]);
}
public function actionAddSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$min_code = $request->post('min_code');
$max_code = $request->post('max_code');
$type_id = $request->post('type_id');
if($min_code == '') {
$result['msg'] = '请输入开始编号!';
return $result;
}
if($max_code == '') {
$result['msg'] = '请输入结束编号!';
return $result;
}
if($type_id == 0) {
$result['msg'] = '请选择类型!';
return $result;
}
$row = null;
for($i = $min_code; $i <= $max_code; $i++) {
$row = GiftTicketT::findOne(['code'=>$i,'type_id'=>$type_id]);
if(!$row) {
$row = new GiftTicketT();
$row->code = $i;
$row->type_id = $type_id;
$row->input_date = date('Y-m-d H:i:s');
$row->op_id = $this->my->id;
$row->status = 0;
$row->save();
}
}
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionOutput()
{
$request = Yii::$app->request;
$type_items = GiftType2T::find()->all();
$gift_group_items = GiftGroupT::find()->all();
return $this->render('output',[
'type_items' => $type_items,
'gift_group_items' => $gift_group_items,
]);
}
public function actionOutputSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$codes = $request->post('codes',array());
$types = $request->post('types',array());
$car_no = $request->post('car_no');
$tran = GiftTicketT::getDb()->beginTransaction();
try {
foreach($types as $index => $type_id) {
if($type_id == 0) continue;
$ticket_info = GiftTicketT::findOne(['code'=>$codes[$index],'type_id'=>$type_id]);
if(!$ticket_info) {
$result['msg'] = '第'.($index+1).'组礼品编号不存在!';
return $result;
}
if($ticket_info->status != 0) {
$result['msg'] = '第'.($index+1).'组礼品编号已经出库!';
return $result;
}
$ticket_info->group_id = 0;
$ticket_info->car_no = $car_no;
$ticket_info->status = 1;
$ticket_info->use_date = date('Y-m-d H:i:s');
$ticket_info->op_id = $this->my->id;
if(!$ticket_info->save()) {
var_dump($ticket_info->errors);
}
}
$tran->commit();
} catch(\Exception $e) {
$tran->rollBack();
throw $e;
}
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionEdit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
$back_params = $request->get('back_params');
if($id > 0) {
$info = GiftTicketT::findOne(['id'=>$id]);
} else {
$info = new GiftTicketT();
}
$type_items = GiftTypeT::find()->all();
return $this->render('edit',[
'info' => $info,
'type_items' => $type_items,
'back_params' => $back_params,
]);
}
public function actionSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$id = $request->post('id');
$status = $request->post('status');
$car_no = $request->post('car_no');
$ticket_info = GiftTicketT::findOne(['id'=>$id]);
if(!$ticket_info) {
$result['msg'] = '礼品券不存在!';
return $result;
}
$ticket_info->car_no = $car_no;
$ticket_info->status = $status;
$ticket_info->use_date = date('Y-m-d H:i:s');
$ticket_info->op_id = $this->my->id;
$ticket_info->save();
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionDelete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '删除失败';
if($request->isPost) {
$id = $request->post('id',0);
if($id > 0) {
$row = GiftTicketT::findOne(['id'=>$id]);
if($row->status == 0) {
$row->delete();
$result['success'] = true;
$result['msg'] = '删除成功';
}
}
}
return $result;
}
public function actionTicket2List()
{
$request = Yii::$app->request;
$code = $request->get('code');
$car_no = $request->get('car_no');
$type_id = $request->get('type_id',0);
$page = $request->get('page',1);
if($page < 1) $page = 1;
$query = GiftTicketT::find()
->where('status=1')
->orderBy('id DESC');
if($code != '') {
$query = $query->andWhere('code="'.$code.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_no like "'.$car_no.'"');
}
if($type_id > 0) {
$query = $query->andWhere('type_id='.$type_id);
}
// echo $query->createCommand()->rawSql;
$total = $query->count();
$pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
$pagination->setPage($page-1);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$items = $query->all();
$type_items = GiftType2T::find()->all();
$page_info = MyLib::getPageInfo($pagination);
return $this->render('ticket2-list',[
'items' => $items,
'code' => $code,
'car_no' => $car_no,
'page' => $page,
'page_info' => $page_info,
'type_items' => $type_items,
'type_id' => $type_id,
]);
}
public function actionTicket2Output()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
if($id == 0) {
echo '无效礼券';
exit;
}
$ticket_info = GiftTicketT::findOne(['id'=>$id]);
$gift_items = Gift2T::find()->all();
$type_items = GiftType2T::find()->all();
return $this->render('ticket2-output',[
'ticket_info' => $ticket_info,
'gift_items' => $gift_items,
'type_items' => $type_items
]);
}
public function actionTicket2OutputSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$ticket_id = $request->post('ticket_id');
$gift_id = (int)$request->post('gift_id');
$send_type = $request->post('send_type');
$send_no = $request->post('send_no');
$ticket_info = GiftTicketT::findOne(['id'=>$ticket_id]);
if(!$ticket_info) {
$result['msg'] = '礼品编号不存在!';
return $result;
}
if($gift_id == 0) {
$result['msg'] = '请选择礼品!';
return $result;
}
$ticket2_info = new GiftTicket2T();
$ticket2_info->ticket_id = $ticket_info->id;
$ticket2_info->gift_id = $gift_id;
$ticket2_info->send_type = $send_type;
$ticket2_info->send_no = $send_no;
$ticket2_info->status = 1;
$ticket2_info->op_id = $this->my->id;
$ticket2_info->use_date = date('Y-m-d H:i:s');
$ticket2_info->save();
$ticket_info->status = 2;
$ticket_info->use_date;
$ticket_info->op_id = $this->my->id;
$ticket_info->save();
//礼品
$gift_info = Gift2T::findOne(['id'=>$gift_id]);
$gift_info->total = $gift_info->total - 1;
$gift_info->save();
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionTicket2Edit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
if($id > 0) {
$info = GiftTicket2T::findOne(['id'=>$id]);
} else {
$info = new GiftTicket2T();
}
$gift_items = GiftT::find()->all();
$type_items = GiftTypeT::find()->all();
return $this->render('ticket2-edit',[
'info' => $info,
'gift_items' => $gift_items,
'type_items' => $type_items
]);
}
public function actionTicket2Save()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$id = $request->post('id',0);
$status = (int)$request->post('status');
$row = GiftTicket2T::findOne(['id'=>$id]);
$gift_info = $row->gift;
$gift_info->total = $gift_info->total + 1;
$gift_info->save();
$row->status = 3;
$row->use_date = date('Y-m-d H:i:s');
$row->save();
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionGift2List()
{
$request = Yii::$app->request;
$name = $request->get('name');
$query = Gift2T::find();
if($name != '') {
$query = $query->andWhere(['like','name',$name]);
}
$items = $query->all();
return $this->render('gift2-list',[
'items' => $items,
'name' => $name
]);
}
public function actionGift2Edit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
if($id > 0) {
$info = Gift2T::findOne(['id'=>$id]);
} else {
$info = new GiftT();
}
return $this->render('gift2-edit',[
'info' => $info
]);
}
public function actionGift2Save()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$id = $request->post('id',0);
$name = $request->post('name');
$price = $request->post('price');
$remark = $request->post('remark');
$total = (int)$request->post('total');
if($name == '') {
$result['msg'] = '请输入名称!';
return $result;
}
$row = null;
if($id > 0) {
$row = Gift2T::findOne(['id'=>$id]);
} else {
$row = new Gift2T();
}
$row->name = $name;
$row->price = $price;
$row->remark = $remark;
$row->total = $total;
$row->save();
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionGift2Delete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '删除失败';
if($request->isPost) {
$id = $request->post('id',0);
if($id > 0) {
$row = Gift2T::findOne(['id'=>$id]);
$row->delete();
$result['success'] = true;
$result['msg'] = '删除成功';
}
}
return $result;
}
public function actionStastics()
{
$gift_type_items = GiftType2T::find()->all();
$gift_items = Gift2T::find()->all();
return $this->render('stastics',[
'gift_type_items' => $gift_type_items,
'gift_items' => $gift_items,
]);
}
}

@ -784,6 +784,126 @@ class GiftController extends \yii\web\Controller
return $data;
}
public function actionGiftUse() {
$type_items = GiftT::find()
->where(['type_id'=>1,'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_id = $request->get('car_id',0);
$car_no = $request->get('car_no');
$order_id = $request->get('order_id');
$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->andWhere('gift_ticket_t_use.code="'.$code.'"');
}
if($car_id > 0) {
$query->andWhere('order_t.car_id='.$car_id);
}
if($order_id > 0) {
$query->andWhere('order_t.id='.$order_id);
}
if($car_no != '') {
$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->andWhere('gift_ticket_t_use.op_id='.$user->id);
}
if($s_begin_date != ''){
$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['username'] = ($item->user && $item->status > 0)?$item->user->getShowName():'';
$row['submit_user'] = $order_info->user ? $order_info->user->getShowName():'';
$row['status'] = $item->getStatus();
$row['use_num'] = $gift_info->use_num;
$data['rows'][] = $row;
}
return $data;
}
public function actionTicketUse() {
$type_items = GiftT::find()
->where(['type_id'=>2,'is_delete'=>0])

@ -1,141 +0,0 @@
<?php
namespace frontend\controllers;
use common\libs\MyLib;
use common\models\GiftGroupT;
use common\models\GiftType2T;
use common\models\GiftType3T;
use common\models\GiftTypeT;
use common\models\UserT;
use Yii;
use yii\web\Response;
class GiftGroupController extends \yii\web\Controller
{
public $my = null;
public function init()
{
parent::init();
$cookie = Yii::$app->request->cookies;
$user_id = MyLib::encrypt($cookie->get('aid'),'DECODE');
if($user_id != 0)
{
$this->my = UserT::findOne(['id'=>$user_id]);
} else {
Yii::$app->response->redirect('/common/login')->send();
exit;
}
}
public function actionIndex()
{
$request = Yii::$app->request;
$name = $request->get('name');
$query = GiftGroupT::find()
->orderBy('id ASC')
->where('id>0');
if($name != '') {
$query = $query->andWhere('name like "'.$name.'%"');
}
$total = $query->count();
$items = $query->all();
return $this->render('index',[
'items' => $items,
'name' => $name
]);
}
public function actionEdit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
$info = GiftGroupT::findOne(['id'=>$id]);
if(!$info)
$info = new GiftGroupT();
$gifts = $info->gifts;
$gift_ids = array();
if($gifts) {
foreach($gifts as $gift) {
$gift_ids[] = $gift->id;
}
}
$gift_items = GiftType3T::find()->all();
return $this->render('edit',[
'info'=>$info,
'gift_ids'=>$gift_ids,
'gift_items'=>$gift_items
]);
}
public function actionSave() {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
if($request->isPost) {
$id = intval($request->post('id'));
$name = $request->post('name');
$is_free = $request->post('is_free',0);
$is_damage = $request->post('is_damage',0);
$gift_ids = $request->post('gift_ids');
$gift_str = join(',',$gift_ids);
$min_money = $request->post('min_money');
$max_money = $request->post('max_money');
$group_ids = $request->post('group_ids');
$row = null;
if($id > 0) {
$row = GiftGroupT::findOne(['id'=>$id]);
} else {
$row = new GiftGroupT();
}
$row->name = $name;
$row->is_free = $is_free;
$row->is_damage = $is_damage;
$row->gift_ids = $gift_str;
$row->min_money = $min_money;
$row->max_money = $max_money;
$row->group_ids = $group_ids;
if(!$row->save()) {
var_dump($row->errors);
}
$result['success'] = true;
$result['msg'] = '操作成功';
return $result;
}
$result['success'] = false;
$reuslt['msg'] = '操作失败';
return $result;
}
public function actionDelete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '删除失败';
if($request->isPost) {
$id = $request->post('id',0);
if($id > 0) {
$row = GiftGroupT::findOne(['id'=>$id]);
$row->delete();
$result['success'] = true;
$result['msg'] = '删除成功';
}
}
return $result;
}
}

@ -1,298 +0,0 @@
<?php
namespace frontend\controllers;
use common\libs\MyLib;
use common\models\GiftType2T;
use common\models\GiftType3T;
use common\models\GiftTypeT;
use common\models\UserT;
use Yii;
use yii\web\Response;
class GiftTypeController extends \yii\web\Controller
{
public $my = null;
public function init()
{
parent::init();
$cookie = Yii::$app->request->cookies;
$user_id = MyLib::encrypt($cookie->get('aid'),'DECODE');
if($user_id != 0)
{
$this->my = UserT::findOne(['id'=>$user_id]);
} else {
Yii::$app->response->redirect('/common/login')->send();
exit;
}
}
public function actionIndex()
{
$request = Yii::$app->request;
$name = $request->get('name');
$query = GiftTypeT::find();
if($name != '') {
$query = $query->andWhere(['like','name',$name]);
}
$items = $query->all();
return $this->render('index',[
'items' => $items,
'name' => $name
]);
}
public function actionEdit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
if($id > 0) {
$info = GiftTypeT::findOne(['id'=>$id]);
} else {
$info = new GiftTypeT();
}
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) {
$id = $request->post('id',0);
$name = $request->post('name');
if($name == '') {
$result['msg'] = '请输入名称!';
return $result;
}
$row = null;
if($id > 0) {
$row = GiftTypeT::findOne(['id'=>$id]);
} else {
$row = new GiftTypeT();
}
$row->name = $name;
$row->save();
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionDelete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '删除失败';
if($request->isPost) {
$id = $request->post('id',0);
if($id > 0) {
$row = GiftTypeT::findOne(['id'=>$id]);
$row->delete();
$result['success'] = true;
$result['msg'] = '删除成功';
}
}
return $result;
}
public function actionType2List()
{
$request = Yii::$app->request;
$name = $request->get('name');
$query = GiftType2T::find();
if($name != '') {
$query = $query->andWhere(['like','name',$name]);
}
$items = $query->all();
return $this->render('type2-list',[
'items' => $items,
'name' => $name
]);
}
public function actionType2Edit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
if($id > 0) {
$info = GiftType2T::findOne(['id'=>$id]);
} else {
$info = new GiftType2T();
}
return $this->render('type2-edit',[
'info' => $info
]);
}
public function actionType2Save()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$id = $request->post('id',0);
$name = $request->post('name');
if($name == '') {
$result['msg'] = '请输入名称!';
return $result;
}
$row = null;
if($id > 0) {
$row = GiftType2T::findOne(['id'=>$id]);
} else {
$row = new GiftType2T();
}
$row->name = $name;
$row->save();
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionType2Delete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '删除失败';
if($request->isPost) {
$id = $request->post('id',0);
if($id > 0) {
$row = GiftType2T::findOne(['id'=>$id]);
$row->delete();
$result['success'] = true;
$result['msg'] = '删除成功';
}
}
return $result;
}
public function actionType3List()
{
$request = Yii::$app->request;
$name = $request->get('name');
$query = GiftType3T::find();
if($name != '') {
$query = $query->andWhere(['like','name',$name]);
}
$items = $query->all();
return $this->render('type3-list',[
'items' => $items,
'name' => $name
]);
}
public function actionType3Edit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
if($id > 0) {
$info = GiftType3T::findOne(['id'=>$id]);
} else {
$info = new GiftType3T();
}
return $this->render('type3-edit',[
'info' => $info
]);
}
public function actionType3Save()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
if($request->isPost) {
$id = $request->post('id',0);
$name = $request->post('name');
$price = $request->post('price',0);
$total = $request->post('total',-1);
$type = $request->post('type',0);
if($name == '') {
$result['msg'] = '请输入名称!';
return $result;
}
$row = null;
if($id > 0) {
$row = GiftType3T::findOne(['id'=>$id]);
} else {
$row = new GiftType3T();
}
$row->name = $name;
$row->price = $price;
$row->total = $total;
$row->type = $type;
if(!$row->save()) {
var_dump($row->errors);
}
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionType3Delete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '删除失败';
if($request->isPost) {
$id = $request->post('id',0);
if($id > 0) {
$row = GiftType3T::findOne(['id'=>$id]);
$row->delete();
$result['success'] = true;
$result['msg'] = '删除成功';
}
}
return $result;
}
}

@ -467,11 +467,20 @@ class MarketingStrategyController extends UserBaseController
$car_use_id = $request->post('car_use_id', 0);
$company2_id = $request->post('company2_id', 0);
//获取自己的所有策略
$items = ZhongjiUserT::find()
->where(['user_id'=>$this->my->id])
->all();
$celuo_ids = [];
foreach($items as $item) {
$celuo_ids[] = $item->celuo_id;
}
$date = date('Y-m-d H:i:s');
$yingxiao_item = ZhongjiYingxiao::find()
$query = ZhongjiYingxiao::find()
->where('begin_date<=:begin_date and end_date>=:end_date',[':begin_date'=>$date,':end_date'=>$date])
->orderBy('id desc')
->one();
->andWhere(['in','id',$celuo_ids])
->orderBy('id desc');
$yingxiao_item = $query->one();
if(!$yingxiao_item) {
return $result;
}

@ -31,9 +31,12 @@ use \common\libs\MyLib;
<div class="col-sm-3">
<input type="text" name="car_man" value="<?=$info->car_man?>" class="form-control">
</div>
<label class="col-sm-1 control-label">联系电话</label>
<label class="col-sm-1 control-label">证件类型</label>
<div class="col-sm-3">
<input type="text" name="phone" value="<?=$info->phone?>" class="form-control">
<select name="car_man_type" class="form-control">
<option value="身份证">身份证</option>
<option value="营业执照">营业执照</option>
</select>
</div>
<label class="col-sm-1 control-label">证件号码</label>
<div class="col-sm-3">
@ -41,6 +44,10 @@ use \common\libs\MyLib;
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">联系电话</label>
<div class="col-sm-3">
<input type="text" name="phone" value="<?=$info->phone?>" class="form-control">
</div>
<label class="col-sm-1 control-label">厂牌型号</label>
<div class="col-sm-3">
<input type="text" name="factory_model" value="<?=$info->factory_model?>" class="form-control">
@ -49,27 +56,13 @@ use \common\libs\MyLib;
<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>
<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>
<?php
foreach($car_type_items as $item) {
echo '<option value="'.$item->id.'"';
if($info->car_type_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
<input type="text" name="seats" value="<?=$info->seats?>" class="form-control">
</div>
<label class="col-sm-1 control-label">运营性质</label>
<label class="col-sm-1 control-label">使用性质</label>
<div class="col-sm-3">
<select name="car_use_id" class="form-control">
<option value="0">---请选择---</option>
@ -83,6 +76,10 @@ use \common\libs\MyLib;
?>
</select>
</div>
<label class="col-sm-1 control-label">购置价</label>
<div class="col-sm-3">
<input type="text" name="purchase_price" value="<?=$info->purchase_price?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">备注</label>

@ -70,7 +70,7 @@
</button>
<nav class="page-tabs J_menuTabs">
<div class="page-tabs-content">
<a href="javascript:;" class="active J_menuTab" data-id="index_v1.html">首页</a>
<a href="javascript:;" class="active J_menuTab" data-id="/">首页</a>
</div>
</nav>
<button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>

@ -62,16 +62,6 @@ use \common\libs\MyLib;
});
});
$(function () {
//上传
$('#fileupload').fileupload({
url: '/finance/receipt-upload',
dataType: 'json',
done: function (e, data) {
var file_info = data.result.files[0];
$('#urlfile').val(file_info.url);
$('#submit-btn').removeAttr('disabled');
}
});
//提交按钮
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {

@ -1,84 +0,0 @@
<table width="100%" border="0" align="center" cellpadding="2" 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 class="Ainput" name="name" type="text" id="name" value="<?=$info->name?>" style="width:300px;"/></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">针对岗位</td>
<td height="25" class="td_bg">
<input class="Ainput" name="group_ids" type="text" id="group_ids" value="<?=$info->group_ids?>" style="width:300px;"/>
注:如果针对全部岗位,则保持空。多个岗位之间用逗号间隔。
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">是否免费</td>
<td height="25" class="td_bg">
<label>
<input name="is_free" type="checkbox" id="is_free" value="1" <?=$info->is_free==1?'checked':''?>/>
</label>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">是否需要车损险</td>
<td height="25" class="td_bg">
<label>
<input name="is_damage" type="checkbox" id="is_damage" value="1" <?=$info->is_damage==1?'checked':''?>/>
</label>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">最低额度</td>
<td height="25" class="td_bg"><input class="Ainput" name="min_money" type="text" id="min_money" value="<?=$info->min_money?>" style="width:300px;"/></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">最高额度</td>
<td height="25" class="td_bg"><input class="Ainput" name="max_money" type="text" id="max_money" value="<?=$info->max_money?>" style="width:300px;"/></td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">包含礼品</td>
<td height="25" class="td_bg">
<?php
foreach($gift_items as $item) {
echo '<label><input type="checkbox" name="gift_ids[]" value="'.$item->id.'"';
if(in_array($item->id,$gift_ids))
echo ' checked ';
echo '>'.$item->name.'</label>';
}
?>
</td>
</tr>
</form>
<tr>
<td height="22" colspan="2" 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-group/save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/gift-group/index';
});
})
</script>

@ -1,79 +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-group/edit?id=' + id;
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/gift-group/delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/gift-group/index?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<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 align="center" width="24" align="center" class="bg_tr">ID</td>
<td width="150" align="center" align="center" class="bg_tr">分类名称</td>
<td width="50" align="center" align="center" class="bg_tr">是否免费</td>
<td width="50" align="center" align="center" class="bg_tr">是否车损险</td>
<td width="100" align="center" align="center" class="bg_tr">最低额度</td>
<td width="100" align="center" align="center" class="bg_tr">最高额度</td>
<td width="300" align="center" align="center" class="bg_tr">包含礼品</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 ><?=$item->id?></td>
<td align="left" class="td_bg"nowrap ><?=$item->name?></td>
<td align="center" class="td_bg"nowrap ><?=$item->is_free==1?'是':''?></td>
<td align="center" class="td_bg"nowrap ><?=$item->is_damage==1?'是':''?></td>
<td align="center" class="td_bg"nowrap ><?=$item->min_money==0?'无限制':$item->min_money.'元'?></td>
<td align="center" class="td_bg"nowrap ><?=$item->max_money==0?'无限制':$item->max_money.'元'?></td>
<td align="left" class="td_bg"nowrap ><?php
if($item->gifts) foreach($item->gifts as $gift) {
echo $gift->name.', ';
}
?></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>

@ -1,42 +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="name" type="text" id="name" value="<?=$info->name?>" style="width:400px;"/>
</td>
</tr>
</form>
<tr>
<td height="22" colspan="2" 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-type/save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/gift-type/index';
});
})
</script>

@ -1,64 +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-type/edit?id=' + id;
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/gift-type/delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/gift-type/index?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<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="80%" align="center" align="center" class="bg_tr">名称</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>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">修改</a>]
[<a href="javascript:void(0);" onclick="del(<?=$item->id?>)">删除</a>]
</td>
</tr>
<?php
}
?>
</table>

@ -1,42 +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="name" type="text" id="name" value="<?=$info->name?>" style="width:400px;"/>
</td>
</tr>
</form>
<tr>
<td height="22" colspan="2" 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-type/type2-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/gift-type/type2-list';
});
})
</script>

@ -1,64 +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-type/type2-edit?id=' + id;
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/gift-type/type2-delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/gift-type/type2-list?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<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="80%" align="center" align="center" class="bg_tr">名称</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>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">修改</a>]
[<a href="javascript:void(0);" onclick="del(<?=$item->id?>)">删除</a>]
</td>
</tr>
<?php
}
?>
</table>

@ -1,65 +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="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="price" type="text" id="price" value="<?=$info->price?>" style="width:100px;"/>小于零时,为百分比。
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">数量</td>
<td height="25" class="td_bg">
<input name="total" type="text" id="total" value="<?=$info->total?>" style="width:100px;"/>-1为无限数量。
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">类型</td>
<td height="25" class="td_bg">
<label>
<input type="radio" name="type" value="0" <?=$info->type==0?'checked':''?>> 实物
</label>
<label>
<input type="radio" name="type" value="1" <?=$info->type==1?'checked':''?>> 礼券
</label>
</td>
</tr>
</form>
<tr>
<td height="22" colspan="2" 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-type/type3-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/gift-type/type3-list';
});
})
</script>

@ -1,70 +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-type/type3-edit?id=' + id;
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/gift-type/type3-delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/gift-type/type3-list?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<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="70%" align="center" align="center" class="bg_tr">名称</td>
<td width="50" align="center" class="bg_tr">价格</td>
<td width="50" align="center" class="bg_tr">数量</td>
<td width="50" align="center" class="bg_tr">类型</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->price?><?=$item->price<0?'%':'元'?></td>
<td align="center" class="td_bg" nowrap><?=$item->total<0?'无限':$item->total?></td>
<td align="center" class="td_bg" nowrap><?=$item->type==0?'实物':'礼券'?></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,167 @@
<?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-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="code">礼品编号</label>
<input type="text" id="code" name="code" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="car_no">车牌</label>
<input type="text" id="car_no" name="car_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="frame_no">车架号</label>
<input type="text" id="frame_no" name="frame_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no">发动机号</label>
<input type="text" id="engine_no" name="engine_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="status">状态</label>
<select name="status" id="status" class="form-control">
<option value="0" >全部</option>
<option value="1">未使用</option>
<option value="2">使用中</option>
<option value="3">使用完</option>
</select>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="type_id">分类</label>
<select name="type_id" id="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>
<div class="form-group" style="margin-bottom: 8px;">
<label for="username">业务工号</label>
<input type="text" id="username" name="username" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="insurer1_no">商业保单号</label>
<input type="text" id="insurer1_no" name="insurer1_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker1">提单日期</label>
<div class="input-daterange input-group" id="datepicker1">
<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>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker2">正本日期</label>
<div class="input-daterange input-group" id="datepicker2">
<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>
<button type="submit" class="btn btn-primary mb-8">搜索</button>
</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="submit_user">提单人</th>
<th data-field="use_date">出库日期</th>
<th data-field="status">状态</th>
<th data-field="username">操作员</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 edit(id) {
title = '礼品核销';
layer_show(title, '/gift/gift-use-edit?id='+id);
}
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(); ?>

@ -22,8 +22,8 @@ use \common\libs\MyLib;
<form role="form" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="free_type">礼品类型</label>
<select id="is_leave" name="is_leave" class="form-control">
<option value="">全部</option>
<select id="type_id" name="type_id" class="form-control">
<option value="0">全部</option>
<option value="1">实名礼品</option>
<option value="2">礼券</option>
</select>

Loading…
Cancel
Save