Quellcode durchsuchen

指定项目的优惠券和查看检查报告图片

lighter vor 1 Jahr
Ursprung
Commit
b758247b1b

+ 3 - 3
src/api/coupon.js

@@ -17,10 +17,10 @@ export function receiveSalesmanCoupon(key) {
 }
 
 
-export function getMyCoupons(hisOrdNum) {
+export function getMyCoupons(data) {
     return request({
         url: '/coupon/getMyCoupons',
-        method: 'get',
-        params: { hisOrdNum }
+        method: 'post',
+        data
     })
 }

+ 26 - 1
src/utils/request.js

@@ -2,8 +2,9 @@ import axios from 'axios'
 import {showDialog, showToast} from 'vant'
 import store from '../store/index'
 
+const baseURL = import.meta.env.VITE_BASE_URL
 const service = axios.create({
-    baseURL: import.meta.env.VITE_BASE_URL,
+    baseURL: baseURL,
     withCredentials: true,
     timeout: 0,
 })
@@ -58,3 +59,27 @@ service.interceptors.response.use(
 )
 
 export default service
+
+export function fetchInspectionReportImage(data) {
+    store.commit('SET_LOADING', true);
+    return new Promise((resolve, reject) => {
+        axios({
+            url: baseURL + '/inspections/fetchReportImage',
+            method: 'post',
+            data: data,
+            headers: {'token': localStorage.getItem('token')},
+            contentType: 'image/JPEG',
+            responseType: 'blob',
+        }).then(response => {
+            const blob = new Blob(
+                [response.data],
+                {type: response.headers['content-type']}
+            );
+            resolve(URL.createObjectURL(blob))
+        }).catch(() => {
+            reject("请求失败,请稍后再试。");
+        }).finally(() => {
+            store.commit('SET_LOADING', false);
+        })
+    })
+}

+ 6 - 15
src/views/hospital-service/check-exam/pathology/CheckPathologyDetail.vue

@@ -8,28 +8,19 @@
 import {useStore} from "vuex";
 import {onMounted, ref} from "vue";
 import router from "../../../../router";
-import axios from "axios";
-const baseURL = import.meta.env.VITE_BASE_URL
+import {fetchInspectionReportImage} from "../../../../utils/request";
 
 const store = useStore()
 const pathologyIndex = store.getters.getCurrentPathologyIndex
 const imageSrc = ref(null)
 
 onMounted(() => {
-  axios({
-    url: baseURL + '/inspections/checkPathologyDetail',
-    method: 'post',
-    data: {
-      patientId: router.currentRoute.value.params.patientId,
-      reportId: pathologyIndex.reportUrl
-    },
-    headers: {'token': localStorage.getItem('token')},
-    contentType: 'image/JPEG',
-    responseType: 'blob',
+  fetchInspectionReportImage({
+    patientId: router.currentRoute.value.params.patientId,
+    reportId: pathologyIndex.reportId,
+    reportUrl: pathologyIndex.reportUrl
   }).then(response => {
-    const blob = new Blob([response.data],
-        { type: response.headers['content-type'] });
-    imageSrc.value = URL.createObjectURL(blob);
+    imageSrc.value = response
   })
 })
 </script>

+ 40 - 0
src/views/hospital-service/check-exam/test/CheckTestDetail.vue

@@ -5,6 +5,12 @@
     <van-cell title="送检医生" :value="testResult.doctorName"></van-cell>
     <van-cell title="报告时间" :value="testResult.checkTime"></van-cell>
     <van-cell title="报告单号" :value="testResult.patientUid"></van-cell>
+    <van-cell
+        v-if="testResult.reportUrl"
+        title="报告图片"
+        is-link
+        @click="seeTestImage"
+    ></van-cell>
     <div style="height: 5px"></div>
     <van-tag type="primary" plain style="margin-left: 8px">检查所见</van-tag>
     <div class="test-result-text">
@@ -15,6 +21,17 @@
     <div class="test-result-text">
       <p v-html="testResult.examinationreSult"></p>
     </div>
+
+    <van-popup
+        v-model:show="showTestImage"
+        closeable
+        position="bottom"
+        close-icon="close"
+        :style="{ height: '100%' }"
+    >
+      <van-image width="100%" :src="imageSrc" fit="cover"/>
+    </van-popup>
+
   </window-size>
 </template>
 
@@ -22,11 +39,25 @@
 import { useRouter } from 'vue-router'
 import { checkTestDetail } from '../../../../api/check-exam'
 import { onMounted, ref} from 'vue'
+import {fetchInspectionReportImage} from "../../../../utils/request";
 
 const router = useRouter()
 
 const testResult = ref({})
 
+const showTestImage = ref(false)
+const imageSrc = ref(null)
+function seeTestImage() {
+  fetchInspectionReportImage({
+    patientId: router.currentRoute.value.params.patientId,
+    reportId: testResult.value.patientUid,
+    reportUrl: testResult.value.reportUrl,
+  }).then(response => {
+    showTestImage.value = true
+    imageSrc.value = response
+  })
+}
+
 onMounted(() => {
   const params = router.currentRoute.value.params
   checkTestDetail(params).then((res) => {
@@ -41,4 +72,13 @@ onMounted(() => {
   color: black;
   padding: 4px 20px;
 }
+
+.test-img-wrapper {
+  position: absolute;
+  top: 0;
+  left: 0;
+  bottom: 0;
+  right: 0;
+  background-color: green;
+}
 </style>

+ 6 - 1
src/views/hospital-service/pay-mz-fee/UnPaidList.vue

@@ -2,7 +2,12 @@
   <window-size>
     <van-empty :image="empty" description="您没有待缴费记录" v-if="showEmpty"></van-empty>
     <div v-for="item in unpaidFees" :key="item.hisOrdNum">
-      <van-cell :title="makeTitle(item)" :label="item.priceTime" is-link center @click="onClickFeeItem(item)">
+      <van-cell
+          :title="makeTitle(item)"
+          :label="item.priceTime"
+          is-link
+          center
+          @click="onClickFeeItem(item)">
         <template #default>
           <span style="color: orangered">{{ makeMoney(item.totalAmt) }}</span>
         </template>

+ 3 - 3
src/views/mine/my-coupons/MyCoupons.vue

@@ -35,13 +35,13 @@ import {onMounted, ref} from "vue";
 import {getMyCoupons} from "../../../api/coupon";
 import store from "../../../store";
 
-const screenSize = store.state.screenSize
-
 const usableCoupons = ref([])
 const unusableCoupons = ref([])
 
 onMounted(() => {
-  getMyCoupons('NONE').then(res => {
+  getMyCoupons({
+    hisOrdNum: 'NONE'
+  }).then(res => {
     usableCoupons.value = res.usableCoupons
     unusableCoupons.value = res.unusableCoupons
   })

+ 25 - 3
src/views/public-pages/Cashier.vue

@@ -91,10 +91,26 @@ const onCouponChange = (index) => {
   } else {
     const coupon = usableCoupons.value[index]
     createOrderRequest.couponId = coupon.id
-    createOrderRequest.couponAmt = coupon.value / 100
+    if (coupon.availableCharge) {
+      let targetChargeFee = getTargetChargeFee(coupon.availableCharge)
+      let couponValue = coupon.value > targetChargeFee ? targetChargeFee : coupon.value
+      createOrderRequest.couponAmt = couponValue / 100
+    } else {
+      createOrderRequest.couponAmt = coupon.value / 100
+    }
   }
 }
 
+function getTargetChargeFee(code) {
+  for (let i = 0; i < createOrderRequest.chargeList.length; i++) {
+    let charge = createOrderRequest.chargeList[i]
+    if (charge.itemCode === code) {
+      return charge.itemTotalFee
+    }
+  }
+  return 0
+}
+
 function makeMoneyStyle(m) {
   return '¥' + m.toFixed(2)
 }
@@ -139,10 +155,16 @@ function queryOrderTradeState(tradeNo) {
 
 onMounted(() => {
   const hisOrdNum = createOrderRequest.hisOrdNum || 'NONE'
-  getMyCoupons(hisOrdNum).then(res => {
+  const chargeCodeList = []
+  if (createOrderRequest.chargeList) {
+    createOrderRequest.chargeList.forEach((item) => {
+      chargeCodeList.push(item.itemCode)
+    })
+  }
+  getMyCoupons({hisOrdNum, chargeCodeList}).then(res => {
     usableCoupons.value = res.usableCoupons
     unusableCoupons.value = res.unusableCoupons
-  })
+  });
 })
 </script>