Browse Source

Merge branch 'master' of http://git.huxiukeji.com/lizhen/xiaoshan

Panda 3 months ago
parent
commit
c39c4abc7b

+ 22 - 1
addons/shopro/controller/Cart.php

@@ -5,6 +5,7 @@ namespace addons\shopro\controller;
 use app\admin\model\shopro\Cart as CartModel;
 use app\admin\model\shopro\goods\Goods;
 use app\admin\model\shopro\goods\SkuPrice;
+use think\Db;
 
 class Cart extends Common
 {
@@ -12,6 +13,12 @@ class Cart extends Common
     protected $noNeedLogin = [];
     protected $noNeedRight = ['*'];
 
+    public function number(){
+        $user = auth_user();
+        $number = Db::name('shopro_cart')->where('user_id',$user['id'])->count();
+        $this->success(1,$number);
+    }
+
     public function index()
     {
         $user = auth_user();
@@ -38,7 +45,21 @@ class Cart extends Common
             $cart->sku_price->image = localpath_to_netpath($cart->sku_price->image);//规格图
         });
 
-        $this->success('获取成功', $carts);
+        $carts = json_decode(json_encode($carts),true);
+
+        $choose_price = 0;
+        foreach($carts as $key => $val){
+            if($val['choose'] == 1){
+                $choose_price = bcadd($choose_price,$val['sku_price']['price'],2);
+            }
+        }
+
+        $result = [
+            'choose_price' => $choose_price,
+            'list' => $carts,
+        ];
+
+        $this->success('获取成功', $result);
     }
 
 

+ 7 - 2
addons/shopro/controller/Coupon.php

@@ -57,10 +57,10 @@ class Coupon extends Common
             ->goods($goods)       // 符合指定商品,并且检测商品所属分类
             ->order('id', 'desc');
 
-        if ($user) {
+        /*if ($user) {
             // 关联用户优惠券
             $coupons = $coupons->with(['userCoupons']);
-        }
+        }*/
         $coupons = $coupons->select();
         
         $coupons = collection($coupons)->each(function ($coupon) {
@@ -68,6 +68,11 @@ class Coupon extends Common
             $coupon->get_status_text = $coupon->get_status_text;
         });
 
+        $coupons = json_decode(json_encode($coupons),true);
+        foreach($coupons as $key => $val){
+            unset($coupons[$key]['user_coupons']);
+        }
+
         $this->success('获取成功', $coupons);
     }
 

+ 16 - 7
addons/shopro/controller/goods/Comment.php

@@ -11,7 +11,7 @@ class Comment extends Common
     protected $noNeedLogin = ['index', 'getType'];
     protected $noNeedRight = ['*'];
 
-    public function index() 
+    public function index()
     {
         $params = $this->request->param();
         $type = $params['type'] ?? 'all';
@@ -23,12 +23,21 @@ class Comment extends Common
             $comments = $comments->{$type}();
         }
 
-        $comments = $comments->order('id', 'desc')->paginate(request()->param('list_rows', 10));
-            // ->each(function ($comment) {
-            //     if ($comment->user) {
-            //         $comment->user->nickname_hide = $comment->user->nickname_hide;
-            //     }
-            // })->toArray();
+        $comments = $comments->order('id', 'desc')
+//            ->paginate(request()->param('list_rows', 10));
+            ->autopage()->select();
+        $comments = json_decode(json_encode($comments),true);
+        $comments = list_domain_image($comments,['user_avatar']);
+        foreach($comments as $key => $val){
+            $val['images'] = array_domain_image($val['images']);
+
+            $comments[$key] = $val;
+        }
+        // ->each(function ($comment) {
+        //     if ($comment->user) {
+        //         $comment->user->nickname_hide = $comment->user->nickname_hide;
+        //     }
+        // })->toArray();
 
         // $data = $comments['data'];
         // foreach ($data as $key => &$comment) {

+ 3 - 5
addons/shopro/controller/goods/Goods.php

@@ -147,8 +147,6 @@ class Goods extends Common
                 $goods->original_goods_price = $goods->original_goods_price;
             }*/
 
-            $goods->activity = $goods->activity;
-
             $old_goods_price = $goods->original_goods_price;  //getOriginalGoodsPriceAttr
             $goods->old_goods_price = $old_goods_price ? $old_goods_price : $goods->price;
 
@@ -180,7 +178,7 @@ class Goods extends Common
         $skuPrices      = list_domain_image($skuPrices->toArray(),['image']);//规格图
 
 
-        $goods['current_sku'] = (object)[];
+        //$goods['current_sku'] = (object)[];
         foreach ($skuPrices as $key => $skuPrice) {
             //如果传过来规格id,那主图,price的第零个,original_goods_price的第零个  都需要跟着变
             if($goods_sku_price_id){
@@ -189,11 +187,11 @@ class Goods extends Common
                     $goods['price'][0] = $skuPrice['price'];
                     $goods['old_goods_price'][0] = $skuPrice['old_price'];
 
-                    $goods['current_sku'] = [
+                    /*$goods['current_sku'] = [
                         'id' => $skuPrice['id'],
                         'goods_sku_ids' => $skuPrice['goods_sku_ids'],
                         'goods_sku_text' => $skuPrice['goods_sku_text'],
-                    ];
+                    ];*/
                 }
 
             }

+ 2 - 2
addons/shopro/library/activity/ActivityRedis.php

@@ -183,9 +183,9 @@ class ActivityRedis
             }
 
             //倒计时
-            if(isset($activity['end_time'])){
+            /*if(isset($activity['end_time'])){
                 $activity['seconds'] = $activity['end_time'] - time();
-            }
+            }*/
         }
 
         return $activity ?? null;

+ 2 - 0
addons/shopro/library/activity/provider/Groupon.php

@@ -130,6 +130,8 @@ class Groupon extends Base
                     // 记录相关活动类型
                     $skuPrice->activity_type = $activity['type'];
                     $skuPrice->activity_id = $activity['id'];
+                    $skuPrice->activity_endtime = $activity['end_time'];
+                    $skuPrice->activity_seconds = $activity['end_time'] - time();
                     // 下单的时候需要存活动 的 sku_price_id)
                     $skuPrice->item_goods_sku_price = $activitySkuPrice;
                     break;

+ 2 - 0
addons/shopro/library/activity/provider/Kan.php

@@ -82,6 +82,8 @@ class Kan extends Base
                     // 记录相关活动类型
                     $skuPrice->activity_type = $activity['type'];
                     $skuPrice->activity_id = $activity['id'];
+                    $skuPrice->activity_endtime = $activity['end_time'];
+                    $skuPrice->activity_seconds = $activity['end_time'] - time();
                     // 下单的时候需要存活动 的 sku_price_id)
                     $skuPrice->item_goods_sku_price = $activitySkuPrice;
                     break;

+ 2 - 0
addons/shopro/library/activity/provider/Seckill.php

@@ -80,6 +80,8 @@ class Seckill extends Base
                     // 记录相关活动类型
                     $skuPrice->activity_type = $activity['type'];
                     $skuPrice->activity_id = $activity['id'];
+                    $skuPrice->activity_endtime = $activity['end_time'];
+                    $skuPrice->activity_seconds = $activity['end_time'] - time();
                     // 下单的时候需要存活动 的 sku_price_id)
                     $skuPrice->item_goods_sku_price = $activitySkuPrice;
                     break;

+ 2 - 2
application/admin/controller/shopro/goods/Goods.php

@@ -115,7 +115,7 @@ class Goods extends Common
         $params = $this->request->only([
             'type', 'title', 'subtitle', 'category_ids', 'image', 'images', 'image_wh', 'params',
             'original_price', 'price', 'is_sku', 'limit_type', 'limit_num', 'sales_show_type',
-            'stock_show_type', 'show_sales', 'service_ids', 'dispatch_type', 'dispatch_id', 'is_offline', 'status', 'weigh',
+            'stock_show_type', 'show_sales', 'service_ids', 'dispatch_type', 'dispatch_id', 'is_offline','yushou', 'status', 'weigh',
         ]);         // likes, views, sales,
         $params['content'] = $this->request->param('content', '', null);      // content 不经过全局过滤
         $this->svalidate($params, ".add");
@@ -183,7 +183,7 @@ class Goods extends Common
         $params = $this->request->only([
             'type', 'title', 'subtitle', 'image', 'images', 'image_wh', 'params',
             'original_price', 'price', 'is_sku', 'limit_type', 'limit_num', 'sales_show_type',
-            'stock_show_type', 'show_sales', 'service_ids', 'dispatch_type', 'dispatch_id', 'is_offline', 'status', 'weigh',
+            'stock_show_type', 'show_sales', 'service_ids', 'dispatch_type', 'dispatch_id', 'is_offline', 'yushou', 'status', 'weigh',
         ]);         // likes, views, sales,
         $this->request->has('content') && $params['content'] = $this->request->param('content', '', null);      // content 不经过全局过滤
         $this->svalidate($params);

+ 3 - 0
application/admin/view/shopro/goods/goods/add.html

@@ -788,6 +788,9 @@
                             <el-form-item label="货到付款">
                                 <el-switch v-model="form.model.is_offline" :active-value="1" :inactive-value="0"></el-switch>
                             </el-form-item>
+                            <el-form-item label="预售">
+                                <el-input class="sa-w-360" v-model="form.model.yushou" placeholder="例如:承诺12天内发货"></el-input>
+                            </el-form-item>
                         </template>
                         <template v-if="form.model.type=='virtual'">
                             <el-form-item label="配送方式">

+ 1 - 1
gitpull.sh

@@ -1,4 +1,4 @@
 sudo -uroot git reset --hard;
 sudo -uroot git pull;
-sudo -uroot chown -R www:www /www/wwwroot/xiaoshan.huxiukeji.cn;
+sudo -uroot chown -R www:www /www/wwwroot/xiaoshan;
 sudo -uroot chmod -R 777 *;

+ 1 - 0
public/assets/js/backend/shopro/goods/goods.js

@@ -411,6 +411,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             dispatch_type: 'express',
                             dispatch_id: '',
                             is_offline: 0,
+                            yushou: '',
                             is_sku: 0,
                             price: '',
                             original_price: 0,