|
|
@@ -3,15 +3,18 @@
|
|
|
<div class="white-box">
|
|
|
<el-form ref="form" :model="form" label-width="250px" class="form-page" style="margin-top: 25px;">
|
|
|
<el-form-item :label="form.TITLE" :key="form.CONFIG_NAME">
|
|
|
- <el-input v-model="form.VALUE" placeholder="请输入内容">
|
|
|
+ <el-input v-model="form.VALUE">
|
|
|
<template slot="append">naira / $</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <span style="font-weight: bold; color: red; font-size: 12px;">提示:修改汇率会刷新商品的销售价格(naira),请谨慎操作!!</span>
|
|
|
+ <el-form-item label="刷新商品价格">
|
|
|
+ <el-switch v-model="synchronize"></el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="" v-show="notice">
|
|
|
+ <span style="font-weight: bold; color: red; font-size: 14px;">开启后会根据最新汇率刷新商品的奈拉价格,请谨慎操作!!</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" size="small" @click="onSubmit" :loading="submitButtonStat">保存并刷新商品价格</el-button>
|
|
|
+ <el-button :type="btnType" size="medium" @click="onSubmit" :loading="submitButtonStat">{{ btnTxt }}</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
@@ -20,9 +23,10 @@
|
|
|
|
|
|
<script>
|
|
|
import network from '@/utils/network'
|
|
|
+import locale from "element-ui/lib/locale/lang/en";
|
|
|
export default {
|
|
|
name: 'config_exchange_rate',
|
|
|
- mounted() {
|
|
|
+ created() {
|
|
|
this.getData()
|
|
|
},
|
|
|
data() {
|
|
|
@@ -34,30 +38,36 @@ export default {
|
|
|
},
|
|
|
loading: true,
|
|
|
submitButtonStat: false,
|
|
|
+ btnType: 'primary',
|
|
|
+ btnTxt: '保存汇率',
|
|
|
+ notice: false,
|
|
|
+ synchronize: false,
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
onSubmit() {
|
|
|
- let _this = this
|
|
|
- _this.$confirm('修改汇率会刷新商品销售价格(naira), 是否继续?', '提示', {
|
|
|
+ this.$confirm(this.btnTxt, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
- _this.submitButtonStat = true
|
|
|
- network.postData('config/exchange-rate', this.form).then(response => {
|
|
|
- _this.$message({
|
|
|
+ this.submitButtonStat = true
|
|
|
+
|
|
|
+ let param = this.form
|
|
|
+ param.synchronize = this.synchronize
|
|
|
+ return network.postData('config/exchange-rate', param).then(response => {
|
|
|
+ this.$message({
|
|
|
message: response,
|
|
|
type: 'success'
|
|
|
})
|
|
|
- _this.submitButtonStat = false
|
|
|
- _this.getData()
|
|
|
- }).catch(response => {
|
|
|
- _this.submitButtonStat = false
|
|
|
- _this.getData()
|
|
|
+ this.submitButtonStat = false
|
|
|
+ location.reload()
|
|
|
+ }).catch(_ => {
|
|
|
+ this.submitButtonStat = false
|
|
|
+ this.getData()
|
|
|
})
|
|
|
}).catch(() => {
|
|
|
- _this.submitButtonStat = false
|
|
|
+ this.submitButtonStat = false
|
|
|
})
|
|
|
},
|
|
|
getData() {
|
|
|
@@ -66,6 +76,18 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 监听是否同步刷新商品价格
|
|
|
+ synchronize: {
|
|
|
+ handler(modern, origin) {
|
|
|
+ this.btnType = (modern === true) ? 'danger' : 'primary'
|
|
|
+ this.btnTxt = (modern === true) ? '保存并刷新商品价格' : '保存汇率'
|
|
|
+ this.notice = (modern === true)
|
|
|
+ },
|
|
|
+ // 深度监听
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|