Commit 8248bf21 authored by weishengfei's avatar weishengfei

feat(obstetric): 产检详情页面增加微信订阅消息功能

- 在产检详情页面添加微信订阅消息功能
- 新增 getWxNotification 接口用于保存订阅消息
- 优化提醒选择器,使用对象数组替代字符串数组
- 修复完成检查时检查日期的判断逻辑
parent d674968d
......@@ -59,3 +59,9 @@ export const getAdd = (data) => api.post('/c/maternityCheckup/add',data);
*/
export const getReportList = () => api.get('/c/maternityCheckup/reportList');
/**
* 保存订阅消息
* @returns
*/
export const getWxNotification = (data) => api.post('/c/wxNotification/save',data);
\ No newline at end of file
......@@ -127,7 +127,7 @@
:class="{'item-active': pickerValue === index}"
@click="handleChange(index)"
>
{{ item }}
{{ item.name }}
</view>
</view>
......@@ -167,14 +167,28 @@ import DatePicker from '@/components/DatePicker.vue'
import { uploadImage } from '../../api/common.js'
import {
getDetail,
getUpdate
getUpdate,
getWxNotification
} from '../../api/obstetric.js';
// 提醒选择器相关状态
const showPicker = ref(false)
const options = ['当天', '前一天', '前三天'] // 提醒时间选项
const options = [
{
name: '当天',
id: 0
},
{
name: '前一天',
id: 1
},
{
name: '前三天',
id: 3
}
] // 提醒时间选项
const pickerValue = ref(0) // 当前选中的索引
const selectedValue = ref('') // 选中的值
const selectedValue = ref(0) // 选中的值
const tabInfo = [{
"line1": "产检须知",
......@@ -401,13 +415,14 @@ const handleChange = (e) => {
}
// 确认选择
const handleConfirm = () => {
selectedValue.value = options[pickerValue.value];
selectedValue.value = options[pickerValue.value].id;
close();
// 订阅提醒
uni.requestSubscribeMessage({
tmplIds: [infoData.wxTemplateId],
success(res) {
console.log(res)
getWxNotificationFn(selectedValue.value, infoData.wxTemplateId, infoData.value.id)
},
fail(res) {
console.log(res)
......@@ -415,9 +430,31 @@ const handleConfirm = () => {
})
}
// 保存订阅消息
const getWxNotificationFn = async (notificationTimeType, wxTemplateId, examinationRecordId)=>{
const params = {
type: 1,
notificationTimeType,
wxTemplateId,
examinationRecordId,
}
const { code, message, data, success } = await getWxNotification(params)
if(success){
uni.showToast({
title: '保存成功',
icon: 'success',
duration: 2000
})
} else {
uni.showToast({
title: message,
icon: 'none'
})
}
}
// 完成检查
const onComplete = () => {
if(infoData.checkupDate == ''){
if(infoData.value.checkupDate == ''){
uni.showToast({
title: '请选择产检日期',
icon: 'none',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment