| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <template>
- <div v-loading="loading">
- <div class="white-box">
- <el-form ref="form" :model="form" label-width="150px" style="width:500px;">
- <el-form-item label="Member Code">
- 是否主会员
- </el-form-item>
- <el-form-item v-for="(item,index) in userBinds" :key="index" :label="item.USER_NAME">
- <el-switch v-model="item.USER_ID==mainUid" active-color="#13ce66" @change="changeMainUid(item.USER_ID)">
- </el-switch>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="onSubmit" :loading="submitButtonStat">保存</el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- import network from '@/utils/network'
- export default {
- name: 'user_bind-edit',
- mounted() {
- this.getData()
- },
- data() {
- return {
- form: {
- id: null,
- type: 1,
- userName: null,
- mainUserName: null,
- mainUid:null,
- },
- mainUid:null,
- userBinds:[],
- loading: true,
- submitButtonStat: false,
- }
- },
- methods: {
- getData() {
- this.form.id = this.$route.params.id
- network.getData(`user/bind-edit/${this.$route.params.id}`).then(response => {
- this.loading = false
- this.userBinds = response.userBinds
- this.form.mainUid = response.mainUid
- this.mainUid = response.mainUid
- }).catch(() => {
- })
- },
- changeMainUid(uid){
- this.mainUid=uid
- this.form.mainUid = uid
- },
- onSubmit() {
- this.submitButtonStat = true
- let path = `user/bind-edit/${this.$route.params.id}`
- network.postData(path, this.form).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- this.submitButtonStat = false
- this.$router.go(-1)
- }).catch(response => {
- this.submitButtonStat = false
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|