Commit 76e2c4c759b4db75962c6407bbed0a4320c9555a
1 parent
1705091d
开发 admin 营销功能
Showing
11 changed files
with
657 additions
and
54 deletions
src/api/market/marketSmsManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取营销短信列表 | ||
| 4 | +export function listMarketSms(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/marketSms.listMarketSms', | ||
| 8 | + method: 'get', | ||
| 9 | + params | ||
| 10 | + }).then(response => { | ||
| 11 | + const res = response.data | ||
| 12 | + if (res.code === 0) { | ||
| 13 | + resolve(res) | ||
| 14 | + } else { | ||
| 15 | + reject(new Error(res.msg || '获取营销短信列表失败')) | ||
| 16 | + } | ||
| 17 | + }).catch(error => { | ||
| 18 | + reject(error) | ||
| 19 | + }) | ||
| 20 | + }) | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +// 保存营销短信 | ||
| 24 | +export function saveMarketSms(data) { | ||
| 25 | + return new Promise((resolve, reject) => { | ||
| 26 | + request({ | ||
| 27 | + url: '/marketSms.saveMarketSms', | ||
| 28 | + method: 'post', | ||
| 29 | + data | ||
| 30 | + }).then(response => { | ||
| 31 | + const res = response.data | ||
| 32 | + if (res.code === 0) { | ||
| 33 | + resolve(res) | ||
| 34 | + } else { | ||
| 35 | + reject(new Error(res.msg || '保存营销短信失败')) | ||
| 36 | + } | ||
| 37 | + }).catch(error => { | ||
| 38 | + reject(error) | ||
| 39 | + }) | ||
| 40 | + }) | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +// 更新营销短信 | ||
| 44 | +export function updateMarketSms(data) { | ||
| 45 | + return new Promise((resolve, reject) => { | ||
| 46 | + request({ | ||
| 47 | + url: '/marketSms.updateMarketSms', | ||
| 48 | + method: 'post', | ||
| 49 | + data | ||
| 50 | + }).then(response => { | ||
| 51 | + const res = response.data | ||
| 52 | + if (res.code === 0) { | ||
| 53 | + resolve(res) | ||
| 54 | + } else { | ||
| 55 | + reject(new Error(res.msg || '更新营销短信失败')) | ||
| 56 | + } | ||
| 57 | + }).catch(error => { | ||
| 58 | + reject(error) | ||
| 59 | + }) | ||
| 60 | + }) | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +// 删除营销短信 | ||
| 64 | +export function deleteMarketSms(data) { | ||
| 65 | + return new Promise((resolve, reject) => { | ||
| 66 | + request({ | ||
| 67 | + url: '/marketSms.deleteMarketSms', | ||
| 68 | + method: 'post', | ||
| 69 | + data | ||
| 70 | + }).then(response => { | ||
| 71 | + const res = response.data | ||
| 72 | + if (res.code === 0) { | ||
| 73 | + resolve(res) | ||
| 74 | + } else { | ||
| 75 | + reject(new Error(res.msg || '删除营销短信失败')) | ||
| 76 | + } | ||
| 77 | + }).catch(error => { | ||
| 78 | + reject(error) | ||
| 79 | + }) | ||
| 80 | + }) | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +// 获取营销短信键列表 | ||
| 84 | +export function listMarketSmsKey(params) { | ||
| 85 | + return new Promise((resolve, reject) => { | ||
| 86 | + request({ | ||
| 87 | + url: '/marketSms.listMarketSmsKey', | ||
| 88 | + method: 'get', | ||
| 89 | + params | ||
| 90 | + }).then(response => { | ||
| 91 | + const res = response.data | ||
| 92 | + if (res.code === 0) { | ||
| 93 | + resolve(res) | ||
| 94 | + } else { | ||
| 95 | + reject(new Error(res.msg || '获取营销短信键列表失败')) | ||
| 96 | + } | ||
| 97 | + }).catch(error => { | ||
| 98 | + reject(error) | ||
| 99 | + }) | ||
| 100 | + }) | ||
| 101 | +} | ||
| 0 | \ No newline at end of file | 102 | \ No newline at end of file |
src/components/market/AddMarketSms.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('marketSms.add.title')" :visible.sync="visible" width="50%" @close="handleClose"> | ||
| 3 | + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||
| 4 | + <el-form-item :label="$t('marketSms.form.smsName')" prop="smsName"> | ||
| 5 | + <el-input v-model="form.smsName" :placeholder="$t('marketSms.placeholder.smsName')" /> | ||
| 6 | + </el-form-item> | ||
| 7 | + <el-form-item :label="$t('marketSms.form.smsType')" prop="smsType"> | ||
| 8 | + <el-select v-model="form.smsType" :placeholder="$t('marketSms.placeholder.smsType')" style="width: 100%" | ||
| 9 | + @change="handleSmsTypeChange"> | ||
| 10 | + <el-option v-for="item in smsTypes" :key="item.statusCd" :label="item.name" :value="item.statusCd" /> | ||
| 11 | + </el-select> | ||
| 12 | + </el-form-item> | ||
| 13 | + <el-form-item v-for="(item, index) in smsTypeValues" :key="index" :label="item.name"> | ||
| 14 | + <el-input v-model="item.smsValue" :placeholder="item.remark" /> | ||
| 15 | + </el-form-item> | ||
| 16 | + <el-form-item :label="$t('marketSms.form.remark')" prop="remark"> | ||
| 17 | + <el-input v-model="form.remark" :placeholder="$t('marketSms.placeholder.remark')" type="textarea" rows="3" /> | ||
| 18 | + </el-form-item> | ||
| 19 | + </el-form> | ||
| 20 | + <div slot="footer" class="dialog-footer"> | ||
| 21 | + <el-button @click="visible = false"> | ||
| 22 | + {{ $t('common.cancel') }} | ||
| 23 | + </el-button> | ||
| 24 | + <el-button type="primary" @click="handleSubmit"> | ||
| 25 | + {{ $t('common.confirm') }} | ||
| 26 | + </el-button> | ||
| 27 | + </div> | ||
| 28 | + </el-dialog> | ||
| 29 | +</template> | ||
| 30 | + | ||
| 31 | +<script> | ||
| 32 | +import { saveMarketSms, listMarketSmsKey } from '@/api/market/marketSmsManageApi' | ||
| 33 | +import {getDict} from '@/api/community/communityApi' | ||
| 34 | + | ||
| 35 | +export default { | ||
| 36 | + name: 'AddMarketSms', | ||
| 37 | + data() { | ||
| 38 | + return { | ||
| 39 | + visible: false, | ||
| 40 | + form: { | ||
| 41 | + smsName: '', | ||
| 42 | + smsType: '', | ||
| 43 | + remark: '' | ||
| 44 | + }, | ||
| 45 | + smsTypes: [], | ||
| 46 | + smsTypeValues: [], | ||
| 47 | + rules: { | ||
| 48 | + smsName: [ | ||
| 49 | + { required: true, message: this.$t('marketSms.validate.smsName'), trigger: 'blur' }, | ||
| 50 | + { max: 64, message: this.$t('marketSms.validate.smsNameMax'), trigger: 'blur' } | ||
| 51 | + ], | ||
| 52 | + smsType: [ | ||
| 53 | + { required: true, message: this.$t('marketSms.validate.smsType'), trigger: 'change' } | ||
| 54 | + ], | ||
| 55 | + remark: [ | ||
| 56 | + { required: true, message: this.$t('marketSms.validate.remark'), trigger: 'blur' }, | ||
| 57 | + { max: 512, message: this.$t('marketSms.validate.remarkMax'), trigger: 'blur' } | ||
| 58 | + ] | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + }, | ||
| 62 | + created() { | ||
| 63 | + this.getDictData() | ||
| 64 | + }, | ||
| 65 | + methods: { | ||
| 66 | + async getDictData() { | ||
| 67 | + try { | ||
| 68 | + const data = await getDict('market_sms_key', 'sms_type') | ||
| 69 | + this.smsTypes = data | ||
| 70 | + } catch (error) { | ||
| 71 | + console.error('获取字典数据失败:', error) | ||
| 72 | + } | ||
| 73 | + }, | ||
| 74 | + async handleSmsTypeChange(value) { | ||
| 75 | + if (!value) return | ||
| 76 | + try { | ||
| 77 | + const { data } = await listMarketSmsKey({ | ||
| 78 | + smsType: value, | ||
| 79 | + page: 1, | ||
| 80 | + row: 100 | ||
| 81 | + }) | ||
| 82 | + this.smsTypeValues = data | ||
| 83 | + } catch (error) { | ||
| 84 | + console.error('获取短信类型值失败:', error) | ||
| 85 | + } | ||
| 86 | + }, | ||
| 87 | + open() { | ||
| 88 | + this.visible = true | ||
| 89 | + }, | ||
| 90 | + handleClose() { | ||
| 91 | + this.$refs.form.resetFields() | ||
| 92 | + this.smsTypeValues = [] | ||
| 93 | + }, | ||
| 94 | + handleSubmit() { | ||
| 95 | + this.$refs.form.validate(async valid => { | ||
| 96 | + if (!valid) return | ||
| 97 | + | ||
| 98 | + try { | ||
| 99 | + const formData = { | ||
| 100 | + ...this.form, | ||
| 101 | + smsTypeValues: this.smsTypeValues | ||
| 102 | + } | ||
| 103 | + await saveMarketSms(formData) | ||
| 104 | + this.$message.success(this.$t('marketSms.add.success')) | ||
| 105 | + this.visible = false | ||
| 106 | + this.$emit('success') | ||
| 107 | + } catch (error) { | ||
| 108 | + this.$message.error(error.message) | ||
| 109 | + } | ||
| 110 | + }) | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | +} | ||
| 114 | +</script> | ||
| 0 | \ No newline at end of file | 115 | \ No newline at end of file |
src/components/market/DeleteMarketSms.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('marketSms.delete.title')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="30%" | ||
| 6 | + @close="handleClose" | ||
| 7 | + > | ||
| 8 | + <div class="delete-content"> | ||
| 9 | + <p>{{ $t('marketSms.delete.confirm') }}</p> | ||
| 10 | + </div> | ||
| 11 | + <div slot="footer" class="dialog-footer"> | ||
| 12 | + <el-button @click="visible = false"> | ||
| 13 | + {{ $t('common.cancel') }} | ||
| 14 | + </el-button> | ||
| 15 | + <el-button type="primary" @click="handleConfirm"> | ||
| 16 | + {{ $t('common.confirm') }} | ||
| 17 | + </el-button> | ||
| 18 | + </div> | ||
| 19 | + </el-dialog> | ||
| 20 | + </template> | ||
| 21 | + | ||
| 22 | + <script> | ||
| 23 | + import { deleteMarketSms } from '@/api/market/marketSmsManageApi' | ||
| 24 | + | ||
| 25 | + export default { | ||
| 26 | + name: 'DeleteMarketSms', | ||
| 27 | + data() { | ||
| 28 | + return { | ||
| 29 | + visible: false, | ||
| 30 | + smsId: '' | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | + methods: { | ||
| 34 | + open(data) { | ||
| 35 | + this.smsId = data.smsId | ||
| 36 | + this.visible = true | ||
| 37 | + }, | ||
| 38 | + handleClose() { | ||
| 39 | + this.smsId = '' | ||
| 40 | + }, | ||
| 41 | + async handleConfirm() { | ||
| 42 | + try { | ||
| 43 | + await deleteMarketSms({ smsId: this.smsId }) | ||
| 44 | + this.$message.success(this.$t('marketSms.delete.success')) | ||
| 45 | + this.visible = false | ||
| 46 | + this.$emit('success') | ||
| 47 | + } catch (error) { | ||
| 48 | + this.$message.error(error.message) | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + </script> | ||
| 54 | + | ||
| 55 | + <style scoped> | ||
| 56 | + .delete-content { | ||
| 57 | + text-align: center; | ||
| 58 | + font-size: 16px; | ||
| 59 | + margin-bottom: 20px; | ||
| 60 | + } | ||
| 61 | + </style> | ||
| 0 | \ No newline at end of file | 62 | \ No newline at end of file |
src/components/market/EditMarketSms.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('marketSms.edit.title')" :visible.sync="visible" width="50%" @close="handleClose"> | ||
| 3 | + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||
| 4 | + <el-form-item :label="$t('marketSms.form.smsName')" prop="smsName"> | ||
| 5 | + <el-input v-model="form.smsName" /> | ||
| 6 | + </el-form-item> | ||
| 7 | + <el-form-item :label="$t('marketSms.form.smsType')" prop="smsType"> | ||
| 8 | + <el-select v-model="form.smsType" style="width: 100%" disabled> | ||
| 9 | + <el-option v-for="item in smsTypes" :key="item.statusCd" :label="item.name" :value="item.statusCd" /> | ||
| 10 | + </el-select> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item v-for="(item, index) in form.smsTypeValues" :key="index" :label="item.name"> | ||
| 13 | + <el-input v-model="item.smsValue" :placeholder="item.remark" /> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item :label="$t('marketSms.form.remark')" prop="remark"> | ||
| 16 | + <el-input v-model="form.remark" type="textarea" /> | ||
| 17 | + </el-form-item> | ||
| 18 | + </el-form> | ||
| 19 | + <span slot="footer" class="dialog-footer"> | ||
| 20 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 21 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 22 | + </span> | ||
| 23 | + </el-dialog> | ||
| 24 | +</template> | ||
| 25 | + | ||
| 26 | +<script> | ||
| 27 | +import { updateMarketSms } from '@/api/market/marketSmsManageApi' | ||
| 28 | +import { getDict } from '@/api/community/communityApi' | ||
| 29 | + | ||
| 30 | +export default { | ||
| 31 | + name: 'EditMarketSms', | ||
| 32 | + data() { | ||
| 33 | + return { | ||
| 34 | + visible: false, | ||
| 35 | + smsTypes: [], | ||
| 36 | + form: { | ||
| 37 | + smsId: '', | ||
| 38 | + smsName: '', | ||
| 39 | + smsType: '', | ||
| 40 | + remark: '', | ||
| 41 | + smsTypeValues: [] | ||
| 42 | + }, | ||
| 43 | + rules: { | ||
| 44 | + smsName: [ | ||
| 45 | + { required: true, message: this.$t('marketSmsManage.rules.smsName'), trigger: 'blur' }, | ||
| 46 | + { max: 64, message: this.$t('marketSmsManage.rules.smsNameMax'), trigger: 'blur' } | ||
| 47 | + ], | ||
| 48 | + smsType: [ | ||
| 49 | + { required: true, message: this.$t('marketSmsManage.rules.smsType'), trigger: 'change' } | ||
| 50 | + ], | ||
| 51 | + remark: [ | ||
| 52 | + { required: true, message: this.$t('marketSmsManage.rules.remark'), trigger: 'blur' }, | ||
| 53 | + { max: 512, message: this.$t('marketSmsManage.rules.remarkMax'), trigger: 'blur' } | ||
| 54 | + ] | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + }, | ||
| 58 | + created() { | ||
| 59 | + this.getSmsTypes() | ||
| 60 | + }, | ||
| 61 | + methods: { | ||
| 62 | + open(data) { | ||
| 63 | + this.form = { | ||
| 64 | + ...data, | ||
| 65 | + smsTypeValues: data.values || [] | ||
| 66 | + } | ||
| 67 | + this.visible = true | ||
| 68 | + }, | ||
| 69 | + async getSmsTypes() { | ||
| 70 | + try { | ||
| 71 | + const data = await getDict('market_sms_key', 'sms_type') | ||
| 72 | + this.smsTypes = data | ||
| 73 | + } catch (error) { | ||
| 74 | + console.error('Failed to get sms types:', error) | ||
| 75 | + } | ||
| 76 | + }, | ||
| 77 | + handleSubmit() { | ||
| 78 | + this.$refs.form.validate(async valid => { | ||
| 79 | + if (!valid) return | ||
| 80 | + try { | ||
| 81 | + await updateMarketSms(this.form) | ||
| 82 | + this.$message.success(this.$t('marketSmsManage.message.editSuccess')) | ||
| 83 | + this.$emit('success') | ||
| 84 | + this.visible = false | ||
| 85 | + } catch (error) { | ||
| 86 | + this.$message.error(error.message || this.$t('marketSmsManage.message.editFailed')) | ||
| 87 | + } | ||
| 88 | + }) | ||
| 89 | + }, | ||
| 90 | + handleClose() { | ||
| 91 | + this.$refs.form.resetFields() | ||
| 92 | + this.form.smsTypeValues = [] | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | +} | ||
| 96 | +</script> | ||
| 0 | \ No newline at end of file | 97 | \ No newline at end of file |
src/i18n/index.js
| @@ -96,6 +96,7 @@ import { messages as storeOrderCartManageMessages } from '../views/mall/storeOrd | @@ -96,6 +96,7 @@ import { messages as storeOrderCartManageMessages } from '../views/mall/storeOrd | ||
| 96 | import { messages as storeOrderCartReturnMessages } from '../views/mall/storeOrderCartReturnLang' | 96 | import { messages as storeOrderCartReturnMessages } from '../views/mall/storeOrderCartReturnLang' |
| 97 | import { messages as userIntegralMessages } from '../views/mall/userIntegralLang' | 97 | import { messages as userIntegralMessages } from '../views/mall/userIntegralLang' |
| 98 | import { messages as integralDetailMessages } from '../views/mall/integralDetailLang' | 98 | import { messages as integralDetailMessages } from '../views/mall/integralDetailLang' |
| 99 | +import { messages as marketSmsManageMessages } from '../views/market/marketSmsManageLang' | ||
| 99 | 100 | ||
| 100 | Vue.use(VueI18n) | 101 | Vue.use(VueI18n) |
| 101 | 102 | ||
| @@ -196,6 +197,7 @@ const messages = { | @@ -196,6 +197,7 @@ const messages = { | ||
| 196 | ...storeOrderCartReturnMessages.en, | 197 | ...storeOrderCartReturnMessages.en, |
| 197 | ...userIntegralMessages.en, | 198 | ...userIntegralMessages.en, |
| 198 | ...integralDetailMessages.en, | 199 | ...integralDetailMessages.en, |
| 200 | + ...marketSmsManageMessages.en, | ||
| 199 | }, | 201 | }, |
| 200 | zh: { | 202 | zh: { |
| 201 | ...loginMessages.zh, | 203 | ...loginMessages.zh, |
| @@ -292,6 +294,7 @@ const messages = { | @@ -292,6 +294,7 @@ const messages = { | ||
| 292 | ...storeOrderCartReturnMessages.zh, | 294 | ...storeOrderCartReturnMessages.zh, |
| 293 | ...userIntegralMessages.zh, | 295 | ...userIntegralMessages.zh, |
| 294 | ...integralDetailMessages.zh, | 296 | ...integralDetailMessages.zh, |
| 297 | + ...marketSmsManageMessages.zh, | ||
| 295 | } | 298 | } |
| 296 | } | 299 | } |
| 297 | 300 |
src/router/index.js
| @@ -466,6 +466,11 @@ const routes = [ | @@ -466,6 +466,11 @@ const routes = [ | ||
| 466 | name: '/pages/admin/integralDetail', | 466 | name: '/pages/admin/integralDetail', |
| 467 | component: () => import('@/views/mall/integralDetailList.vue') | 467 | component: () => import('@/views/mall/integralDetailList.vue') |
| 468 | }, | 468 | }, |
| 469 | + { | ||
| 470 | + path:'/pages/admin/marketSmsManage', | ||
| 471 | + name:'/pages/admin/marketSmsManage', | ||
| 472 | + component: () => import('@/views/market/marketSmsManageList.vue') | ||
| 473 | + }, | ||
| 469 | // 其他子路由可以在这里添加 | 474 | // 其他子路由可以在这里添加 |
| 470 | ] | 475 | ] |
| 471 | }, | 476 | }, |
src/views/community/CommunityLang.js
| @@ -12,19 +12,6 @@ export const messages = { | @@ -12,19 +12,6 @@ export const messages = { | ||
| 12 | startTime: 'Start Time', | 12 | startTime: 'Start Time', |
| 13 | endTime: 'End Time', | 13 | endTime: 'End Time', |
| 14 | status: 'Status' | 14 | status: 'Status' |
| 15 | - }, | ||
| 16 | - common: { | ||
| 17 | - search: 'Search', | ||
| 18 | - reset: 'Reset', | ||
| 19 | - operation: 'Operation', | ||
| 20 | - edit: 'Edit', | ||
| 21 | - view: 'View', | ||
| 22 | - delete: 'Delete', | ||
| 23 | - confirm: 'Confirm', | ||
| 24 | - cancel: 'Cancel', | ||
| 25 | - warning: 'Warning', | ||
| 26 | - deleteConfirm: 'Are you sure to delete this record?', | ||
| 27 | - deleteSuccess: 'Delete successfully' | ||
| 28 | } | 15 | } |
| 29 | }, | 16 | }, |
| 30 | zh: { | 17 | zh: { |
| @@ -40,19 +27,6 @@ export const messages = { | @@ -40,19 +27,6 @@ export const messages = { | ||
| 40 | startTime: '开始时间', | 27 | startTime: '开始时间', |
| 41 | endTime: '结束时间', | 28 | endTime: '结束时间', |
| 42 | status: '状态' | 29 | status: '状态' |
| 43 | - }, | ||
| 44 | - common: { | ||
| 45 | - search: '搜索', | ||
| 46 | - reset: '重置', | ||
| 47 | - operation: '操作', | ||
| 48 | - edit: '编辑', | ||
| 49 | - view: '查看', | ||
| 50 | - delete: '删除', | ||
| 51 | - confirm: '确定', | ||
| 52 | - cancel: '取消', | ||
| 53 | - warning: '警告', | ||
| 54 | - deleteConfirm: '确定要删除这条记录吗?', | ||
| 55 | - deleteSuccess: '删除成功' | ||
| 56 | } | 30 | } |
| 57 | } | 31 | } |
| 58 | } | 32 | } |
| 59 | \ No newline at end of file | 33 | \ No newline at end of file |
src/views/mall/userIntegralLang.js
| @@ -22,10 +22,6 @@ export const messages = { | @@ -22,10 +22,6 @@ export const messages = { | ||
| 22 | merchant: 'Merchant' | 22 | merchant: 'Merchant' |
| 23 | }, | 23 | }, |
| 24 | fetchError: 'Failed to fetch points data' | 24 | fetchError: 'Failed to fetch points data' |
| 25 | - }, | ||
| 26 | - common: { | ||
| 27 | - search: 'Search', | ||
| 28 | - manage: 'Manage' | ||
| 29 | } | 25 | } |
| 30 | }, | 26 | }, |
| 31 | zh: { | 27 | zh: { |
| @@ -51,10 +47,6 @@ export const messages = { | @@ -51,10 +47,6 @@ export const messages = { | ||
| 51 | merchant: '商户' | 47 | merchant: '商户' |
| 52 | }, | 48 | }, |
| 53 | fetchError: '获取积分数据失败' | 49 | fetchError: '获取积分数据失败' |
| 54 | - }, | ||
| 55 | - common: { | ||
| 56 | - search: '查询', | ||
| 57 | - manage: '管理' | ||
| 58 | } | 50 | } |
| 59 | } | 51 | } |
| 60 | } | 52 | } |
| 61 | \ No newline at end of file | 53 | \ No newline at end of file |
src/views/market/marketSmsManageLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + marketSms: { | ||
| 4 | + search: { | ||
| 5 | + title: 'Search Conditions', | ||
| 6 | + smsName: 'Please enter name', | ||
| 7 | + smsType: 'Please select type' | ||
| 8 | + }, | ||
| 9 | + list: { | ||
| 10 | + title: 'Marketing Configuration' | ||
| 11 | + }, | ||
| 12 | + table: { | ||
| 13 | + smsId: 'ID', | ||
| 14 | + smsName: 'Name', | ||
| 15 | + smsType: 'Type', | ||
| 16 | + createTime: 'Create Time', | ||
| 17 | + remark: 'Remark' | ||
| 18 | + }, | ||
| 19 | + form: { | ||
| 20 | + smsName: 'Name', | ||
| 21 | + smsType: 'Type', | ||
| 22 | + remark: 'Remark' | ||
| 23 | + }, | ||
| 24 | + placeholder: { | ||
| 25 | + smsName: 'Please enter name', | ||
| 26 | + smsType: 'Please select type', | ||
| 27 | + remark: 'Please enter remark' | ||
| 28 | + }, | ||
| 29 | + validate: { | ||
| 30 | + smsName: 'Name is required', | ||
| 31 | + smsNameMax: 'Name cannot exceed 64 characters', | ||
| 32 | + smsType: 'Type is required', | ||
| 33 | + remark: 'Remark is required', | ||
| 34 | + remarkMax: 'Remark cannot exceed 512 characters', | ||
| 35 | + smsId: 'ID is required' | ||
| 36 | + }, | ||
| 37 | + add: { | ||
| 38 | + title: 'Add Marketing SMS', | ||
| 39 | + success: 'Add successful' | ||
| 40 | + }, | ||
| 41 | + edit: { | ||
| 42 | + title: 'Edit Marketing SMS', | ||
| 43 | + success: 'Edit successful' | ||
| 44 | + }, | ||
| 45 | + delete: { | ||
| 46 | + title: 'Delete Confirmation', | ||
| 47 | + confirm: 'Are you sure to delete this marketing SMS?', | ||
| 48 | + success: 'Delete successful' | ||
| 49 | + }, | ||
| 50 | + fetchError: 'Failed to fetch data' | ||
| 51 | + } | ||
| 52 | + }, | ||
| 53 | + zh: { | ||
| 54 | + marketSms: { | ||
| 55 | + search: { | ||
| 56 | + title: '查询条件', | ||
| 57 | + smsName: '请输入名称', | ||
| 58 | + smsType: '请选择类型' | ||
| 59 | + }, | ||
| 60 | + list: { | ||
| 61 | + title: '营销配置' | ||
| 62 | + }, | ||
| 63 | + table: { | ||
| 64 | + smsId: '编号', | ||
| 65 | + smsName: '名称', | ||
| 66 | + smsType: '设置类型', | ||
| 67 | + createTime: '创建时间', | ||
| 68 | + remark: '备注' | ||
| 69 | + }, | ||
| 70 | + form: { | ||
| 71 | + smsName: '名称', | ||
| 72 | + smsType: '设置类型', | ||
| 73 | + remark: '备注' | ||
| 74 | + }, | ||
| 75 | + placeholder: { | ||
| 76 | + smsName: '请输入名称', | ||
| 77 | + smsType: '请选择设置类型', | ||
| 78 | + remark: '请输入备注' | ||
| 79 | + }, | ||
| 80 | + validate: { | ||
| 81 | + smsName: '名称不能为空', | ||
| 82 | + smsNameMax: '名称不能超过64个字符', | ||
| 83 | + smsType: '设置类型不能为空', | ||
| 84 | + remark: '备注不能为空', | ||
| 85 | + remarkMax: '备注不能超过512个字符', | ||
| 86 | + smsId: '编号不能为空' | ||
| 87 | + }, | ||
| 88 | + add: { | ||
| 89 | + title: '添加营销短信', | ||
| 90 | + success: '添加成功' | ||
| 91 | + }, | ||
| 92 | + edit: { | ||
| 93 | + title: '修改营销短信', | ||
| 94 | + success: '修改成功' | ||
| 95 | + }, | ||
| 96 | + delete: { | ||
| 97 | + title: '删除确认', | ||
| 98 | + confirm: '确定删除该营销短信吗?', | ||
| 99 | + success: '删除成功' | ||
| 100 | + }, | ||
| 101 | + fetchError: '获取数据失败' | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | +} | ||
| 0 | \ No newline at end of file | 105 | \ No newline at end of file |
src/views/market/marketSmsManageList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="market-sms-container"> | ||
| 3 | + <!-- 查询条件 --> | ||
| 4 | + <el-card class="search-wrapper"> | ||
| 5 | + <div slot="header" class="clearfix text-left"> | ||
| 6 | + <span>{{ $t('marketSms.search.title') }}</span> | ||
| 7 | + </div> | ||
| 8 | + <el-row :gutter="20"> | ||
| 9 | + <el-col :span="4"> | ||
| 10 | + <el-input v-model="searchForm.smsName" :placeholder="$t('marketSms.search.smsName')" clearable /> | ||
| 11 | + </el-col> | ||
| 12 | + <el-col :span="4"> | ||
| 13 | + <el-select v-model="searchForm.smsType" :placeholder="$t('marketSms.search.smsType')" clearable> | ||
| 14 | + <el-option v-for="item in smsTypes" :key="item.statusCd" :label="item.name" :value="item.statusCd" /> | ||
| 15 | + </el-select> | ||
| 16 | + </el-col> | ||
| 17 | + <el-col :span="4"> | ||
| 18 | + <el-button type="primary" @click="handleSearch"> | ||
| 19 | + {{ $t('common.search') }} | ||
| 20 | + </el-button> | ||
| 21 | + </el-col> | ||
| 22 | + </el-row> | ||
| 23 | + </el-card> | ||
| 24 | + | ||
| 25 | + <!-- 列表 --> | ||
| 26 | + <el-card class="list-wrapper"> | ||
| 27 | + <div slot="header" class="clearfix text-left"> | ||
| 28 | + <span>{{ $t('marketSms.list.title') }}</span> | ||
| 29 | + <div style="float: right;"> | ||
| 30 | + <el-button type="primary" size="small" @click="handleAdd"> | ||
| 31 | + {{ $t('common.add') }} | ||
| 32 | + </el-button> | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | + | ||
| 36 | + <el-table v-loading="loading" :data="tableData" border style="width: 100%"> | ||
| 37 | + <el-table-column prop="smsId" :label="$t('marketSms.table.smsId')" align="center" /> | ||
| 38 | + <el-table-column prop="smsName" :label="$t('marketSms.table.smsName')" align="center" /> | ||
| 39 | + <el-table-column prop="smsType" :label="$t('marketSms.table.smsType')" align="center" /> | ||
| 40 | + <el-table-column prop="createTime" :label="$t('marketSms.table.createTime')" align="center" /> | ||
| 41 | + <el-table-column prop="remark" :label="$t('marketSms.table.remark')" align="center" /> | ||
| 42 | + <el-table-column :label="$t('common.operation')" align="center" width="200"> | ||
| 43 | + <template slot-scope="scope"> | ||
| 44 | + <el-button size="mini" type="primary" @click="handleEdit(scope.row)"> | ||
| 45 | + {{ $t('common.edit') }} | ||
| 46 | + </el-button> | ||
| 47 | + <el-button size="mini" type="danger" @click="handleDelete(scope.row)"> | ||
| 48 | + {{ $t('common.delete') }} | ||
| 49 | + </el-button> | ||
| 50 | + </template> | ||
| 51 | + </el-table-column> | ||
| 52 | + </el-table> | ||
| 53 | + | ||
| 54 | + <el-pagination :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | ||
| 55 | + :total="pagination.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" | ||
| 56 | + @current-change="handleCurrentChange" /> | ||
| 57 | + </el-card> | ||
| 58 | + | ||
| 59 | + <!-- 子组件 --> | ||
| 60 | + <add-market-sms ref="addMarketSms" @success="handleSuccess" /> | ||
| 61 | + <edit-market-sms ref="editMarketSms" @success="handleSuccess" /> | ||
| 62 | + <delete-market-sms ref="deleteMarketSms" @success="handleSuccess" /> | ||
| 63 | + </div> | ||
| 64 | +</template> | ||
| 65 | + | ||
| 66 | +<script> | ||
| 67 | +import { listMarketSms } from '@/api/market/marketSmsManageApi' | ||
| 68 | +import AddMarketSms from '@/components/market/AddMarketSms' | ||
| 69 | +import EditMarketSms from '@/components/market/EditMarketSms' | ||
| 70 | +import DeleteMarketSms from '@/components/market/DeleteMarketSms' | ||
| 71 | + | ||
| 72 | +export default { | ||
| 73 | + name: 'MarketSmsManageList', | ||
| 74 | + components: { | ||
| 75 | + AddMarketSms, | ||
| 76 | + EditMarketSms, | ||
| 77 | + DeleteMarketSms | ||
| 78 | + }, | ||
| 79 | + data() { | ||
| 80 | + return { | ||
| 81 | + loading: false, | ||
| 82 | + searchForm: { | ||
| 83 | + smsName: '', | ||
| 84 | + smsType: '' | ||
| 85 | + }, | ||
| 86 | + tableData: [], | ||
| 87 | + smsTypes: [], | ||
| 88 | + pagination: { | ||
| 89 | + current: 1, | ||
| 90 | + size: 10, | ||
| 91 | + total: 0 | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + }, | ||
| 95 | + created() { | ||
| 96 | + this.getList() | ||
| 97 | + this.getDictData() | ||
| 98 | + }, | ||
| 99 | + methods: { | ||
| 100 | + async getList() { | ||
| 101 | + try { | ||
| 102 | + this.loading = true | ||
| 103 | + const params = { | ||
| 104 | + page: this.pagination.current, | ||
| 105 | + row: this.pagination.size, | ||
| 106 | + ...this.searchForm | ||
| 107 | + } | ||
| 108 | + const { data, total } = await listMarketSms(params) | ||
| 109 | + this.tableData = data | ||
| 110 | + this.pagination.total = total | ||
| 111 | + } catch (error) { | ||
| 112 | + this.$message.error(this.$t('marketSms.fetchError')) | ||
| 113 | + } finally { | ||
| 114 | + this.loading = false | ||
| 115 | + } | ||
| 116 | + }, | ||
| 117 | + async getDictData() { | ||
| 118 | + try { | ||
| 119 | + const data = await this.$store.dispatch('dict/getDict', { | ||
| 120 | + dictType: 'market_sms_key', | ||
| 121 | + dictName: 'sms_type' | ||
| 122 | + }) | ||
| 123 | + this.smsTypes = data | ||
| 124 | + } catch (error) { | ||
| 125 | + console.error('获取字典数据失败:', error) | ||
| 126 | + } | ||
| 127 | + }, | ||
| 128 | + handleSearch() { | ||
| 129 | + this.pagination.current = 1 | ||
| 130 | + this.getList() | ||
| 131 | + }, | ||
| 132 | + handleAdd() { | ||
| 133 | + this.$refs.addMarketSms.open() | ||
| 134 | + }, | ||
| 135 | + handleEdit(row) { | ||
| 136 | + this.$refs.editMarketSms.open(row) | ||
| 137 | + }, | ||
| 138 | + handleDelete(row) { | ||
| 139 | + this.$refs.deleteMarketSms.open(row) | ||
| 140 | + }, | ||
| 141 | + handleSuccess() { | ||
| 142 | + this.getList() | ||
| 143 | + }, | ||
| 144 | + handleSizeChange(val) { | ||
| 145 | + this.pagination.size = val | ||
| 146 | + this.getList() | ||
| 147 | + }, | ||
| 148 | + handleCurrentChange(val) { | ||
| 149 | + this.pagination.current = val | ||
| 150 | + this.getList() | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | +} | ||
| 154 | +</script> | ||
| 155 | + | ||
| 156 | +<style lang="scss" scoped> | ||
| 157 | +.market-sms-container { | ||
| 158 | + padding: 20px; | ||
| 159 | + | ||
| 160 | + .search-wrapper { | ||
| 161 | + margin-bottom: 20px; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + .list-wrapper { | ||
| 165 | + margin-bottom: 20px; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + .el-pagination { | ||
| 169 | + margin-top: 20px; | ||
| 170 | + text-align: right; | ||
| 171 | + } | ||
| 172 | +} | ||
| 173 | +</style> | ||
| 0 | \ No newline at end of file | 174 | \ No newline at end of file |
src/views/project/menuLang.js
| @@ -19,16 +19,6 @@ export default { | @@ -19,16 +19,6 @@ export default { | ||
| 19 | createTime: 'Create Time' | 19 | createTime: 'Create Time' |
| 20 | } | 20 | } |
| 21 | }, | 21 | }, |
| 22 | - common: { | ||
| 23 | - add: 'Add', | ||
| 24 | - edit: 'Edit', | ||
| 25 | - delete: 'Delete', | ||
| 26 | - search: 'Search', | ||
| 27 | - operation: 'Operation', | ||
| 28 | - pagination: { | ||
| 29 | - layout: 'total, sizes, prev, pager, next, jumper' | ||
| 30 | - } | ||
| 31 | - } | ||
| 32 | }, | 22 | }, |
| 33 | zh: { | 23 | zh: { |
| 34 | menu: { | 24 | menu: { |
| @@ -50,15 +40,5 @@ export default { | @@ -50,15 +40,5 @@ export default { | ||
| 50 | createTime: '创建时间' | 40 | createTime: '创建时间' |
| 51 | } | 41 | } |
| 52 | }, | 42 | }, |
| 53 | - common: { | ||
| 54 | - add: '新增', | ||
| 55 | - edit: '编辑', | ||
| 56 | - delete: '删除', | ||
| 57 | - search: '查询', | ||
| 58 | - operation: '操作', | ||
| 59 | - pagination: { | ||
| 60 | - layout: 'total, sizes, prev, pager, next, jumper' | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | } | 43 | } |
| 64 | } | 44 | } |
| 65 | \ No newline at end of file | 45 | \ No newline at end of file |