示例框架
vue & element-ui
效果图
script
要害:async/await
import { INSERT_PHONE} from "@/api"; // 封装好的post接口,代码略
// 调配 aa / 调配 bb (业务需要)
showAssign(title, data) {
this.$prompt(
`调配${title}前,请补充该用户手机号码`,
`调配${title}提醒`,
{
closeOnClickModal: false,
cancelButtonClass: "el-button--info",
inputPattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
inputPlaceholder: "该手机号用于收取领取明码,请确保填写",
inputErrorMessage: "请输出正确的手机号码"
}
)
.then(async ({ value }) => {
let params = {
id: data.id,
phoneNo: value
};
await INSERT_PHONE(params).then(res => {
if (res.code === 10000) {
// 胜利的业务操作(代码略)
} else {
// 失败的提醒
this.$message({
center: true,
message: res.remark,
type: "error"
});
}
});
})
.catch(() => {
return false;
});
}
},
发表回复