|
@@ -172,8 +172,15 @@ import {onMounted, reactive, ref} from "vue";
|
|
|
import {submitInpatientSatisfiedAssessment} from '../../../api/assessments'
|
|
|
import {showToast} from "vant";
|
|
|
import {useRouter} from "vue-router";
|
|
|
+import {receiveAssessmentGift} from "../../../api/coupon";
|
|
|
|
|
|
const router = useRouter()
|
|
|
+
|
|
|
+const routerValue = router.currentRoute.value
|
|
|
+const routerParams = routerValue.params.visitId
|
|
|
+const couponGift = routerValue.path.indexOf('inpatientSatisfiedByPush') > -1
|
|
|
+ && routerParams.indexOf('AND') > -1
|
|
|
+
|
|
|
const answer = reactive({
|
|
|
inpatientNo: null,
|
|
|
times: null,
|
|
@@ -284,13 +291,30 @@ const submitAnswer = () => {
|
|
|
}
|
|
|
submitInpatientSatisfiedAssessment(answer).then(() => {
|
|
|
disableSubmitButton.value = true
|
|
|
- router.push({
|
|
|
- name: 'resultSuccess',
|
|
|
- params: {
|
|
|
- title: '提交成功',
|
|
|
- subtitle: '感谢您的评价,您的意见对我们非常重要。',
|
|
|
- },
|
|
|
- })
|
|
|
+ if (couponGift) {
|
|
|
+ receiveAssessmentGift(routerParams).then((res) => {
|
|
|
+ showToast({
|
|
|
+ message: res,
|
|
|
+ position: 'top',
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ gotoResult()
|
|
|
+ }).catch(() => {
|
|
|
+ gotoResult()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ gotoResult()
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const gotoResult = () => {
|
|
|
+ router.push({
|
|
|
+ name: 'resultSuccess',
|
|
|
+ params: {
|
|
|
+ title: '提交成功',
|
|
|
+ subtitle: '感谢您的评价,您的意见对我们非常重要。',
|
|
|
+ },
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -372,12 +396,11 @@ function getOptions(key) {
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- let visitId = router.currentRoute.value.params.visitId
|
|
|
- let visitIdArr = visitId.split('AND')
|
|
|
+ let visitIdArr = routerParams.split('AND')
|
|
|
if (visitIdArr.length < 3) {
|
|
|
answer.inpatientNo = 'unknown'
|
|
|
answer.times = 0
|
|
|
- answer.patientId = visitId
|
|
|
+ answer.patientId = routerParams
|
|
|
} else {
|
|
|
answer.inpatientNo = visitIdArr[0]
|
|
|
answer.times = visitIdArr[1]
|