From 236b692608ff68cc1761fbcab0d22973a66f76b3 Mon Sep 17 00:00:00 2001 From: yuan Date: Thu, 11 Jan 2024 14:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E9=80=81=E9=82=80=E7=BA=A6=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/contact-edit/index.vue | 1 + src/pages/contact-new/index.vue | 2 +- src/pages/contact-send-invite-sms/index.scss | 4 + src/pages/contact-send-invite-sms/index.vue | 217 +++++++++++++------ src/pages/contact-send-invite-sms/sms.png | Bin 0 -> 294773 bytes src/stores/contact-visit-record.ts | 2 +- 6 files changed, 161 insertions(+), 65 deletions(-) create mode 100644 src/pages/contact-send-invite-sms/sms.png diff --git a/src/pages/contact-edit/index.vue b/src/pages/contact-edit/index.vue index 327b842..56b5cff 100644 --- a/src/pages/contact-edit/index.vue +++ b/src/pages/contact-edit/index.vue @@ -12,6 +12,7 @@ const contactData = Router.getData() const contact = useContactItemStore() const contacts = useContactsStore() const contactVisitRecord = useContactVisitRecordStore() +contactVisitRecord.reset() contact.setContact(contactData) const showDeleteConfirmMenu = ref(false) diff --git a/src/pages/contact-new/index.vue b/src/pages/contact-new/index.vue index 62e6787..2e1943d 100644 --- a/src/pages/contact-new/index.vue +++ b/src/pages/contact-new/index.vue @@ -15,7 +15,7 @@ contact.setContact(contact.getEmptyContactData()) const contacts = useContactsStore() const contactVisitRecord = useContactVisitRecordStore() - +contactVisitRecord.reset() const onSaveClicked = (isSmsSend: boolean) => { Taro.showLoading({ diff --git a/src/pages/contact-send-invite-sms/index.scss b/src/pages/contact-send-invite-sms/index.scss index b41e6ef..6352a24 100644 --- a/src/pages/contact-send-invite-sms/index.scss +++ b/src/pages/contact-send-invite-sms/index.scss @@ -18,3 +18,7 @@ page { .nut-action-sheet__item { color: red !important; } + +.nut-cell-group__wrap { + box-shadow: unset; +} diff --git a/src/pages/contact-send-invite-sms/index.vue b/src/pages/contact-send-invite-sms/index.vue index 5e7a2df..e2ccc30 100644 --- a/src/pages/contact-send-invite-sms/index.vue +++ b/src/pages/contact-send-invite-sms/index.vue @@ -3,7 +3,7 @@ import { reactive } from 'vue' import { View } from '@tarojs/components' import './index.scss' -import {weappAuth} from "../../utils"; +import {Route, Session, weappAuth} from "../../utils"; import { GroupedContactPassRecords, useContactPassRecordsStore @@ -11,100 +11,191 @@ import { import {Router} from "tarojs-router-next"; import { BjxHelper } from "../../utils"; import {ContactEditLog, useContactEditLogsStore} from "../../stores/contact-edit-logs"; +import {useContactItemStore} from "../../stores/contact-item"; +import {useContactVisitRecordStore} from "../../stores/contact-visit-record"; +import Taro from "@tarojs/taro"; const contactData = Router.getData() console.log("contactData", contactData) -const state = reactive<{ - isPageDataLoading: boolean, - isAuthError: boolean, - contactEditLogs: ContactEditLog[], -}>({ - isPageDataLoading: true, - isAuthError: false, - contactEditLogs: [], -}) -const editLogs = useContactEditLogsStore() - -init() - -function init() { - state.isAuthError = false - state.isPageDataLoading = true - console.log("contactData", contactData) - weappAuth().then(r => { - console.log(r) - editLogs.loadContactEditLogsFromServer(contactData.id).then( editLogs => { - state.isPageDataLoading = false - state.contactEditLogs = editLogs - // console.log(state.groupedPassRecords) - }) - .catch(error => { - console.log("error", error) - state.isAuthError = true - state.isPageDataLoading = false - }) - }).catch(e => { - console.log("error", e) - state.isAuthError = true - state.isPageDataLoading = false - }) -} +const contact = useContactItemStore() +const contactVisitRecord = useContactVisitRecordStore() + +const state = reactive({ + isDateSelectorVisible: false, + isSmsSent: false +}); -const onAuthErrorRefresh = () => { - init() -} -// const onPullDownRefresh = () => { -// console.log("onPullDownRefresh") -// state.isRefresherTriggered = false -// } -function onPullDownRefresh (e) { - console.log("onPullDownRefresh", e) - // state.isRefresherTriggered = false -} const goBack = () => { Router.back(undefined, { delta: 2 }) } - +const openSwitch = (param) => { + state[`${param}`] = true; +}; +const closeSwitch = (param) => { + state[`${param}`] = false; +} +const setChooseDate = (param) => { + Taro.showLoading({ + title: 'loading', + }) + + contact.contact.nextVisitDate = param[3] + + if (contact.contact.nextVisitDate !== "") { + contactVisitRecord.save(contact.contact.id, contact.contact.nextVisitDate).then( visitRecordResult => { + console.log("save contactVisitRecord DONE") + Taro.hideLoading() + }) + } + else { + Taro.hideLoading() + } +} +const onSmsSend = () => { + console.log(contactVisitRecord.visitRecord) + if (contactVisitRecord.visitRecord == null){ + Taro.showToast({ + title: '请选择邀请到访的日期', + icon: 'none', + duration: 2000}) + } + else { + Taro.request({ + method: 'GET', + url: SERVER_URL + '/system/visitor/sms/send-sms', + header: { + Authorization: 'Bearer ' + Session.get('access_token'), + }, + data: { + visitRecordId: contactVisitRecord.visitRecord.id, + staffId: Session.get("staff").id + }, + success: result => { + if (result.statusCode === 200 && result.data.code === 200) { + Taro.showToast({ + title: '发送成功', + icon: 'success', + duration: 2000 + }) + } else { + Taro.showToast({ + title: '网络错误', + icon: 'error', + duration: 2000 + }) + } + }, + fail: res => { + console.log(res); + } + }) + } +} +