<template>
|
<GlobalWindow
|
:title="title"
|
width="60%"
|
:visible.sync="visible"
|
:confirm-working="isWorking"
|
@confirm="confirm"
|
>
|
<p class="tip-warn" style="margin: 30px;"><i class="el-icon-warning"></i>操作说明:积分增加或减少后会在消费者端展示,请谨慎操作!</p>
|
<el-form :model="form" ref="form" :rules="rules" label-width="100px" label-suffix=":" inline>
|
<el-form-item label="当前余额" >
|
<span class="green" ><b>{{info.integral}}</b></span>
|
</el-form-item>
|
<el-form-item label="调整方式" prop="type" >
|
<el-radio-group v-model="form.type">
|
<el-radio :value="0" :label="0">增加</el-radio>
|
<el-radio :value="1" :label="1">减少</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="数量" prop="num" >
|
<el-input v-model="form.num" type="number" placeholder="请输入数量" ></el-input>
|
</el-form-item>
|
<el-form-item label="备注" prop="remark" >
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" ></el-input>
|
</el-form-item>
|
</el-form>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseOpera from '@/components/base/BaseOpera'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
export default {
|
name: 'OperaChangeShopWindow',
|
extends: BaseOpera,
|
components: { GlobalWindow },
|
data () {
|
return {
|
searchLoading: false,
|
info:{},
|
// 表单数据
|
form: {
|
memberId: null,
|
remark: null,
|
userType:null,
|
num: null,
|
type: 0
|
},
|
rules: {
|
type: [
|
{ required: true, message: '请选择调整方式' }
|
],
|
num: [
|
{ required: true, message: '请输入调整数量' }
|
]
|
}
|
}
|
},
|
created () {
|
this.config({
|
api: '/business/integral',
|
'field.id': 'id'
|
})
|
},
|
methods: {
|
confirm () {
|
this.$refs.form.validate((valid) => {
|
if (!valid) {
|
return
|
}
|
this.isWorking = true
|
this.api.updateIntegral(this.form)
|
.then(() => {
|
this.visible = false
|
this.$tip.apiSuccess('操作成功')
|
this.$emit('success')
|
})
|
.catch(e => {
|
// this.$tip.apiFailed(e)
|
})
|
.finally(() => {
|
this.isWorking = false
|
})
|
})
|
},
|
open (title, target,userType) {
|
this.title = title
|
this.visible = true
|
this.info = target
|
this.form.type = 0
|
this.form.userType = userType || 0
|
this.form.memberId = target.id
|
this.form.num = null
|
this.form.remark = null
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import "@/assets/style/alertstyle.scss";
|
::v-deep .el-form-item__content {
|
flex: 0.6;
|
}
|
</style>
|