refundForm.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  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-elif="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-elif="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/requestConfig";
  313. import refund from "../config/api";
  314. import { REQUEST_CONFIG } from '@/config';
  315. import { requestWithCancel } from "./singletonRequest";
  316. import common from "@/utils/common";
  317. import {
  318. channelType,
  319. relationType,
  320. form_basic,
  321. form_bank,
  322. form_wechat,
  323. form_zfb,
  324. } from "./formConfig";
  325. // Components
  326. import tabBar from "../components/tabBar/tabBar.vue";
  327. import gForm from "../components/form/index.vue";
  328. const app = getApp();
  329. // Refs
  330. const form_basic_ref = ref(null);
  331. const form_bank_ref = ref(null);
  332. const form_wechat_ref = ref(null);
  333. const form_zfb_ref = ref(null);
  334. // Data
  335. const baseUrl = ref(`${REQUEST_CONFIG.BASE_URL}`);
  336. const memberInfo = ref<any>({});
  337. const refundDetail = ref<any>({});
  338. const channelTypeList = ref(channelType);
  339. const relationTypeConf = reactive({
  340. relationTypeSlt: "1",
  341. relationTypeList: relationType,
  342. });
  343. // Form Configs (Reactive to allow modifications)
  344. const formConfig_basic_data = ref([...form_basic]);
  345. const formConfig_bank_data = ref([...form_bank]);
  346. const formConfig_wechat_data = ref([...form_wechat]);
  347. const formConfig_zfb_data = ref([...form_zfb]);
  348. // Expose configs for template
  349. const formConfig_basic = formConfig_basic_data;
  350. const formConfig_bank = formConfig_bank_data;
  351. const formConfig_wechat = formConfig_wechat_data;
  352. const formConfig_zfb = formConfig_zfb_data;
  353. const formData = ref<any>({
  354. MemberName: "",
  355. IdCardNo: "",
  356. RefundMoney: 0,
  357. HandlerMobile: "",
  358. TransferType: "Bank",
  359. HandlerReName: "",
  360. HanderReBankName: "",
  361. HandlerBankName: "",
  362. RecAccNo: "",
  363. ReviewImages: [],
  364. PatientId: [],
  365. // Internal fields
  366. HandlerMobile_pcId: "",
  367. HandlerMobile_code: "",
  368. });
  369. const confirmDialogVisible = ref(false);
  370. // Methods from WXS
  371. const autoUrl = (baseUrl: string, url: string) => {
  372. if (!url) return url;
  373. if (url.indexOf("http") !== -1) return url;
  374. return baseUrl + url;
  375. };
  376. const getListKey = (
  377. list: any[],
  378. searchKeyStr: string,
  379. val: any,
  380. keyStr: string
  381. ) => {
  382. if (!list || !list.length) return "";
  383. let str = "";
  384. for (let i = 0; i < list.length; i++) {
  385. if (list[i][searchKeyStr] == val) {
  386. str = list[i][keyStr] || "";
  387. break;
  388. }
  389. }
  390. return str;
  391. };
  392. // Lifecycle
  393. onLoad((options) => {
  394. initPageParam(options);
  395. initFormData();
  396. });
  397. // Methods
  398. const initPageParam = (options: any) => {
  399. const queryBean = app.globalData.queryBean;
  400. if (queryBean) {
  401. memberInfo.value = queryBean.memberInfo;
  402. refundDetail.value = queryBean.refundDetail;
  403. app.globalData.queryBean = null;
  404. }
  405. };
  406. const initFormData = () => {
  407. // Mount sendCodeApi implementation
  408. formConfig_basic.value?.forEach((item: any) => {
  409. if (item.type === "smsCode") {
  410. item.sendCodeApi = (phone: string) => sendVerificationCode_V3(phone);
  411. }
  412. });
  413. // Multi-card handling
  414. const cardList = refundDetail.value?.CardInfoList || [];
  415. if (cardList.length > 1) {
  416. formConfig_basic.value = formConfig_basic.value.filter(
  417. (item: any) => item.key != "CardNo"
  418. );
  419. }
  420. const newFormData: any = {
  421. MemberName: memberInfo.value.memberName,
  422. IdCardNo: memberInfo.value.certNum,
  423. HandlerMobile: refundDetail.value.CardInfoList?.[0]?.Mobile || "",
  424. RefundMoney: (Number(refundDetail.value.CanRefundSum) || 0) / 100,
  425. CardNo: cardList?.[0]?.CardNo || "",
  426. PatientId: refundDetail.value.PatientId,
  427. };
  428. // Fast fill (Edit mode)
  429. if (app.globalData.fastEditRefundFormData) {
  430. Object.assign(newFormData, app.globalData.fastEditRefundFormData);
  431. relationTypeConf.relationTypeSlt = newFormData.FilingType || "1";
  432. app.globalData.fastEditRefundFormData = null;
  433. }
  434. formData.value = Object.assign({}, formData.value, newFormData);
  435. // Status handling
  436. if (formData.value.Status == "0" || formData.value.Status == "1") {
  437. formConfig_basic.value.forEach((item: any) => {
  438. item.readOnly = true;
  439. if (item.type == "smsCode") {
  440. item.type = "input";
  441. }
  442. });
  443. }
  444. };
  445. const onFormSubmit = (e: any) => {
  446. // Not used in original code, but kept for compatibility
  447. // const { formData: val } = e;
  448. };
  449. const handleSubmit = () => {
  450. const componentConfigMap = [
  451. { formConfigName: "formConfig_basic", ref: form_basic_ref },
  452. ];
  453. if (formData.value.TransferType == "Bank") {
  454. componentConfigMap.push({
  455. formConfigName: "formConfig_bank",
  456. ref: form_bank_ref,
  457. });
  458. } else if (formData.value.TransferType == "Wechat") {
  459. componentConfigMap.push({
  460. formConfigName: "formConfig_wechat",
  461. ref: form_wechat_ref,
  462. });
  463. } else if (formData.value.TransferType == "Zfb") {
  464. componentConfigMap.push({
  465. formConfigName: "formConfig_zfb",
  466. ref: form_zfb_ref,
  467. });
  468. }
  469. let flag = true;
  470. for (const item of componentConfigMap) {
  471. // Check if config exists and has length (proxy for v-if)
  472. // In Vue, we check if ref is available
  473. const formComponent = item.ref.value;
  474. if (!formComponent) continue;
  475. formComponent.submitForm();
  476. if (formComponent.hasError) {
  477. flag = false;
  478. break;
  479. }
  480. }
  481. return flag;
  482. };
  483. const onErrorReport = (e: any) => {
  484. const { errorMsg } = e;
  485. common.throttle(() => {
  486. uni.showModal({
  487. title: "温馨提示",
  488. content: errorMsg,
  489. showCancel: false,
  490. });
  491. });
  492. };
  493. const onFormDataChange = async (e: any) => {
  494. const { formData: newFormData, target } = e;
  495. const [key, value] = Object.entries(target).flat() as [string, any];
  496. if (!key.includes("_")) {
  497. if (key === "TransferType") {
  498. if (value == "Wechat") {
  499. await requestMerchantTransfer().catch((err: any) => {
  500. common.showModal(err.message);
  501. newFormData[key] = formData.value[key];
  502. });
  503. }
  504. newFormData["RecAccNo"] = "";
  505. }
  506. formData.value = newFormData;
  507. if (key === "RecAccNo" && formData.value.TransferType === "Bank") {
  508. getBankName(target);
  509. }
  510. return;
  511. }
  512. const [baseKey, type] = key.split("_");
  513. if (type !== "phone") {
  514. formData.value = newFormData;
  515. return;
  516. }
  517. const target_pcId = formData.value[`${baseKey}_pcId`];
  518. if (!target_pcId || newFormData[key] == formData.value[key]) {
  519. formData.value = newFormData;
  520. return;
  521. }
  522. const modalSltRes = await uni.showModal({
  523. title: "温馨提示",
  524. content: "当前手机号已发送验证码,修改手机号需要重新发送,确认吗?",
  525. });
  526. if (modalSltRes.confirm) {
  527. newFormData[`${baseKey}_pcId`] = "";
  528. }
  529. if (modalSltRes.cancel) {
  530. newFormData[key] = formData.value[key];
  531. }
  532. formData.value = newFormData;
  533. };
  534. const onActionClick = (e: any) => {
  535. const { formData: newFormData, target } = e;
  536. const [key, value] = Object.entries(target).flat();
  537. console.info(
  538. `%c 【表单项目点击】 %c key:${key} value:${value} `,
  539. "padding: 2px 6px; border-radius: 3px 0 0 3px; color: #fff; background: #FF6699; font-weight: bold;",
  540. "padding: 2px 6px; border-radius: 0 3px 3px 0; color: #fff; background: #FF9999; font-weight: bold;"
  541. );
  542. };
  543. const onSmsCodeSendSuccess = (e: any) => {
  544. const { key, res } = e;
  545. formData.value[`${key}_pcId`] = res?.[0]?.pcId || "";
  546. common.showModal(`验证码发送成功`, () => {}, { title: "温馨提示" });
  547. console.log(`短信验证码组件 ${key} 发送成功`, res);
  548. };
  549. const onSmsCodeSendFail = (e: any) => {
  550. const { key, err } = e;
  551. formData.value[`${key}_pcId`] = "";
  552. common.showModal(
  553. `验证码发送失败,原因:${err.message}`,
  554. () => {},
  555. { title: "温馨提示" }
  556. );
  557. console.log(`短信验证码组件 ${key} 发送失败`, err);
  558. };
  559. const beforeSubmitForm = async () => {
  560. if (!handleSubmit()) {
  561. return;
  562. }
  563. try {
  564. if (
  565. formConfig_bank.value.length &&
  566. relationTypeConf.relationTypeSlt == "1" &&
  567. formData.value.MemberName != formData.value.HandlerReName
  568. ) {
  569. const modalSltRes = await uni.showModal({
  570. title: "温馨提示",
  571. content: "收款户名与就诊人姓名不一致,是否切换为建议代办办理?",
  572. });
  573. if (modalSltRes.confirm) {
  574. relationTypeConf.relationTypeSlt = "2";
  575. return;
  576. }
  577. if (modalSltRes.cancel) {
  578. throw new Error("本人办理模式下收款户名必须与就诊人姓名一致");
  579. }
  580. }
  581. await checkUploadImage();
  582. changeDialogVisible_info();
  583. } catch (err: any) {
  584. common.showModal(err.message);
  585. }
  586. };
  587. const submitForm = async () => {
  588. changeDialogVisible_info();
  589. try {
  590. if (formData.value.TransferType === "Wechat") {
  591. await requestMerchantTransfer();
  592. }
  593. if (formData.value.Status === undefined || formData.value.Status == "3") {
  594. await checkVerificationCode_V3(
  595. formData.value.HandlerMobile_pcId,
  596. formData.value.HandlerMobile_code
  597. );
  598. }
  599. const reqData = {
  600. ...formData.value,
  601. BaseMemberEncryptionStore: memberInfo.value.baseMemberEncryptionStore,
  602. FilingType: relationTypeConf.relationTypeSlt,
  603. CardList: refundDetail.value.CardInfoList || formData.value.CardList,
  604. HandlerMobile: formData.value.HandlerMobile_phone,
  605. ReviewImages: formData.value.ReviewImages?.map((item: any) => ({
  606. ...item,
  607. value: `${baseUrl.value}${item.value}`,
  608. })),
  609. RecAccNo:
  610. formData.value.TransferType == "Wechat"
  611. ? uni.getStorageSync("smallProOpenId")
  612. : formData.value.RecAccNo,
  613. };
  614. let reqFunc = refund.RefundRegisterNew;
  615. if (formData.value.Status == "0" || formData.value.Status == "1") {
  616. reqFunc = refund.refundUpdate;
  617. }
  618. const { resData, resp } = await reqFunc(reqData);
  619. if (resData.RespCode != "10000") {
  620. throw new Error(resData.RespMessage || `申请失败,请重试`);
  621. }
  622. if (resp.length > 0) {
  623. common.showModal(
  624. resp
  625. .map((cardInfo: any) => `${cardInfo.CardNo}:${cardInfo.ErrorMsg}`)
  626. .join("\n")
  627. );
  628. return;
  629. }
  630. common.goToUrl(
  631. `/pagesPatient/st1/business/outpatient/outpatientRefundNew/refundResult/refundResult`
  632. );
  633. } catch (err: any) {
  634. common.showModal(err.message);
  635. }
  636. };
  637. const uploadImage = async (key: string) => {
  638. try {
  639. const path = await chooseImage();
  640. const uploadRes: any = await upload(path.tempFiles[0].tempFilePath);
  641. if (uploadRes.RespCode != "10000") {
  642. common.showModal(`图片上传失败,请重试`);
  643. return;
  644. }
  645. const url = `${uploadRes.url.replace(/\\/g, "/")}`;
  646. const target = formData.value.ReviewImages.find(
  647. (item: any) => item.key == key
  648. );
  649. if (target) {
  650. target.value = url;
  651. } else {
  652. formData.value.ReviewImages.push({
  653. key: key,
  654. value: url,
  655. });
  656. }
  657. } catch (e) {
  658. // Handle error
  659. }
  660. };
  661. const checkUploadImage = async () => {
  662. const imageKeyList = [
  663. { key: "oneselfFrontIdCard", text: "就诊人身份证人像面" },
  664. { key: "oneselfBackIdCard", text: "就诊人身份证国徽面" },
  665. ];
  666. if (relationTypeConf.relationTypeSlt == "2") {
  667. imageKeyList.push({ key: "agentFrontIdCard", text: "代办人身份证人像面" });
  668. imageKeyList.push({ key: "agentBackIdCard", text: "代办人身份证国徽面" });
  669. }
  670. const target = imageKeyList.find(
  671. (item) => !formData.value.ReviewImages.map((i: any) => i.key).includes(item.key)
  672. );
  673. if (target) {
  674. throw new Error(`请上传【${target.text}】` || `存在未上传的图片,请检查`);
  675. }
  676. };
  677. const chooseImage = async () => {
  678. const res = await uni.chooseMedia({
  679. count: 1,
  680. sourceType: ["album", "camera"],
  681. sizeType: ["compressed"],
  682. });
  683. return res;
  684. };
  685. const upload = (path: string) => {
  686. return new Promise((resolve, reject) => {
  687. common.showLoading();
  688. uni.uploadFile({
  689. url: `${REQUEST_CONFIG.BASE_URL}upload/uploadFileAndWatermark.do`,
  690. filePath: path,
  691. name: "newsFile",
  692. formData: {
  693. user: "test",
  694. watermarkText: "照片仅用于退款审核",
  695. },
  696. header: {
  697. token: uni.getStorageSync("token"),
  698. },
  699. success: (res) => resolve(JSON.parse(res.data)),
  700. fail: (err) => reject(err),
  701. complete: () => common.hideLoading(),
  702. });
  703. });
  704. };
  705. const sendVerificationCode_V3 = async (mobile: string) => {
  706. const reqData = { mobile };
  707. const { resData, resp } = await refund.sendVerificationCode_V3(reqData, {
  708. showModal: false,
  709. });
  710. if (resData.RespCode != "10000") {
  711. throw new Error(resData.RespMessage);
  712. }
  713. return resp;
  714. };
  715. const checkVerificationCode_V3 = async (pcId: string, code: string) => {
  716. if (!pcId) {
  717. throw new Error("请先发送验证码");
  718. }
  719. const reqData = {
  720. pcId: pcId,
  721. verificationCode: code,
  722. };
  723. const { resData, resp } = await refund.checkVerificationCode_V3(reqData, {
  724. showModal: false,
  725. });
  726. if (resData.RespCode != "10000") {
  727. throw new Error(resData.RespMessage || "验证码校验失败");
  728. }
  729. };
  730. const tabClick = (e: any) => {
  731. const { value } = e;
  732. relationTypeConf.relationTypeSlt = value;
  733. };
  734. const changeDialogVisible_info = () => {
  735. confirmDialogVisible.value = !confirmDialogVisible.value;
  736. };
  737. const getBankName = async (target: any = {}) => {
  738. const res = await requestWithCancel({
  739. url: refund.getBankNameApiUrl(),
  740. data: {
  741. ...target,
  742. HandlerBankCardNo: target["RecAccNo"],
  743. },
  744. });
  745. const resData = res.data;
  746. const resp = resData.Data || [];
  747. if (resData.RespCode != "10000" || !resp.length) {
  748. return;
  749. }
  750. formData.value.HanderReBankName = resp[0].BankName;
  751. };
  752. const requestMerchantTransfer = async () => {
  753. // #ifdef MP-WEIXIN
  754. if (!wx.canIUse("requestMerchantTransfer")) {
  755. throw new Error(
  756. `您的微信版本过低,无法使用微信转账退款,请更换转账方式或更新微信至最新版本。`
  757. );
  758. }
  759. const reqData = {
  760. UserDisplayName: "预交金退费",
  761. OperatorId: uni.getStorageSync("smallProOpenId"),
  762. };
  763. const { resData, resp } = await refund.userConfirmAuth(reqData, {
  764. showModal: false,
  765. });
  766. if (resData.RespCode != "10000" || common.isEmpty(resp)) {
  767. throw new Error(`${resData.RespMessage}` || "获取微信退款授权配置失败");
  768. }
  769. if (common.isEmpty(resp)) {
  770. return;
  771. }
  772. const merchantTransferConfig = resp[0] || {};
  773. return new Promise((resolve, reject) => {
  774. wx.requestMerchantTransfer({
  775. mchId: merchantTransferConfig.MchId,
  776. appId: uni.getAccountInfoSync().miniProgram.appId,
  777. package: merchantTransferConfig.PackageInfo,
  778. openId: uni.getStorageSync("smallProOpenId"),
  779. success: (res) => {
  780. console.log("success:", res);
  781. resolve(res);
  782. },
  783. fail: (res) => {
  784. console.log("fail:", res);
  785. reject(res);
  786. },
  787. });
  788. });
  789. // #endif
  790. };
  791. </script>
  792. <style scoped>
  793. @import "../static/css/refund.wxss";
  794. .container {
  795. }
  796. .content {
  797. padding: 0upx 30upx 200upx;
  798. }
  799. /* 块标题 start */
  800. .block-title {
  801. position: relative;
  802. font-size: 32upx;
  803. padding: 0 26upx;
  804. margin: 20upx 0;
  805. }
  806. .require::after {
  807. content: "*";
  808. position: absolute;
  809. color: #ff1d1f;
  810. top: 10%;
  811. left: 0;
  812. }
  813. /* 块标题 end */
  814. /* 办理类型 start */
  815. .channel-type__selector {
  816. position: relative;
  817. height: 100upx;
  818. line-height: 100upx;
  819. overflow: hidden;
  820. }
  821. .channel-type__tag {
  822. height: inherit;
  823. line-height: inherit;
  824. font-size: 32upx;
  825. flex: 1 0 0;
  826. z-index: 9;
  827. transition: all 0.3s ease-in-out;
  828. }
  829. .channel-type__tag.active {
  830. color: #fff;
  831. }
  832. .channel-type__block {
  833. position: absolute;
  834. height: 100%;
  835. z-index: 1;
  836. border-radius: 24upx;
  837. transition: all 0.3s ease-in-out;
  838. }
  839. /* 办理类型 end */
  840. /* 图片上传 start */
  841. .upload-image__content {
  842. flex: 1 0 0;
  843. height: 240upx;
  844. display: flex;
  845. flex-direction: column;
  846. border-radius: 12upx;
  847. overflow: hidden;
  848. background-color: #eff1f5;
  849. }
  850. .upload-image__content .upload-image__main {
  851. flex: 1 0 0;
  852. padding: 20upx 20upx;
  853. height: 100%;
  854. }
  855. .upload-image__content .upload-image__info {
  856. height: 60upx;
  857. line-height: 60upx;
  858. }
  859. /* 图片上传end */
  860. /* 提示 start */
  861. .tip {
  862. margin-top: 40upx;
  863. }
  864. .tip .tip-title {
  865. font-size: 32upx;
  866. }
  867. .tip .tip-content {
  868. margin-top: 20upx;
  869. font-size: 28upx;
  870. color: #61616d;
  871. line-height: 50upx;
  872. }
  873. /* 提示 end */
  874. /* 信息确认弹窗 start */
  875. .dialog_mask {
  876. width: 100%;
  877. height: 100%;
  878. background: rgba(0, 0, 0, 0.6);
  879. position: fixed;
  880. top: 0;
  881. left: 0;
  882. z-index: 20;
  883. }
  884. .dialog {
  885. background: #ffffff;
  886. border-radius: 30upx;
  887. width: 90%;
  888. position: fixed;
  889. top: 50%;
  890. left: 50%;
  891. transform: translate(-50%, -50%);
  892. z-index: 25;
  893. }
  894. .dialog_header {
  895. position: relative;
  896. padding: 40upx 30upx 30upx;
  897. font-size: 36upx;
  898. font-weight: 500;
  899. color: #000000;
  900. text-align: center;
  901. }
  902. .dialog_main {
  903. padding: 20upx 48upx;
  904. }
  905. .dialog_main .innerBox {
  906. height: 40upx;
  907. line-height: 40upx;
  908. font-size: 32upx;
  909. }
  910. .dialog_main .innerBox + .innerBox {
  911. margin-top: 30upx;
  912. }
  913. .dialog_main .input_tit,
  914. .dialog_main .input_con {
  915. height: inherit;
  916. line-height: inherit;
  917. }
  918. .dialog_main .input_tit {
  919. min-width: 160upx;
  920. width: 28%;
  921. color: #333;
  922. }
  923. .dialog_main .input_con {
  924. flex: 1 0 0;
  925. padding: 0 20upx;
  926. }
  927. .dialog_btnList {
  928. padding: 20upx 30upx 20upx;
  929. display: flex;
  930. justify-content: space-between;
  931. align-items: center;
  932. gap: 20upx;
  933. }
  934. .dialog_btn {
  935. width: 100%;
  936. height: 90upx;
  937. border-radius: 9999999upx;
  938. font-size: 34upx;
  939. line-height: 90upx;
  940. text-align: center;
  941. background-color: #d9d9d9;
  942. color: #fff;
  943. }
  944. .dialog_btn.dialog_btn_confirm {
  945. background: var(--dominantColor) !important;
  946. color: #fff !important;
  947. }
  948. /* 信息确认弹窗 end */
  949. /* 覆盖 */
  950. .public_btn_con {
  951. background-color: #fff;
  952. z-index: 9;
  953. }
  954. .display-flex__ac {
  955. display: flex;
  956. align-items: center;
  957. }
  958. .display-flex__jc {
  959. display: flex;
  960. justify-content: center;
  961. }
  962. .displayFlexLeft {
  963. display: flex;
  964. justify-content: flex-start;
  965. align-items: center;
  966. }
  967. .text-center {
  968. text-align: center;
  969. }
  970. .font-bold {
  971. font-weight: bold;
  972. }
  973. .no-padding {
  974. padding: 0 !important;
  975. }
  976. .backgroundCustom {
  977. background: var(--dominantColor) !important;
  978. color: #fff !important;
  979. }
  980. .text-color__dominant {
  981. color: var(--dominantColor);
  982. }
  983. </style>