This commit is contained in:
yyx 2025-07-11 19:04:16 +08:00
parent 5818568014
commit 8df649c8ee
5 changed files with 89 additions and 31 deletions

View File

@ -52,7 +52,7 @@
</van-form> </van-form>
<div class="footer"> <div class="footer">
<van-button type="primary" class="footer-button" @click="onSubmit">提交</van-button> <van-button type="primary" v-if="!isView" class="footer-button" @click="onSubmit">提交</van-button>
</div> </div>
<Pay v-model:showDialog="showPayCodeDialog" v-model:current_order="current_order" <Pay v-model:showDialog="showPayCodeDialog" v-model:current_order="current_order"
@ -99,6 +99,7 @@ let task_title = ref("添加任务")
let template_info = {} let template_info = {}
let group_info = {} let group_info = {}
const isEdit = ref(false) const isEdit = ref(false)
const isView = ref(false)
const onClickLeft = () => { const onClickLeft = () => {
router.back() router.back()
} }
@ -107,10 +108,11 @@ const onConfirm = ({ selectedOptions }) => {
form.template = selectedOptions[0]?.text; form.template = selectedOptions[0]?.text;
form.temp_id = selectedOptions[0]?.value; form.temp_id = selectedOptions[0]?.value;
showPicker.value = false; showPicker.value = false;
let template = template_info.find(item => item.id == selectedOptions[0]?.value) let template = template_info?.find(item => item?.id == selectedOptions[0]?.value)
console.log(template); console.log(template);
let group_id = JSON.parse(template?.group_ids) if (template) {
let group_id = template?.group_ids ? JSON.parse(template?.group_ids) : []
form.times = template?.times + '小时1次' form.times = template?.times + '小时1次'
form.cycle = template?.cycle + '天' form.cycle = template?.cycle + '天'
form.price = template?.price form.price = template?.price
@ -118,6 +120,8 @@ const onConfirm = ({ selectedOptions }) => {
return group_info.find(item => item.id == id).tg_name + '@' + group_info.find(item => item.id == id).tg_url return group_info.find(item => item.id == id).tg_name + '@' + group_info.find(item => item.id == id).tg_url
}) })
form.group = filter_groups.join(','); form.group = filter_groups.join(',');
}
}; };
const onTypeConfirm = ({ selectedOptions }) => { const onTypeConfirm = ({ selectedOptions }) => {
@ -227,6 +231,13 @@ onBeforeMount(async () => {
form.next_run_time = current_task_info.next_run_time form.next_run_time = current_task_info.next_run_time
form.tg_title = current_task_info.tg_title form.tg_title = current_task_info.tg_title
isEdit.value = true isEdit.value = true
isView.value = current_task_info.type == 'view'
if (current_task_info.type == 'view') {
task_title.value = '查看任务'
}
if (current_task_info.type == 'edit') {
task_title.value = '编辑任务'
}
} }
}) })
@ -244,6 +255,9 @@ const handleConfrimPay = (val = '', type) => {
const closePay = () => { const closePay = () => {
router.push('/h5') router.push('/h5')
} }
const goBack = () => {
router.push('/h5')
}
onMounted(() => { onMounted(() => {
}) })

View File

@ -4,6 +4,7 @@
<van-search v-model="search" placeholder="请输入任务名称进行搜索" @search="onSearch" @clear="onSearch" /> <van-search v-model="search" placeholder="请输入任务名称进行搜索" @search="onSearch" @clear="onSearch" />
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<div v-for="item in list" :key="item.id" class="item"> <div v-for="item in list" :key="item.id" class="item">
<div>任务ID{{ item.id }}</div>
<div>任务名称{{ item.title }}</div> <div>任务名称{{ item.title }}</div>
<div>模板名称{{ item.temp_name }}</div> <div>模板名称{{ item.temp_name }}</div>
<div>模板类型{{ item.temp_type === 1 ? '预设模板' : '定制模板' }}</div> <div>模板类型{{ item.temp_type === 1 ? '预设模板' : '定制模板' }}</div>
@ -44,12 +45,19 @@
<van-tag type="success" v-if="item.order_status == 2 || item.order_status == 5"> <van-tag type="success" v-if="item.order_status == 2 || item.order_status == 5">
{{order_status?.find(o => o.value == item.order_status)?.label}}</van-tag> {{order_status?.find(o => o.value == item.order_status)?.label}}</van-tag>
</div> </div>
<div class="buttons-groups">
<div>
<van-button type="primary" size="small" @click="viewRecord(item)">群发记录</van-button>
</div>
<div class="item-btns"> <div class="item-btns">
<van-button type="primary"
v-if="item.status == 0 || item.status == 1 || item.status == 3 || item.status == 5" size="small"
style="margin-left: 12px;" @click="addTask(item)">编辑</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;" <van-button type="primary" size="small" style="margin-left: 12px;"
v-if="item.order_status == 0 || item.order_status == 8" @click="payTask(item)">支付</van-button> @click="addTask(item, 'view')">查看</van-button>
<van-button type="primary"
v-if="item.status == 0 || item.status == 1 || item.status == 3 || item.status == 5"
size="small" style="margin-left: 12px;" @click="addTask(item, 'edit')">编辑</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;"
v-if="item.order_status == 0 || item.order_status == 8"
@click="payTask(item)">支付</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;" v-if="item.status == 5" <van-button type="primary" size="small" style="margin-left: 12px;" v-if="item.status == 5"
@click="handleTask(item.id, '2')">执行</van-button> @click="handleTask(item.id, '2')">执行</van-button>
<van-button type="primary" size="small" v-if="item.status == 2" style="margin-left: 12px;" <van-button type="primary" size="small" v-if="item.status == 2" style="margin-left: 12px;"
@ -58,9 +66,11 @@
v-if="item.status == 6 || item.status == 0" @click="deleteTask(item.id)">删除</van-button> v-if="item.status == 6 || item.status == 0" @click="deleteTask(item.id)">删除</van-button>
</div> </div>
</div> </div>
</div>
</van-list> </van-list>
<div class="footer"> <div class="footer">
<van-button type="primary" size="small" class="footer-button" @click="addTask('')">创建任务</van-button> <van-button type="primary" size="small" class="footer-button" @click="addTask('', '')">创建任务</van-button>
</div> </div>
<Pay v-model:showDialog="showPayCodeDialog" v-model:current_order="current_order" <Pay v-model:showDialog="showPayCodeDialog" v-model:current_order="current_order"
@handleConfrimPay="handleConfrimPay"></Pay> @handleConfrimPay="handleConfrimPay"></Pay>
@ -180,9 +190,10 @@ const goPage = (url) => {
console.log('goPage', url) console.log('goPage', url)
window.open(url) window.open(url)
} }
const addTask = (row = '') => { const addTask = (row = '', type = '') => {
console.log('addTask', row) console.log('addTask', row)
if (row.id) { if (row.id) {
row.type = type
localStorage.setItem('current_task_info', JSON.stringify(row)) localStorage.setItem('current_task_info', JSON.stringify(row))
} else { } else {
localStorage.removeItem('current_task_info') localStorage.removeItem('current_task_info')
@ -249,6 +260,12 @@ const deleteTask = (id) => {
}); });
} }
const viewRecord = (row) => {
localStorage.setItem('current_task_id', row.id)
router.push({
path: '/h5/mass_send',
})
}
</script> </script>
<style lang="scss"> <style lang="scss">
@ -263,11 +280,16 @@ const deleteTask = (id) => {
border-radius: 24px; border-radius: 24px;
padding: 12px; padding: 12px;
.buttons-groups {
display: flex;
justify-content: space-between;
margin-top: 8px;
}
.item-btns { .item-btns {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: flex-end; justify-content: flex-end;
margin-top: 8px;
} }
} }

View File

@ -54,6 +54,7 @@ const editUserInfo = () => {
router.push('/h5/detail') router.push('/h5/detail')
} }
const goPage = (url) => { const goPage = (url) => {
localStorage.setItem('current_task_id', '')
router.push(url) router.push(url)
} }
</script> </script>

View File

@ -10,8 +10,13 @@
1 ? '成功' : '失败' 1 ? '成功' : '失败'
}}</van-tag></div> }}</van-tag></div>
<div><span>发送时间</span>{{ dayjs(item.updated_at).format('YYYY-MM-DD HH:mm:ss') }}</div> <div><span>发送时间</span>{{ dayjs(item.updated_at).format('YYYY-MM-DD HH:mm:ss') }}</div>
<div><span>发送群组</span>{{ item.group_name }}</div> <div v-if="item.group_id" @click="goPage(groupsList.find(g => g.id ==
<div @click="goPage(item.send_url)"><span>发送链接</span>{{ item.send_url }}</div> item.group_id).tg_url)"><span>发送群组:</span><a target="_blank" href="#">{{groupsList.find(g => g.id
==
item.group_id).tg_url}}</a></div>
<div @click="goPage(getMessageUrl(item))"><span>发送链接</span> <a style="color: #1989fa;" target="_blank"
href="#">{{
getMessageUrl(item) }}</a></div>
<div><span>失败原因</span> {{ showReason(item.reason) }}</div> <div><span>失败原因</span> {{ showReason(item.reason) }}</div>
@ -20,9 +25,9 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, onBeforeMount } from 'vue'; import { ref, onBeforeMount, onMounted } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { getMassSend } from '@/axios/request'; import { getMassSend, getGroupsList } from '@/axios/request';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
const router = useRouter(); const router = useRouter();
@ -42,6 +47,7 @@ const onLoad = async () => {
}) })
console.log('list', res) console.log('list', res)
if (currentPage == 1) { if (currentPage == 1) {
list.value = []
list.value = res.data list.value = res.data
} else { } else {
list.value = list.value.concat(res.data) list.value = list.value.concat(res.data)
@ -57,6 +63,21 @@ const onSearch = () => {
currentPage = 1 currentPage = 1
onLoad() onLoad()
} }
const groupsList = ref([])
onBeforeMount(async () => {
})
onMounted(async () => {
search.value = localStorage.getItem('current_task_id')
groupsList.value = await getGroupsList({ pagination: 'off' })
console.log('groupList', groupsList.value)
})
const getMessageUrl = (row) => {
let message_id = row?.tg_message_id;
let chat_id = row?.chat_id;
return `https://t.me/c/${chat_id}/${message_id}`
};
const goPage = (url) => { const goPage = (url) => {

View File

@ -23,7 +23,7 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.2.79', target: 'http://128.1.34.17:8080',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api'), rewrite: (path) => path.replace(/^\/api/, '/api'),
}, },