quanwei
19 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
shop_vue/src/views/plus/team/grade/Add.vue
@@ -20,22 +20,60 @@
        </el-input>
         <div class="gray9">队长分红=(实际付款金额 + 余额抵扣 - 运费)* 分红比例</div>
      </el-form-item>
      <el-form-item label="自动升级" :label-width="formLabelWidth" prop="auto_upgrade">
        <el-radio-group v-model="form.auto_upgrade">
          <el-radio :label="1">允许自动升级</el-radio>
          <el-radio :label="0">禁止自动升级</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="升级条件" :label-width="formLabelWidth">
        <div class="gray9">满足以下勾选的其中一个条件,会员自动升级到该等级</div>
        <div class="d-s-c mt16">
          <el-checkbox v-model="form.open_money">累计消费满</el-checkbox>
          <el-input v-model="form.upgrade_money" type="number" :disabled="form.open_money==0" style="width: 160px; margin-left: 10px;" ></el-input>
          <span class="ml10">元</span>
        <div>
          <el-radio-group v-model="form.condition_type">
            <el-radio label="and">满足勾选的所有条件</el-radio>
            <el-radio label="or">满足勾选的任意条件</el-radio>
          </el-radio-group>
        </div>
        <div class="d-s-c mt16">
          <el-checkbox v-model="form.open_points">累计积分满</el-checkbox>
          <el-input v-model="form.upgrade_points" type="number" :disabled="form.open_points==0" style="width: 160px;margin-left: 10px;"></el-input>
          <span class="ml10">个</span>
          <div class="mr10">
            <el-checkbox v-model="form.open_agent_money">累计佣金</el-checkbox>
            <el-input v-model="form.agent_money" type="number" :disabled="form.open_agent_money==0" style="width: 160px; margin-left: 10px;" >
              <template slot="append">元</template>
            </el-input>
          </div>
          <div>
            <el-checkbox v-model="form.open_agent_user">直推分销商</el-checkbox>
          <el-input v-model="form.agent_user" type="number" :disabled="form.open_agent_user==0" style="width: 160px;margin-left: 10px;">
            <template slot="append">人</template>
          </el-input>
          </div>
        </div>
        <div class="d-s-c mt16">
          <el-checkbox v-model="form.open_invite">推荐人数满</el-checkbox>
          <el-input v-model="form.upgrade_invite" type="number" :disabled="form.open_invite==0" style="width: 160px;margin-left: 10px;"></el-input>
          <span class="ml10">人</span>
          <div class="mr10">
            <el-checkbox v-model="form.open_team_user">团队人数</el-checkbox>
            <el-input v-model="form.team_user" type="number" :disabled="form.open_team_user==0" style="width: 160px;margin-left: 10px;">
              <template slot="append">人</template>
            </el-input>
          </div>
          <div class="d-s-c">
            <el-checkbox v-model="form.open_team_money">团队业绩</el-checkbox>
            <el-input v-model="form.team_money" type="number" :disabled="form.open_team_money==0" style="width: 160px;margin-left: 10px;">
              <template slot="append">元</template>
            </el-input>
            <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>
@@ -44,12 +82,18 @@
      <el-button @click="dialogFormVisible">取 消</el-button>
      <el-button type="primary" @click="addGrade()" :disabled="submit_loading">确 定</el-button>
    </div>
    <!--产品列表弹出层组件-->
    <Product :isproduct="isproduct" append-to-body @closeDialog="closeDialogFunc($event)">产品列表弹出层</Product>
  </el-dialog>
</template>
<script>
  import UserApi from '@/api/plus/team.js';
  import Product from '@/components/product/Product';
  export default {
    components: {
      Product
    },
    data() {
      return {
        form: {
@@ -71,6 +115,36 @@
          upgrade_invite:0,
          /*等级权重*/
          weight: 100,
          /*自动升级*/
          auto_upgrade: 1,
          /*升级条件*/
          condition_type: 'and',
          /*是否开放累计推广佣金*/
          open_agent_money: 0,
          /*累计推广佣金*/
          agent_money: 0,
          /*是否开放直推分销商*/
          open_agent_user: 0,
          /*直推分销商*/
          agent_user: 0,
          /*是否开放团队人数*/
          open_team_user: 0,
          /*团队人数*/
          team_user: 0,
          /*是否开放团队业绩*/
          open_team_money: 0,
          /*团队业绩*/
          team_money: 0,
          /*是否包含个人业绩*/
          self_buy_money: 0,
          /*是否开放购买指定商品*/
          open_buy_product: 0,
          /*购买指定商品id列表*/
          product_ids: [],
          /*购买指定商品图片及名称列表*/
          product_image: [],
          /*购买商品就升级*/
          open_type_product: 0,
        },
        /*左边长度*/
        formLabelWidth: '120px',
@@ -78,6 +152,8 @@
        dialogVisible: false,
        /*是否正在提交*/
        submit_loading: false,
        /*是否显示产品列表弹出层*/
        isproduct: false
      };
    },
    props: ['open_add'],
@@ -93,9 +169,13 @@
        self.$refs.form.validate((valid) => {
          if (valid) {
            self.submit_loading = true;
            params.open_money=params.open_money==true?1:0;
            params.open_points=params.open_points==true?1:0;
            params.open_invite=params.open_invite==true?1:0;
            params.open_agent_money = params.open_agent_money == true ? 1 : 0;
            params.open_agent_user = params.open_agent_user == true ? 1 : 0;
            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;
            UserApi.addgrade(params, true).then(data => {
                self.submit_loading = false;
                self.$message({
@@ -123,10 +203,76 @@
            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>