2022-05-19 17:28:10 +08:00
|
|
|
<template>
|
|
|
|
|
<section class="giveIntegral">
|
|
|
|
|
<AiGroup>
|
|
|
|
|
<AiItem label="选择对象" required>
|
|
|
|
|
<AiSelect v-model="form.objectType" dict="integralGiveObjType"/>
|
|
|
|
|
</AiItem>
|
|
|
|
|
<AiItem label="选择人员" required v-if="form.objectType">
|
2022-05-27 10:56:06 +08:00
|
|
|
<AiPagePicker v-if="form.objectType==0" single auditStatus="1" @select="handleSelectUser">
|
2022-05-19 17:28:10 +08:00
|
|
|
<AiMore v-model="form.userName"/>
|
|
|
|
|
</AiPagePicker>
|
|
|
|
|
<AiPagePicker v-if="form.objectType==1" single @select="handleSelectUser" type="sysUser">
|
|
|
|
|
<AiMore v-model="form.userName"/>
|
|
|
|
|
</AiPagePicker>
|
|
|
|
|
</AiItem>
|
|
|
|
|
</AiGroup>
|
|
|
|
|
<AiGroup>
|
|
|
|
|
<AiItem label="赠送分值" required topLabel>
|
|
|
|
|
<div slot="sub" class="color-999">(积分总额{{ info.sysUserIntegral || 0 }}分)</div>
|
|
|
|
|
<input v-model.number="form.integral"/>
|
|
|
|
|
</AiItem>
|
|
|
|
|
</AiGroup>
|
|
|
|
|
<AiBottomBtn text="确认赠送" @click="submit"/>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {mapState} from "vuex";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "giveIntegral",
|
|
|
|
|
appName: "积分赠送",
|
|
|
|
|
computed: {
|
|
|
|
|
...mapState(['user'])
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
info: {},
|
2022-05-25 16:19:42 +08:00
|
|
|
form: {userName: ""},
|
|
|
|
|
flag: false
|
2022-05-19 17:28:10 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getInfo() {
|
|
|
|
|
let {user: {id: userId}} = this
|
|
|
|
|
this.$http.post('/app/appvillagerintegraldetail/sysUserIntegralList', null, {
|
|
|
|
|
params: {userId, current: 1, size: 10}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res?.data) {
|
|
|
|
|
this.info = res.data
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
2022-05-25 16:19:42 +08:00
|
|
|
if(this.flag) return
|
2022-05-19 17:28:10 +08:00
|
|
|
let {objectType, userId, integral} = this.form
|
|
|
|
|
if (!objectType) {
|
|
|
|
|
return this.$u.toast("请选择对象")
|
|
|
|
|
}
|
|
|
|
|
if (!userId) {
|
|
|
|
|
return this.$u.toast("请选择人员")
|
|
|
|
|
}
|
2022-05-23 10:44:09 +08:00
|
|
|
if (isNaN(integral) || !/^\d*[.\d]\d?$/.test(integral)) {
|
2022-05-23 10:42:15 +08:00
|
|
|
return this.$u.toast("请输入赠送分值,最多保留一位小数")
|
2022-05-20 15:21:26 +08:00
|
|
|
}
|
2022-05-25 16:19:42 +08:00
|
|
|
this.flag = true
|
2022-05-19 17:28:10 +08:00
|
|
|
this.$http.post("/admin/user/giveIntegral", null, {
|
|
|
|
|
params: {...this.form}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res?.code == 0) {
|
2022-05-25 16:01:53 +08:00
|
|
|
uni.$emit("updateIntegral")
|
2022-05-19 17:28:10 +08:00
|
|
|
this.$u.toast("提交成功!")
|
2022-05-23 10:44:09 +08:00
|
|
|
uni.navigateBack({})
|
2022-05-25 16:01:53 +08:00
|
|
|
}else {
|
2022-05-25 16:19:42 +08:00
|
|
|
this.flag = false
|
2022-05-25 16:01:53 +08:00
|
|
|
this.$u.toast(res.msg)
|
2022-05-19 17:28:10 +08:00
|
|
|
}
|
2022-05-25 18:26:33 +08:00
|
|
|
}).catch((err) => {
|
|
|
|
|
this.flag = false
|
|
|
|
|
this.$u.toast(err)
|
2022-05-19 17:28:10 +08:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleSelectUser(v) {
|
|
|
|
|
this.form.userId = v?.[0]?.id || ""
|
|
|
|
|
this.form.userName = v?.[0]?.name || ""
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getInfo()
|
|
|
|
|
this.$dict.load("integralGiveObjType")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.giveIntegral {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
.color-999 {
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|