作者 杨育虎

online push

要显示太多修改。

为保证性能只显示 18 of 18+ 个文件。

<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/8/20
* Time: 10:57
*/
namespace app\admin\controller;
use app\admin\model\LogisticsModel;
use cmf\controller\AdminBaseController;
use think\Db;
class LogisticsController extends AdminBaseController
{
protected $table;
protected $logistics_model;
public function _initialize()
{
$this->table = 'Logistics';
$this->logistics_model = new LogisticsModel();
}
/**
* 物流列表
* @adminMenu(
* 'name' => '物流列表',
* 'parent' => 'admin/OrderOption/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '物流列表',
* 'param' => ''
* )
*/
public function index() {
$param = $this->request->param();
$where = [
'delete_time'=>0,
'is_del'=>0
];
if(isset($param['keyword'])) {
$where['name'] = ['like','%'.$param['keyword'].'%'];
}
$list = $this->singleData($this->table,$where,2,['create_time'=>'DESC']);
$list->appends($param);
$this->assign('list',$list->items());
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
return $this->fetch();
}
/**
* 导入excel数据
* @adminMenu(
* 'name' => '导入excel数据',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '导入excel数据',
* 'param' => ''
* )
*/
public function excel() {
list($status, $msg, $file) = $this->upload();
if($status == 0) {
$this->error($msg);
}
$excel = $file['filepath'];
// 获取excel内容的数据
$array = $this->import_excel('./upload/'.$excel);
//执行导入操作
Db::startTrans();
foreach ($array as $k=>$v) {
$insert = $update = [];
// if(!$this->logistics_model->check($v[1])) {
$insert['mobile'] = $update['mobile'] = $v[0];
$insert['send_time'] = $update['send_time'] = date('Y-m-d H:i:s',\PHPExcel_Shared_Date::ExcelToPHP($v[1]));
$insert['version'] = $update['version'] = $v[2];
$insert['express'] = $update['express'] = $v[3];
$insert['is_del'] = $update['is_del'] = $v[4];
if(empty($v[4])) {
$insert['is_del'] = $update['is_del'] = 0;
if($v[4] == 0) {
$update['delete_time'] = 0;
$insert['is_del'] = $update['is_del'] = 0;
}
} else{
if($v[4] == 1) {
$update['delete_time'] = time();
$update['is_del'] = 1;
}
}
$info = $this->logistics_model->where(['express'=>$insert['express']])->find();
if($info) {
$update['update_time'] = time();
if(!$this->logistics_model->where(['id'=>$info['id']])->update($update)) {
Db::rollback();
$this->error('数据导入中出错,请重试'.$info['id']);
}
} else {
if(!$this->logistics_model->addLogistics($insert)) {
Db::rollback();
$this->error('数据导入中出错,请重试');
}
}
// }
}
Db::commit();
$this->success('数据导入成功');
}
/**
* 导入excel文件
* @param string $file excel文件路径
* @return array excel文件内容数组
*/
private function import_excel($file){
// 判断文件是什么格式
$type = pathinfo($file);
$type = strtolower($type["extension"]);
if($type =='xlsx' ){
$type = 'Excel2007';
}else{
$type = 'Excel5';
}
ini_set('max_execution_time', '0');
vendor('phpoffice.phpexcel');
// 判断使用哪种格式
$objReader = \PHPExcel_IOFactory::createReader($type);
$objPHPExcel = $objReader->load($file);
$sheet = $objPHPExcel->getSheet(0);
// 取得总行数
$highestRow = $sheet->getHighestRow();
// 取得总列数
$highestColumn = $sheet->getHighestColumn();
//循环读取excel文件,读取一条,插入一条
$data=array();
//从第二行开始读取数据
for($j=2;$j<=$highestRow;$j++){
//从A列读取数据
for($k='A';$k<=$highestColumn;$k++){
// 读取单元格
$cell = $objPHPExcel->getActiveSheet()->getCell("$k$j")->getValue();
if(is_object($cell)) {
$data[$j][] = $cell->__toString();
} else {
$data[$j][] = $cell;
}
}
}
return $data;
}
/**
* 添加物流
* @adminMenu(
* 'name' => '添加物流',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 2,
* 'icon' => '',
* 'remark' => '添加物流',
* 'param' => ''
* )
*/
public function add() {
return $this->fetch();
}
/**
* 添加物流提交
* @adminMenu(
* 'name' => '添加物流提交',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 3,
* 'icon' => '',
* 'remark' => '添加物流提交',
* 'param' => ''
* )
*/
public function addPost() {
if($this->request->isAjax()) {
$post = $this->request->param();
$validate = $this->validate($post, $this->table);
if ($validate !== true) {
$this->error($validate);
}
$result = $this->logistics_model->addLogistics($post);
if (!$result) {
$this->error('添加失败');
}
$this->success('添加成功',url('Logistics/index'));
}
}
/**
* 编辑物流
* @adminMenu(
* 'name' => '编辑物流',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 4,
* 'icon' => '',
* 'remark' => '编辑物流',
* 'param' => ''
* )
*/
public function edit() {
$id = $this->request->param('id',0,'intval');
if(!$id) {
$this->error('参数错误');
}
$info = $this->singleData($this->table,['id'=>$id,'delete_time'=>0]);
$this->assign($info);
return $this->fetch();
}
/**
* 编辑物流提交
* @adminMenu(
* 'name' => '编辑物流提交',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 5,
* 'icon' => '',
* 'remark' => '编辑物流提交',
* 'param' => ''
* )
*/
public function editPost() {
if($this->request->isPost()) {
$id = $this->request->param('id', 0, 'intval');
if (!$id) {
$this->error('参数错误');
}
$post = $this->request->param();
$validate = $this->validate($post, $this->table);
if ($validate !== true) {
$this->error($validate);
}
$result = $this->logistics_model->editLogistics($post);
if (!$result) {
$this->error('修改失败');
}
$this->success('修改成功');
}
}
/**
* 删除物流
* @adminMenu(
* 'name' => '删除物流',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 6,
* 'icon' => '',
* 'remark' => '删除物流',
* 'param' => ''
* )
*/
public function delete() {
$id = $this->request->param('id',0,'intval');
$ids = $this->request->param('ids/a');
if(isset($id)) {
$result = $this->logistics_model->where(['id'=>$id])->update(['delete_time'=>time(),'is_del'=>1]);
}
if(isset($ids)) {
$result = $this->logistics_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time(),'is_del'=>1]);
}
if(!$result) {
$this->error('删除失败');
}
$this->success('删除成功');
}
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/8/20
* Time: 10:57
*/
namespace app\admin\controller;
use app\admin\model\LogisticsModel;
use cmf\controller\AdminBaseController;
use think\Db;
class LogisticsController extends AdminBaseController
{
protected $table;
protected $logistics_model;
public function _initialize()
{
$this->table = 'Logistics';
$this->logistics_model = new LogisticsModel();
}
/**
* 物流列表
* @adminMenu(
* 'name' => '物流列表',
* 'parent' => 'admin/OrderOption/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '物流列表',
* 'param' => ''
* )
*/
public function index() {
$param = $this->request->param();
$where = [
'delete_time'=>0,
'is_del'=>0
];
if(isset($param['keyword'])) {
$where['mobile'] = ['like',$param['keyword'].'%'];
}
$list = $this->singleData($this->table,$where,2,['create_time'=>'DESC']);
$list->appends($param);
$this->assign('list',$list->items());
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
return $this->fetch();
}
/**
* 导入excel数据
* @adminMenu(
* 'name' => '导入excel数据',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '导入excel数据',
* 'param' => ''
* )
*/
public function excel() {
set_time_limit(0);
ini_set('memory_limit', '1024M');
ini_set("max_execution_time", 0);
list($status, $msg, $file) = $this->upload();
if($status == 0) {
$this->error($msg);
}
$excel = $file['filepath'];
// 获取excel内容的数据
$array = $this->import_excel('./upload/'.$excel);
//执行导入操作
Db::startTrans();
foreach ($array as $k=>$v) {
$insert = $update = [];
// if(!$this->logistics_model->check($v[1])) {
if(!empty($v[0]) && !empty($v[2]) && !empty($v[3])) {
$insert['mobile'] = $update['mobile'] = $v[0];
$insert['send_time'] = $update['send_time'] = date('Y-m-d H:i:s',\PHPExcel_Shared_Date::ExcelToPHP($v[1]));
$insert['version'] = $update['version'] = $v[2];
$insert['express'] = $update['express'] = $v[3];
$insert['is_del'] = $update['is_del'] = $v[4];
if(empty($v[4])) {
$insert['is_del'] = $update['is_del'] = 0;
if($v[4] == 0) {
$update['delete_time'] = 0;
$insert['is_del'] = $update['is_del'] = 0;
}
} else{
if($v[4] == 1) {
$update['delete_time'] = time();
$update['is_del'] = 1;
}
}
$info = $this->logistics_model->where(['express'=>$insert['express']])->find();
if($info) {
$update['update_time'] = time();
if(!$this->logistics_model->where(['id'=>$info['id']])->update($update)) {
Db::rollback();
$this->error('数据导入中出错,请重试'.$info['id'].'--手机号码:'.$v[0],null,'',10);
}
} else {
if(!$this->logistics_model->addLogistics($insert)) {
Db::rollback();
$this->error('数据导入中出错,请重试');
}
}
}
// }
}
Db::commit();
$this->success('数据导入成功');
}
/**
* 导入excel文件
* @param string $file excel文件路径
* @return array excel文件内容数组
*/
private function import_excel($file){
// 判断文件是什么格式
$type = pathinfo($file);
$type = strtolower($type["extension"]);
if($type =='xlsx' ){
$type = 'Excel2007';
}else{
$type = 'Excel5';
}
ini_set('max_execution_time', '0');
vendor('phpoffice.phpexcel');
// 判断使用哪种格式
$objReader = \PHPExcel_IOFactory::createReader($type);
$objPHPExcel = $objReader->load($file);
$sheet = $objPHPExcel->getSheet(0);
// 取得总行数
$highestRow = $sheet->getHighestRow();
// 取得总列数
$highestColumn = $sheet->getHighestColumn();
//循环读取excel文件,读取一条,插入一条
$data=array();
//从第二行开始读取数据
for($j=2;$j<=$highestRow;$j++){
//从A列读取数据
for($k='A';$k<=$highestColumn;$k++){
// 读取单元格
$cell = $objPHPExcel->getActiveSheet()->getCell("$k$j")->getValue();
if(is_object($cell)) {
$data[$j][] = $cell->__toString();
} else {
$data[$j][] = $cell;
}
}
}
return $data;
}
/**
* 添加物流
* @adminMenu(
* 'name' => '添加物流',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 2,
* 'icon' => '',
* 'remark' => '添加物流',
* 'param' => ''
* )
*/
public function add() {
return $this->fetch();
}
/**
* 添加物流提交
* @adminMenu(
* 'name' => '添加物流提交',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 3,
* 'icon' => '',
* 'remark' => '添加物流提交',
* 'param' => ''
* )
*/
public function addPost() {
if($this->request->isAjax()) {
$post = $this->request->param();
$validate = $this->validate($post, $this->table);
if ($validate !== true) {
$this->error($validate);
}
$result = $this->logistics_model->addLogistics($post);
if (!$result) {
$this->error('添加失败');
}
$this->success('添加成功',url('Logistics/index'));
}
}
/**
* 编辑物流
* @adminMenu(
* 'name' => '编辑物流',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 4,
* 'icon' => '',
* 'remark' => '编辑物流',
* 'param' => ''
* )
*/
public function edit() {
$id = $this->request->param('id',0,'intval');
if(!$id) {
$this->error('参数错误');
}
$info = $this->singleData($this->table,['id'=>$id,'delete_time'=>0]);
$this->assign($info);
return $this->fetch();
}
/**
* 编辑物流提交
* @adminMenu(
* 'name' => '编辑物流提交',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 5,
* 'icon' => '',
* 'remark' => '编辑物流提交',
* 'param' => ''
* )
*/
public function editPost() {
if($this->request->isPost()) {
$id = $this->request->param('id', 0, 'intval');
if (!$id) {
$this->error('参数错误');
}
$post = $this->request->param();
$validate = $this->validate($post, $this->table);
if ($validate !== true) {
$this->error($validate);
}
$result = $this->logistics_model->editLogistics($post);
if (!$result) {
$this->error('修改失败');
}
$this->success('修改成功');
}
}
/**
* 删除物流
* @adminMenu(
* 'name' => '删除物流',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 6,
* 'icon' => '',
* 'remark' => '删除物流',
* 'param' => ''
* )
*/
public function delete() {
$id = $this->request->param('id',0,'intval');
$ids = $this->request->param('ids/a');
if(isset($id)) {
$result = $this->logistics_model->where(['id'=>$id])->update(['delete_time'=>time(),'is_del'=>1]);
}
if(isset($ids)) {
$result = $this->logistics_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time(),'is_del'=>1]);
}
if(!$result) {
$this->error('删除失败');
}
$this->success('删除成功');
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/8/16
* Time: 14:14
*/
namespace app\admin\controller;
use app\admin\model\OrderModel;
use app\portal\model\OrderViewModel;
use cmf\controller\AdminBaseController;
use think\Db;
class OrderController extends AdminBaseController
{
protected $table;
protected $order_model;
protected $option_table;
protected $sort_model;
protected $order_sort_table;
public function _initialize()
{
$this->table = 'Order';
$this->order_model = new OrderModel();
$this->option_table = 'OrderOption';
$this->order_sort_table = 'OrderSort';
// 订单字段类型定义
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}">
<p class="tit"><span class=" _validate">{name}</span></p>
<div class="flex_style">
{options}
</div>
</div>';
$this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<textarea class="baby_input">{value}</textarea>
</div>';
$this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="product" value="{value}" class="baby_input" placeholder="请选择{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}">
<p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
</div>
<div class="up_wrap form_options">
<div class="up_pic">
<i class="iconfont icon-msnui-cloud-upload"></i>
<p class="click_up">点击上传</p>
</div>
</div>';
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker>
<input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[12] = '<div class="text_item form_options" data-validate="{validate}" data-type="12">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
}
/**
* 电子订单列表
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderOption/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '电子订单列表',
* 'param' => ''
* )
*/
public function index() {
$param = $this->request->param();
// 查询条件处理
$where = [
'delete_time'=>0
];
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$order_view_model = new OrderViewModel();
$list = $order_view_model->where($where)
->paginate(10);
$orderList = $list->items();
foreach ($orderList as $k=>$v) {
$v['options'] = json_decode($v['options'],true);
$orderList[$k]['order_price'] = 0;
foreach ($v['options'] as $ko=>$vo) {
if($vo['id'] == 64) {
$orderList[$k]['order_price'] = $vo['user_choose'];
}
}
}
$list->appends($param);
$this->assign('list',$orderList);
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
// 订单类型查询
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 电子订单列表(表单类型下)
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderSort/index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 1,
* 'icon' => '',
* 'remark' => '电子订单列表(表单类型下)',
* 'param' => ''
* )
*/
public function index_sort() {
$param = $this->request->param();
$where = [
'delete_time'=>0
];
if(empty($param['sort_id'])) {
$this->error('参数错误');
}
$where['sort_id'] = $param['sort_id'];
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
$endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$order_view_model = new OrderViewModel();
$list = $order_view_model->where($where)
->paginate(10);
$orderList = $list->items();
foreach ($orderList as $k=>$v) {
$v['options'] = json_decode($v['options'],true);
$orderList[$k]['order_price'] = 0;
foreach ($v['options'] as $ko=>$vo) {
if($vo['id'] == 64) {
$orderList[$k]['order_price'] = $vo['user_choose'];
}
}
}
$list->appends($param);
$this->assign('list',$orderList);
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('sort_id',$param['sort_id']);
// 订单类型
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 电子订单列表(销售人员下)
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderSort/index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 2,
* 'icon' => '',
* 'remark' => '电子订单列表(销售人员下)',
* 'param' => ''
* )
*/
public function index_sales() {
$param = $this->request->param();
$where = [
'delete_time'=>0
];
if(empty($param['user_id'])) {
$this->error('参数错误');
}
$where['user_id'] = $param['user_id'];
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
$endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$order_view_model = new OrderViewModel();
$list = $order_view_model->where($where)
->paginate(10);
$orderList = $list->items();
foreach ($orderList as $k=>$v) {
$v['options'] = json_decode($v['options'],true);
$orderList[$k]['order_price'] = 0;
foreach ($v['options'] as $ko=>$vo) {
if($vo['id'] == 64) {
$orderList[$k]['order_price'] = $vo['user_choose'];
}
}
}
$list->appends($param);
$this->assign('list',$orderList);
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('user_id',$param['user_id']);
// 订单类型
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 用户数据导出
* @adminMenu(
* 'name' => '用户数据导出',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 3,
* 'icon' => '',
* 'remark' => '用户数据导出',
* 'param' => ''
* )
*/
public function excel()
{
$param = $this->request->param();
// 进行查询条件的处理
$where = [
'delete_time'=>0
];
if(!empty($param['ids'])) {
$where['id'] = ['in',$param['ids']];
}
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['user_id'])) {
$where['user_id'] = $param['user_id'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
// 查询数据并导出
$list = $this->singleData('order_view',$where,1);
$this->expList($list);
}
// 数据导出
private function expList($array)
{
//导出Excel
$objPHPExcel = new \PHPExcel();
// 设置单元格宽度
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('P')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Q')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('R')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('S')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('T')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('U')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('V')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('W')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('X')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Y')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Z')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AA')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AB')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AC')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AD')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AE')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AF')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AG')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AH')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AI')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AJ')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AK')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AL')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AM')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AQ')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AR')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AS')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AT')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AU')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AV')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AW')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AX')->setWidth(20);
// 设置水平居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// 设置垂直居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
//Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'ID')
->setCellValue('B1', '订单号')
->setCellValue('C1', '订单类型')
->setCellValue('D1', '销售用户名')
->setCellValue('E1', '订单确认码')
->setCellValue('F1', '订单状态')
->setCellValue('G1', '支付方式')
->setCellValue('H1', '收集状态')
->setCellValue('I1', '发布时间')
->setCellValue('J1', '失效时间')
->setCellValue('K1', '订单来源')
->setCellValue('L1', '来源渠道')
->setCellValue('M1', '销售人员')
->setCellValue('N1', '小朋友姓名')
->setCellValue('O1', '小朋友性别')
->setCellValue('P1', '小朋友生日')
->setCellValue('Q1', '家长姓名')
->setCellValue('R1', '家长身份')
->setCellValue('S1', '其他身份')
->setCellValue('T1', '联系电话')
->setCellValue('U1', '手机备用电话')
->setCellValue('V1', '座机备用电话')
->setCellValue('W1', '地址')
->setCellValue('X1', '收货地址')
->setCellValue('Y1', '详细收货地址')
->setCellValue('Z1', '收货人姓名')
->setCellValue('AA1', '收货人电话')
->setCellValue('AB1', '收货区域')
->setCellValue('AC1', '商品选择')
->setCellValue('AD1', '其他版本')
->setCellValue('AE1', '具体版本')
->setCellValue('AF1', '订购长度')
->setCellValue('AG1', '其他订购长度')
->setCellValue('AH1', '订购起始月')
->setCellValue('AI1', '订购价格')
->setCellValue('AJ1', '礼物选择')
->setCellValue('AK1', '后期加赠礼物')
->setCellValue('AL1', '是否适龄')
->setCellValue('AM1', '不适龄备注')
->setCellValue('AN1', '不适龄照片')
->setCellValue('AO1', '月龄版升级年份')
->setCellValue('AP1', '备注')
->setCellValue('AQ1', '客户编号')
->setCellValue('AR1', '介绍人类型')
->setCellValue('AS1', '介绍人信息')
->setCellValue('AT1', '介绍人礼物')
->setCellValue('AU1', '被介绍人礼物')
->setCellValue('AV1', '固定礼')
->setCellValue('AW1', '选择礼')
->setCellValue('AX1', '商品名称');
$i = 2;
// 循环到导出数据
foreach ($array as $v) {
$status = '未支付';
if($v['status'] == 1) {
$status = '已支付';
}
$is_stop = '收集中';
if($v['is_stop'] == 1) {
$is_stop = '已停止';
}
$pay_type = '';
if($v['pay_type'] == 1) {
$pay_type = '微信';
}
if($v['pay_type'] == 2) {
$pay_type = '支付宝';
}
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A' . $i, $v['id'])
->setCellValueExplicit('B' . $i, $v['order_sn'],\PHPExcel_Cell_DataType::TYPE_STRING)
// ->setCellValueExplicit('B' . $i, $v['order_sn'],\PHPExcel_Cell_DataType::TYPE_STRING)
->setCellValue('C' . $i, $v['sort_name'])
->setCellValue('D' . $i, $v['user_login'])
->setCellValue('E' . $i, $v['number'])
->setCellValue('F' . $i, $status)
->setCellValue('G' . $i, $pay_type)
->setCellValue('H' . $i, $is_stop)
->setCellValue('I' . $i, date('Y-m-d H:i',$v['create_time']))
->setCellValue('J' . $i, date('Y-m-d H:i',$v['over_time']));
$v['options'] = json_decode($v['options'],true);
foreach ($v['options'] as $ks=>$vs) {
$where = [
'id' => $vs['id']
];
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
if(!empty($vs['cell'])) {
if($vs['type'] == 3) {
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
} elseif($vs['type'] == 8) {
// 导出图片格式,高度自适应
$filePath = './upload/'.$vs['user_choose'];
if(!empty($vs['user_choose']) && file_exists($filePath)) {
$image = \think\Image::open('./upload/'.$vs['user_choose']);
// 返回图片的宽度
$width = $image->width();
// 返回图片的高度
$height = $image->height();
$default = $height/($width/100);
//设置默认行高(通过图片缩放比例计算高度)
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default);
// 图片生成
$objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();
$objDrawing[$i]->setPath($filePath);
// 设置宽度
$objDrawing[$i]->setWidth(100); //照片宽度
/*设置图片要插入的单元格*/
$objDrawing[$i]->setCoordinates($vs['cell'].$i);
// 图片偏移距离
$objDrawing[$i]->setOffsetX(12);
$objDrawing[$i]->setOffsetY(12);
$objDrawing[$i]->setWorksheet($objPHPExcel->getActiveSheet());
}
} else {
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
}
}
}
$i++;
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
}
$filename = '订单数据导出'. date('Y-m-d').'.xls';
ob_end_clean();
header("Content-type:application/vnd.ms-excel;charset=UTF-8");
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $filename . '"');
header('Cache-Control: max-age=0');
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
/**
* 编辑订单
* @adminMenu(
* 'name' => '编辑订单',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 4,
* 'icon' => '',
* 'remark' => '编辑订单',
* 'param' => ''
* )
*/
public function edit() {
$id = $this->request->param('id',0,'intval');
if(!$id) {
$this->error('参数错误');
}
$where = [
'id' => $id,
'delete_time'=>0
];
$info = Db::name('order_view')->where($where)->find();
$info['options'] = json_decode($info['options'],true);
foreach ($info['options'] as $k=>$v) {
$optionsInfo = $this->singleData($this->option_table,['id'=>$v['id']]);
$v['name'] = $optionsInfo['name'];
$v['html'] = $this->form_model($v);
$info['group'][] = $v;
}
$this->assign($info);
return $this->fetch();
}
// 处理订单模型数据
private function form_model($formData) {
$html = $this->sort_model[$formData['type']];
$html = str_replace('{name}',$formData['name'],$html);
if($formData['checked'] == 1) {
$html = str_replace('{must}','*',$html);
$html = str_replace('{validate}',1,$html);
} else {
$html = str_replace('{must}','',$html);
$html = str_replace('{validate}',0,$html);
}
if(!empty($formData['values']) && $formData['values'] != null) {
$array = explode(',',$formData['values']);
$options = '';
foreach ($array as $k=>$v) {
$active = isset($formData['user_choose'])?($formData['user_choose']==$v?'active':''):($k==0?'active':'');
$options .= '<p class="order_style '.$active.'">'.$v.'</p>';
}
$html = str_replace('{options}',$options,$html);
}
if(!empty($formData['user_choose'])) {
$html = str_replace('{value}',$formData['user_choose'],$html);
} else {
$html = str_replace('{value}','',$html);
}
return $html;
}
/**
* 修改订单收集状态
* @adminMenu(
* 'name' => '修改订单收集状态',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 5,
* 'icon' => '',
* 'remark' => '修改订单收集状态',
* 'param' => ''
* )
*/
public function stop()
{
$param = $this->request->param();
$msg = '';
if (isset($param['ids']) && isset($param["is_stop"])) {
$stop = $param["is_stop"];
$ids = $this->request->param('ids/a');
$this->order_model->where(['id' => ['in', $ids]])->update(['is_stop' => $stop, 'update_time' => time()]);
if($stop == 0) {
$msg = "开启收集成功!";
}
if($stop == 1) {
$msg = "停止收集成功!";
}
$this->success($msg, '');
}
if (isset($param['id']) && isset($param["is_stop"])) {
$stop = $param["is_stop"];
$id = $this->request->param('id');
$this->order_model->where(['id' => $id])->update(['is_stop' => $stop, 'update_time' => time()]);
if($stop == 0) {
$msg = "开启收集成功!";
}
if($stop == 1) {
$msg = "停止收集成功!";
}
$this->success($msg,'');
}
}
/**
* 删除订单
* @adminMenu(
* 'name' => '删除订单',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 6,
* 'icon' => '',
* 'remark' => '删除订单',
* 'param' => ''
* )
*/
public function delete() {
$id = $this->request->param('id',0,'intval');
$ids = $this->request->param('ids/a');
if(isset($id)) {
$result = $this->order_model->where(['id'=>$id])->update(['delete_time'=>time()]);
}
if(isset($ids)) {
$result = $this->order_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time()]);
}
if(!$result) {
$this->error('删除失败');
}
$this->success('删除成功');
}
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/8/16
* Time: 14:14
*/
namespace app\admin\controller;
use app\admin\model\OrderModel;
use app\portal\model\OrderViewModel;
use cmf\controller\AdminBaseController;
use think\Db;
class OrderController extends AdminBaseController
{
protected $table;
protected $order_model;
protected $option_table;
protected $sort_model;
protected $order_sort_table;
public function _initialize()
{
$this->table = 'Order';
$this->order_model = new OrderModel();
$this->option_table = 'OrderOption';
$this->order_sort_table = 'OrderSort';
parent::_initialize();
// 订单字段类型定义
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}">
<p class="tit"><span class=" _validate">{name}</span></p>
<div class="flex_style">
{options}
</div>
</div>';
$this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<textarea class="baby_input">{value}</textarea>
</div>';
$this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="product" value="{value}" class="baby_input" placeholder="请选择{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}">
<p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
</div>
<div class="up_wrap form_options">
<div class="up_pic">
<i class="iconfont icon-msnui-cloud-upload"></i>
<p class="click_up">点击上传</p>
</div>
</div>';
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker>
<input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[12] = '<div class="text_item form_options" data-validate="{validate}" data-type="12">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
}
/**
* 电子订单列表
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderOption/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '电子订单列表',
* 'param' => ''
* )
*/
public function index() {
$param = $this->request->param();
// 查询条件处理
$where = [
'delete_time'=>0
];
if(!empty($param['parent_name'])) {
// $parent_name = unicode_encode($param['parent_name']);
// $parent_name = '"{"id":"46","type":"1","status":"0","checked":"1","values":"","user_choose":"'.$parent_name.'"}';
$where['parent_name'] = ['like','%'.$param['parent_name'].'%'];
}
if(!empty($param['mobile'])) {
$mobile = '{"id":"49","type":"3","status":"0","checked":"1","values":"","user_choose":"'.$param['mobile'].'"}';
$where['options'] = ['like','%'.$mobile.'%'];
}
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$order_view_model = new OrderViewModel();
$list = $order_view_model->where($where)
->paginate(10);
$orderList = $list->items();
foreach ($orderList as $k=>$v) {
$v['options'] = json_decode($v['options'],true);
$orderList[$k]['order_price'] = 0;
foreach ($v['options'] as $ko=>$vo) {
if($vo['id'] == 64) {
$orderList[$k]['order_price'] = $vo['user_choose'];
}
if($vo['id'] == 46) {
$orderList[$k]['parent_name'] = $vo['user_choose'];
}
if($vo['id'] == 49) {
$orderList[$k]['mobile'] = $vo['user_choose'];
}
}
if(!empty($orderList[$k]['parent_name'])) {
Db::name('order')->update(['id'=>$v['id'],'parent_name'=>$orderList[$k]['parent_name']]);
}
}
$list->appends($param);
$this->assign('list',$orderList);
$this->assign('page',$list->render());
$this->assign('parent_name',isset($param['parent_name']) ? $param['parent_name'] : '');
$this->assign('mobile',isset($param['mobile']) ? $param['mobile'] : '');
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
// 订单类型查询
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 电子订单列表(表单类型下)
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderSort/index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 1,
* 'icon' => '',
* 'remark' => '电子订单列表(表单类型下)',
* 'param' => ''
* )
*/
public function index_sort() {
$param = $this->request->param();
$where = [
'delete_time'=>0
];
if(empty($param['sort_id'])) {
$this->error('参数错误');
}
$where['sort_id'] = $param['sort_id'];
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
$endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$order_view_model = new OrderViewModel();
$list = $order_view_model->where($where)
->paginate(10);
$orderList = $list->items();
foreach ($orderList as $k=>$v) {
$v['options'] = json_decode($v['options'],true);
$orderList[$k]['order_price'] = 0;
foreach ($v['options'] as $ko=>$vo) {
if($vo['id'] == 64) {
$orderList[$k]['order_price'] = $vo['user_choose'];
}
}
}
$list->appends($param);
$this->assign('list',$orderList);
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('sort_id',$param['sort_id']);
// 订单类型
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 电子订单列表(销售人员下)
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderSort/index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 2,
* 'icon' => '',
* 'remark' => '电子订单列表(销售人员下)',
* 'param' => ''
* )
*/
public function index_sales() {
$param = $this->request->param();
$where = [
'delete_time'=>0
];
if(empty($param['user_id'])) {
$this->error('参数错误');
}
$where['user_id'] = $param['user_id'];
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
$endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$order_view_model = new OrderViewModel();
$list = $order_view_model->where($where)
->paginate(10);
$orderList = $list->items();
foreach ($orderList as $k=>$v) {
$v['options'] = json_decode($v['options'],true);
$orderList[$k]['order_price'] = 0;
foreach ($v['options'] as $ko=>$vo) {
if($vo['id'] == 64) {
$orderList[$k]['order_price'] = $vo['user_choose'];
}
}
}
$list->appends($param);
$this->assign('list',$orderList);
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('user_id',$param['user_id']);
// 订单类型
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 用户数据导出
* @adminMenu(
* 'name' => '用户数据导出',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 3,
* 'icon' => '',
* 'remark' => '用户数据导出',
* 'param' => ''
* )
*/
public function excel()
{
$param = $this->request->param();
// 进行查询条件的处理
$where = [
'delete_time'=>0
];
if(!empty($param['ids'])) {
$where['id'] = ['in',$param['ids']];
}
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['user_id'])) {
$where['user_id'] = $param['user_id'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
// 查询数据并导出
$list = $this->singleData('order_view',$where,1);
$this->expList($list);
}
// 数据导出
private function expList($array)
{
//导出Excel
$objPHPExcel = new \PHPExcel();
// 设置单元格宽度
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('P')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Q')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('R')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('S')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('T')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('U')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('V')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('W')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('X')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Y')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Z')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AA')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AB')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AC')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AD')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AE')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AF')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AG')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AH')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AI')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AJ')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AK')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AL')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AM')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AQ')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AR')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AS')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AT')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AU')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AV')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AW')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AX')->setWidth(20);
// 设置水平居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// 设置垂直居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
//Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'ID')
->setCellValue('B1', '订单号')
->setCellValue('C1', '订单类型')
->setCellValue('D1', '销售用户名')
->setCellValue('E1', '订单确认码')
->setCellValue('F1', '订单状态')
->setCellValue('G1', '支付方式')
->setCellValue('H1', '收集状态')
->setCellValue('I1', '发布时间')
->setCellValue('J1', '失效时间')
->setCellValue('K1', '订单来源')
->setCellValue('L1', '来源渠道')
->setCellValue('M1', '销售人员')
->setCellValue('N1', '小朋友姓名')
->setCellValue('O1', '小朋友性别')
->setCellValue('P1', '小朋友生日')
->setCellValue('Q1', '家长姓名')
->setCellValue('R1', '家长身份')
->setCellValue('S1', '其他身份')
->setCellValue('T1', '联系电话')
->setCellValue('U1', '手机备用电话')
->setCellValue('V1', '座机备用电话')
->setCellValue('W1', '地址')
->setCellValue('X1', '收货地址')
->setCellValue('Y1', '详细收货地址')
->setCellValue('Z1', '收货人姓名')
->setCellValue('AA1', '收货人电话')
->setCellValue('AB1', '收货区域')
->setCellValue('AC1', '商品选择')
->setCellValue('AD1', '其他版本')
->setCellValue('AE1', '具体版本')
->setCellValue('AF1', '订购长度')
->setCellValue('AG1', '其他订购长度')
->setCellValue('AH1', '订购起始月')
->setCellValue('AI1', '订购价格')
->setCellValue('AJ1', '礼物选择')
->setCellValue('AK1', '后期加赠礼物')
->setCellValue('AL1', '是否适龄')
->setCellValue('AM1', '不适龄备注')
->setCellValue('AN1', '不适龄照片')
->setCellValue('AO1', '月龄版升级年份')
->setCellValue('AP1', '备注')
->setCellValue('AQ1', '客户编号')
->setCellValue('AR1', '介绍人类型')
->setCellValue('AS1', '介绍人信息')
->setCellValue('AT1', '介绍人礼物')
->setCellValue('AU1', '被介绍人礼物')
->setCellValue('AV1', '固定礼')
->setCellValue('AW1', '选择礼')
->setCellValue('AX1', '商品名称');
$i = 2;
// 循环到导出数据
foreach ($array as $v) {
$status = '未支付';
if($v['status'] == 1) {
$status = '已支付';
}
$is_stop = '收集中';
if($v['is_stop'] == 1) {
$is_stop = '已停止';
}
$pay_type = '';
if($v['pay_type'] == 1) {
$pay_type = '微信';
}
if($v['pay_type'] == 2) {
$pay_type = '支付宝';
}
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A' . $i, $v['id'])
->setCellValueExplicit('B' . $i, $v['order_sn'],\PHPExcel_Cell_DataType::TYPE_STRING)
// ->setCellValueExplicit('B' . $i, $v['order_sn'],\PHPExcel_Cell_DataType::TYPE_STRING)
->setCellValue('C' . $i, $v['sort_name'])
->setCellValue('D' . $i, $v['user_login'])
->setCellValue('E' . $i, $v['number'])
->setCellValue('F' . $i, $status)
->setCellValue('G' . $i, $pay_type)
->setCellValue('H' . $i, $is_stop)
->setCellValue('I' . $i, date('Y-m-d H:i',$v['create_time']))
->setCellValue('J' . $i, date('Y-m-d H:i',$v['over_time']));
$v['options'] = json_decode($v['options'],true);
foreach ($v['options'] as $ks=>$vs) {
$where = [
'id' => $vs['id']
];
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
if(!empty($vs['cell'])) {
if($vs['type'] == 3) {
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
} elseif($vs['type'] == 8) {
// 导出图片格式,高度自适应
$filePath = './upload/'.$vs['user_choose'];
if(!empty($vs['user_choose']) && file_exists($filePath)) {
$image = \think\Image::open('./upload/'.$vs['user_choose']);
// 返回图片的宽度
$width = $image->width();
// 返回图片的高度
$height = $image->height();
$default = $height/($width/100);
//设置默认行高(通过图片缩放比例计算高度)
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default);
// 图片生成
$objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();
$objDrawing[$i]->setPath($filePath);
// 设置宽度
$objDrawing[$i]->setWidth(100); //照片宽度
/*设置图片要插入的单元格*/
$objDrawing[$i]->setCoordinates($vs['cell'].$i);
// 图片偏移距离
$objDrawing[$i]->setOffsetX(12);
$objDrawing[$i]->setOffsetY(12);
$objDrawing[$i]->setWorksheet($objPHPExcel->getActiveSheet());
}
} else {
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
}
}
}
$i++;
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
}
$filename = '订单数据导出'. date('Y-m-d').'.xls';
ob_end_clean();
header("Content-type:application/vnd.ms-excel;charset=UTF-8");
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $filename . '"');
header('Cache-Control: max-age=0');
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
/**
* 编辑订单
* @adminMenu(
* 'name' => '编辑订单',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 4,
* 'icon' => '',
* 'remark' => '编辑订单',
* 'param' => ''
* )
*/
public function edit() {
$id = $this->request->param('id',0,'intval');
if(!$id) {
$this->error('参数错误');
}
$where = [
'id' => $id,
'delete_time'=>0
];
$info = Db::name('order_view')->where($where)->find();
$info['options'] = json_decode($info['options'],true);
foreach ($info['options'] as $k=>$v) {
$optionsInfo = $this->singleData($this->option_table,['id'=>$v['id']]);
$v['name'] = $optionsInfo['name'];
$v['html'] = $this->form_model($v);
$info['group'][] = $v;
}
$this->assign($info);
return $this->fetch();
}
// 处理订单模型数据
private function form_model($formData) {
$html = $this->sort_model[$formData['type']];
$html = str_replace('{name}',$formData['name'],$html);
if($formData['checked'] == 1) {
$html = str_replace('{must}','*',$html);
$html = str_replace('{validate}',1,$html);
} else {
$html = str_replace('{must}','',$html);
$html = str_replace('{validate}',0,$html);
}
if(!empty($formData['values']) && $formData['values'] != null) {
$array = explode(',',$formData['values']);
$options = '';
foreach ($array as $k=>$v) {
$active = isset($formData['user_choose'])?($formData['user_choose']==$v?'active':''):($k==0?'active':'');
$options .= '<p class="order_style '.$active.'">'.$v.'</p>';
}
$html = str_replace('{options}',$options,$html);
}
if(!empty($formData['user_choose'])) {
$html = str_replace('{value}',$formData['user_choose'],$html);
} else {
$html = str_replace('{value}','',$html);
}
return $html;
}
/**
* 修改订单收集状态
* @adminMenu(
* 'name' => '修改订单收集状态',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 5,
* 'icon' => '',
* 'remark' => '修改订单收集状态',
* 'param' => ''
* )
*/
public function stop()
{
$param = $this->request->param();
$msg = '';
if (isset($param['ids']) && isset($param["is_stop"])) {
$stop = $param["is_stop"];
$ids = $this->request->param('ids/a');
$this->order_model->where(['id' => ['in', $ids]])->update(['is_stop' => $stop, 'update_time' => time()]);
if($stop == 0) {
$msg = "开启收集成功!";
}
if($stop == 1) {
$msg = "停止收集成功!";
}
$this->success($msg, '');
}
if (isset($param['id']) && isset($param["is_stop"])) {
$stop = $param["is_stop"];
$id = $this->request->param('id');
$this->order_model->where(['id' => $id])->update(['is_stop' => $stop, 'update_time' => time()]);
if($stop == 0) {
$msg = "开启收集成功!";
}
if($stop == 1) {
$msg = "停止收集成功!";
}
$this->success($msg,'');
}
}
/**
* 修改订单导出状态
* @adminMenu(
* 'name' => '修改订单导出状态',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 5,
* 'icon' => '',
* 'remark' => '修改订单导出状态',
* 'param' => ''
* )
*/
public function is_excel()
{
$param = $this->request->param();
$msg = '';
if (isset($param['ids']) && isset($param["is_excel"])) {
$is_excel = $param["is_excel"];
$ids = $this->request->param('ids/a');
$this->order_model->where(['id' => ['in', $ids]])->update(['is_excel' => $is_excel, 'update_time' => time()]);
if($is_excel == 0) {
$msg = "改为未导出成功!";
}
if($is_excel == 1) {
$msg = "改为已导出成功!";
}
$this->success($msg, '');
}
if (isset($param['id']) && isset($param["is_excel"])) {
$is_excel = $param["is_excel"];
$id = $this->request->param('id');
$this->order_model->where(['id' => $id])->update(['is_excel' => $is_excel, 'update_time' => time()]);
if($is_excel == 0) {
$msg = "改为未导出成功!";
}
if($is_excel == 1) {
$msg = "改为已导出成功!";
}
$this->success($msg,'');
}
}
/**
* 删除订单
* @adminMenu(
* 'name' => '删除订单',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 6,
* 'icon' => '',
* 'remark' => '删除订单',
* 'param' => ''
* )
*/
public function delete() {
$id = $this->request->param('id',0,'intval');
$ids = $this->request->param('ids/a');
if(isset($id)) {
$result = $this->order_model->where(['id'=>$id])->update(['delete_time'=>time()]);
}
if(isset($ids)) {
$result = $this->order_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time()]);
}
if(!$result) {
$this->error('删除失败');
}
$this->success('删除成功');
}
}
\ No newline at end of file
... ...
... ... @@ -185,7 +185,7 @@ class MemberSalesController extends HomeBaseController
// Cache::set('short_url',$short_url);
$this->assign('default',$default);
$this->assign('goodsList',json_encode($goodsList));
$this->assign('myOrderUrl',url('portal/MemberSales/deal',['id'=>$id]));
$this->assign('myOrderUrl',url('portal/MemberSales/deal',['id'=>$id,'ver'=>1.05]));
$this->assign('typeInfo',$typeInfo);
return $this->fetch();
}
... ... @@ -218,21 +218,25 @@ class MemberSalesController extends HomeBaseController
if(!$typeInfo) {
$this->error('电子订单类型错误');
}
$mobile = '';
$mobile = $parent_name = '';
$typeInfo['options'] = json_decode($typeInfo['options'],true);
foreach ($typeInfo['options'] as $k=>$v) {
if($v['id'] == 49) {
$mobile = $data[$k];
}
if($v['id'] == 46) {
$parent_name = $data[$k];
}
$typeInfo['options'][$k]['user_choose'] = $data[$k];
}
$order_insert = [
'user_id' => cmf_get_current_user_sale_id(),
'sort_id' => $typeInfo['id'],
'options' => json_encode($typeInfo['options']),
'order_sn' => cmf_get_order_sn(),
'order_sn' => cmf_get_order_sn().rand(0000,9999),
'number' => Session::get('user_sale.number'),
'over_time' => time() + 60*60*24*2
'over_time' => time() + 60*60*24*2,
'parent_name' => $parent_name
];
$validate = $this->validate($order_insert, 'admin/'.$this->order_table,'.add');
if ($validate !== true) {
... ... @@ -248,6 +252,7 @@ class MemberSalesController extends HomeBaseController
'delete_time' => 0
];
$text = '订单确认码:'.Session::get('user_sale.number').'.点击 http://suo.im/51dOVK 或关注【天津宛林】完成支付.详询4001107575.';
$text = '订单确认码:'.Session::get('user_sale.number').'.点击 http://nxw.so/5Nryg 或关注【天津宛林】完成支付.详询4001107575.';
$this->sendSMSS($mobile,$text);
$numberList = $this->order_model->where($order_where)->column('number');
Cache::set('number',$numberList);
... ... @@ -261,6 +266,8 @@ class MemberSalesController extends HomeBaseController
if(!$id) {
$this->redirect(url('portal/MemberSales/order_type'));
}
ini_set("max_execution_time", "120");
ini_set('memory_limit', '1024M');
$user_id = cmf_get_current_user_sale_id();
$order_where1 = [
'user_id' => $user_id,
... ... @@ -275,11 +282,14 @@ class MemberSalesController extends HomeBaseController
'is_stop' => 0,
'delete_time' => 0
];
$order_view_model = new OrderViewModel();
$orderList = $order_view_model
->where(function ($q) use ($order_where1) {$q->where($order_where1);})
->whereOr(function ($q) use ($order_where2) {$q->where($order_where2);})
->select()->toArray();
foreach ($orderList as $k=>$v) {
$mobile = '';
$v['options'] = json_decode($v['options'],true);
... ... @@ -291,7 +301,7 @@ class MemberSalesController extends HomeBaseController
$orderList[$k]['mobile'] = $mobile;
}
$this->assign('sort_id',$id);
$this->assign('orderUrl',url('portal/MemberSales/write',['id'=>$id]));
$this->assign('orderUrl',url('portal/MemberSales/write',['id'=>$id,'ver'=>1.05]));
$this->assign('orderList',$orderList);
return $this->fetch();
}
... ... @@ -371,6 +381,7 @@ class MemberSalesController extends HomeBaseController
$orderInfo['groupD'][] = $v;
}
}
$this->assign('sort_id',$id);
$this->assign('order_id',$order_id);
$this->assign('orderInfo',$orderInfo);
return $this->fetch();
... ... @@ -379,6 +390,7 @@ class MemberSalesController extends HomeBaseController
// 修改订单
public function edit() {
$id = $this->request->param('id',0,'intval');
$is_detail = $this->request->param('is_detail',0,'intval');
if(!$id) {
$this->redirect(url('portal/MemberSales/order_type'));
}
... ... @@ -428,8 +440,10 @@ class MemberSalesController extends HomeBaseController
}
}
$this->assign('goodsList',json_encode($goodsList));
$this->assign('sort_id',$id);
$this->assign('is_detail',$is_detail);
$this->assign('order_id',$order_id);
$this->assign('myOrderUrl',url('portal/MemberSales/deal',['id'=>$id]));
$this->assign('myOrderUrl',url('portal/MemberSales/deal',['id'=>$id,'ver'=>1.05]));
$this->assign('orderInfo',$orderInfo);
return $this->fetch();
}
... ... @@ -547,4 +561,4 @@ class MemberSalesController extends HomeBaseController
}
}
}
}
\ No newline at end of file
}
... ...
... ... @@ -182,11 +182,15 @@ class OrderController extends HomeBaseController
if(!$order) {
$this->error('订单不存在',1);
}
$over_time = $order['over_time'];
if($over_time < time()) {
$this->error('您的订单确认码已失效',2);
if($order['status'] == 0) {
$over_time = $order['over_time'];
if($over_time < time()) {
$this->error('您的订单确认码已失效',2);
}
} else {
$this->success('成功',url('portal/Order/pay_result',['order_sn'=>$order['order_sn']]));
}
$this->success('成功',url('order_confirm',['id'=>$order['id']]));
$this->success('成功',url('order_confirm',['id'=>$order['id'],'ver'=>1.02]));
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\user\controller;
use app\admin\model\SlideItemModel;
use app\member\model\MemberModel;
use app\user\model\CodeModel;
use cmf\controller\HomeBaseController;
use think\Db;
use think\Session;
use think\Validate;
use app\user\model\UserModel;
class RegisterController extends HomeBaseController
{
/**
* 前台用户注册
*/
public function index()
{
$url = url('index','','',true);
$qrcode = $this->createQRcode($url,'Q',9);
$name = '用户注册页';
$this->qrcodePage($url,$name,$qrcode);
$channel_id = $this->request->param('channel_id');
$redirect = $this->request->post("redirect");
if (empty($redirect)) {
$redirect = $this->request->server('HTTP_REFERER');
} else {
$redirect = base64_decode($redirect);
}
session('login_http_referer', $redirect);
if (cmf_is_user_login()) {
if(!session('baby_age')) {
return redirect(url('user/Login/chooseAge'));
} else {
return redirect($this->request->root() . '/');
}
} else {
// 渠道参数
$token = $this->request->param('token');
if(!empty($token)) {
$channel = Db::name('Channel')->where(['token'=>$token,'delete_time'=>0])->find();
if(!$channel || $channel['is_stop'] == 1) {
return $this->fetch(":close");
}
Session::set('channel',$channel['id']);
}
// 协议文章内容
$info = Db::name('PortalPost')->field(['id,create_time,post_title,post_excerpt'])->where(['id'=>3,'delete_time'=>0])->find();
$this->assign('info',$info);
// banner图
$slide_model = new SlideItemModel();
$slide_where = [
'slide_id' => 5,
'status' => 1
];
$slide = $slide_model->where($slide_where)->order(['list_order'=>'ASC'])->find();
$this->assign('slide',$slide);
return $this->fetch(":register");
}
}
/**
* 前台用户注册提交
*/
public function doRegister()
{
if ($this->request->isPost()) {
$rules = [
'baby_name' => 'require',
'baby_birth' => 'require',
'parent_name' => 'require',
'parent_status' => 'require',
// 'mobile' => 'require|mobile',
'is_member' => 'require|in:0,1',
'code' => 'require|number|length:6'
// 'password' => 'require|min:6|max:32',
];
// $isOpenRegistration=cmf_is_open_registration();
//
// if ($isOpenRegistration) {
// unset($rules['code']);
// }
$validate = new Validate($rules);
$validate->message([
'baby_name.require' => '宝宝姓名不能为空',
'baby_birth.require' => '宝宝生日不能为空',
'parent_name.require' => '家长姓名不能为空',
'parent_status.require' => '家长身份不能为空',
'mobile.require' => '手机号码不能为空',
// 'mobile.mobile' => '手机号码格式错误',
'is_member.require' => '请选择是否为巧虎会员',
'is_member.in' => '是否为巧虎会员参数错误',
'code.require' => '验证码不能为空',
'code.number' => '验证码必须为数字',
'code.length' => '验证码长度为6位',
// 'password.max' => '密码不能超过32个字符',
// 'password.min' => '密码不能小于6个字符',
// 'captcha.require' => '验证码不能为空',
]);
$data = $this->request->post();
if (!$validate->check($data)) {
$this->error($validate->getError());
}
if(!preg_match('/^1(3|4|5|7|8|9)\d{9}$/',$data['mobile'])) {
$this->error('手机号码错误');
}
// if (!cmf_captcha_check($data['captcha'])) {
// $this->error('验证码错误');
// }
// if(!$isOpenRegistration){
// $errMsg = cmf_check_verification_code($data['username'], $data['code']);
// if (!empty($errMsg)) {
// $this->error($errMsg);
// }
// }
$code_where = [
'mobile' => $data['mobile'],
'code' => $data['code'],
'is_used' => 0
];
$code_check = Db::name('Code')->where($code_where)->find();
if(!$code_check) {
$this->error('手机验证码错误',json_encode($code_where));
}
Db::name('Code')->where($code_where)->update(['is_used' => 1]);
$register = new MemberModel();
// $user['user_pass'] = $data['password'];
// if (Validate::is($data['username'], 'email')) {
// $user['user_email'] = $data['username'];
// $log = $register->registerEmail($user);
// } else
if (preg_match('/^1(3|4|5|7|8|9)\d{9}$/', $data['mobile'])) {
// $user['mobile'] = $data['mobile'];
$log = $register->registerMobile($data);
} else {
$log = 2;
}
$sessionLoginHttpReferer = session('login_http_referer');
$redirect = empty($sessionLoginHttpReferer) ? cmf_get_root() . '/' : $sessionLoginHttpReferer;
switch ($log) {
case 0:
// $this->success('注册成功', $redirect);
$this->success('注册成功', url('user/Login/chooseAge'));
break;
case 1:
$this->error("您的账户已注册过");
break;
case 2:
$this->error("您输入的账号格式错误");
break;
default :
$this->error('未受理的请求');
}
} else {
$this->error("请求错误");
}
}
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\user\controller;
use app\admin\model\SlideItemModel;
use app\member\model\MemberModel;
use app\user\model\CodeModel;
use cmf\controller\HomeBaseController;
use think\Db;
use think\Session;
use think\Validate;
use app\user\model\UserModel;
class RegisterController extends HomeBaseController
{
/**
* 前台用户注册
*/
public function index()
{
$url = url('index','','',true);
$qrcode = $this->createQRcode($url,'Q',9);
$name = '用户注册页';
$this->qrcodePage($url,$name,$qrcode);
$channel_id = $this->request->param('channel_id');
$redirect = $this->request->post("redirect");
if (empty($redirect)) {
$redirect = $this->request->server('HTTP_REFERER');
} else {
$redirect = base64_decode($redirect);
}
session('login_http_referer', $redirect);
if (cmf_is_user_login()) {
if(!session('baby_age')) {
return redirect(url('user/Login/chooseAge'));
} else {
return redirect($this->request->root() . '/');
}
} else {
// 渠道参数
$token = $this->request->param('token');
if(!empty($token)) {
$channel = Db::name('Channel')->where(['token'=>$token,'delete_time'=>0])->find();
if(!$channel || $channel['is_stop'] == 1) {
return $this->fetch(":close");
}
Session::set('channel',$channel['id']);
}
// 协议文章内容
$info = Db::name('PortalPost')->field(['id,create_time,post_title,post_excerpt'])->where(['id'=>3,'delete_time'=>0])->find();
$this->assign('info',$info);
// banner图
$slide_model = new SlideItemModel();
$slide_where = [
'slide_id' => 5,
'status' => 1
];
$slide = $slide_model->where($slide_where)->order(['list_order'=>'ASC'])->find();
$this->assign('slide',$slide);
return $this->fetch(":register");
}
}
/**
* 前台用户注册提交
*/
public function doRegister()
{
if ($this->request->isPost()) {
$rules = [
'baby_name' => 'require',
'baby_birth' => 'require',
'parent_name' => 'require',
'parent_status' => 'require',
// 'mobile' => 'require|mobile',
'is_member' => 'require|in:0,1',
'code' => 'require|number|length:6'
// 'password' => 'require|min:6|max:32',
];
// $isOpenRegistration=cmf_is_open_registration();
//
// if ($isOpenRegistration) {
// unset($rules['code']);
// }
$validate = new Validate($rules);
$validate->message([
'baby_name.require' => '宝宝姓名不能为空',
'baby_birth.require' => '宝宝生日不能为空',
'parent_name.require' => '家长姓名不能为空',
'parent_status.require' => '家长身份不能为空',
'mobile.require' => '手机号码不能为空',
// 'mobile.mobile' => '手机号码格式错误',
'is_member.require' => '请选择是否为巧虎会员',
'is_member.in' => '是否为巧虎会员参数错误',
'code.require' => '验证码不能为空',
'code.number' => '验证码必须为数字',
'code.length' => '验证码长度为6位',
// 'password.max' => '密码不能超过32个字符',
// 'password.min' => '密码不能小于6个字符',
// 'captcha.require' => '验证码不能为空',
]);
$data = $this->request->post();
if (!$validate->check($data)) {
$this->error($validate->getError());
}
if(!preg_match('/^1(3|4|5|6|7|8|9)\d{9}$/',$data['mobile'])) {
$this->error('手机号码错误');
}
// if (!cmf_captcha_check($data['captcha'])) {
// $this->error('验证码错误');
// }
// if(!$isOpenRegistration){
// $errMsg = cmf_check_verification_code($data['username'], $data['code']);
// if (!empty($errMsg)) {
// $this->error($errMsg);
// }
// }
$code_where = [
'mobile' => $data['mobile'],
'code' => $data['code'],
'is_used' => 0
];
$code_check = Db::name('Code')->where($code_where)->find();
if(!$code_check) {
$this->error('手机验证码错误',json_encode($code_where));
}
Db::name('Code')->where($code_where)->update(['is_used' => 1]);
$register = new MemberModel();
// $user['user_pass'] = $data['password'];
// if (Validate::is($data['username'], 'email')) {
// $user['user_email'] = $data['username'];
// $log = $register->registerEmail($user);
// } else
if (preg_match('/^1(3|4|5|6|7|8|9)\d{9}$/', $data['mobile'])) {
// $user['mobile'] = $data['mobile'];
$log = $register->registerMobile($data);
} else {
$log = 2;
}
$sessionLoginHttpReferer = session('login_http_referer');
$redirect = empty($sessionLoginHttpReferer) ? cmf_get_root() . '/' : $sessionLoginHttpReferer;
switch ($log) {
case 0:
// $this->success('注册成功', $redirect);
$this->success('注册成功', url('user/Login/chooseAge'));
break;
case 1:
$this->error("您的账户已注册过");
break;
case 2:
$this->error("您输入的账号格式错误");
break;
default :
$this->error('未受理的请求');
}
} else {
$this->error("请求错误");
}
}
}
\ No newline at end of file
... ...
<?php
/**
* 配置文件
*/
return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => 'rm-m5eblhc9o3515i25neo.mysql.rds.aliyuncs.com',
// 数据库名
'database' => 'qiaohu',
// 用户名
'username' => 'db136s1ehvo1yn73',
// 密码
'password' => 'cxz307311SJK',
// 端口
'hostport' => '3306',
// 数据库编码默认采用utf8
'charset' => 'utf8mb4',
// 数据库表前缀
'prefix' => 'qiaohu_',
"authcode" => 'y7WYUwISQg7YIkjFGp',
//#COOKIE_PREFIX#
];
<?php
/**
* 配置文件
*/
return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => 'rm-m5eblhc9o3515i25n.mysql.rds.aliyuncs.com',
// 数据库名
'database' => 'qiaohu',
// 用户名
'username' => 'db136s1ehvo1yn73',
// 密码
'password' => 'cxz307311SJK',
// 端口
'hostport' => '3306',
// 数据库编码默认采用utf8
'charset' => 'utf8mb4',
// 数据库表前缀
'prefix' => 'qiaohu_',
"authcode" => 'y7WYUwISQg7YIkjFGp',
//#COOKIE_PREFIX#
];
... ...
... ... @@ -59,6 +59,7 @@ return array (
'ADMIN_NAVMENU_EDITPOST' => '编辑导航菜单提交保存',
'ADMIN_NAVMENU_INDEX' => '导航菜单',
'ADMIN_NAVMENU_LISTORDER' => '导航菜单排序',
'ADMIN_ORDER_DELETE' => '删除订单',
'ADMIN_ORDER_EDIT' => '编辑订单',
'ADMIN_ORDER_EXCEL' => '用户数据导出',
'ADMIN_ORDER_INDEX' => '电子订单列表',
... ...
User-agent: *
Disallow:
<include file="public@header"/>
<style>
.form-control {
margin: 5px 0;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">订单列表</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Order/index')}">
订单类型:
<select class="form-control" name="sort_id" style="width: 140px;">
<option value="0">请选择</option>
<volist name="sortList" id="vo">
<option value="{$vo.id}" <eq name="sort_id" value="$vo['id']">selected</eq>>{$vo.name}</option>
</volist>
</select>&nbsp; &nbsp;
订单状态:
<select class="form-control" name="status" style="width: 140px;">
<option value="-1">请选择</option>
<option value="0" <eq name="status" value="0">selected</eq>>未支付</option>
<option value="1" <eq name="status" value="1">selected</eq>>已支付</option>
</select>&nbsp; &nbsp;
是否失效:
<select class="form-control" name="is_over" style="width: 140px;">
<option value="-1">请选择</option>
<option value="0" <eq name="is_over" value="0">selected</eq>>否</option>
<option value="1" <eq name="is_over" value="1">selected</eq>>是</option>
</select>&nbsp; &nbsp;
支付类型:
<select class="form-control" name="pay_type" style="width: 140px;">
<option value="0">请选择</option>
<option value="1" <eq name="pay_type" value="1">selected</eq>>微信</option>
<option value="2" <eq name="pay_type" value="2">selected</eq>>支付宝</option>
</select>&nbsp; &nbsp;
导出状态:
<select class="form-control" name="is_excel" style="width: 140px;">
<option value="-1">请选择</option>
<option value="0" <eq name="is_excel" value="0">selected</eq>>未导出</option>
<option value="1" <eq name="is_excel" value="1">selected</eq>>已导出</option>
</select>&nbsp; &nbsp;
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入关键字...">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Order/index')}">清空</a>
<input type="button" class="btn btn-primary" id="excel" value="导出"/>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('Order/delete')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<notempty name="category">
<th width="50">{:lang('SORT')}</th>
</notempty>
<th width="50">ID</th>
<th>订单号</th>
<th>订单类型</th>
<th>销售用户名</th>
<th>订单确认码</th>
<th>订单价格</th>
<th>订单状态</th>
<th>支付方式</th>
<th>收集状态</th>
<th>导出状态</th>
<th width="130">发布时间</th>
<th>失效时间</th>
<th width="140">操作</th>
</tr>
</thead>
<foreach name="list" item="vo">
<tr>
<td>
<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$vo.id}" title="ID:{$vo.id}">
</td>
<td><b>{$vo.id}</b></td>
<td>{$vo.order_sn}</td>
<td>{$vo.sort_name}</td>
<td>{$vo.user_login}</td>
<td>{$vo.number}</td>
<td>{$vo.order_price}</td>
<td><eq name="vo.status" value="0">未支付</eq><eq name="vo.status" value="1">已支付</eq></td>
<td><eq name="vo.pay_type" value="1">微信</eq><eq name="vo.pay_type" value="2">支付宝</eq></td>
<td><eq name="vo.is_stop" value="0">收集中</eq><eq name="vo.is_stop" value="1">已停止</eq></td>
<td><eq name="vo.is_excel" value="0">未导出</eq><eq name="vo.is_excel" value="1">已导出</eq></td>
<td>{:date('Y-m-d H:i',$vo.create_time)}</td>
<td>{:date('Y-m-d H:i',$vo.over_time)}</td>
<td>
<a href="{:url('Order/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
<eq name="vo.is_stop" value="0">
<a href="{:url('Order/stop',array('id'=>$vo['id'],'is_stop'=>1))}" class="js-ajax-dialog-btn" data-msg="确定停止收集吗?">停止</a>
</eq>
<eq name="vo.is_stop" value="1">
<a href="{:url('Order/stop',array('id'=>$vo['id'],'is_stop'=>0))}" class="js-ajax-dialog-btn" data-msg="确定开启收集吗?">收集</a>
</eq>
<a href="{:url('Order/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
</td>
</tr>
</foreach>
<tfoot>
<tr>
<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x"
data-checklist="js-check-x"></label></th>
<th width="50">ID</th>
<th>订单号</th>
<th>订单类型</th>
<th>销售用户名</th>
<th>订单确认码</th>
<th>订单价格</th>
<th>订单状态</th>
<th>支付方式</th>
<th>收集状态</th>
<th>导出状态</th>
<th width="130">发布时间</th>
<th>失效时间</th>
<th width="90">操作</th>
</tr>
</tfoot>
</table>
<div class="table-actions">
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('Order/delete')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
$('#excel').click(function () {
var url1 = "{:url('Order/excel')}";
var url2 = url1.split('.',5);
var sort_id = $('select[name=sort_id]').val();
var status = $('select[name=status]').val();
var pay_type = $('select[name=pay_type]').val();
var is_over = $('select[name=is_over]').val();
var is_excel = $('select[name=is_excel]').val();
var keyword = $('input[name=keyword]').val();
var start_time = $('input[name=start_time]').val();
var end_time = $('input[name=end_time]').val();
var param = '/excel/1';
var ids = [];
$('.js-check').each(function(index,element) {
if($(this).prop('checked') == true) {
ids.push($(this).val());
}
});
console.log(ids);
if(ids.length>0) {
ids = ids.join(',');
param += '/ids/' + ids;
}
if(sort_id.length > 0) {
param += '/sort_id/'+sort_id;
}
if(status.length > 0) {
param += '/status/'+status;
}
if(pay_type.length > 0) {
param += '/pay_type/'+pay_type;
}
if(is_over.length > 0) {
param += '/is_over/'+is_over;
}
if(is_excel.length > 0) {
param += '/is_excel/'+is_excel;
}
if(keyword.length > 0) {
param += '/keyword/'+keyword;
}
if(start_time.length > 0) {
param += '/start_time/'+start_time;
}
if(end_time.length > 0) {
param += '/end_time/'+end_time;
}
var url = url2[0]+param+'.html';
window.open(url);
});
function reloadPage(win) {
win.location.reload();
}
</script>
</body>
<include file="public@header"/>
<style>
.form-control {
margin: 5px 0;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">订单列表</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Order/index')}">
订单类型:
<select class="form-control" name="sort_id" style="width: 140px;">
<option value="0">请选择</option>
<volist name="sortList" id="vo">
<option value="{$vo.id}" <eq name="sort_id" value="$vo['id']">selected</eq>>{$vo.name}</option>
</volist>
</select>&nbsp; &nbsp;
订单状态:
<select class="form-control" name="status" style="width: 140px;">
<option value="-1">请选择</option>
<option value="0" <eq name="status" value="0">selected</eq>>未支付</option>
<option value="1" <eq name="status" value="1">selected</eq>>已支付</option>
</select>&nbsp; &nbsp;
是否失效:
<select class="form-control" name="is_over" style="width: 140px;">
<option value="-1">请选择</option>
<option value="0" <eq name="is_over" value="0">selected</eq>>否</option>
<option value="1" <eq name="is_over" value="1">selected</eq>>是</option>
</select>&nbsp; &nbsp;
支付类型:
<select class="form-control" name="pay_type" style="width: 140px;">
<option value="0">请选择</option>
<option value="1" <eq name="pay_type" value="1">selected</eq>>微信</option>
<option value="2" <eq name="pay_type" value="2">selected</eq>>支付宝</option>
</select>&nbsp; &nbsp;
导出状态:
<select class="form-control" name="is_excel" style="width: 140px;">
<option value="-1">请选择</option>
<option value="0" <eq name="is_excel" value="0">selected</eq>>未导出</option>
<option value="1" <eq name="is_excel" value="1">selected</eq>>已导出</option>
</select>&nbsp; &nbsp;
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
家长姓名:
<input type="text" class="form-control" name="parent_name" style="width: 200px;"
value="{$parent_name|default=''}" placeholder="请输入家长姓名...">
移动电话:
<input type="text" class="form-control" name="mobile" style="width: 200px;"
value="{$mobile|default=''}" placeholder="请输入移动电话...">
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入关键字...">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Order/index')}">清空</a>
<input type="button" class="btn btn-primary" id="excel" value="导出"/>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('Order/delete')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<notempty name="category">
<th width="50">{:lang('SORT')}</th>
</notempty>
<th width="50">ID</th>
<th>订单号</th>
<th>订单类型</th>
<th>销售用户名</th>
<th>订单确认码</th>
<th>订单价格</th>
<th>订单状态</th>
<th>支付方式</th>
<th>支付时间</th>
<th>家长姓名</th>
<th>移动电话</th>
<th>收集状态</th>
<th>导出状态</th>
<th width="130">发布时间</th>
<th>失效时间</th>
<th width="140">操作</th>
</tr>
</thead>
<foreach name="list" item="vo">
<tr>
<td>
<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$vo.id}" title="ID:{$vo.id}">
</td>
<td><b>{$vo.id}</b></td>
<td>{$vo.order_sn}</td>
<td>{$vo.sort_name}</td>
<td>{$vo.user_login}</td>
<td>{$vo.number}</td>
<td>{$vo.order_price}</td>
<td><eq name="vo.status" value="0">未支付</eq><eq name="vo.status" value="1">已支付</eq></td>
<td><eq name="vo.pay_type" value="1">微信</eq><eq name="vo.pay_type" value="2">支付宝</eq></td>
<td><eq name="vo.status" value="0">未支付</eq><eq name="vo.status" value="1">{:date('Y-m-d H:i:s',$vo['pay_time'])}</eq></td>
<td>{$vo.parent_name}</td>
<td>{$vo.mobile}</td>
<td><eq name="vo.is_stop" value="0">收集中</eq><eq name="vo.is_stop" value="1">已停止</eq></td>
<td><eq name="vo.is_excel" value="0">未导出</eq><eq name="vo.is_excel" value="1">已导出</eq></td>
<td>{:date('Y-m-d H:i',$vo.create_time)}</td>
<td>{:date('Y-m-d H:i',$vo.over_time)}</td>
<td>
<a href="{:url('Order/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
<eq name="vo.is_stop" value="0">
<a href="{:url('Order/stop',array('id'=>$vo['id'],'is_stop'=>1))}" class="js-ajax-dialog-btn" data-msg="确定停止收集吗?">停止</a>
</eq>
<eq name="vo.is_excel" value="0">
<a href="{:url('Order/is_excel',array('id'=>$vo['id'],'is_excel'=>1))}" class="js-ajax-dialog-btn" data-msg="确定改为已导出吗?">改为已导出</a>
</eq>
<eq name="vo.is_excel" value="1">
<a href="{:url('Order/is_excel',array('id'=>$vo['id'],'is_excel'=>0))}" class="js-ajax-dialog-btn" data-msg="确定改为未导出吗?">改为未导出</a>
</eq>
<a href="{:url('Order/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
</td>
</tr>
</foreach>
<tfoot>
<tr>
<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x"
data-checklist="js-check-x"></label></th>
<th width="50">ID</th>
<th>订单号</th>
<th>订单类型</th>
<th>销售用户名</th>
<th>订单确认码</th>
<th>订单价格</th>
<th>订单状态</th>
<th>支付方式</th>
<th>支付时间</th>
<th>家长姓名</th>
<th>移动电话</th>
<th>收集状态</th>
<th>导出状态</th>
<th width="130">发布时间</th>
<th>失效时间</th>
<th width="90">操作</th>
</tr>
</tfoot>
</table>
<div class="table-actions">
<button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
data-action="{:url('Order/delete')}" data-subcheck="true" data-msg="您确定删除吗?">
{:lang('DELETE')}
</button>
</div>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
$('#excel').click(function () {
var url1 = "{:url('Order/excel')}";
var url2 = url1.split('.',5);
var sort_id = $('select[name=sort_id]').val();
var status = $('select[name=status]').val();
var pay_type = $('select[name=pay_type]').val();
var is_over = $('select[name=is_over]').val();
var is_excel = $('select[name=is_excel]').val();
var keyword = $('input[name=keyword]').val();
var start_time = $('input[name=start_time]').val();
var end_time = $('input[name=end_time]').val();
var param = '/excel/1';
var ids = [];
$('.js-check').each(function(index,element) {
if($(this).prop('checked') == true) {
ids.push($(this).val());
}
});
console.log(ids);
if(ids.length>0) {
ids = ids.join(',');
param += '/ids/' + ids;
}
if(sort_id.length > 0) {
param += '/sort_id/'+sort_id;
}
if(status.length > 0) {
param += '/status/'+status;
}
if(pay_type.length > 0) {
param += '/pay_type/'+pay_type;
}
if(is_over.length > 0) {
param += '/is_over/'+is_over;
}
if(is_excel.length > 0) {
param += '/is_excel/'+is_excel;
}
if(keyword.length > 0) {
param += '/keyword/'+keyword;
}
if(start_time.length > 0) {
param += '/start_time/'+start_time;
}
if(end_time.length > 0) {
param += '/end_time/'+end_time;
}
var url = url2[0]+param+'.html';
window.open(url);
});
function reloadPage(win) {
win.location.reload();
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<include file="public@head_common"/>
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/weui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/myweui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/write/deal_list.css" />
<title>已提交订单</title>
<style type="text/css">
</style>
</head>
<body>
<div class="content_height">
<div class="header">
<div class="return">
<span class="back_href">
<i class="iconfont icon-jiantou-copy"></i>返回
</span>
</div>
已提交订单
</div>
<div class="test_num"></div>
<div class="header_place"></div>
<div class="tab_tit">
<p class="tab_item write_order">填写电子订单</p>
<p class="tab_item active">查看已提交订单</p>
</div>
<div class="choose_time">
<i class="iconfont icon-rili"></i>选择提交时间
</div>
<div class="deal_list">
<volist name="orderList" id="vo">
<div class="list_style" data-href="{:url('detail',['id'=>$sort_id,'order_id'=>$vo['id']])}">
<div class="style_one">
<p class="style_text">
订单类型:<span class="font_weight">{$vo.sort_name}</span>
</p>
<eq name="vo.status" value="0">
<p class="order_state">未支付</p>
</eq>
<eq name="vo.status" value="1">
<p class="no_pay">已支付</p>
</eq>
</div>
<p class="order_num">订单编号:{$vo.order_sn}</p>
<p class="order_data" id="change_time">提交时间:{:date('Y-m-d',$vo['create_time'])}</p>
<p class="order_data">订单确认码:{$vo.number}</p>
<p class="order_data">联系电话:{$vo.mobile}</p>
<eq name="vo.status" value="0">
<div class="change_btn" data-href="{:url('edit',['id'=>$sort_id,'order_id'=>$vo['id']])}">修改</div>
</eq>
</div>
</volist>
</div>
</div>
<div class="bottom_icon">
<img src="__TMPL__/public/mobile/images/biglogo@2x.png" class="bottom_img" />
<p class="bottom_text">{$site_info.site_name}</p>
</div>
<script src="__TMPL__/public/mobile/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/weui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/myweui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/swiper-4.3.5.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$('.choose_time').click(function(){
weui.datePicker({
start: 2000,
end: 2030,
defaultValue: [2015, 6, 9],
onChange: function(result) {
console.log(result);
},
onConfirm: function(result) {
var birthday = result[0].label + result[1].label + result[2].label;
$('.choose_time').html(`<i class="iconfont icon-rili"></i>${birthday}`);
var date = result[0].value + '-' + result[1].value + '-' + result[2].value;
var data = {
date: date,
sort_id: "{$sort_id}"
};
list(data);
},
id: 'datePicker'
});
});
$('body').on('click','.weui-picker__action',function() {
if($(this).data('action') == 'cancel') {
$('.choose_time').html(`<i class="iconfont icon-rili"></i>选择提交时间`);
list({
date: '',
sort_id: "{$sort_id}"
});
}
});
$('.deal_list').on('click','.change_btn',function(event){
event.stopPropagation();
location.href = $(this).data('href');
});
$('.deal_list').on('click','.list_style',function(){
event.stopPropagation();
location.href = $(this).data('href');
});
$('.tab_tit').on('click','.write_order',function(){
location.href = "{$orderUrl}";
});
// ajax数据渲染
function list(data) {
$.ajax({
url: "{:url('choosetime_detail')}",
type: "POST",
data: data,
dataType: "JSON",
success: function (res) {
console.log(res);
if (res.code == 1) {
if(res.data.length == 0) {
$('.deal_list').html('');
} else {
html = '';
$(res.data).each(function(index,element){
var status = `<p class="order_state">未支付</p>`;
var change = `<div class="change_btn" data-href="${element.edit_url}">修改</div>`;
if(element.status == 1) {
status = `<p class="no_pay">已支付</p>`;
change = '';
}
html += `<div class="list_style" data-href="${element.detail_url}">
<div class="style_one">
<p class="style_text">
订单类型:<span class="font_weight">${element.sort_name}</span>
</p>
${status}
</div>
<p class="order_num">订单编号:${element.order_sn}</p>
<p class="order_data" id="change_time">提交时间:${element.create_time}</p>
<p class="order_data">订单确认码:${element.number}</p>
<p class="order_data">联系电话:${element.mobile}</p>
${change}
</div>`;
});
$('.deal_list').html(html);
}
} else {
_error(res.msg);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
}
});
}
// 弹窗提示
var popup_switch = true;
function _error(test) {
if(popup_switch) {
popup_switch = false;
$('.test_num').html(test);
$('.test_num').removeClass('Augly-fadeout');
$('.test_num').addClass('Augly-fadein');
$('.test_num').show();
setTimeout(function() {
$('.test_num').removeClass('Augly-fadein');
$('.test_num').addClass('Augly-fadeout');
popup_switch = true
}, 1500)
} else {
popup_switch = true
}
}
//固定公司底部的名字
// var h=$(".deal_list").height();
// if(h>445){
// $(".footstyle").addClass("bottom_icon");
// $(".footstyle").removeClass("foot_icon");
//
// }else if(h<=445){
// $(".footstyle").addClass("foot_icon");
// $(".footstyle").removeClass("bottom_icon");
// }
// alert($(".deal_list").height())
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<include file="public@head_common"/>
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/weui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/myweui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/write/deal_list.css" />
<title>已提交订单</title>
<style type="text/css">
</style>
</head>
<body>
<div class="content_height">
<div class="header">
<div class="return">
<span class="back_href">
<i class="iconfont icon-jiantou-copy"></i>返回
</span>
</div>
已提交订单
</div>
<div class="test_num"></div>
<div class="header_place"></div>
<div class="tab_tit">
<p class="tab_item write_order">填写电子订单</p>
<p class="tab_item active">查看已提交订单</p>
</div>
<div class="choose_time">
<i class="iconfont icon-rili"></i>选择提交时间
</div>
<div class="deal_list">
<volist name="orderList" id="vo">
<div class="list_style" data-href="{:url('detail',['id'=>$sort_id,'order_id'=>$vo['id'],'ver'=>1.05])}">
<div class="style_one">
<p class="style_text">
订单类型:<span class="font_weight">{$vo.sort_name}</span>
</p>
<eq name="vo.status" value="0">
<p class="order_state">未支付</p>
</eq>
<eq name="vo.status" value="1">
<p class="no_pay">已支付</p>
</eq>
</div>
<p class="order_num">订单编号:{$vo.order_sn}</p>
<p class="order_data" id="change_time">提交时间:{:date('Y-m-d',$vo['create_time'])}</p>
<p class="order_data">订单确认码:{$vo.number}</p>
<p class="order_data">联系电话:{$vo.mobile}</p>
<eq name="vo.status" value="0">
<div class="change_btn" data-href="{:url('edit',['id'=>$sort_id,'order_id'=>$vo['id'],'ver'=>1.05])}">修改</div>
</eq>
</div>
</volist>
</div>
</div>
<div class="bottom_icon">
<img src="__TMPL__/public/mobile/images/biglogo@2x.png" class="bottom_img" />
<p class="bottom_text">{$site_info.site_name}</p>
</div>
<script src="__TMPL__/public/mobile/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/weui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/myweui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/swiper-4.3.5.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$('.choose_time').click(function(){
weui.datePicker({
start: 2000,
end: 2030,
defaultValue: [2015, 6, 9],
onChange: function(result) {
console.log(result);
},
onConfirm: function(result) {
var birthday = result[0].label + result[1].label + result[2].label;
$('.choose_time').html(`<i class="iconfont icon-rili"></i>${birthday}`);
var date = result[0].value + '-' + result[1].value + '-' + result[2].value;
var data = {
date: date,
sort_id: "{$sort_id}"
};
list(data);
},
id: 'datePicker'
});
});
$('body').on('click','.weui-picker__action',function() {
if($(this).data('action') == 'cancel') {
$('.choose_time').html(`<i class="iconfont icon-rili"></i>选择提交时间`);
list({
date: '',
sort_id: "{$sort_id}"
});
}
});
$('.deal_list').on('click','.change_btn',function(event){
event.stopPropagation();
location.href = $(this).data('href');
});
$('.deal_list').on('click','.list_style',function(){
event.stopPropagation();
location.href = $(this).data('href');
});
$('.tab_tit').on('click','.write_order',function(){
location.href = "{$orderUrl}";
});
// ajax数据渲染
function list(data) {
$.ajax({
url: "{:url('choosetime_detail')}",
type: "POST",
data: data,
dataType: "JSON",
success: function (res) {
console.log(res);
if (res.code == 1) {
if(res.data.length == 0) {
$('.deal_list').html('');
} else {
html = '';
$(res.data).each(function(index,element){
var status = `<p class="order_state">未支付</p>`;
var change = `<div class="change_btn" data-href="${element.edit_url}">修改</div>`;
if(element.status == 1) {
status = `<p class="no_pay">已支付</p>`;
change = '';
}
html += `<div class="list_style" data-href="${element.detail_url}">
<div class="style_one">
<p class="style_text">
订单类型:<span class="font_weight">${element.sort_name}</span>
</p>
${status}
</div>
<p class="order_num">订单编号:${element.order_sn}</p>
<p class="order_data" id="change_time">提交时间:${element.create_time}</p>
<p class="order_data">订单确认码:${element.number}</p>
<p class="order_data">联系电话:${element.mobile}</p>
${change}
</div>`;
});
$('.deal_list').html(html);
}
} else {
_error(res.msg);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
}
});
}
// 弹窗提示
var popup_switch = true;
function _error(test) {
if(popup_switch) {
popup_switch = false;
$('.test_num').html(test);
$('.test_num').removeClass('Augly-fadeout');
$('.test_num').addClass('Augly-fadein');
$('.test_num').show();
setTimeout(function() {
$('.test_num').removeClass('Augly-fadein');
$('.test_num').addClass('Augly-fadeout');
popup_switch = true
}, 1500)
} else {
popup_switch = true
}
}
//固定公司底部的名字
// var h=$(".deal_list").height();
// if(h>445){
// $(".footstyle").addClass("bottom_icon");
// $(".footstyle").removeClass("foot_icon");
//
// }else if(h<=445){
// $(".footstyle").addClass("foot_icon");
// $(".footstyle").removeClass("bottom_icon");
// }
// alert($(".deal_list").height())
</script>
</body>
</html>
... ...
... ... @@ -127,7 +127,7 @@
$('.mask').hide()
})
$('.btn').click(function(){
$('.mask').show()
location.href = "{:url('edit',['id'=>$sort_id,'order_id'=>$order_id,'is_detail'=>1,'ver'=>1.02])}";
})
</script>
</body>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<include file="public@head_common"/>
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/weui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/myweui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/write/write.css" />
<title>填写电子订单</title>
<style type="text/css">
</style>
</head>
<body>
<div class="content_height">
<div class="header">
<div class="return">
<span class="back_href">
<i class="iconfont icon-jiantou-copy"></i>返回
</span>
</div>
填写电子订单
</div>
<div class="test_num"></div>
<div class="header_place"></div>
<div class="tab_tit">
<p class="tab_item active">填写电子订单</p>
<p class="tab_item view_orders">查看已提交订单</p>
</div>
<div class="form_data">
<!--第一步-->
<div class="write_one" style="">
<div class="register_item baby_name">
<div class="write_tit">
<p class="tit">订单类型</p>
<p class="detail">{$orderInfo.name}</p>
</div>
<volist name="orderInfo.groupA" id="vo">
{$vo.html}
</volist>
</div>
<notempty name="orderInfo.groupB">
<div class="info_wrap parent_name">
<volist name="orderInfo.groupB" id="vo">
{$vo.html}
</volist>
</div>
</notempty>
<notempty name="orderInfo.groupC">
<div class="first_page next_btn">
下一步
</div>
<else/>
<div class="submit_btn next_btn">
提交
</div>
</notempty>
</div>
<notempty name="orderInfo.groupC">
<div class="write_two" style="display: none;">
<div class="register_item baby_name">
<volist name="orderInfo.groupC" id="vo">
{$vo.html}
</volist>
</div>
<div class="write_two_btn">
<div class="one_page two_btn_item">
上一步
</div>
<notempty name="orderInfo.groupD">
<div class="three_page two_btn_item">
下一步
</div>
<else/>
<div class="submit_btn two_btn_item">
提交
</div>
</notempty>
</div>
</div>
</notempty>
<notempty name="orderInfo.groupD">
<div class="write_three" style="display: none;">
<div class="register_item baby_name">
<volist name="orderInfo.groupD" id="vo">
{$vo.html}
</volist>
</div>
<div class="write_two_btn">
<div class="two_page two_btn_item">
上一步
</div>
<div class="submit_btn two_btn_item">
提交
</div>
</div>
</div>
</notempty>
</div>
</div>
<div class="mask" style="display: none;">
<!--订单修改-->
<div class="order_change" style="display: block;">
<div class="order_change_pic" id="tucengf">
<img src="__TMPL__/public/mobile/images/tucengf.png"/>
</div>
<div class="order_change_pic" style="width: 1.5rem;" id="tucengs">
<img src="__TMPL__/public/mobile/images/tucengs.png"/>
</div>
<div class="change_text change_class">
<img src="__TMPL__/public/mobile/images/closeimg.png" class="change_close" />
<p class="change_text_o">您已提交成功</p>
<p class="change_text_t">订单确认码为</p>
<p class="change_btn">确认</p>
</div>
</div>
</div>
<div class="bottom_icon">
<img src="__TMPL__/public/mobile/images/biglogo@2x.png" class="bottom_img" />
<p class="bottom_text">{$site_info.site_name}</p>
</div>
<script src="__TMPL__/public/mobile/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/weui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/myweui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/citypicker.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/swiper-4.3.5.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var form_data = [];
var write_one = write_two = write_three = [];
var allow_submit = true;
var res = {
data: ''
};
var reg = /^1[0-9]{10}$/;
var is_stop = "{$orderInfo.is_stop}";
if(is_stop == 1) {
$('.change_text_o').html('对不起,当前功能已暂停');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('#tucengf').hide();
$('#tucengs').show();
$('.change_text_t').hide();
$('.mask').show()
}
$('.order_style').click(function() {
$(this).addClass('active').siblings().removeClass('active')
});
$('.person_sex').click(function() {
$(this).addClass('sex_active').siblings().removeClass('sex_active')
});
//第二部选择地址
$('.add_btn').click(function() {
$(this).addClass('add_active').siblings().removeClass('add_active')
});
var dt = new Date();
var df= [dt.getFullYear(), (dt.getMonth() + 1), dt.getDate()];
$('.birthday').on('focus',function(e) {
console.log(e)
var ele = e.currentTarget.id;
console.log(ele)
var obj = $(this);
var this_date = obj.val();
dt = new Date(Date.parse(this_date.replace('年','-').replace('月','-').replace('日','')))
df= [dt.getFullYear(), (dt.getMonth() + 1), dt.getDate()];
console.log(df);
timeInit(obj,df,ele);
});
// 时间组件
function timeInit(obj,df,el) {
weui.datePicker({
start: 2000,
end: 2030,
defaultValue: df,
onChange: function(result) {
console.log(result);
// $('.#birthday_input').val(result)
},
onConfirm: function(result) {
var birthday = result[0].label + result[1].label + result[2].label;
obj.val(birthday)
},
id: el
});
}
$('.address').click(function() {
var obj = $(this);
weui.picker(rawCitiesData, {
onConfirm: function(result) {
obj.val(result[0].label + '-' + result[1].label + '-' + result[2].label);
}
});
});
$('#product').click(function() {
var goodsList = JSON.parse(`{$goodsList}`);
console.log(goodsList);
weui.picker(goodsList, {
onChange: function(result) {
console.log(result);
},
onConfirm: function(result) {
$('#product').val(result[0].label)
console.log(result);
},
id: 'multiPickerBtn'
});
});
//下一步
$('.first_page').click(function() {
if(submit_common('.write_one',write_one)){
$('.write_one').hide()
$('.write_two').show()
};
});
// 上一步
$('.one_page').click(function() {
$('.write_one').show();
$('.write_two').hide()
});
$('.two_page').click(function() {
$('.write_three').hide();
$('.write_two').show()
});
// 下一步
$('.three_page').click(function() {
if(submit_common('.write_two',write_two)) {
$('.write_three').show();
$('.write_two').hide()
}
});
// 关闭成功弹出框
$('.change_close').click(function() {
window.history.go(-1);
$('.mask').hide();
});
$('.change_btn').click(function() {
window.history.go(-1);
$('.mask').hide();
});
// 提交订单
$('.submit_btn').click(function() {
var btn = $(this);
var text = btn.text();
if(submit_common('.form_data',form_data)) {
if(allow_submit) {
console.log(form_data);
allow_submit = false;
var data = {
id: "{$orderInfo.id}",
param: form_data.join(',')
};
$.ajax({
url: "{:url('submit_form_edit')}",
type: "POST",
data: data,
dataType: "JSON",
beforeSend: function(){
btn.text(text+'中...');
},
success: function (res) {
console.log(res);
if (res.code == 1) {
if(res.data == 1) {
$('.change_text_o').html('订单修改成功');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('#tucengf').show();
$('#tucengs').hide();
$('.change_text_t').hide();
}
if(res.data == 2) {
$('.change_text_o').html('抱歉,客户已支付订单');
$('.mask').find('.change_class').addClass('change_text');
$('.mask').find('.change_class').removeClass('change_text_single');
$('#tucengf').hide();
$('#tucengs').show();
$('.change_text_t').html('您无法进行修改');
}
if(res.data == 3) {
$('.change_text_o').html('对不起,当前功能已暂停');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('#tucengf').hide();
$('#tucengs').show();
$('.change_text_t').hide();
}
$('.mask').show()
} else {
_error(res.msg);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
allow_submit = true;
btn.text(text);
}
});
}
}
});
$('.order_long').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.more_gift').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.age').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.people').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.view_orders').click(function(){
location.href = "{$myOrderUrl}";
});
// 验证表单数据通用方法
function submit_common(sort, data) {
var status = true;
$(sort).find('.form_options').each(function(index,element){
var value = '';
if($(this).find('input').length > 0) {
// 判断填写内容是否符合要求
if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
if($(this).data('type') == 3 && $(this).data('validate') == 1) {
if(!reg.test($(this).find('input').val())) {
_error($(this).find('._validate').html()+'格式错误');
status = false;
return false;
}
value = $(this).find('input').val();
} else {
value = $(this).find('input').val();
}
}
}
if($(this).find('textarea').length > 0){
if($(this).find('textarea').val() == '' && $(this).data('validate') == 1) {
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
value = $(this).find('textarea').val();
}
}
if($(this).find('.order_style').length > 0) {
value = $(this).find('.active').html();
}
data.push(value);
});
return status;
}
// 弹窗提示
var popup_switch = true;
function _error(test) {
if(popup_switch) {
popup_switch = false;
$('.test_num').html(test);
$('.test_num').removeClass('Augly-fadeout');
$('.test_num').addClass('Augly-fadein');
$('.test_num').show();
setTimeout(function() {
$('.test_num').removeClass('Augly-fadein');
$('.test_num').addClass('Augly-fadeout');
popup_switch = true
}, 1500)
} else {
popup_switch = true
}
}
// 上传图片
$(".up_wrap").on("change","input[type='file']",function(){
var file = this.files[0];
var parent = $(this).parent().find('.up_pic');
var filePath=$(this).val();
if (this.files && this.files[0]) {
if(filePath.indexOf("jpg")!=-1 || filePath.indexOf("png")!=-1 || filePath.indexOf("jpeg")!=-1 ){
var arr=filePath.split('\\');
var fileName=arr[arr.length-1];
$("#fileName").val(fileName);
var reader = new FileReader();
reader.onload = function(evt){
html = '<img src=" '+ evt.target.result +'" width="100%" height="100%" />'
parent.html(html);
parent.css('height','auto');
}
reader.readAsDataURL(this.files[0]);
var formData = new FormData();
formData.append("file", this.files[0]);
formData.append("filetype", "image");
formData.append("app", 'licence');
var params = {
file: this.files[0],
fileType: "image",
app: 'licence'
}
$.ajax({
url: "{:url('portal/MemberSales/upload')}",
type: "POST",
data: formData,
contentType:false,
processData:false,
dataType:'json',
mimeType:"multipart/form-data",
success:function(res){
if(res.code == '1'){
console.log(res.data)
// toastr.success('上传成功!')
$('#up_wrap').val(res.data[0].filepath)
}
},
error:function(res){
console.log(res)
}
})
}else{
toastr.warning('请按照要求上传图片!')
$(this).val('')
}
}
})
function clearNoNum(obj){
obj.value = obj.value.replace(/[^\d.]/g,""); //清除“数字”和“.”以外的字符
obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的
obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数
if(obj.value.indexOf(".")< 0 && obj.value !=""){
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
obj.value= parseFloat(obj.value);
}
}
</script>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<include file="public@head_common"/>
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/weui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/myweui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/write/write.css" />
<title>填写电子订单</title>
<style type="text/css">
</style>
</head>
<body>
<div class="content_height">
<div class="header">
<div class="return">
<span class="back_href">
<i class="iconfont icon-jiantou-copy"></i>返回
</span>
</div>
填写电子订单
</div>
<div class="test_num"></div>
<div class="header_place"></div>
<div class="tab_tit">
<p class="tab_item active">填写电子订单</p>
<p class="tab_item view_orders">查看已提交订单</p>
</div>
<div class="form_data">
<!--第一步-->
<div class="write_one" style="">
<div class="register_item baby_name">
<div class="write_tit">
<p class="tit">订单类型</p>
<p class="detail">{$orderInfo.name}</p>
</div>
<volist name="orderInfo.groupA" id="vo">
{$vo.html}
</volist>
</div>
<notempty name="orderInfo.groupB">
<div class="info_wrap parent_name">
<volist name="orderInfo.groupB" id="vo">
{$vo.html}
</volist>
</div>
</notempty>
<notempty name="orderInfo.groupC">
<div class="first_page next_btn">
下一步
</div>
<else/>
<div class="submit_btn next_btn">
提交
</div>
</notempty>
</div>
<notempty name="orderInfo.groupC">
<div class="write_two" style="display: none;">
<div class="register_item baby_name">
<volist name="orderInfo.groupC" id="vo">
{$vo.html}
</volist>
</div>
<div class="write_two_btn">
<div class="one_page two_btn_item">
上一步
</div>
<notempty name="orderInfo.groupD">
<div class="three_page two_btn_item">
下一步
</div>
<else/>
<div class="submit_btn two_btn_item">
提交
</div>
</notempty>
</div>
</div>
</notempty>
<notempty name="orderInfo.groupD">
<div class="write_three" style="display: none;">
<div class="register_item baby_name">
<volist name="orderInfo.groupD" id="vo">
{$vo.html}
</volist>
</div>
<div class="write_two_btn">
<div class="two_page two_btn_item">
上一步
</div>
<div class="submit_btn two_btn_item">
提交
</div>
</div>
</div>
</notempty>
</div>
</div>
<div class="mask" style="display: none;">
<!--订单修改-->
<div class="order_change" style="display: block;">
<div class="order_change_pic" id="tucengf">
<img src="__TMPL__/public/mobile/images/tucengf.png"/>
</div>
<div class="order_change_pic" style="width: 1.5rem;" id="tucengs">
<img src="__TMPL__/public/mobile/images/tucengs.png"/>
</div>
<div class="change_text change_class">
<img src="__TMPL__/public/mobile/images/closeimg.png" class="change_close" />
<p class="change_text_o">您已提交成功</p>
<p class="change_text_t">订单确认码为</p>
<p class="change_btn">确认</p>
</div>
</div>
</div>
<div class="bottom_icon">
<img src="__TMPL__/public/mobile/images/biglogo@2x.png" class="bottom_img" />
<p class="bottom_text">{$site_info.site_name}</p>
</div>
<script src="__TMPL__/public/mobile/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/weui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/myweui.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/citypicker.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/swiper-4.3.5.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var form_data = [];
var write_one = write_two = write_three = [];
var allow_submit = true;
var res = {
data: ''
};
var reg = /^1[0-9]{10}$/;
var is_stop = "{$orderInfo.is_stop}";
if(is_stop == 1) {
$('.change_text_o').html('对不起,当前功能已暂停');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('#tucengf').hide();
$('#tucengs').show();
$('.change_text_t').hide();
$('.mask').show()
}
$('.order_style').click(function() {
$(this).addClass('active').siblings().removeClass('active')
});
$('.person_sex').click(function() {
$(this).addClass('sex_active').siblings().removeClass('sex_active')
});
//第二部选择地址
$('.add_btn').click(function() {
$(this).addClass('add_active').siblings().removeClass('add_active')
});
var dt = new Date();
var df= [dt.getFullYear(), (dt.getMonth() + 1), dt.getDate()];
$('.birthday').on('focus',function(e) {
console.log(e)
var ele = e.currentTarget.id;
console.log(ele)
var obj = $(this);
var this_date = obj.val();
dt = new Date(Date.parse(this_date.replace('年','-').replace('月','-').replace('日','')))
df= [dt.getFullYear(), (dt.getMonth() + 1), dt.getDate()];
console.log(df);
timeInit(obj,df,ele);
});
// 时间组件
function timeInit(obj,df,el) {
weui.datePicker({
start: 2000,
end: 2030,
defaultValue: df,
onChange: function(result) {
console.log(result);
// $('.#birthday_input').val(result)
},
onConfirm: function(result) {
var birthday = result[0].label + result[1].label + result[2].label;
obj.val(birthday)
},
id: el
});
}
$('.address').click(function() {
var obj = $(this);
weui.picker(rawCitiesData, {
onConfirm: function(result) {
obj.val(result[0].label + '-' + result[1].label + '-' + result[2].label);
}
});
});
$('#product').click(function() {
var goodsList = JSON.parse(`{$goodsList}`);
console.log(goodsList);
weui.picker(goodsList, {
onChange: function(result) {
console.log(result);
},
onConfirm: function(result) {
$('#product').val(result[0].label)
console.log(result);
},
id: 'multiPickerBtn'
});
});
//下一步
$('.first_page').click(function() {
if(submit_common('.write_one',write_one)){
$('.write_one').hide()
$('.write_two').show()
};
});
// 上一步
$('.one_page').click(function() {
$('.write_one').show();
$('.write_two').hide()
});
$('.two_page').click(function() {
$('.write_three').hide();
$('.write_two').show()
});
// 下一步
$('.three_page').click(function() {
if(submit_common('.write_two',write_two)) {
$('.write_three').show();
$('.write_two').hide()
}
});
// 关闭成功弹出框
$('.change_close').click(function() {
var is_detail = "{$is_detail}";
if(is_detail == 1) {
location.href = "{:url('detail',['id'=>$sort_id,'order_id'=>$order_id,'ver'=>1.05])}";
} else {
window.history.go(-1);
}
$('.mask').hide();
});
$('.change_btn').click(function() {
var is_detail = "{$is_detail}";
if(is_detail == 1) {
location.href = "{:url('detail',['id'=>$sort_id,'order_id'=>$order_id,'ver'=>1.05])}";
} else {
window.history.go(-1);
}
$('.mask').hide();
});
// 提交订单
$('.submit_btn').click(function() {
var btn = $(this);
var text = btn.text();
if(submit_common('.form_data',form_data)) {
if(allow_submit) {
console.log(form_data);
allow_submit = false;
var data = {
id: "{$orderInfo.id}",
param: form_data.join(',')
};
$.ajax({
url: "{:url('submit_form_edit')}",
type: "POST",
data: data,
dataType: "JSON",
beforeSend: function(){
btn.text(text+'中...');
},
success: function (res) {
console.log(res);
if (res.code == 1) {
if(res.data == 1) {
$('.change_text_o').html('订单修改成功');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('#tucengf').show();
$('#tucengs').hide();
$('.change_text_t').hide();
}
if(res.data == 2) {
$('.change_text_o').html('抱歉,客户已支付订单');
$('.mask').find('.change_class').addClass('change_text');
$('.mask').find('.change_class').removeClass('change_text_single');
$('#tucengf').hide();
$('#tucengs').show();
$('.change_text_t').html('您无法进行修改');
}
if(res.data == 3) {
$('.change_text_o').html('对不起,当前功能已暂停');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('#tucengf').hide();
$('#tucengs').show();
$('.change_text_t').hide();
}
$('.mask').show()
} else {
_error(res.msg);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
allow_submit = true;
btn.text(text);
}
});
}
}
});
$('.order_long').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.more_gift').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.age').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.people').click(function() {
$(this).addClass('long_active').siblings().removeClass('long_active')
});
$('.view_orders').click(function(){
location.href = "{$myOrderUrl}";
});
// 验证表单数据通用方法
function submit_common(sort, data) {
var status = true;
$(sort).find('.form_options').each(function(index,element){
var value = '';
if($(this).find('input').length > 0) {
// 判断填写内容是否符合要求
if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
data = form_data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
if($(this).data('type') == 3 && $(this).data('validate') == 1) {
if(!reg.test($(this).find('input').val())) {
data = form_data = [];
_error($(this).find('._validate').html()+'格式错误');
status = false;
return false;
}
value = $(this).find('input').val();
} else {
value = $(this).find('input').val();
}
}
}
if($(this).find('textarea').length > 0){
if($(this).find('textarea').val() == '' && $(this).data('validate') == 1) {
data = form_data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
value = $(this).find('textarea').val();
}
}
if($(this).find('.order_style').length > 0) {
value = $(this).find('.active').html();
}
data.push(value);
});
return status;
}
// 弹窗提示
var popup_switch = true;
function _error(test) {
if(popup_switch) {
popup_switch = false;
$('.test_num').html(test);
$('.test_num').removeClass('Augly-fadeout');
$('.test_num').addClass('Augly-fadein');
$('.test_num').show();
setTimeout(function() {
$('.test_num').removeClass('Augly-fadein');
$('.test_num').addClass('Augly-fadeout');
popup_switch = true
}, 1500)
} else {
popup_switch = true
}
}
// 上传图片
$(".up_wrap").on("change","input[type='file']",function(){
var file = this.files[0];
var parent = $(this).parent().find('.up_pic');
var filePath=$(this).val();
if (this.files && this.files[0]) {
if(filePath.indexOf("jpg")!=-1 || filePath.indexOf("png")!=-1 || filePath.indexOf("jpeg")!=-1 ){
var arr=filePath.split('\\');
var fileName=arr[arr.length-1];
$("#fileName").val(fileName);
var reader = new FileReader();
reader.onload = function(evt){
html = '<img src=" '+ evt.target.result +'" width="100%" height="100%" />'
parent.html(html);
parent.css('height','auto');
}
reader.readAsDataURL(this.files[0]);
var formData = new FormData();
formData.append("file", this.files[0]);
formData.append("filetype", "image");
formData.append("app", 'licence');
var params = {
file: this.files[0],
fileType: "image",
app: 'licence'
}
$.ajax({
url: "{:url('portal/MemberSales/upload')}",
type: "POST",
data: formData,
contentType:false,
processData:false,
dataType:'json',
mimeType:"multipart/form-data",
success:function(res){
if(res.code == '1'){
console.log(res.data)
// toastr.success('上传成功!')
$('#up_wrap').val(res.data[0].filepath)
}
},
error:function(res){
console.log(res)
}
})
}else{
toastr.warning('请按照要求上传图片!')
$(this).val('')
}
}
})
function clearNoNum(obj){
obj.value = obj.value.replace(/[^\d.]/g,""); //清除“数字”和“.”以外的字符
obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的
obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数
if(obj.value.indexOf(".")< 0 && obj.value !=""){
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
obj.value= parseFloat(obj.value);
}
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<include file="public@head_common"/>
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/weui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/myweui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/pay/order_style.css" />
<title>选择订单类型</title>
<style type="text/css">
.content_height {
padding-bottom: 0;
}
.bottom_icon {
position: absolute;
bottom: 0.1rem;
}
</style>
</head>
<body>
<div class="content_height">
<div class="header">
<div class="return">
<span class="back_href">
<i class="iconfont icon-jiantou-copy"></i>返回
</span>
</div>
选择订单类型
</div>
<div class="header_place"></div>
<div class="container">
<p class="choose_style">选择订单类型</p>
<p class="sytle_english">SELECT ORDER TYPE</p>
<div class="item_list">
<volist name="typeList" id="vo" key="key">
<div class="icon_item" data-href="{:url('write',['id'=>$vo['id']])}">
<div class="icon_wrap">
<img src="{:cmf_get_asset_url($vo['icon'])}"/>
<p class="icon_name">{$vo.name}</p>
</div>
</div>
</volist>
</div>
</div>
<div class="bottom_icon">
<img src="__TMPL__/public/mobile/images/biglogo@2x.png" class="bottom_img" />
<p class="bottom_text">{$site_info.site_name}</p>
</div>
</div>
<script src="__TMPL__/public/mobile/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/swiper-4.3.5.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function(){
if($('.icon_item').length==4){
$('.icon_item').css('width','34%')
}
$('.icon_item').click(function(){
location.href = $(this).data('href');
})
})
</script>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<include file="public@head_common"/>
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/weui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/myweui.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/augly.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/mobile/css/pay/order_style.css" />
<title>选择订单类型</title>
<style type="text/css">
.content_height {
padding-bottom: 0;
}
.bottom_icon {
position: absolute;
bottom: 0.1rem;
}
</style>
</head>
<body>
<div class="content_height">
<div class="header">
<div class="return">
<span class="back_href">
<i class="iconfont icon-jiantou-copy"></i>返回
</span>
</div>
选择订单类型
</div>
<div class="header_place"></div>
<div class="container">
<p class="choose_style">选择订单类型</p>
<p class="sytle_english">SELECT ORDER TYPE</p>
<div class="item_list">
<volist name="typeList" id="vo" key="key">
<div class="icon_item" data-href="{:url('write',['id'=>$vo['id'],'ver'=>1.05])}">
<div class="icon_wrap">
<img src="{:cmf_get_asset_url($vo['icon'])}"/>
<p class="icon_name">{$vo.name}</p>
</div>
</div>
</volist>
</div>
</div>
<div class="bottom_icon">
<img src="__TMPL__/public/mobile/images/biglogo@2x.png" class="bottom_img" />
<p class="bottom_text">{$site_info.site_name}</p>
</div>
</div>
<script src="__TMPL__/public/mobile/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/swiper-4.3.5.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function(){
if($('.icon_item').length==4){
$('.icon_item').css('width','34%')
}
$('.icon_item').click(function(){
location.href = $(this).data('href');
})
})
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@
<div class="form_data">
<!--第一步-->
<div class="write_one" style="display: ;">
<div class="write_one" style="">
<div class="register_item baby_name">
<div class="write_tit">
<p class="tit">订单类型</p>
... ... @@ -226,7 +226,7 @@
location.href = "{:url('order_type')}";
// $('.mask').hide()
});
$('.change_btn').click(function() {
$('.mask').on('click','.change_btn',function() {
location.href = "{:url('order_type')}";
// $('.mask').hide()
});
... ... @@ -236,6 +236,7 @@
var btn = $(this);
var text = btn.text();
if(submit_common('.form_data',form_data)) {
// alert(form_data.join(','));return false;
if(allow_submit) {
allow_submit = false;
var data = {
... ... @@ -243,7 +244,7 @@
param: form_data.join(',')
};
$.ajax({
url: "{:url('submit_form')}",
url: "{:url('submit_form',['ver'=>1.02])}",
type: "POST",
data: data,
dataType: "JSON",
... ... @@ -295,13 +296,14 @@
if($(this).find('input').length > 0) {
// 判断填写内容是否符合要求
if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
data = [];
data = form_data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
if($(this).data('type') == 3 && $(this).data('validate') == 1) {
if(!reg.test($(this).find('input').val())) {
data = form_data = [];
_error($(this).find('._validate').html()+'格式错误');
status = false;
return false;
... ... @@ -314,6 +316,7 @@
}
if($(this).find('textarea').length > 0){
if($(this).find('textarea').val() == '' && $(this).data('validate') == 1) {
data = form_data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
... ...

48.6 KB | 宽: | 高:

41.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

37.8 KB | 宽: | 高:

36.0 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

69.3 KB | 宽: | 高:

77.0 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

82.1 KB | 宽: | 高:

66.3 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖