فهرست منبع

some bug fixes

theo 3 سال پیش
والد
کامیت
488d52744e

+ 10 - 0
common/helpers/user/Info.php

@@ -53,6 +53,16 @@ class Info {
         return $user ? $user['USER_NAME'] : null;
     }
 
+    /**
+     * 获取用户EMAIL
+     * @param $userName
+     * @return mixed
+     */
+    public static function getEmailByUserId($userId) {
+        $user = UserInfo::findOneAsArray('USER_ID=:USER_ID AND DELETED=0', [':USER_ID' => $userId], 'USER_NAME');
+        return $user ? $user['EMAIL'] : null;
+    }
+
     /**
      * 获取会员姓名通过ID
      * @param $userId

+ 3 - 3
common/models/Order.php

@@ -66,7 +66,7 @@ class Order extends \common\components\ActiveRecord
         return [
             [['USER_ID', 'USER_NAME', 'ORDER_TYPE', 'CREATE_USER', 'EMAIL'], 'required'],
             [['ORDER_AMOUNT', 'PV', 'PAY_AMOUNT', 'PAY_PV', 'FREIGHT', 'PAY_FREIGHT'], 'number'],
-            [['PAY_AT', 'DELIVERY_STATUS', 'DELIVERY_PERIOD', 'DELIVERY_AT', 'EXPRESS_TYPE', 'PERIOD_NUM', 'STATUS', 'PROVINCE', 'CITY', 'COUNTY', 'CREATED_AT', 'UPDATED_AT', 'IS_DELETE', 'DELETED_AT'], 'integer'],
+            [['PAY_AT', 'DELIVERY_STATUS', 'DELIVERY_PERIOD', 'DELIVERY_AT', 'EXPRESS_TYPE', 'PERIOD_NUM', 'STATUS', 'PROVINCE', /*'CITY', 'COUNTY', */'CREATED_AT', 'UPDATED_AT', 'IS_DELETE', 'DELETED_AT'], 'integer'],
             [['ID','SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO','PAY_TYPE'], 'string', 'max' => 32],
             [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE'], 'string', 'max' => 16],
             [['ORDER_TYPE'], 'string', 'max' => 12],
@@ -114,8 +114,8 @@ class Order extends \common\components\ActiveRecord
             'MOBILE' => '收货人手机',
             'TEL' => '固定电话',
             'PROVINCE' => '省份名称',
-            'CITY' => '城市名称',
-            'COUNTY' => '县区',
+//            'CITY' => '城市名称',
+//            'COUNTY' => '县区',
             'ADDRESS' => '详细地址',
             'P_CALC_MONTH' => '分区日期',
             'CREATED_AT' => '订单创建时间',

+ 9 - 5
common/models/forms/OrderForm.php

@@ -125,7 +125,7 @@ class OrderForm extends Model
             // 会员下单
             'userOrder' => ['type','addressId', 'payType','goodsId','goodsNum', 'remark', 'payPassword', 'email'],
             // 帮会员复消下单
-            'reconsumeOrder' => ['type','userName', 'payType','goodsId','goodsNum', 'remark', 'payPassword','consignee','acceptMobile','province','city','county','detailaddress'],
+            'reconsumeOrder' => ['type','userName', 'payType','goodsId','goodsNum', 'remark', 'payPassword','consignee','acceptMobile','province',/*'city','county',*/'detailaddress'],
             // 管理员修改订单状态
             'verifyPayStack' => ['sn', 'remark'],
             // 管理员退款
@@ -581,8 +581,10 @@ class OrderForm extends Model
         $orderModel->CONSIGNEE = $this->_address['CONSIGNEE'];
         $orderModel->MOBILE = $this->_address['MOBILE'];
         $orderModel->PROVINCE = $this->_address['PROVINCE'];
-        $orderModel->CITY = $this->_address['CITY'];
-        $orderModel->COUNTY = $this->_address['COUNTY'];
+//        $orderModel->CITY = $this->_address['CITY'];
+//        $orderModel->COUNTY = $this->_address['COUNTY'];
+        $orderModel->LGA_NAME = $this->_address['LGA_NAME'];
+        $orderModel->CITY_NAME = $this->_address['CITY_NAME'];
         $orderModel->ADDRESS = $this->_address['ADDRESS'];
         $orderModel->FRONT_REMARK = $this->remark;
         $orderModel->WAREHOUSE = $warehouse;
@@ -732,6 +734,7 @@ class OrderForm extends Model
         $loginUserName = Info::getUserNameByUserId($loginUserId);
         //订单会员Id
         $userId = Info::getUserIdByUserName($this->userName);
+        $email = Info::getEmailByUserId($this->userName);
 
         // 加入订单信息
         if($this->province!=1){
@@ -762,14 +765,15 @@ class OrderForm extends Model
         $orderModel->CONSIGNEE = $this->consignee;
         $orderModel->MOBILE = $this->acceptMobile;
         $orderModel->PROVINCE = $this->province;
-        $orderModel->CITY = $this->city;
-        $orderModel->COUNTY = $this->county;
+//        $orderModel->CITY = $this->city;
+//        $orderModel->COUNTY = $this->county;
         $orderModel->ADDRESS = $this->detailaddress;
         $orderModel->FRONT_REMARK = $this->remark;
         $orderModel->WAREHOUSE = $warehouse;
         $orderModel->STATUS = 1;
         $orderModel->CREATED_AT = Date::nowTime();
         $orderModel->CREATE_USER = $loginUserName;
+        $orderModel->EMAIL = $email?$email:'tt@qq.com';
         if(!$orderModel->save()){
             $this->addErrors($orderModel->getErrors());
             return false;

+ 21 - 16
common/models/forms/ShopGoodsForm.php

@@ -115,24 +115,29 @@ class ShopGoodsForm extends Model
      */
     public function beforeValidate()
     {
-        // 处理sellType
-        $categoryType = array_column(ShopGoods::CATEGORY_TYPE, NULL, 'id');
-        $sellType = $categoryType[$this->categoryType]['sell_type'] ?? [];
-        if (!$sellType) {
-            $this->addError('add', '商品购买方式错误');
-        } else {
-            foreach ($sellType as $item) {
-                if (!in_array($item['id'], array_keys(ShopGoods::SALE_TYPE))) {
-                    $this->addError('add', '商品购买方式错误');
-                    break;
+        if($this->categoryType){
+            // 处理sellType
+            $categoryType = array_column(ShopGoods::CATEGORY_TYPE, NULL, 'id');
+            $sellType = $categoryType[$this->categoryType]['sell_type'] ?? [];
+//            print_r($formModel);
+//            print_r($this);
+//            exit;
+            if (!$sellType) {
+                $this->addError('add', '商品购买方式错误');
+            } else {
+                foreach ($sellType as $item) {
+                    if (!in_array($item['id'], array_keys(ShopGoods::SALE_TYPE))) {
+                        $this->addError('add', '商品购买方式错误');
+                        break;
+                    }
                 }
-            }
 
-            // 购买方式格式化为','分割的方式
-            $this->sellType = implode(',', array_column($sellType, 'id'));
-            // 如果是普通商品,有PV,旅游、名车、豪宅商品没有PV
-            if ($this->categoryType != 1) {
-                $this->pricePv = 0;
+                // 购买方式格式化为','分割的方式
+                $this->sellType = implode(',', array_column($sellType, 'id'));
+                // 如果是普通商品,有PV,旅游、名车、豪宅商品没有PV
+                if ($this->categoryType != 1) {
+                    $this->pricePv = 0;
+                }
             }
         }
 

+ 2 - 4
frontendEle/src/views/layout/layout.vue

@@ -17,7 +17,7 @@
               <el-dropdown-item icon="el-icon-user" @click.native="onGo('/user/index')">Personal Information</el-dropdown-item><!--个人资料-->
               <!--<el-dropdown-item icon="el-icon-message" @click.native="onGo('/message/list')">站内信</el-dropdown-item>-->
 <!--              <el-dropdown-item icon="el-icon-setting" @click.native="onGo('/config/base')">个人设置</el-dropdown-item>-->
-              <el-dropdown-item icon="el-icon-switch-button" @click.native="onLogout">Loggoing Out</el-dropdown-item><!--安全退出-->
+              <el-dropdown-item icon="el-icon-switch-button" @click.native="onLogout">Logging Out</el-dropdown-item><!--安全退出-->
             </el-dropdown-menu>
           </el-dropdown>
         </div>
@@ -66,11 +66,9 @@
               </div>
             </transition>
           </li>
-
-
         </ul>
         <div style="text-align: right">
-          <el-button type="text" @click.native="onLogout">Loggoing Out</el-button><!--安全退出-->
+          <el-button type="text" @click.native="onLogout">Logging Out</el-button><!--安全退出-->
         </div>
       </el-header>
       <div :class="'breadcrumb-box '+menuClass">