orderPayment.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <view class="container">
  3. <view class="content" v-if="showCon">
  4. <view class="userInfoTopFixe">
  5. <userInfo page-type="1" :userInfo="currentUser" bgClass="bgLinGra"></userInfo>
  6. </view>
  7. <view class="content_inner">
  8. <block v-if="!showNoData">
  9. <view class="inner_list">
  10. <view class="public_con" v-for="(item, index) in list" :key="index">
  11. <view class="public_con_nav displayFlexBetween">
  12. <view class="public_con_nav_tit">
  13. {{item.PrescTimeDiy}}
  14. </view>
  15. <view class="public_con_nav_name">
  16. <text class="mr10">{{item.DoctorName}} </text>
  17. <text>{{item.DeptName}}</text>
  18. </view>
  19. </view>
  20. <view class="public_con_info border_top">
  21. <view class="info_list" @click="getDetail(item, index)">
  22. <view class="list_item" @click.stop="selectedOptions(item)">
  23. <image class="list_circle" :src="isInclude(item) ? iconUrl.circle_active : iconUrl.circle"></image>
  24. <view class="list_name">{{item.PrescType||item.ServiceName||item.ReceiptName}}</view>
  25. </view>
  26. <view class="list_item list_item_sec">
  27. <view class="list_money">{{(item.Price/100||item.TotalMoney/100||item.TotalPrice/100)}}元</view>
  28. <image class="public_right_img" :src="iconUrl.icon_right"></image>
  29. </view>
  30. </view>
  31. <view class="list_itemDetail " v-if="item.check">
  32. <view class="itemDetail_list displayFlexBetween" v-for="(detailItem, ind) in item.ItemList" :key="ind">
  33. <view class="name">{{detailItem.Project||detailItem.ReceiptName}}</view>
  34. <view class="specifications">{{detailItem.Specifications}}</view>
  35. <view class="money">{{detailItem.SumOfMoney/100}}元</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </block>
  42. <view v-else class="noData">
  43. <noData :value="noDataValue"></noData>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 底部结算 -->
  48. <view class="order_bottom">
  49. <view class="bottom_checkbox" v-if="pageConfig.consolidationPayment" @click="allSelecteClick">
  50. <view class="icon">
  51. <image class="list_circle" :src="isAllSelected ? iconUrl.circle_active : iconUrl.circle"></image>
  52. </view>
  53. <view>全选</view>
  54. </view>
  55. <view class='bottom_cost'>
  56. <view>合计:
  57. <text class="c_fa4844">{{totalPrice}}元</text>
  58. </view>
  59. </view>
  60. <view class='cost_btn backgroundCustom' @click="pay">去缴费</view>
  61. </view>
  62. </view>
  63. </template>
  64. <script setup lang="ts">
  65. import { ref, computed, onMounted } from 'vue';
  66. import { onLoad } from '@dcloudio/uni-app';
  67. import common from '@/utils/common';
  68. import icon from '@/utils/icon';
  69. import {
  70. queryOrderSettlementList,
  71. queryOrderReceiptList,
  72. queryOrderPrescriptionList,
  73. queryOrderSettlementInfo,
  74. queryOrderPrescriptionInfo,
  75. settleOrderSettlement,
  76. addOrderPrescription,
  77. mergeSettledPayReceipt
  78. } from '@/pagesPatient/service/order/index';
  79. import { pagesPatientFn } from '@/utils';
  80. import userInfo from '@/pagesPersonal/st1/components/userInfo/userInfo.vue';
  81. import noData from '@/pages/st1/components/noData/noData.vue';
  82. const app = getApp();
  83. const iconUrl = icon;
  84. const currentUser = ref<any>({});
  85. const list = ref<any[]>([]);
  86. const listSelected = ref<any[]>([]);
  87. const showNoData = ref(false);
  88. const isAllSelected = ref(false);
  89. const noDataValue = ref('暂无待结算处方');
  90. const showCon = ref(false);
  91. const pageConfig = ref<any>({});
  92. onLoad((options) => {
  93. let config = common.deepCopy(app.globalData.config.pageConfiguration.orderPayment_config);
  94. currentUser.value = app.globalData.currentUser;
  95. pageConfig.value = config;
  96. // 判断是否合并支付
  97. if (config.consolidationPayment) {
  98. common.showModal('标准不做合并处方结算,如医院有要上,个性化。');
  99. return;
  100. }
  101. main();
  102. });
  103. const main = async () => {
  104. // /**如果没有就诊卡 */
  105. // if (await publicFn.cardListIsEmpty(this)) {
  106. // return
  107. // }
  108. queryList();
  109. };
  110. const refresh = () => {
  111. main();
  112. };
  113. const selectedOptions = (item: any) => {
  114. let selected = listSelected.value;
  115. let consolidationPayment = pageConfig.value.consolidationPayment;
  116. let has = false;
  117. let key = item.PrescNo ? 'PrescNo' : 'ReceiptNo';
  118. for (let i of selected) {
  119. if (i[key] == item[key]) {
  120. has = true;
  121. break;
  122. }
  123. }
  124. if (consolidationPayment) {
  125. /**可合并支付 */
  126. if (has) {
  127. /**如果当前点击的处方已经选中 将其删除*/
  128. selected = selected.filter(cell => cell[key] != item[key]);
  129. } else {
  130. selected.push(item);
  131. }
  132. } else {
  133. /**不可合并支付 */
  134. selected = [item];
  135. }
  136. listSelected.value = selected;
  137. isAllSelected.value = list.value.length == selected.length;
  138. };
  139. const allSelecteClick = () => {
  140. if (isAllSelected.value) {
  141. listSelected.value = [];
  142. } else {
  143. listSelected.value = [...list.value];
  144. }
  145. isAllSelected.value = !isAllSelected.value;
  146. };
  147. const queryList = async (pIndex = 0) => {
  148. let orderPaymentMode = pageConfig.value.orderPaymentMode;
  149. let consolidationPayment = pageConfig.value.consolidationPayment;
  150. let dataList: any[] = [];
  151. let showNoDataVal = true;
  152. let times = 30 * 24 * 60 * 60 * 1000;
  153. let beginDate = common.dateFormat(new Date(Date.now() - times)).formatYear;
  154. let endDate = common.newDay();
  155. let user = currentUser.value;
  156. let queryData: any = {
  157. CardNo: user.cardNo,
  158. CardType: user.cardType,
  159. MemberId: user.memberId,
  160. Store: {
  161. cardEncryptionStore: user.encryptionStore || '',
  162. baseMemberEncryptionStore: user.baseMemberEncryptionStore
  163. },
  164. BeginDate: beginDate,
  165. EndDate: endDate,
  166. Page: {
  167. PIndex: pIndex,
  168. PSize: 10
  169. }
  170. };
  171. let resp;
  172. if (orderPaymentMode == '1') {
  173. /**预交金模式 */
  174. queryData.IsSettlement = '0';
  175. resp = await queryOrderSettlementList(queryData);
  176. } else if (orderPaymentMode == '2') {
  177. /**线上支付 */
  178. if (consolidationPayment) {
  179. /**如果是合并支付 */
  180. queryData.IsSettlement = '0';
  181. resp = await queryOrderReceiptList(queryData);
  182. } else {
  183. /**单笔支付 */
  184. queryData.OrderState = '0';
  185. resp = await queryOrderPrescriptionList(queryData);
  186. }
  187. }
  188. if (!common.isEmpty(resp)) {
  189. resp.map((item: any) => {
  190. item.PrescTimeDiy = item.PrescTime || item.ReceiptTime;
  191. item.PrescTimeDiy = item.PrescTimeDiy.substring(0, 10);
  192. });
  193. dataList = resp;
  194. showNoDataVal = false;
  195. }
  196. list.value = dataList;
  197. showNoData.value = showNoDataVal;
  198. showCon.value = true;
  199. listSelected.value = [];
  200. isAllSelected.value = false;
  201. };
  202. const getDetail = async (item: any, index: number) => {
  203. let orderPaymentMode = pageConfig.value.orderPaymentMode;
  204. let user = currentUser.value;
  205. let resp;
  206. if (common.isEmpty(item.ItemList)) {
  207. let queryData = {
  208. HisOrderId: item.HisOrderId,
  209. PrescNo: item.PrescNo || item.ReceiptNo || '',
  210. MemberId: user.memberId,
  211. Store: {
  212. cardEncryptionStore: user.encryptionStore || '',
  213. baseMemberEncryptionStore: user.baseMemberEncryptionStore
  214. },
  215. };
  216. if (orderPaymentMode == '1') {
  217. /**如果是预交金模式 */
  218. resp = await queryOrderSettlementInfo(queryData);
  219. } else {
  220. /**订单模式 在线支付 */
  221. resp = await queryOrderPrescriptionInfo(queryData);
  222. }
  223. if (!common.isEmpty(resp)) {
  224. list.value[index].ItemList = resp[0].Data_1;
  225. }
  226. }
  227. list.value[index].check = !list.value[index].check;
  228. };
  229. const toDetail = (e: any) => {
  230. let queryBean = JSON.stringify(e.currentTarget.dataset.item);
  231. common.goToUrl(`/pages/st1/business/order/orderPaymentDetails/orderPaymentDetails?queryBean=${queryBean}`);
  232. };
  233. const pay = (e: any) => {
  234. prescriptionPayment();
  235. };
  236. const prescriptionPayment = async () => {
  237. /**订单缴费模式 1预交金 2线上支付 */
  238. let config = !common.isEmpty(pageConfig.value) ? pageConfig.value : (app.globalData.config.pageConfiguration.orderPayment_config || {});
  239. let orderPaymentMode = config.orderPaymentMode;
  240. /**是否合并支付 */
  241. let consolidationPayment = config.consolidationPayment;
  242. let user = currentUser.value;
  243. if (common.isEmpty(listSelected.value)) {
  244. common.showModal('请选择处方');
  245. return;
  246. }
  247. let total = 0;
  248. let hisOrderIds: any[] = [];
  249. let prescNos: any[] = [];
  250. let receiptPrices: any[] = [];
  251. let receiptNames: any[] = [];
  252. let serviceId = listSelected.value[0].ServiceId;
  253. listSelected.value.map(item => {
  254. total += item.Price || item.TotalMoney || item.TotalPrice;
  255. receiptPrices.push(item.Price || item.TotalMoney || item.TotalPrice);
  256. receiptNames.push(item.PrescType || item.ServiceName || item.ReceiptName);
  257. hisOrderIds.push(item.HisOrderId);
  258. prescNos.push(item.PrescNo || item.ReceiptNo);
  259. });
  260. if (orderPaymentMode == '1') {
  261. /**预交金模式 */
  262. common.showModal('确认结算?', async () => {
  263. let queryData = {
  264. CardNo: user.cardNo,
  265. CardType: user.cardType,
  266. MemberId: user.memberId,
  267. TotalPrice: total,
  268. HisOrderIds: hisOrderIds.join(','),
  269. PrescNos: prescNos.join(','),
  270. Store: {
  271. cardEncryptionStore: user.encryptionStore || '',
  272. baseMemberEncryptionStore: user.baseMemberEncryptionStore
  273. }
  274. };
  275. let resp = await settleOrderSettlement(queryData);
  276. if (!common.isEmpty(resp)) {
  277. common.goToUrl(`/pagesPatient/st1/business/pay/payState/payState?pageType=orderPayment`);
  278. }
  279. }, {
  280. cancelText: '取消'
  281. });
  282. } else {
  283. /**判断是否有待支付订单*/
  284. if (await pagesPatientFn.hasOrderToBePaid(serviceId)) {
  285. return;
  286. }
  287. common.showModal('确认结算?', async () => {
  288. let resp;
  289. if (consolidationPayment) {
  290. /**如果是订单缴费合并支付 */
  291. let queryData = {
  292. CardNo: user.cardNo,
  293. CardType: user.cardType,
  294. MemberId: user.memberId,
  295. TotalPrice: total,
  296. ReceiptNos: prescNos.join(','),
  297. ReceiptPrices: receiptPrices.join(','),
  298. ReceiptNames: receiptNames.join(','),
  299. Store: {
  300. cardEncryptionStore: user.encryptionStore || '',
  301. baseMemberEncryptionStore: user.baseMemberEncryptionStore
  302. }
  303. };
  304. resp = await mergeSettledPayReceipt(queryData);
  305. } else {
  306. /**订单缴费单笔支付 */
  307. let queryData = {
  308. HisOrderId: hisOrderIds.join(','),
  309. PrescNo: prescNos.join(','),
  310. PayMoney: total,
  311. TotalMoney: total,
  312. OperatorName: user.memberName,
  313. EqptType: '3',
  314. MemberId: user.memberId,
  315. CardNo: user.cardNo,
  316. CardType: user.cardType,
  317. OperatorId: uni.getStorageSync('openid'),
  318. ServiceId: serviceId,
  319. TransactionCode: "",
  320. Store: {
  321. cardEncryptionStore: user.encryptionStore || '',
  322. baseMemberEncryptionStore: user.baseMemberEncryptionStore
  323. }
  324. };
  325. resp = await addOrderPrescription(queryData);
  326. }
  327. if (!common.isEmpty(resp)) {
  328. common.goToUrl(`/pagesPatient/st1/business/pay/payMent/payMent?orderId=${resp[0].OrderId}`);
  329. }
  330. }, {
  331. cancelText: '取消'
  332. });
  333. }
  334. };
  335. const totalPrice = computed(() => {
  336. let num = 0;
  337. if (listSelected.value && listSelected.value.length > 0) {
  338. for (let i = 0; i < listSelected.value.length; i++) {
  339. const item = listSelected.value[i];
  340. num += item.Price || item.TotalMoney || item.TotalPrice || 0;
  341. }
  342. }
  343. return num / 100;
  344. });
  345. const isInclude = (item: any) => {
  346. const selected = listSelected.value;
  347. if (selected && selected.length > 0) {
  348. const variable = selected[0].PrescNo ? "PrescNo" : "ReceiptNo";
  349. return selected.some((i: any) => i[variable] == item[variable]);
  350. }
  351. return false;
  352. };
  353. defineExpose({
  354. refresh
  355. });
  356. </script>
  357. <style lang="scss" scoped>
  358. .content {
  359. height: 100%;
  360. padding-bottom: 132upx;
  361. overflow: auto;
  362. padding-top: 190upx;
  363. }
  364. .noData {
  365. margin-top: 250upx;
  366. }
  367. .public_con{
  368. margin: 30upx;
  369. background-color: #fff;
  370. border-radius: 24upx;
  371. }
  372. .public_con_nav{
  373. font-size: 32upx;
  374. padding: 40upx 30upx;
  375. }
  376. .public_con_info {
  377. margin: 0 30upx;
  378. }
  379. .public_con_info .info_list {
  380. font-size: 30upx;
  381. font-weight: 400;
  382. color: #222326;
  383. display: flex;
  384. align-items: center;
  385. }
  386. .list_item {
  387. display: flex;
  388. align-items: center;
  389. justify-content: flex-start;
  390. width: 50%;
  391. padding: 40upx 0 46upx;
  392. }
  393. .list_item_sec {
  394. justify-content: flex-end;
  395. position: relative;
  396. }
  397. .list_money {
  398. margin-right: 32upx;
  399. }
  400. .list_circle {
  401. width: 44upx;
  402. height: 44upx;
  403. margin-right: 24upx;
  404. flex-shrink: 0;
  405. }
  406. .list_name{
  407. line-height: 24upx;
  408. }
  409. .list_itemDetail .itemDetail_list {
  410. font-size: 30upx;
  411. font-weight: 400;
  412. color: #222326;
  413. padding-bottom: 30upx;
  414. }
  415. .list_itemDetail .itemDetail_list .name{
  416. width: 50%;
  417. }
  418. .list_itemDetail .itemDetail_list .money{
  419. width: 20%;
  420. text-align: right;
  421. }
  422. .list_itemDetail .itemDetail_list .specifications{
  423. color:#6f6f6f;
  424. width: 30%;
  425. }
  426. /* 底部结算 */
  427. .order_bottom {
  428. height: 132upx;
  429. width: 100%;
  430. background: #fff;
  431. position: fixed;
  432. left: 0;
  433. bottom: 0;
  434. z-index: 100;
  435. display: flex;
  436. align-items: center;
  437. padding: 0 30upx;
  438. }
  439. .order_bottom .bottom_checkbox {
  440. flex: 0 0 auto;
  441. display: flex;
  442. justify-content: flex-start;
  443. align-items: center;
  444. font-size: 30upx;
  445. font-weight: 400;
  446. color: rgba(0, 0, 0, 1);
  447. margin-right: 40upx;
  448. }
  449. .order_bottom .bottom_cost {
  450. font-size: 32upx;
  451. font-weight: 500;
  452. color: rgba(0, 0, 0, 1);
  453. }
  454. .order_bottom .cost_btn {
  455. font-size: 32upx;
  456. font-weight: 500;
  457. width: 240upx !important;
  458. height: 92upx;
  459. border-radius: 46upx;
  460. color: #fff;
  461. position: absolute;
  462. top: 20upx;
  463. right: 30upx;
  464. display: flex;
  465. align-items: center;
  466. justify-content: center;
  467. }
  468. .c_fa4844 {
  469. color: #fa4844;
  470. }
  471. /* Helper classes */
  472. .displayFlexBetween {
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. }
  477. .border_top {
  478. border-top: 1upx solid #eee;
  479. }
  480. .mr10 {
  481. margin-right: 10upx;
  482. }
  483. </style>