zxl
2 天以前 226c543d57ef46fcd0cd1f71fb9ceb2b715cab97
抽奖活动,奖品
2个文件已修改
147 ■■■■■ 已修改文件
manager/src/views/activity-prize/index.vue 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manager/src/views/activity-prize/prize.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manager/src/views/activity-prize/index.vue
@@ -78,7 +78,7 @@
              @click="publishPrizeActivity(row)"
              :loading="row.statusLoading"
            >
              {{row.enableStatus === 'on' ? '关闭' : '开启'}}
              {{row.enableStatus === 'ON' ? '关闭' : '开启'}}
            </Button>
            <Button
              type="info"
@@ -90,16 +90,16 @@
              size="small"
              @click="setPrize(row)"
            >奖品设置</Button>
            <Button
              type="info"
              size="small"
              @click="openEdit(row)"
            >编辑</Button>
            <Button
              type="error"
              size="small"
              @click="delById(row)"
            >删除</Button>
<!--            <Button-->
<!--              type="info"-->
<!--              size="small"-->
<!--              @click="openEdit(row)"-->
<!--            >编辑</Button>-->
<!--            <Button-->
<!--              type="error"-->
<!--              size="small"-->
<!--              @click="delById(row)"-->
<!--            >删除</Button>-->
          </div>
        </template>
@@ -282,8 +282,8 @@
          <Col span="24">
            <div class="detail-item">
              <label>活动状态:</label>
              <Tag :color="detailData.enableStatus === 'on' ? 'success' : 'default'">
                {{ detailData.enableStatus === 'on' ? '已启用' : '未启用' }}
              <Tag :color="detailData.enableStatus === 'ON' ? 'success' : 'default'">
                {{ detailData.enableStatus === 'ON' ? '已启用' : '未启用' }}
              </Tag>
            </div>
          </Col>
@@ -334,7 +334,7 @@
                    </span>
                        </Col>
                        <Col span="12">
                          <span>概率: {{ prize.probability}}%</span>
                          <span>概率: {{ prize.prizeProbability}}%</span>
                        </Col>
                      </Row>
                    </div>
@@ -437,7 +437,7 @@
                    v-model="row.prizeNum"
                    :min="1"
                    :max="999999"
                    placeholder="请输入每日最大中奖数"
                    placeholder="数量"
                    style="width: 100%"
                    @on-change="(val) => handlePrizeNumChange(val, index)"
                  ></InputNumber>
@@ -656,7 +656,7 @@
        prizeNum:0,
        activityImg:'',
        activityCover:'',
        enableStatus:'off'
        enableStatus:''
      },
      loading:false,
      columns:[
@@ -707,9 +707,9 @@
          render: (h, params) => {
            return h('Tag', {
              props: {
                color: params.row.enableStatus  === 'on' ? 'green' : 'default'
                color: params.row.enableStatus  === 'ON' ? 'green' : 'default'
              }
            }, params.row.enableStatus === 'on' ? '开启' : '关闭')
            }, params.row.enableStatus === 'ON' ? '开启' : '关闭')
          }
        },
        {
@@ -787,7 +787,6 @@
    // 格式化奖品类型
    replaceText(type) {
      console.log(type)
      if (type === "coupon") {
        return "优惠券";
      }
@@ -820,7 +819,7 @@
    },
    // 检查奖品是否已被选择
    isPrizeChosen(prizeId) {
      return this.choiceData.some(item => item.id === prizeId);
      return this.choiceData.some(item => item.prizeId === prizeId);
    },
    choicePrize(row){
      //判断数组长度
@@ -828,7 +827,9 @@
        this.$Message.warning("最多添加5个奖品")
        return;
      }
      console.log(row.prizeId)
      if (this.isPrizeChosen(row.id)){
        this.$Message.warning("已添加")
        return;
      }
@@ -895,7 +896,7 @@
    //奖品设置
    setPrize(row){
      //判断是否启动,若启动则,无法编辑
      if("on" === row.enableStatus){
      if("ON" === row.enableStatus){
        this.$Message.error("抽奖已开启,不能编辑!")
        return
      }
@@ -908,6 +909,9 @@
      getActivityRefPrizeByActivityId(row.id).then(res =>{
        this.choiceLoading = false;
        if (res.code === 200){
          res.data.forEach(item =>{
            item.id =null;
          })
          this.choiceData = res.data
        }
@@ -1068,25 +1072,29 @@
      console.log(this.detailData)
    },
    openEdit(row){
      this.modelShow = true;
      this.modelTitle = "编辑活动";
      this.activityFrom= {
        id:row.id,
        activityName:row.activityName,
        activityDes:row.activityDes,
        beginTime:this.formatDate(row.beginTime, 'YYYY-MM-DD HH:mm:ss'),
        endTime: this.formatDate(row.endTime, 'YYYY-MM-DD HH:mm:ss'),
        maxPrize:row.maxPrize,
        prizeNum:row.prizeNum,
        activityImg:row.activityImg,
        activityCover:row.activityCover,
        enableStatus:row.enableStatus,
      }
      this.coverTempUrl = row.activityCoverUrl;
      this.imgTempUrl = row.activityImgUrl;
    },
    // openEdit(row){
    //   if("ON" === row.enableStatus){
    //     this.$Message.error("抽奖已开启,不能编辑!")
    //     return
    //   }
    //   this.modelShow = true;
    //   this.modelTitle = "编辑活动";
    //   this.activityFrom= {
    //     id:row.id,
    //     activityName:row.activityName,
    //     activityDes:row.activityDes,
    //     beginTime:this.formatDate(row.beginTime, 'YYYY-MM-DD HH:mm:ss'),
    //     endTime: this.formatDate(row.endTime, 'YYYY-MM-DD HH:mm:ss'),
    //     maxPrize:row.maxPrize,
    //     prizeNum:row.prizeNum,
    //     activityImg:row.activityImg,
    //     activityCover:row.activityCover,
    //     enableStatus:row.enableStatus,
    //   }
    //   this.coverTempUrl = row.activityCoverUrl;
    //   this.imgTempUrl = row.activityImgUrl;
    //
    // },
    handleSearch(type,value){
      if (type === 'beginTime') {
@@ -1098,6 +1106,7 @@
    },
    openAdd(){
      this.$refs.form.resetFields()
      this.activityFrom.id = null;
      this.modelShow = true;
      this.modelTitle = "新增活动";
      this.coverTempUrl = null;
@@ -1105,16 +1114,21 @@
      this.prizeImg = null;
      this.imgTempUrl = null;
    },
    delById(row){
      del(row.id).then(res=>{
        if (res.code === 200){
          this.$Message.success(res.msg)
        }else {
          this.$Message.error(res.msg)
        }
        this.getPage()
      })
    },
    // delById(row){
    //   if("ON" === row.enableStatus){
    //     this.$Message.error("抽奖已开启,无法删除!")
    //     return
    //   }
    //   //若关联商品不让删
    //   del(row.id).then(res=>{
    //     if (res.code === 200){
    //       this.$Message.success(res.msg)
    //     }else {
    //       this.$Message.error(res.msg)
    //     }
    //     this.getPage()
    //   })
    // },
    // 获取富文本编辑器的内容
    // 初始化数据
    init() {
@@ -1138,15 +1152,15 @@
      this.prizeSearchForm.pageNumber = page
      this.getPrizeList()
    },
    publishPrizeActivity(row){
      publishPrizeActivity(row.id).then(res =>{
    async publishPrizeActivity(row){
      await publishPrizeActivity(row.id).then(res =>{
        if (res.code === 200){
          this.$Message.success(res.msg)
        }else{
          this.$Message.error(res.msg)
        }
      })
      this.getPage()
      await this.getPage()
    },
  },
manager/src/views/activity-prize/prize.vue
@@ -588,6 +588,7 @@
    handleRowClick(currentRow ,oldCurrentRow){
      this.prizeFrom.couponId = currentRow.id;
      this.showCoupon = currentRow.couponName;
      console.log(this.prizeFrom.couponId)
    },
    getCouponDataList() {
      // 获取数据
@@ -595,7 +596,6 @@
      getPlatformCouponList(this.couponSearchForm).then((res) => {
        this.couponLoading = false;
        if (res.success) {
          console.log(res);
          this.couponData = res.result.records;
          this.couponTotal = res.result.total;
        }
@@ -701,7 +701,7 @@
      this.modelShow = false
      this.submitLoading = false
      this.showCoupon = '';
      this.$refs.form.resetFields()
    },
    getPage(){
      this.loading = true;
@@ -723,10 +723,13 @@
      this.infoModalShow = false;
    },
    openEdit(row){
      this.$refs.form.resetFields();
      //重置id
      //需要判断是否可以编辑
      canUpDatePrizeDraw(row.id).then(res =>{
        if (res.code === 200){
          if (res.state){
            console.log(res.data)
            this.modelShow = true;
            this.modelTitle = "编辑奖品";
            this.prizeFrom ={
@@ -758,6 +761,9 @@
    },
    openAdd(){
      this.$refs.form.resetFields()
      //重置id
      this.prizeFrom.id = null;
      this.modelShow = true;
      this.modelTitle = "新增奖品";
      //清除表单状态.
@@ -767,8 +773,17 @@
      this.imgTempUrl = null;
      this.showCoupon = null;
    },
    delById(row){
      del(row.id).then(res=>{
    async delById(row){
      let status = false
     await canUpDatePrizeDraw(row.id).then(res => {
        if (res.code === 200) {
          status = res.state;
        }
      });
     if (status){
       await del(row.id).then(res=>{
        if (res.code === 200){
          this.$Message.success(res.msg)
        }else {
@@ -776,6 +791,10 @@
        }
        this.getPage()
      })
     }else {
       this.$Message.error("该奖品在抽奖活动中无法删除!")
     }
    },
    // 获取富文本编辑器的内容
    // 初始化数据