hospitalCostsList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="container">
  3. <view class="content">
  4. <view class="userInfoTopFixe">
  5. <!-- 时间选择 -->
  6. <view class='selsecttime displayFlexRow'>
  7. <view class='beforeday' @click="optionClick('before')">前一天</view>
  8. <view class="picker displayFlexRow">
  9. <picker mode="date" :value="queryBean.Date" :start="startdata" :end="enddata" @change="bindTimeChange">
  10. <view>{{ queryBean.Date }}</view>
  11. </picker>
  12. <image :src="iconUrl.bottom" class='iconcalendar'></image>
  13. </view>
  14. <view class='laterday' @click="optionClick('after')">后一天</view>
  15. </view>
  16. </view>
  17. <block v-if="!showNoData">
  18. <!-- 费用-->
  19. <view class='money'>今日费用: ¥{{ totalFee }}</view>
  20. <!-- 费用列表 -->
  21. <view class="content_inner">
  22. <view class='inner_list border_top' @click="click(item)" v-for="(item, index) in list" :key="index">
  23. <view class="list_info">
  24. <view class="info_name">{{ item.ExpenseTypeName }}</view>
  25. <view class="info_time">{{ item.Date }}</view>
  26. </view>
  27. <view class="list_key">
  28. <text class="">¥{{ item.Fee / 100 }}</text>
  29. <image class="public_right_img" :src="iconUrl.icon_right"></image>
  30. </view>
  31. </view>
  32. </view>
  33. </block>
  34. <view v-else class="noData">
  35. <noData :value="noDataValue"></noData>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script setup lang="ts">
  41. import { ref, computed } from 'vue';
  42. import { useOnLoad } from '@dcloudio/uni-app';
  43. import { queryInHospitalCostType } from '@/pagesPatient/service/costDetailedList';
  44. import common from '@/utils/common';
  45. import icon from '@/utils/icon';
  46. import noData from '@/pages/st1/components/noData/noData.vue';
  47. const iconUrl = icon;
  48. const queryBean = ref<any>({});
  49. const noDataValue = ref('暂无清单数据');
  50. const list = ref<any[]>([]);
  51. const showNoData = ref(true);
  52. const startdata = ref(''); // Although not used in original JS logic explicitly, it's in WXML. Keeping empty/default.
  53. const enddata = ref('');
  54. const currentUser = ref<any>({});
  55. // WXS replacement
  56. const totalFee = computed(() => {
  57. let num = 0;
  58. if (list.value && list.value.length > 0) {
  59. for (let i = 0; i < list.value.length; i++) {
  60. num += list.value[i].Fee;
  61. }
  62. }
  63. return num / 100;
  64. });
  65. useOnLoad((options: any) => {
  66. let qBean = options.queryBean ? JSON.parse(options.queryBean) : {};
  67. if (qBean.Date) {
  68. qBean.Date = qBean.Date.substring(0, 10);
  69. }
  70. queryBean.value = qBean;
  71. currentUser.value = getApp().globalData.currentUser;
  72. main();
  73. });
  74. const main = async () => {
  75. await getInHospitalCostType();
  76. };
  77. const getInHospitalCostType = async (pIndex = 0) => {
  78. let queryData = {
  79. MemberId: currentUser.value.memberId,
  80. CardNo: currentUser.value.cardNo,
  81. CardType: currentUser.value.cardType,
  82. BeginDate: queryBean.value.Date,
  83. EndDate: queryBean.value.Date,
  84. Store: {
  85. cardEncryptionStore: currentUser.value.encryptionStore || '',
  86. baseMemberEncryptionStore: currentUser.value.baseMemberEncryptionStore
  87. },
  88. Page: {
  89. PIndex: pIndex,
  90. PSize: 10
  91. }
  92. };
  93. // 遵循规范:必须解构返回值
  94. let { resp } = await queryInHospitalCostType(queryData);
  95. if (!common.isEmpty(resp)) {
  96. list.value = resp;
  97. showNoData.value = false;
  98. } else {
  99. list.value = [];
  100. showNoData.value = true;
  101. }
  102. };
  103. const bindTimeChange = (e: any) => {
  104. queryBean.value.Date = e.detail.value;
  105. main();
  106. };
  107. const optionClick = (type: string) => {
  108. let times;
  109. if (type == "before") {
  110. // 点击前一天
  111. times = -24 * 60 * 60 * 1000;
  112. } else {
  113. /**后一天 */
  114. times = 24 * 60 * 60 * 1000;
  115. }
  116. // Use replace for cross-platform date parsing compatibility
  117. let dateStr = queryBean.value.Date.replace(/\-/g, "/");
  118. let date = new Date(new Date(dateStr).getTime() + times);
  119. let formatDate = common.dateFormat(date).formatYear;
  120. queryBean.value.Date = formatDate;
  121. main();
  122. };
  123. const click = (item: any) => {
  124. let qBean = JSON.stringify(item);
  125. common.goToUrl(`/pagesPatient/st1/business/costDetailedList/costListingDetails/costListingDetails?queryBean=${qBean}&pageType=hospital`);
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. /* 时间选择 */
  130. .selsecttime {
  131. height: 120upx;
  132. line-height: 120upx;
  133. text-align: center;
  134. background-color: #fff;
  135. }
  136. .selsecttime .picker {
  137. width: 50%;
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. }
  142. .selsecttime .picker .iconcalendar {
  143. width: 20upx;
  144. height: 16upx;
  145. margin-left: 10upx;
  146. }
  147. .selsecttime .beforeday,
  148. .selsecttime .laterday {
  149. color: #000;
  150. padding: 0 30upx;
  151. font-weight: 400;
  152. width: 25%;
  153. }
  154. .selsecttime .beforeday:before {
  155. content: "";
  156. display: inline-block;
  157. width: 8px;
  158. height: 8px;
  159. border: solid #ccc;
  160. border-width: 2px 2px 0 0;
  161. -webkit-transform: rotate(-135deg);
  162. transform: rotate(-135deg);
  163. margin: 0 3upx 0 1upx;
  164. }
  165. .selsecttime .laterday:after {
  166. content: "";
  167. display: inline-block;
  168. width: 8px;
  169. height: 8px;
  170. border: solid #ccc;
  171. border-width: 2px 2px 0 0;
  172. -webkit-transform: rotate(45deg);
  173. transform: rotate(45deg);
  174. margin: 0 3upx 0 1upx;
  175. }
  176. /* 今日费用 */
  177. .money {
  178. padding: 40upx 0 40upx 31upx;
  179. background-color: #f5f5f5;
  180. font-size: 30upx;
  181. font-weight: 400;
  182. color: rgba(85, 85, 85, 1);
  183. line-height: 36upx;
  184. margin-top: 120upx;
  185. }
  186. /* 数据列表 */
  187. .content_inner {
  188. padding: 0 30upx;
  189. background-color: #fff;
  190. overflow: hidden;
  191. }
  192. .content_inner .inner_list {
  193. line-height: 50upx;
  194. position: relative;
  195. display: flex;
  196. padding: 40upx 30upx;
  197. color: #333;
  198. margin-top: -1px;
  199. }
  200. .content_inner .inner_list .list_info {
  201. flex: 1;
  202. font-size: 30upx;
  203. }
  204. .list_info .info_name {
  205. font-size: 32upx;
  206. font-weight: 500;
  207. color: rgba(0, 0, 0, 1);
  208. margin-bottom: 23upx;
  209. }
  210. .list_info .info_time {
  211. font-size: 28upx;
  212. font-weight: 400;
  213. color: rgba(85, 85, 85, 1);
  214. }
  215. .content_inner .inner_list .list_key {
  216. flex: 0 0 auto;
  217. font-size: 34upx;
  218. font-weight: 500;
  219. color: rgba(250, 72, 68, 1);
  220. display: flex;
  221. flex-direction: column;
  222. justify-content: center;
  223. }
  224. </style>