|
@@ -0,0 +1,177 @@
|
|
|
+<template>
|
|
|
+ <div class="flex flex-col justify-between w-full sm:flex-row">
|
|
|
+ <div class="w-full">
|
|
|
+ <Search :search="search" :reset="reset">
|
|
|
+ <template v-slot:body>
|
|
|
+ <el-form-item label="公众号">
|
|
|
+ <el-select v-model="query.gzh_id" filterable remote clearable
|
|
|
+ :remote-method="(query) => { remoteMethod(query, 'wechatPlatformOfficialAccountList') }">
|
|
|
+ <el-option v-for="item in officialAccountsList" :key="item.id" :label="item.nick_name" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:content>
|
|
|
+ <div class="table-default">
|
|
|
+ <div class="pt-5 pl-2">
|
|
|
+ <el-button type="primary" v-action="'wechatPlatform.KFMessage.add'" size="default"
|
|
|
+ @click="openType('createVisible', null)">新增</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="tableData" class="mt-3" v-loading="loading">
|
|
|
+ <el-table-column prop="name" label="配置公众号" min-width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="flex flex-col">
|
|
|
+ <div>
|
|
|
+ {{ scope.row.gzh_names }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="send_at" label="关注类型" min-width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.send_at }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="send_at" label="弹窗类型" min-width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.send_at }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="send_at" label="创建时间" min-width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.send_at }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="200" fixed="right">
|
|
|
+ <template #default="scope">
|
|
|
+ <div v-if="![4, 2].includes(scope.row.status)" v-action="'wechatPlatform.KFMessage.updateContent'">
|
|
|
+ <el-button link type="primary" size="small"
|
|
|
+ @click="openType('createVisible', scope.row)">编辑</el-button>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-button link type="primary" size="small" v-action="'wechatPlatform.KFMessage.detail'"
|
|
|
+ @click="openType('createVisible', { look: true, ...scope.row })">查看</el-button>
|
|
|
+ </div>
|
|
|
+ <div v-if="scope.row.status != 2" v-action="'wechatPlatform.KFMessage.delete'">
|
|
|
+ <el-button link type="primary" size="small" @click="deleteChange(scope.row)">删除</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <Paginate />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </Search>
|
|
|
+ <Dialog v-model="createVisible" :title="createTitle" destroy-on-close>
|
|
|
+ <Create @close="closeType('createVisible')" :primary="current" />
|
|
|
+ </Dialog>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { InfoFilled } from '@element-plus/icons-vue';
|
|
|
+import { shortcuts } from '@/utils/shortcuts'
|
|
|
+import { optionsCommonParams } from '@/api/common/index'
|
|
|
+import Create from './form/create.vue';
|
|
|
+import { useGetList } from '@/hook/curd/useGetList';
|
|
|
+import { wechatPlatformOfficialAccountList } from '@/api/officialAccount/officialList/index'
|
|
|
+import { wechatPlatformKfMessageStop, wechatPlatformKfMessageDelete, wechatPlatformKfMessageUpdateGZH } from '@/api/officialAccount/newsService/index'
|
|
|
+const api = 'wechatPlatform/kfMessage/list';
|
|
|
+const createVisible = ref(false)
|
|
|
+const current = ref<object | null>({})
|
|
|
+const messageTypeList = ref([])
|
|
|
+const sendStateList = ref([])
|
|
|
+const officialAccountsList = ref([])
|
|
|
+const createTitle = ref('新增')
|
|
|
+const { data, query, search, reset, loading } = useGetList(api);
|
|
|
+const rolesIdentify = inject('rolesIdentify')
|
|
|
+const tableData = computed(() => data.value?.data);
|
|
|
+
|
|
|
+const openType = (type: string, data: object | null) => {
|
|
|
+ current.value = data;
|
|
|
+ switch (type) {
|
|
|
+ case 'createVisible':
|
|
|
+ createVisible.value = true
|
|
|
+ if (current.value?.id) {
|
|
|
+ createTitle.value = '编辑'
|
|
|
+ if (current.value.look) {
|
|
|
+ createTitle.value = "查看"
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ createTitle.value = '新增'
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const initCommonParams = () => {
|
|
|
+ optionsCommonParams().then(res => {
|
|
|
+ console.log(res, 'optionsCommonParams');
|
|
|
+ messageTypeList.value = res?.data?.wechatPlatform?.kfMessageType
|
|
|
+ sendStateList.value = res?.data?.wechatPlatform?.kfMessageStatus
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const closeType = (type: string) => {
|
|
|
+ switch (type) {
|
|
|
+ case 'createVisible':
|
|
|
+ createVisible.value = false
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ search()
|
|
|
+}
|
|
|
+
|
|
|
+const deleteChange = (row: object) => {
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ `确定要删除活动:${row.name} 吗?`,
|
|
|
+ '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ wechatPlatformKfMessageDelete({ ids: [row.id] }).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ ElMessage.success(res.message)
|
|
|
+ search()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+
|
|
|
+ })
|
|
|
+}
|
|
|
+const remoteMethod = (query: string, type: string,) => {
|
|
|
+ console.log(query, 'queryquery', type);
|
|
|
+ switch (type) {
|
|
|
+ case 'wechatPlatformOfficialAccountList':
|
|
|
+ initRemoteOption('wechatPlatformOfficialAccountList', { nick_name: query })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const initRemoteOption = (type: string, params?: object) => {
|
|
|
+ switch (type) {
|
|
|
+ case 'wechatPlatformOfficialAccountList':
|
|
|
+ wechatPlatformOfficialAccountList({ limit: 99, ...params }).then(res => {
|
|
|
+ officialAccountsList.value = res.data
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ initCommonParams()
|
|
|
+ initRemoteOption('wechatPlatformOfficialAccountList')
|
|
|
+ search();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.withdraw-popup-warn {
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #666;
|
|
|
+}
|
|
|
+</style>
|