Просмотр исходного кода

站点配置、汇率配置、报单中心配置

kevin_zhangl 2 лет назад
Родитель
Сommit
f6d1dba0ad

+ 49 - 0
src/api/config.js

@@ -23,3 +23,52 @@ export function updateSiteConfig(data) {
     data
   })
 }
+
+/**
+ * 获取汇率配置
+ * @returns {*}
+ */
+export function fetchExchangeRateConfig() {
+  return request({
+    url: '/v1/config/exchange-rate',
+    method: 'get'
+  })
+}
+
+/**
+ * 更新汇率配置
+ * @param data
+ * @returns {*}
+ */
+export function updateExchangeRateConfig(data) {
+  return request({
+    url: '/v1/config/exchange-rate',
+    method: 'post',
+    data
+  })
+}
+
+/**
+ * 获取报单中心配置
+ * @returns {*}
+ */
+export function fetchStockistConfig() {
+  return request({
+    url: '/v1/config/dec-role',
+    method: 'get'
+  })
+}
+
+/**
+ * 更新报单中心配置
+ * @param data
+ * @param id
+ * @returns {*}
+ */
+export function updateStockistConfig(data, id) {
+  return request({
+    url: `/v1/config/dec-role-edit/${id}`,
+    method: 'post',
+    data
+  })
+}

+ 23 - 1
src/lang/en.js

@@ -197,7 +197,9 @@ export default {
     websiteTitle: 'Member Management System',
     uploadHints: 'Uploading, please hold on. Do not close the window!',
     canNotBeBlank: ' cannot be blank',
-    require: 'is required'
+    require: 'is required',
+    createdAt: '创建时间',
+    updatedAt: '更新时间'
   },
 
   menu: {
@@ -271,5 +273,25 @@ export default {
     decLevelConfig: '会员级别配置',
     empLevelConfig: '会员聘级配置',
     decRoleConfig: '报单中心级别配置'
+  },
+
+  // 会员
+  user: {
+
+  },
+
+  // 配置
+  config: {
+    refreshShopPrice: '刷新商品价格',
+    refreshShopNaraPriceThenSave: '保存后根据新汇率刷新上架商品奈拉价格',
+    confirmToChangeExchangeRate: '是否确认修改汇率?',
+    levelName: '级别名称',
+    sort: 'Sort',
+    modifiedStockist: '修改报单中心'
+  },
+
+  // 财务
+  financial: {
+    serviceCharge: '服务费(%)'
   }
 }

+ 2 - 1
src/lang/index.js

@@ -51,7 +51,8 @@ const i18n = new VueI18n({
   // 默认语言设置,当其他语言没有的情况下,使用en作为默认语言
   fallbackLocale: 'en',
   // set locale messages
-  messages
+  messages,
+  silentTranslationWarn: true
 })
 
 export default i18n

+ 19 - 1
src/lang/zh.js

@@ -197,7 +197,9 @@ export default {
     websiteTitle: '会员管理系统',
     uploadHints: '正在上传,请稍后。请勿关闭窗口!',
     canNotBeBlank: '不能为空',
-    require: '必须填写'
+    require: '必须填写',
+    createdAt: '创建时间',
+    updatedAt: '更新时间'
   },
 
   // 菜单
@@ -277,5 +279,21 @@ export default {
   // 会员
   user: {
 
+  },
+
+  // 配置
+  config: {
+    refreshShopPrice: '刷新商品价格',
+    refreshShopNaraPriceThenSave: '保存后根据新汇率刷新上架商品奈拉价格',
+    confirmToChangeExchangeRate: '是否确认修改汇率?',
+    levelName: '级别名称',
+    sort: '序号',
+    modifiedStockist: '修改报单中心'
+  },
+
+  // 财务
+  financial: {
+    serviceCharge: '服务费(%)'
   }
+
 }

+ 12 - 0
src/router/modules/config.js

@@ -13,6 +13,18 @@ const configRouter = {
       component: () => import('@/views/config/site-config'),
       name: 'siteConfig',
       meta: { title: '站点配置', icon: 'user', noCache: true }
+    },
+    {
+      path: 'exchange-rate', // 汇率配置
+      component: () => import('@/views/config/exchange-rate'),
+      name: 'exchangeRate',
+      meta: { title: '汇率配置', icon: 'user', noCache: true }
+    },
+    {
+      path: 'dec-role', // 报单中心配置
+      component: () => import('@/views/config/stockist-config'),
+      name: 'stockistConfig',
+      meta: { title: '报单中心配置', icon: 'user', noCache: true }
     }
   ]
 }

+ 97 - 0
src/views/config/exchange-rate.vue

@@ -0,0 +1,97 @@
+<template>
+  <div class="app-container">
+    <div v-loading="loading" class="white-box">
+      <el-form ref="form" :model="form" label-width="250px" :label-position="labelPosition" class="form-page">
+        <el-form-item :key="form.CONFIG_NAME" :label="form.TITLE">
+          <el-input v-model="form.VALUE" style="max-width: 300px;">
+            <template slot="append">naira / $</template>
+          </el-input>
+        </el-form-item>
+        <el-form-item :label="$t('config.refreshShopPrice')">
+          <el-switch v-model="synchronize" />
+          <el-divider direction="vertical" />
+          <span style="font-weight: bold; color: red; font-size: 14px;">{{ $t('config.refreshShopNaraPriceThenSave') }}</span>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" size="medium" :loading="submitButtonStat" @click="onSubmit">{{ $t('common.confirm') }}</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import { fetchExchangeRateConfig, updateExchangeRateConfig } from '@/api/config'
+import { getScreenWidth } from '@/utils'
+
+export default {
+  name: 'ExchangeRate',
+  data() {
+    return {
+      form: {
+        CONFIG_NAME: '',
+        VALUE: 0,
+        TITLE: ''
+      },
+      loading: true,
+      submitButtonStat: false,
+      synchronize: false,
+      screenWidth: getScreenWidth() > 600 ? '500px' : getScreenWidth() + 'px',
+      labelPosition: getScreenWidth() > 600 ? 'right' : 'top'
+    }
+  },
+  created() {
+    this.fetchData()
+  },
+  methods: {
+    fetchData() {
+      this.loading = true
+      fetchExchangeRateConfig().then(response => {
+        this.form = response.data
+
+        setTimeout(() => {
+          this.loading = false
+        }, 0.5 * 1000)
+      })
+    },
+    onSubmit() {
+      this.$confirm(this.$t('config.confirmToChangeExchangeRate'), this.$t('common.hint'), {
+        confirmButtonText: this.$t('common.confirm'),
+        cancelButtonText: this.$t('common.cancel'),
+        type: 'warning'
+      }).then(() => {
+        this.submitButtonStat = true
+
+        const param = this.form
+        param.synchronize = this.synchronize
+        updateExchangeRateConfig(param).then(response => {
+          this.$message({
+            message: response.data,
+            type: 'success'
+          })
+
+          setTimeout(() => {
+            this.submitButtonStat = false
+          }, 0.5 * 1000)
+
+          this.fetchData()
+        }).catch(error => {
+          this.$message({
+            message: error,
+            type: 'warning'
+          })
+
+          this.submitButtonStat = false
+          this.fetchData()
+        })
+      }).catch(() => {
+        this.submitButtonStat = false
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 2
src/views/config/site-config.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <div class="white-box">
+    <div v-loading="loading" class="white-box">
       <el-form ref="form" :model="form" label-width="250px" :label-position="labelPosition" class="form-page">
         <template v-for="item in configData">
           <el-form-item :key="item.CONFIG_NAME" :label="item.TITLE">
@@ -44,7 +44,7 @@
           </el-form-item>
         </template>
         <el-form-item>
-          <el-button type="primary" :loading="submitButtonStat" @click="onSubmit">更新</el-button>
+          <el-button type="primary" :loading="submitButtonStat" @click="onSubmit">{{ $t('common.confirm') }}</el-button>
         </el-form-item>
       </el-form>
     </div>

+ 128 - 0
src/views/config/stockist-config.vue

@@ -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>