inquiryList.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <view class="container">
  3. <view class="content">
  4. <view class="search">
  5. <view class="search_box">
  6. <input
  7. :class="isFocus ? 'search_input' : 'search_input_none'"
  8. placeholder="请输入搜索名称"
  9. :placeholder-class="isFocus ? 'placeholder' : 'placeholder_none'"
  10. :value="searchValue"
  11. @focus="focusFn('focus')"
  12. @input="setVal('searchValue', $event)"
  13. />
  14. <image
  15. class="search_icon"
  16. :class="{ search_icon_none: !isFocus }"
  17. :src="iconUrl.search"
  18. ></image>
  19. <image
  20. class="remove_icon"
  21. v-if="isFocus"
  22. :src="iconUrl.cha"
  23. @click.stop="focusFn('blur')"
  24. ></image>
  25. <view
  26. v-if="isFocus"
  27. class="search_confirm backgroundCustom_F08"
  28. :class="{ search_confirm_active: isFocus }"
  29. @click="searchClick"
  30. >搜索</view
  31. >
  32. </view>
  33. </view>
  34. <view class="content_list" v-if="!showNoData">
  35. <block v-for="(item, ind) in searchList" :key="ind">
  36. <view
  37. class="list_drug_box"
  38. @click="jumpQueryPatient(item)"
  39. v-if="type == 'pro'"
  40. >
  41. <view class="list-message">
  42. <view class="list-info-name">{{ item.ItemName }}</view>
  43. <view class="list-info-time">规格:{{ item.Unit }}</view>
  44. </view>
  45. <view class="list-key">{{ item.UnitPrice }}元</view>
  46. </view>
  47. <view
  48. class="list_project_box"
  49. @click="jumpQueryPatient(item)"
  50. v-else
  51. >
  52. <view class="box-name">
  53. <text class="title">{{ item.DrugName }}</text>
  54. <!--西药 western_color 中药 china_color 中成药 synthetic_color -->
  55. <text class="box-name-medicine ">{{
  56. item.DrugClassification
  57. }}</text>
  58. </view>
  59. <view class="box-time"
  60. >规格:{{ item.Specs }} 分类:{{ item.DrugType }}</view
  61. >
  62. <view class="box-company">{{ item.Manufacturer }}</view>
  63. <view class="box-money border_top">{{ item.UnitPrice }}元</view>
  64. </view>
  65. </block>
  66. <view class="public_loadAllTip" v-if="loadAll">已加载全部</view>
  67. </view>
  68. <view v-else class="noData">
  69. <noData :value="noDataValue"></noData>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script setup lang="ts">
  75. import { ref } from 'vue';
  76. import { useOnLoad, onReachBottom } from '@dcloudio/uni-app';
  77. import { queryDrugList, queryExpensesItemList } from '@/pagesPatient/service/priceInquiry';
  78. import { common } from '@/utils';
  79. import icon from '@/utils/icon';
  80. import noData from '@/pages/st1/components/noData/noData.vue';
  81. const iconUrl = ref(icon);
  82. const isFocus = ref(false);
  83. const searchValue = ref('');
  84. const searchList = ref<any[]>([]);
  85. const type = ref('drug'); // drug:药品查询 pro:项目查询
  86. const noDataValue = ref('暂无查询数据');
  87. const showNoData = ref(false);
  88. const loadAll = ref(false);
  89. const pIndex = ref(1);
  90. useOnLoad((options: any) => {
  91. type.value = options.type || '';
  92. main();
  93. });
  94. const main = async () => {
  95. queryList(searchValue.value, pIndex.value);
  96. };
  97. const searchClick = () => {
  98. loadAll.value = false;
  99. pIndex.value = 1;
  100. searchList.value = [];
  101. queryList(searchValue.value, pIndex.value);
  102. };
  103. const queryList = async (searchTxt: string, pageIndex: number) => {
  104. let queryData: any = {
  105. Page: {
  106. PIndex: pageIndex,
  107. PSize: 100,
  108. },
  109. };
  110. let resp: any;
  111. if (type.value == 'drug') {
  112. queryData.DrugName = searchTxt;
  113. resp = await queryDrugList(queryData);
  114. } else if (type.value == 'pro') {
  115. queryData.CostsItemName = searchTxt;
  116. resp = await queryExpensesItemList(queryData);
  117. }
  118. let list = searchList.value;
  119. if (!common.isEmpty(resp)) {
  120. list = list.concat(resp);
  121. }
  122. const currentRespLength = resp ? resp.length : 0;
  123. searchList.value = list;
  124. showNoData.value = list.length <= 0;
  125. pIndex.value = pIndex.value + 1;
  126. loadAll.value = list.length > 0 && currentRespLength < 10;
  127. };
  128. const focusFn = (eventType: string) => {
  129. if (eventType === 'focus') {
  130. isFocus.value = true;
  131. } else {
  132. isFocus.value = !isFocus.value;
  133. searchValue.value = '';
  134. searchList.value = [];
  135. queryList(searchValue.value, 1);
  136. }
  137. };
  138. const setVal = (key: string, event: any) => {
  139. const value = event.detail.value;
  140. if (key === 'searchValue') {
  141. searchValue.value = value;
  142. }
  143. };
  144. const jumpQueryPatient = (item: any) => {
  145. let queryBean = JSON.stringify(item);
  146. common.goToUrl(
  147. `/pagesPatient/st1/business/priceInquiry/inquiryDetails/inquiryDetails?queryBean=${queryBean}&type=${type.value}`
  148. );
  149. };
  150. onReachBottom(() => {
  151. if (loadAll.value || type.value == 'pro') {
  152. return;
  153. }
  154. if (searchList.value.length >= 10) {
  155. queryList(searchValue.value, pIndex.value);
  156. }
  157. });
  158. </script>
  159. <style lang="scss">
  160. /* Copied from search.wxss and inquiryList.wxss, converted rpx to upx */
  161. /* 搜索框 */
  162. .search {
  163. position: fixed;
  164. z-index: 2;
  165. height: 110upx;
  166. width: 100%;
  167. padding: 0 30upx 20upx;
  168. top: 0;
  169. left: 0;
  170. background-color: #fff;
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-between;
  174. }
  175. .search_box {
  176. width: 100%;
  177. margin-top: 10upx;
  178. display: flex;
  179. flex-direction: row;
  180. justify-content: flex-start;
  181. align-items: center;
  182. position: relative;
  183. z-index: 10;
  184. }
  185. .search_input_none {
  186. width: 690upx;
  187. height: 74upx;
  188. border-radius: 50px;
  189. font-size: 28upx;
  190. color: #333 !important;
  191. background: #f2f2f2;
  192. padding-left: 65upx;
  193. text-align: center;
  194. }
  195. .search_input {
  196. width: 570upx;
  197. height: 80upx;
  198. border-radius: 50px;
  199. font-size: 28upx;
  200. color: #333 !important;
  201. background: #F1F1F6;
  202. margin-right: 24upx;
  203. padding-left: 65upx;
  204. padding-right: 85upx;
  205. }
  206. .search_icon {
  207. width: 26upx;
  208. height: 26upx;
  209. position: absolute;
  210. top: 33%;
  211. left: 36%;
  212. }
  213. .search_icon_none {
  214. left: 20upx;
  215. }
  216. .remove_icon {
  217. width: 36upx;
  218. height: 36upx;
  219. position: absolute;
  220. top: 28%;
  221. right: 158upx;
  222. z-index: 50;
  223. }
  224. .search_btn {
  225. display: inline-block;
  226. width: 100upx;
  227. line-height: 56upx;
  228. text-align: center;
  229. font-size: 30upx;
  230. font-family: PingFang SC;
  231. margin-bottom: 28upx;
  232. }
  233. .search_confirm {
  234. width: 0;
  235. height: 68upx;
  236. border-radius: 50px;
  237. line-height: 68upx;
  238. text-align: center;
  239. transition: all 0.3s;
  240. font-size: 0;
  241. }
  242. .search_confirm_active {
  243. width: 128upx;
  244. font-size: 28upx;
  245. }
  246. /* inquiryList.wxss content */
  247. .content_list {
  248. padding-top: 110upx;
  249. }
  250. /* 项目样式 */
  251. .list_drug_box {
  252. margin: 30upx;
  253. background: rgba(255, 255, 255, 1);
  254. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  255. border-radius: 20upx;
  256. padding: 38upx 30upx 43upx;
  257. position: relative;
  258. display: box;
  259. display: -webkit-box;
  260. }
  261. .list_drug_box .list-message {
  262. width: 80%;
  263. }
  264. .list_drug_box .list-message .list-info-name {
  265. font-size: 30upx;
  266. font-weight: 500;
  267. color: rgba(0, 0, 0, 1);
  268. padding-bottom: 18upx;
  269. line-height: 24upx;
  270. word-break: break-all;
  271. }
  272. .list_drug_box .list-message .list-info-time {
  273. font-size: 28upx;
  274. font-weight: 400;
  275. color: rgba(166, 166, 166, 1);
  276. }
  277. .list_drug_box .list-key {
  278. display: -webkit-box;
  279. -webkit-box-orient: vertical;
  280. -webkit-box-pack: center;
  281. font-size: 30upx;
  282. font-weight: 500;
  283. color: rgba(250, 72, 68, 1);
  284. width: 20%;
  285. text-align: right;
  286. }
  287. /* 药品样式 */
  288. .list_project_box {
  289. margin: 30upx;
  290. background: rgba(255, 255, 255, 1);
  291. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  292. border-radius: 24upx;
  293. padding: 38upx 30upx 0;
  294. }
  295. .list_project_box .box-name {
  296. font-size: 30upx;
  297. font-weight: 500;
  298. color: rgba(0, 0, 0, 1);
  299. display: flex;
  300. align-items: flex-start;
  301. justify-content: space-between;
  302. }
  303. .list_project_box .box-name .box-name-medicine {
  304. float: right;
  305. font-size: 26upx;
  306. font-weight: 400;
  307. line-height: 48upx;
  308. }
  309. .china_color {
  310. color: #ff7800;
  311. }
  312. .western_color {
  313. color: #29cf8c;
  314. }
  315. .synthetic_color {
  316. color: #00a2fe;
  317. }
  318. .list_project_box .box-time {
  319. font-size: 28upx;
  320. font-weight: 400;
  321. color: rgba(85, 85, 85, 1);
  322. margin: 20upx 0;
  323. }
  324. .list_project_box .box-company {
  325. font-size: 28upx;
  326. font-weight: 400;
  327. color: #a6a6a6;
  328. margin-bottom: 28upx;
  329. }
  330. .list_project_box .box-money {
  331. font-size: 30upx;
  332. font-weight: 500;
  333. color: rgba(250, 72, 68, 1);
  334. padding: 28upx 0;
  335. text-align: right;
  336. }
  337. .box-name .title {
  338. width: 550upx;
  339. line-height: 48upx;
  340. flex-shrink: 0;
  341. }
  342. </style>