173 lines
4.0 KiB
Vue
173 lines
4.0 KiB
Vue
<template>
|
|
<div class="addPoints">
|
|
<div class="item">
|
|
<div class="item_left"><span class="red">*</span><span class="color-666">事件类型</span></div>
|
|
<AiSelect dict="integralApplyEventType" v-model="form.eventType"/>
|
|
</div>
|
|
<div class="item">
|
|
<div class="item_left"><span class="red">*</span><span class="color-666">申请事项</span></div>
|
|
<div class="input"><u-input v-model="form.applyItem" type="text" placeholder="请输入" /></div>
|
|
</div>
|
|
|
|
<div class="item">
|
|
<div class="item_left"><span class="red">*</span><span class="color-666">积分数量</span></div>
|
|
<div class="input"><u-input v-model="form.applyIntegral" type="number" disabled placeholder="请输入"/></div>
|
|
</div>
|
|
|
|
<div class="items">
|
|
<div><span class="red">*</span><span class="color-666">上传图片</span></div>
|
|
<AiUploader style="margin-top: 12px;" :def.sync="form.files" :limit="1" action="/admin/file/add2"></AiUploader>
|
|
</div>
|
|
|
|
<div class="btn">
|
|
<div class="subBtn" @click="submit">提交</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'addPoints',
|
|
data() {
|
|
return {
|
|
value: '',
|
|
form: {
|
|
eventType: '',
|
|
applyItem: '',
|
|
applyIntegral: '',
|
|
voucherImageUrl: '',
|
|
files: []
|
|
},
|
|
flag: false,
|
|
}
|
|
},
|
|
onLoad(opt) {
|
|
document.title = '积分申请'
|
|
if(opt) {
|
|
this.getDetail(opt.id)
|
|
}
|
|
this.$dict.load('integralApplyEventType')
|
|
},
|
|
watch: {
|
|
'form.eventType'(val) {
|
|
if(val==0 || val == 1 || val == 5) {
|
|
this.form.applyIntegral = 2
|
|
} else if(val == 2 || val == 3 || val == 4) {
|
|
this.form.applyIntegral = 5
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
getDetail(id) {
|
|
this.$http.post(`/app/appintegralmemberapply/queryDetailById?id=${id}`).then(res=> {
|
|
if(res?.data) {
|
|
this.form = res.data
|
|
this.form.files = [{url:res.data.voucherImageUrl}]
|
|
}
|
|
})
|
|
},
|
|
submit() {
|
|
if(this.flag) return
|
|
|
|
if(!this.form.eventType) {
|
|
return this.$u.toast('请选择事件类型')
|
|
}
|
|
|
|
if(!this.form.applyItem) {
|
|
return this.$u.toast('请输入申请事项')
|
|
}
|
|
|
|
if(!this.form.applyIntegral) {
|
|
return this.$u.toast('请输入积分数量')
|
|
}
|
|
|
|
if(this.form.files.length) {
|
|
this.form.voucherImageUrl = this.form.files[0].url
|
|
}
|
|
|
|
this.flag = true
|
|
this.$http.post(`/app/appintegralmemberapply/addOrUpdate`,{...this.form}).then(res=> {
|
|
if(res.code == 0) {
|
|
this.$u.toast('提交成功')
|
|
setTimeout(() => {
|
|
uni.navigateBack()
|
|
}, 400)
|
|
}
|
|
}).catch(err=> {
|
|
this.$u.toast(err.message)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.addPoints {
|
|
padding: 0 16px 120px;
|
|
box-sizing: border-box;
|
|
font-size: 32px;
|
|
.item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-top: 24px;
|
|
background: #FFF;
|
|
box-shadow: inset 0 0 0 0 #EEEEEE;
|
|
border-radius: 32px;
|
|
padding: 16px 32px;
|
|
box-sizing: border-box;
|
|
.item_left {
|
|
font-size: 32px;
|
|
.red {
|
|
color: #E64A4A;
|
|
}
|
|
.color-666 {
|
|
color: #666666;
|
|
}
|
|
}
|
|
.input {
|
|
width: calc(100% - 200px);
|
|
}
|
|
::v-deep .uni-input-input,
|
|
.uni-input-placeholder {
|
|
text-align: right;
|
|
|
|
}
|
|
}
|
|
|
|
.items {
|
|
margin-top: 24px;
|
|
background: #FFF;
|
|
box-shadow: inset 0 0 0 0 #EEEEEE;
|
|
border-radius: 32px;
|
|
padding: 16px 32px;
|
|
box-sizing: border-box;
|
|
.red {
|
|
color: #E64A4A;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
background: #F5F5F5;
|
|
padding: 16px 32px;
|
|
box-sizing: border-box;
|
|
height: 120px;
|
|
line-height: 120px;
|
|
.subBtn {
|
|
text-align: center;
|
|
color: #FFF;
|
|
background: #3975C6;
|
|
border-radius: 44px;
|
|
width: 100%;
|
|
height: 88px;
|
|
line-height: 88px;
|
|
font-style: 34px;
|
|
}
|
|
}
|
|
|
|
}
|
|
</style> |