|
@@ -1,6 +1,14 @@
|
|
|
<template>
|
|
|
<!-- 充值对话框 -->
|
|
|
- <el-dialog class="common-dialog" title="余额充值/扣减" :visible.sync="showDialog" width="700px" @close="cancel" append-to-body destroy-on-close>
|
|
|
+ <el-dialog
|
|
|
+ class="common-dialog"
|
|
|
+ title="余额充值/扣减"
|
|
|
+ :visible.sync="showDialog"
|
|
|
+ width="700px"
|
|
|
+ @close="cancel"
|
|
|
+ append-to-body
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
@@ -12,7 +20,7 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="可用余额:" prop="balance">
|
|
|
- <span>¥{{ memberInfo.balance.toFixed(2) }}</span>
|
|
|
+ <span>{{ $pinia._s.get('user').getSymbol }}{{ memberInfo.balance.toFixed(2) }}</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -29,14 +37,25 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="变更金额:" prop="amount">
|
|
|
- <el-input v-model="form.amount" placeholder="请输入变更金额" style="width: 200px" maxlength="100" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.amount"
|
|
|
+ placeholder="请输入变更金额"
|
|
|
+ style="width: 200px"
|
|
|
+ maxlength="100"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item class="recharge-item" prop="remark" label="备注信息:">
|
|
|
- <el-input v-model="form.remark" type="textarea" rows="2" placeholder="请输入备注信息" maxlength="255" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.remark"
|
|
|
+ type="textarea"
|
|
|
+ rows="2"
|
|
|
+ placeholder="请输入备注信息"
|
|
|
+ maxlength="255"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -49,19 +68,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { doRecharge } from "@/api/balance";
|
|
|
-import { getMemberInfo } from "@/api/member";
|
|
|
+import { doRecharge } from '@/api/balance'
|
|
|
+import { getMemberInfo } from '@/api/member'
|
|
|
export default {
|
|
|
- name: "balanceRecharge",
|
|
|
+ name: 'balanceRecharge',
|
|
|
props: {
|
|
|
- showDialog:{
|
|
|
- type:[Boolean],
|
|
|
- default:()=>false
|
|
|
+ showDialog: {
|
|
|
+ type: [Boolean],
|
|
|
+ default: () => false,
|
|
|
+ },
|
|
|
+ userId: {
|
|
|
+ type: [String],
|
|
|
+ default: () => '',
|
|
|
},
|
|
|
- userId:{
|
|
|
- type:[String],
|
|
|
- default:()=> ''
|
|
|
- }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -72,64 +91,69 @@ export default {
|
|
|
form: { type: '1', amount: '', userId: '' },
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
- userId: [
|
|
|
- { required: true, message: "请选择会员", trigger: "blur" },
|
|
|
- ],
|
|
|
+ userId: [{ required: true, message: '请选择会员', trigger: 'blur' }],
|
|
|
amount: [
|
|
|
- { required: true, message: "金额不能为空", trigger: "blur" },
|
|
|
+ { required: true, message: '金额不能为空', trigger: 'blur' },
|
|
|
{ min: 1, max: 6, message: '请在1至99999元范围内输入', trigger: 'blur' },
|
|
|
- { pattern: /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/, message: `请输入正确的金额`, trigger: 'blur' }
|
|
|
- ]
|
|
|
- }
|
|
|
- };
|
|
|
+ {
|
|
|
+ pattern: /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/,
|
|
|
+ message: `请输入正确的金额`,
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
showDialog(value) {
|
|
|
if (value) {
|
|
|
- this.getMemberInfo()
|
|
|
+ this.getMemberInfo()
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询会员信息
|
|
|
getMemberInfo() {
|
|
|
- this.loading = true;
|
|
|
- getMemberInfo(this.userId).then(response => {
|
|
|
- this.form.userId = response.data.memberInfo.id;
|
|
|
- this.memberInfo = response.data.memberInfo;
|
|
|
- this.loading = false;
|
|
|
- }
|
|
|
- ).catch((err) => {
|
|
|
- this.loading = false;
|
|
|
- console.log(err.toString());
|
|
|
- });
|
|
|
+ this.loading = true
|
|
|
+ getMemberInfo(this.userId)
|
|
|
+ .then((response) => {
|
|
|
+ this.form.userId = response.data.memberInfo.id
|
|
|
+ this.memberInfo = response.data.memberInfo
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.loading = false
|
|
|
+ console.log(err.toString())
|
|
|
+ })
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
- this.$emit('closeDialog','balance');
|
|
|
+ this.$emit('closeDialog', 'balance')
|
|
|
},
|
|
|
// 充值表单
|
|
|
reset() {
|
|
|
- this.form.userId = '';
|
|
|
- this.form.type = '1';
|
|
|
- this.form.amount = '';
|
|
|
- this.form.remark = '';
|
|
|
- this.memberInfo = { name: '', id: '', balance: 0 };
|
|
|
+ this.form.userId = ''
|
|
|
+ this.form.type = '1'
|
|
|
+ this.form.amount = ''
|
|
|
+ this.form.remark = ''
|
|
|
+ this.memberInfo = { name: '', id: '', balance: 0 }
|
|
|
},
|
|
|
// 提交按钮
|
|
|
- submitForm: function() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
+ submitForm: function () {
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- doRecharge(this.form).then(response => {
|
|
|
- this.$alert("余额操作成功!");
|
|
|
- this.$emit('closeDialog','balance');
|
|
|
- this.reset();
|
|
|
- }).catch(() => {
|
|
|
- // empty
|
|
|
- });
|
|
|
+ doRecharge(this.form)
|
|
|
+ .then((response) => {
|
|
|
+ this.$alert('余额操作成功!')
|
|
|
+ this.$emit('closeDialog', 'balance')
|
|
|
+ this.reset()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // empty
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+}
|
|
|
</script>
|