MrShi
2 天以前 4eac422e52a4d28fb651b75d0f054697c7a2c0fa
admin/src/views/business/orderSet.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,266 @@
<template>
  <div class="box" style="max-height:calc(100% - 60px);margin-bottom:50px;overflow-y: auto" >
    <el-form :model="form" ref="form">
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【1】注册奖励</span>
      </div>
      <div class="item-content">
        <el-form-item label="积分奖励" label-width="150px"  prop="regIntegralRewardStatus">
          <el-switch  v-model="form.regIntegralRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="新人注册送" label-width="250px" prop="regIntegralReward">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.regIntegralReward"   placeholder="请输入"   v-trim>
            <template slot="append">积分</template>
          </el-input>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="优惠券奖励" label-width="150px"  prop="regCouponRewardStatus">
          <el-switch  v-model="form.regCouponRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <div  >
          <el-form-item label="新人注册送优惠券" label-width="250px" prop="regCouponRewardList">
          </el-form-item>
          <div  style="margin-left: 150px;border: 1px solid #f2f2f2">
            <el-table style="width: 600px;"  :data="form.regCouponRewardList">
              <el-table-column prop="shopPrice" label="优惠券" min-width="300px" align="center">
                <template slot-scope="{row}" >
                  <el-select v-model="row.couponId" style="width: 200px;margin: 0px 20px" clearable filterable   placeholder="请选择优惠券"  >
                    <el-option v-for="item in couponList"   :label="item.name"  :value="item.id">  </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column prop="num" label="数量" min-width="200px" align="center">
                <template slot-scope="{row}" >
                  <el-input  style="width: 100px;margin: 0px 20px" type="number"   v-model="row.num"   placeholder="请输入数量"   v-trim/>
                </template>
              </el-table-column>
              <el-table-column  label="操作" min-width="100px" align="center">
                <template slot-scope="scope" >
                  <el-button style="color: red;border: none;" @click="delCoupon(0,scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-button s type="primary" icon="el-icon-plus" @click="addCoupon(0)" style="height: 30px;margin: 10px;">添加</el-button>
          </div>
        </div>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【2】邀请好友奖励</span>
      </div>
      <div class="item-content">
        <el-form-item label="积分奖励" label-width="150px"  prop="shareIntegralRewardStatus">
          <el-switch  v-model="form.shareIntegralRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="好友成功注册送邀请人" label-width="250px" prop="shareIntegralReward">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.shareIntegralReward"   placeholder="请输入"   v-trim>
            <template slot="append">积分</template>
          </el-input>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="优惠券奖励" label-width="150px"  prop="shareCouponRewardStatus">
          <el-switch  v-model="form.shareCouponRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <div  >
          <el-form-item label="好友完成首单送邀请人优惠券" label-width="250px" prop="shareCouponRewardList">
          </el-form-item>
          <div  style="margin-left: 150px;border: 1px solid #f2f2f2">
            <el-table style="width: 600px;"  :data="form.shareCouponRewardList">
              <el-table-column prop="couponId" label="优惠券" min-width="300px" align="center">
                <template slot-scope="{row}" >
                  <el-select v-model="row.couponId" style="width: 200px;margin: 0px 20px"  clearable filterable   placeholder="请选择优惠券"  >
                    <el-option v-for="item in couponList"   :label="item.name"  :value="item.id">  </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column prop="num" label="数量" min-width="200px" align="center">
                <template slot-scope="{row}" >
                  <el-input  style="width: 100px;margin: 0px 20px" type="number"   v-model="row.num"   placeholder="请输入数量"   v-trim/>
                </template>
              </el-table-column>
              <el-table-column  label="操作" min-width="100px" align="center">
                <template slot-scope="scope" >
                  <el-button style="color: red;border: none;" @click="delCoupon(1,scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-button s type="primary" icon="el-icon-plus" @click="addCoupon(1)" style="height: 30px;margin: 10px;">添加</el-button>
          </div>
        </div>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【3】消费返积分</span>
      </div>
      <div class="item-content">
        <el-form-item label="返用户积分" label-width="150px"  prop="returnMemberIntegralStatus">
          <el-switch  v-model="form.returnMemberIntegralStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="订单实付金额每满" label-width="250px" prop="returnMemberIntegral">
          <el-input  style="width: 250px;margin: 0px 20px" type="number"   v-model="form.returnMemberIntegral"   placeholder="请输入"   v-trim>
            <template slot="append">元返用户1积分</template>
          </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:实付金额去除运费</p>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="返经销商积分" label-width="150px"  prop="returnShopIntegralStatus">
          <el-switch  v-model="form.returnShopIntegralStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="订单实付金额每满" label-width="250px" prop="returnShopIntegral">
          <el-input  style="width: 250px;margin: 0px 20px" type="number"   v-model="form.returnShopIntegral"   placeholder="请输入"   v-trim>
            <template slot="append">元返经销商1积分</template>
          </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:实付金额去除运费</p>
        </el-form-item>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【4】合计优惠承担比例</span>
      </div>
      <div class="item-content">
        <el-form-item label="总部承担" label-width="150px" prop="totalRate">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.totalRate"   placeholder="请输入"   v-trim>
            <template slot="append">%</template>
          </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:设置总部和经销商在订单合计优惠金额中(优惠券+积分抵扣)各自承担的比例</p>
        </el-form-item>
      </div>
      <el-form-item style="margin-top: 100px;width: 100%;text-align: center">
        <el-button type="primary" style="width: 300px"  :loading="working" @click="submit">保存配置项</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { getPlatformConfig, updPlatformConfig } from '@/api/system/dictData'
import { allList } from '@/api/business/coupon'
export default {
  name: '',
  data () {
    return {
      uploadData: {
        folder: ''
      },
      isUploading: false,
      working: false,
      couponList: [],
      form: {
        dictCode: 'ORDER_SET',
        regIntegralRewardStatus: 0,
        shareIntegralRewardStatus: 0,
        regCouponRewardStatus: 0,
        shareCouponRewardStatus: 0,
        regIntegralReward: 0,
        shareIntegralReward: 0,
        regCouponRewardList: [],
        shareCouponRewardList: [],
        returnMemberIntegralStatus: 0,
        returnShopIntegralStatus: 0,
        returnMemberIntegral: 0,
        returnShopIntegral: 0,
        totalRate: 0
      }
    }
  },
  created () {
    this.getCouponList()
    this.getData()
  },
  methods: {
    getCouponList () {
      allList({})
        .then(res => {
          if (res) {
            this.couponList = res || []
          }
        })
    },
    delCoupon (type, index) {
      if (type === 0) {
        this.form.regCouponRewardList.splice(index, 1)
      } else if (type === 1) {
        this.form.shareCouponRewardList.splice(index, 1)
      }
    },
    addCoupon (type) {
      if (type === 0) {
        this.form.regCouponRewardList.push({ couponId: null, num: null })
      } else if (type === 1) {
        this.form.shareCouponRewardList.push({ couponId: null, num: null })
      }
    },
    getData () {
      getPlatformConfig({})
        .then(res => {
          if (res) {
            this.form = {
              dictCode: 'ORDER_SET',
              regIntegralRewardStatus: res.regIntegralRewardStatus || 0,
              shareIntegralRewardStatus: res.shareIntegralRewardStatus || 0,
              regCouponRewardStatus: res.regCouponRewardStatus || 0,
              shareCouponRewardStatus: res.shareCouponRewardStatus || 0,
              regIntegralReward: res.regIntegralReward || 0,
              shareIntegralReward: res.shareIntegralReward || 0,
              regCouponRewardList: res.regCouponRewardList || [],
              shareCouponRewardList: res.shareCouponRewardList || [],
              returnMemberIntegralStatus: res.returnMemberIntegralStatus || 0,
              returnShopIntegralStatus: res.returnShopIntegralStatus || 0,
              returnMemberIntegral: res.returnMemberIntegral || 0,
              returnShopIntegral: res.returnShopIntegral || 0,
              totalRate: res.totalRate || 0
            }
          }
        })
    },
    submit () {
      console.log(this.form)
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return
        }
        // è°ƒç”¨æ–°å»ºæŽ¥å£
        this.isWorking = true
        updPlatformConfig(this.form).then(res => {
          this.$message.success('保存成功')
          this.getData()
        })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking = false
          })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.el-container /deep/  .el-main{
  width: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.item-content{
  display: flex;
  width: 100%;
}
.header{
  margin: 20px 0 20px 0;padding:10px;background-color: #E0DEDE;
}
/deep/ .el-main{
  width: 100%;
  //height: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.box {
  width: 100%;
  padding: 0 30px;
  box-sizing: border-box;
  background: #ffffff;
}
</style>