quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
shop_vue/src/views/plus/operations/setting/part/Basic.vue
@@ -20,27 +20,43 @@
            <el-radio :label="40">下级分销商总数</el-radio>
            <el-radio :label="50">累计佣金总数</el-radio>
            <el-radio :label="90">单次消费</el-radio>
            <el-radio :label="100">购买指定商品</el-radio>
          </el-radio-group>
        </div>
      </el-form-item>
      <el-form-item :label="label_name" v-if="form.become!=10">
      <el-form-item :label="label_name" v-if="form.become!=10&&form.become!=100">
        <div>
          <el-input v-model="form.province_condition" type="number" class="max-w460">
            <template slot="prepend">省代理满</template>
            <template slot="prepend">省运营中心满</template>
            <template slot="append">{{unit}}</template>
          </el-input>
        </div>
        <div>
          <el-input v-model="form.city_condition" type="number" class="max-w460 mt10">
            <template slot="prepend">市代理满</template>
            <template slot="prepend">市运营中心满</template>
            <template slot="append">{{unit}}</template>
          </el-input>
        </div>
        <div>
          <el-input v-model="form.area_condition" type="number" class="max-w460 mt10">
            <template slot="prepend">区/县代理满</template>
            <template slot="prepend">区/县运营中心满</template>
            <template slot="append">{{unit}}</template>
          </el-input>
        </div>
      </el-form-item>
      <el-form-item label="" v-if="form.become == 100">
        <div>
          <el-row>
            <el-button type="primary" @click="openProduct">选择商品</el-button>
            <div v-if="form.product_image && form.product_image.length > 0" class="d-s-c f-w">
              <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" width="100" height="100" />
                <p class="text-ellipsis">{{ item.product_name }}</p>
              </div>
            </div>
          </el-row>
        </div>
      </el-form-item>
      <!--提交-->
@@ -48,6 +64,8 @@
        <el-button size="small" type="primary" @click="onSubmit" :loading="loading">提交</el-button>
      </div>
    </el-form>
    <!--产品列表弹出层组件-->
    <Product :isproduct="isproduct" @closeDialog="closeDialogFunc($event)">产品列表弹出层</Product>
  </div>
</template>
@@ -84,6 +102,9 @@
    this.form = this.settingData.data.basic.values;
    this.form.become = parseInt(this.form.become);
    this.chooseBecomeType(this.form.become);
    if (!this.form.product_image) {
      this.form.product_image = [];
    }
  },
  methods: {
@@ -132,6 +153,32 @@
        this.unit = '元';
      }
    },
    /*删除商品*/
    deleteFunc(i) {
      this.form.become__buy_product_ids.splice(i, 1);
      this.form.product_image.splice(i, 1);
    },
    /*产品列表弹出层*/
    openProduct() {
      this.isproduct = true;
    },
    /*关闭弹窗*/
    closeDialogFunc(e) {
      this.isproduct = e.openDialog;
      if (e.type == 'success') {
        if (this.form.become__buy_product_ids.indexOf(e.params.product_id) == -1) {
          this.form.become__buy_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>