refundForm.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. <template>
  2. <view>
  3. <view class="container">
  4. <view class="content">
  5. <!-- 基础信息表单 -->
  6. <view v-if="formConfig_basic.length" class="white-panel no-padding">
  7. <gForm
  8. id="form_basic"
  9. ref="form_basic"
  10. :formConfig="formConfig_basic"
  11. :formData="formData"
  12. @formSubmit="onFormSubmit"
  13. @errorReport="onErrorReport"
  14. @formDataChange="onFormDataChange"
  15. @smsCodeSendSuccess="onSmsCodeSendSuccess"
  16. @smsCodeSendFail="onSmsCodeSendFail"
  17. @actionClick="onActionClick"
  18. />
  19. </view>
  20. <!-- 办理类型选择 -->
  21. <tabBar
  22. :tabList="relationTypeConf.relationTypeList"
  23. :value="relationTypeConf.relationTypeSlt"
  24. @tabClick="tabClick"
  25. ></tabBar>
  26. <!-- 转账信息表单 -->
  27. <view class="white-panel no-padding">
  28. <block v-if="formData.TransferType == 'Bank'">
  29. <gForm
  30. id="form_bank"
  31. ref="form_bank"
  32. :formConfig="formConfig_bank"
  33. :formData="formData"
  34. @formSubmit="onFormSubmit"
  35. @errorReport="onErrorReport"
  36. @formDataChange="onFormDataChange"
  37. @smsCodeSendSuccess="onSmsCodeSendSuccess"
  38. @smsCodeSendFail="onSmsCodeSendFail"
  39. @actionClick="onActionClick"
  40. />
  41. </block>
  42. <block v-if="formData.TransferType == 'Wechat'">
  43. <gForm
  44. id="form_wechat"
  45. ref="form_wechat"
  46. :formConfig="formConfig_wechat"
  47. :formData="formData"
  48. @formSubmit="onFormSubmit"
  49. @errorReport="onErrorReport"
  50. @formDataChange="onFormDataChange"
  51. @smsCodeSendSuccess="onSmsCodeSendSuccess"
  52. @smsCodeSendFail="onSmsCodeSendFail"
  53. @actionClick="onActionClick"
  54. />
  55. </block>
  56. <block v-if="formData.TransferType == 'Zfb'">
  57. <gForm
  58. id="form_zfb"
  59. ref="form_zfb"
  60. :formConfig="formConfig_zfb"
  61. :formData="formData"
  62. @formSubmit="onFormSubmit"
  63. @errorReport="onErrorReport"
  64. @formDataChange="onFormDataChange"
  65. @smsCodeSendSuccess="onSmsCodeSendSuccess"
  66. @smsCodeSendFail="onSmsCodeSendFail"
  67. @actionClick="onActionClick"
  68. />
  69. </block>
  70. </view>
  71. <!-- 证件上传 -->
  72. <view class="block-title font-bold require">请上传就诊人身份证</view>
  73. <view class="white-panel display-flex__ac" style="gap: 20upx">
  74. <view
  75. class="upload-image__content"
  76. @click="uploadImage('oneselfFrontIdCard')"
  77. >
  78. <view class="upload-image__main display-flex__ac display-flex__jc">
  79. <image
  80. v-if="
  81. getListKey(
  82. formData.ReviewImages,
  83. 'key',
  84. 'oneselfFrontIdCard',
  85. 'value'
  86. )
  87. "
  88. :src="
  89. autoUrl(
  90. baseUrl,
  91. getListKey(
  92. formData.ReviewImages,
  93. 'key',
  94. 'oneselfFrontIdCard',
  95. 'value'
  96. )
  97. )
  98. "
  99. mode="aspectFit"
  100. />
  101. <image v-else src="../static/images/rxm.png" mode="aspectFit" />
  102. </view>
  103. <view class="upload-image__info text-center backgroundCustom">
  104. 点击拍摄/上传人像面
  105. </view>
  106. </view>
  107. <view
  108. class="upload-image__content"
  109. @click="uploadImage('oneselfBackIdCard')"
  110. >
  111. <view class="upload-image__main display-flex__ac display-flex__jc">
  112. <image
  113. v-if="
  114. getListKey(
  115. formData.ReviewImages,
  116. 'key',
  117. 'oneselfBackIdCard',
  118. 'value'
  119. )
  120. "
  121. :src="
  122. autoUrl(
  123. baseUrl,
  124. getListKey(
  125. formData.ReviewImages,
  126. 'key',
  127. 'oneselfBackIdCard',
  128. 'value'
  129. )
  130. )
  131. "
  132. mode="aspectFit"
  133. />
  134. <image v-else src="../static/images/ghm.png" mode="aspectFit" />
  135. </view>
  136. <view class="upload-image__info text-center backgroundCustom">
  137. 点击拍摄/上传国徽面
  138. </view>
  139. </view>
  140. </view>
  141. <block v-if="relationTypeConf.relationTypeSlt == '2'">
  142. <view class="block-title font-bold require">请上传代办人身份证</view>
  143. <view class="white-panel display-flex__ac" style="gap: 20upx">
  144. <view
  145. class="upload-image__content"
  146. @click="uploadImage('agentFrontIdCard')"
  147. >
  148. <view
  149. class="upload-image__main display-flex__ac display-flex__jc"
  150. >
  151. <image
  152. v-if="
  153. getListKey(
  154. formData.ReviewImages,
  155. 'key',
  156. 'agentFrontIdCard',
  157. 'value'
  158. )
  159. "
  160. :src="
  161. autoUrl(
  162. baseUrl,
  163. getListKey(
  164. formData.ReviewImages,
  165. 'key',
  166. 'agentFrontIdCard',
  167. 'value'
  168. )
  169. )
  170. "
  171. mode="aspectFit"
  172. />
  173. <image
  174. v-else
  175. src="../static/images/rxm.png"
  176. mode="aspectFit"
  177. />
  178. </view>
  179. <view class="upload-image__info text-center backgroundCustom">
  180. 点击拍摄/上传人像面
  181. </view>
  182. </view>
  183. <view
  184. class="upload-image__content"
  185. @click="uploadImage('agentBackIdCard')"
  186. >
  187. <view
  188. class="upload-image__main display-flex__ac display-flex__jc"
  189. >
  190. <image
  191. v-if="
  192. getListKey(
  193. formData.ReviewImages,
  194. 'key',
  195. 'agentBackIdCard',
  196. 'value'
  197. )
  198. "
  199. :src="
  200. autoUrl(
  201. baseUrl,
  202. getListKey(
  203. formData.ReviewImages,
  204. 'key',
  205. 'agentBackIdCard',
  206. 'value'
  207. )
  208. )
  209. "
  210. mode="aspectFit"
  211. />
  212. <image
  213. v-else
  214. src="../static/images/ghm.png"
  215. mode="aspectFit"
  216. />
  217. </view>
  218. <view class="upload-image__info text-center backgroundCustom">
  219. 点击拍摄/上传国徽面
  220. </view>
  221. </view>
  222. </view>
  223. </block>
  224. <!-- 温馨提示 -->
  225. <view class="tip">
  226. <view class="tip-title text-color__dominant font-bold"
  227. >温馨提示</view
  228. >
  229. <view class="tip-content text-justify">
  230. <rich-text
  231. :nodes="
  232. getListKey(
  233. channelTypeList,
  234. 'value',
  235. formData.TransferType,
  236. 'tip'
  237. )
  238. "
  239. />
  240. </view>
  241. </view>
  242. </view>
  243. <view class="public_btn_con">
  244. <view class="public_btn backgroundCustom" @click="beforeSubmitForm"
  245. >退款申请</view
  246. >
  247. </view>
  248. </view>
  249. <!-- 信息确认 -->
  250. <view class="dialog_mask" v-if="confirmDialogVisible"></view>
  251. <view class="dialog" v-if="confirmDialogVisible">
  252. <view class="dialog_header">收款信息确认</view>
  253. <view class="dialog_main">
  254. <!-- 银行卡转账 -->
  255. <block v-if="formData.TransferType == 'Bank'">
  256. <view class="innerBox displayFlexLeft">
  257. <view class="input_tit">收款户名</view>
  258. <view class="input_con">{{ formData.HandlerReName }}</view>
  259. </view>
  260. <view class="innerBox displayFlexLeft">
  261. <view class="input_tit">收款银行</view>
  262. <view class="input_con">{{ formData.HanderReBankName }}</view>
  263. </view>
  264. <view class="innerBox displayFlexLeft">
  265. <view class="input_tit">开户银行</view>
  266. <view class="input_con">{{ formData.HandlerBankName }}</view>
  267. </view>
  268. <view class="innerBox displayFlexLeft">
  269. <view class="input_tit">银行卡号</view>
  270. <view class="input_con">{{ formData.RecAccNo }}</view>
  271. </view>
  272. </block>
  273. <!-- 支付宝转账 -->
  274. <block v-else-if="formData.TransferType == 'Zfb'">
  275. <view class="innerBox displayFlexLeft">
  276. <view class="input_tit">支付宝收款户名</view>
  277. <view class="input_con">{{ formData.HandlerReName }}</view>
  278. </view>
  279. <view class="innerBox display-flex__ac">
  280. <view class="input_tit">支付宝账号</view>
  281. <view class="input_con">{{ formData.RecAccNo }}</view>
  282. </view>
  283. </block>
  284. <!-- 微信转账 -->
  285. <block v-else-if="formData.TransferType == 'Wechat'">
  286. <view class="innerBox display-flex__ac">
  287. <!-- <view class="input_tit"></view> -->
  288. <view class="input_con">
  289. 请确认当前微信号实名和收款人姓名
  290. <text class="colorRed font-bold"
  291. >【{{ formData.HandlerReName }}】</text
  292. >
  293. 一致
  294. </view>
  295. </view>
  296. </block>
  297. </view>
  298. <view class="dialog_btnList">
  299. <view class="dialog_btn" @click="changeDialogVisible_info"
  300. >取消申请</view
  301. >
  302. <view class="dialog_btn dialog_btn_confirm" @click="submitForm"
  303. >继续申请</view
  304. >
  305. </view>
  306. </view>
  307. </view>
  308. </template>
  309. <script setup lang="ts">
  310. import { ref, reactive, onMounted, getCurrentInstance, nextTick } from "vue";
  311. import { onLoad, onShow } from "@dcloudio/uni-app";
  312. import { REQUEST_CONFIG } from '@/config';
  313. import { requestWithCancel } from "./singletonRequest";
  314. import { common } from '@/utils';
  315. import {
  316. refundRegisterNew,
  317. refundUpdate,
  318. sendVerificationCode_V3 as sendVerificationCodeApi,
  319. checkVerificationCode_V3 as checkVerificationCodeApi,
  320. getBankNameUrl,
  321. userConfirmAuth
  322. } from '@/pagesPatient/service/refund';
  323. import {
  324. channelType,
  325. relationType,
  326. form_basic,
  327. form_bank,
  328. form_wechat,
  329. form_zfb,
  330. } from "./formConfig";
  331. // Components
  332. import tabBar from "../components/tabBar/tabBar.vue";
  333. import gForm from "../components/form/index.vue";
  334. const app = getApp();
  335. // Refs
  336. const form_basic_ref = ref(null);
  337. const form_bank_ref = ref(null);
  338. const form_wechat_ref = ref(null);
  339. const form_zfb_ref = ref(null);
  340. // Data
  341. const baseUrl = ref(`${REQUEST_CONFIG.BASE_URL}`);
  342. const memberInfo = ref<any>({});
  343. const refundDetail = ref<any>({});
  344. const channelTypeList = ref(channelType);
  345. const relationTypeConf = reactive({
  346. relationTypeSlt: "1",
  347. relationTypeList: relationType,
  348. });
  349. // Form Configs (Reactive to allow modifications)
  350. const formConfig_basic_data = ref([...form_basic]);
  351. const formConfig_bank_data = ref([...form_bank]);
  352. const formConfig_wechat_data = ref([...form_wechat]);
  353. const formConfig_zfb_data = ref([...form_zfb]);
  354. // Expose configs for template
  355. const formConfig_basic = formConfig_basic_data;
  356. const formConfig_bank = formConfig_bank_data;
  357. const formConfig_wechat = formConfig_wechat_data;
  358. const formConfig_zfb = formConfig_zfb_data;
  359. const formData = ref<any>({
  360. MemberName: "",
  361. IdCardNo: "",
  362. RefundMoney: 0,
  363. HandlerMobile: "",
  364. TransferType: "Bank",
  365. HandlerReName: "",
  366. HanderReBankName: "",
  367. HandlerBankName: "",
  368. RecAccNo: "",
  369. ReviewImages: [],
  370. PatientId: [],
  371. // Internal fields
  372. HandlerMobile_pcId: "",
  373. HandlerMobile_code: "",
  374. });
  375. const confirmDialogVisible = ref(false);
  376. // Methods from WXS
  377. const autoUrl = (baseUrl: string, url: string) => {
  378. if (!url) return url;
  379. if (url.indexOf("http") !== -1) return url;
  380. return baseUrl + url;
  381. };
  382. const getListKey = (
  383. list: any[],
  384. searchKeyStr: string,
  385. val: any,
  386. keyStr: string
  387. ) => {
  388. if (!list || !list.length) return "";
  389. let str = "";
  390. for (let i = 0; i < list.length; i++) {
  391. if (list[i][searchKeyStr] == val) {
  392. str = list[i][keyStr] || "";
  393. break;
  394. }
  395. }
  396. return str;
  397. };
  398. // Lifecycle
  399. onLoad((options) => {
  400. initPageParam(options);
  401. initFormData();
  402. });
  403. // Methods
  404. const initPageParam = (options: any) => {
  405. const queryBean = app.globalData.queryBean;
  406. if (queryBean) {
  407. memberInfo.value = queryBean.memberInfo;
  408. refundDetail.value = queryBean.refundDetail;
  409. app.globalData.queryBean = null;
  410. }
  411. };
  412. const initFormData = () => {
  413. // Mount sendCodeApi implementation
  414. formConfig_basic.value?.forEach((item: any) => {
  415. if (item.type === "smsCode") {
  416. item.sendCodeApi = (phone: string) => sendVerificationCode_V3(phone);
  417. }
  418. });
  419. // Multi-card handling
  420. const cardList = refundDetail.value?.CardInfoList || [];
  421. if (cardList.length > 1) {
  422. formConfig_basic.value = formConfig_basic.value.filter(
  423. (item: any) => item.key != "CardNo"
  424. );
  425. }
  426. const newFormData: any = {
  427. MemberName: memberInfo.value.memberName,
  428. IdCardNo: memberInfo.value.certNum,
  429. HandlerMobile: refundDetail.value.CardInfoList?.[0]?.Mobile || "",
  430. RefundMoney: (Number(refundDetail.value.CanRefundSum) || 0) / 100,
  431. CardNo: cardList?.[0]?.CardNo || "",
  432. PatientId: refundDetail.value.PatientId,
  433. };
  434. // Fast fill (Edit mode)
  435. if (app.globalData.fastEditRefundFormData) {
  436. Object.assign(newFormData, app.globalData.fastEditRefundFormData);
  437. relationTypeConf.relationTypeSlt = newFormData.FilingType || "1";
  438. app.globalData.fastEditRefundFormData = null;
  439. }
  440. formData.value = Object.assign({}, formData.value, newFormData);
  441. // Status handling
  442. if (formData.value.Status == "0" || formData.value.Status == "1") {
  443. formConfig_basic.value.forEach((item: any) => {
  444. item.readOnly = true;
  445. if (item.type == "smsCode") {
  446. item.type = "input";
  447. }
  448. });
  449. }
  450. };
  451. const onFormSubmit = (e: any) => {
  452. // Not used in original code, but kept for compatibility
  453. // const { formData: val } = e;
  454. };
  455. const handleSubmit = () => {
  456. const componentConfigMap = [
  457. { formConfigName: "formConfig_basic", ref: form_basic_ref },
  458. ];
  459. if (formData.value.TransferType == "Bank") {
  460. componentConfigMap.push({
  461. formConfigName: "formConfig_bank",
  462. ref: form_bank_ref,
  463. });
  464. } else if (formData.value.TransferType == "Wechat") {
  465. componentConfigMap.push({
  466. formConfigName: "formConfig_wechat",
  467. ref: form_wechat_ref,
  468. });
  469. } else if (formData.value.TransferType == "Zfb") {
  470. componentConfigMap.push({
  471. formConfigName: "formConfig_zfb",
  472. ref: form_zfb_ref,
  473. });
  474. }
  475. let flag = true;
  476. for (const item of componentConfigMap) {
  477. // Check if config exists and has length (proxy for v-if)
  478. // In Vue, we check if ref is available
  479. const formComponent = item.ref.value;
  480. if (!formComponent) continue;
  481. formComponent.submitForm();
  482. if (formComponent.hasError) {
  483. flag = false;
  484. break;
  485. }
  486. }
  487. return flag;
  488. };
  489. const onErrorReport = (e: any) => {
  490. const { errorMsg } = e;
  491. common.throttle(() => {
  492. uni.showModal({
  493. title: "温馨提示",
  494. content: errorMsg,
  495. showCancel: false,
  496. });
  497. });
  498. };
  499. const onFormDataChange = async (e: any) => {
  500. const { formData: newFormData, target } = e;
  501. const [key, value] = Object.entries(target).flat() as [string, any];
  502. if (!key.includes("_")) {
  503. if (key === "TransferType") {
  504. if (value == "Wechat") {
  505. await requestMerchantTransfer().catch((err: any) => {
  506. common.showModal(err.message);
  507. newFormData[key] = formData.value[key];
  508. });
  509. }
  510. newFormData["RecAccNo"] = "";
  511. }
  512. formData.value = newFormData;
  513. if (key === "RecAccNo" && formData.value.TransferType === "Bank") {
  514. getBankName(target);
  515. }
  516. return;
  517. }
  518. const [baseKey, type] = key.split("_");
  519. if (type !== "phone") {
  520. formData.value = newFormData;
  521. return;
  522. }
  523. const target_pcId = formData.value[`${baseKey}_pcId`];
  524. if (!target_pcId || newFormData[key] == formData.value[key]) {
  525. formData.value = newFormData;
  526. return;
  527. }
  528. const modalSltRes = await uni.showModal({
  529. title: "温馨提示",
  530. content: "当前手机号已发送验证码,修改手机号需要重新发送,确认吗?",
  531. });
  532. if (modalSltRes.confirm) {
  533. newFormData[`${baseKey}_pcId`] = "";
  534. }
  535. if (modalSltRes.cancel) {
  536. newFormData[key] = formData.value[key];
  537. }
  538. formData.value = newFormData;
  539. };
  540. const onActionClick = (e: any) => {
  541. const { formData: newFormData, target } = e;
  542. const [key, value] = Object.entries(target).flat();
  543. console.info(
  544. `%c 【表单项目点击】 %c key:${key} value:${value} `,
  545. "padding: 2px 6px; border-radius: 3px 0 0 3px; color: #fff; background: #FF6699; font-weight: bold;",
  546. "padding: 2px 6px; border-radius: 0 3px 3px 0; color: #fff; background: #FF9999; font-weight: bold;"
  547. );
  548. };
  549. const onSmsCodeSendSuccess = (e: any) => {
  550. const { key, res } = e;
  551. formData.value[`${key}_pcId`] = res?.[0]?.pcId || "";
  552. common.showModal(`验证码发送成功`, () => {}, { title: "温馨提示" });
  553. console.log(`短信验证码组件 ${key} 发送成功`, res);
  554. };
  555. const onSmsCodeSendFail = (e: any) => {
  556. const { key, err } = e;
  557. formData.value[`${key}_pcId`] = "";
  558. common.showModal(
  559. `验证码发送失败,原因:${err.message}`,
  560. () => {},
  561. { title: "温馨提示" }
  562. );
  563. console.log(`短信验证码组件 ${key} 发送失败`, err);
  564. };
  565. const beforeSubmitForm = async () => {
  566. if (!handleSubmit()) {
  567. return;
  568. }
  569. try {
  570. if (
  571. formConfig_bank.value.length &&
  572. relationTypeConf.relationTypeSlt == "1" &&
  573. formData.value.MemberName != formData.value.HandlerReName
  574. ) {
  575. const modalSltRes = await uni.showModal({
  576. title: "温馨提示",
  577. content: "收款户名与就诊人姓名不一致,是否切换为建议代办办理?",
  578. });
  579. if (modalSltRes.confirm) {
  580. relationTypeConf.relationTypeSlt = "2";
  581. return;
  582. }
  583. if (modalSltRes.cancel) {
  584. throw new Error("本人办理模式下收款户名必须与就诊人姓名一致");
  585. }
  586. }
  587. await checkUploadImage();
  588. changeDialogVisible_info();
  589. } catch (err: any) {
  590. common.showModal(err.message);
  591. }
  592. };
  593. const submitForm = async () => {
  594. changeDialogVisible_info();
  595. try {
  596. if (formData.value.TransferType === "Wechat") {
  597. await requestMerchantTransfer();
  598. }
  599. if (formData.value.Status === undefined || formData.value.Status == "3") {
  600. await checkVerificationCode_V3(
  601. formData.value.HandlerMobile_pcId,
  602. formData.value.HandlerMobile_code
  603. );
  604. }
  605. const reqData = {
  606. ...formData.value,
  607. BaseMemberEncryptionStore: memberInfo.value.baseMemberEncryptionStore,
  608. FilingType: relationTypeConf.relationTypeSlt,
  609. CardList: refundDetail.value.CardInfoList || formData.value.CardList,
  610. HandlerMobile: formData.value.HandlerMobile_phone,
  611. ReviewImages: formData.value.ReviewImages?.map((item: any) => ({
  612. ...item,
  613. value: `${baseUrl.value}${item.value}`,
  614. })),
  615. RecAccNo:
  616. formData.value.TransferType == "Wechat"
  617. ? uni.getStorageSync("smallProOpenId")
  618. : formData.value.RecAccNo,
  619. };
  620. let reqFunc = refundRegisterNew;
  621. if (formData.value.Status == "0" || formData.value.Status == "1") {
  622. reqFunc = refundUpdate;
  623. }
  624. const { resData, resp } = await reqFunc(reqData);
  625. if (resData.RespCode != "10000") {
  626. throw new Error(resData.RespMessage || `申请失败,请重试`);
  627. }
  628. if (resp.length > 0) {
  629. common.showModal(
  630. resp
  631. .map((cardInfo: any) => `${cardInfo.CardNo}:${cardInfo.ErrorMsg}`)
  632. .join("\n")
  633. );
  634. return;
  635. }
  636. common.goToUrl(
  637. `/pagesPatient/st1/business/outpatient/outpatientRefundNew/refundResult/refundResult`
  638. );
  639. } catch (err: any) {
  640. common.showModal(err.message);
  641. }
  642. };
  643. const uploadImage = async (key: string) => {
  644. try {
  645. const path = await chooseImage();
  646. const uploadRes: any = await upload(path.tempFiles[0].tempFilePath);
  647. if (uploadRes.RespCode != "10000") {
  648. common.showModal(`图片上传失败,请重试`);
  649. return;
  650. }
  651. const url = `${uploadRes.url.replace(/\\/g, "/")}`;
  652. const target = formData.value.ReviewImages.find(
  653. (item: any) => item.key == key
  654. );
  655. if (target) {
  656. target.value = url;
  657. } else {
  658. formData.value.ReviewImages.push({
  659. key: key,
  660. value: url,
  661. });
  662. }
  663. } catch (e) {
  664. // Handle error
  665. }
  666. };
  667. const checkUploadImage = async () => {
  668. const imageKeyList = [
  669. { key: "oneselfFrontIdCard", text: "就诊人身份证人像面" },
  670. { key: "oneselfBackIdCard", text: "就诊人身份证国徽面" },
  671. ];
  672. if (relationTypeConf.relationTypeSlt == "2") {
  673. imageKeyList.push({ key: "agentFrontIdCard", text: "代办人身份证人像面" });
  674. imageKeyList.push({ key: "agentBackIdCard", text: "代办人身份证国徽面" });
  675. }
  676. const target = imageKeyList.find(
  677. (item) => !formData.value.ReviewImages.map((i: any) => i.key).includes(item.key)
  678. );
  679. if (target) {
  680. throw new Error(`请上传【${target.text}】` || `存在未上传的图片,请检查`);
  681. }
  682. };
  683. const chooseImage = async () => {
  684. const res = await uni.chooseMedia({
  685. count: 1,
  686. sourceType: ["album", "camera"],
  687. sizeType: ["compressed"],
  688. });
  689. return res;
  690. };
  691. const upload = (path: string) => {
  692. return new Promise((resolve, reject) => {
  693. common.showLoading();
  694. uni.uploadFile({
  695. url: `${REQUEST_CONFIG.BASE_URL}upload/uploadFileAndWatermark.do`,
  696. filePath: path,
  697. name: "newsFile",
  698. formData: {
  699. user: "test",
  700. watermarkText: "照片仅用于退款审核",
  701. },
  702. header: {
  703. token: uni.getStorageSync("token"),
  704. },
  705. success: (res) => resolve(JSON.parse(res.data)),
  706. fail: (err) => reject(err),
  707. complete: () => common.hideLoading(),
  708. });
  709. });
  710. };
  711. const sendVerificationCode_V3 = async (mobile: string) => {
  712. const reqData = { mobile };
  713. const { resData, resp } = await sendVerificationCodeApi(reqData, {
  714. showModal: false,
  715. });
  716. if (resData.RespCode != "10000") {
  717. throw new Error(resData.RespMessage);
  718. }
  719. return resp;
  720. };
  721. const checkVerificationCode_V3 = async (pcId: string, code: string) => {
  722. if (!pcId) {
  723. throw new Error("请先发送验证码");
  724. }
  725. const reqData = {
  726. pcId: pcId,
  727. verificationCode: code,
  728. };
  729. const { resData, resp } = await checkVerificationCodeApi(reqData, {
  730. showModal: false,
  731. });
  732. if (resData.RespCode != "10000") {
  733. throw new Error(resData.RespMessage || "验证码校验失败");
  734. }
  735. };
  736. const tabClick = (e: any) => {
  737. const { value } = e;
  738. relationTypeConf.relationTypeSlt = value;
  739. };
  740. const changeDialogVisible_info = () => {
  741. confirmDialogVisible.value = !confirmDialogVisible.value;
  742. };
  743. const getBankName = async (target: any = {}) => {
  744. const res = await requestWithCancel({
  745. url: getBankNameUrl,
  746. data: {
  747. ...target,
  748. HandlerBankCardNo: target["RecAccNo"],
  749. },
  750. });
  751. const resData = res.data;
  752. const resp = resData.Data || [];
  753. if (resData.RespCode != "10000" || !resp.length) {
  754. return;
  755. }
  756. formData.value.HanderReBankName = resp[0].BankName;
  757. };
  758. const requestMerchantTransfer = async () => {
  759. // #ifdef MP-WEIXIN
  760. if (!wx.canIUse("requestMerchantTransfer")) {
  761. throw new Error(
  762. `您的微信版本过低,无法使用微信转账退款,请更换转账方式或更新微信至最新版本。`
  763. );
  764. }
  765. const reqData = {
  766. UserDisplayName: "预交金退费",
  767. OperatorId: uni.getStorageSync("smallProOpenId"),
  768. };
  769. const { resData, resp } = await userConfirmAuth(reqData, {
  770. showModal: false,
  771. });
  772. if (resData.RespCode != "10000" || common.isEmpty(resp)) {
  773. throw new Error(`${resData.RespMessage}` || "获取微信退款授权配置失败");
  774. }
  775. if (common.isEmpty(resp)) {
  776. return;
  777. }
  778. const merchantTransferConfig = resp[0] || {};
  779. return new Promise((resolve, reject) => {
  780. wx.requestMerchantTransfer({
  781. mchId: merchantTransferConfig.MchId,
  782. appId: uni.getAccountInfoSync().miniProgram.appId,
  783. package: merchantTransferConfig.PackageInfo,
  784. openId: uni.getStorageSync("smallProOpenId"),
  785. success: (res) => {
  786. console.log("success:", res);
  787. resolve(res);
  788. },
  789. fail: (res) => {
  790. console.log("fail:", res);
  791. reject(res);
  792. },
  793. });
  794. });
  795. // #endif
  796. };
  797. </script>
  798. <style scoped>
  799. @import "../static/css/refund.css";
  800. .container {
  801. }
  802. .content {
  803. padding: 0upx 30upx 200upx;
  804. }
  805. /* 块标题 start */
  806. .block-title {
  807. position: relative;
  808. font-size: 32upx;
  809. padding: 0 26upx;
  810. margin: 20upx 0;
  811. }
  812. .require::after {
  813. content: "*";
  814. position: absolute;
  815. color: #ff1d1f;
  816. top: 10%;
  817. left: 0;
  818. }
  819. /* 块标题 end */
  820. /* 办理类型 start */
  821. .channel-type__selector {
  822. position: relative;
  823. height: 100upx;
  824. line-height: 100upx;
  825. overflow: hidden;
  826. }
  827. .channel-type__tag {
  828. height: inherit;
  829. line-height: inherit;
  830. font-size: 32upx;
  831. flex: 1 0 0;
  832. z-index: 9;
  833. transition: all 0.3s ease-in-out;
  834. }
  835. .channel-type__tag.active {
  836. color: #fff;
  837. }
  838. .channel-type__block {
  839. position: absolute;
  840. height: 100%;
  841. z-index: 1;
  842. border-radius: 24upx;
  843. transition: all 0.3s ease-in-out;
  844. }
  845. /* 办理类型 end */
  846. /* 图片上传 start */
  847. .upload-image__content {
  848. flex: 1 0 0;
  849. height: 240upx;
  850. display: flex;
  851. flex-direction: column;
  852. border-radius: 12upx;
  853. overflow: hidden;
  854. background-color: #eff1f5;
  855. }
  856. .upload-image__content .upload-image__main {
  857. flex: 1 0 0;
  858. padding: 20upx 20upx;
  859. height: 100%;
  860. }
  861. .upload-image__content .upload-image__info {
  862. height: 60upx;
  863. line-height: 60upx;
  864. }
  865. /* 图片上传end */
  866. /* 提示 start */
  867. .tip {
  868. margin-top: 40upx;
  869. }
  870. .tip .tip-title {
  871. font-size: 32upx;
  872. }
  873. .tip .tip-content {
  874. margin-top: 20upx;
  875. font-size: 28upx;
  876. color: #61616d;
  877. line-height: 50upx;
  878. }
  879. /* 提示 end */
  880. /* 信息确认弹窗 start */
  881. .dialog_mask {
  882. width: 100%;
  883. height: 100%;
  884. background: rgba(0, 0, 0, 0.6);
  885. position: fixed;
  886. top: 0;
  887. left: 0;
  888. z-index: 20;
  889. }
  890. .dialog {
  891. background: #ffffff;
  892. border-radius: 30upx;
  893. width: 90%;
  894. position: fixed;
  895. top: 50%;
  896. left: 50%;
  897. transform: translate(-50%, -50%);
  898. z-index: 25;
  899. }
  900. .dialog_header {
  901. position: relative;
  902. padding: 40upx 30upx 30upx;
  903. font-size: 36upx;
  904. font-weight: 500;
  905. color: #000000;
  906. text-align: center;
  907. }
  908. .dialog_main {
  909. padding: 20upx 48upx;
  910. }
  911. .dialog_main .innerBox {
  912. height: 40upx;
  913. line-height: 40upx;
  914. font-size: 32upx;
  915. }
  916. .dialog_main .innerBox + .innerBox {
  917. margin-top: 30upx;
  918. }
  919. .dialog_main .input_tit,
  920. .dialog_main .input_con {
  921. height: inherit;
  922. line-height: inherit;
  923. }
  924. .dialog_main .input_tit {
  925. min-width: 160upx;
  926. width: 28%;
  927. color: #333;
  928. }
  929. .dialog_main .input_con {
  930. flex: 1 0 0;
  931. padding: 0 20upx;
  932. }
  933. .dialog_btnList {
  934. padding: 20upx 30upx 20upx;
  935. display: flex;
  936. justify-content: space-between;
  937. align-items: center;
  938. gap: 20upx;
  939. }
  940. .dialog_btn {
  941. width: 100%;
  942. height: 90upx;
  943. border-radius: 9999999upx;
  944. font-size: 34upx;
  945. line-height: 90upx;
  946. text-align: center;
  947. background-color: #d9d9d9;
  948. color: #fff;
  949. }
  950. .dialog_btn.dialog_btn_confirm {
  951. background: var(--dominantColor) !important;
  952. color: #fff !important;
  953. }
  954. /* 信息确认弹窗 end */
  955. /* 覆盖 */
  956. .public_btn_con {
  957. background-color: #fff;
  958. z-index: 9;
  959. }
  960. .display-flex__ac {
  961. display: flex;
  962. align-items: center;
  963. }
  964. .display-flex__jc {
  965. display: flex;
  966. justify-content: center;
  967. }
  968. .displayFlexLeft {
  969. display: flex;
  970. justify-content: flex-start;
  971. align-items: center;
  972. }
  973. .text-center {
  974. text-align: center;
  975. }
  976. .font-bold {
  977. font-weight: bold;
  978. }
  979. .no-padding {
  980. padding: 0 !important;
  981. }
  982. .backgroundCustom {
  983. background: var(--dominantColor) !important;
  984. color: #fff !important;
  985. }
  986. .text-color__dominant {
  987. color: var(--dominantColor);
  988. }
  989. </style>