quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
shop_vue/src/views/plus/team/grade/part/Edit.vue
@@ -68,6 +68,19 @@
              <div><el-checkbox v-model="form.self_buy_money" class="pl10">包含个人业绩</el-checkbox></div>
            </div>
          </div>
          <div class="d-s-c mt16">
            <el-checkbox v-model="form.open_buy_product">购买指定商品</el-checkbox>
            <el-button type="primary" :disabled="form.open_buy_product==0" @click="openProduct">选择商品</el-button>
            <el-checkbox style="margin-left: 10px;" v-model="form.open_type_product">购买商品就升级</el-checkbox>
          </div>
          <div v-if="form.product_image && form.product_image.length > 0" class="d-s-c f-w product-team-image">
            <div v-for="(item, index) in form.product_image" :key="index" class="img pr">
              <a href="javascript:void(0)" class="delete-btn" @click="deleteFunc(index)"><i
                class="el-icon-error"></i></a>
              <img :src="item.image" height="100" />
              <p class="text-ellipsis">{{ item.product_name }}</p>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="提现条件" :label-width="formLabelWidth">
          <div>
@@ -96,12 +109,18 @@
      <el-button @click="dialogFormVisible">取 消</el-button>
      <el-button type="primary" @click="editGrade" :disabled="submit_loading">确 定</el-button>
    </div>
    <!--产品列表弹出层组件-->
    <Product :isproduct="isproduct" append-to-body @closeDialog="closeDialogFunc($event)">产品列表弹出层</Product>
  </el-dialog>
</template>
<script>
  import GradeApi from '@/api/plus/team/grade.js';
  import Product from '@/components/product/Product';
  export default {
    components: {
      Product
    },
    data() {
      return {
        /*左边长度*/
@@ -110,6 +129,8 @@
        dialogVisible: false,
        /*是否正在提交*/
        submit_loading: false,
        /*是否显示产品列表弹出层*/
        isproduct: false
      };
    },
    props: ['open_edit', 'form'],
@@ -120,6 +141,14 @@
      this.form.open_team_money=this.form.open_team_money==1?true:false;
      this.form.open_team_user=this.form.open_team_user==1?true:false;
      this.form.self_buy_money=this.form.self_buy_money==1?true:false;
      this.form.open_buy_product=this.form.open_buy_product==1?true:false;
      this.form.open_type_product=this.form.open_type_product==1?true:false;
      // 等级id转换成数组
      if (this.form.product_ids && this.form.product_ids.length) {
        for (let i = 0; i < this.form.product_ids.length; i++) {
          this.form.product_ids[i] = parseInt(this.form.product_ids[i]);
        }
      }
      this.dialogVisible = this.open_edit;
      //this.getData();
    },
@@ -146,6 +175,8 @@
              params.open_team_money=params.open_team_money==true?1:0;
              params.open_team_user=params.open_team_user==true?1:0;
              params.self_buy_money=params.self_buy_money==true?1:0;
              params.open_buy_product=params.open_buy_product==true?1:0;
              params.open_type_product=params.open_type_product==true?1:0;
            }else{
              delete params.open_agent_money;
              delete params.open_agent_user;
@@ -156,6 +187,10 @@
              delete params.team_money;
              delete params.team_user;
              delete params.self_buy_money;
              delete params.open_buy_product;
              delete params.product_ids;
              delete params.product_image;
              delete params.open_type_product;
            }
            GradeApi.editGrade(params, true)
              .then(data => {
@@ -188,10 +223,77 @@
            openDialog: false
          })
        }
      },
      /*删除商品*/
      deleteFunc(i) {
        this.form.product_ids.splice(i, 1);
        this.form.product_image.splice(i, 1);
      },
      /*产品列表弹出层*/
      openProduct() {
        this.isproduct = true;
        this.$nextTick(() => {
          setTimeout(() => {
            // 强制提升所有弹窗和遮罩层的z-index
            const dialogWrappers = document.querySelectorAll('.el-dialog__wrapper');
            const modals = document.querySelectorAll('.v-modal');
            // 为每个弹窗设置递增的z-index
            dialogWrappers.forEach((dialog, index) => {
              dialog.style.zIndex = 2000 + (index * 10) + 5;
            });
            // 为每个遮罩层设置递增的z-index(略低于对应弹窗)
            modals.forEach((modal, index) => {
              modal.style.zIndex = 2000 + (index * 10);
            });
          }, 50);
        });
      },
      /*关闭弹窗*/
      closeDialogFunc(e) {
        this.isproduct = e.openDialog;
        if (e.type == 'success') {
          if (this.form.product_ids == '') {
            this.form.product_ids = [];
            this.form.product_image = [];
          }
          if (this.form.product_ids.indexOf(e.params.product_id) == -1) {
            this.form.product_ids.push(e.params.product_id);
            this.form.product_image.push({
              product_id: e.params.product_id,
              image: e.params.image,
              product_name: e.params.product_name
            });
          } else {
            this.$message({
              message: '已选择该商品',
              type: 'warning'
            });
          }
        }
      }
    }
  };
</script>
<style></style>
<style>
.product-team-image p{
  width: 100px;
}
.product-team-image{
  margin-top: 10px;
  .delete-btn {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    right: -8px;
    top: -8px;
    color: red;
  }
}
</style>