Commit e4292439 authored by 万成波's avatar 万成波

优化代码

parent 3c1b3b18
......@@ -23,6 +23,7 @@
<el-image :src="row.imgsUrl" style="width: 30px;height: 30px;"></el-image>
</template>
</el-table-column>
<el-table-column label="商品库存" prop="stockNum" align="center"></el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
......@@ -130,4 +131,4 @@ export default {
}
}
</script>
\ No newline at end of file
</script>
......@@ -22,6 +22,7 @@
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="姓名" prop="nickName" align="center"></el-table-column>
<el-table-column label="用户名" prop="userName" align="center"></el-table-column>
<el-table-column label="可用积分" prop="currentPoints" align="center"></el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
......@@ -136,4 +137,4 @@ export default {
}
}
</script>
\ No newline at end of file
</script>
......@@ -13,7 +13,7 @@
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="primary" @click="handleConfirm" :loading="loading">确定</el-button>
</template>
</el-dialog>
<!-- 操作失败结果 -->
......@@ -29,6 +29,7 @@ export default {
data() {
return {
visible: false,
loading: false,
form: {},
userList: [],
optionList: [],
......@@ -69,18 +70,22 @@ export default {
users,
goodsCode
}
this.loading = true;
this.$refs.formRef.validate((valid) => {
if (valid) {
batchExchange(data).then(res => {
if (res.code == 200) {
if (res.data.length == 0) {
this.loading = false;
this.$modal.msgSuccess('批量兑换商品成功')
} else {
this.loading = false;
this.$refs.errorDialogRef.openModal(res.data)
}
this.handleClose()
this.$emit('handleOk');
} else {
this.loading = false;
this.$modal.msgError(res.msg || "批量兑换商品失败");
}
})
......
......@@ -8,13 +8,13 @@
@getValue="getNickName" placeholder="请选择用户"></UserSelectInput>
</el-form-item>
<el-form-item label="积分" prop="points">
<el-input-number v-model="form.points" placeholder="请输入" :min="0" :step="1"
<el-input-number v-model="form.points" placeholder="请输入" :min="1" :step="1"
style="width: 100%;"></el-input-number>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="primary" @click="handleConfirm" :loading="loading">确定</el-button>
</template>
......@@ -33,6 +33,7 @@ export default {
data() {
return {
visible: false,
loading: false,
form: {},
userList: [],
optionList: [],
......@@ -72,19 +73,23 @@ export default {
users,
points
}
this.loading = true;
this.$refs.formRef.validate((valid) => {
if (valid) {
batchAddPoints(data).then(res => {
console.log(res)
if (res.code == 200) {
if (res.data.length == 0) {
this.loading = false;
this.$modal.msgSuccess('批量添加积分成功')
} else {
this.loading = false;
this.$refs.errorDialogRef.openModal(res.data)
}
this.handleClose()
this.$emit('handleOk');
} else {
this.loading = false;
this.$modal.msgError(res.msg || "批量添加积分失败");
}
})
......
......@@ -2,7 +2,6 @@
<el-dialog :visible.sync="visible" v-if="visible" title="操作失败结果" append-to-body :close-on-click-modal="false" width="40%"
class="dialog" @close="handleClose">
<el-table :data="tableList">
<el-table-column type="index" width="55" align="center"></el-table-column>
<el-table-column label="用户" prop="userName" align="center"></el-table-column>
<el-table-column label="失败原因" prop="errorMessage" align="center"></el-table-column>
</el-table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment