|
@@ -17,6 +17,8 @@ import duijiedetail from '@/layout/duijiehui/duijiedetail.vue';
|
|
|
import { createNamespacedHelpers, mapState } from 'vuex';
|
|
|
const { mapActions: live } = createNamespacedHelpers('live');
|
|
|
const { mapActions: place } = createNamespacedHelpers('place');
|
|
|
+const { mapActions: authUser } = createNamespacedHelpers('authUser');
|
|
|
+
|
|
|
export default {
|
|
|
name: 'columnDetail',
|
|
|
props: {},
|
|
@@ -50,6 +52,7 @@ export default {
|
|
|
methods: {
|
|
|
...place({ palcequery: 'query', transactiondtetle: 'delete' }),
|
|
|
...live({ livefetch: 'fetch', livelist: 'query', livecreate: 'create', liveupdate: 'update' }),
|
|
|
+ ...authUser({ authUserQuery: 'query' }),
|
|
|
async search() {
|
|
|
if (this.$route.query.id) {
|
|
|
const res = await this.livefetch(this.id);
|
|
@@ -68,15 +71,24 @@ export default {
|
|
|
let res = await this.palcequery({ level });
|
|
|
this.$set(this, `option`, res.data);
|
|
|
},
|
|
|
- async onSubmit() {
|
|
|
+ async onSubmit({ data }) {
|
|
|
if (this.id) {
|
|
|
- let res = await this.liveupdate(this.form);
|
|
|
+ let res = await this.liveupdate(data);
|
|
|
this.$checkRes(res, '修改成功', '修改失败');
|
|
|
} else {
|
|
|
- this.form.user_id = this.user.uid;
|
|
|
- this.form.is_allowed = '1';
|
|
|
- let res = await this.livecreate(this.form);
|
|
|
- this.$checkRes(res, '添加成功', '添加失败');
|
|
|
+ data.user_id = this.user.uid;
|
|
|
+ data.is_allowed = '1';
|
|
|
+ const authUserList = await this.authUserQuery();
|
|
|
+ let r = authUserList.data.some(f => f.phone == data.phone);
|
|
|
+ if (r) {
|
|
|
+ this.$message({
|
|
|
+ message: '手机号已经被注册,请重新输入',
|
|
|
+ type: 'warning',
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ let res = await this.livecreate(data);
|
|
|
+ this.$checkRes(res, '添加成功', '添加失败');
|
|
|
+ }
|
|
|
}
|
|
|
this.$router.push({ path: '/duijiehui/index' });
|
|
|
},
|