优化:支持修改未分配的兑换码

This commit is contained in:
wuhui_zzw 2024-03-30 16:11:33 +08:00
parent abebb0ed85
commit 3540ec75c9
2 changed files with 41 additions and 4 deletions

View File

@ -464,7 +464,10 @@ export function exchangeCodeActivateForm() {
export function exchangeCodeCancelForm() {
return request.get('user/exchangeCode/cancelForm')
}
// 会员卡兑换码 - 修改兑换码
export function exchangeCodeUpdate(data) {
return request.post('user/exchangeCode/updateCode',data)
}

View File

@ -35,9 +35,13 @@
{{ scope.row.batch_unique }}
</template>
</el-table-column>
<el-table-column label="兑换码" min-width="100" align="center">
<el-table-column label="兑换码" min-width="150" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.status == 0" type="info" effect="dark">{{ scope.row.exchange_code }}</el-tag>
<el-tooltip v-if="scope.row.status == 0" class="item" effect="dark" content="点击修改兑换码" placement="top-start">
<el-button type="info" size="small" icon="el-icon-edit" @click="updateExchangeCode(scope.row)">
{{ scope.row.exchange_code }}
</el-button>
</el-tooltip>
<el-tag v-else-if="scope.row.status == 1" type="primary" effect="dark">{{ scope.row.exchange_code }}</el-tag>
<el-tag v-else-if="scope.row.status == 2" type="success" effect="dark">{{ scope.row.exchange_code }}</el-tag>
<el-tag v-else-if="scope.row.status == 3" type="danger" effect="dark">{{ scope.row.exchange_code }}</el-tag>
@ -113,7 +117,8 @@ import {
exchangeCodeBatchList,
exchangeCodeCancelForm,
exchangeCodeEditForm,
exchangeCodeList
exchangeCodeList,
exchangeCodeUpdate
} from "@/api/user";
import createWorkBook from "@/utils/newToExcel";
import QRCodeOld from "qrcodejs2";
@ -311,7 +316,36 @@ export default {
FileSaver.saveAs(content, "qrcodes.zip");
});
},
//
updateExchangeCode(info){
let _this = this;
_this.$prompt(`当前兑换码:${info.exchange_code}`, {
confirmButtonText: "提交修改",
cancelButtonText: "取消修改",
inputErrorMessage: "请输入新的兑换码",
inputType: "text",
inputPlaceholder: "请输入新的兑换码",
inputValidator: value => {
if (!value) return "输入不能为空";
if(value.length > 10) return "兑换码长度不能超过10个字符";
const regex = /^[A-Za-z0-9]+$/;
if (!regex.test(value)) return "请输入英文字母或者数字";
}
}).then(({value}) => {
let params = {
id: info.id,
new_exchange_code: value
};
exchangeCodeUpdate(params).then(res => {
_this.$message.success(res.message)
_this.getList()
}).catch((err) => {
_this.$message.error(err.message)
});
}).catch(() => {});
}
},