goodDetails.vue 27.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 134 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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 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 261 262 263 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 289 290 291 292 293 294 295 296 297 298 299 300 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 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 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 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 618 619 620 621 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 655 656 657 658 659 660 661 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 688 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 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
<template>
<div class="good-details-box">
    <!-- H5唤起App组件 -->
        <call-app-box
            class="call-app-box"
            :style="'padding-top: ' + $parent.top.value + 'px'"
            ref="callApp"
            v-if="!isCNLive.value"
            :callApps="$parent.callApps"
        >
        </call-app-box>
        <back-box
            v-if="isCNLive.value"
            :class="{'hide': $route.query.hideBack == true}"
            class="back-box"
            :style="'padding-top: ' + $parent.top.value + 'px'"
            @back="back"
            :backs="backs"
        >
        </back-box>
                <!-- pl -->
        <div class="pl" :style="'padding-top: ' + $parent.top.value + 'px'" :class="{'is-cnlive': isCNLive.value, 'is-open-app': $parent.isOpenApp.value, 'hide': $route.query.hideBack == true}"></div>
        <!--轮播-->
        <!-- <swiper
          :style="
                'margin-top:' +
                    ($parent.isBack && isCNLive.value ? 62 : 10) +
                    'px'
            "
            v-if="simgList"
            :swipers="goodsInfo.simg"
            :isPointsMall= 'true'
            :options="{
                showIndicators: true
            }"
        >
        </swiper> -->
        <img v-if="goodsInfo && goodsInfo.simg" class="goods-img" v-lazy="goodsInfo.simg" alt=""/>
        <!-- 内容 -->
        <div class="main-box">
            <!-- 标题 -->
            <div v-if="goodsInfo && goodsInfo.title" class="title">
             {{goodsInfo.title}}
            </div> 
            <!-- 积分 -->
            <div class="title-t">
              <div v-show="goodsInfo && parseInt(goodsInfo.price)>0" class="goods_tip">
                积分+现金
              </div>
              <div>
                <!-- <span v-if="goodsInfo && goodsInfo.price" class="price">¥{{goodsInfo.price}}</span> -->
                <span v-if="goodsInfo && goodsInfo.num" class="integral">{{parseInt(goodsInfo.num)>9999?this.formatDecimal((parseInt(goodsInfo.num) / 10000), 0) +"万":goodsInfo.num}}积分<span v-show="parseInt(goodsInfo.price)>0"> +{{goodsInfo.price}}元</span></span>
                <!-- <span class="integral-in">积分</span> -->
              </div>
            </div>
            <!-- 商品信息 -->
            <div class="goods-info">
              <div v-show="goodsInfo && goodsInfo.content" class="good-title">
                <span class="left"></span>商品详情<span class="right"></span>
              </div>
              <!-- 虚拟商品展示 -->
              <div v-if="goodsInfo && goodsInfo.content &&  goodsInfo.shop_type !=1" v-html="goodsInfo.content" class="good-desc html_box">
              </div>
              <!-- 实物商品展示 -->
              <div v-else-if="goodsInfo && goodsInfo.content && goodsInfo.content.length &&  goodsInfo.shop_type ==1" class="good-desc html_box">
                <img v-for="(item,index) in goodsInfo.content" :key=" 't' + index" :src="item" alt="商品图片"/>
              </div>
              <!-- 商品规格 -->
              <div v-if="goodsInfo && goodsInfo.attr" class="good-title">
                <span class="left"></span>商品规格<span class="right"></span>
              </div>
              <div v-if="goodsInfo && goodsInfo.attr" class="item_sku_box">
                <div v-for="(item,index) in goodsInfo.attr" :key="index" class="item_sku">
                  <div class="left">{{item.k}}</div>
                  <div class="right"><span>{{item.v}}</span></div>
                </div>
              </div>
              <div class="good-title">
                <span class="left"></span>兑换规则<span class="right"></span>
              </div>
              <div class="good-desc">
                <!-- 实物 -->
                <div v-if="goodsInfo && goodsInfo.shop_type && goodsInfo.shop_type == 1">
                    <div class="text-left">
                      <span class="blue">本商品为积分+现金的方式进行兑换。</span><br>
                      用户兑换后可在我的-我的订单中查看详情及物流。
                    </div>
                    <div class="text-left">
                      <span>· 正版授权</span>
                      所售商品均已官方授权,请放心购买;
                    </div>
                    <div class="text-left">
                      <span>· 正品保障</span>
                      独家正品保障。
                    </div>
                    <div class="text-left">
                      客服说明:如有疑问请联系平台客服,电话:<a href="tel:010-65832485">010-65832485</a><br>
                    </div>
                </div>
                <!-- 优惠券 -->
                <div v-else-if="goodsInfo && goodsInfo.shop_type && goodsInfo.shop_type == 2">
                  <div class="desc_title">兑换流程</div>
                    <div class="text-left">
                    1、 本券以积分进行兑换,兑换后将直接进入到用户的虚拟账户中。<br> 2、 用户兑换后可在我的-我的卡券中进行查看。
                    </div>
                    <div class="desc_title mar_top10">注意事项</div>
                    <div class="text-left">
                      1、 使用说明:每个手机号码只能领取一次;优惠券兑换后不退,过期不补,请兑换后尽快使用。<br>
                      2、 优惠券有效期:自兑换之日起一个月。<br>
                      3、 适用商品:除特殊商品外,全平台商品可用。<br>
                      4、 客服说明:如有疑问请联系平台客服,电话:<a href="tel:010-65832485">010-65832485</a>
                    </div>
                </div>
                <!-- 虚拟商品 -->
                <div v-else-if="goodsInfo && goodsInfo.shop_type && goodsInfo.shop_type == 3" class="text-left">
                  1、 本商品以积分进行兑换。兑换后将直接进入到用户的虚拟账户中。<br>
                  2、 用户兑换后可在我的-我的付费内容中进行查看。<br>
                  <!-- 3、 您兑换的音频内容,音频上线期间可长期收听;<br> -->
                  3、 兑换后暂不支持退款,感谢您的支持;<br>
                  4、 兑换完成后若显示异常,请10分钟之后尝试;<br>
                  5、您兑换的音频内容为网家家版权内容,请勿恶意转载;<br>
                  6、 客服说明:如有疑问请联系平台客服,电话:<a href="tel:010-65832485">010-65832485</a><br>
                  7、 具体注意事项详情可见
                  <span @click="toLink" class="to-link">
                    《网家家APP购买音频内容服务协议》
                  </span>
                </div>
              </div>
              <div class="good-title">
                <span class="left"></span>相似商品<span class="right"></span>
              </div>
               <!-- 像是商品推荐 -->
              <!-- 商品样式 7 列表 -->
              <column-list-box class="column-list-box" v-if="goodsInfo && goodsInfo.list && goodsInfo.list.length" @jump="toDetail" 
                  :lists="goodsInfo"
                  com="7"
                  goodType="1">
              </column-list-box>
            </div>
        </div>
        <!-- 有积分页脚显示 -->
        <div v-if="goodsInfo && goodsInfo.stock != 0">
          <!-- 积分充足 -->
          <div v-if="parseInt(goodsInfo.grade || 0)>parseInt(goodsInfo.num) || parseInt(goodsInfo.grade || 0) == parseInt(goodsInfo.num)" class="footer">
            <div class="btn" @click="exchange">
              立即兑换
            </div>
          </div>
          <!-- 积分不足页脚显示 -->
          <div v-if="parseInt(goodsInfo.grade || 0)<parseInt(goodsInfo.num)" class="footer">
            <div class="desc">还差{{parseInt(goodsInfo.num)-parseInt(goodsInfo.grade || 0)}}积分</div>
            <div class="btn" @click="jumpClientIntegralList">
                获取积分
          </div>
          </div>
        </div>
        <!-- 有积分商品售罄 -->
        <div v-else-if="goodsInfo && goodsInfo.stock == 0" class="footer">
          <div class="btn grey">
            补货中
          </div>
        </div>
        <!-- 地址信息组件 -->
        <!-- <app-address-toast ref="itemsInfo" @toUpdate="toLinkPointsMall" v-show="pointsToast_control"></app-address-toast> -->
        <!-- 底部弹出层 -->
        <van-popup class="popup_box" v-model="show" position="bottom" :close-on-click-overlay="false">
            <div class="popup_main">
              <!-- 商品信息 -->
              <div class="goods_box">
                <div class="item_pic_box">
                  <img class="item_pic" :src="goodsInfo && goodsInfo.simg" alt="" />
                </div>
                <div class="right">
                  <!-- 标题 -->
                  <div class="title">
                    <div v-if="goodsInfo && goodsInfo.title" class="title_t">{{goodsInfo.title}}</div> 
                    <img @click="show=false" class="close" src="static/img/close_grey.png" alt="" />
                  </div>
                  <!-- 价格 -->
                  <div class="pirce">
                    <span v-if="goodsInfo && goodsInfo.num">{{goodsInfo.num}}积分+</span>
                    <span v-if="goodsInfo && goodsInfo.price">{{goodsInfo.price}}元</span>
                  </div>
                </div>
              </div>
              <!--购买数量-->
              <div class="num_box">
                <div class="num_tip">购买数量</div>
                <div class="right">
                  <van-stepper theme="round" input-width="40px" input-size="32px" button-size="32px" v-model="stepperValue" min="1" :max="(goodsInfo && goodsInfo.stock > -1) ?goodsInfo.stock :'999'" integer  async-change @change="onChange"/>
                  <!-- <img src="static/img/reduce.png" alt="" />
                  <div class="num">1</div>
                  <img src="static/img/plus.png" alt="" /> -->
                </div>
              </div>
              <!-- 支付方式 -->
              <div class="line_box">
                <div class="left">支付方式</div>
                <div class="right">积分+现金</div>
              </div>
              <!-- 按钮 -->
              <div @click="jumpToConfirmOrderPage(goodsInfo)" class="btn">确定</div>
            </div>
        </van-popup>
</div>
</template>

<script>
import { Swipe, SwipeItem } from 'vant';
import callAppBox from "@/components/callAppBox/callAppBox";
import swiper from "@/components/swiper/swiper";
import backBox from "@/components/backBox/backBox";
import columnListBox from "@/components/columnListBox/columnListBox";
// import appAddressToast from "@/components/appAddressToast/appAddressToast";
import { Toast, Indicator } from "mint-ui";
export default {
  name: 'goodDetails',
  data () {
    return {
      title: "", // 标题
      banner: null,
      goodsInfo: null,
      backs: null, // 后退按钮组
      // pointsToast_control: false,
      isExchange: false, // 是否已经兑换
      show: false, // 是否显示底部支付模块
      stepperValue: 1, // 进步器
      version: this.$route.query.version, //长版本号(ios)
      ver: this.$route.query.version //短版本号(Android)
    }
  },
  //部件
  components: {
    callAppBox,
    swiper,
    backBox,
    columnListBox,
    // appAddressToast
  },
  //静态
  props: [
  ],
  //对象内部的属性监听,也叫深度监听
  head: {
    title () {
      return {
        inner: this.title
      }
    }
  },
  watch: {
    // 设置页面标题
    title (newVal) {
      if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
        this.$iFrame.insertIFrame(newVal);
      } else {
        this.$emit("updateHead");
      }
    }
  },
  //属性的结果会被缓存,除非依赖的响应式属性变化才会重新计算。主要当作属性来使用;
  computed: {
  },
  //方法表示一个具体的操作,主要书写业务逻辑;
  methods: {
    // 显示底部模块
    opintsPopup () {
      this.show = true;
    },
    // 跳转到订单详情
    jumpOrderDes (item) {
      // 判断APP内
      if (this.isCNLive.value) {
        // (判断app内是否有该方法)type=2为积分加现金模式
        if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.jumpOrderDes) {
          // 跳转到原生的任务列表
          window.webkit.messageHandlers.jumpOrderDes.postMessage({ body: { orderId: item.id, type: 2 } })
        } else if (window.obj && window.obj.jumpOrderDes) {
          // 跳转到原生的任务列表
          window.obj.jumpOrderDes(JSON.stringify({ orderId: item.id, type: 2 }));
        }
      }
    },
    // 跳转到确认订单详情
    jumpToConfirmOrderPage (item) {
      if ((parseInt(this.goodsInfo.stock) > -1 && parseInt(this.stepperValue) > parseInt(this.goodsInfo.stock)) || parseInt(this.stepperValue) > 999) {
        Toast("数量超出库存范围~")
      } else {
        // 判断APP内
        if (this.isCNLive.value) {
          // (判断app内是否有该方法)type=2为积分加现金模式
          if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.jumpToConfirmOrderPage) {
            // 跳转到原生的任务列表
            window.webkit.messageHandlers.jumpToConfirmOrderPage.postMessage({ body: { pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type: 4 } })
          } else if (window.obj && window.obj.jumpToConfirmOrderPage) {
            // 跳转到原生的任务列表
            window.obj.jumpToConfirmOrderPage(JSON.stringify({ pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type: 4 }));
          }
        }
      }
    },
    // 跳转网家家购买音频协议
    toLink () {
      if (this.isCNLive.value) {
        // 跳转封装
        if (typeof this.$parent.gotoDetail === 'function') {
          // 设置跳转参数
          let params = {
            type: '34',
            to: "https://wjj.ys1.cnliveimg.com/term/liveFwxy.html?type=web",
            shop_type: ''
          };
          // 页面跳转
          this.$parent.gotoDetail(params);
        }
      } else {
        this.$parent.callApp();
      }
    },
    //获取连接中的参数
    getUrlParam (name) {
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return r[2];
      return "";
    },
    // toLinkPointsMall () {
    //   // 显示查看地址弹框
    //   let options = {
    //     message: "兑换成功",
    //     messageAlign: "center",
    //     confirmButtonText: "我知道了",
    //     confirmButtonCallback: ""
    //     // confirmButtonCallback: this.addAddressCallback,
    //     // params: { shopType: datas.shop_type, id: datas.id }
    //   };
    //   this.$set(this.$parent, "showOptions", options);
    //   // 显示通用浮层
    //   this.$parent.$refs.showModal.showLayer();
    //   // 调用back返回上一页
    //   // this.back();
    //   // this.$router.push({
    //   //   path: '/pointsMall',
    //   //   query: {
    //   //     uid: this.getStore("uid")
    //   //   }
    //   // })
    // },
    /**
     * 后退
     */
    back () {
      // 返回先隐藏弹框

      // 判断是否有处理函数
      if (typeof this.$parent.back === 'function') {
        // 隐藏通用浮层
        this.$parent.$refs.showModal.hideLayer();
        // 后退
        this.$parent.back();
      } else {

        // 后退
        window.history.go(-1);
      }
    },
    /**
    * 跳转商品详情
    * @param {Object} item [数据对象]
    */
    toDetail (item) {
      if (this.isCNLive.value) {
        // 跳转封装
        if (typeof this.$parent.gotoDetail === 'function') {

          // 设置跳转参数
          let params = {
            type: '5',
            to: window.location.origin + '/html/select_good/1/#/goodDetails?goodsId=' + item.id,
            shop_type: ''
          };

          // 页面跳转
          this.$parent.gotoDetail(params);
        }
      } else {
        this.$parent.callApp();
      }
    },
    // 版本判断
    versionJudgment () {
      if (this.isCNLive.value) {
        let options;
        if (this.isAndroid.value) {
          if (this.ver != "") {
            var ver = this.ver ? this.ver.replace(/\.*/g, "") : "";
          }
          var isVer = 1732;
          if (ver > isVer) {
            // 调用底部商品数量层
            this.opintsPopup();
          } else {
            // 提示用积分兑换兑换
            options = {
              message: "当前版本过旧,请升级最新版本",
              messageAlign: "center",
              confirmButtonText: "去更新",
              confirmButtonCallback: this.appUpdate,
              showCancelButton: true,
              cancelButtonText: "取消"
            };
          }
        } else if (this.isiPhone.value) {
          if (this.version != "") {
            var version = this.version ? this.version.replace(/\.*/g, "") : "";
          }
          if (this.mode == "prod") {
            var isVer = 189;
          } else {
            var isVer = 189;
          }
          if (version > isVer) {
            // 调用底部商品数量层
            this.opintsPopup();
          } else {
            // 提示用积分兑换兑换
            options = {
              message: "当前版本过旧,请升级最新版本",
              messageAlign: "center",
              confirmButtonText: "去更新",
              confirmButtonCallback: this.appUpdate,
              showCancelButton: true,
              cancelButtonText: "取消"
            };
          }
        }
        // 调用showModal层参数
        this.$set(this.$parent, "showOptions", options);
        // 显示通用浮层
        this.$parent.$refs.showModal.showLayer();
      }
    },
    // App升级跳转
    appUpdate () {
      if (this.isiPhone.value) {
        window.location.href = "http://itunes.apple.com/cn/app/id1337575478?mt=8"
      } else if (this.isAndroid.value) {
        window.location.href = "http://wjj.ys1.cnliveimg.com/download/ac/1733/strike-1.7.3.3-release.apk"
      }
    },
    // 兑换
    exchange () {
      if (this.isCNLive.value) {
        // 校验登录
        if (this.$parent.checkLogin()) {
          // 实物商品不提示用积分
          if (this.goodsInfo.shop_type == 1) {
            // 判断安卓版本1.7.3.3展示ios1.9.0显示实物弹出底部数量填写
            this.versionJudgment()
            // 弹出填写地址
            //  this.addAddressCallback()
          } else {
            // 虚拟商品提示用积分兑换
            let options = {
              title: "",
              message: "确定使用" + this.goodsInfo.num + "积分兑换?",
              confirmButtonText: "确定",
              confirmButtonCallback: this.addIntegralOrderconfirm,
              showCancelButton: true,
              cancelButtonText: "取消"
            };
            // 调用showModal层参数
            this.$set(this.$parent, "showOptions", options);
            // 显示通用浮层
            this.$parent.$refs.showModal.showLayer();
          }
        }
      } else {
        this.$parent.callApp();
      }
    },
    // 确定兑换回调
    addIntegralOrderconfirm () {
      // isExchange为false才可兑换防止连续点击
      if (!this.isExchange) {
        // 兑换
        this.addIntegralOrder();
      }
    },
    /**
     * 分享
     */
    // toShare () {
    //   // 判断分享
    //   if (typeof this.$parent.toShare === 'function') {
    //     this.$parent.toShare(45, "1", "");
    //   }
    // },
    /**
   * 积分兑换接口
   */
    addIntegralOrder () {
      // 加载中提示
      Indicator.open("加载中...");
      // 获取证书请求接口
      this.http("/Api/" + this.getApiVersion().LuckDraw + "/addIntegralOrder", {
        uid: this.getStore("uid"),
        id: this.$route.query.goodsId, // 商品ID
        num: 1
      }, this.addIntegralOrderCallback, {
          method: "POST"
        });
    },

    /**
     * 积分兑换接口回调
     * @param {Object} res [服务器返回数据]
     * @param {Object} ext [扩展参数]
     */
    addIntegralOrderCallback (res, ext) {

      // 加载完成
      Indicator.close();

      // 返回处理
      if (res.code == 200) {
        // 解构数据
        let { data: datas } = res;
        // 方式连续点击兑换
        this.isExchange = true;
        // 两秒后可继续兑换
        let _this = this
        setTimeout(function () {
          _this.isExchange = false;
        }, 1500);
        // 提示语判断
        let tipMessage;
        if (datas.shop_type == 2) {
          tipMessage = "红包已存入您的账户,可前往“我的”—“我的卡券查看”"
        } else if (datas.shop_type == 3) {
          tipMessage = "付费音频已存入您的账户,可前往“我的”—“我的付费内容”—“已购内容收听”"
        }
        // 显示查看地址弹框
        let options = {
          message: tipMessage,
          messageAlign: "center",
          confirmButtonText: "我知道了",
          confirmButtonCallback: ""
          // confirmButtonCallback: this.addAddressCallback,
          // params: { shopType: datas.shop_type, id: datas.id }
        };
        this.$set(this.$parent, "showOptions", options);
        // 显示通用浮层
        this.$parent.$refs.showModal.showLayer();
      } else if (res.code == 401) {
        // 获取积分商品详情页失败
        // 
        // 显示查看地址弹框
        let options = {
          title: "",
          message: "你的积分不足" + "<br>" + "赚取更多积分,请至任务列表",
          messageAlign: "center",
          confirmButtonText: "确定",
          confirmButtonCallback: this.jumpClientIntegralList,
          showCancelButton: true,
          cancelButtonText: "取消"
        };
        this.$set(this.$parent, "showOptions", options);
        // 显示通用浮层
        this.$parent.$refs.showModal.showLayer();
      } else {
        Toast(res.message);
      }
    },
    // 填写地址
    // addAddressCallback () {
    //   this.pointsToast_control = true;
    //   // 礼品兑换弹框派发
    //   this.$refs.itemsInfo.getItemInfo(this.goodsInfo, params.id)
    // },
    /**
    * 跳转赚取积分页面
    * @param {Object} item [数据对象]
    */
    jumpClientIntegralList () {
      // 判断APP内
      if (this.isCNLive.value) {
        // (判断app内是否有该方法)
        if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.jumpClientIntegralList) {
          // 跳转到原生的任务列表
          window.webkit.messageHandlers.jumpClientIntegralList.postMessage({ body: {} });
        } else if (window.obj && window.obj.jumpClientIntegralList) {
          // 跳转到原生的任务列表
          window.obj.jumpClientIntegralList();
        }
      }
    },
    /**
     * 积分商品详情页页面接口
     */
    getGoodsInfo (goodsId) {
      // 加载中提示
      Indicator.open("加载中...");
      // 获取证书请求接口
      this.http("/Api/" + this.getApiVersion().LuckDraw + "/integralGoodsInfo", {
        id: goodsId, // 商品ID
        uid: this.getStore("uid") // 用户ID
      }, this.getGoodsInfoCallback, {
          method: "POST"
        });
    },

    /**
     * 积分商品详情页页面接口回调
     * @param {Object} res [服务器返回数据]
     * @param {Object} ext [扩展参数]
     */
    getGoodsInfoCallback (res, ext) {

      // 加载完成
      Indicator.close();

      // 返回处理
      if (res.code == 200) {

        // 解构数据
        let { data: datas } = res;
        /* 获取详细信息 */
        this.goodsInfo = datas
        /* 设置商品详情页 */
        /* 相似商品 */
      } else if (res.code == 400) {

        // 获取积分商品详情页失败
        Toast(res.message);
      } else {

        // 获取积分商品详情页失败
        Toast("获取积分商品详情页失败");
      }
    },
    /**
    * app选中地址回选
    * @param {Object} addressInfo [服务器返回数据]
    */
    appSelectAddressCallback (addressInfo) {
      if (this.isAndroid.value) {
        this.$refs.itemsInfo.getAppAddressInfo(addressInfo);
      } else {
        if (addressInfo) {
          this.$refs.itemsInfo.getAppAddressInfo(JSON.parse(addressInfo));
        } else {
          this.$refs.itemsInfo.getAppAddressInfo();
        }
      }
    },
    // 判断值是否大于库存
    onChange (value) {
      if ((parseInt(this.goodsInfo.stock) > -1 && parseInt(value) > parseInt(this.goodsInfo.stock)) || parseInt(value) > 999) {
        Toast("数量超出库存范围~")
      }
    },
  },
  //请求数据
  created () {
    // 设置标题
    this.$set(this, "title", "积分商品详情页");
    // 获取商品ID
    let goodsId = this.$route.query.goodsId;
    if (goodsId) {
      // 获取商品信息
      this.getGoodsInfo(goodsId);
    }
    // ios从url获取安卓localStorage
    if (this.isiPhone.value) {
      this.pointsToast_control = this.$route.query.pointsToast_control;
    } else {
      let ext = window.localStorage.getItem("ext");
      this.pointsToast_control = this.getParameterByName(
        "pointsToast_control",
        ext
      );
    }

    // 判断是否在App内
    if (this.isCNLive.value) {

      // 添加后退按钮组“后退”和“分享”按钮
      this.$set(this, 'backs', {
        funcs: {
          back: {
            icon: "static/img/icon_back.png"
          }
          // funcArray: [
          //   {
          //     icon: "static/img/icon_share.png",
          //     func: this.toShare
          //   }
          // ]
        }
      });

      // 设置标题
      this.$set(this.backs, 'title', '积分商品详情页');
    }

  },
  mounted () {
    var that = this;
    // 原生选中地址回调
    window["appSelectAddressCallback"] = function (result) {
      that.appSelectAddressCallback(result);
    };
    // 页面显示监听
    document.addEventListener('visibilitychange', () => {
      // 页面显示出来隐藏底部支付模块
      if (document.hidden === false) {
        this.show = false;
        this.stepperValue = 1;
      }
    });
    // 原生支付完成回调隐藏底部弹窗
    // window["appPaymentCallback"] = function (result) {
    //   that.show = false;
    // };
    // 如果是App外,设置唤起App和微信内分享参数
    // if (!this.isCNLive.value) {
    //   // 设置积分首页唤起app参数
    //   if (typeof this.$parent.getOpenApp === "function") {
    //     this.$parent.getOpenApp({
    //       type: 45,
    //       id: 1,
    //       url: ""
    //     });
    //   }
    // }
    // // 地址回选原生回调
    // if (this.isiPhone.value) {
    //   var that = this;
    //   function resolution (data) {
    //     that.appSelectAddressCallback();
    //   }
    //   this.$bridge.registerHandler("appSelectAddressCallback", function (
    //     data,
    //     responseCallback
    //   ) {
    //     resolution(data);

    //     responseCallback(data);
    //   });
    // } else if (this.isAndroid.value) {

    // }
  },
  destroyed () {
    // 隐藏通用浮层
    this.$parent.$refs.showModal.hideLayer();
  }
}
</script>

<style rel="stylesheet/less" lang="less" scoped>
@import './goodDetails.less';
</style>

<style>
.html_box img {
  display: block;
  width: 100%;
}
/* 更改有赞的样式 */
.van-stepper__input {
  font-size: 34px;
  color: #565656;
}
.van-stepper__minus,
.van-stepper__plus {
  color: #fc1541;
  background-color: #fff;
  border: 1px solid #fc1541;
  /* width: 54px;
  height: 54px;
  background: url('../../../static/img/reduce.png') no-repeat center top;
  background-size: 100%; */
}
</style>