WIN-2308041133\Administrator 1 月之前
父节点
当前提交
8d4243222d

+ 5 - 30
app/admin/view/store/store_product/create.php

@@ -429,14 +429,11 @@
                                                 <div class="layui-form-item rules">
                                                     <label class="layui-form-label"></label>
                                                         <button type="button"
-                                                                :class="{'layui-btn-primary': !(item.specialDetail && item.specialDetail[val]), 'layui-btn-danger': (item.specialDetail && item.specialDetail[val])}"
-                                                                class="layui-btn layui-btn-sm"
-                                                                v-for="(val,inx) in item.detail"
-                                                                @click="toggleSpecial(item, val)">
+                                                                class="layui-btn layui-btn-primary layui-btn-sm"
+                                                                v-for="(val,inx) in item.detail">
                                                             {{val}}
-                                                            <span v-if="item.specialDetail && item.specialDetail[val]" style="margin-left:2px;font-size:10px">特供</span>
                                                             <i class="layui-icon layui-icon-close"
-                                                               @click.stop="deleteValue(item,inx)"></i>
+                                                               @click="deleteValue(item,inx)"></i>
                                                         </button>
                                                     <div class="rules rulesBox">
                                                         <div class="rules-btn-sm">
@@ -1169,8 +1166,7 @@
                     //     value: '',
                     //     detailValue:'',
                     //     attrHidden:false,
-                    //     detail:[],
-                    //     specialDetail:{} //{value: true} 标记特供规格值
+                    //     detail:[]
                     // }
                 ],
                 activity: ['秒杀', '砍价', '拼团'],
@@ -1488,20 +1484,6 @@
                 }
                 item.detail.push(item.detailValue);
                 item.detailValue = '';
-                if (!item.specialDetail) this.$set(item, 'specialDetail', {});
-            },
-            /**
-             * 切换规格值特供状态
-             * @param item 规格对象
-             * @param val 规格值
-             */
-            toggleSpecial: function (item, val) {
-                if (!item.specialDetail) this.$set(item, 'specialDetail', {});
-                if (item.specialDetail[val]) {
-                    this.$set(item.specialDetail, val, false);
-                } else {
-                    this.$set(item.specialDetail, val, true);
-                }
             },
             /**
              * 删除某个属性值
@@ -1510,12 +1492,7 @@
              * */
             deleteValue: function (item, inx) {
                 if (item.detail.length > 1) {
-                    var oldVal = item.detail[inx];
                     item.detail.splice(inx, 1);
-                    // 清理该值的特供标记
-                    if (item.specialDetail && item.specialDetail[oldVal]) {
-                        this.$delete(item.specialDetail, oldVal);
-                    }
                 } else {
                     return this.showMsg('请设置至少一个属性');
                 }
@@ -1571,8 +1548,7 @@
                         value: this.formDynamic.attrsName,
                         detailValue: '',
                         attrHidden: false,
-                        detail: [this.formDynamic.attrsVal],
-                        specialDetail: {}
+                        detail: [this.formDynamic.attrsVal]
                     });
                     this.formDynamic.attrsName = '';
                     this.formDynamic.attrsVal = '';
@@ -2028,7 +2004,6 @@
                     if (rule) {
                         this.ruleBool = true;
                         var rule_value = rule.rule_value.map(function (item) {
-                            item.specialDetail = item.specialDetail || {};
                             return item;
                         });
                         this.$set(this.formData, 'items', rule_value);

+ 0 - 39
app/api/controller/store/StoreProductController.php

@@ -141,45 +141,6 @@ class StoreProductController
         $storeInfo['userCollect'] = StoreProductRelation::isProductRelation($id, $uid, 'collect');
         $storeInfo['userLike'] = StoreProductRelation::isProductRelation($id, $uid, 'like');
         list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $uid, $type);
-
-        // 特供规格过滤:非经销商用户隐藏特供规格值
-        $isDealer = $uid ? (User::where('uid', $uid)->value('dealer') > 0) : false;
-        if (!$isDealer) {
-            // 收集所有特供规格值
-            $specialValues = [];
-            foreach ($productAttr as $attrGroup) {
-                foreach ($attrGroup['attr_value'] as $av) {
-                    if (!empty($av['is_special'])) {
-                        $specialValues[] = $av['attr'];
-                    }
-                }
-            }
-            // 过滤 productValue:移除包含特供值的SKU
-            if (!empty($specialValues)) {
-                foreach ($productValue as $suk => $value) {
-                    foreach ($specialValues as $sv) {
-                        if (in_array($sv, explode(',', $suk))) {
-                            unset($productValue[$suk]);
-                            break;
-                        }
-                    }
-                }
-                // 过滤 productAttr:移除特供规格值
-                foreach ($productAttr as $k => $attrGroup) {
-                    $newAttrValues = [];
-                    $newAttrValue = [];
-                    foreach ($attrGroup['attr_value'] as $av) {
-                        if (empty($av['is_special'])) {
-                            $newAttrValues[] = $av['attr'];
-                            $newAttrValue[] = $av;
-                        }
-                    }
-                    $productAttr[$k]['attr_values'] = $newAttrValues;
-                    $productAttr[$k]['attr_value'] = $newAttrValue;
-                }
-            }
-        }
-
         StoreVisit::setView($uid, $id, $storeInfo['cate_id'], 'viwe');
         $data['storeInfo'] = StoreProduct::setLevelPrice($storeInfo, $uid, true);
         $data['similarity'] = StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'], 'id,store_name,image,price,sales,ficti', 4);

+ 0 - 19
app/models/store/StoreProductAttr.php

@@ -59,31 +59,12 @@ class StoreProductAttr extends BaseModel
             $values[$value['suk']] = $value;
         }
 
-        // 读取特供规格标记
-        $specialValueMap = [];
-        $resultData = Db::name('StoreProductAttrResult')->where('product_id', $productId)->where('type', $type_id)->value('result');
-        if ($resultData) {
-            $resultJson = json_decode($resultData, true);
-            if (isset($resultJson['attr']) && is_array($resultJson['attr'])) {
-                foreach ($resultJson['attr'] as $attrItem) {
-                    if (isset($attrItem['specialDetail']) && is_array($attrItem['specialDetail'])) {
-                        foreach ($attrItem['specialDetail'] as $specVal => $isSpecial) {
-                            if ($isSpecial) {
-                                $specialValueMap[trim($specVal)] = true;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
         foreach ($attrDetail as $k=>$v){
             $attr = $v['attr_values'];
 //            unset($productAttr[$k]['attr_values']);
             foreach ($attr as $kk=>$vv){
                 $attrDetail[$k]['attr_value'][$kk]['attr'] =  $vv;
                 $attrDetail[$k]['attr_value'][$kk]['check'] =  false;
-                $attrDetail[$k]['attr_value'][$kk]['is_special'] = isset($specialValueMap[$vv]);
             }
         }
         return [$attrDetail,$values];