| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <div class="app-container">
- <div v-loading="loading" class="white-box">
- <el-form ref="form" :model="form" label-width="250px" :label-position="labelPosition">
- <el-form-item :label="$t('member.memberCode')">
- <el-input v-model.trim="form.userName" @change="handleChange"></el-input>
- <el-tag style="margin-top: 15px;" v-show="userInfo.REAL_NAME !== null">{{ $t('member.memberName') }}:{{ userInfo.REAL_NAME }} ({{ userInfo.country }})</el-tag>
- <el-tag v-show="userInfo.REAL_NAME !== null" style="margin-top: 5px;">{{ $t('member.currentLevel') }}:{{ allDecRole[userInfo.DEC_ROLE_ID] ? allDecRole[userInfo.DEC_ROLE_ID]['ROLE_NAME'] : '' }}</el-tag>
- </el-form-item>
- <el-form-item :label="$t('member.stockistLevel')">
- <el-select v-model="form.levelId" :placeholder="$t('member.pleaseSelectStockistLevel')">
- <el-option v-for="(item,key) in allDecRole" :label="item.ROLE_NAME" :value="item.ID" :key="key"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item :label="$t('member.remark')">
- <el-input type="textarea" :rows="2" placeholder="" v-model="form.remark">
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" :loading="submitButtonStat" @click="onSubmit">{{ $t('common.confirm') }}</el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- import waves from '@/directive/waves'
- import { getScreenWidth } from '@/utils'
- import {fetchMemberFullInfo, updateUserStockistLevel} from "@/api/member";
- import baseInfo from "@/utils/baseInfo";
- export default {
- name: 'modifyStockistLevel',
- directives: { waves },
- data() {
- return {
- form: {
- userName: null,
- levelId: null,
- remark: null,
- },
- loading: false,
- submitButtonStat: false,
- allDecRole: baseInfo.decRoles(),
- periodArr: [],
- userInfo: {
- REAL_NAME: null,
- DEC_ROLE_ID: null,
- country: null,
- },
- screenWidth: getScreenWidth() > 600 ? '500px' : getScreenWidth() + 'px',
- labelPosition: getScreenWidth() > 600 ? 'right' : 'top',
- }
- },
- methods: {
- handleChange() {
- this.loading = true
- fetchMemberFullInfo({ userName: this.form.userName }).then(response => {
- this.userInfo = response.data
- setTimeout(() => {
- this.loading = false
- }, 0.5 * 1000)
- }).catch(error => {
- this.userInfo.REAL_NAME = null
- this.$message({
- message: error,
- type: 'warning'
- })
- this.loading = false
- })
- },
- onSubmit() {
- this.$confirm(this.$t('member.modifyEntryLevelHits'), this.$t('common.hint'), {
- confirmButtonText: this.$t('common.confirm'),
- cancelButtonText: this.$t('common.cancel'),
- type: 'warning'
- }).then(() => {
- this._handleSubmit()
- }).catch(error => {
- this.$message({
- message: error,
- type: 'warning'
- })
- })
- },
- _handleSubmit() {
- updateUserStockistLevel(this.form).then(response => {
- this.$message({
- message: response.data,
- type: 'success'
- })
- setTimeout(() => {
- this.submitButtonStat = false
- }, 0.5 * 1000)
- this.submitButtonStat = false
- }).catch(error => {
- this.$message({
- message: error,
- type: 'warning'
- })
- this.submitButtonStat = false
- })
- this._clearData()
- },
- _clearData(){
- this.form = {
- userName: null,
- levelId: null,
- remark: null,
- }
- this.userInfo= {
- REAL_NAME: null,
- DEC_ROLE_ID: null,
- }
- }
- }
- }
- </script>
- <style>
- .app-main {
- padding: 15px;
- }
- .app-container {
- padding: 0;
- }
- .white-box {
- padding: 15px;
- }
- .form-page {
- width: 100%;
- }
- </style>
|