livedSelectionSpe.vue 25.8 KB
Newer Older
李嘉林 committed
1 2 3 4 5 6
<template>
  <!-- 选择商品规格 -->
  <div class="livedSelectionSpe">
    <van-popup
      :show="show"
      position="bottom"
李嘉林 committed
7
      custom-style="border-top-left-radius:10px;border-top-right-radius:10px;"
李嘉林 committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
      :close-on-click-overlay="true"
      @close="closeDia"
    >
      <div class="goodsMess">
        <div class="sku">
          <!-- 关闭按钮 -->
          <div class="close" @click="closeDia">
            <van-icon name="cross" />
          </div>
          <!-- 内容 -->
          <div class="cont flex">
            <div class="pic">
              <img width="100%" height="100%" :src="product_goods_info.goodsImgUrl" alt />
            </div>
            <div class="content">
              <div class="price" v-if="product_goods_info.discountPrice">
                <div>{{product_goods_info.discountPrice}}</div>
                <div v-if="product_goods_info.singleItemActivityId">
李嘉林 committed
26
                  <p class="delPrice">{{product_goods_info.originalPrice}}</p>
李嘉林 committed
27
                  <!-- <del style="color:#666;">{{product_goods_info.originalPrice}}</!--> 
李嘉林 committed
28 29 30 31
                </div>
                <div
                  v-else-if="product_goods_info.discountPrice-0<product_goods_info.goodsSuggestedRetailPrice-0"
                >
李嘉林 committed
32 33
                  <p class="delPrice">{{product_goods_info.goodsSuggestedRetailPrice}}</p>
                  <!-- <del style="color:#666;">{{product_goods_info.goodsSuggestedRetailPrice}}</del> -->
李嘉林 committed
34 35 36
                </div>
              </div>
              <template v-else-if="minSale<maxSale">
李嘉林 committed
37
                <div class="price">{{minSale}}-¥{{maxSale}}</div>
李嘉林 committed
38 39 40 41
                <p  class="delPrice" v-if="(minSale-0<minSuggestedRetailPrice-0)&&(maxSale-0<maxSuggestedRetailPrice-0)">
{{minSuggestedRetailPrice}}-¥{{maxSuggestedRetailPrice}}
                </p>
                <!-- <del
李嘉林 committed
42
                  v-if="(minSale-0<minSuggestedRetailPrice-0)&&(maxSale-0<maxSuggestedRetailPrice-0)"
李嘉林 committed
43
                >{{minSuggestedRetailPrice}}-¥{{maxSuggestedRetailPrice}}</del> -->
李嘉林 committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
              </template>
              <template v-else>
                <div class="price">{{minSale}}</div>
              </template>
              <div class="num" v-if="product_goods_info.oversoldFlag==1&&isGetMixId">库存充足</div>
              <div
                class="num"
                v-else-if="product_goods_info.oversoldFlag!=1&&isGetMixId"
              >库存{{product_goods_info.sellMaxQty}}件</div>
              <div class="Choice" v-if="isChoice">【请选择规格】</div>
              <div class="Choice line-clamp1" v-else>
                <span v-for="(item,index) in goodsGuige" :key="index">{{item}}&nbsp;&nbsp;&nbsp;</span>
              </div>
            </div>
          </div>
          <div class="commoditySty">
            <ul>
              <li v-for="(ProductItem,n) in goodsGuiges" :key="n">
                <div class="property">{{ProductItem.specificationName}}</div>
                <div class="specification clearfix">
                  <div
                    v-for="(oItem,index) in ProductItem.specificationValue"
                    :key="index"
                    @click="specificationBtn(oItem.name,n,$event,index)"
                    :class="[oItem.isShow?'':'soldOut',subIndex[n] == index?'active':'']"
                    class="specification-item"
                  >
                    <div>{{oItem.name}}</div>
                  </div>
                </div>
              </li>
            </ul>
          </div>
李嘉林 committed
77
          <div class="buyQty flex">
李嘉林 committed
78
            <div class="ti">购买数量</div>
李嘉林 committed
79
            <van-stepper
李嘉林 committed
80
              :value="buyQty"
李嘉林 committed
81
              :min="product_goods_info.productMinCount>0?product_goods_info.productMinCount:1"
李嘉林 committed
82
              :max="MaxQtyNum"
李嘉林 committed
83 84 85
              :disable-input="true"
              @change="changeQty"
              input-class="ipt"
李嘉林 committed
86 87 88 89
            />
          </div>
        </div>
        <div v-if="!goodsLowerShelf&&!sellOut" class="bottom flex">
李嘉林 committed
90 91
          <div class="addCart van-button" @click="onAddCartClicked">加入购物车</div>
          <div class="toPay van-button" @click="onBuyClicked">立即购买</div>
李嘉林 committed
92 93 94 95 96 97 98 99 100 101 102 103 104
        </div>
        <div v-else-if="!goodsLowerShelf&&sellOut" class="goodsStand">商品已售罄</div>
        <div v-else class="goodsStand">商品已下架</div>
      </div>
    </van-popup>
  </div>
</template>

<script type="text/ecmascript-6">
import { DFSImg } from "@/utils/index";
import live from "@/api/live";
export default {
  props: {
李嘉林 committed
105
    show: Boolean,
李嘉林 committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
    productInfoId: String,
    minSale: String,
    maxSale: String,
    goodsImg: String,
    minSuggestedRetailPrice: String,
    maxSuggestedRetailPrice: String,
    goodsLowerShelf: Boolean
  },
  name: "",
  data() {
    return {
      product_goods_info: {
        afterSaleContent: "",
        goodsImgUrl: "",
        maxQty: "",
        pdtName: "",
        productGoodsId: "",
        productGoodsMixId: "",
        productId: "",
        referencePrice: "",
        marketPrice: "",
        oversoldFlag: Number,
        originalPrice: "",
        sellMaxQty: "",
        limitQty: "",
        specifications: [], //原规格
        discountPrice: ""
      },
李嘉林 committed
134
      buyQty: 1,
李嘉林 committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
      goodsGuige: [],
      // 对应商品所有规格
      goodsGuiges: [],
      // 规格转json对象
      goodsString: {},
      // 规格对象
      choose: {},
      MaxQtyNum: 0,
      isGetMixId: false, // 是否取价格
      isChoice: true, //显示“请选择规格”
      getProductInfos: [], //产品信息数组
      getProductInfo: {}, //产品信息
      isSingle: false, //是否为单规格商品
      saleStatus: 1, //销售状态,
      goodsStand: 1, //上下架,
      shopItemInfo: {}, //存放要和选中的值进行匹配的数据
      subIndex: [], //是否选中 因为不确定是多规格还是但规格,所以这里定义数组来判断
      isLogin: false, //是否登录
      nonstandardGoods: false, //无规格商品
      selectedPrice: "", // 选中的规格价格
      isChoice: true, //显示“请选择规格”
      productUrl: "", // 产品主图
      sellOut: false, //售罄及无库存且不是超卖
      isGetMixId: false, // 是否取价格
      paramData: "", //埋点数据
      maxSelectedPrice: 0, //  限时特惠选中规格后划线价
李嘉林 committed
161 162
      allSellOut: false, //全部售罄标识
      isDefault:false,
李嘉林 committed
163 164 165 166 167
    };
  },
  components: {},
  computed: {},
  created() {},
李嘉林 committed
168
  onLoad(options) {
程智春 committed
169 170 171 172 173 174 175 176 177 178
    if(options.params){
      let params = JSON.parse(options.params);
      this.liveId = params.liveId;  
    }else if(options.scene){
      var scene = decodeURIComponent(options.scene); //参数二维码传递过来的参数
      console.log(scene)
      let sceneInfo = scene.split(',')
      console.log('sceneInfo',sceneInfo)
      this.liveId = sceneInfo[0].split('=')[1]
    }
李嘉林 committed
179
    this.product_goods_info.goodsImgUrl=this.goodsImg;
李嘉林 committed
180 181 182 183 184
    this.init();
  },
  mounted() {},
  methods: {
    // 初始化
李嘉林 committed
185
    async init() {
李嘉林 committed
186
      let productInfoId = this.productInfoId;
李嘉林 committed
187 188
      await live
        .getProductGoodsByProductInfo(productInfoId)
李嘉林 committed
189
        .then(res => {
李嘉林 committed
190 191 192 193
          if (res.data.code == 200) {
            this.getProductInfos = res.data.data;
            this.product_goods_info.productGoodsId = res.data.data[0].productGoodsId;
            this.product_goods_info.goodsId = res.data.data[0].goodsId;
李嘉林 committed
194
            this.product_goods_info.productGoodsMixId =
李嘉林 committed
195 196 197
              res.data.data[0].productGoodsMixId;
            this.product_goods_info.specifications = res.data.data[0].specifications;
            this.product_goods_info.oversoldFlag = res.data.data[0].oversoldFlag;
李嘉林 committed
198 199 200 201
          }
        });
      // 获取商品规格
      let productId = this.productInfoId;
李嘉林 committed
202 203 204 205
      await live.getProductGoodsSpecifications(productId).then(res => {
        if (res.data.code == 200) {
          this.goodsGuiges = res.data.data;
          console.log(this.goodsGuiges,'------------188')
李嘉林 committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
          //做判断如果只有一套规格,直接添加规格 不用弹出选择规格弹窗直接进行下单 4.8建
          let isSingles = [];
          this.goodsGuiges.forEach((item, index) => {
            if (item.specificationValue.length >= 2) {
              isSingles.push(1);
            }
            if (isSingles.length != 0) {
              this.isSingle = false; //多规格
              this.goodsGuige = [];
              this.subIndex.pop();
            } else {
              this.isSingle = true; // 单规格商品
              this.isChoice = false;
              // this.goodsGuige.push(item.specificationValue[0]);
              this.goodsGuige = [];
              this.subIndex.push(0);
              // 通过mixid取价格
            }
          });
          if (this.isSingle == true) {
            this.getMixId(0);
          }

          //  规格数据重组
          for (var i = 0; i < this.goodsGuiges.length; i++) {
            for (
              var j = 0;
              j < this.goodsGuiges[i].specificationValue.length;
              j++
            ) {
              this.goodsGuiges[i].specificationValue[j] = {
                name: this.goodsGuiges[i].specificationValue[j],
                isShow: true
              };
            }
          }

          // console.log(this.specifications,'-------------规格')
          this.getProductInfos.forEach((item, index) => {
            item.twoSpecifications = [];
            item.specifications.forEach((item1, index1) => {
              item.specifications.splice(index1, 1, item1.specificationValue);
              item.twoSpecifications.splice(
                index1,
                1,
                item1.specificationValue
              );
            });
            item.specifications = item.specifications.join("abab@&*");
          });
          for (var i in this.getProductInfos) {
            this.shopItemInfo[
              this.getProductInfos[i].specifications
            ] = this.getProductInfos[i]; //修改数据结构格式,改成键值对的方式,以方便和选中之后的值进行匹配
          }
李嘉林 committed
261
          // let defaultnoSellOut=this.getProductInfos.filter((item,index)=>{return !((item.oversoldFlag==0&&item.saleQty-0<=0)||item.saleStatus=='0')});
李嘉林 committed
262
          // 默认选中一个只有一个未售罄的规格
李嘉林 committed
263
          // this.defaultSelection(defaultnoSellOut[0].twoSpecifications,this.goodsGuiges);
李嘉林 committed
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
          if (this.goodsGuiges.length == 1) {
            this.goodsGuiges[0].specificationValue.forEach((item, index) => {
              for (var i in this.shopItemInfo) {
                if (item.name == i && this.shopItemInfo[i].saleStatus == "0") {
                  item.isShow = false;
                }
                if (
                  item.name == i &&
                  this.shopItemInfo[i].oversoldFlag == 0 &&
                  this.shopItemInfo[i].saleQty - 0 <= 0
                ) {
                  item.isShow = false;
                }
              }
            });
          }
          // this.checkItem();
        } else if (res.code == -1) {
          this.isSingle = true;
          this.nonstandardGoods = true;
          this.goodsGuige = [];
          this.getMixId(0);
        }
      });
    },
李嘉林 committed
289 290 291
    changeQty(event){
      console.log(event.mp.detail,'------------------------------279')
      this.buyQty=event.mp.detail;
李嘉林 committed
292
      this.getMixId(1,true);
李嘉林 committed
293
    },
李嘉林 committed
294 295 296
    // 默认选中一组规格
    // 两个参数goodsSpc,allSpc  sku及所有规格
    defaultSelection(goodsSpc,allSpc){
李嘉林 committed
297 298 299 300
      // 是默认调取getMixid接口状态
      this.isDefault=true;
      // console.log(goodsSpc,'-------371')
      // console.log(allSpc,'-------372')
李嘉林 committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
      for(let i=0;i<allSpc.length;i++){
        for(let j=0;j<allSpc[i].specificationValue.length;j++){
          for(let k=0;k<goodsSpc.length;k++){
            if(allSpc[i].specificationValue[j].name==goodsSpc[k]){
              this.specificationBtn(allSpc[i].specificationValue[j].name,i,null,j);
              break;
            }
          }
        }
      }
    },
    onAddCartClicked() {
      let productGoodsId = this.product_goods_info.productGoodsId;
      if (
        this.goodsGuige.length < this.goodsGuiges.length ||
        this.checkGoodsGuigeValue()
      ) {
        wx.showToast({
          title: '请选择规格',
          icon: 'none',
        })
      } else if (
        this.product_goods_info.oversoldFlag == 0 &&
        this.product_goods_info.sellMaxQty <= 0
      ) {
        wx.showToast({
          title: '商品暂无库存',
          icon: 'none',
        })
      } else {
        live
          .addCart([{ productGoodsId: productGoodsId, qty: this.buyQty }])
          .then(res => {
            if (res.data.code == 200) {
              wx.showToast({
                title: '加入成功',
                icon: 'success',
              })
              this.showSize = false;
            } else {
              wx.showToast({
                title: res.data.msg,
                icon: 'none',
              })
            }
          });
      }
    },
李嘉林 committed
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
    // 立即购买
    onBuyClicked(){
      if (
        this.goodsGuige.length < this.goodsGuiges.length ||
        this.checkGoodsGuigeValue()
      ) {
        wx.showToast({
          title: '请选择规格',
          icon: 'none',
        })
      } else if (
        this.product_goods_info.oversoldFlag == 0 &&
        this.product_goods_info.sellMaxQty <= 0
      ) {
        wx.showToast({
          title: '商品暂无库存',
          icon: 'none',
        })
      } else {
        let query ={};
        query.productGoodsMixId = this.product_goods_info.productGoodsMixId;
        query.productGoodsId = this.product_goods_info.productGoodsId;
        query.goodsId = this.product_goods_info.goodsId;
        query.qty = this.buyQty;
        query.goodsString = JSON.stringify(this.goodsString);
        query.maxQty = this.product_goods_info.maxQty;
        query.productMinCount = this.product_goods_info.productMinCount;
        query.fromLived = 1;
        query.liveId = this.liveId;

        // 将规格转化为json字符串
        this.backPath=`/order/orderConfirm`;
        wx.reLaunch({
          url: `../index/main?from=livedToOrderConfirm&backpath=${
            this.backPath
          }&params=${JSON.stringify(query)}`
        })
      }
    },
李嘉林 committed
388
    // 取价格
李嘉林 committed
389
    getMixId(val,getNewPrice) {
李嘉林 committed
390 391 392 393 394 395
      if(!this.isDefault){
        wx.showLoading({
          title: '加载中...',
        })
      }
      this.isDefault=false;
李嘉林 committed
396
      this.isGetMixId = true;
李嘉林 committed
397
      let productGoodsMixId=this.product_goods_info.productGoodsMixId
李嘉林 committed
398
      live
李嘉林 committed
399
        .getProductGoodsByMixId(productGoodsMixId)
李嘉林 committed
400
        .then(res => {
李嘉林 committed
401
          wx.hideLoading()
李嘉林 committed
402
          if (res.data.code == 200) {
李嘉林 committed
403
            if (this.nonstandardGoods == false) {
李嘉林 committed
404
              res.data.data.specifications.forEach((item, index) => {
李嘉林 committed
405 406 407 408 409 410 411 412 413
                if (item.specificationPictureUrl != "") {
                  this.product_goods_info.goodsImgUrl = DFSImg(
                    item.specificationPictureUrl,
                    400,
                    400
                  );
                }
              });
              if (this.product_goods_info.goodsImgUrl == "") {
李嘉林 committed
414
                this.productUrl = res.data.data.productUrl || "";
李嘉林 committed
415
                this.product_goods_info.goodsImgUrl =
李嘉林 committed
416
                  DFSImg(res.data.data.productUrl, 400, 400) || "";
李嘉林 committed
417 418
              }
            } else {
李嘉林 committed
419
              this.productUrl = res.data.data.productUrl || "";
李嘉林 committed
420 421
            }
            this.product_goods_info.goodsImgUrl =
李嘉林 committed
422 423 424 425 426 427 428 429 430
              DFSImg(res.data.data.productUrl, 400, 400) || DFSImg("", 400, 400);
            this.product_goods_info.marketPrice = Number(res.data.data.marketPrice);
            this.product_goods_info.originalPrice = Number(res.data.data.originalPrice);
            this.product_goods_info.discountPrice = Number(res.data.data.discountPrice);
            this.product_goods_info.sellMaxQty = Number(res.data.data.sellMaxQty); //可销售库存
            this.product_goods_info.limitQty = Number(res.data.data.limitQty); //  实际库存
            this.product_goods_info.productMinCount = Number(res.data.data.productMinCount); //最小购买数  0不限
            this.product_goods_info.maxQty = Number(res.data.data.maxQty); // 最大购买数   0不限
            this.product_goods_info.oversoldFlag = res.data.data.oversoldFlag; // 1超卖 0不超卖
李嘉林 committed
431
            this.product_goods_info.goodsSuggestedRetailPrice =
李嘉林 committed
432
              Number(res.data.data.goodsSuggestedRetailPrice);
李嘉林 committed
433
            this.product_goods_info.singleItemActivityId =
李嘉林 committed
434
              res.data.data.singleItemActivityId||'';
李嘉林 committed
435 436 437 438
            if(!getNewPrice){
              this.buyQty =
                this.product_goods_info.productMinCount > 0 ? this.product_goods_info.productMinCount :1;
            }
李嘉林 committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
            if (
              this.product_goods_info.oversoldFlag != 1 &&
              this.product_goods_info.sellMaxQty - 0 <= 0
            ) {
              this.sellOut = true;
              // console.log(this.sellOut, "cg416");
            } else {
              this.sellOut = false;
            }
            this.getMaxQtyNum(); //更新最大值
            this.$forceUpdate();
          }
        });
    },
    checkGoodsGuigeValue() {
      for (let i = 0; i < this.goodsGuige.length; i++) {
        if (
          this.goodsGuige[i] == "" ||
          this.goodsGuige[i] == "undefined" ||
          this.goodsGuige[i] == undefined
        ) {
          return true;
        }
      }
      return false;
    },
    getMaxQtyNum() {
      let num = 0;
      if (this.product_goods_info.maxQty == "0") {
        //无限制
        if (this.product_goods_info.oversoldFlag == "0") {
          //不允许超卖
          num = this.product_goods_info.sellMaxQty;
        } else {
          num = 999;
        }
      } else {
        if (
          this.product_goods_info.sellMaxQty > this.product_goods_info.maxQty
        ) {
          num = this.product_goods_info.sellMaxQty;
        } else {
          num = this.product_goods_info.maxQty;
        }
      }
      this.MaxQtyNum = num;
    },
    specificationBtn(item, n, event, index) {
      this.isChoice = false;
      if (this.goodsGuige[n] != item) {
        this.goodsGuige[n] = item;
        // this.goodsGuige[n] = item;
        this.subIndex[n] = index;
        this.subIndex.splice(n, 1, index);
      } else {
        this.goodsGuige[n] = "";
        this.subIndex[n] = -1; //去掉选中的颜色
        this.subIndex.splice(n, 1, -1); //去掉选中的颜色
        this.product_goods_info.discountPrice = null;
        this.goodsStand = 1;
        let isChoice = 0;
        // this.product_goods_info.goodsImgUrl=DFSImg(this.goodsImg,400,400);
        this.product_goods_info.goodsImgUrl =
          this.goodsImg || DFSImg("", 1024, 1024);
        this.sellOut = false;
        this.isGetMixId = false;
        this.goodsGuige.forEach((item, index) => {
          if (item == "") {
            isChoice++;
          }
        });
        if (isChoice == this.goodsGuige.length) {
          this.isChoice = true;
          this.goodsGuige = [];
          isChoice = 0;
        } else {
          this.isChoice = false;
        }
      }
      this.checkItem();
      let noStr = 0;
      this.goodsGuige.forEach((item, index) => {
        if (item != "") noStr++;
      });
      if (noStr == this.goodsGuiges.length) {
        this.getMixId(1);
      }
    },
    checkItem() {
      var option = this.goodsGuiges;
      var result = []; //定义数组存储被选中的值
      // console.log(this.goodsGuiges,"cg524")
      for (var i in option) {
        result[i] = this.goodsGuige[i] ? this.goodsGuige[i] : "";
      }
      for (var i in option) {
        var last = result[i]; //把选中的值存放到字符串last去
        for (var k in option[i].specificationValue) {
          result[i] = option[i].specificationValue[k].name; //赋值,存在直接覆盖,不存在往里面添加name值
          option[i].specificationValue[k].isShow = this.isMay(result); //在数据里面添加字段isShow来判断是否可以选择
        }
        result[i] = last; //还原,目的是记录点下去那个值,避免下一次执行循环时避免被覆盖
      }
      this.$forceUpdate(); //重绘
    },
    isMay: function(result) {
      for (var i in result) {
        if (result[i] == "") {
          return true; //如果数组里有为空的值,那直接返回true
        }
      }
      // console.log(result,this.goodsGuige,"cg494")
      for (var i in this.shopItemInfo) {
        let newArr = i.split("abab@&*");
        let isTrue = this.isContained(result, newArr);
        if (isTrue == true) {
          // console.log(newArr,i,result,"cg498")
          if (this.goodsGuige.length == this.goodsGuiges.length) {
            let isGoods = this.isContained(this.goodsGuige, newArr);
            if (isGoods == true) {
              this.product_goods_info.productGoodsMixId = this.shopItemInfo[
                i
              ].productGoodsMixId;
              this.product_goods_info.productGoodsId = this.shopItemInfo[
                i
              ].productGoodsId;
              this.product_goods_info.goodsId = this.shopItemInfo[i].goodsId;
            }
          }
          // 判断上下架、售罄
          console.log(
            this.shopItemInfo[i].saleStatus == 0,
            this.shopItemInfo[i].oversoldFlag == 0 &&
              this.shopItemInfo[i].saleQty - 0 <= 0,
            "-------------------703"
          );
          if (
            this.shopItemInfo[i].saleStatus == 0 ||
            (this.shopItemInfo[i].oversoldFlag == 0 &&
              this.shopItemInfo[i].saleQty - 0 <= 0)
          ) {
            return false;
          } else {
            return true;
          }
        }
      }
    },
    isContained(aa, bb) {
      if (
        !(aa instanceof Array) ||
        !(bb instanceof Array) ||
        aa.length < bb.length
      ) {
        return false;
      }
      for (var i = 0; i < bb.length; i++) {
        var flag = false;
        for (var j = 0; j < aa.length; j++) {
          if (aa[j] == bb[i]) {
            flag = true;
            break;
          }
        }
        if (flag == false) {
          return flag;
        }
      }
      return true;
    },
    //   关闭
    closeDia() {
      this.$emit("closeSpeDia");
    }
  }
};
</script>

<style lang="scss" scoped>
李嘉林 committed
618 619 620 621
.delPrice{
  text-decoration: line-through;
  color: #666;
}
李嘉林 committed
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
.flex{
  display: flex;
}
/*清除浮动*/
.clearfix {
  zoom: 1;
}

.clearfix:after {
  clear: both;
  content: '.';
  display: block;
  width: 0;
  height: 0;
  visibility: hidden;
}
/* 一行否则出现省略号 */
.line-clamp1 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.line-clamp2 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 22px;
}
李嘉林 committed
655 656 657 658 659 660
.livedSelectionSpe {
  .goodsMess {
    width: 100%;
    background: rgba(255, 255, 255, 1);
    border-radius: 8px 8px 0px 0px;
    .sku {
李嘉林 committed
661
      padding: 8px 10px;
李嘉林 committed
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687
      position: relative;
      .close {
        position: absolute;
        right: 8px;
        top: 8px;
        font-size: 20px;
      }
    }
    .cont {
      width: 100%;
      height: 126px;
      border-bottom: 1px solid #e5e5e5;
      .pic {
        width: 100px;
        height: 100px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .content {
        margin-left: 8px;
        width: 65%;
        .price {
          font-size: 13px;
          font-weight: 400;
李嘉林 committed
688
          color: #ff4240;
李嘉林 committed
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
          margin-top: 10px;
        }
        .num,
        .size {
          font-size: 11px;
          font-weight: 400;
          color: rgba(146, 146, 146, 1);
        }
        .size {
          color: rgba(41, 41, 41, 1);
        }
        .Choice {
          width: 100%;
          margin-top: 10px;
          font-size: 14px;
          color: #292929;
        }
        .num,
        .soldout {
          margin-top: 10px;
          margin-bottom: 13px;
        }
      }
    }
    .commoditySty {
      border-bottom: 1px solid #e5e5e5;
李嘉林 committed
715 716
      // max-height: 240px;
      // overflow-y: scroll;
李嘉林 committed
717
      ul {
李嘉林 committed
718
        height: 100%;
李嘉林 committed
719 720 721 722 723 724 725 726
        li {
          height: 100%;
          .property {
            margin: 10px 0;
            font-size: 15px;
          }
          .specification {
            div.specification-item {
李嘉林 committed
727
              font-size: 15px;
李嘉林 committed
728
              border: 1px solid #606060;
李嘉林 committed
729
              border-radius: 4px;
李嘉林 committed
730 731
              color: #606060;
              text-align: center;
李嘉林 committed
732
              padding: 2px 4px;
李嘉林 committed
733
              float: left;
李嘉林 committed
734 735 736
              margin-right: 6px;
              min-width: 30px;
              margin-bottom: 6px;
李嘉林 committed
737 738 739 740 741 742 743 744
              box-sizing: content-box;
              div {
                text-align: left;
                display: inline-block;
              }
            }
            div.active {
              color: #fff;
李嘉林 committed
745 746
              background-color: #ff4240;
              border-color: #ff4240;
李嘉林 committed
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762
            }
            div.soldOut {
              background-color: #ccc;
              opacity: 0.4;
              color: #000;
              pointer-events: none;
              border-color: #606060;
            }
          }
        }
      }
    }
    .buyQty {
      margin-top: 10px;
      width: 100%;
      height: 60px;
李嘉林 committed
763 764 765 766 767 768 769
      justify-content: space-between;
      .ti{
        font-size: 14px;
      }
      /deep/.ipt{
        color: #000!important;
      }
李嘉林 committed
770 771 772 773
    }
    .bottom {
      margin-top: 60px;
      .van-button {
李嘉林 committed
774 775 776 777
        width: 50vw;
        height: 50px;
        text-align: center;
        line-height: 50px;
李嘉林 committed
778
        font-size: 14px;
李嘉林 committed
779 780
      }
      .toPay {
李嘉林 committed
781
        background: #ff4240;
李嘉林 committed
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
        color: #fff;
      }
      .addCart {
        background-color: #fff;
        color: #292929;
      }
    }
    .goodsStand {
      margin-top: 60px;
      background: #606060;
      width: 100%;
      height: 49px;
      text-align: center;
      line-height: 49px;
      color: #fff;
      font-size: 16px;
    }
  }
}
</style>