north 6 年之前
父節點
當前提交
16642bc5d9

+ 13 - 1
www/protected/components/CommonFn.php

@@ -8,7 +8,19 @@
 use Green\Request\V20170112 as Green;
 class CommonFn
 {
-
+    // 生成密码
+    public static function generateRandomString($length = 10) {
+        $characters = '0123456789';//ABCDEFGHIJKLMNOPQRSTUVWXYZ
+        $randomString = '';
+        for ($i = 0; $i < $length/2; $i++) {
+            $randomString .= $characters[rand(0, strlen($characters) - 1)];
+        }
+        $characters = 'abcdefghijklmnopqrstuvwxyz';
+        for ($i = 0; $i < $length/2; $i++) {
+            $randomString .= $characters[rand(0, strlen($characters) - 1)];
+        }
+        return $randomString;
+    }
     //替换爬虫中的url
     public static function replaceUrl($tmp_str){
         $_tmp_str = str_replace('pics.wozhua.mobi','wozhua-pics.qiniudn.com',$tmp_str);

+ 2 - 0
www/protected/config/console.php

@@ -27,6 +27,7 @@ if(trim($env) == 'develop'){// 本地配置
             'application.widget.*',
             'application.modules.o2o.models.*',
             'application.modules.j.models.*',
+            'application.modules.construction.models.*',
             'ext.phpexcel.*',
 
         ),
@@ -143,6 +144,7 @@ if(trim($env) == 'develop'){// 本地配置
             'application.widget.*',
             'application.modules.o2o.models.*',
             'application.modules.j.models.*',
+            'application.modules.construction.models.*',
 
         ),
 

+ 2 - 0
www/protected/config/main.php

@@ -27,6 +27,7 @@ return array(
         'application.widget.*',
         'application.modules.o2o.models.*',
         'application.modules.j.models.*',
+        'application.modules.construction.models.*',
         'application.modules.moonclub.models.*',
         'ext.phpexcel.*',
         'ext.aliyuncs.*',
@@ -48,6 +49,7 @@ return array(
         'y',
         'j',
         'ch',
+        'construction',
     ),
 
     'components'=>array(

+ 58 - 1
www/protected/controllers/RUserController.php

@@ -1,6 +1,12 @@
 <?php
 class RUserController extends AdminController{
-
+    protected $fileds = [
+                'user_name' =>'姓名',
+                'phone' =>'手机号',
+                'sex' =>'性别',
+                'card_number' =>'注册号',
+                'password' =>'密码',
+                ];
     public function actionIndex()
     {
 //        $users = RUser::model()->findAll();
@@ -12,6 +18,7 @@ class RUserController extends AdminController{
         $type_data = Yii::app()->params['o2o_service'];
         $type = CommonFn::getComboboxData($type_data, 100, true, 100);
         $this->render('index', array(
+            'fileds' => $this->fileds,
             'type'         => $type
         ));
     }
@@ -235,4 +242,54 @@ class RUserController extends AdminController{
 
          CommonFn::requestAjax(true, '优惠券已成功发放');
      }
+
+     public function actionAdd(){
+         $user_name = Yii::app()->request->getParam('user_name', '');
+         $sex = (int)Yii::app()->request->getParam('sex', '');
+         $phone = Yii::app()->request->getParam('phone', '');
+         $card_number = Yii::app()->request->getParam('card_number', '');
+         $password = Yii::app()->request->getParam('password', '');
+
+         $criteria = new EMongoCriteria();
+         $criteria->card_number('==',$card_number);
+         $criteria->password('==',$password);
+         $result = RegisterCard::model()->find($criteria);
+         if ($result->status != 0) {
+             CommonFn::requestAjax(false, '添加失败,注册卡已被使用');
+         }
+         if ($result) {
+             $userAr  = new RUser();
+             $userAr->user_name = $user_name;
+             $userAr->user_info = [
+                 'name' => $user_name,
+                 'mobile' => $phone,
+                 'phone' => $phone,
+                 'email' => '',
+                 'birth' => '',
+                 'sex' => (int)$sex,
+             ];
+             $userAr->avatar = '';
+             $userAr->wx_pub_openid = '';
+             $userAr->unionid = '';
+             $userAr->sex = $sex;
+             $userAr->register_time = time();
+             $userAr->channel = 'wxpub';
+             $userAr->wx_have_follow = 1;
+             $userAr->source = '建工';
+             $userAr->type = '电话';
+             $userAr->balance = 800;
+             $userAr->save();
+             $result->user_id = $userAr->_id;
+             $result->time = time();
+             $result->phone = $phone;
+             $result->status = 1;
+             $result->source = '电话';
+             $result->save();
+             CommonFn::requestAjax(true, '添加成功');
+         } else {
+             CommonFn::requestAjax(false, '添加失败,注册卡号不正确');
+         }
+
+
+     }
 }

+ 76 - 0
www/protected/controllers/RegisterCardController.php

@@ -0,0 +1,76 @@
+<?php
+
+/**
+ * Created by north.Deng's MAC
+ * User: north.Deng
+ * Date: 2018/2/28
+ * Time: 下午12:30
+ * description :
+ */
+class RegisterCardController extends AdminController
+{
+    protected $fileds  = [
+        'card_number' => '卡号',
+        'time' => '注册时间',
+        'phone' => '注册手机号',
+        'user_id' => '注册人',
+        'source' => '来源',
+        'password' => '密码',
+        'status' => '状态',
+        'desc' => '备注',
+
+    ];
+    public function actionIndex()
+    {
+        $status = CommonFn::getComboboxData(RegisterCard::$status_options, 100, true, 100);
+        $this->render('index',[
+            'fileds' => $this->fileds,
+            'status' => $status
+        ]);
+
+    }
+
+    public function actionList()
+    {
+        $pageParams = CommonFn::getPageParams();
+        $search = Yii::app()->request->getParam('search', '');
+        $criteria = new EMongoCriteria($pageParams);
+
+        if ($search) {
+            $criteria->addCond('phone','or',new MongoRegex('/' . $search . '/'));
+        }
+        $cursor = RegisterCard::model()->findAll($criteria);
+        $rows = CommonFn::getRowsFromCursor($cursor);
+        $parsedRows = RegisterCard::model()->parse($rows);
+        $total = $cursor->count();
+        echo CommonFn::composeDatagridData($parsedRows, $total);
+    }
+
+    public function actionEdit()
+    {
+        $this->fileds['id'] = 'ID';
+        $data = [];
+        foreach ($this->fileds as $filed => $v) {
+            $data[$filed] = Yii::app()->request->getParam($filed,'');
+            if ($filed == 'status' && (int)$v == 100) {
+                CommonFn::requestAjax(false, '请选择状态', array(
+                    'error' => $filed,
+                ));
+            } else if (empty($data[$filed])) {
+                CommonFn::requestAjax(false, '请填写完整数据', array(
+                    'error' => $filed,
+                ));
+
+            }
+        }
+        $card = RegisterCard::get(new MongoId($data['id']));
+        $card->status = (int)$data['status'];
+        $card->source = $data['source'];
+        $card->phone = $data['phone'];
+        $card->desc = $data['desc'];
+        $card->save();
+        CommonFn::requestAjax(true,'修改成功');exit;
+    }
+
+
+}

+ 2 - 0
www/protected/models/data/RUser.php

@@ -23,6 +23,7 @@ class RUser extends MongoAr
     public $balance = 0;//账户余额
     public $user_info = array();
     public $source = '壹管家';
+    public $type = '微信';
 
 
     public function __construct($scenario='insert'){
@@ -69,6 +70,7 @@ class RUser extends MongoAr
             $newRow = array();
             $newRow['id'] = (string)$row['_id'];
             $newRow['sex'] = CommonFn::get_val_if_isset($row,'sex',3);
+            $newRow['type'] = CommonFn::get_val_if_isset($row,'type','');
             $newRow['avatar'] = CommonFn::get_val_if_isset($row,'avatar',Yii::app()->params['defaultUserAvatar']);
             if($newRow['avatar']==''){
                 $newRow['avatar'] = Yii::app()->params['defaultUserAvatar'];

+ 29 - 0
www/protected/modules/construction/ConstructionModule.php

@@ -0,0 +1,29 @@
+<?php
+
+class ConstructionModule extends CWebModule
+{
+	public function init()
+	{
+		// this method is called when the module is being created
+		// you may place code here to customize the module or the application
+
+		// import the module-level models and components
+		$this->setImport(array(
+			'construction.models.*',
+			'construction.components.*',
+		));
+	}
+    //test
+	public function beforeControllerAction($controller, $action)
+	{
+        $controller->layout = '//layouts/none';
+		if(parent::beforeControllerAction($controller, $action))
+		{
+			// this method is called before any module controller action is performed
+			// you may place customized code here
+			return true;
+		}
+		else
+			return false;
+	}
+}

+ 10 - 0
www/protected/modules/construction/components/ConstructionController.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * o2o模块公共基类
+ */
+class ConstructionController extends Controller{
+
+    protected function beforeAction($action) {
+        return true;
+    }
+}

+ 10 - 0
www/protected/modules/construction/controllers/DefaultController.php

@@ -0,0 +1,10 @@
+<?php
+
+class DefaultController extends ConstructionController
+{
+	public function actionIndex()
+	{
+
+		$this->render('index');
+	}
+}

+ 134 - 0
www/protected/modules/construction/controllers/WebController.php

@@ -0,0 +1,134 @@
+<?php
+class WebController extends ConstructionController {
+
+	public function actionIndex() {
+
+		$signPackage = CommonWeixin::get_sign();
+		$home_page = Yii::app()->getRequest()->getParam("home_page",'');
+		$code = Yii::app()->getRequest()->getParam("code");
+		$state = Yii::app()->getRequest()->getParam("state");
+
+		$userId = '';
+		$appToken = '';
+		if($code && $state){
+            $wxConfig = Yii::app()->params['wxJgConfig'];
+            $accessInfo = CommonWeixin::getAccessInfo($code,$wxConfig['appId'],$wxConfig['appSecret']);
+			$userId = '';
+			if (!isset($accessInfo['errcode']) && $state == 'yiguanjia') {
+				$appToken = md5(substr($accessInfo['openid'],2));
+				//微信校验通过,登录(注册),分发token
+				$userInfo = CommonWeixin::getUserInfo($accessInfo['access_token'], $accessInfo['openid']);
+				if (!isset($accessInfo['errcode'])) {
+					//检查是否有注册,没有就注册
+					$criteria = new EMongoCriteria();
+					$criteria->wx_pub_openid('==', $accessInfo['openid']);
+					$user = RUser::model()->find($criteria);
+					if ($user) {
+						$userId = $user->_id;
+						if(!isset($user->wx_pub_openid) || empty($user->wx_pub_openid) || $user->source != "建工"){
+							$user->wx_pub_openid = $accessInfo['openid'];
+							$user->wx_have_follow = 1;
+                            $user->source = '建工';
+							$user->update(array('source','wx_pub_openid','wx_have_follow'),true);
+						}
+					}else{
+						$userAr  = new RUser();
+						$userAr->user_name = $userInfo['nickname'];
+						$userAr->avatar = $userInfo['headimgurl'];
+						$userAr->wx_pub_openid = $userInfo['openid'];
+						$userAr->unionid = $userInfo['openid'];
+						$userAr->sex = $userInfo['sex'];
+						$userAr->register_time = time();
+						$userAr->channel = 'wxpub';
+						$userAr->wx_have_follow = 1;
+						$userAr->source = '建工';
+						$u_criteria = new EMongoCriteria();
+						$u_criteria->user_name('==',$userInfo['nickname']);
+						$olduser = RUser::model()->find($u_criteria);
+						if($olduser){
+							$user_new_neme = $userAr->user_name.'_'.substr(time(),-7);
+							$userAr->user_name = $user_new_neme;
+						}
+
+						$result = $userAr->save();
+						if($result){
+							//异步同步微信头像到七牛
+							if (!empty($userAr->unionid) && (strpos($userAr->avatar, 'qiniu') === false)) {
+								$list = new ARedisList('after_user_reg');
+								$user_id = (string)$userAr->_id;
+								$list->push($user_id);
+							}
+							$userId = (string)$userAr->_id;
+
+						}else{
+							var_dump($userAr);exit;
+						}
+					}
+				}else{
+					echo $accessInfo['errcode'];
+					die();
+				}
+			}
+
+		}
+
+		if($home_page){
+			$this->renderpartial($home_page.'Index', array(
+				'version' => '2015082505',
+				'debug' => 'false',
+				'signPackage' => $signPackage,
+				'userId1' => $userId,
+				'appToken1' => $appToken,
+			));
+		}else{
+			/* var_dump(array(
+					 'version' => '2015111601',
+					 'debug' => 'false',
+					 'signPackage' => $signPackage,
+					 'userId' => $userId,
+					 'appToken' => $appToken,
+			 ));exit;*/
+			$this->renderpartial('index', array(
+				'version' => '2015111601',
+				'debug' => 'false',
+				'signPackage' => $signPackage,
+				'userId1' => $userId,
+				'appToken1' => $appToken,
+			));
+		}
+	}
+
+	//检查微信登录页
+	public function actionWxIndex() {
+		$wxConfig = Yii::app()->params['wxJgConfig'];
+		$home_page = Yii::app()->getRequest()->getParam("home_page",'');
+		$redirectURI = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . '/index.php?r=construction/web/index';
+		if($home_page){
+			$appURI = Yii::app()->request->baseUrl . 'index.php?r=construction/web/index'.'&home_page='.$home_page;
+			$redirectURI = $redirectURI.'/'.$home_page;
+		}else{
+			$appURI = Yii::app()->request->baseUrl . 'index.php?r=construction/web/index';
+		}
+		$scope = 'snsapi_userinfo';
+		$state = 'yiguanjia';
+		$codeURI = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $wxConfig['appId'] . '&redirect_uri=' . urlencode($redirectURI) . '&response_type=code&scope=' . $scope . '&state=' . $state . '#wechat_redirect';
+		$this->renderpartial('wxIndex', array(
+			'codeURI' => $codeURI,
+			'appURI' => $appURI
+		));
+	}
+
+	// 服务介绍
+	public function actionServiceIntroduction()
+	{
+
+		$this->renderpartial('serviceIntroduction');
+	}
+	// 礼包介绍  Gift package introduction
+	public function actionGiftPackage()
+	{
+
+		$this->renderpartial('giftPackage');
+	}
+
+}

+ 117 - 0
www/protected/modules/construction/models/RegisterCard.php

@@ -0,0 +1,117 @@
+<?php
+
+/**
+ * Created by north.Deng's MAC
+ * User: north.Deng
+ * Date: 2018/5/4
+ * Time: 上午10:10
+ * description :
+ * 注册卡
+ */
+class RegisterCard extends MongoAr
+{
+    public $_id;
+    public $card_number;//卡号
+    public $index;
+    public $time;//注册时间
+    public $phone;//手机号
+    public $user_id;//用户id
+    public $source;//来源
+    public $desc;//备注
+    public $password;//密码
+    public $status = 0;//状态
+
+
+    public static $status_options = [
+        0 => ['name' => '未激活'],
+        1 => ['name' => '已激活'],
+        2 => ['name' => '作废'],
+    ];
+    public function __construct($scenario='insert'){
+        $this->setMongoDBComponent(Yii::app()->getComponent('mongodb_o2o'));
+        parent::__construct($scenario);
+    }
+
+
+    public static function model($className=__CLASS__)
+    {
+        return parent::model($className);
+    }
+
+    public function getCollectionName()
+    {
+        return 'construction_register_card';
+    }
+    // 批量生成 注册卡
+    public static function generateRegisterCard($number = 1){
+        $index = 0;
+        $criteria = new EMongoCriteria();
+        $criteria->sort('index',EMongoCriteria::SORT_DESC);
+        $criteria->limit(1);
+        $result = self::model()->findAll($criteria);
+        if ($result) {
+            foreach ($result as $value) {
+                $index = $value->index;
+            }
+        }
+        $index += 1;
+        while($number > 0) {
+            $card = new self();
+            $card->card_number = substr_replace('MSG0000001',$index,strlen('MSG0000001')-strlen($index),strlen($index));
+            $card->password = CommonFn::generateRandomString(8);
+            $card->index = $index++;
+            $card->save();
+            $number--;
+        }
+    }
+
+    public static function get($_id) {
+        if(CommonFn::isMongoId($_id)){
+            $criteria = new EMongoCriteria();
+            $criteria->_id('==', $_id);
+            $model = self::model()->find($criteria);
+            return $model;
+        }else{
+            return false;
+        }
+    }
+
+    public function parseRow($row,$output=array()){
+
+        $newRow = array();
+        $newRow['id'] = (string)$row['_id'];
+        $newRow['user_id'] = CommonFn::get_val_if_isset($row,'user_id','');
+        if ($newRow['user_id']) {
+            if (CommonFn::isMongoId($newRow['user_id'])) {
+                $newRow['user'] = RUser::get($newRow['user_id']);
+            } else {
+                $newRow['user'] = RUser::get(new MongoId($newRow['user_id']));
+            }
+        }else {
+            $newRow['user'] = [
+                'user_info' => [
+                    'name' => ''
+                ]
+            ];
+        }
+        $newRow['card_number'] = CommonFn::get_val_if_isset($row,'card_number','');
+        $newRow['phone'] = CommonFn::get_val_if_isset($row,'phone','');
+        $newRow['source'] = CommonFn::get_val_if_isset($row,'source','');
+        $newRow['password'] = CommonFn::get_val_if_isset($row,'password','');
+        $newRow['status'] = CommonFn::get_val_if_isset($row,'status','');
+        $newRow['status_str'] = self::$status_options[intval($newRow['status'])]['name'];
+        $newRow['time'] = CommonFn::get_val_if_isset($row,'time','');
+        if ($newRow['time']) {
+            $newRow['time_str'] = date('Y-m-d H:i:s',$newRow['time']);
+        }
+        $newRow['desc'] = CommonFn::get_val_if_isset($row,'desc','');
+        if(APPLICATION=='admin'){
+            $newRow['action_user'] = CommonFn::get_val_if_isset($row,'action_user',"");
+            $newRow['action_time'] = CommonFn::get_val_if_isset($row,'action_time',"");
+            $newRow['action_log'] = CommonFn::get_val_if_isset($row,'action_log',"");
+
+        }
+        return $this->output($newRow,$output);
+    }
+
+}

+ 33 - 0
www/protected/modules/construction/views/default/index.php

@@ -0,0 +1,33 @@
+<?php $host = $_SERVER['HTTP_HOST']; /*资源路径设置*/ ?>
+<?php $newVersion = time() /*时间戳*/ ?>
+<!doctype html>
+<html lang="en">
+<head>
+  <title>家政</title>
+  <style>
+    * {
+      margin: 0;
+      padding: 0;
+    }
+  </style>
+  <meta charset="UTF-8">
+  <meta name="viewport"
+        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+  <meta http-equiv="X-UA-Compatible" content="ie=edge">
+
+  <link rel="stylesheet" id="app_css"
+        href="http://<?php echo $host ?>/webapp/housekeeping/home/static/css/app.css?v=<?php echo $newVersion ?>">
+  <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/1.1.2/weui.min.css">
+  <script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.1.2/weui.min.js"></script>
+</head>
+<body>
+<!--vue-->
+<div id=app></div>
+<script type=text/javascript id="manifest"
+        src="http://<?php echo $host ?>/webapp/housekeeping/home/static/js/manifest.js?v=<?php echo $newVersion ?>"></script>
+<script type=text/javascript id="vendor"
+        src="http://<?php echo $host ?>/webapp/housekeeping/home/static/js/vendor.js?v=<?php echo $newVersion ?>"></script>
+<script type=text/javascript id="appJs"
+        src="http://<?php echo $host ?>/webapp/housekeeping/home/static/js/app.js?v=<?php echo $newVersion ?>"></script>
+</body>
+</html>

+ 24 - 0
www/protected/modules/construction/views/web/authFailed.php

@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!--HTML5 doctype-->
+<html>
+ 
+<head>
+    <title>家政</title>
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+    <meta http-equiv="Pragma" content="no-cache">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/webapp/framework/ratchet-2.0.2/dist/css/ratchet.min.css">
+	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/webapp/framework/ratchet-2.0.2/dist/css/ratchet-theme-ios.min.css">
+</head>
+	
+<body>
+	<div class="content-padded">
+		<h2>微信登录失败</h2>
+		<a class="btn btn-primary btn-block" href="<?php echo $wxLoginURI; ?>">重新登录</a>
+	</div>
+</body>
+	
+</html>

+ 91 - 0
www/protected/modules/construction/views/web/giftPackage.php

@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+  <title>巾帼家政</title>
+  <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
+  <meta name="apple-mobile-web-app-capable" content="yes">
+  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+  <meta http-equiv="Pragma" content="no-cache">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <style>
+   *{padding:0;margin:0}.titles{position:fixed;top:0;left:0;right:0;z-index:5;display:block;text-align:center;font-size:.66666667rem;line-height:1;padding:.3rem 0;background-color:#fff}.titles span{width:.66666667rem;height:.66666667rem;position:absolute;top:.25rem;left:15px;background:url('http://oduj3utzz.bkt.clouddn.com/2018_04_02_green_left.svg');background-position:center;-moz-background-size:100%;background-size:100%}.container{margin-top:1.4rem;padding:0 15px}.container .items{margin-bottom:15px}.container .items .title{text-align:left;padding-left:15px;line-height:2;color:#fff;background-color:#abd272;font-size:.53333333rem;position:relative}.container .items .title::after{content:"";display:block;width:35px;height:35px;position:absolute;right:5px;bottom:0;background:url('http://oduj3utzz.bkt.clouddn.com/2018_04_02_arrow_bottom.svg');background-position:center;-moz-background-size:100%;background-size:100%}.container .items .images{width:100%}.container .items .images img{width:100%}.container .fade-enter-active,.container .fade-leave-active{-webkit-transition:opacity .3s;-moz-transition:opacity .3s;transition:opacity .3s}.container .fade-enter,.container .fade-leave-to{opacity:0}.reservation{position:fixed;bottom:1.5rem;right:15px;background:#abd272;width:60px;font-size:15px;color:white;text-shadow:1px 1px 6px #000;height:60px;line-height:60px;text-align:center;-moz-border-radius:50%;border-radius:50%;-webkit-box-shadow:0 0 15px -3px #000;-moz-box-shadow:0 0 15px -3px #000;box-shadow:0 0 15px -3px #000}
+  </style>
+</head>
+
+<body>
+  <div id=app>
+    <div class=titles>礼包介绍
+      <span @click=back></span>
+    </div>
+    <div class=container>
+      <div class=items v-for='(item,index) in imgs' :key='index'>
+        <div class=title @click='btnShow(item.name)' ref='gift'>{{item.name}}</div>
+        <transition name=fade>
+          <div class=images v-if="item.name == nameShow">
+            <img @load="imageLoaded(item.index)" v-for="images in item.urls" :src=images>
+          </div>
+        </transition>
+      </div>
+    </div>
+    <div class=reservation @click=exchange>兑换</div>
+    <div></div>
+  </div>
+  <!-- js -->
+  <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
+  <script src="http://pics.yiguanjia.me/flexible.min.js"></script>
+  <script>
+    // 我们的数据对象
+    var vm = new Vue({
+      el: "#app",
+      data: {
+        nameShow: "",
+        oldNameShow: "",
+        scroll:[],
+        imgs: {
+          chicken: {
+            name: "巾帼醇种土鸡",
+            index:0,
+            urls: {
+              0: "http://pics.yiguanjia.me/2018_7_25_01.jpg",
+            }
+          },
+          sterilization: {
+            name: "整房杀菌除螨",
+            index:1,
+            urls: {
+              0: "http://pics.yiguanjia.me/2018_7_25_02.jpg",
+            }
+          },
+          deep_cleaning: {
+            name: "母婴房深度清洁",
+            index:2,
+            urls: {
+              0: "http://pics.yiguanjia.me/2018_7_25_03.jpg",
+            }
+          } 
+        }
+      },
+      created() {
+        // this.btnShow(this.imgs.chicken.name)
+      },
+      methods: {
+        btnShow(_) {
+          this.nameShow = this.oldNameShow == _ ? "" : _, this.oldNameShow = this.oldNameShow == _ ? "" : _
+        },
+        imageLoaded(index) {
+          window.scrollTo(0, 58 * index);
+        },
+        back() {
+          location.href = "http://common.yiguanjia.me/index.php?r=j/web/index"
+        },
+        exchange() {
+          location.href = "http://common.yiguanjia.me/index.php?r=j/web/index/#/exchange"
+        }
+      }
+    });
+  </script>
+</body>
+
+</html>

+ 77 - 0
www/protected/modules/construction/views/web/index.php

@@ -0,0 +1,77 @@
+<?php $host = $_SERVER['HTTP_HOST']; /*资源路径设置*/ ?>
+<?php $newVersion = time() /*时间戳*/ ?>
+<!doctype html>
+<html lang="en">
+<head>
+  <title>巾帼家政</title>
+  <style>
+    * {
+      margin: 0;
+      padding: 0;
+    }
+  </style>
+  <meta charset="UTF-8">
+  <meta name="viewport"
+        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+  <meta http-equiv="X-UA-Compatible" content="ie=edge">
+
+  <link rel="stylesheet" id="app_css"
+        href="http://<?php echo $host ?>/webapp/housekeeping/asset/css/app.css?v=<?php echo $newVersion ?>">
+  <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/1.1.2/weui.min.css">
+  <script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.1.2/weui.min.js"></script>
+</head>
+<body>
+<!--vue-->
+<div id=app></div>
+<script type=text/javascript id="manifest"
+        src="http://<?php echo $host ?>/webapp/housekeeping/asset/js/manifest.js?v=<?php echo $newVersion ?>"></script>
+<script type=text/javascript id="vendor"
+        src="http://<?php echo $host ?>/webapp/housekeeping/asset/js/vendor.js?v=<?php echo $newVersion ?>"></script>
+<script type=text/javascript id="appJs"
+        src="http://<?php echo $host ?>/webapp/housekeeping/asset/js/app.js?v=<?php echo $newVersion ?>"></script>
+</body>
+
+<!--vue-end-->
+<script type="text/javascript" id="wxMain" data-sign="<?php echo @htmlentities(json_encode($signPackage)); ?>"></script>
+<script type="text/javascript" defer>
+  (function () {
+    var ua = navigator.userAgent.toLowerCase();
+    <?php
+    if (isset($from_channel)) {
+      echo "var from_channel = '$from_channel';";
+      if (!empty($userId1) && $from_channel == 'baidu') {
+        echo "var bd_userId = localStorage.setItem('bd_userId',  '" . $userId1 . "');";
+      }
+    }
+    ?>
+    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+      <?php
+      if (!empty($userId1) && !empty($appToken1)) {
+        echo '
+        var wxUserID1 = localStorage.setItem("wxUserID1",  "' . $userId1 . '");
+        var appToken1 = localStorage.setItem("appToken1", "' . $appToken1 . '");
+        ';
+      }
+      ?>
+      var userID1 = localStorage.getItem('wxUserID1');
+      var appToken1 = localStorage.getItem('appToken1');
+      console.log(userID1);
+      console.log(appToken1);
+      var uri = location.href;
+      if (!userID1 || !appToken1) {
+        localStorage.clear();
+        location.href = '<?php echo Yii::app()->request->baseUrl . 'index.php?r=construction/web/wxIndex'; ?>';
+      }
+
+      if (uri.indexOf('state=yiguanjia') > -1 && userID1 && appToken1) {
+        window.location.href='http://common.yiguanjia.me/index.php?r=construction/web/index';
+      }
+      document.write('<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"><\/script>');
+    }
+    if (location.hash == '#rd') {
+      location.hash = '';
+    }
+  })();
+</script>
+</body>
+</html>

File diff suppressed because it is too large
+ 32 - 0
www/protected/modules/construction/views/web/serviceIntroduction.php


+ 31 - 0
www/protected/modules/construction/views/web/wxIndex.php

@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!--HTML5 doctype-->
+<html>
+
+<head>
+    <title>巾帼家政</title>
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+    <meta http-equiv="Pragma" content="no-cache">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+</head>
+
+<body>
+    <script type="text/javascript">
+    (function(){
+        var codeURI = '<?php echo $codeURI; ?>';
+        var appURI = '<?php echo $appURI; ?>';
+
+        var wxUserID1 = localStorage.getItem('wxUserID1');
+        if (wxUserID1) {
+            location.href = appURI+'&userId='+wxUserID1;
+        } else {
+            location.href = codeURI;
+        }
+    })();
+    </script>
+</body>
+
+</html>

+ 99 - 62
www/protected/views/rUser/index.php

@@ -21,8 +21,8 @@
             <div class="tb_line">
                 <input id="ss" />
             </div>
-            <div style="margin: 3px 2px;padding:5px;border: 1px solid #95B8E7;display:none;">
-               <!-- <a href="#" class='easyui-linkbutton' plain="true" iconCls="icon-add" onclick="add_content();return false;">新增用户</a>-->
+            <div style="margin: 3px 2px;padding:5px;border: 1px solid #95B8E7;">
+                <a href="#" class='easyui-linkbutton' plain="true" iconCls="icon-add" onclick="add_content();return false;">新增建工用户</a>
             </div>
         </div>
     </div>
@@ -327,6 +327,54 @@
 </div>
 
 </div>
+<div style="display: none;">
+    <div id="add_dialog" style="padding: 15px 0;">
+        <form id="add_form" method="post">
+            <ul>
+                <?php
+                foreach ($fileds as $key => $name) {
+                    if (in_array($key,['time','serve_time_start','serve_time_end','start_time','end_time'])) {
+                        $type = 'class="easyui-datetimebox" data-options="required:false,showSeconds:true"';
+                    }else {
+                        $type = '';
+                    }
+                    if ($key == 'sex') {
+                        echo "
+                                    <li class='f_item'>
+                                        <div class='box'>
+                                            <div class='f_label'>
+                                                <span>{$name}: </span>
+                                            </div>
+                                            <div class='box_flex f_content' >
+                                                <input type='radio' name='{$key}' id='sex1' value='1' checked/>男
+                                                <input type='radio' name='{$key}' id='sex2' value='2' />女
+                                            </div>
+                                        </div>
+                                    </li>
+                                ";
+                    } else {
+                        echo "
+                                    <li class='f_item'>
+                                        <div class='box'>
+                                            <div class='f_label'>
+                                                <span>{$name}: </span>
+                                            </div>
+                                            <div class='box_flex f_content'>
+                                                <input type='text' {$type} name='{$key}' value='' style='width: 250px;'  />
+                                            </div>
+                                        </div>
+                                    </li>
+                                ";
+                    }
+
+                }
+                ?>
+            </ul>
+        </form>
+    </div>
+
+</div>
+
 <!--新增用户结束 -->
 <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/qiniu_upload_single.js?v=20200907"></script>
 <script type="text/javascript">
@@ -413,64 +461,57 @@ $(function(){
             }
         }],
         onOpen:function(){
-            $('#avatar').parent().children('img').remove();
-            jq_add_form.form('clear');
-            $.fn.qiniu_upload_single('init',{
-                bucket:'avatars',
-                success_callback:function(result){
-                    var img_url = result.url;
-                    $('#avatar').parent().children('img').remove();
-                    $('#avatar').val(img_url).after('<img src="'+img_url+'" style="max-width: 200px;" />');
-                },
-                fail_callback:function(){
-                    $.messager.alert('提示', '上传失败,请稍后再试', 'warning');
-                    return false;
-                }
-            });
-        }
-    });
-    jq_add_form.form({
-        url: module_router + '/add',
-        onSubmit: function(param){
-            if(checkPass($('#add_password').val())<3){
-                $.messager.show({
-                    title: '提示',
-                    msg: '密码太简单了,必须是大写字母、小写字母、数字、特殊字符中任意三个组合,且长度大于8',
-                    timeout: 3500,
-                    showType: 'slide'
-                });
-                $.messager.progress('close');
-                return false ;
-            }
-            var isValid = $(this).form('validate');
-            if (!isValid){
-                $.messager.progress('close');
-            }
-            return isValid;
-        },
-        success: function(res){
-            $.messager.progress('close');
-            var res = JSON.parse(res);
-            if (res.success){
-                $.messager.show({
-                    title: '提示',
-                    msg: '添加成功',
-                    timeout: 3500,
-                    showType: 'slide'
-                });
-                jq_add_dialog.dialog('close');
-                jq_dg_content.datagrid('reload');
-            }else{
-                $.messager.show({
-                    title: '提示',
-                    msg: res.message,
-                    timeout: 3500,
-                    showType: 'slide'
-                });
-            }
-
+            // $('#avatar').parent().children('img').remove();
+            // jq_add_form.form('clear');
+            // $.fn.qiniu_upload_single('init',{
+            //     bucket:'avatars',
+            //     success_callback:function(result){
+            //         var img_url = result.url;
+            //         $('#avatar').parent().children('img').remove();
+            //         $('#avatar').val(img_url).after('<img src="'+img_url+'" style="max-width: 200px;" />');
+            //     },
+            //     fail_callback:function(){
+            //         $.messager.alert('提示', '上传失败,请稍后再试', 'warning');
+            //         return false;
+            //     }
+            // });
         }
     });
+  jq_add_form.form({
+    url : module_router + '/add',
+    onSubmit : function (param) {
+      var isValid = $(this).form('validate');
+      if (!isValid){
+        $.messager.progress('close');
+      }
+      return isValid;
+    },
+    success : function (res) {
+      $.messager.progress('close');
+      var res = JSON.parse(res);
+
+      if (res.success) {
+        $.messager.show({
+          title : '提示',
+          msg : '保存成功',
+          timeout : 3500,
+          showType : 'slide'
+        });
+        $('#content_avatar_show').html('');
+        jq_add_dialog.dialog('close');
+        jq_add_dialog.form('clear');
+
+        jq_dg_content.datagrid('reload');
+      } else {
+        $.messager.show({
+          title : '提示',
+          msg : res.message,
+          timeout : 3500,
+          showType : 'slide'
+        });
+      }
+    }
+  });
 
 
     jq_dg_content.datagrid({
@@ -852,10 +893,6 @@ function search_content(){
     });
 }
 function save_content(){
-    var a_id = $('#user_id').val();
-    if (!a_id){
-        return false;
-    }
     $.messager.progress();
     jq_content_form.submit();
 }

+ 581 - 0
www/protected/views/registerCard/index.php

@@ -0,0 +1,581 @@
+<style>
+    .f_label {width: 90px;}
+    .accordion-body {padding: 0;}
+    #view_select_position {
+        display:inline-block;
+        padding:1px 4px 1px 4px;
+        border:1px solid #999999;
+        text-decoration:none;
+        color:#333333;
+    }
+</style>
+
+<div id="main">
+    <div region="west" border="false" id="west_panel">
+        <table id="dg_content"></table>
+        <div id="tb_content">
+
+            <div class="tb_line">
+<!--                <span class="tb_label">状态: </span>-->
+<!--                <input id="filter_status" />-->
+                <div class="left">
+                    查询:<input id="ss" />
+                </div>
+            </div>
+<!--            <div>-->
+<!--                <a href="#" class='easyui-linkbutton' plain="true" iconCls="icon-add" onclick="add_content();return false;">新增注册卡</a>-->
+<!--            </div>-->
+        </div>
+    </div>
+
+    <div id="acc_container" class="accordion" region="center">
+        <div region="center" title="注册卡信息" data-options="iconCls:'icon-save',selected:true">
+            <div class="easyui-layout detail_layout">
+                <div data-options="region:'center'" class="detail_center">
+                    <div class="detail_main">
+                        <form id="content_form" method="post">
+                            <ul>
+                                <li class="f_item">
+                                    <div class="box">
+                                        <div class="f_label">
+                                            <span>ID: </span>
+                                        </div>
+                                        <div class="box_flex f_content">
+                                            <input type="hidden" name="id" id="id" value='' />
+                                            <span id="id_str"></span>
+                                        </div>
+                                    </div>
+                                </li>
+                                <?php
+                                foreach ($fileds as $key => $name) {
+                                    if (in_array($key,['time'])) {
+                                        $type = 'class="easyui-datetimebox" data-options="required:true,showSeconds:false"';
+                                    }else {
+                                        $type = '';
+                                    }
+                                    $readonly = '';
+                                    if (in_array($key,['password','user_id'])) {
+                                        $readonly = 'readonly';
+                                    } else {
+                                        $readonly ='';
+                                    }
+                                    if($key == 'status'){
+                                        echo "<li class='f_item'>
+                                        <div class='box'>
+                                            <div class='f_label'>
+                                                <span>{$name}: </span>
+                                            </div>
+                                            <div class='box_flex f_content'>
+                                                <input type='text' name='{$key}' id='{$key}' style='width: 250px;' />
+                                            </div>
+                                        </div>
+                                    </li>";
+                                    } else {
+                                        echo "
+                                    <li class='f_item'>
+                                        <div class='box'>
+                                            <div class='f_label'>
+                                                <span>{$name}: </span>
+                                            </div>
+                                            <div class='box_flex f_content'>
+                                                <input type='text' {$type} name='{$key}' id='{$key}' style='width: 250px;'   $readonly />
+                                            </div>
+                                        </div>
+                                    </li>
+                                ";
+                                    }
+
+                                }
+                                ?>
+
+                            </ul>
+                        </form>
+                    </div>
+                    <div data-options="region:'south'" class="detail_south">
+                        <div class="detail_toolbar">
+                            <a href="#" class="easyui-linkbutton set_button" iconCls="icon-save" onclick="save_content();return false;">保存</a>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div style="display: none;">
+    <div id="add_dialog" style="padding: 15px 0;">
+        <form id="add_form" method="post">
+            <ul>
+                <?php
+                        foreach ($fileds as $key => $name) {
+                            if (in_array($key,['time','start_time','end_time'])) {
+                                $type = 'class="easyui-datetimebox" data-options="required:true,showSeconds:false"';
+                            } else {
+                                $type = '';
+                            }
+                             if($key == 'certificate'){
+                                echo "
+                                        <li class='f_item'><div class='box'>
+                                            <input type='hidden' name='certificate' id='certificate1' value='1' />
+
+                                       </li>";
+                            }else {
+                                echo "
+                                    <li class='f_item'>
+                                        <div class='box'>
+                                            <div class='f_label'>
+                                                <span>{$name}: </span>
+                                            </div>
+                                            <div class='box_flex f_content'>
+                                                <input type='text' {$type} name='{$key}' value='' style='width: 250px;'  />
+                                            </div>
+                                        </div>
+                                    </li>
+                                ";
+                            }
+
+                        }
+                    ?>
+            </ul>
+        </form>
+    </div>
+
+</div>
+<div style="display:none;">
+    <div id="refund_tip_dialog" style="padding: 30px 0;">
+        <div style="text-align:center;"><span id="refund_tip"></span></div>
+    </div>
+</div>
+<div style="display: none;">
+    <div id="edit_extra_dialog" style="margin:5px 0 0 0;">
+        <ul>
+            <li class="f_item">
+                <div class="box">
+                    <div class="f_label">
+                        <span>开始时间段: </span>
+                    </div>
+                    <div class="box_flex f_content">
+                        <input type="text" id="edit_extra_type" style="width: 250px;"/>
+                    </div>
+                </div>
+            </li>
+
+
+            <li class="f_item">
+                <div class="box">
+                    <div class="f_label">
+                        <span>结束时间段: </span>
+                    </div>
+                    <div class="box_flex f_content">
+                        <input type="text" id="edit_extra_price" style="width: 250px;"/>
+                    </div>
+                </div>
+            </li>
+        </ul>
+    </div>
+</div>
+<script language="javascript" type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/coolautosuggest/jquery.coolautosuggest.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/coolautosuggest/jquery.coolautosuggest.css" />
+<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/qiniu_upload_single.js?v=123123123"></script>
+<script type="text/javascript">
+  var jq_dg_content = $('#dg_content');
+  var jq_content_form = $('#content_form');
+  var jq_filter_status = $('#filter_status');
+  var module_router = site_root + '/index.php?r=RegisterCard';
+  var fields = <?=json_encode($fileds)?>;
+  var jq_setStatus = $('#setStatus');
+  var jq_setStatus_add = $('#setStatus_add');
+  var w_width = $(window).width();
+  var w_height = $(window).height();
+  var jq_ss = $('#ss');
+  var jq_add_dialog = $('#add_dialog');
+  var jq_add_form = $('#add_form');
+  var status_data = <?=json_encode($status)?>;
+  var jq_set_precedence = $('#set_precedence');
+  var jq_action_info = $('#action_info');
+  var jq_acc = $('#acc_container');
+  $('#expire_time1').datetimebox({});
+  $('#server_start_time').datetimebox({});
+  $('#server_end_time').datetimebox({});
+  var jq_edit_extra_dialog = $('#edit_extra_dialog');
+  $('body').on('click','.del_extra',function(){
+    $(this).parent('div').remove();
+
+    var extras = new Array();
+    if($('#add_extra').val()){
+      extras = JSON.parse($('#add_extra').val());
+    }
+
+    extras.splice($(this).parent('div').attr('data'),1);
+
+    $('#extra_add_info').children('div').each(function(index,e){
+      console.log(index);
+      $(this).attr("data",index);
+    })
+
+    $('#add_extra').val(JSON.stringify(extras));
+  });
+  $(function(){
+    jq_acc.accordion({
+      height: w_height - 18,
+      onSelect: function(title) {
+
+      }
+    });
+
+
+
+    jq_setStatus.combobox({
+      editable: false,
+      data: status_data,
+    });
+    $('#status').combobox({
+      editable: false,
+      data: status_data,
+    });
+
+    jq_setStatus_add.combobox({
+      editable: false,
+      data: (function () {
+        var status_data_temp = new Array();
+        $.extend(status_data_temp, status_data);
+        status_data_temp.shift();
+
+        return status_data_temp;
+      })()
+    });
+    jq_filter_status.combobox({
+      width: 100,
+      data: status_data,
+      editable: false,
+      onSelect: function(){
+        search_content();
+      }
+    });
+
+
+    var p_width = parseInt(w_width / 2);
+    if (p_width < 520){
+      p_width = 520;
+    }
+    var d_width = p_width - 10;
+    $('#west_panel').css({width : p_width});
+    $('#main').css({width: w_width - 25, height: w_height - 18}).layout();
+
+    jq_ss.searchbox({
+      width: 130,
+      searcher:function(value){
+        search_content(value);
+      },
+      prompt: '请输入关键字'
+    });
+
+    jq_add_dialog.dialog({
+      title: '创建注册卡',
+      width: 500,
+      height: 500,
+      closed: true,
+      modal: true,
+      buttons:[{
+        text: '确认',
+        iconCls: 'icon-ok',
+        handler: function(){
+          // ------ 数据完整性检查 ------
+          var check = checkAddForm();
+          if (!check) {
+            return false;
+          } else {
+            $.messager.progress();
+            jq_add_form.submit();
+          }
+        }
+      },{
+        text: '取消',
+        iconCls: 'icon-cancel',
+        handler: function(){
+          jq_add_dialog.dialog('close');
+        }
+      }],
+      onOpen:function(){
+        // jq_add_form.form('clear');
+
+        // jq_add_form.form('load', {});
+        // jq_set_precedence.combobox('setValue', 0);
+      }
+    });
+    jq_ss.searchbox({
+      width: 130,
+      searcher:function(value){
+        search_content(value);
+      },
+      prompt: '请输入关键字'
+    });
+    jq_dg_content.datagrid({
+      url: module_router + '/list',
+      title: '注册卡列表',
+      width: d_width,
+      height: w_height - 18,
+      fitColumns: true,
+      autoRowHeight: true,
+      striped: true,
+      toolbar: '#tb_content',
+      singleSelect: true,
+      selectOnCheck: false,
+      checkOnSelect: false,
+      rowStyler: function(index,row){
+        if (row.status==1){
+          //return 'color:red;';
+        }else if(row.status==-3){
+          return 'color:green;';
+        }
+      },
+      pagination: true,
+      pageList: [20, 30, 50],
+      pageSize: 20,
+      nowrap: false,
+      idField: 'id',
+      sortName: 'id',
+      sortOrder: 'desc',
+      queryParams: get_param_obj(),
+      frozenColumns:[[
+        {field:'id',checkbox:true}
+      ]],
+      columns:[[
+        {field:'id', title:'id', hidden:true},
+        {field:'card_number', title:'卡号',width:40},
+        {field:'user', title:'注册用户',sortable:false, formatter: function (value,row,index) {
+            return value.user_info.name;
+        }},
+        {field:'phone', title:'手机号', width:40,sortable:false},
+        {field:'source', title:'来源', width:40,sortable:false},
+        {field:'time_str', title:'注册时间', width:40,sortable:false},
+        {field:'status_str', title:'状态', width:40,sortable:false},
+
+      ]],
+
+      onSelect: function(index, row){
+        var data = $.extend({}, row);
+        console.log((row));
+        $('#id').val(row.id);
+        $('#id_str').html(row.id);
+        for (let obj in fields) {
+          if( obj == 'time'){
+            $(`#${obj}`).datetimebox('setValue', parse_time(data,obj));
+          }else if(obj == 'status'){
+            $(`#${obj}`).combobox('setValue', row[obj]);
+          } else {
+            $(`#${obj}`).val(row[obj]);
+          }
+        }
+        // $('#expire_time1').datetimebox('setValue', parse_time(data,'flow_time'));
+        // $('#edit_status').combobox('setValue', row.status);
+
+
+
+      },
+      onLoadSuccess : function () {
+        $('#id').val('');
+        $('#id_str').html('');
+        for (let obj in fields) {
+          if (obj == 'sex') {
+            $('#sex1').attr('checked', false);
+            $('#sex2').attr('checked', false);
+          }else if(  obj == 'time' || obj == 'start_time'|| obj == 'end_time'){
+            $(`#${obj}`).datetimebox('setValue', '');
+          } else {
+            $(`#${obj}`).val('');
+          }
+        }
+        $('#content_avatar_show').html('');
+        jq_dg_content.datagrid('clearSelections');
+      }
+
+    });
+    // 头像上传
+    $.fn.qiniu_upload_single('init', {
+      bucket: 'avatars',
+      button: '#content_avatar_uploader',
+      success_callback: function(result) {
+        console.log(result);
+        var img_url = result.url;
+
+        var img = new Image();
+        img.onload = function() {
+          var imgWidth = img.width;
+          var imgHeight = img.height;
+          $('#certificate').val(img_url);
+          $('#content_avatar_show').html('<img src="'+img_url+'" style="max-width: 60px;"/>');
+        }
+        img.src = img_url;
+      },
+      fail_callback: function() {
+        $.messager.alert('提示', '上传失败,请重试');
+        return false;
+      }
+    });
+     $.fn.qiniu_upload_single('init', {
+          bucket: 'avatars',
+          button: '#content_avatar_uploader1',
+          success_callback: function(result) {
+            console.log(result);
+            var img_url = result.url;
+
+            var img = new Image();
+            img.onload = function() {
+              var imgWidth = img.width;
+              var imgHeight = img.height;
+              $('#certificate1').val(img_url);
+              $('#content_avatar_show1').html('<img src="'+img_url+'" style="max-width: 60px;"/>');
+            }
+            img.src = img_url;
+          },
+          fail_callback: function() {
+            $.messager.alert('提示', '上传失败,请重试');
+            return false;
+          }
+        });
+
+
+
+
+    jq_content_form.form({
+      url: module_router + '/edit',
+      onSubmit: function(param){
+        var isValid = $(this).form('validate');
+        if (!isValid){
+          $.messager.progress('close');
+        }
+        return isValid;
+      },
+      success: function(res){
+        $.messager.progress('close');
+        var res = JSON.parse(res);
+
+        if (res.success){
+          jq_dg_content.datagrid('reload');
+        }
+        if(res.success){
+          $.messager.show({
+            title: '提示',
+            msg: '保存成功',
+            timeout: 3500,
+            showType: 'slide'
+          });
+
+          $('#technician_id').val(0);
+        }else{
+          $.messager.show({
+            title: '提示',
+            msg: res.message,
+            timeout: 3500,
+            showType: 'slide'
+          });
+        }
+      }
+    });
+
+    jq_add_form.form({
+      url : module_router + '/add',
+      //url :'index.php?r=moonclub/xOrder/add',
+      onSubmit : function (param) {
+        var isValid = $(this).form('validate');
+        if (!isValid){
+          $.messager.progress('close');
+        }
+        return isValid;
+      },
+      success : function (res) {
+        $.messager.progress('close');
+        var res = JSON.parse(res);
+
+        if (res.success) {
+          $.messager.show({
+            title : '提示',
+            msg : '保存成功1',
+            timeout : 3500,
+            showType : 'slide'
+          });
+          $('#content_avatar_show').html('');
+          jq_add_dialog.dialog('close');
+          jq_add_dialog.form('clear');
+
+          jq_dg_content.datagrid('reload');
+        } else {
+          $.messager.show({
+            title : '提示',
+            msg : res.message,
+            timeout : 3500,
+            showType : 'slide'
+          });
+        }
+      }
+    });
+  });
+
+  function search_content(value = ''){
+    var search = value;
+    jq_dg_content.datagrid({
+      pageNum: 1,
+      queryParams: {
+        search : search,
+      }
+    });
+
+  };
+
+  function checkAddForm () {
+
+    return true;
+  }
+
+  function add_content(){
+    jq_add_dialog.dialog('open');
+  }
+  function   formatDate(now){
+    var   year=now.getFullYear();
+    var   month=now.getMonth()+1;
+    var   date=now.getDate();
+    var  hour = now.getHours();
+    var  minute = now.getMinutes();
+    return   year+"-"+month+"-"+date+" "+hour+":"+minute;
+  }
+  function save_content(){
+    $.messager.progress();
+    jq_content_form.submit();
+  }
+  function parse_time(data,attr){
+    if(data[attr]){
+      var d=new Date(data[attr]*1000);
+      return formatDate(d);
+    }else{
+      return '';
+    }
+  }
+  function   formatDate(now){
+    var   year=now.getFullYear();
+    var   month=now.getMonth()+1;
+    var   date=now.getDate();
+    var  hour = now.getHours();
+    var  minute = now.getMinutes();
+    return   year+"-"+month+"-"+date+" "+hour+":"+minute;
+  }
+  function add_extra(){
+    jq_edit_extra_dialog.dialog('open');
+  }
+  function parse_extra_item(extra,is_last,index){
+    return '<div data='+index+'>['+extra.type+'-'+extra.price+']'+'&nbsp;&nbsp;<a href="#"  class="del_extra">删除</a></div>';
+  }
+  function export_order() {
+    var start_time = $('#server_start_time').datebox('getValue');
+    var end_time = $('#server_end_time').datebox('getValue');
+    console.log(start_time);
+    if (!start_time && !end_time) {
+      alert('请选择时间');
+    } else {
+      window.location.href = module_router+'/OutputExcel&start_time='+start_time+'&end_time='+end_time;
+      $('#server_start_time').datebox('setValue','');
+      $('#server_end_time').datebox('setValue','');
+    }
+
+  }
+
+</script>

Some files were not shown because too many files changed in this diff