WIN-2308041133\Administrator 4 months ago
parent
commit
b7930a5479

+ 6 - 0
app/admin/controller/store/StoreProduct.php

@@ -435,6 +435,12 @@ class StoreProduct extends AuthController
             Form::radio('is_new', '首发新品', $product->getData('is_new'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
             Form::radio('is_new', '首发新品', $product->getData('is_new'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
             Form::radio('is_postage', '是否包邮', $product->getData('is_postage'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
             Form::radio('is_postage', '是否包邮', $product->getData('is_postage'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
             Form::radio('is_good', '是否优品推荐', $product->getData('is_good'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
             Form::radio('is_good', '是否优品推荐', $product->getData('is_good'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
+            Form::radio('is_inclusive', '普惠商品', $product->getData('is_inclusive'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
+            Form::radio('is_points', '积分商品', $product->getData('is_points'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
+            Form::radio('is_explosive', '报单商品', $product->getData('is_explosive'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
+            Form::radio('is_health', '健康专区', $product->getData('is_health'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
+            Form::radio('is_life', '生活专区', $product->getData('is_life'))->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]])->col(8),
+
         ];
         ];
         $form = Form::make_post_form('编辑产品', $field, Url::buildUrl('update', array('id' => $id)), 2);
         $form = Form::make_post_form('编辑产品', $field, Url::buildUrl('update', array('id' => $id)), 2);
         $this->assign(compact('form'));
         $this->assign(compact('form'));

+ 81 - 1
app/admin/view/store/store_product/create.php

@@ -916,6 +916,81 @@
                                             </div>
                                             </div>
                                         </div>
                                         </div>
                                     </div>
                                     </div>
+                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">普惠商品</label>
+                                                <div class="layui-input-block">
+                                                    <input type="radio" name="is_inclusive" lay-filter="is_inclusive" value="1"
+                                                           title="开启"
+                                                           :checked="formData.is_inclusive == 1 ? true : false">
+                                                    <input type="radio" name="is_inclusive" lay-filter="is_inclusive" value="0"
+                                                           title="关闭"
+                                                           :checked="formData.is_inclusive == 0 ? true : false">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">积分商品</label>
+                                                <div class="layui-input-block">
+                                                    <input type="radio" name="is_points" lay-filter="is_points" value="1"
+                                                           title="开启"
+                                                           :checked="formData.is_points == 1 ? true : false">
+                                                    <input type="radio" name="is_points" lay-filter="is_points" value="0"
+                                                           title="关闭"
+                                                           :checked="formData.is_points == 0 ? true : false">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">报单商品</label>
+                                                <div class="layui-input-block">
+                                                    <input type="radio" name="is_explosive" lay-filter="is_explosive" value="1"
+                                                           title="开启"
+                                                           :checked="formData.is_explosive == 1 ? true : false">
+                                                    <input type="radio" name="is_explosive" lay-filter="is_explosive" value="0"
+                                                           title="关闭"
+                                                           :checked="formData.is_explosive == 0 ? true : false">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">健康专区</label>
+                                                <div class="layui-input-block">
+                                                    <input type="radio" name="is_health" lay-filter="is_health" value="1"
+                                                           title="开启"
+                                                           :checked="formData.is_health == 1 ? true : false">
+                                                    <input type="radio" name="is_health" lay-filter="is_health" value="0"
+                                                           title="关闭"
+                                                           :checked="formData.is_health == 0 ? true : false">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">生活专区</label>
+                                                <div class="layui-input-block">
+                                                    <input type="radio" name="is_life" lay-filter="is_life" value="1"
+                                                           title="开启"
+                                                           :checked="formData.is_life == 1 ? true : false">
+                                                    <input type="radio" name="is_life" lay-filter="is_life" value="0"
+                                                           title="关闭"
+                                                           :checked="formData.is_life == 0 ? true : false">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
 <!--                                    <div class="layui-row layui-col-space15">-->
 <!--                                    <div class="layui-row layui-col-space15">-->
 <!--                                        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">-->
 <!--                                        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">-->
 <!--                                            <div class="grid-demo grid-demo-bg1">-->
 <!--                                            <div class="grid-demo grid-demo-bg1">-->
@@ -1028,6 +1103,11 @@
                 is_best: 0,
                 is_best: 0,
                 is_new: 0,
                 is_new: 0,
                 is_good: 0,
                 is_good: 0,
+                is_inclusive: 0,
+                is_points: 0,
+                is_explosive: 0,
+                is_health: 0,
+                is_life: 0,
                 store_type: 1,
                 store_type: 1,
                 is_sub: 0,
                 is_sub: 0,
                 items: [
                 items: [
@@ -1067,7 +1147,7 @@
             activity: {'秒杀': '#1E9FFF', '砍价': '#189688', '拼团': '#FEB900'},
             activity: {'秒杀': '#1E9FFF', '砍价': '#189688', '拼团': '#FEB900'},
             attr: [],//临时属性
             attr: [],//临时属性
             newRule: false,//是否添加新规则
             newRule: false,//是否添加新规则
-            radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best', 'spec_type'],//radio 当选规则
+            radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best','is_inclusive','is_points','is_explosive','is_health','is_life', 'spec_type'],//radio 当选规则
             rule: { //多图选择规则
             rule: { //多图选择规则
                 slider_image: {
                 slider_image: {
                     maxLength: 5
                     maxLength: 5

+ 2 - 1
app/api/controller/store/StoreProductController.php

@@ -46,7 +46,8 @@ class StoreProductController
             ['news', 0],
             ['news', 0],
             ['page', 0],
             ['page', 0],
             ['limit', 0],
             ['limit', 0],
-            ['type', 0]
+            ['type', 0],
+            ['is_type',0]
         ], $request);
         ], $request);
         return app('json')->successful(StoreProduct::getProductList($data, $request->uid()));
         return app('json')->successful(StoreProduct::getProductList($data, $request->uid()));
     }
     }

+ 2 - 0
app/models/store/StoreOrder.php

@@ -409,6 +409,8 @@ class StoreOrder extends BaseModel
             }
             }
             if (!$res2) return self::setErrorInfo('使用积分抵扣失败!', true);
             if (!$res2) return self::setErrorInfo('使用积分抵扣失败!', true);
             if ($payPrice <= 0) $payPrice = 0;
             if ($payPrice <= 0) $payPrice = 0;
+
+
             if ($test) {
             if ($test) {
                 self::rollbackTrans();
                 self::rollbackTrans();
                 return [
                 return [

+ 25 - 4
app/models/store/StoreProduct.php

@@ -93,6 +93,7 @@ class StoreProduct extends BaseModel
         $page = $data['page'];
         $page = $data['page'];
         $limit = $data['limit'];
         $limit = $data['limit'];
         $type = $data['type']; // 某些模板需要购物车数量 1 = 需要查询,0 = 不需要
         $type = $data['type']; // 某些模板需要购物车数量 1 = 需要查询,0 = 不需要
+        $is_type = $data['is_type'];  //特殊商品类型
         $model = self::validWhere();
         $model = self::validWhere();
         if ($sId) {
         if ($sId) {
             $model->whereIn('id', function ($query) use ($sId) {
             $model->whereIn('id', function ($query) use ($sId) {
@@ -107,6 +108,26 @@ class StoreProduct extends BaseModel
         }
         }
         if (!empty($keyword)) $model->where('keyword|store_name', 'LIKE', htmlspecialchars("%$keyword%"));
         if (!empty($keyword)) $model->where('keyword|store_name', 'LIKE', htmlspecialchars("%$keyword%"));
         if ($news != 0) $model->where('is_new', 1);
         if ($news != 0) $model->where('is_new', 1);
+        if ($is_type != 0) {
+            switch ($is_type) {
+                case 1:
+                    $model->where('is_inclusive', 1); //普惠商品
+                    break;
+                case 2:
+                    $model->where('is_points', 1);  //积分商品
+                    break;
+                case 3:
+                    $model->where('is_explosive', 1); //报单商品
+                    break;
+                case 4:
+                    $model->where('is_bargain', 1);  //健康商品
+                    break;
+                case 5:
+                    $model->where('is_seckill', 1);  //生活商品
+                    break;
+
+            }
+        }
         $baseOrder = '';
         $baseOrder = '';
         if ($priceOrder) $baseOrder = $priceOrder == 'desc' ? 'price DESC' : 'price ASC';
         if ($priceOrder) $baseOrder = $priceOrder == 'desc' ? 'price DESC' : 'price ASC';
 //        if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';//真实销量
 //        if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';//真实销量
@@ -289,22 +310,22 @@ class StoreProduct extends BaseModel
                 return $isSingle ? $list : 0;
                 return $isSingle ? $list : 0;
         //当$list为数组时$isSingle==true为一维数组 ,否则为二维
         //当$list为数组时$isSingle==true为一维数组 ,否则为二维
         if ($isSingle) {
         if ($isSingle) {
-            if (!empty($list['is_inclusive'])&&!empty($list['is_points'])&&!empty($list['is_explosive'])){
+            if (!empty($list['is_inclusive']) && !empty($list['is_points']) && !empty($list['is_explosive'])) {
                 if ($list['is_inclusive'] == 0 && $list['is_points'] == 0 && $list['is_explosive'] == 0) {
                 if ($list['is_inclusive'] == 0 && $list['is_points'] == 0 && $list['is_explosive'] == 0) {
                     $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
                     $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
                 }
                 }
-            }else{
+            } else {
                 $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
                 $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
             }
             }
 
 
         } else {
         } else {
             foreach ($list as &$item) {
             foreach ($list as &$item) {
-                if (!empty($list['is_inclusive'])&&!empty($list['is_points'])&&!empty($list['is_explosive'])){
+                if (!empty($list['is_inclusive']) && !empty($list['is_points']) && !empty($list['is_explosive'])) {
                     if ($item['is_inclusive'] == 0 && $item['is_points'] == 0 && $item['is_explosive'] == 0) {
                     if ($item['is_inclusive'] == 0 && $item['is_points'] == 0 && $item['is_explosive'] == 0) {
 //                @file_put_contents('quanju.txt',  json_encode($item)."-5\r\n", 8);
 //                @file_put_contents('quanju.txt',  json_encode($item)."-5\r\n", 8);
                         $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
                         $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
                     }
                     }
-                }else{
+                } else {
                     $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
                     $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
                 }
                 }
             }
             }