Merge branch 'master' of http://192.168.31.40:10101/r/Demay_New
commit
ee7e7ddf12
@ -1,22 +1,83 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
|
||||
<el-form :model="formData" :rules="rules" ref="formData" label-width="auto" label-position="top" style="width:500px">
|
||||
<el-form-item style="margin-bottom:20px;">
|
||||
<el-button size="small" type="primary" @click="save">保存</el-button>
|
||||
<el-button size="small" @click="resetForm">重置</el-button>
|
||||
<el-button size="small" type="primary" @click="fetchData">刷新</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="开发者ID(AppID)" prop="appid" style="margin-bottom:15px">
|
||||
<el-input v-model="formData.appid"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="开发者密码(AppSecret)" prop="appEcret" style="margin-bottom:15px">
|
||||
<el-input v-model="formData.appEcret"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信公众号管理员手机号码" prop="iphone" style="margin-bottom:15px">
|
||||
<el-input v-model="formData.iphone"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="令牌(Token)" prop="token">
|
||||
<el-input v-model="formData.token"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getWXAccount, doSetWXAccount, doEditWXAccount } from "../../../api/storeManage";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
formData: {},
|
||||
rules: {
|
||||
appid: [{ required: true, message: '请输入开发者ID(AppID)', trigger: 'blur' }],
|
||||
appEcret: [{ required: true, message: '请输入开发者密码(AppSecret)', trigger: 'blur' }],
|
||||
iphone: [{ required: true, message: '请输入微信公众号管理员手机号码', trigger: 'blur' }],
|
||||
token: [{ required: true, message: '请输入令牌(Token)', trigger: 'blur' }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
|
||||
async fetchData() {
|
||||
let { code, pageInfo } = await getWXAccount({ storeId: sessionStorage.getItem('storeId') })
|
||||
if (code == '000000') {
|
||||
this.formData = Object.assign({}, pageInfo.list[0]);
|
||||
}
|
||||
},
|
||||
// 重置
|
||||
resetForm(formName) {
|
||||
this.$refs.formData.resetFields();
|
||||
},
|
||||
// 新增/修改
|
||||
save() {
|
||||
this.$refs.formData.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.formData.id) {
|
||||
doEditWXAccount(this.formData).then(res => { this.callbackFun(res) })
|
||||
} else {
|
||||
let formData = Object.assign({}, this.formData);
|
||||
formData.storeId = sessionStorage.getItem('storeId')
|
||||
doSetWXAccount(formData).then(res => { this.callbackFun(res) })
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
callbackFun(res) {
|
||||
if (res.code == '000000') {
|
||||
this.$message.success({ message: res.message });
|
||||
} else {
|
||||
this.$message.error({ message: res.message });
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-form--label-top .el-form-item__label {
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue