root пре 3 година
родитељ
комит
ddb97657f9
2 измењених фајлова са 89 додато и 69 уклоњено
  1. 87 67
      common/models/forms/DeclarationForm.php
  2. 2 2
      frontendEle/src/views/user/dec.vue

+ 87 - 67
common/models/forms/DeclarationForm.php

@@ -131,39 +131,39 @@ class DeclarationForm extends Model
     public function attributeLabels()
     {
         return [
-            'type' => '报单类型',
-            'decLv' => '报单级别',
+            'type' => 'Entry type',//报单类型
+            'decLv' => 'Entry level',//报单级别
             //'decPv' => '报单PV',
-            'decWay' => '报单方式',
-            'packageId' => '报单套餐',
-            'goodsId' => '商品ID',
-            'goodsNum' => '商品数量',
+            'decWay' => 'Entry method',//报单方式
+            'packageId' => 'Entry Package',//报单套餐
+            'goodsId' => 'product ID',//商品ID
+            'goodsNum' => 'Product quantity',//商品数量
             //'addType' => '新增会员方式',
-            'insertUserName' => '会员用户名',
-            'password' => '登陆密码',
-            'payPassword' => '支付密码',
-            'realName' => '会员姓名',
-            'insertUserIdCard' => '身份证号',
-            'mobile' => '手机号',
-            'address' => '地址',
-            'openBank' => '开户行',
-            'bankAddress' => '开户支行',
-            'bankNo' => '银行账号',
-            'bankProvince' => '银行省份',
-            'bankCity' => '银行城市',
-            'bankCounty' => '银行县区',
-            'conUserName' => '指导老师用户名',
-            'recUserName' => '开拓人用户名',
-            'decUserName' => '报单中心用户名',
-            'conUid' => '指导老师会员ID',
-            'recUid' => '开拓人会员ID',
-            'location' => '市场',
-            'consignee' => '收货人',
-            'acceptMobile' => '收货人手机',
-            'province' => '收货省',
-            'city' => '收货市',
-            'county' => '收货区县',
-            'address' => '收货详细地址',
+            'insertUserName' => 'Member user name',//会员用户名
+            'password' => 'Login password',//登陆密码
+            'payPassword' => 'Payment password',//支付密码
+            'realName' => 'Member name',//会员姓名
+            'insertUserIdCard' => 'ID',//身份证号
+            'mobile' => 'phone number',//手机号
+            'address' => 'address',//地址
+            'openBank' => 'openBank',//开户行
+            'bankAddress' => 'bankAddress',//开户支行
+            'bankNo' => 'bankNo',//银行账号
+            'bankProvince' => 'bankProvince',//银行省份
+            'bankCity' => 'bankCity',//银行城市
+            'bankCounty' => 'bankCounty',//银行县区
+            'conUserName' => 'Instructor user name',//指导老师用户名
+            'recUserName' => 'Developer user name',//开拓人用户名
+            'decUserName' => 'Entry center user name',//报单中心用户名
+            'conUid' => 'Instructor member ID',//指导老师会员ID
+            'recUid' => 'Pioneer member ID',//'开拓人会员ID
+            'location' => 'market',//市场
+            'consignee' => 'consignee',//收货人
+            'acceptMobile' => 'Consignee is mobile phone',//收货人手机
+            'province' => 'Receiving Province',//收货省
+            'city' => 'Receiving City',//收货市
+            'county' => 'Receiving area / county',//收货区县
+            'address' => 'Receiving detailed address',//收货详细地址
         ];
     }
 
@@ -188,7 +188,7 @@ class DeclarationForm extends Model
      */
     public function issetDec($attribute){
         if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
-            $this->addError($attribute, '报单中心不存在');
+            $this->addError($attribute, 'Entry center does not exist');//报单中心不存在
             return false;
         } else {
             // 判断报单中心是否在新加入会员的安置网上级中
@@ -200,7 +200,8 @@ class DeclarationForm extends Model
 //            echo $this->insertUserName.'=='.$this->decUserName;
 //            exit;
             if (!isset($flipParent[$this->decUserName])) {
-                $this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                $this->addError($attribute, 'To' . $this->insertUserName . 'Entry,Entry Center' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
                 return ;
             }
             $this->_decId = $decUser['ID'];
@@ -218,9 +219,11 @@ class DeclarationForm extends Model
                 $conUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->conUserName]);
                 if(!$conUserTemp){
                     if($this->insertUserName){
-                        $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'不存在');
+                        //$this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'不存在');
+                        $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Instructor'.$this->conUserName.'not in exist');
                     } else {
-                        $this->addError($attribute, '指导老师'.$this->conUserName.'不存在');
+                        //$this->addError($attribute, '指导老师'.$this->conUserName.'不存在');
+                        $this->addError($attribute, 'Instructor'.$this->conUserName.'not in exist');
                     }
                     return ;
                 }
@@ -245,9 +248,11 @@ class DeclarationForm extends Model
             // 判断接点会员的下级会员是否大于三个,如果大于三个则不允许
             if($conUser['CON_NUM'] >= 3){
                 if($this->insertUserName){
-                    $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
+                   // $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
+                    $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Instructor'.$this->conUserName.'lower level is full');
                 } else {
-                    $this->addError($attribute, '指导老师'.$this->conUserName.'下级点位已满');
+                    //$this->addError($attribute, '指导老师'.$this->conUserName.'下级点位已满');
+                    $this->addError($attribute, 'Instructor'.$this->conUserName.'lower level is full');
                 }
                 return;
             }
@@ -284,9 +289,11 @@ class DeclarationForm extends Model
                 $recUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->recUserName]);
                 if(!$recUserTemp){
                     if($this->insertUserName){
-                        $this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
+                        //$this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
+                        $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Pioneer'.$this->recUserName.'not in exist');
                     } else {
-                        $this->addError($attribute, '开拓人'.$this->recUserName.'不存在');
+                       // $this->addError($attribute, '开拓人'.$this->recUserName.'不存在');
+                        $this->addError($attribute, 'Pioneer'.$this->recUserName.'not in exist');
                     }
 
                     return ;
@@ -315,7 +322,8 @@ class DeclarationForm extends Model
             if($this->insertUserName) {
                 $this->loopFindParentToNetwork($this->insertUserName);
                 if (!$this->recUserIsInNetworkParent()) {
-                    $this->addError($attribute, '为' . $this->insertUserName . '报单,开拓人' . $this->recUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                   // $this->addError($attribute, '为' . $this->insertUserName . '报单,开拓人' . $this->recUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry,Pioneer' . $this->recUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
                     return ;
                 }
             }
@@ -360,7 +368,8 @@ class DeclarationForm extends Model
         // 如果没有这个新加入的接点,
         else {
             if($this->insertUserName == $conUserName){
-                $this->addError('recUserName', '新加入的会员不存在');
+               // $this->addError('recUserName', '新加入的会员不存在');
+                $this->addError('recUserName', 'New member does not exist');
                 return false;
             }
             // 去数据库里查找这个会员的所有上级
@@ -400,7 +409,8 @@ class DeclarationForm extends Model
     public function isLocation($attribute){
         if($this->type == self::TYPE_ZC){
             if(!in_array($this->location, [1, 2, 3])){
-                $this->addError($attribute, '市场必须在第1市场、第2市场或第三3市场');
+                //$this->addError($attribute, '市场必须在第1市场、第2市场或第三3市场');
+                $this->addError($attribute, 'Please select a market');
             }
             $conUser = $recUser = null;
             if(isset($this->_tempParentUser[$this->conUserName])){
@@ -413,9 +423,11 @@ class DeclarationForm extends Model
                 // 判断指导老师相应的区位是否已满
                 if($conUser['LOCATION'.$this->location]){
                     if($this->insertUserName){
-                        $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'的第'.$this->location.'市场已存在会员');
+                       // $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'的第'.$this->location.'市场已存在会员');
+                        $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Instructor'.$this->conUserName.'the'.($this->location == 1 ? 'left' : 'regiht').' superior already existing member');
                     } else {
-                        $this->addError($attribute, '指导老师'.$this->conUserName.'的第'.$this->location.'市场已存在会员');
+                       // $this->addError($attribute, '指导老师'.$this->conUserName.'的第'.$this->location.'市场已存在会员');
+                        $this->addError($attribute, 'Instructor'.$this->conUserName.'the'.($this->location == 1 ? 'left' : 'regiht').'superior already existing member');
                     }
                     return;
                 }
@@ -452,7 +464,8 @@ class DeclarationForm extends Model
             if(!isset($this->_tempParentUser[$this->conUserName])){
                 $conUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->conUserName]);
                 if(!$conUserTemp){
-                    $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'不存在');
+//                    $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'不存在');
+                    $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Instructor'.$this->conUserName.'not in exist');
                     return ;
                 }
                 $conUserTemp['CON_NUM'] = UserNetwork::firstFloorChildNum($conUserTemp['USER_ID']);
@@ -478,7 +491,8 @@ class DeclarationForm extends Model
             if(!isset($this->_tempParentUser[$this->recUserName])){
                 $recUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->recUserName]);
                 if(!$recUserTemp){
-                    $this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
+//                    $this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
+                    $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Pioneer'.$this->recUserName.'not in exist');
                     return ;
                 }
                 $recUserTemp['CON_NUM'] = UserNetwork::firstFloorChildNum($recUserTemp['USER_ID']);
@@ -502,12 +516,14 @@ class DeclarationForm extends Model
 
             // 判断接点会员的下级会员是否大于三个,如果大于三个则不允许
             if($conUser['CON_NUM'] >= 3){
-                $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
+//                $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
+                $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Pioneer'.$this->conUserName.'lower level is full');
                 return;
             }
             // 判断指导老师相应的区位是否已满
             if($conUser['LOCATION'.$this->location]){
-                $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'该市场已存在会员');
+//                $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'该市场已存在会员');
+                $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Pioneer'.$this->conUserName.'Members already exist in this market');
                 return;
             }
 //            if($conUser['CON_NUM'] == 0 && $this->location != 1){
@@ -548,16 +564,16 @@ class DeclarationForm extends Model
         if(array_key_exists($this->type, $this->_types)){
             if($this->type == self::TYPE_ZC){
                 if($this->scenario == 'userDec'){
-                    if(!$this->insertUserName) $this->addError($attribute, '首购必须填写加入会员编号');
+                    if(!$this->insertUserName) $this->addError($attribute, 'Membership number must be filled in for initial purchase');//首购必须填写加入会员编号
                 }
-                if(!$this->insertUserName) $this->addError($attribute, '首购必须填写加入会员编号');
-                if(!$this->insertUserIdCard) $this->addError($attribute, '首购必须填写加入会员的身份证号');
-                if(!$this->conUserName) $this->addError($attribute, '首购必须填写加入会员的指导老师编号');
-                if(!$this->recUserName) $this->addError($attribute, '首购必须填写加入会员的开拓人编号');
-                if(!$this->location) $this->addError($attribute, '首购必须填写加入会员的市场');
+                if(!$this->insertUserName) $this->addError($attribute, 'Membership number must be filled in for initial purchase');//首购必须填写加入会员编号
+                if(!$this->insertUserIdCard) $this->addError($attribute, 'For the first purchase, the ID number of the member must be filled in');//首购必须填写加入会员的身份证号
+                if(!$this->conUserName) $this->addError($attribute, 'For the first purchase, you must fill in the instructor number of the member');//首购必须填写加入会员的指导老师编号
+                if(!$this->recUserName) $this->addError($attribute, 'For the first purchase, the pioneer number of the member must be filled in');//首购必须填写加入会员的开拓人编号
+                if(!$this->location) $this->addError($attribute, 'The first purchase must be filled in the market of the member');//首购必须填写加入会员的市场
             }
         } else {
-            $this->addError($attribute, '报单类型不正确');
+            $this->addError($attribute, 'Incorrect entry type');//报单类型不正确
         }
     }
 
@@ -570,7 +586,7 @@ class DeclarationForm extends Model
             // 新加入会员的身份证号对应网内的其他会员
             $otherUser = User::findAllAsArray("ID_CARD=:ID_CARD AND IS_UNION=0 AND DELETED=0 AND (ID_CARD_PREFIX IS NULL OR ID_CARD_PREFIX='')", [':ID_CARD'=>$this->insertUserIdCard]);
             if(count($otherUser)>=7){
-                $this->addError($attribute, '同一个身份证限制只能报7单');
+                $this->addError($attribute, 'Only 7 documents can be reported for the same ID card');//同一个身份证限制只能报7单
             }
             if($otherUser){
                 $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
@@ -582,12 +598,14 @@ class DeclarationForm extends Model
                     }
                 }
                 if (!$isExsit) {
-                    $this->addError($attribute, '为' . $this->insertUserName . '报单,身份证号码相同的会员'.$otherUser[0]['USER_NAME'].'不在' . $this->insertUserName . '的安置网上级中');
+//                    $this->addError($attribute, '为' . $this->insertUserName . '报单,身份证号码相同的会员'.$otherUser[0]['USER_NAME'].'不在' . $this->insertUserName . '的安置网上级中');
+                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry,Members with the same ID number'.$otherUser[0]['USER_NAME'].'not in exist' . $this->insertUserName . 'in the placement superiors');
                     return ;
                 }
             }
         } else {
-            $this->addError($attribute, '为'.$this->insertUserName.'报单,接点人'.$this->conUserName.'不存在');
+//            $this->addError($attribute, '为'.$this->insertUserName.'报单,接点人'.$this->conUserName.'不存在');
+            $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Contact person'.$this->conUserName.'not in exist');
         }
     }
 
@@ -606,14 +624,14 @@ class DeclarationForm extends Model
         // 首购单,需要添加会员操作
         if($this->type == self::TYPE_ZC){
             if (preg_match("/[\x7f-\xff]/", $this->insertUserName)) {  //判断字符串中是否有中文
-                throw new Exception('会员编号中不能含有汉字');
+                throw new Exception('Member number cannot contain Chinese characters');//会员编号中不能含有汉字
             }
             //报单商品及PV判断
             $decLevelConfig = Cache::getDecLevelConfig();
             $decLevel = $decLevelConfig[$this->decLv];
             $toDecLevel = $this->decLv;
             if(!$this->decLv){
-                throw new Exception('请选择报单级别');
+                throw new Exception('Please select the entry level');//请选择报单级别
             }
             if($this->decWay==1) {
                 $decPackage = DeclarationPackage::findOneAsArray('ID=:ID', [':ID'=>$this->packageId]);
@@ -656,7 +674,7 @@ class DeclarationForm extends Model
                     }
                 }
                 if($totalPv<$decLevel['PERF']){
-                    throw new Exception('自选商品总PV不能小于所选报单级别PV');
+                    throw new Exception('The total BV of self selected goods cannot be less than the BV of the selected entry level');//自选商品总BV不能小于所选报单级别BV
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($totalPv>=$val['PERF']){
@@ -664,7 +682,7 @@ class DeclarationForm extends Model
                     }
                 }
                 if($this->decLv!=$toDecLevel){
-                    throw new Exception('自选商品总PV不能超过已选级别下一个级别的PV值');
+                    throw new Exception('The total BV of self selected goods cannot exceed the BV value of the next level under the selected level');//自选商品总BV不能超过已选级别下一个级别的BV值
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;
@@ -672,7 +690,7 @@ class DeclarationForm extends Model
             //看现金余额是否充足
             $loginUserId = \Yii::$app->user->id;
             if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
-                throw new Exception('报单人现金不足,无法完成报单');
+                throw new Exception('The applicant is short of cash and cannot complete the declaration');//报单人现金不足,无法完成报单
             }
 
             if(!($zcResult = $this->addUser($allData))) {
@@ -703,7 +721,7 @@ class DeclarationForm extends Model
         $user->ID_CARD = $this->insertUserIdCard;
         $user->MOBILE = $this->mobile;
         $user->EMAIL = $this->email;
-        $user->ADDRESS = $this->address ? $this->address : '无';
+        $user->ADDRESS = $this->address ? $this->address : 'nothing';//无
         $user->OPEN_BANK = $this->openBank;
         $user->BANK_ADDRESS = $this->bankAddress;
         $user->BANK_NO = $this->bankNo;
@@ -794,7 +812,7 @@ class DeclarationForm extends Model
         if($this->province!=1){
             $warehouse = Region::getWarehouseByCode($this->province);//仓库
             if(!$warehouse){
-                throw new Exception('地区暂时不支持配送,具体联系客服');
+                throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');//地区暂时不支持配送,具体联系客服
             }
         }else{
             $warehouse = '01';
@@ -859,7 +877,8 @@ class DeclarationForm extends Model
                 throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
             }
             //扣报单人现金钱包
-            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'报单']);
+//            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'报单']);
+            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'To'.$this->insertUserName.'Entry']);
             return $addressModel;
         }else{
             $addressModel = new ReceiveAddress();
@@ -887,7 +906,8 @@ class DeclarationForm extends Model
             }
             // 如果是复销单的话,还需要考虑给会员的复销池减去金额
             elseif($this->type == self::TYPE_FX){
-                Reconsume::changePoolPV($oneOrder['TO_USER_ID'], -abs($oneOrder['DEC_PV']), ['REMARK'=>'删单扣除', 'DEAL_TYPE'=>Reconsume::TYPE_AUDIT_PV]);
+//                Reconsume::changePoolPV($oneOrder['TO_USER_ID'], -abs($oneOrder['DEC_PV']), ['REMARK'=>'删单扣除', 'DEAL_TYPE'=>Reconsume::TYPE_AUDIT_PV]);
+                Reconsume::changePoolPV($oneOrder['TO_USER_ID'], -abs($oneOrder['DEC_PV']), ['REMARK'=>'Deletion deduction', 'DEAL_TYPE'=>Reconsume::TYPE_AUDIT_PV]);
             }
             $transaction->commit();
         } catch (Exception $e) {

+ 2 - 2
frontendEle/src/views/user/dec.vue

@@ -133,8 +133,8 @@
                 <el-form-item label="Placement tree"><!--安置区位-->
                     <el-radio-group v-model="form.location">
                         <el-radio-button :label="1">Left</el-radio-button><!--左区-->
-                        <!-- <el-radio-button :label="2">Middle</el-radio-button> --><!--中区-->
-                        <el-radio-button :label="3">Right</el-radio-button><!--右区-->
+                        <el-radio-button :label="2">Right</el-radio-button><!--中区-->
+                      <!--  <el-radio-button :label="3">Right</el-radio-button> --><!--右区-->
                     </el-radio-group>
                 </el-form-item>