|
|
@@ -0,0 +1,128 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div v-loading="loading" class="white-box">
|
|
|
+ <el-table :data="tableData" stripe style="width: 100%;">
|
|
|
+ <el-table-column prop="SORT" :label="$t('config.sort')" width="80" />
|
|
|
+ <el-table-column prop="ROLE_NAME" :label="$t('config.levelName')" min-width="150px;" />
|
|
|
+ <el-table-column prop="FW_BONUS_PERCENT" :label="$t('financial.serviceCharge')" min-width="90px;" />
|
|
|
+ <el-table-column :label="$t('common.createdAt')" min-width="150px;">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ {{ row.CREATED_AT | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('common.updatedAt')" min-width="150px;">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ {{ row.UPDATED_AT | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column fixed="right" :label="$t('common.action')" min-width="90px;">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-edit" plain @click="edit(scope.row)">{{ $t('common.edit') }}</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 编辑 -->
|
|
|
+ <el-dialog v-loading="editLoading" :title="$t('config.modifiedStockist')" :visible.sync="dialog" :width="screenWidth" style="margin-top: -80px">
|
|
|
+ <el-form ref="editForm" :model="editForm" style="margin-top: -30px; margin-bottom: -15px;">
|
|
|
+ <el-row :gutter="3">
|
|
|
+ <el-col :xs="24" :sm="24" :lg="12">
|
|
|
+ <el-input v-show="false" v-model="editForm.ID" size="small" type="text" />
|
|
|
+ <el-form-item :label="$t('config.levelName')" prop="ROLE_NAME" required style="margin-bottom: 10px;">
|
|
|
+ <el-input v-model.trim="editForm.ROLE_NAME" size="small" type="text" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('financial.serviceCharge')" prop="FW_BONUS_PERCENT" required style="margin-bottom: 10px;">
|
|
|
+ <el-input v-model="editForm.FW_BONUS_PERCENT" size="small" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item style="margin-bottom: 15px;">
|
|
|
+ <el-button type="warning" size="mini" @click="dialog = false">{{ $t('table.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="onSubmit">{{ $t('table.confirm') }}</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import waves from '@/directive/waves'
|
|
|
+import { getScreenWidth } from '@/utils'
|
|
|
+import { fetchStockistConfig, updateStockistConfig } from '@/api/config'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'StockistConfig',
|
|
|
+ directives: { waves },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: true,
|
|
|
+ tableData: null,
|
|
|
+ total: 0,
|
|
|
+ multipleSelection: [],
|
|
|
+ screenWidth: getScreenWidth() > 500 ? '500px' : getScreenWidth() + 'px',
|
|
|
+ labelPosition: getScreenWidth() >= 500 ? 'right' : 'top',
|
|
|
+
|
|
|
+ dialog: false,
|
|
|
+ editLoading: false,
|
|
|
+ editForm: {
|
|
|
+ ID: '',
|
|
|
+ ROLE_NAME: '',
|
|
|
+ FW_BONUS_PERCENT: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ fetchData() {
|
|
|
+ this.loading = true
|
|
|
+ fetchStockistConfig().then(response => {
|
|
|
+ this.tableData = response.data.list
|
|
|
+ this.total = +response.data.totalCount
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false
|
|
|
+ }, 0.5 * 1000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ edit(row) {
|
|
|
+ this.editForm = row
|
|
|
+ this.dialog = true
|
|
|
+ },
|
|
|
+ onSubmit() {
|
|
|
+ this.editLoading = true
|
|
|
+ const data = {
|
|
|
+ roleName: this.editForm.ROLE_NAME,
|
|
|
+ fwBonusPercent: this.editForm.FW_BONUS_PERCENT
|
|
|
+ }
|
|
|
+ updateStockistConfig(data, this.editForm.ID).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.editLoading = false
|
|
|
+ this.dialog = false
|
|
|
+ }, 0.5 * 1000)
|
|
|
+
|
|
|
+ this.fetchData()
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+
|
|
|
+ this.editLoading = false
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+</style>
|