|
@@ -349,18 +349,41 @@ export default {
|
|
|
name: '',
|
|
|
status: ''
|
|
|
},
|
|
|
- // 表单校验
|
|
|
rules: {
|
|
|
- type: [{ required: true, message: '商户号不能为空', trigger: 'blur' }],
|
|
|
+ type: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t('merchant.merchantNumberRequired'),
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
no: [
|
|
|
- { required: true, message: '商户号不能为空', trigger: 'blur' },
|
|
|
- { min: 5, max: 30, message: '商户号长度必须介于5至30之间', trigger: 'blur' }
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t('merchant.merchantNumberRequired'),
|
|
|
+ trigger: 'blur'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ min: 5,
|
|
|
+ max: 30,
|
|
|
+ message: this.$t('merchant.merchantNumberLengthRange'),
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
name: [
|
|
|
- { required: true, message: '商户名称不能为空', trigger: 'blur' },
|
|
|
- { min: 2, max: 30, message: '商户名称长度必须介于 2 和 50 之间', trigger: 'blur' }
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t('merchant.merchantNameRequired'),
|
|
|
+ trigger: 'blur'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ min: 2,
|
|
|
+ max: 30,
|
|
|
+ message: this.$t('merchant.merchantNameLengthRange'),
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
]
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -369,127 +392,130 @@ export default {
|
|
|
methods: {
|
|
|
// 查询日志
|
|
|
getList() {
|
|
|
- this.loading = true
|
|
|
- getMerchantList(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
|
|
|
- this.list = response.data.dataList.content
|
|
|
- this.total = response.data.dataList.totalElements
|
|
|
- this.imagePath = response.data.imagePath
|
|
|
- this.typeOptions = response.data.typeList
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
+ this.loading = true;
|
|
|
+ getMerchantList(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
|
|
|
+ this.list = response.data.dataList.content;
|
|
|
+ this.total = response.data.dataList.totalElements;
|
|
|
+ this.imagePath = response.data.imagePath;
|
|
|
+ this.typeOptions = response.data.typeList;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
// 搜索按钮操作
|
|
|
handleQuery() {
|
|
|
- this.queryParams.page = 1
|
|
|
- this.getList()
|
|
|
+ this.queryParams.page = 1;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
// 重置按钮操作
|
|
|
resetQuery() {
|
|
|
- this.resetForm('queryForm')
|
|
|
- this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
|
|
- this.handleQuery()
|
|
|
+ this.resetForm('queryForm');
|
|
|
+ this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order);
|
|
|
+ this.handleQuery();
|
|
|
},
|
|
|
// 状态修改
|
|
|
handleStatusChange(row) {
|
|
|
- let text = row.status == '1' ? '启用' : '禁用'
|
|
|
- this.$modal
|
|
|
- .confirm('确认要' + text + '"' + row.name + '"商户吗?')
|
|
|
- .then(function () {
|
|
|
- return updateMerchantStatus(row.id, row.status)
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$modal.msgSuccess(text + '成功')
|
|
|
- })
|
|
|
- .catch(function () {
|
|
|
- row.status = row.status === 'A' ? 'A' : 'D'
|
|
|
- })
|
|
|
+ let text = row.status === '1' ? this.$t('merchant.enable') : this.$t('merchant.disable');
|
|
|
+ const confirmMsg = this.$t('merchant.confirmChangeStatus', { action: text, name: row.name });
|
|
|
+ this.$modal
|
|
|
+ .confirm(confirmMsg)
|
|
|
+ .then(() => {
|
|
|
+ return updateMerchantStatus(row.id, row.status);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const successMsg = this.$t('merchant.statusChangeSuccess', { action: text });
|
|
|
+ this.$modal.msgSuccess(successMsg);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ row.status = row.status === 'A' ? 'A' : 'D';
|
|
|
+ });
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map((item) => item.id)
|
|
|
- this.multiple = !selection.length
|
|
|
+ this.ids = selection.map((item) => item.id);
|
|
|
+ this.multiple = !selection.length;
|
|
|
},
|
|
|
// 排序触发事件
|
|
|
handleSortChange(column, prop, order) {
|
|
|
- this.queryParams.orderByColumn = column.prop
|
|
|
- this.queryParams.isAsc = column.order
|
|
|
- this.getList()
|
|
|
+ this.queryParams.orderByColumn = column.prop;
|
|
|
+ this.queryParams.isAsc = column.order;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
// 新增按钮操作
|
|
|
handleAdd() {
|
|
|
- this.reset()
|
|
|
- this.open = true
|
|
|
- this.title = '新增商户'
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = this.$t('merchant.addNewMerchant');
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
- this.form = {
|
|
|
- id: '',
|
|
|
- no: '',
|
|
|
- name: '',
|
|
|
- logo: '',
|
|
|
- license: '',
|
|
|
- wxAppId: '',
|
|
|
- wxAppSecret: '',
|
|
|
- wxOfficialAppId: '',
|
|
|
- wxOfficialAppSecret: '',
|
|
|
- description: '',
|
|
|
- status: 'A'
|
|
|
- }
|
|
|
- this.resetForm('form')
|
|
|
+ this.form = {
|
|
|
+ id: '',
|
|
|
+ no: '',
|
|
|
+ name: '',
|
|
|
+ logo: '',
|
|
|
+ license: '',
|
|
|
+ wxAppId: '',
|
|
|
+ wxAppSecret: '',
|
|
|
+ wxOfficialAppId: '',
|
|
|
+ wxOfficialAppSecret: '',
|
|
|
+ description: '',
|
|
|
+ status: 'A'
|
|
|
+ };
|
|
|
+ this.resetForm('form');
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
- this.open = false
|
|
|
- this.reset()
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
},
|
|
|
// 提交按钮
|
|
|
submitForm: function () {
|
|
|
- this.$refs['form'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.id) {
|
|
|
- saveMerchant(this.form).then((response) => {
|
|
|
- this.$modal.msgSuccess('修改成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
- } else {
|
|
|
- saveMerchant(this.form).then((response) => {
|
|
|
- this.$modal.msgSuccess('新增成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.id) {
|
|
|
+ saveMerchant(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess(this.$t('merchant.modifySuccess'));
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ saveMerchant(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess(this.$t('merchant.addSuccess'));
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 修改按钮操作
|
|
|
handleUpdate(row) {
|
|
|
- const app = this
|
|
|
- app.reset()
|
|
|
- const id = row.id || this.ids
|
|
|
- getMerchantInfo(id).then((response) => {
|
|
|
- app.form = response.data.merchantInfo
|
|
|
- app.open = true
|
|
|
- app.title = '编辑商户'
|
|
|
- })
|
|
|
+ const app = this;
|
|
|
+ app.reset();
|
|
|
+ const id = row.id || this.ids;
|
|
|
+ getMerchantInfo(id).then((response) => {
|
|
|
+ app.form = response.data.merchantInfo;
|
|
|
+ app.open = true;
|
|
|
+ app.title = this.$t('merchant.editMerchant');
|
|
|
+ });
|
|
|
},
|
|
|
// 删除按钮操作
|
|
|
handleDelete(row) {
|
|
|
- const name = row.name || this.id
|
|
|
- this.$modal
|
|
|
- .confirm('是否确认删除"' + name + '"的数据项?')
|
|
|
- .then(function () {
|
|
|
- return updateMerchantStatus(row.id, 'D')
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.getList()
|
|
|
- this.$modal.msgSuccess('删除成功')
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
+ const name = row.name || this.id;
|
|
|
+ const confirmMsg = this.$t('merchant.confirmDelete', { name });
|
|
|
+ this.$modal
|
|
|
+ .confirm(confirmMsg)
|
|
|
+ .then(() => {
|
|
|
+ return updateMerchantStatus(row.id, 'D');
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess(this.$t('merchant.deleteSuccess'));
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
handleUploadSuccess(file) {
|
|
|
- this.form.logo = file.data.fileName
|
|
|
+ this.form.logo = file.data.fileName;
|
|
|
}
|
|
|
}
|
|
|
}
|