healthCardQrcode.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="container">
  3. <view class="content" v-if="showCon">
  4. <view class="bar_list" v-if="queryBean.healthCard">
  5. <view :class="['bar_item', type=='healthCard'?'bar_item_active':'']" @click="tabbarClick" data-type="healthCard">电子健康卡</view>
  6. <view :class="['bar_item', type=='card'?'bar_item_active':'']" @click="tabbarClick" data-type="card">就诊卡</view>
  7. </view>
  8. <view class="content_inner">
  9. <view class="qr_code" v-show="type=='healthCard'">
  10. <canvas class='coode' canvas-id='canvasHealth'></canvas>
  11. </view>
  12. <view class="qr_code" v-show="type=='card'">
  13. <!-- <image class="card-qrcode-logo" src="@/static/images/healthCard/logo_.png" alt="" /> -->
  14. <cover-image class="card-qrcode-logo" src="@/static/images/healthCard/logo_.png"></cover-image>
  15. <canvas class='baseCode' canvas-id='canvasCard' ></canvas>
  16. <!-- <image style="width:300upx;height:300upx" src="data:image/png;base64,{{queryBean.base64Code}}" wx:if="{{queryBean.healthCard&&queryBean.base64Code}}" mode="widthFix"></image> -->
  17. </view>
  18. <!-- <view class="card_type">{{queryBean.healthCard?'电子健康卡':'院内就诊卡'}}</view> -->
  19. <view class="list">
  20. <view class="item">
  21. <view class="item_tit">姓名</view>
  22. <view class="item_con">{{queryBean.MemberName}}</view>
  23. </view>
  24. <!-- <view class="item">
  25. <view class="item_tit">性别</view>
  26. <view class="item_con">{{queryBean.OtherInfo.patientsex}}</view>
  27. </view> -->
  28. <!-- <view class="item">
  29. <view class="item_tit">病人ID</view>
  30. <view class="item_con">{{queryBean.OtherInfo.patientid}}</view>
  31. </view> -->
  32. <view class="item">
  33. <view class="item_tit">手机号</view>
  34. <view class="item_con">{{queryBean.Mobile}}</view>
  35. </view>
  36. <view class="item">
  37. <view class="item_tit">就诊卡号</view>
  38. <view class="item_con">{{queryBean.CardNo}}</view>
  39. </view>
  40. <!-- <view class="item">
  41. <view class="item_tit">患者身份</view>
  42. <view class="item_con">{{queryBean.OtherInfo.chargetype}}</view>
  43. </view> -->
  44. <!-- <view class="item">
  45. <view class="item_tit">证件类型</view>
  46. <view class="item_con">{{queryBean.OtherInfo.ext5==1?'本人身份证':'监护人身份证'}}</view>
  47. </view> -->
  48. <view class="item">
  49. <view class="item_tit">证件号</view>
  50. <view class="item_con">{{queryBean.IdCardNo}}</view>
  51. </view>
  52. <view class="item">
  53. <view class="item_tit">家庭住址</view>
  54. <view class="item_con">{{queryBean.Address}}</view>
  55. </view>
  56. <view class="item" v-if="queryBean.healthCard" v-show="type=='healthCard'">
  57. <view class="item_tit">{{'电子健康卡'}}</view>
  58. <view class="item_con">{{queryBean.healthCard}}</view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="btn" @click="toH5" v-if="queryBean.healthCard">进入卡包</view>
  63. </view>
  64. </view>
  65. </template>
  66. <script lang="ts" setup>
  67. import { ref, getCurrentInstance } from 'vue';
  68. import { onLoad } from '@dcloudio/uni-app';
  69. import { common, QRCode } from '@/utils';
  70. const app = getApp();
  71. const queryBean = ref<any>({});
  72. const type = ref('healthCard');
  73. const showCon = ref(false);
  74. const main = async (bean: any) => {
  75. common.showLoading('加载中');
  76. if (!common.isEmpty(bean)) {
  77. var otherInfo = bean.OtherInfo;
  78. if(otherInfo){
  79. var qrCodeText = otherInfo.qrCodeText;
  80. if(qrCodeText){
  81. bean.healthCard = qrCodeText;
  82. }
  83. }else{
  84. type.value = 'card';
  85. }
  86. setTimeout(() => {
  87. // 如果是就诊卡 或者健康卡code未加载成功
  88. if(bean.healthCard){
  89. new QRCode('canvasHealth', {
  90. text: bean.healthCard,
  91. width: uni.upx2px(300),
  92. height: uni.upx2px(300),
  93. colorDark: "#000000",
  94. colorLight: "#ffffff",
  95. correctLevel: QRCode.CorrectLevel.H,
  96. });
  97. }
  98. new QRCode('canvasCard', {
  99. text: bean.CardNo,
  100. width: uni.upx2px(300),
  101. height: uni.upx2px(300),
  102. colorDark: "#000000",
  103. colorLight: "#ffffff",
  104. correctLevel: QRCode.CorrectLevel.H,
  105. });
  106. }, 200);
  107. }
  108. queryBean.value = bean;
  109. showCon.value = true;
  110. common.hideLoading();
  111. }
  112. onLoad((options) => {
  113. let cardInfo = app.globalData.cardInfo_x;
  114. main(cardInfo);
  115. });
  116. const tabbarClick = (e: any) => {
  117. let t = e.currentTarget.dataset.type;
  118. type.value = t;
  119. }
  120. const toH5 = () => {
  121. common.showToast("跳转卡包 暂不支持");
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .content_inner {
  126. background-color: #fff;
  127. padding: 1px 50upx;
  128. border-bottom: 1px solid #ebeaea;
  129. }
  130. .qr_code{
  131. margin: 30upx auto;
  132. font-size: 0;
  133. min-height:200upx;
  134. overflow: hidden;
  135. text-align: center;
  136. position: relative;
  137. }
  138. .card_type {
  139. text-align: center;
  140. }
  141. .item {
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. padding: 30upx 0;
  146. border-top: 1px solid rgb(245, 245, 245);
  147. }
  148. .item_con {
  149. color: rgb(127, 127, 127);
  150. margin-right: 20upx;
  151. width: 460upx;
  152. text-align: right;
  153. white-space: nowrap;
  154. text-overflow: ellipsis;
  155. overflow: hidden;
  156. }
  157. .btn {
  158. margin: 40upx;
  159. border-radius: 5px;
  160. color: #fff;
  161. padding: 20upx 0;
  162. /* background-color: rgb(89, 164, 248); */
  163. background-color: var(--auxiliaryColor);
  164. text-align: center;
  165. }
  166. canvas {
  167. width: 300upx;
  168. height: 300upx;
  169. margin: 0 auto;
  170. }
  171. .bar_list{
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. background-color: #fff;
  176. margin-bottom: 1px;
  177. }
  178. .bar_item{
  179. line-height: 100upx;
  180. width: 50%;
  181. text-align: center;
  182. }
  183. .bar_item_active{
  184. color: var(--auxiliaryColor) !important;
  185. }
  186. .del{
  187. background-color: #fff;
  188. color: var(--auxiliaryColor) !important;
  189. }
  190. .card-qrcode-logo {
  191. border: 2px solid #fff;
  192. height: 55upx;
  193. width: 55upx;
  194. position: absolute;
  195. top: 50%;
  196. left: 50%;
  197. transform: translate(-50%, -50%);
  198. z-index: 10;
  199. }
  200. .baseCode{
  201. z-index: 1;
  202. }
  203. </style>