Commit 8758d017 by 王志慧

fixed

1 parent f0da8a54
......@@ -40,7 +40,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="活动模版:" prop="templateId" class="m-t-20">
<el-select :size="size" v-model="configForm.templateId" placeholder="请选择" :disabled="disabled" filterable remote @focus="selectFocus" :loading="loading">
<el-select :size="size" v-model="configForm.templateId" placeholder="请选择" @focus="getRedEnvelopeTemplateList" filterable >
<el-option v-for="item in templateList" :key="item.id" :label="item.templateName" :value="item.id"></el-option>
</el-select>
</el-form-item>
......@@ -64,7 +64,7 @@
<!-- :红包、实物、谢谢惠顾时,为输入框 优惠券,为下拉框 -->
<el-form-item style="margin-bottom: 0px" :prop="'awardList.' + scope.index + '.couponId'" :rules="configRules.couponId">
<el-select style="width: 100%" v-model="scope.scope.couponId" placeholder="请选择" @change="setAwardName(scope.scope)">
<el-option v-for="item in couponList" :key="item.id" :label="item.goodsName" :value="item.id"></el-option>
<el-option v-for="item in couponList" :key="item.id" :label="item.goodsName+'('+item.denomination/100+'元)'" :value="item.id"></el-option>
</el-select>
</el-form-item>
</template>
......@@ -124,17 +124,17 @@
<span class="num">{{ configForm.awardsConfig.awardsTotal }}</span>
个奖项,
<span class="num">{{ configForm.awardsConfig.redEnvelopesTotal }}</span>
个红包,金额
个红包,红包金额
<span class="num">{{ configForm.awardsConfig.amountTotal }}</span>
元
<span class="btn">合算</span>
<!-- <span class="btn">合算</span> -->
</div>
<el-form-item label="限制条件:" class="m-t-20">
<el-switch v-model="configForm.limiting" active-color="#5850ff"></el-switch>
</el-form-item>
<div class="limit-container" v-if="configForm.limiting">
一个账户(open ID)每个活动最多扫码次数为
<el-input-number v-model="configForm.awardsConfig.limitTimes" size="small" controls-position="right" @change="handleChange" :min="1"></el-input-number>
<el-input-number v-model="configForm.awardsConfig.limitTimes" size="small" controls-position="right" @change="handleChange" :min="1" :max="50"></el-input-number>
次,超出该数量提示
<el-form-item prop="awardsConfig.msg" class="limit-msg">
<el-input v-model="configForm.awardsConfig.msg" maxlength="20" show-word-limit placeholder="请输入"></el-input>
......@@ -162,18 +162,6 @@ export const afterRangePickerOptions = {
return false
}
}
export const checkPrice = (rule, value, callback) => {
if (isNaN(value)) {
callback(new Error('请输入数字值'))
} else {
if (value <= 0.1 || value > 9999.99) {
callback(new Error('仅支持输入0.1~9999.99'))
} else {
callback()
}
}
}
import commonFun from '../common/fun.js'
import * as dayjs from 'dayjs'
import { getMerchantListMixin } from '@/mixins'
import { awardType } from '@/common/constant'
......@@ -190,7 +178,7 @@ export default {
data() {
return {
loading: false,
activePage: 1,
activePage: 2,
templateList: [],
couponList: [],
afterRangePickerOptions,
......@@ -256,10 +244,7 @@ export default {
type: [{ required: true, message: '请选择', trigger: 'change' }],
name: [{ required: true, message: '请输入', trigger: 'blur' }],
couponId: [{ required: true, message: '请选择', trigger: 'change' }],
amount: [
{ required: true, message: '请输入', trigger: 'blur' }
// { validator: checkPrice, trigger: 'blur' }
],
amount: [{ required: true, message: '请输入', trigger: 'blur' }],
total: [{ required: true, message: '请输入', trigger: 'blur' }],
'awardsConfig.msg': [{ required: true, message: '请输入限制条件', trigger: 'blur' }]
},
......@@ -310,10 +295,16 @@ export default {
this.handleStatistics()
},
deep: true
},
'configForm.limiting'(newVal){
if(newVal){
this.configForm.awardsConfig.limitTimes=1
this.configForm.awardsConfig.msg=''
}
}
},
mounted() {
this.getRedEnvelopeTemplateList()
// this.getRedEnvelopeTemplateList()
this.getCouponList()
if (this.configForm.id) this.getRedEnvelopeActivityDetail()
},
......@@ -360,9 +351,15 @@ export default {
}
},
getRedEnvelopeTemplateList() {
if (!this.configForm.merchantId) {
this.$message.error('请先选择所属渠道')
return
}
let params = {
pageSize: 10000,
pageNum: 1
pageNum: 1,
// merchantIdList:'44217631'
merchantIdList: [this.configForm.merchantId]
}
this.$apis.redenvelope.getRedEnvelopeTemplateList(params).then(res => {
this.templateList = res.data
......@@ -374,7 +371,6 @@ export default {
pageNum: 1
}
this.$apis.redenvelope.getCouponList(params).then(res => {
console.log(res)
this.couponList = res.list
})
},
......@@ -440,9 +436,11 @@ export default {
awardsTotal: this.configForm.awardList.length
}
this.configForm.awardList.forEach(item => {
if (item.type == 0) {
params.redEnvelopesTotal += 1
if (item.amount && item.total) params.amountTotal += item.amount * item.total
if (item.type === 0) {
if(item.total) params.redEnvelopesTotal += Number(item.total)
if (item.amount && item.total) {
params.amountTotal += item.amount * item.total
}
}
})
......@@ -485,8 +483,8 @@ export default {
})
}
},
setAwardName(data){
data.name=this.couponList.filter(item=>item.id==data.couponId)[0].goodsName
setAwardName(data) {
data.name = this.couponList.filter(item => item.id == data.couponId)[0].goodsName
},
handleCalculate(data, key) {
if (isNaN(data[key])) {
......@@ -510,7 +508,7 @@ export default {
} else {
data[key] = data[key] ? new BigNumber(data[key]).dp(0).toNumber() : ''
}
}
}
}
this.calculateProbability()
},
......@@ -526,6 +524,7 @@ export default {
handleDelete(index) {
if (this.configForm.awardList.length == 1) return
this.configForm.awardList.splice(index, 1)
this.calculateProbability()
},
addLine() {
this.configForm.awardList.push({
......
......@@ -112,7 +112,7 @@ export default {
},
{
label: '来源',
label: '用途',
prop: 'bindingSourceStr',
minWidth: 100
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!