|
|
@@ -3,7 +3,7 @@ import { reactive } from 'vue' |
|
|
import { View } from '@tarojs/components' |
|
|
import { View } from '@tarojs/components' |
|
|
|
|
|
|
|
|
import './index.scss' |
|
|
import './index.scss' |
|
|
import {weappAuth} from "../../utils"; |
|
|
|
|
|
|
|
|
import {Route, Session, weappAuth} from "../../utils"; |
|
|
import { |
|
|
import { |
|
|
GroupedContactPassRecords, |
|
|
GroupedContactPassRecords, |
|
|
useContactPassRecordsStore |
|
|
useContactPassRecordsStore |
|
|
@@ -11,100 +11,191 @@ import { |
|
|
import {Router} from "tarojs-router-next"; |
|
|
import {Router} from "tarojs-router-next"; |
|
|
import { BjxHelper } from "../../utils"; |
|
|
import { BjxHelper } from "../../utils"; |
|
|
import {ContactEditLog, useContactEditLogsStore} from "../../stores/contact-edit-logs"; |
|
|
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() |
|
|
const contactData = Router.getData() |
|
|
console.log("contactData", contactData) |
|
|
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 = () => { |
|
|
const goBack = () => { |
|
|
Router.back(undefined, { delta: 2 }) |
|
|
Router.back(undefined, { delta: 2 }) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<view class="h-100 d-flex flex-column"> |
|
|
<view class="h-100 d-flex flex-column"> |
|
|
<BackgroundBasic/> |
|
|
<BackgroundBasic/> |
|
|
<NutNavbar title=""></NutNavbar> |
|
|
<NutNavbar title=""></NutNavbar> |
|
|
<view class="p-3 d-flex"> |
|
|
|
|
|
|
|
|
<view class="pl-3 pr-3 pt-3 pb-0 d-flex"> |
|
|
<view class="flex-grow-1"> |
|
|
<view class="flex-grow-1"> |
|
|
<view class="h3"> |
|
|
<view class="h3"> |
|
|
<view class="fas fa-chevron-left text-primary" @tap="goBack()" hover-class="btn-hover-primary"/> |
|
|
<view class="fas fa-chevron-left text-primary" @tap="goBack()" hover-class="btn-hover-primary"/> |
|
|
发送短信 |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view class="text-black-50">此联系人的最近编辑记录</view> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view class="d-flex align-items-end"> |
|
|
<view class="d-flex align-items-end"> |
|
|
<View></View> |
|
|
<View></View> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<View v-if="state.isAuthError"> |
|
|
|
|
|
<nut-empty description="连接出现问题,请稍后重试"> |
|
|
|
|
|
<div style="margin-top: 10px"> |
|
|
|
|
|
<nut-button type="default" @tap="onAuthErrorRefresh">刷新</nut-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</nut-empty> |
|
|
|
|
|
|
|
|
<View class="d-flex flex-column" > |
|
|
|
|
|
<View class="d-flex justify-content-center"> |
|
|
|
|
|
<Image :src="require('./sms.png')" mode='heightFix' style="height: 30vh"/> |
|
|
|
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
<View class="scroll 100vh" v-else> |
|
|
|
|
|
<view class="scroll 100vh" v-if="!state.isPageDataLoading"> |
|
|
|
|
|
</view> |
|
|
|
|
|
<View v-else class="skeleton"> |
|
|
|
|
|
<NutSkeleton v-for="_ in 10" class="pl-4 pt-4 pb-4 pr-5" height="20px" width="60vw" animated avatar avatar-size="50px" row="2"/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<View class="card m-3 mt-5 shadow-lg"> |
|
|
|
|
|
<View class="card-body"> |
|
|
|
|
|
|
|
|
|
|
|
<nut-form> |
|
|
|
|
|
<nut-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<view class="d-flex"> |
|
|
|
|
|
<view class="mr-4"> |
|
|
|
|
|
<NutBadge :value="contact.contact.isVIP?'VIP':''"> |
|
|
|
|
|
<NutAvatar size="normal" color="white" :bg-color="BjxHelper.mbString2RgbHex(contact.contact.name)" class="overflow-hidden"> |
|
|
|
|
|
<img v-if="contact.contact.avatar" :src="contact.contact.avatar" /> |
|
|
|
|
|
<view v-else-if="BjxHelper.getBJXFirstChar(contact.contact.name)">{{BjxHelper.getBJXFirstChar(contact.contact.name)}}</view> |
|
|
|
|
|
<view v-else> |
|
|
|
|
|
<Text className='fas fa-user fa-lg'/> |
|
|
|
|
|
</view> |
|
|
|
|
|
</NutAvatar> |
|
|
|
|
|
</NutBadge> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="flex-grow-1"> |
|
|
|
|
|
<view class="d-flex flex-row"> |
|
|
|
|
|
<view v-if="contact.contact.name" class="name text-dark">{{contact.contact.name}}</view> |
|
|
|
|
|
<view v-else> |
|
|
|
|
|
<view class="text-black-50 name"> |
|
|
|
|
|
<Text className='text-info fas fa-exclamation-circle'/> 无姓名 |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="company text-black-50 small"> |
|
|
|
|
|
<view v-if="contact.contact.company">{{contact.contact.company}}</view> |
|
|
|
|
|
<view v-else> |
|
|
|
|
|
<Text className='text-info fas fa-exclamation-circle'/> 无公司信息 |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</nut-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<nut-form-item label="约定到访日期" v-show="!contact.contact.flexVisit"> |
|
|
|
|
|
<view class="d-flex calendar"> |
|
|
|
|
|
<view class="flex-grow-1"></view> |
|
|
|
|
|
<view class="text-dark" @tap="openSwitch('isDateSelectorVisible')"> |
|
|
|
|
|
{{contact.contact.nextVisitDate ? contact.contact.nextVisitDate : '请选择'}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</nut-form-item> |
|
|
|
|
|
|
|
|
|
|
|
</nut-form> |
|
|
|
|
|
|
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view v-if="state.isSmsSent" class="p-3 pb-5"> |
|
|
|
|
|
<nut-button block type="info" @tap="goBack">确认</nut-button> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view v-else class="p-3 pb-5"> |
|
|
|
|
|
<nut-button block type="info" @tap="onSmsSend">发送邀约短信</nut-button> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<nut-calendar |
|
|
|
|
|
v-model:visible="state.isDateSelectorVisible" |
|
|
|
|
|
@close="closeSwitch('isDateSelectorVisible')" |
|
|
|
|
|
@choose="setChooseDate" |
|
|
|
|
|
:default-value="contact.contact.nextVisitDate" |
|
|
|
|
|
:is-auto-back-fill="true" |
|
|
|
|
|
> |
|
|
|
|
|
</nut-calendar> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|