setmealAddUpdate.vue 28.8 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 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
<template>
  <div class="marketing live-room">
    <div class="topMsg">
      <p class="pageTitle"
         v-if="!id">创建套餐</p>
      <p class="pageTitle"
         v-else>编辑套餐</p>
      <!-- <el-button type="primary" size="small" @click="goBack">返回</el-button> -->
    </div>
    <div class="live-room container marketing gl-form-page">
      <el-form ref="ruleForm"
               :rules="rules"
               :model="ruleForm"
               class="demo-ruleForm">
        <el-form-item size="small"
                      label="套餐名称:"
                      prop="packageName">
          <el-input size="small"
                    v-model="ruleForm.packageName"
                    maxlength="15"
                    placeholder="请输入套餐名称"></el-input>
        </el-form-item>
        <el-form-item size="small"
                      label="服务内容:"
                      class="is-required">
          <el-button @click="handleGiftAdd"
                     size="small"
                     class="default-blue-btn">选择服务</el-button>
          <div class="gift-block m-t-10"
               :style="{ 'margin-left': defaultLabelWidth }"
               v-show="choseItemList.length != 0">
            <div v-for="(item, index) in orderShow"
                 :key="index">
              <div class="gift-box flex-top"
                   v-show="couponObj[item].list.length">
                <img class="gift-logo"
                     :src="couponObj[item].logo"
                     alt="" />
                <div class="gift-content">
                  <div class="gift-item"
                       v-for="(subItem, subIndex) in couponObj[item].list"
                       :key="subIndex">
                    <span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
                    <div :class="['gift-coupon-name', subItem.status == '3' ? ' txt-grey' : '']">
                      {{ subItem.couponName }} × {{ subItem.couponAmount }}</div>
                    <div v-show="subItem.status == '3'"
                         class="gift-tips">已失效</div>
                    <i class="el-icon-delete"
                       @click="handleGiftDelete(item, subIndex)"></i>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="el-form-item__error"
               v-if="setmealContentRules">请选择套餐</div>
        </el-form-item>
        <el-form-item size="small"
                      label="会员专享:"
                      v-if="isHmd"
                      prop="memberPayFlags">
          <el-checkbox-group v-model="ruleForm.memberPayFlags">
            <el-checkbox v-for="(item, index) in memberList"
                         :key="index"
                         :label="item.name">{{ item.label }}</el-checkbox>
          </el-checkbox-group>
          <span class="give-tip"
                style="margin: -15px 0 0 154px">仅勾选的等级用户方可购买会员套餐</span>
        </el-form-item>
        <el-form-item label="赠送金卡会员:"
                      prop="giveGoldFlag"
                      v-if="showGh && accountLevel == 4">
          <el-radio-group v-model="ruleForm.giveGoldFlag">
            <el-radio :label="2">赠送</el-radio>
            <el-radio :label="1">不赠送</el-radio>
          </el-radio-group>
        </el-form-item>

        <span class="give-tip"
              v-if="showGh && accountLevel == 4">选择赠送,客户购买该套餐后即开通一年金卡会员权益</span>
        <el-form-item size="small"
                      label="套餐售价/元:"
                      prop="packagePrice">
          <el-input size="small"
                    v-model="ruleForm.packagePrice"
                    placeholder="请输入套餐售价"
                    @keyup.native="ruleForm.packagePrice = oninput(ruleForm.packagePrice)">
            <!-- <span slot="suffix" class="suffix-label">元</span> -->
          </el-input>
        </el-form-item>
        <el-form-item label="限购:"
                      prop="limitPurchaseFlag"
                      v-if="!showGh && accountLevel == 4">
          <el-radio-group v-model="ruleForm.limitPurchaseFlag"
                          class="limit-wrap"
                          @change="changeLimit">
            <el-radio :label="2">
              每人限购
              <el-input-number class="limit-number" size="mini" controls-position="right" :disabled="ruleForm.limitPurchaseFlag == 1" v-model="ruleForm.limitPurchaseNumber" @blur="ruleForm.limitPurchaseNumber=parseInt(ruleForm.limitPurchaseNumber)" :max="100"></el-input-number>
              次
            </el-radio>
            <el-radio :label="1">不限购</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- <template v-if="accountLevel == 4">
          <el-form-item size="small" label="计价器" prop="switchStatus">
            <el-switch v-model="ruleForm.switchStatus" active-color="#5850ff" active-text="开" inactive-text="关"></el-switch>
            <span class="calcValueMsg">开启后,小程序端套餐详情将展示该信息</span>
          </el-form-item>
        </template> -->
        <!-- <template v-if="ruleForm.switchStatus">
          <div class="shopValuePanel">
            <div class="setmealName">套餐服务</div>
            <div class="rowMsg" v-for="(item, index) in choseItemList" :key="index">
              <span>
                {{ item.couponName }}
                <span style="color: #4a4a4a">×{{ item.couponAmount }}</span>
              </span>
              <span>
                价值约:
                <span style="color: #ff5151">{{ item.shopPrice * item.couponAmount }}元</span>
              </span>
            </div>
          </div>
          <div class="allPrice" v-if="choseItemList.length > 0">
            套餐内服务实际价值总计约:
            <span class="price">{{ totalShopPrice }}元</span>
          </div>
        </template> -->
        <el-form-item size="small"
                      label="说明:"
                      prop="notes">
          <el-input size="small"
                    :rows="6"
                    type="textarea"
                    v-model="ruleForm.notes"
                    placeholder="请输入"
                    maxlength="200"
                    show-word-limit></el-input>
        </el-form-item>
        <template v-if="showGh && accountLevel == 4">
          <el-form-item size="small"
                        label="套餐详情图片:">
            <preview :picOptions="picOptions"
                     :imageUrlArr="packageImgArr"
                     @change="changeqrCode"></preview>
          </el-form-item>
          <span class="give-tip">可在套餐详情页顶部展示</span>
        </template>
        <template v-if="showGh && accountLevel == 4">
          <el-form-item size="small"
                        label="分享图片:">
            <preview :picOptions="sharePosterOptions"
                     :imageUrlArr="sharePosterImgArr"
                     @change="changeqrCode"></preview>
          </el-form-item>
        </template>
      </el-form>
    </div>
    <GLFooter>
      <el-button @click="goBack"
                 size="medium">取消</el-button>
      <el-button type="primary"
                 @click="submitForm()"
                 size="medium"
                 :loading="sloading">提交</el-button>
    </GLFooter>
    <GLDialog mode="small"
              type="warning"
              @onOk="handleTipConfirm"
              content="当前有内容信息未保存,是否继续返回?"
              @onCancel="handleTipClose"
              :visible.sync="isTipDialogVisible"></GLDialog>
    <select-gift-dialog v-if="isSelectGiftVisible"
                        :isSelectGiftVisible="isSelectGiftVisible"
                        :selectedGiftList="selectedMealList"
                        @handleGiftConfirm="handleGiftConfirm"
                        @handleGiftClose="handleGiftClose"></select-gift-dialog>
  </div>
</template>
<script>
import { getSetmealService, createSetMeal, getServiceInfo, updateSetMeal, configSetMeal } from '@/api/modules/setmeal'
import { getCardContent } from '@/api/modules/center'
import selectGiftDialog from './selectGiftDialog.vue'
import preview from './components/preview'

export default {
  components: {
    selectGiftDialog,
    preview
  },
  data() {
    // else if (value < this.memberPrice && this.ruleForm.giveGoldFlag == 2 && this.accountLevel == 4 && this.showGh) {
    //     return callback(new Error('套餐售价不能低于会员卡价格'))
    //   }
    var validatePrice = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请输入售价'))
      } else {
        callback()
      }
    }
    return {
      isHmd: true,
      memberPrice: '', //会员卡价格
      sloading: false,
      ruleForm: {
        packageName: '',
        packagePrice: '',
        switchStatus: true,
        // couponList:[],
        notes: '',
        giveGoldFlag: '',
        packageImg: '',
        memberPayFlags: [],
        limitPurchaseFlag: 1,
        limitPurchaseNumber: 0
      },
      copyRuleForm: {}, //用于检查页面信息是否改动
      rules: {
        packageName: [{ required: true, message: '请输入套餐名称', trigger: 'blur' }],
        packagePrice: [{ required: true, validator: validatePrice, trigger: 'blur' }],
        giveGoldFlag: [{ required: true, message: '请选择金卡会员', trigger: 'change' }],
        limitPurchaseFlag: [{ required: true, message: '请选择限购', trigger: 'change' }],
        memberPayFlags: [{ required: true, message: '请选择会员专享', trigger: 'change' }]
      },
      picOptions: {
        width: '104px',
        height: '104px',
        key: 'packageImg',
        isClose: true
      },
      sharePosterOptions: {
        width: '104px',
        height: '104px',
        key: 'sharePosterImg',
        isClose: true
      },
      memberList: [
        {
          label: '普通用户',
          name: 2
        },
        {
          label: '普通会员',
          name: 3
        },
        {
          label: '银卡会员',
          name: 4
        },
        {
          label: '金卡用户',
          name: 5
        }
      ],
      packageImgArr: [],
      sharePosterImgArr: [],
      allItemList: [],
      choseItemList: [], //['一年12次洗车券×1', '车身打蜡×2', '全车镀膜×1'],
      copyChoseItemList: [], //用于检查页面信息是否改动
      merchantId: 44184606,
      merchantName: '',
      setmealContentRules: false,
      isConfig: false,
      //弹窗
      //弹窗2(提示弹窗)
      isTipDialogVisible: false,
      selectNum: 0,
      totalPrice: 0,
      //选择服务弹窗
      isSelectGiftVisible: false,
      selectedMealList: [],
      orderShow: ['service', 'cash', 'discount', 'exchange'],
      couponObj: {
        // 折扣券
        discount: {
          label: '折扣券',
          discountType: 2,
          list: [],
          logo: require('../../assets/coupon/icon-discount.png')
        },
        // 代金券
        cash: {
          label: '代金券',
          discountType: 3,
          list: [],
          logo: require('../../assets/coupon/icon-cash.png')
        },
        // 兑换券
        exchange: {
          label: '兑换券',
          discountType: 4,
          list: [],
          logo: require('../../assets/coupon/icon-exchange.png')
        },
        // 会员服务
        service: {
          label: '会员服务',
          discountType: 7,
          list: [],
          logo: require('../../assets/coupon/icon-service.png')
        }
      },
      numToCoupon: {
        2: 'discount',
        3: 'cash',
        4: 'exchange',
        7: 'service'
      },
      // totalEstimatedCost: '',
      copyTotalPrice: 0, //用于检查页面信息是否改动
      id: this.$route.query.id || 0,
      accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
      showGh: false
    }
  },
  computed: {
    totalShopPrice() {
      var sum = 0
      if (this.choseItemList.length > 0) {
        this.choseItemList.forEach(item => {
          sum = ((sum * 100 + item.shopPrice * item.couponAmount * 100) / 100).toFixed(2)
        })
        return sum
      }
      return 0
    }
  },
  created() {
    this.copyRuleForm = JSON.parse(JSON.stringify(this.ruleForm)) //深拷贝一份数据
    if (window.__POWERED_BY_QIANKUN__) {
      //运行在qiankun容器中
      this.merchantId = this.$globalState.session.merchantId
      this.merchantName = this.$globalState.session.merchantName
      this.accountLevel = this.$globalState.session.accountLevel
    }
    // 判断是否是海马刀
    this.isHmd = this.merchantId == this.$hmdMerchantId
    console.log('this.merchantId', this.merchantId);
    console.log('this.$hmdMerchantId', this.$hmdMerchantId);
    this.showGh = window.location.host.indexOf('cgacar') != -1
    if (this.showGh) {
      this.getCardContentFun()
    }
    if (this.id) {
      this.getServiceInfo()
    } else {
      this.ruleForm.giveGoldFlag = 2
    }
    // this.getSetmealServiceFun() //获取服务套餐,执行完了之后去获取编辑详情
  },
  mounted() { },
  methods: {
    changeLimit(e) {
      if (e == 2) {
        this.ruleForm.limitPurchaseNumber = 1
        return
      }
      this.ruleForm.limitPurchaseNumber = 0
    },
    changeqrCode(val) {
      this.ruleForm[val.key] = val.arr[0]
    },
    //获取会员卡上方卡片的相关信息
    getCardContentFun() {
      getCardContent({ merchantId: this.merchantId }).then(res => {
        if (!res) {
          return
        }
        this.memberPrice = res.goodPrice
      })
    },
    // 礼包
    recoveryGiftList() {
      this.choseItemList = []
      this.orderShow.forEach(item => {
        this.couponObj[item].list.forEach(k => {
          this.choseItemList.push(k)
        })
      })
      if (this.choseItemList.length > 0) {
        this.setmealContentRules = false
      } else {
        this.setmealContentRules = true
      }
    },
    handleGiftDelete(attr, idx) {
      this.couponObj[attr].list.splice(idx, 1)
      // this.recoveryTotalPrice()
      this.recoveryGiftList()
    },
    // 计算预估成本
    recoveryTotalPrice() {
      this.totalEstimatedCost = 0
      this.orderShow.forEach(item => {
        this.couponObj[item].list.forEach(subItem => {
          // 失效券不加入预估成本
          if (subItem.status != '3') {
            this.totalEstimatedCost = this.totalEstimatedCost + parseInt(subItem.couponAnticipatedCost) * parseInt(subItem.couponAmount)
          }
        })
      })
      this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
    },
    handleGiftAdd() {
      this.selectedMealList = JSON.parse(JSON.stringify(this.couponObj))
      this.handleGiftClose()
    },
    handleGiftClose() {
      this.isSelectGiftVisible = !this.isSelectGiftVisible
    },
    handleGiftConfirm(selectedData) {
      this.handleGiftClose()
      this.couponObj = selectedData
      this.recoveryGiftList()
    },
    recoveryCoupon() {
      this.orderShow.forEach(item => {
        this.couponObj[item].list = []
      })
      this.choseItemList.forEach(item => {
        this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
      })
    },
    //编辑详情
    getServiceInfo() {
      getServiceInfo({ id: this.id }).then(res => {
        if (res.code == '0') {
          this.ruleForm = res.data
          this.ruleForm.switchStatus = res.data.switchStatus == 1 ? true : false
          this.choseItemList = res.data.list
          this.totalPrice = res.data.referencePrice
          this.choseItemList.forEach(item => {
            item.couponAmount = item.serviceQuantity
            item.id = item.serviceId
          })
          !res.data.memberPayFlags ? (this.ruleForm.memberPayFlags = []) : ''
          this.packageImgArr = res.data.packageImg ? [res.data.packageImg] : []
          this.sharePosterImgArr = res.data.sharePosterImg ? [res.data.sharePosterImg] : []
          this.recoveryCoupon()
          this.copyTotalPrice = this.totalPrice
          this.copyRuleForm = JSON.parse(JSON.stringify(this.ruleForm)) //深拷贝一份数据
          this.copyChoseItemList = this.choseItemList
        }
      })
    },
    //获取套餐服务总的数量
    getSetmealServiceFun() {
      let params = {}
      params.merchantId = this.merchantId
      params.status = ''
      params.discountType = ''
      params.pageSize = 1000
      params.currentPage = 1
      getSetmealService(params).then(res => {
        this.allItemList = res.list.map(item => {
          return {
            ...item,
            serviceQuantity: 0
          }
        })
        if (this.id) {
          this.getServiceInfo() //获取编辑详情
        }
      })
    },
    submitForm(formName) {
      this.$refs.ruleForm.validate(async valid => {
        if (this.choseItemList.length <= 0) {
          this.setmealContentRules = true
          return
        }
        if (!valid) {
          return
        }
        if (this.id) {
          //需要调config的接口????
          // scrm.api.equity.package.service.config
          //调修改的接口
          this.configFun().then(result => {
            if (!result) {
              let param = {}
              param.id = this.id
              param.merchantId = this.merchantId
              param.merchantName = this.merchantName
              param.packageName = this.ruleForm.packageName
              param.packagePrice = this.ruleForm.packagePrice
              param.notes = this.ruleForm.notes
              param.switchStatus = this.ruleForm.switchStatus ? 1 : 0
              if (this.isHmd) param.memberPayFlags = this.ruleForm.memberPayFlags
              if (this.showGh) {
                param.giveGoldFlag = this.ruleForm.giveGoldFlag
                if (this.accountLevel == 4) {
                  param.packageImg = this.ruleForm.packageImg
                  param.sharePosterImg = this.ruleForm.sharePosterImg
                }
              }
              if (!this.showGh && this.accountLevel == 4) {
                param.limitPurchaseFlag = this.ruleForm.limitPurchaseFlag
                param.limitPurchaseNumber = this.ruleForm.limitPurchaseFlag == 2 ? this.ruleForm.limitPurchaseNumber : ''
              }

              let lists = this.choseItemList
              for (var k in lists) {
                param[`lists[${k}].serviceQuantity`] = lists[k].couponAmount
                param[`lists[${k}].serviceId`] = lists[k].id
              }
              this.sloading = true
              updateSetMeal(param)
                .then(res => {
                  this.sloading = false
                  this.$message({
                    message: res.code == '0' ? '修改成功' : res.message,
                    type: res.code == '0' ? 'success' : 'error'
                  })
                  if (res.code == '0') {
                    this.$router.push('/memberCenter/setmeal')
                  }
                })
                .catch(err => {
                  this.sloading = false
                })
                .finally(() => {
                  this.sloading = false
                })
            }
          })
        } else {
          //调创建的接口
          let params = {}
          params.referencePrice = this.totalPrice
          params.merchantId = this.merchantId
          params.merchantName = this.merchantName
          params.packageName = this.ruleForm.packageName
          params.packagePrice = this.ruleForm.packagePrice
          params.notes = this.ruleForm.notes
          params.switchStatus = this.ruleForm.switchStatus ? 1 : 0
          // 海马刀传参
          if (this.isHmd) params.memberPayFlags = this.ruleForm.memberPayFlags
          if (this.showGh) {
            params.giveGoldFlag = this.ruleForm.giveGoldFlag
            if (this.accountLevel == 4) {
              params.packageImg = this.ruleForm.packageImg
              params.sharePosterImg = this.ruleForm.sharePosterImg
            }
          }
          if (!this.showGh && this.accountLevel == 4) {
            params.limitPurchaseFlag = this.ruleForm.limitPurchaseFlag
            params.limitPurchaseNumber = this.ruleForm.limitPurchaseFlag == 2 ? this.ruleForm.limitPurchaseNumber : ''
          }
          let list = this.choseItemList
          for (var i in list) {
            params[`list[${i}].serviceQuantity`] = list[i].couponAmount
            params[`list[${i}].serviceId`] = list[i].id
          }
          this.sloading = true
          createSetMeal(params)
            .then(res => {
              this.sloading = false
              this.$message({
                message: res.code == '0' ? '创建成功' : res.message,
                type: res.code == '0' ? 'success' : 'error'
              })
              if (res.code == '0') {
                this.$router.push('/memberCenter/setmeal')
              }
            })
            .catch(err => {
              this.sloading = false
            })
            .finally(() => {
              this.sloading = false
            })
        }
      })
    },
    configFun() {
      return new Promise(resolve => {
        let params = {}
        params.id = this.id
        let list = this.choseItemList
        for (var i in list) {
          params[`list[${i}].serviceQuantity`] = list[i].couponAmount
          params[`list[${i}].serviceId`] = list[i].id
        }
        configSetMeal(params).then(res => {
          if (res.code == -1) {
            this.$message({
              message: res.message,
              type: 'error'
            })
            resolve(true)
          } else {
            resolve(false)
          }
        })
      })
    },
    goBack() {
      // this.$router.go(-1)
      if (JSON.stringify(this.ruleForm) == JSON.stringify(this.copyRuleForm) && this.choseItemList.length == this.copyChoseItemList.length && this.totalPrice == this.copyTotalPrice) {
        // this.$router.go(-1)
        this.$router.push('/memberCenter/setmeal')
      } else {
        this.isTipDialogVisible = true
      }
    },
    oninput(value) {
      let str = value
      let len1 = str.substr(0, 1)
      let len2 = str.substr(1, 1) //如果第一位是0,第二位不是点,就用数字把点替换掉
      if (str.length > 1 && len1 == 0 && len2 != '.') {
        str = str.substr(1, 1)
      } //第一位不能是.
      if (len1 == '.') {
        str = ''
      }
      if (len1 == '+') {
        str = ''
      }
      if (len1 == '-') {
        str = ''
      } //限制只能输入一个小数点
      if (Number(value) >= 99999) {
        return (str = 99999)
      }
      if (str.indexOf('.') != -1) {
        let str_ = str.substr(str.indexOf('.') + 1)
        if (str_.indexOf('.') != -1) {
          str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
        }
      }
      //正则替换
      // (/[^\-\d.]/g, ''))"
      str = str.replace(/[^\d.^]+/g, '') // 保留数字和小数点
      str = str.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/, '$1') // 小数点后只能输 2 位
      return str
    },
    handleTipClose() {
      this.isTipDialogVisible = false
    },
    handleTipConfirm() {
      this.$router.push('/memberCenter/setmeal')
    }
  }
}
</script>
<style lang="scss" scoped>
.live-room {
  /deep/ .el-icon-warning {
    color: #5850ff !important;
  }

  .topMsg {
    padding: 0 20px;
    background-color: #fff;
    height: 56px;
    border-bottom: 1px solid#DCDFE6;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .pageTitle {
      position: relative;
      // margin-bottom: 20px;
      // height: 20px;
      font-size: 20px;
      font-weight: 700;
      color: #333333;
      line-height: 20px;
      letter-spacing: 1px;
    }
  }

  .container {
    margin: 0 0px 16px;
    position: relative;
    min-height: calc(100vh - 300px);

    .allChoseWrap {
      width: 363px;
      min-height: 32px;
      margin-top: 10px;
      background: #f7f7f7;
      border-radius: 4px;
      border: 1px solid #dcdfe6;
      display: flex;
      flex-wrap: wrap;
      align-content: flex-start;
      padding-top: 5px;
      padding-left: 10px;
      box-sizing: border-box;
      .choseItem {
        position: relative;
        min-width: 90px;
        padding: 0 22px 0 6px;
        box-sizing: border-box;
        height: 26px;
        line-height: 22px;
        // background: #e6e9ff;
        background: #fafbfe;
        border-radius: 4px;
        // border-radius: 2px;
        // border: 1px solid #5850ff;
        border: 1px solid #e8e8ea;
        margin-right: 10px;
        margin-bottom: 10px;

        span {
          font-size: 14px;
          font-weight: 400;
          color: #666666;
        }

        .close-x {
          position: absolute;
          color: #666;
          top: 5px;
          right: 5px;
          display: inline-block;
          width: 12px;
          text-align: center;
          height: 12px;
          line-height: 12px;
          cursor: pointer;

          &:hover {
            border-radius: 100%;
            background-color: #e8e8ea;
          }
        }

        // img {
        //   position: absolute;
        //   top: 5px;
        //   right: 5px;
        //   cursor: pointer;
        // }
      }
    }

    .totalWrap {
      margin-top: 5px;
      margin-bottom: -5px;

      span {
        font-size: 14px;
        font-weight: 400;
        color: #666666;
      }

      span:last-child {
        color: #ff5151;
      }
    }

    .calcValueMsg {
      margin-left: -8px;
      font-size: 14px;
      font-weight: 400;
      color: #999999;
    }

    .shopValuePanel {
      margin-left: 120px;
      margin-bottom: 15px;
      width: 550px;
      min-height: 140px;
      border: 1px solid #e8e8ea;
      border-radius: 2px;
      padding-bottom: 10px;

      .setmealName {
        padding-left: 10px;
        height: 28px;
        line-height: 28px;
        background: #fafafa;
        border-radius: 2px 2px 0px 0px;
        border-bottom: 1px solid #e8e8ea;
        font-size: 14px;
        font-weight: 400;
        color: #666666;
      }

      .rowMsg {
        font-size: 14px;
        font-weight: 400;
        color: #666666;
        margin-top: 10px;
        > span:first-child {
          display: inline-block;
          min-width: 165px;
          text-align: right;
          margin-right: 10px;
        }
      }
    }

    .allPrice {
      margin: 0 0 20px 120px;
      font-size: 14px;
      font-weight: 400;
      color: #666666;

      .price {
        color: #ff5151;
      }
    }
  }

  .marketing {
    // 礼包
    .gift-block {
      width: 878px;
      border-radius: 4px;
      border: 1px solid #e5e5e5;

      .gift-title {
        padding: 10px;
        background-color: #f4f6fc;
        border-bottom: 1px solid #e5e5e5;

        .price {
          font-size: 18px;
        }
      }

      .gift-box {
        display: flex;
        padding: 10px 0 10px 10px;

        .gift-logo {
          width: 58px;
          height: 22px;
          margin-right: 12px;
        }

        .gift-label {
          width: 70px;
          color: #999999;
          text-align: right;
        }

        .gift-content {
          width: calc(100% - 70px);
          border-bottom: 1px solid #e5e5e5;
          line-height: 22px;

          .gift-item {
            display: inline-block;
            width: 50%;

            .gift-coupon-name {
              display: inline-block;
              margin: 0 5px 0 7px;
            }

            .gift-tips {
              display: inline-block;
              font-size: 12px;
              height: 18px;
              line-height: 18px;
              color: #999999;
              background-color: #eeeded;
              margin-right: 7px;
            }
          }
        }

        .gift-content:last-child {
          border-bottom: 0px;
        }
      }
    }
  }

  .footer-panel {
    position: fixed;
    bottom: 0px;
    height: 78px;
    left: 220px;
    width: 100%;
    background: #ffffff;
    box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
    z-index: 999;

    div {
      display: inline-block;
      position: relative;
      transform: translate(-50%, -50%);
      left: 50%;
      top: 50%;
      margin-left: -110px;
    }
  }
  .give-tip {
    font-weight: 400;
    font-size: 12px;
    color: #999999;
    display: block;
    margin: -15px 0 20px 154px;
  }
}
/deep/ .el-form-item__error {
  margin-left: 154px;
}

.limit-wrap {
  /deep/ {
    .el-input-number--mini .el-input__inner {
      height: 36px;
    }
    .limit-number {
      display: inline-block;
      width: 110px;
      height: 36px;
      margin: 0 4px;
    }
    .el-input--mini .el-input__inner {
      border: 1px solid #e5e5e5;
    }
    .el-input-number--mini .el-input-number__decrease,
    .el-input-number--mini .el-input-number__increase {
      width: 21px !important;
      line-height: 17.5px;
      // border: 1px solid #E5E5E5;
      background-color: #fff;
    }
  }
}
</style>