多租户商城-平台端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1790 lines
57 KiB

  1. <!-- -->
  2. <template>
  3. <div>
  4. <div class="pending">
  5. <!-- 搜索 -->
  6. <div class="formSearch">
  7. <el-form
  8. :inline="true"
  9. :model="formInline"
  10. >
  11. <el-form-item label="商家名称">
  12. <el-input
  13. v-model="formInline.businessName"
  14. maxlength="20"
  15. placeholder="请输入商家名称"
  16. />
  17. </el-form-item>
  18. <el-form-item label="商家编码">
  19. <el-input
  20. v-model="formInline.businessCode"
  21. maxlength="20"
  22. placeholder="请输入商家编码"
  23. />
  24. </el-form-item>
  25. <el-form-item label="负责人">
  26. <el-input
  27. v-model="formInline.chargePersonName"
  28. maxlength="20"
  29. placeholder="请输入负责人"
  30. />
  31. </el-form-item>
  32. <el-form-item label="合同状态">
  33. <el-select
  34. v-model="formInline.contractState"
  35. placeholder="请选择"
  36. >
  37. <el-option
  38. label="有效"
  39. value="1"
  40. />
  41. <el-option
  42. label="无效"
  43. value="0"
  44. />
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button
  49. type="primary"
  50. plain
  51. @click="onSubmit"
  52. >查询
  53. </el-button>
  54. <el-button
  55. type="success"
  56. plain
  57. @click="addbuss"
  58. >新建商家
  59. </el-button>
  60. </el-form-item>
  61. </el-form>
  62. </div>
  63. <!-- 表格 -->
  64. <div class="tableBox">
  65. <el-table
  66. ref="multipleTable"
  67. :data="tableData"
  68. border
  69. :header-cell-style="{ background: '#EEF3FF', color: '#333333' }"
  70. tooltip-effect="dark"
  71. style="width: 100%"
  72. >
  73. <el-table-column
  74. label="商家名称"
  75. width="220"
  76. >
  77. <template slot-scope="scope">{{ scope.row.businessName }}</template>
  78. </el-table-column>
  79. <el-table-column
  80. prop="businessCode"
  81. label="商家编码"
  82. />
  83. <el-table-column
  84. prop="businessPhone"
  85. label="联系电话"
  86. />
  87. <el-table-column label="合同状态">
  88. <template slot-scope="scope">
  89. <span v-if="scope.row.contractState === 0">无效</span>
  90. <span v-if="scope.row.contractState === 1">有效</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="支付模式">
  94. <template slot-scope="scope">
  95. <span v-if="scope.row.payMode === 0">新生支付</span>
  96. <span v-if="scope.row.payMode === 1">新账通</span>
  97. <span v-if="scope.row.payMode === 2">原生微信支付宝</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. prop="createTime"
  102. label="创建时间"
  103. show-overflow-tooltip
  104. />
  105. <el-table-column
  106. label="操作"
  107. show-overflow-tooltip
  108. >
  109. <template slot-scope="scope">
  110. <div class="btnList">
  111. <el-button
  112. type="text"
  113. @click="seeMore(scope.row)"
  114. >查看
  115. </el-button>
  116. <el-button
  117. type="text"
  118. @click="edit(scope.row)"
  119. >编辑
  120. </el-button>
  121. <el-button
  122. v-if="scope.row.state == 1"
  123. type="text"
  124. @click="del(scope.row)"
  125. >禁用
  126. </el-button>
  127. <el-button
  128. v-else
  129. type="text"
  130. @click="del(scope.row)"
  131. >启用
  132. </el-button>
  133. <el-button
  134. type="text"
  135. @click="delBusiness(scope.row)"
  136. >删除
  137. </el-button>
  138. <el-button
  139. type="text"
  140. @click="setShareSetting(scope.row)"
  141. >设置分账</el-button>
  142. <el-button
  143. type="text"
  144. @click="setDomainSetting(scope.row)"
  145. >设置域名</el-button>
  146. </div>
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. <div class="fenye">
  151. <el-pagination
  152. :current-page="currentPage"
  153. :page-sizes="[10, 20, 50, 100]"
  154. :page-size="10"
  155. layout="total, sizes, prev, pager, next, jumper"
  156. :total="total"
  157. @size-change="handleSizeChange"
  158. @current-change="handleCurrentChange"
  159. />
  160. </div>
  161. </div>
  162. <!-- ******************************************************弹框开始****************************************************** -->
  163. <!-- 新建商家弹框 -->
  164. <el-dialog
  165. :title="
  166. userState === 0
  167. ? '新增商家'
  168. : userState === 1
  169. ? '修改商家'
  170. : '查看商家'
  171. "
  172. :visible.sync="dialogVisible"
  173. width="40%"
  174. center
  175. :close-on-click-modal="false"
  176. >
  177. <div>
  178. <el-tabs
  179. v-model="activeName"
  180. @tab-click="handleClick"
  181. >
  182. <el-tab-pane
  183. label="授权信息"
  184. name="first"
  185. >
  186. <el-form
  187. ref="ruleFormInfo"
  188. :model="ruleForm"
  189. :rules="rulesInfo"
  190. label-width="120px"
  191. >
  192. <el-form-item
  193. label="商家名称"
  194. prop="businessName"
  195. >
  196. <el-input
  197. v-model="ruleForm.businessName"
  198. maxlength="20"
  199. :disabled="disabled"
  200. />
  201. </el-form-item>
  202. <el-form-item
  203. label="联系电话"
  204. prop="businessPhone"
  205. >
  206. <el-input
  207. v-if="cpPhoneShow"
  208. :value="hidden(ruleForm.businessPhone,3,4)"
  209. maxlength="11"
  210. :disabled="disabled"
  211. @focus="focusPhoneInput"
  212. />
  213. <el-input
  214. v-else
  215. ref="phoneCls"
  216. v-model="ruleForm.businessPhone"
  217. maxlength="11"
  218. clearable
  219. :disabled="disabled"
  220. @change="changePhoneInput"
  221. />
  222. </el-form-item>
  223. <el-form-item
  224. label="商家负责人"
  225. prop="chargePersonName"
  226. >
  227. <el-input
  228. v-model="ruleForm.chargePersonName"
  229. maxlength="20"
  230. :disabled="disabled"
  231. />
  232. </el-form-item>
  233. <el-form-item
  234. label="负责人电话"
  235. prop="chargePersonPhone"
  236. >
  237. <el-input
  238. v-if="cpPhoneShow"
  239. :value="hidden(ruleForm.chargePersonPhone,3,4)"
  240. maxlength="11"
  241. :disabled="disabled"
  242. @focus="focuscpPhoneInput"
  243. />
  244. <el-input
  245. v-else
  246. ref="cpPhoneCls"
  247. v-model="ruleForm.chargePersonPhone"
  248. maxlength="11"
  249. clearable
  250. :disabled="disabled"
  251. @change="changecpPhoneInput"
  252. />
  253. </el-form-item>
  254. <el-form-item
  255. label="商家地址"
  256. prop="businessAdress"
  257. >
  258. <el-input
  259. ref="addressCls"
  260. v-model="ruleForm.businessAdress"
  261. maxlength="60"
  262. :disabled="disabled"
  263. />
  264. <!-- <div v-else @click="inputAddress">
  265. <el-input :value="hidden(ruleForm.businessAdress, 1, 1)" :disabled="disabled" />
  266. </div> -->
  267. </el-form-item>
  268. <el-form-item
  269. label="生效日期"
  270. prop="effectiveDate"
  271. >
  272. <el-date-picker
  273. v-model="ruleForm.effectiveDate"
  274. :disabled="disabled"
  275. value-format="yyyy-MM-dd"
  276. type="date"
  277. placeholder="选择日期"
  278. />
  279. </el-form-item>
  280. <el-form-item
  281. label="生效年限"
  282. prop="effectiveYear"
  283. >
  284. <el-input
  285. v-model="ruleForm.effectiveYear"
  286. type="text"
  287. :disabled="disabled"
  288. placeholder="请输入内容"
  289. maxlength="4"
  290. class="elipt"
  291. style="width: 50%"
  292. show-word-limit
  293. />
  294. <span class="elspan"></span>
  295. </el-form-item>
  296. <el-form-item
  297. label="合同状态"
  298. prop="contractState"
  299. >
  300. <el-radio-group v-model="ruleForm.contractState">
  301. <el-radio
  302. :disabled="disabled"
  303. :label="1"
  304. >有效
  305. </el-radio>
  306. <el-radio
  307. :disabled="disabled"
  308. :label="0"
  309. >无效
  310. </el-radio>
  311. </el-radio-group>
  312. </el-form-item>
  313. <el-form-item
  314. label="PC端商城域名"
  315. prop="pcDomain"
  316. >
  317. <el-input
  318. ref="addressCls"
  319. v-model="ruleForm.pcDomain"
  320. maxlength="60"
  321. :disabled="disabled"
  322. />
  323. </el-form-item>
  324. <el-form-item
  325. label="移动端商城域名"
  326. prop="mobileDomain"
  327. >
  328. <el-input
  329. ref="addressCls"
  330. v-model="ruleForm.mobileDomain"
  331. maxlength="60"
  332. :disabled="disabled"
  333. />
  334. </el-form-item>
  335. <!-- <el-form-item
  336. label="直播间审核"
  337. prop="auditLive"
  338. >
  339. <el-radio-group v-model="ruleForm.auditLive">
  340. <el-radio
  341. :disabled="disabled"
  342. :label="1"
  343. >开启
  344. </el-radio>
  345. <el-radio
  346. :disabled="disabled"
  347. :label="0"
  348. >关闭
  349. </el-radio>
  350. </el-radio-group>
  351. </el-form-item>
  352. <el-form-item
  353. label="直播间商品审核"
  354. prop="auditLiveProduct"
  355. >
  356. <el-radio-group v-model="ruleForm.auditLiveProduct">
  357. <el-radio
  358. :disabled="disabled"
  359. :label="1"
  360. >开启
  361. </el-radio>
  362. <el-radio
  363. :disabled="disabled"
  364. :label="0"
  365. >关闭
  366. </el-radio>
  367. </el-radio-group>
  368. </el-form-item>-->
  369. </el-form>
  370. </el-tab-pane>
  371. <el-tab-pane
  372. label="客户信息"
  373. name="second"
  374. >
  375. <el-form
  376. ref="ruleForm"
  377. :model="ruleForm"
  378. :rules="rules"
  379. label-width="100px"
  380. >
  381. <el-form-item
  382. label="账号"
  383. prop="businessPhone"
  384. >
  385. <el-input
  386. v-if="businessPhoneShow"
  387. :value="hidden(ruleForm.businessPhone, 3, 4)"
  388. :disabled="disabled"
  389. maxlength="20"
  390. @focus="focusbusinessPhoneInput"
  391. />
  392. <el-input
  393. v-else
  394. ref="businessPhoneCls"
  395. v-model="ruleForm.businessPhone"
  396. :disabled="disabled"
  397. maxlength="20"
  398. />
  399. </el-form-item>
  400. <el-form-item
  401. label="密码"
  402. prop="businessPassword"
  403. >
  404. <el-input
  405. v-model="ruleForm.businessPassword"
  406. type="password"
  407. :disabled="disabled"
  408. maxlength="16"
  409. />
  410. </el-form-item>
  411. </el-form>
  412. </el-tab-pane>
  413. <el-tab-pane
  414. label="新账通支付"
  415. name="third"
  416. >
  417. <div style="display: flex;flex-direction: row;margin-bottom: 15px;justify-content: flex-end">
  418. <el-switch
  419. active-text="开启"
  420. inactive-text="关闭"
  421. :loading="isHnaPayOpenLoading"
  422. :disabled="disabled"
  423. v-model="hnapayOpen"
  424. @change="hnapayOpenChange"
  425. />
  426. </div>
  427. <div style="margin-left: 15px; margin-bottom: 20px" v-if="hnapayOpen">
  428. <span v-if="hnapayStatus != '2' && currentHnapayId" style="color: orange;cursor: pointer" @click="showUploadCert()">上传资料</span>
  429. <span v-if="hnapayStatus === '1'" style="margin-left: 15px;color: #2e60f8">资料审核中</span>
  430. <span v-if="hnapayStatus === '2'">审核通过</span>
  431. <span v-if="hnapayStatus === '3'" style="margin-left: 15px;color: red">资料审核拒绝请重新上传</span>
  432. </div>
  433. <el-form
  434. v-if="hnapayOpen"
  435. ref="hnapayForm"
  436. :model="hnapayForm"
  437. :rules="hnaPayRules"
  438. label-width="100px"
  439. >
  440. <el-form-item label="企业名称" prop="name">
  441. <el-input
  442. v-model="hnapayForm.name" placeholder="请输入企业名称" :disabled="hnapayEditDisabled"/>
  443. </el-form-item>
  444. <el-form-item label="营业执照号" prop="enterpriseCode">
  445. <el-input
  446. v-model="hnapayForm.enterpriseCode" placeholder="请输入营业执照号" :disabled="hnapayEditDisabled"/>
  447. </el-form-item>
  448. <el-form-item label="执照效期" :prop="isForever ? '' : 'validDate'">
  449. <div class="acea-row" >
  450. <el-date-picker v-model="hnapayForm.validDate" type="date" style="width: 78%"
  451. value-format="yyyyMMdd" placeholder="请选择营业执照有效期" :disabled="validDateDisable || hnapayEditDisabled"/>
  452. <el-checkbox style="margin-left: 20px" v-model="isForever" @change="onForeverChange" :disabled="hnapayEditDisabled">永久</el-checkbox>
  453. </div>
  454. </el-form-item>
  455. <el-form-item label="银行卡号" prop="bankCard">
  456. <el-input :disabled="hnapayEditDisabled"
  457. v-model="hnapayForm.bankCard" placeholder="请输入银行卡号"/>
  458. </el-form-item>
  459. <el-form-item label="银行简码" prop="bankCode" >
  460. <el-select v-model="hnapayForm.bankCode" style="width: 100%" filterable :disabled="hnapayEditDisabled">
  461. <el-option v-for="item in bankCodeList" :key="item.value" :label="item.value + ' ' + item.label" :value="item.value">
  462. <span style="float: left">{{ item.value }}</span>
  463. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.label }}</span>
  464. </el-option>
  465. </el-select>
  466. </el-form-item>
  467. <el-form-item label="开户行省市" prop="bankProvince">
  468. <el-cascader
  469. :disabled="hnapayEditDisabled"
  470. style="width: 100%"
  471. v-model="value.label"
  472. :options="areaList"
  473. :props="{ expandTrigger: 'hover' }"
  474. @change="handleChange"
  475. clearable
  476. filterable
  477. placeholder="请选择开户行所属省市">
  478. </el-cascader>
  479. </el-form-item>
  480. <el-form-item label="开户支行" prop="bankBranch">
  481. <el-input
  482. :disabled="hnapayEditDisabled"
  483. v-model="hnapayForm.bankBranch" placeholder="请输入开户支行"/>
  484. </el-form-item>
  485. <el-form-item label="预留手机号" prop="contactPhone">
  486. <el-input
  487. :disabled="hnapayEditDisabled"
  488. v-model="hnapayForm.contactPhone" placeholder="请输入银行预留手机号"/>
  489. </el-form-item>
  490. </el-form>
  491. </el-tab-pane>
  492. <el-tab-pane
  493. label="微信支付宝"
  494. name="fourth"
  495. >
  496. <div style="display: flex;flex-direction: row;margin-bottom: 15px;justify-content: flex-end">
  497. <el-switch
  498. active-text="开启"
  499. inactive-text="关闭"
  500. :loading="isWxaliPayOpenLoading"
  501. :disabled="disabled"
  502. v-model="wxaliPayOpen"
  503. @change="wxaliPayOpenChange"
  504. />
  505. </div>
  506. <div v-if="wxaliPayOpen" style="display: flex;flex-direction: column">
  507. <el-checkbox
  508. style="margin-bottom: 20px"
  509. v-model="wxPayCanConfig"
  510. :disabled="disabled"
  511. >
  512. 微信商户配置
  513. </el-checkbox>
  514. <el-form
  515. v-if="wxPayCanConfig"
  516. ref="wxPayForm"
  517. :model="wxPayForm"
  518. :rules="wxPayRules"
  519. label-width="115px"
  520. >
  521. <el-form-item label="小程序appid" prop="appId">
  522. <el-input
  523. v-model="wxPayForm.appId" placeholder="请输入支付小程序appid" :disabled="disabled"/>
  524. </el-form-item>
  525. <el-form-item label="App端的appid" prop="appAppId">
  526. <el-input
  527. v-model="wxPayForm.appAppId" placeholder="请输入支付APP端的appid" :disabled="disabled"/>
  528. </el-form-item>
  529. <el-form-item label="商户号" prop="mchId">
  530. <el-input
  531. v-model="wxPayForm.mchId" placeholder="请输入商户号" :disabled="disabled"/>
  532. </el-form-item>
  533. <el-form-item label="商户秘钥" prop="mchKey">
  534. <el-input
  535. v-model="wxPayForm.mchKey" placeholder="请输入商户秘钥" :disabled="disabled"/>
  536. </el-form-item>
  537. <el-form-item label="私钥" prop="secret">
  538. <el-input
  539. v-model="wxPayForm.secret" placeholder="请输入私钥" :disabled="disabled"/>
  540. </el-form-item>
  541. <el-form-item label="证书路径" prop="certUrl">
  542. <el-input
  543. v-model="wxPayForm.certUrl" placeholder="请输入证书路径" :disabled="disabled"/>
  544. </el-form-item>
  545. </el-form>
  546. <el-button v-if="wxPayCanConfig" style="width: 200px;align-self: center" type="primary" size="small" @click="handleWxPay"> </el-button>
  547. </div>
  548. <div v-if="wxaliPayOpen" style="display: flex;flex-direction: column;margin-top: 15px">
  549. <el-checkbox
  550. style="margin-bottom: 20px"
  551. v-model="aliPayCanConfig"
  552. :disabled="disabled"
  553. >
  554. 支付宝商户配置
  555. </el-checkbox>
  556. <el-form
  557. v-if="aliPayCanConfig"
  558. ref="aliPayForm"
  559. :model="aliPayForm"
  560. :rules="aliPayRules"
  561. label-width="115px"
  562. >
  563. <el-form-item label="应用appid" prop="appId">
  564. <el-input
  565. v-model="aliPayForm.appId" placeholder="请输入应用appid" :disabled="disabled"/>
  566. </el-form-item>
  567. <el-form-item label="应用私钥" prop="privateKey">
  568. <el-input
  569. v-model="aliPayForm.privateKey" placeholder="请输入应用私钥" :disabled="disabled"/>
  570. </el-form-item>
  571. <el-form-item label="支付宝公钥" prop="publicKey">
  572. <el-input
  573. v-model="aliPayForm.publicKey" placeholder="请输入支付宝公钥" :disabled="disabled"/>
  574. </el-form-item>
  575. <el-form-item label="内容解密key" prop="decryKey">
  576. <el-input
  577. v-model="aliPayForm.decryKey" placeholder="请输入接口内容解密key" :disabled="disabled"/>
  578. </el-form-item>
  579. <el-form-item label="网关地址" prop="gatewayUrl">
  580. <el-input
  581. v-model="aliPayForm.gatewayUrl" placeholder="请输入请求网关地址" :disabled="disabled"/>
  582. </el-form-item>
  583. </el-form>
  584. <el-button v-if="aliPayCanConfig" style="width: 200px;align-self: center" type="primary" size="small" @click="handleAliPay"> </el-button>
  585. </div>
  586. </el-tab-pane>
  587. </el-tabs>
  588. </div>
  589. <span
  590. slot="footer"
  591. class="dialog-footer"
  592. >
  593. <el-button @click="closeFn"> </el-button>
  594. <el-button
  595. v-if="activeName == 'first'"
  596. type="primary"
  597. @click="next"
  598. >下一步</el-button>
  599. <el-button
  600. v-if="activeName == 'second'"
  601. type="primary"
  602. @click="addCheck('ruleForm')"
  603. > </el-button>
  604. <el-button
  605. v-if="activeName == 'third' && hnapayOpen"
  606. type="primary"
  607. @click="handleSubmitHnapay"
  608. > </el-button>
  609. </span>
  610. </el-dialog>
  611. <SharesettingDialog
  612. ref="shareSettingDialog"/>
  613. <DomainSettingDialog
  614. ref="domainSettingDialog"
  615. @onFinishSetDomain="onFinishSetDomain"/>
  616. </div>
  617. <el-dialog title="企业资料上传" :visible.sync="uploadCertDialog" :close-on-click-modal="false" :show-close="false" width="30%">
  618. <div class="col-content">
  619. <div class="row-content">
  620. <div class="col-content">
  621. <span style="margin-bottom: 10px;text-align: center">身份证正面</span>
  622. <el-upload
  623. class="avatar-uploader"
  624. action="#"
  625. :show-file-list="false"
  626. :auto-upload="false"
  627. :before-upload="beforeUpload"
  628. :on-change="handleFrontCardNoChange">
  629. <img v-if="frontCardIdBase64" :src="frontCardIdBase64" class="avatar">
  630. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  631. </el-upload>
  632. <el-button type="primary" size="mini" style="margin-top: 8px" @click="uploadCertInfo(1)" :disabled="hasUploadFrontCard == true">{{hasUploadFrontCard ? '已上传' : '确认上传'}}</el-button>
  633. </div>
  634. <div class="col-content">
  635. <span style="margin-bottom: 10px;text-align: center">身份证反面</span>
  636. <el-upload
  637. class="avatar-uploader"
  638. action="#"
  639. :show-file-list="false"
  640. :auto-upload="false"
  641. :before-upload="beforeUpload"
  642. :on-change="handleAfterCardNoChange">
  643. <img v-if="afterCardIdBase64" :src="afterCardIdBase64" class="avatar">
  644. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  645. </el-upload>
  646. <el-button type="primary" size="mini" style="margin-top: 8px" @click="uploadCertInfo(2)" :disabled="hasUploadAfterCard == true">{{hasUploadAfterCard ? '已上传' : '确认上传'}}</el-button>
  647. </div>
  648. </div>
  649. <div class="row-content" style="margin-top: 40px">
  650. <div class="col-content">
  651. <span style="margin-bottom: 10px;text-align: center">营业执照</span>
  652. <el-upload
  653. class="avatar-uploader"
  654. action="#"
  655. :show-file-list="false"
  656. :auto-upload="false"
  657. :before-upload="beforeUpload"
  658. :on-change="handleCertNoChange">
  659. <img v-if="certNoBase64" :src="certNoBase64" class="avatar">
  660. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  661. </el-upload>
  662. <el-button type="primary" size="mini" style="margin-top: 8px" @click="uploadCertInfo(4)" :disabled="hasUploadCertNo == true">{{hasUploadCertNo ? '已上传' : '确认上传'}}</el-button>
  663. </div>
  664. <div class="col-content">
  665. <span style="margin-bottom: 10px;text-align: center">开户许可证</span>
  666. <el-upload
  667. class="avatar-uploader"
  668. action="#"
  669. :show-file-list="false"
  670. :auto-upload="false"
  671. :before-upload="beforeUpload"
  672. :on-change="handlePermitCertChange">
  673. <img v-if="permitCertBase64" :src="permitCertBase64" class="avatar">
  674. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  675. </el-upload>
  676. <el-button type="primary" size="mini" style="margin-top: 8px" @click="uploadCertInfo(7)" :disabled="hasUploadCertNo == true">{{hasUploadPermitCert ? '已上传' : '确认上传'}}</el-button>
  677. </div>
  678. </div>
  679. </div>
  680. <span slot="footer" class="dialog-footer">
  681. <el-button @click="onUploadCertCancel"> </el-button>
  682. <el-button type="primary" @click="onUploadCertConfirm"> </el-button>
  683. </span>
  684. </el-dialog>
  685. </div>
  686. </template>
  687. <script>
  688. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  689. // 例如:import 《组件名称》 from '《组件路径》';
  690. import {
  691. businessListGetAll,
  692. businessListSave,
  693. businessListGetById,
  694. businessListUpdate,
  695. businessListStart,
  696. delBusinessById,
  697. hnapaySave,
  698. uploadCertInfo,
  699. getHnaPayInfo,
  700. changeBusinessPayMode, wxPaySave, aliPaySave, wxPayUpdate, aliPayUpdate, getWxPayInfo, getAliPayInfo
  701. } from '@/api/business'
  702. import SharesettingDialog from '../../../components/Sharesetting';
  703. import DomainSettingDialog from '../../../components/DomainSetting';
  704. import areaJSON from '@/assets/area'
  705. export default {
  706. components: {SharesettingDialog, DomainSettingDialog},
  707. data () {
  708. // 这里存放数据
  709. return {
  710. // 新建商家弹框
  711. dialogVisible: false,
  712. activeName: 'first',
  713. formInline: {
  714. businessName: '', // 商家名称
  715. businessCode: '', // 商家编码
  716. chargePersonName: '', // 商家负责人
  717. contractState: '', // 合同状态 1-有效 0-无效
  718. page: '1', // 当前页
  719. pageSize: '10' // 每页记录数
  720. },
  721. disabled: false,
  722. ruleForm: {
  723. businessName: '', // 商家名称
  724. chargePersonName: '', // 商家负责人
  725. chargePersonPhone: '', // 负责人电话
  726. businessAdress: '', // 地址
  727. effectiveDate: '', // 生效日期
  728. effectiveYear: '', // 生效年限
  729. contractState: 1, // 合同状态 1-有效 0-无效
  730. auditLive: 1,
  731. auditLiveProduct: 1,
  732. businessPhone: '', // 账号
  733. businessPassword: '', // 密码
  734. pcDomain: '', //PC端商城域名
  735. mobileDomain: '' //移动端商城域名
  736. },
  737. hnapayForm: {
  738. name: '', // 企业名称
  739. enterpriseCode: '', // 营业执照号
  740. validDate: '', // 执照效期
  741. bankCard: '', // 银行卡号
  742. bankCode: '', // 银行简码
  743. bankProvince: '', // 开户省份
  744. bankCity: '', // 开户城市
  745. bankBranch: '', //开户支行
  746. contactPhone: '' //负责人电话
  747. },
  748. wxPayForm: {
  749. appId: '', // 支付小程序appid
  750. appAppId: '', // 支付APP端的appid
  751. mchId: '', // 商户号
  752. mchKey: '', // 商户秘钥
  753. secret: '', // 私钥
  754. certUrl: '', // 证书路径
  755. },
  756. aliPayForm: {
  757. appId: '', // 应用appid
  758. privateKey: '', // 应用私钥
  759. publicKey: '', // 支付宝公钥
  760. decryKey: '', //内容解密key
  761. gatewayUrl: '', // 请求网关地址
  762. },
  763. isForever: false,
  764. validDateDisable: false,
  765. hnaPayRules: {
  766. name: [
  767. { required: true, message: '企业名称不能为空', trigger: 'blur' }
  768. ],
  769. enterpriseCode: [
  770. { required: true, message: '统一社会信用代码不能为空', trigger: 'blur' }
  771. ],
  772. validDate: [
  773. { required: true, message: '营业执照有效期不能为空', trigger: 'blur' }
  774. ],
  775. contactPhone: [
  776. { required: true, message: '银行预留手机号不能为空', trigger: 'blur' }
  777. ],
  778. bankCard: [
  779. { required: true, message: '银行卡号不能为空', trigger: 'blur' }
  780. ],
  781. bankCode: [
  782. { required: true, message: '银行简码不能为空', trigger: 'blur' }
  783. ],
  784. bankProvince: [
  785. { required: true, message: '开户行所属省份不能为空', trigger: 'blur' }
  786. ],
  787. bankCity: [
  788. { required: true, message: '开户行所属城市不能为空', trigger: 'blur' }
  789. ],
  790. bankBranch: [
  791. { required: true, message: '开户支行不能为空', trigger: 'blur' }
  792. ],
  793. },
  794. wxPayRules: {
  795. appId: [
  796. { required: true, message: '支付小程序appid不能为空', trigger: 'blur' }
  797. ],
  798. appAppId: [
  799. { required: true, message: '支付APP端的appid不能为空', trigger: 'blur' }
  800. ],
  801. mchId: [
  802. { required: true, message: '商户号不能为空', trigger: 'blur' }
  803. ],
  804. mchKey: [
  805. { required: true, message: '商户秘钥不能为空', trigger: 'blur' }
  806. ],
  807. secret: [
  808. { required: true, message: '私钥不能为空', trigger: 'blur' }
  809. ],
  810. },
  811. aliPayRules: {
  812. appId: [
  813. { required: true, message: '应用appid不能为空', trigger: 'blur' }
  814. ],
  815. privateKey: [
  816. { required: true, message: '应用私钥不能为空', trigger: 'blur' }
  817. ],
  818. publicKey: [
  819. { required: true, message: '支付宝公钥不能为空', trigger: 'blur' }
  820. ],
  821. },
  822. showPhone: false,
  823. showAddress: false,
  824. userPhone: '',
  825. showUserPhone: false,
  826. newAddress: '',
  827. personPhone: '',
  828. rulesInfo: {
  829. effectiveYear: [
  830. { required: true, message: '请输入生效时限', trigger: 'blur' }
  831. ],
  832. businessName: [
  833. { required: true, message: '请输入商家名称', trigger: 'blur' }
  834. ],
  835. chargePersonName: [
  836. { required: true, message: '请输入商家负责人', trigger: 'blur' }
  837. ],
  838. chargePersonPhone: [
  839. { required: true, message: '请输入负责人电话', trigger: 'blur' },
  840. {
  841. pattern: /^1[3456789]\d{9}$/,
  842. message: '目前只支持中国大陆的手机号码'
  843. }
  844. ],
  845. businessAdress: [
  846. { required: true, message: '请输入地址', trigger: 'blur' }
  847. ],
  848. contractState: [
  849. {
  850. required: true,
  851. message: '请选择合同状态',
  852. trigger: 'change'
  853. }
  854. ],
  855. auditLive: [
  856. {
  857. required: true,
  858. message: '请选择状态',
  859. trigger: 'change'
  860. }
  861. ],
  862. auditLiveProduct: [
  863. {
  864. required: true,
  865. message: '请选择状态',
  866. trigger: 'change'
  867. }
  868. ],
  869. effectiveDate: [
  870. {
  871. required: true,
  872. message: '请选择日期',
  873. trigger: 'change'
  874. }
  875. ]
  876. },
  877. rules: {
  878. businessPhone: [
  879. { required: true, message: '请输入账号', trigger: 'blur' },
  880. {
  881. pattern: /^1[3456789]\d{9}$/,
  882. message: '目前只支持中国大陆的手机号码'
  883. }
  884. ],
  885. businessPassword: [
  886. { required: true, message: '请输入密码', trigger: 'blur' },
  887. {
  888. pattern: /^[~!@#$%^&*\-+=_.0-9a-zA-Z]{8,16}$/,
  889. message: '8-16密码数字英文混合'
  890. }
  891. ]
  892. },
  893. total: 1,
  894. tableData: [],
  895. currentPage: 1,
  896. userState: 1,
  897. privacyTime: 0,
  898. cpPhoneShow: true, // 是否显示脱敏负责人手机号
  899. businessPhoneShow: true, // 是否显示脱敏账号
  900. bankCodeList: [
  901. {label : '中国银行', value: 'BOC'},
  902. {label : '中信银行', value: 'CITIC'},
  903. {label : '兴业银行', value: 'CIB'},
  904. {label : '浦发银行', value: 'SPDB'},
  905. {label : '广发银行', value: 'GDB'},
  906. {label : '平安银行', value: 'SPABANK'},
  907. {label : '华夏银行', value: 'HXBANK'},
  908. {label : '恒丰银行', value: 'EGBANK'},
  909. {label : '浙商银行', value: 'CZBANK'},
  910. {label : '渤海银行', value: 'BOHAIB'},
  911. {label : '徽商银行', value: 'HSBANK'},
  912. {label : '中国农业银行', value: 'ANTBANK'},
  913. {label : '中国工商银行', value: 'ICBC'},
  914. {label : '中国建设银行', value: 'CCB'},
  915. {label : '中国邮政储蓄银行', value: 'PSBC'},
  916. {label : '中国民生银行', value: 'CMBC'},
  917. {label : '中国光大银行', value: 'CEB'},
  918. {label : '招商银行', value: 'CMB'},
  919. {label : '交通银行', value: 'COMM'}
  920. ],
  921. value: {
  922. label: []
  923. },
  924. areaList: [],
  925. currentBusinessId: undefined,
  926. currentHnapayId: undefined,
  927. hnapayStatus: '0',
  928. hnapayEditDisabled: false,
  929. uploadCertDialog: false,
  930. frontCardIdBase64: '',
  931. frontCardFormData: undefined,
  932. afterCardIdBase64: '',
  933. afterCardFormData: undefined,
  934. certNoBase64: '',
  935. certNoFormData: undefined,
  936. permitCertBase64: '',
  937. permitCertFormData: undefined,
  938. hasUploadFrontCard: false,
  939. hasUploadAfterCard: false,
  940. hasUploadCertNo: false,
  941. hasUploadPermitCert: false,
  942. hnapayOpen: false,
  943. lastHnaPayOpen: false,//记录切换前的状态(用于失败回退)
  944. isHnaPayOpenLoading: false,
  945. wxaliPayOpen: false,
  946. lastWxaliPayOpen: false,//记录切换前的状态(用于失败回退)
  947. isWxaliPayOpenLoading: false,
  948. //商家支付模式
  949. businessPayMode: '0',
  950. aliPayCanConfig: false,
  951. wxPayCanConfig: true,
  952. wxPayHasSave: false,
  953. aliPayHasSave: false,
  954. }
  955. },
  956. // 监听属性 类似于data概念
  957. computed: {},
  958. // 监控data中的数据变化
  959. watch: {},
  960. // 生命周期 - 创建完成(可以访问当前this实例)
  961. created () {
  962. },
  963. // 生命周期 - 挂载完成(可以访问DOM元素)
  964. mounted () {
  965. this.getAll(this.formInline)
  966. this.privacyTime = localStorage.getItem('privacyTime')
  967. console.log(this.privacyTime)
  968. this.initArea()
  969. },
  970. // 方法集合
  971. methods: {
  972. setShareSetting(row) {
  973. this.$refs.shareSettingDialog.showSetting(2, row.businessId)
  974. },
  975. setDomainSetting(row) {
  976. this.$refs.domainSettingDialog.showSetting(row.businessId, row.pcDomain, row.mobileDomain)
  977. },
  978. focusbusinessPhoneInput () {
  979. this.businessPhoneShow = false
  980. this.ruleForm.businessPhone = ''
  981. // 自动获取焦点
  982. this.$nextTick(() => {
  983. this.$refs.businessPhoneCls.focus()
  984. })
  985. },
  986. focuscpPhoneInput () {
  987. this.cpPhoneShow = false
  988. this.ruleForm.chargePersonPhone = ''
  989. // 自动获取焦点
  990. this.$nextTick(() => {
  991. this.$refs.cpPhoneCls.focus()
  992. })
  993. },
  994. focusPhoneInput () {
  995. this.showPhone = false
  996. this.ruleForm.businessPhone = ''
  997. // 自动获取焦点
  998. this.$nextTick(() => {
  999. this.$refs.phoneCls.focus()
  1000. })
  1001. },
  1002. changePhoneInput () {
  1003. },
  1004. changecpPhoneInput () {
  1005. },
  1006. handleSizeChange (val) {
  1007. this.formInline.pageSize = val
  1008. this.getAll(this.formInline)
  1009. },
  1010. handleCurrentChange (val) {
  1011. this.formInline.page = val
  1012. this.getAll(this.formInline)
  1013. },
  1014. handleClick (tab, event) {
  1015. console.log(tab, event)
  1016. },
  1017. onSubmit () {
  1018. this.getAll(this.formInline)
  1019. },
  1020. // 新建商家
  1021. addbuss () {
  1022. this.userState = 0
  1023. this.disabled = false
  1024. this.hnapayEditDisabled = false
  1025. this.newAddress = ''
  1026. this.personPhone = ''
  1027. this.ruleForm = {
  1028. businessName: '', // 商家名称
  1029. chargePersonName: '', // 商家负责人
  1030. chargePersonPhone: '', // 负责人电话
  1031. businessAdress: '', // 地址
  1032. effectiveDate: '', // 生效日期
  1033. effectiveYear: '', // 生效年限
  1034. contractState: 1, // 合同状态 1-有效 0-无效
  1035. auditLive: 1,
  1036. auditLiveProduct: 1,
  1037. businessPhone: '', // 账号
  1038. businessPassword: '' // 密码
  1039. }
  1040. this.dialogVisible = true
  1041. console.log(this.userState)
  1042. },
  1043. next () {
  1044. this.activeName = 'second'
  1045. },
  1046. closeFn () {
  1047. this.$nextTick(() => {
  1048. this.$refs['ruleForm'].clearValidate()
  1049. this.$refs['ruleFormInfo'].clearValidate()
  1050. this.dialogVisible = false
  1051. })
  1052. },
  1053. // 新建商家确定
  1054. addCheck (ruleForm) {
  1055. this.$refs[ruleForm].validate(valid => {
  1056. if (valid) {
  1057. console.log(this.userState)
  1058. console.log(this.ruleForm)
  1059. if (this.personPhone !== '') {
  1060. this.ruleForm.chargePersonPhone = this.personPhone
  1061. }
  1062. if (this.newAddress !== '') {
  1063. this.ruleForm.businessAdress = this.newAddress
  1064. }
  1065. if (this.userPhone !== '') {
  1066. this.ruleForm.businessPhone = this.userPhone
  1067. }
  1068. if (this.ruleForm.businessName === '') {
  1069. this.$message.error('请输入商家名称')
  1070. return
  1071. }
  1072. if (this.ruleForm.effectiveDate === '') {
  1073. this.$message.error('请输入生效日期')
  1074. return
  1075. }
  1076. if (this.ruleForm.effectiveYear === '') {
  1077. this.$message.error('请输入生效年限')
  1078. return
  1079. }
  1080. if (!this.userState) {
  1081. businessListSave(this.ruleForm).then(res => {
  1082. console.log(res)
  1083. if (res.code === '') {
  1084. this.$message({
  1085. message: '新增成功',
  1086. type: 'success'
  1087. })
  1088. }
  1089. this.getAll(this.formInline)
  1090. this.dialogVisible = false
  1091. this.$refs.ruleForm.clearValidate()
  1092. })
  1093. } else {
  1094. businessListUpdate(this.ruleForm).then(res => {
  1095. console.log(res)
  1096. if (res.code === '') {
  1097. this.$message({
  1098. message: '修改成功',
  1099. type: 'success'
  1100. })
  1101. this.$refs.ruleForm.clearValidate()
  1102. }
  1103. this.getAll(this.formInline)
  1104. this.dialogVisible = false
  1105. })
  1106. }
  1107. } else {
  1108. console.log('error submit!!')
  1109. this.$message.error('请输入完整信息')
  1110. return false
  1111. }
  1112. })
  1113. },
  1114. // 查看
  1115. async seeMore (row) {
  1116. this.showPhone = false
  1117. this.cpPhoneShow = true
  1118. this.businessPhoneShow = true
  1119. const res = await businessListGetById({ businessId: row.businessId })
  1120. console.log(res)
  1121. if (res.code === '') {
  1122. this.disabled = true
  1123. this.userState = 3
  1124. this.hnapayEditDisabled = true
  1125. this.ruleForm = res.data
  1126. this.dialogVisible = true
  1127. }
  1128. },
  1129. // 编辑
  1130. async edit (row) {
  1131. this.currentBusinessId = row.businessId
  1132. this.businessPayMode = row.payMode
  1133. this.hnapayOpen = row.payMode === 1
  1134. this.wxaliPayOpen = row.payMode === 2
  1135. this.hnapayStatus = row.hnapayStatus
  1136. this.currentHnapayId = row.hnaPayId
  1137. if (this.currentHnapayId) {
  1138. this.hnapayEditDisabled = true
  1139. this.getHnaPayInfo()
  1140. }else {
  1141. this.hnapayEditDisabled = false
  1142. this.hnapayForm = {
  1143. name: '', // 企业名称
  1144. enterpriseCode: '', // 营业执照号
  1145. validDate: '', // 执照效期
  1146. bankCard: '', // 银行卡号
  1147. bankCode: '', // 银行简码
  1148. bankProvince: '', // 开户省份
  1149. bankCity: '', // 开户城市
  1150. bankBranch: '', //开户支行
  1151. contactPhone: '' //负责人电话
  1152. }
  1153. }
  1154. this.getWxPayInfo()
  1155. this.getAliPayInfo()
  1156. this.showPhone = false
  1157. this.personPhone = ''
  1158. this.userState = 1
  1159. this.disabled = false
  1160. this.cpPhoneShow = true
  1161. const res = await businessListGetById({ businessId: row.businessId })
  1162. this.ruleForm = res.data
  1163. this.dialogVisible = true
  1164. console.log(this.ruleForm)
  1165. },
  1166. // 删除
  1167. async del (row) {
  1168. console.log(row)
  1169. if (row.state === 1) {
  1170. const res = await businessListStart({
  1171. businessName: row.businessName,
  1172. state: 0,
  1173. businessId: row.businessId
  1174. })
  1175. if (res.code === '') {
  1176. this.$message({
  1177. message: '停用成功',
  1178. type: 'success'
  1179. })
  1180. this.getAll(this.formInline)
  1181. }
  1182. } else {
  1183. const res = await businessListStart({
  1184. businessName: row.businessName,
  1185. state: 1,
  1186. businessId: row.businessId
  1187. })
  1188. if (res.code === '') {
  1189. this.$message({
  1190. message: '启用成功',
  1191. type: 'success'
  1192. })
  1193. this.getAll(this.formInline)
  1194. }
  1195. }
  1196. },
  1197. delBusiness (row) {
  1198. // todo 判断商家状态
  1199. this.$confirm('此操作将永久删除该商家, 是否继续?', '提示', {
  1200. confirmButtonText: '确定',
  1201. cancelButtonText: '取消',
  1202. type: 'warning'
  1203. }).then(async () => {
  1204. const res = await delBusinessById({
  1205. businessId: row.businessId
  1206. })
  1207. if (res.code === '') {
  1208. this.$message({
  1209. message: '操作成功',
  1210. type: 'success'
  1211. })
  1212. this.getAll(this.formInline)
  1213. }
  1214. }).catch(() => {
  1215. })
  1216. },
  1217. // businessListGetAll
  1218. // 初始化查询所有数据
  1219. async getAll (formInline) {
  1220. const res = await businessListGetAll(formInline)
  1221. this.total = res.data.total
  1222. this.tableData = res.data.list
  1223. },
  1224. // 编辑号码
  1225. inputPhone () {
  1226. this.showPhone = true
  1227. this.personPhone = ''
  1228. this.$nextTick(() => {
  1229. this.$refs.phoneCls.focus()
  1230. })
  1231. },
  1232. // 编辑地址
  1233. inputAddress () {
  1234. this.showAddress = true
  1235. this.newAddress = ''
  1236. this.$nextTick(() => {
  1237. this.$refs.addressCls.focus()
  1238. })
  1239. },
  1240. // 编辑客户信息
  1241. inputUserPhone () {
  1242. this.showUserPhone = true
  1243. this.userPhone = ''
  1244. this.$nextTick(() => {
  1245. this.$refs.userPhoneCls.focus()
  1246. })
  1247. },
  1248. onFinishSetDomain() {
  1249. this.onSubmit()
  1250. },
  1251. // 中间部分
  1252. hidden (str, frontLen, endLen) {
  1253. let endLenData = 0
  1254. if (str.length !== 2) {
  1255. endLenData = endLen
  1256. }
  1257. const len = str.length - frontLen - endLenData
  1258. let xing = ''
  1259. for (let i = 0; i < len; i++) {
  1260. xing += '*'
  1261. }
  1262. return (
  1263. str.substring(0, frontLen) + xing + str.substring(str.length - endLenData)
  1264. )
  1265. },
  1266. onForeverChange(val) {
  1267. this.validDateDisable = val
  1268. if (val) {
  1269. this.hnapayForm.validDate = undefined
  1270. }
  1271. },
  1272. // 初始化地区
  1273. initArea() {
  1274. const { province_list, city_list } = areaJSON
  1275. const provinceKeys = Object.keys(province_list)
  1276. const cityKeys = Object.keys(city_list)
  1277. this.areaList = provinceKeys.map(provinceKey => {
  1278. provinceKey += ''
  1279. let provinceList = []
  1280. const provinceKeyId = provinceKey.slice(0, 2)
  1281. const provinceName = province_list[provinceKey]
  1282. let provinceSelected = false
  1283. cityKeys.map(cityKey => {
  1284. const cityKeyId = cityKey.slice(0, 2)
  1285. const cityName = city_list[cityKey]
  1286. if (
  1287. provinceKeyId === cityKeyId
  1288. ) {
  1289. provinceList.push({
  1290. value: cityKey,
  1291. label: cityName
  1292. })
  1293. }
  1294. })
  1295. return {
  1296. value: provinceKeyId,
  1297. label: provinceName,
  1298. children: provinceList
  1299. }
  1300. })
  1301. },
  1302. handleChange (val) {
  1303. if (val.length) {
  1304. this.areaList.forEach(i => {
  1305. if (i.value === val[0]) {
  1306. this.hnapayForm.bankProvince = i.label
  1307. i.children.forEach(j => {
  1308. if (j.value === val[1]) {
  1309. this.hnapayForm.bankCity = j.label
  1310. }
  1311. })
  1312. }
  1313. })
  1314. } else {
  1315. this.hnapayForm.bankProvince = undefined
  1316. this.hnapayForm.bankCity = undefined
  1317. }
  1318. },
  1319. // 企业新账通开通
  1320. handleSubmitHnapay() {
  1321. let _this = this;
  1322. this.$refs['hnapayForm'].validate((valid) => {
  1323. if (valid) {
  1324. let param = {
  1325. businessId: this.currentBusinessId,
  1326. name: this.hnapayForm.name,
  1327. enterpriseCode: this.hnapayForm.enterpriseCode,
  1328. validDate: this.hnapayForm.validDate,
  1329. bankCard: this.hnapayForm.bankCard,
  1330. bankCode: this.hnapayForm.bankCode,
  1331. bankProvince: this.hnapayForm.bankProvince,
  1332. bankCity: this.hnapayForm.bankCity,
  1333. bankBranch: this.hnapayForm.bankBranch,
  1334. contactPhone: this.hnapayForm.contactPhone
  1335. }
  1336. hnapaySave(param).then(res => {
  1337. console.log(res)
  1338. if (res.code === '') {
  1339. _this.currentHnapayId = res.data
  1340. _this.hnapayEditDisabled = true
  1341. this.$message({
  1342. message: '提交成功,请上传企业资料',
  1343. type: 'success'
  1344. })
  1345. _this.showUploadCert()
  1346. }
  1347. })
  1348. }
  1349. })
  1350. },
  1351. showUploadCert() {
  1352. this.frontCardIdBase64 = ""
  1353. this.afterCardIdBase64 = ""
  1354. this.certNoBase64 = ""
  1355. this.permitCertBase64 = ""
  1356. this.hasUploadFrontCard = false
  1357. this.hasUploadAfterCard = false
  1358. this.hasUploadCertNo = false
  1359. this.hasUploadPermitCert = false
  1360. this.uploadCertDialog = true
  1361. },
  1362. onUploadCertCancel() {
  1363. this.uploadCertDialog = false
  1364. },
  1365. onUploadCertConfirm() {
  1366. if (this.hasUploadFrontCard == false){
  1367. this.$message.warning("请上传身份证正面")
  1368. return
  1369. }
  1370. if (this.hasUploadAfterCard == false){
  1371. this.$message.warning("请上传身份证反面")
  1372. return
  1373. }
  1374. if (this.hasUploadCertNo == false){
  1375. this.$message.warning("请上传营业执照")
  1376. return
  1377. }
  1378. if (this.hasUploadPermitCert == false){
  1379. this.$message.warning("请上传开户许可证")
  1380. return
  1381. }
  1382. this.uploadCertDialog = false
  1383. this.hnapayStatus = '1'
  1384. this.$message.success("资料都已上传成功,等待新账通平台审核")
  1385. },
  1386. handleFrontCardNoChange(file, fileList) {
  1387. this.frontCardFormData = new FormData();
  1388. this.frontCardFormData.append('file', file.raw)
  1389. this.hasUploadFrontCard = false
  1390. const reader = new FileReader();
  1391. // 文件读取成功后执行的回调函数
  1392. reader.onload = (e) => {
  1393. this.frontCardIdBase64 = e.target.result;
  1394. };
  1395. // 以Base64形式读取文件
  1396. reader.readAsDataURL(file.raw);
  1397. },
  1398. handleAfterCardNoChange(file, fileList) {
  1399. this.afterCardFormData = new FormData();
  1400. this.afterCardFormData.append('file', file.raw)
  1401. this.hasUploadAfterCard = false
  1402. const reader = new FileReader();
  1403. // 文件读取成功后执行的回调函数
  1404. reader.onload = (e) => {
  1405. this.afterCardIdBase64 = e.target.result;
  1406. };
  1407. // 以Base64形式读取文件
  1408. reader.readAsDataURL(file.raw);
  1409. },
  1410. handleCertNoChange(file, fileList) {
  1411. this.certNoFormData = new FormData();
  1412. this.certNoFormData.append('file', file.raw)
  1413. this.hasUploadCertNo = false
  1414. const reader = new FileReader();
  1415. // 文件读取成功后执行的回调函数
  1416. reader.onload = (e) => {
  1417. this.afterCardIdBase64 = e.target.result;
  1418. };
  1419. // 以Base64形式读取文件
  1420. reader.readAsDataURL(file.raw);
  1421. },
  1422. handlePermitCertChange(file, fileList) {
  1423. this.permitCertFormData = new FormData();
  1424. this.permitCertFormData.append('file', file.raw)
  1425. this.hasUploadPermitCert = false
  1426. const reader = new FileReader();
  1427. // 文件读取成功后执行的回调函数
  1428. reader.onload = (e) => {
  1429. this.afterCardIdBase64 = e.target.result;
  1430. };
  1431. // 以Base64形式读取文件
  1432. reader.readAsDataURL(file.raw);
  1433. },
  1434. beforeUpload(file) {
  1435. let isLt2M = true
  1436. isLt2M = file.size / 1024 / 1024 < 2
  1437. if (!isLt2M) {
  1438. this.$message.error('上传文件大小不能超过 2MB!')
  1439. }
  1440. return isLt2M
  1441. },
  1442. uploadCertInfo(type) {
  1443. let formData = undefined
  1444. switch (type) {
  1445. case 1:
  1446. formData = this.frontCardFormData;
  1447. break;
  1448. case 2:
  1449. formData = this.afterCardFormData
  1450. break
  1451. case 4:
  1452. formData = this.certNoFormData
  1453. break
  1454. case 7:
  1455. formData = this.permitCertFormData
  1456. break
  1457. }
  1458. formData.append('businessId', this.currentBusinessId)
  1459. formData.append('shareParId', this.currentHnapayId)
  1460. formData.append('type', type)
  1461. uploadCertInfo(formData).then(res => {
  1462. this.$message.success("上传成功")
  1463. switch (type) {
  1464. case 1:
  1465. this.hasUploadFrontCard = true
  1466. break;
  1467. case 2:
  1468. this.hasUploadAfterCard = true
  1469. break
  1470. case 4:
  1471. this.hasUploadCertNo = true
  1472. break
  1473. case 7:
  1474. this.hasUploadPermitCert = true
  1475. break
  1476. }
  1477. this.hnapayStatus = '1'
  1478. }).catch(err => {
  1479. this.$message.error("上传失败")
  1480. })
  1481. },
  1482. getHnaPayInfo(){
  1483. let _this = this;
  1484. getHnaPayInfo(this.currentBusinessId).then(res => {
  1485. console.log(res)
  1486. if (res.code === '') {
  1487. _this.hnapayForm = res.data
  1488. }
  1489. })
  1490. },
  1491. getWxPayInfo(){
  1492. let _this = this;
  1493. getWxPayInfo(this.currentBusinessId).then(res => {
  1494. console.log(res)
  1495. if (res.code === '') {
  1496. _this.wxPayForm = res.data
  1497. if (_this.wxPayForm.id){
  1498. console.log('getWxPayInfo-->', _this.wxPayForm)
  1499. _this.wxPayHasSave = true
  1500. }
  1501. }
  1502. })
  1503. },
  1504. getAliPayInfo(){
  1505. let _this = this;
  1506. getAliPayInfo(this.currentBusinessId).then(res => {
  1507. console.log(res)
  1508. if (res.code === '') {
  1509. _this.aliPayForm = res.data
  1510. if (_this.aliPayForm.id){
  1511. _this.aliPayHasSave = true
  1512. }
  1513. }
  1514. })
  1515. },
  1516. async hnapayOpenChange(newVal){
  1517. this.isHnaPayOpenLoading = true;
  1518. this.lastHnaPayOpen = !newVal;
  1519. let param = {
  1520. type: 1,
  1521. businessId: this.currentBusinessId,
  1522. enable: newVal
  1523. }
  1524. const res = await changeBusinessPayMode(param)
  1525. if (res.code === '') {
  1526. this.hnapayOpen = newVal;
  1527. this.wxaliPayOpen = false;
  1528. }else {
  1529. this.hnapayOpen = this.lastHnaPayOpen;
  1530. }
  1531. },
  1532. async wxaliPayOpenChange(newVal){
  1533. this.isWxaliPayOpenLoading = true;
  1534. this.lastWxaliPayOpen = !newVal;
  1535. let param = {
  1536. type: 2,
  1537. businessId: this.currentBusinessId,
  1538. enable: newVal
  1539. }
  1540. const res = await changeBusinessPayMode(param)
  1541. if (res.code === '') {
  1542. this.wxaliPayOpen = newVal;
  1543. this.hnapayOpen = false
  1544. }else {
  1545. this.wxaliPayOpen = this.lastWxaliPayOpen;
  1546. }
  1547. },
  1548. handleWxPay() {
  1549. if (this.wxPayCanConfig) {
  1550. if (this.wxPayHasSave){
  1551. this.handleWxPayUpdate()
  1552. }else {
  1553. this.handleWxPaySave()
  1554. }
  1555. }
  1556. },
  1557. handleAliPay() {
  1558. if (this.aliPayCanConfig){
  1559. if (this.aliPayHasSave){
  1560. this.handleAliPayUpdate()
  1561. }else {
  1562. this.handleAliPaySave()
  1563. }
  1564. }
  1565. },
  1566. handleWxPaySave() {
  1567. let _this = this;
  1568. this.$refs['wxPayForm'].validate((valid) => {
  1569. if (valid) {
  1570. let param = {
  1571. businessId: this.currentBusinessId,
  1572. appId: this.wxPayForm.appId,
  1573. appAppId: this.wxPayForm.appAppId,
  1574. mchId: this.wxPayForm.mchId,
  1575. certUrl: this.wxPayForm.certUrl,
  1576. mchKey: this.wxPayForm.mchKey,
  1577. secret: this.wxPayForm.secret
  1578. }
  1579. wxPaySave(param).then(res => {
  1580. console.log(res)
  1581. if (res.code === '') {
  1582. _this.wxPayHasSave = true
  1583. this.$message({
  1584. message: '提交成功',
  1585. type: 'success'
  1586. })
  1587. }
  1588. })
  1589. }
  1590. })
  1591. },
  1592. handleWxPayUpdate() {
  1593. this.$refs['wxPayForm'].validate((valid) => {
  1594. if (valid) {
  1595. wxPayUpdate(this.wxPayForm).then(res => {
  1596. console.log(res)
  1597. if (res.code === '') {
  1598. this.$message({
  1599. message: '修改成功',
  1600. type: 'success'
  1601. })
  1602. }
  1603. })
  1604. }
  1605. })
  1606. },
  1607. handleAliPaySave() {
  1608. let _this = this;
  1609. this.$refs['aliPayForm'].validate((valid) => {
  1610. if (valid) {
  1611. let param = {
  1612. businessId: this.currentBusinessId,
  1613. appId: this.aliPayForm.appId,
  1614. privateKey: this.aliPayForm.privateKey,
  1615. publicKey: this.aliPayForm.publicKey,
  1616. decryKey: this.aliPayForm.decryKey,
  1617. gatewayUrl: this.aliPayForm.gatewayUrl,
  1618. }
  1619. aliPaySave(param).then(res => {
  1620. console.log(res)
  1621. if (res.code === '') {
  1622. _this.aliPayHasSave = true
  1623. this.$message({
  1624. message: '提交成功',
  1625. type: 'success'
  1626. })
  1627. }
  1628. })
  1629. }
  1630. })
  1631. },
  1632. handleAliPayUpdate() {
  1633. this.$refs['aliPayForm'].validate((valid) => {
  1634. if (valid) {
  1635. aliPayUpdate(this.aliPayForm).then(res => {
  1636. console.log(res)
  1637. if (res.code === '') {
  1638. this.$message({
  1639. message: '修改成功',
  1640. type: 'success'
  1641. })
  1642. }
  1643. })
  1644. }
  1645. })
  1646. },
  1647. }
  1648. }
  1649. </script>
  1650. <style
  1651. lang="scss"
  1652. scoped
  1653. >
  1654. @import url("../../../styles/elDialog.scss");
  1655. .pending {
  1656. padding: 30px;
  1657. background: #FFFFFF;
  1658. border-radius: 10px;
  1659. }
  1660. .btnList{
  1661. display: flex;
  1662. flex-direction: row;
  1663. flex-wrap: wrap;
  1664. align-content: center;
  1665. justify-content: flex-start;
  1666. align-items: center;
  1667. }
  1668. .fenye {
  1669. margin-top: 20px;
  1670. }
  1671. .elipt {
  1672. width: 50%;
  1673. }
  1674. .elspan {
  1675. margin-left: 10px;
  1676. }
  1677. </style>
  1678. <style>
  1679. .avatar-uploader .el-upload {
  1680. border: 1px dashed #d9d9d9;
  1681. border-radius: 6px;
  1682. cursor: pointer;
  1683. position: relative;
  1684. overflow: hidden;
  1685. }
  1686. .avatar-uploader .el-upload:hover {
  1687. border-color: #409EFF;
  1688. }
  1689. .avatar-uploader-icon {
  1690. font-size: 28px;
  1691. color: #8c939d;
  1692. width: 130px;
  1693. height: 130px;
  1694. line-height: 130px;
  1695. text-align: center;
  1696. }
  1697. .row-content{
  1698. display: flex;
  1699. flex-direction: row;
  1700. justify-content: space-around;
  1701. }
  1702. .avatar {
  1703. width: 130px;
  1704. height: 130px;
  1705. display: block;
  1706. }
  1707. .col-content{
  1708. display: flex;
  1709. flex-direction: column;
  1710. }
  1711. </style>