Commit 8758d017 by 王志慧

fixed

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