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

优化代码

parent 3c1b3b18
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<el-image :src="row.imgsUrl" style="width: 30px;height: 30px;"></el-image> <el-image :src="row.imgsUrl" style="width: 30px;height: 30px;"></el-image>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品库存" prop="stockNum" align="center"></el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" /> :limit.sync="queryParams.pageSize" @pagination="getList" />
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<el-table-column type="selection" width="60" align="center"></el-table-column> <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="nickName" align="center"></el-table-column>
<el-table-column label="用户名" prop="userName" 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> </el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" /> :limit.sync="queryParams.pageSize" @pagination="getList" />
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="handleClose">取消</el-button> <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> </template>
</el-dialog> </el-dialog>
<!-- 操作失败结果 --> <!-- 操作失败结果 -->
...@@ -29,6 +29,7 @@ export default { ...@@ -29,6 +29,7 @@ export default {
data() { data() {
return { return {
visible: false, visible: false,
loading: false,
form: {}, form: {},
userList: [], userList: [],
optionList: [], optionList: [],
...@@ -69,18 +70,22 @@ export default { ...@@ -69,18 +70,22 @@ export default {
users, users,
goodsCode goodsCode
} }
this.loading = true;
this.$refs.formRef.validate((valid) => { this.$refs.formRef.validate((valid) => {
if (valid) { if (valid) {
batchExchange(data).then(res => { batchExchange(data).then(res => {
if (res.code == 200) { if (res.code == 200) {
if (res.data.length == 0) { if (res.data.length == 0) {
this.loading = false;
this.$modal.msgSuccess('批量兑换商品成功') this.$modal.msgSuccess('批量兑换商品成功')
} else { } else {
this.loading = false;
this.$refs.errorDialogRef.openModal(res.data) this.$refs.errorDialogRef.openModal(res.data)
} }
this.handleClose() this.handleClose()
this.$emit('handleOk'); this.$emit('handleOk');
} else { } else {
this.loading = false;
this.$modal.msgError(res.msg || "批量兑换商品失败"); this.$modal.msgError(res.msg || "批量兑换商品失败");
} }
}) })
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
@getValue="getNickName" placeholder="请选择用户"></UserSelectInput> @getValue="getNickName" placeholder="请选择用户"></UserSelectInput>
</el-form-item> </el-form-item>
<el-form-item label="积分" prop="points"> <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> style="width: 100%;"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="handleClose">取消</el-button> <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> </template>
...@@ -33,6 +33,7 @@ export default { ...@@ -33,6 +33,7 @@ export default {
data() { data() {
return { return {
visible: false, visible: false,
loading: false,
form: {}, form: {},
userList: [], userList: [],
optionList: [], optionList: [],
...@@ -72,19 +73,23 @@ export default { ...@@ -72,19 +73,23 @@ export default {
users, users,
points points
} }
this.loading = true;
this.$refs.formRef.validate((valid) => { this.$refs.formRef.validate((valid) => {
if (valid) { if (valid) {
batchAddPoints(data).then(res => { batchAddPoints(data).then(res => {
console.log(res) console.log(res)
if (res.code == 200) { if (res.code == 200) {
if (res.data.length == 0) { if (res.data.length == 0) {
this.loading = false;
this.$modal.msgSuccess('批量添加积分成功') this.$modal.msgSuccess('批量添加积分成功')
} else { } else {
this.loading = false;
this.$refs.errorDialogRef.openModal(res.data) this.$refs.errorDialogRef.openModal(res.data)
} }
this.handleClose() this.handleClose()
this.$emit('handleOk'); this.$emit('handleOk');
} else { } else {
this.loading = false;
this.$modal.msgError(res.msg || "批量添加积分失败"); this.$modal.msgError(res.msg || "批量添加积分失败");
} }
}) })
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<el-dialog :visible.sync="visible" v-if="visible" title="操作失败结果" append-to-body :close-on-click-modal="false" width="40%" <el-dialog :visible.sync="visible" v-if="visible" title="操作失败结果" append-to-body :close-on-click-modal="false" width="40%"
class="dialog" @close="handleClose"> class="dialog" @close="handleClose">
<el-table :data="tableList"> <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="userName" align="center"></el-table-column>
<el-table-column label="失败原因" prop="errorMessage" align="center"></el-table-column> <el-table-column label="失败原因" prop="errorMessage" align="center"></el-table-column>
</el-table> </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