|  | @@ -53,7 +53,7 @@
 | 
											
												
													
														|  |            <el-radio v-model="form.useThresholdType" :label="2">指定条件</el-radio>
 |  |            <el-radio v-model="form.useThresholdType" :label="2">指定条件</el-radio>
 | 
											
												
													
														|  |          </el-form-item>
 |  |          </el-form-item>
 | 
											
												
													
														|  |          <el-form-item label="使用对象" prop="useUserType" required>
 |  |          <el-form-item label="使用对象" prop="useUserType" required>
 | 
											
												
													
														|  | -          <el-radio-group v-model="form.useUserType" @input="handleChange">
 |  | 
 | 
											
												
													
														|  | 
 |  | +          <el-radio-group v-model="form.useUserType" :disabled ="isDisabled" @input="handleChange">
 | 
											
												
													
														|  |              <el-radio :label="1">所有用户</el-radio>
 |  |              <el-radio :label="1">所有用户</el-radio>
 | 
											
												
													
														|  |              <el-radio :label="2">指定分销商</el-radio>
 |  |              <el-radio :label="2">指定分销商</el-radio>
 | 
											
												
													
														|  |            </el-radio-group>
 |  |            </el-radio-group>
 | 
											
										
											
												
													
														|  | @@ -169,7 +169,8 @@
 | 
											
												
													
														|  |  // import { updateNoticeMgr } from "@/api/system/noticeMgr";
 |  |  // import { updateNoticeMgr } from "@/api/system/noticeMgr";
 | 
											
												
													
														|  |  import { saveAndEdit, pageTableList } from "@/api/coupon/coupon";
 |  |  import { saveAndEdit, pageTableList } from "@/api/coupon/coupon";
 | 
											
												
													
														|  |  import { goodsPageList } from "@/api/programmeMr/programmeMr";
 |  |  import { goodsPageList } from "@/api/programmeMr/programmeMr";
 | 
											
												
													
														|  | -import { tr } from "voca";
 |  | 
 | 
											
												
													
														|  | 
 |  | +import { pageList } from '@/api/ticketMr/ticketMr'
 | 
											
												
													
														|  | 
 |  | +// import { tr } from "voca";
 | 
											
												
													
														|  |  // import { getToken } from "@/utils/auth";
 |  |  // import { getToken } from "@/utils/auth";
 | 
											
												
													
														|  |  // import { log } from 'mathjs';
 |  |  // import { log } from 'mathjs';
 | 
											
												
													
														|  |  export default {
 |  |  export default {
 | 
											
										
											
												
													
														|  | @@ -223,12 +224,14 @@ export default {
 | 
											
												
													
														|  |        options: [],
 |  |        options: [],
 | 
											
												
													
														|  |        timer: null,
 |  |        timer: null,
 | 
											
												
													
														|  |        isLoading: null,
 |  |        isLoading: null,
 | 
											
												
													
														|  | -      rowId: [],
 |  | 
 | 
											
												
													
														|  | 
 |  | +      // rowId: [],
 | 
											
												
													
														|  |        isDisabled: false,
 |  |        isDisabled: false,
 | 
											
												
													
														|  | 
 |  | +      dataList: [],
 | 
											
												
													
														|  |      };
 |  |      };
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |    created() {
 |  |    created() {
 | 
											
												
													
														|  |      this.getPerformList();
 |  |      this.getPerformList();
 | 
											
												
													
														|  | 
 |  | +    this.getGoodsList();
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |    methods: {
 |  |    methods: {
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
										
											
												
													
														|  | @@ -241,6 +244,7 @@ export default {
 | 
											
												
													
														|  |        this.open = true;
 |  |        this.open = true;
 | 
											
												
													
														|  |        this.reset();
 |  |        this.reset();
 | 
											
												
													
														|  |        this.getOptions();
 |  |        this.getOptions();
 | 
											
												
													
														|  | 
 |  | +      this.isDisabled = true
 | 
											
												
													
														|  |        if (obj){
 |  |        if (obj){
 | 
											
												
													
														|  |          this.title = "编辑优惠券";
 |  |          this.title = "编辑优惠券";
 | 
											
												
													
														|  |          this.$nextTick(() => {
 |  |          this.$nextTick(() => {
 | 
											
										
											
												
													
														|  | @@ -258,11 +262,11 @@ export default {
 | 
											
												
													
														|  |              this.form.useUserId = []
 |  |              this.form.useUserId = []
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  |            obj.useUserType == 2 ? this.isDisabled = true: this.isDisabled = false;
 |  |            obj.useUserType == 2 ? this.isDisabled = true: this.isDisabled = false;
 | 
											
												
													
														|  | 
 |  | +          this.$set(this.form, 'useUserType', obj.useUserType);
 | 
											
												
													
														|  |            this.$set(this.form, 'id', obj.id);
 |  |            this.$set(this.form, 'id', obj.id);
 | 
											
												
													
														|  |            this.$set(this.form, 'couponName', obj.couponName);
 |  |            this.$set(this.form, 'couponName', obj.couponName);
 | 
											
												
													
														|  |            this.$set(this.form, 'type', obj.type);
 |  |            this.$set(this.form, 'type', obj.type);
 | 
											
												
													
														|  |            this.$set(this.form, 'quota', obj.quota);
 |  |            this.$set(this.form, 'quota', obj.quota);
 | 
											
												
													
														|  | -          this.$set(this.form, 'useUserType', obj.useUserType);
 |  | 
 | 
											
												
													
														|  |            this.$set(this.form, 'usePerform', obj.usePerform);
 |  |            this.$set(this.form, 'usePerform', obj.usePerform);
 | 
											
												
													
														|  |            this.$set(this.form, 'useThresholdType', obj.useThresholdType);
 |  |            this.$set(this.form, 'useThresholdType', obj.useThresholdType);
 | 
											
												
													
														|  |            this.$set(this.form, 'useThresholdAmount', obj.useThresholdAmount);
 |  |            this.$set(this.form, 'useThresholdAmount', obj.useThresholdAmount);
 | 
											
										
											
												
													
														|  | @@ -280,14 +284,37 @@ export default {
 | 
											
												
													
														|  |            this.$set(this.form, 'useGood', obj.useGood);
 |  |            this.$set(this.form, 'useGood', obj.useGood);
 | 
											
												
													
														|  |            this.form.useGood= this.getGoodsIds(this.form.useGood);
 |  |            this.form.useGood= this.getGoodsIds(this.form.useGood);
 | 
											
												
													
														|  |          });
 |  |          });
 | 
											
												
													
														|  | -      }else{
 |  | 
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  |          this.title = "新增优惠券";
 |  |          this.title = "新增优惠券";
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | 
 |  | +        this.$set(this.form, 'useUserType', 2);
 | 
											
												
													
														|  | 
 |  | +        this.$set(this.form, 'channelType', 2);
 | 
											
												
													
														|  | 
 |  | +        this.$set(this.form, 'useType', 2);
 | 
											
												
													
														|  | 
 |  | +        this.$set(this.form, 'useDay', '24');
 | 
											
												
													
														|  |        }
 |  |        }
 | 
											
												
													
														|  |        this.$nextTick(() => {
 |  |        this.$nextTick(() => {
 | 
											
												
													
														|  |          this.$refs["form"].clearValidate();
 |  |          this.$refs["form"].clearValidate();
 | 
											
												
													
														|  |        });
 |  |        });
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  | 
 |  | +    // 获取分销票档
 | 
											
												
													
														|  | 
 |  | +    getGoodsList() {
 | 
											
												
													
														|  | 
 |  | +      // this.loading = true;
 | 
											
												
													
														|  | 
 |  | +      let query ={
 | 
											
												
													
														|  | 
 |  | +        pageNum: 1,
 | 
											
												
													
														|  | 
 |  | +        pageSize: 999,
 | 
											
												
													
														|  | 
 |  | +        goodsType: 2,
 | 
											
												
													
														|  | 
 |  | +        classifyId: 1,
 | 
											
												
													
														|  | 
 |  | +        channelType: 'retail'
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      pageList(query).then(response => {
 | 
											
												
													
														|  | 
 |  | +          let resArr = response.data.rows || [];
 | 
											
												
													
														|  | 
 |  | +          if(resArr.length > 0){
 | 
											
												
													
														|  | 
 |  | +            this.dataList = resArr.filter(ele => ele.status == 0)
 | 
											
												
													
														|  | 
 |  | +          } else {
 | 
											
												
													
														|  | 
 |  | +            this.dataList = []
 | 
											
												
													
														|  | 
 |  | +          }
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      );
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  |      /** 查询团队列表 */
 |  |      /** 查询团队列表 */
 | 
											
												
													
														|  |      getOptions(value) {
 |  |      getOptions(value) {
 | 
											
												
													
														|  |        // if(!value) {
 |  |        // if(!value) {
 | 
											
										
											
												
													
														|  | @@ -434,16 +461,68 @@ export default {
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  |      performChange(e){
 |  |      performChange(e){
 | 
											
												
													
														|  |        // console.log('performChange',e);
 |  |        // console.log('performChange',e);
 | 
											
												
													
														|  | -      // console.log('this.performList',this.performList);
 |  | 
 | 
											
												
													
														|  | 
 |  | +      console.log('this.performList',this.performList);
 | 
											
												
													
														|  |        // this.$set(this.form, 'useGood', '');
 |  |        // this.$set(this.form, 'useGood', '');
 | 
											
												
													
														|  | -      // console.log('performChange',e);
 |  | 
 | 
											
												
													
														|  | 
 |  | +      console.log('performChange',e);
 | 
											
												
													
														|  |        let goodsList = this.performList.filter(item => {return item.value == e})[0].goodsList;
 |  |        let goodsList = this.performList.filter(item => {return item.value == e})[0].goodsList;
 | 
											
												
													
														|  | -      this.goodsList = goodsList;
 |  | 
 | 
											
												
													
														|  | -      // console.log('goodsList',this.goodsList);
 |  | 
 | 
											
												
													
														|  | 
 |  | +      if(this.dataList.length != 0) {
 | 
											
												
													
														|  | 
 |  | +        this.dataList.forEach(j => {
 | 
											
												
													
														|  | 
 |  | +          if(j.id) {
 | 
											
												
													
														|  | 
 |  | +            j.goodsId = j.id
 | 
											
												
													
														|  | 
 |  | +          }
 | 
											
												
													
														|  | 
 |  | +          // if(j.name) {
 | 
											
												
													
														|  | 
 |  | +          //   j.goodsName = j.name
 | 
											
												
													
														|  | 
 |  | +          // }
 | 
											
												
													
														|  | 
 |  | +        })
 | 
											
												
													
														|  | 
 |  | +        this.goodsList = this.getMergedCommonById(goodsList, this.dataList, 'goodsId');
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  | 
 |  | +        this.goodsList = [];
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      // this.goodsList = goodsList;
 | 
											
												
													
														|  | 
 |  | +      console.log('useGood', goodsList, this.dataList);
 | 
											
												
													
														|  | 
 |  | +      console.log('goodsList',this.goodsList);
 | 
											
												
													
														|  |        // console.log('useGood',this.form.useGood);
 |  |        // console.log('useGood',this.form.useGood);
 | 
											
												
													
														|  |        this.$set(this.form, 'useGood', null);
 |  |        this.$set(this.form, 'useGood', null);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +    * 从两个数组中找出 id 相同的对象,并合并它们
 | 
											
												
													
														|  | 
 |  | +    * @param {Array} arr1 - 第一个对象数组
 | 
											
												
													
														|  | 
 |  | +    * @param {Array} arr2 - 第二个对象数组
 | 
											
												
													
														|  | 
 |  | +    * @param {string} [idKey='id'] - 用作唯一标识的字段名,默认是 'id'
 | 
											
												
													
														|  | 
 |  | +    * @returns {Array} 合并后的结果数组
 | 
											
												
													
														|  | 
 |  | +    */
 | 
											
												
													
														|  | 
 |  | +    getMergedCommonById(arr1, arr2, idKey = 'id') {
 | 
											
												
													
														|  | 
 |  | +      // 容错处理:确保传入的是数组
 | 
											
												
													
														|  | 
 |  | +      if (!Array.isArray(arr1)) arr1 = [];
 | 
											
												
													
														|  | 
 |  | +      if (!Array.isArray(arr2)) arr2 = [];
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +      // 构建 Set 存储 arr2 中所有的 id
 | 
											
												
													
														|  | 
 |  | +      const idSetInArr2 = new Set(
 | 
											
												
													
														|  | 
 |  | +        arr2.filter(obj => obj && typeof obj === 'object' && idKey in obj)
 | 
											
												
													
														|  | 
 |  | +            .map(obj => obj[idKey])
 | 
											
												
													
														|  | 
 |  | +      );
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +      // 找出 arr1 中 id 在 arr2 中也存在的对象
 | 
											
												
													
														|  | 
 |  | +      const commonInArr1 = arr1.filter(obj => 
 | 
											
												
													
														|  | 
 |  | +        obj && typeof obj === 'object' && idSetInArr2.has(obj[idKey])
 | 
											
												
													
														|  | 
 |  | +      );
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +      // 构建 Map 来快速查找 arr2 中的数据
 | 
											
												
													
														|  | 
 |  | +      const mapInArr2 = new Map();
 | 
											
												
													
														|  | 
 |  | +      arr2.forEach(obj => {
 | 
											
												
													
														|  | 
 |  | +        if (obj && typeof obj === 'object' && idKey in obj) {
 | 
											
												
													
														|  | 
 |  | +          mapInArr2.set(obj[idKey], obj);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      });
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +      // 合并数据
 | 
											
												
													
														|  | 
 |  | +      return commonInArr1.map(obj => {
 | 
											
												
													
														|  | 
 |  | +        const match = mapInArr2.get(obj[idKey]);
 | 
											
												
													
														|  | 
 |  | +        return match ? { ...obj, ...match } : obj;
 | 
											
												
													
														|  | 
 |  | +      });
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  |      useStartDateChange(e){
 |  |      useStartDateChange(e){
 | 
											
												
													
														|  |        // console.log('useStartDateChange',e);
 |  |        // console.log('useStartDateChange',e);
 | 
											
												
													
														|  |        // console.log('useStartDate',this.form.useDate);
 |  |        // console.log('useStartDate',this.form.useDate);
 |