index.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
  3. <template slot-scope="{ activeKey, data }">
  4. <div class="app-container">
  5. <div v-if="activeKey == 'list'" class="mymain-container">
  6. <div>
  7. <el-select v-model="value1" multiple placeholder="显示层级">
  8. <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  9. </el-select>
  10. <span style="display: inline-block; width: 220px; margin: 0 10px"
  11. ><el-input v-model="input" placeholder="模糊搜索"></el-input
  12. ></span>
  13. <el-button type="primary" @click="handleDownload">下载模板</el-button>
  14. <span style="display: inline-block; margin: 0 10px">
  15. <el-upload action="_" :show-file-list="false" :http-request="adminWebsitImportFun">
  16. <el-button type="primary">导入</el-button>
  17. </el-upload>
  18. </span>
  19. <el-button type="primary" @click="daochuqu">导出</el-button>
  20. </div>
  21. <div class="table">
  22. <el-table :data="showList" border>
  23. <el-table-column prop="type" label="级别" width="70">
  24. <template slot-scope="scope">
  25. <el-tag v-if="scope.row.type == 'A'" type="success">平台</el-tag>
  26. <el-tag v-if="scope.row.type == 'B'">商户</el-tag>
  27. <el-tag v-if="scope.row.type == 'C'" type="warning">网点</el-tag>
  28. </template>
  29. </el-table-column>
  30. <el-table-column prop="name" label="网点名称"> </el-table-column>
  31. <el-table-column prop="" label="结构">
  32. <template slot-scope="scope">
  33. {{ scope.row.pname.join(' -> ') }}
  34. </template>
  35. </el-table-column>
  36. <el-table-column align="center" label="状态" class-name="status-col" width="80">
  37. <template slot-scope="scope">
  38. <el-tag :type="scope.row.status ? 'success' : 'danger'">{{
  39. scope.row.status ? '启用' : '禁用'
  40. }}</el-tag>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="操作" width="268" fixed="right">
  44. <template slot-scope="scope">
  45. <el-button
  46. type="primary"
  47. size="mini"
  48. icon="el-icon-edit"
  49. @click="openMainForm('edit', scope.row.websitId)"
  50. >编辑</el-button
  51. >
  52. <el-button type="primary" size="mini" icon="el-icon-edit" @click="handleDelete(scope.row.websitId)"
  53. >删除</el-button
  54. >
  55. <el-button
  56. v-if="!!~['A', 'B'].indexOf(scope.row.type)"
  57. :type="{ A: 'primary', B: 'warning' }[scope.row.type]"
  58. plain
  59. size="mini"
  60. icon="el-icon-plus"
  61. @click="openMainForm('add', scope.row.websitId)"
  62. >
  63. 添加{{ scope.row.type == 'A' ? '商户' : scope.row.type == 'B' ? '网点' : '网点' }}
  64. </el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. <div class="pagination clearfix">
  70. <div class="fr">
  71. <el-pagination
  72. @size-change="handleSizeChange"
  73. @current-change="handleCurrentChange"
  74. :current-page="currentPage"
  75. :page-sizes="[15, 20, 30, 50]"
  76. :page-size="pageSize"
  77. layout="total, sizes, prev, pager, next, jumper"
  78. :total="listTotal"
  79. >
  80. </el-pagination>
  81. </div>
  82. </div>
  83. </div>
  84. <div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box; padding-bottom: 50px">
  85. <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="130px">
  86. <el-row :gutter="20" justify="start">
  87. <el-col :span="6">
  88. <el-form-item label="上级" prop="parentId">
  89. <el-cascader
  90. style="width: 100%"
  91. :options="dataList2"
  92. :props="{ checkStrictly: true, value: 'websitId', label: 'name' }"
  93. v-model="mainForm.parentId"
  94. :disabled="true"
  95. filterable
  96. clearable
  97. >
  98. </el-cascader>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="6">
  102. <el-form-item label="所属公司" prop="belongCompanyCode">
  103. <el-select
  104. v-model="mainForm.belongCompanyCode"
  105. placeholder="请选择"
  106. @change="
  107. V => {
  108. if (v) {
  109. belongCompany = BELONG_COMPANY.find(v).label
  110. } else {
  111. belongCompany = ''
  112. }
  113. }
  114. "
  115. >
  116. <el-option v-for="item in BELONG_COMPANY" :key="item.value" :label="item.label" :value="item.value">
  117. </el-option>
  118. </el-select>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="6">
  122. <el-form-item label="网点名称" prop="name">
  123. <el-input placeholder="请输入网点名称" v-model="mainForm.name"></el-input>
  124. </el-form-item>
  125. </el-col>
  126. <el-col :span="6">
  127. <el-form-item label="网点编号" prop="websitId">
  128. <el-input
  129. :disabled="!!~['edit'].indexOf(activeKey)"
  130. placeholder="请输入网点编号"
  131. v-model="mainForm.websitId"
  132. ></el-input>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="6">
  136. <el-form-item label="网点属性" prop="attr">
  137. <el-radio-group
  138. v-model="mainForm.attr"
  139. @change="
  140. v => {
  141. if (v !== 'SELF') {
  142. mainForm.insureType = ['意外险', '雇主险']
  143. } else {
  144. mainForm.insureType = ['意外险']
  145. }
  146. }
  147. "
  148. >
  149. <el-radio label="SELF">自建网点</el-radio>
  150. <el-radio label="MAJOR">第三方专业网点</el-radio>
  151. <el-radio label="MERCHANT">第三方经销商家网点</el-radio>
  152. </el-radio-group>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="6">
  156. <el-form-item label="网点级别" prop="level">
  157. <div style="min-width: 220px">
  158. <el-radio-group v-model="mainForm.level">
  159. <el-radio :label="1">一级网点</el-radio>
  160. <el-radio :label="2">二级网点</el-radio>
  161. </el-radio-group>
  162. </div>
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="6">
  166. <el-form-item label="状态" prop="status">
  167. <div style="min-width: 220px">
  168. <el-radio-group v-model="mainForm.status">
  169. <el-radio :label="true">启用</el-radio>
  170. <el-radio :label="false">禁用</el-radio>
  171. </el-radio-group>
  172. </div>
  173. </el-form-item>
  174. </el-col>
  175. <el-col :span="6">
  176. <el-form-item label="电子支付商户" prop="payWorkerCodeId">
  177. <el-select v-model="mainForm.payWorkerCodeId" placeholder="请选择">
  178. <el-option
  179. v-for="item in PayConfigListDianzi"
  180. :key="item.value"
  181. :label="item.label"
  182. :value="item.value"
  183. >
  184. </el-option>
  185. </el-select>
  186. <div style="margin-left: 5px; color: #fd8005; width: calc(100% + 120px); margin-left: -90px">
  187. 配置师傅销售辅材配件给用户的电子支付收款商户
  188. </div>
  189. </el-form-item>
  190. </el-col>
  191. <el-col :span="6">
  192. <el-form-item label="保险类型" prop="insureType">
  193. <div style="min-width: 220px">
  194. <el-checkbox-group v-model="mainForm.insureType">
  195. <el-checkbox
  196. label="意外险"
  197. :disabled="mainForm.insureType.includes('意外险') || mainForm.attr !== 'SELF'"
  198. >意外险</el-checkbox
  199. >
  200. <el-checkbox
  201. label="雇主险"
  202. :disabled="mainForm.attr !== 'SELF'"
  203. @change="
  204. () => {
  205. if (mainForm.insureType.includes('雇主险') && mainForm.insureType.includes('工伤险')) {
  206. mainForm.insureType.splice(mainForm.insureType.indexOf('工伤险'), 1)
  207. }
  208. }
  209. "
  210. >雇主险</el-checkbox
  211. >
  212. <el-checkbox
  213. label="工伤险"
  214. :disabled="mainForm.attr !== 'SELF'"
  215. @change="
  216. () => {
  217. if (mainForm.insureType.includes('雇主险') && mainForm.insureType.includes('工伤险')) {
  218. mainForm.insureType.splice(mainForm.insureType.indexOf('雇主险'), 1)
  219. }
  220. }
  221. "
  222. >工伤险</el-checkbox
  223. >
  224. </el-checkbox-group>
  225. </div>
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="6" v-if="mainForm.attr == 'SELF'">
  229. <el-form-item label="保险支付商户" prop="payInsureCodeId">
  230. <el-select v-model="mainForm.payInsureCodeId" placeholder="请选择">
  231. <el-option v-for="item in PayConfigList" :key="item.value" :label="item.label" :value="item.value">
  232. </el-option>
  233. </el-select>
  234. </el-form-item>
  235. </el-col>
  236. <!-- -->
  237. <!-- -->
  238. <el-col :span="6" v-if="mainForm.attr == 'SELF'">
  239. <el-form-item
  240. label="工伤险代买单位"
  241. prop="insureSteadUnit"
  242. :rules="
  243. mainForm.insureType.includes('工伤险')
  244. ? [{ required: true, message: '请你选择', trigger: 'blur' }]
  245. : []
  246. "
  247. >
  248. <el-select v-model="mainForm.insureSteadUnit" placeholder="请选择">
  249. <el-option
  250. v-for="item in INSURE_STEAD_UNIT"
  251. :key="item.value"
  252. :label="item.label"
  253. :value="item.value"
  254. >
  255. </el-option>
  256. </el-select>
  257. </el-form-item>
  258. </el-col>
  259. <!-- -->
  260. <!-- -->
  261. <el-col :span="6">
  262. <el-form-item label="企业法人" prop="legalName">
  263. <el-input placeholder="请输入" v-model="mainForm.legalName"></el-input>
  264. </el-form-item>
  265. </el-col>
  266. <el-col :span="6">
  267. <el-form-item label="法人手机" prop="legalMobile">
  268. <el-input placeholder="请输入" v-model="mainForm.legalMobile"></el-input>
  269. </el-form-item>
  270. </el-col>
  271. <el-col :span="6">
  272. <el-form-item label="法人身份证" prop="legalIdCard">
  273. <el-input placeholder="请输入" v-model="mainForm.legalIdCard"></el-input>
  274. </el-form-item>
  275. </el-col>
  276. <el-col :span="12">
  277. <el-form-item label="地址" prop="address">
  278. <div style="display: flex">
  279. <el-input placeholder="请选择地址" style="margin-right: 20px" v-model="mainForm.address"></el-input>
  280. <geographicalPosi :formData="mainForm" @selectPosi="selectAddress"></geographicalPosi>
  281. </div>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="6">
  285. <el-form-item label="办公电话" prop="websitPhone">
  286. <el-input placeholder="请输入" v-model="mainForm.websitPhone"></el-input>
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="6">
  290. <el-form-item label="开户银行" prop="openBank">
  291. <el-input placeholder="请输入" v-model="mainForm.openBank"></el-input>
  292. </el-form-item>
  293. </el-col>
  294. <el-col :span="6">
  295. <el-form-item label="银行账号" prop="bankAccount">
  296. <el-input placeholder="请输入" v-model="mainForm.bankAccount"></el-input>
  297. </el-form-item>
  298. </el-col>
  299. <el-col :span="6">
  300. <el-form-item label="邮箱" prop="email">
  301. <el-input placeholder="请输入" v-model="mainForm.email"></el-input>
  302. </el-form-item>
  303. </el-col>
  304. <el-col :span="6">
  305. <el-form-item label="传真" prop="fax">
  306. <el-input placeholder="请输入" v-model="mainForm.fax"></el-input>
  307. </el-form-item>
  308. </el-col>
  309. <el-col :span="6">
  310. <el-form-item label="联系人" prop="linkName">
  311. <el-input placeholder="请输入联系人名称" v-model="mainForm.linkName"></el-input>
  312. </el-form-item>
  313. </el-col>
  314. <el-col :span="6">
  315. <el-form-item label="联系人电话" prop="linkMobile">
  316. <el-input
  317. placeholder="请输入联系人电话"
  318. maxlength="11"
  319. type="number"
  320. v-model="mainForm.linkMobile"
  321. ></el-input>
  322. </el-form-item>
  323. </el-col>
  324. <el-col :span="6">
  325. <el-form-item label="邮编" prop="zipCode">
  326. <el-input placeholder="请输入" v-model="mainForm.zipCode"></el-input>
  327. </el-form-item>
  328. </el-col>
  329. <el-col :span="6">
  330. <el-form-item label="配件网点编号" prop="partsWebsitId">
  331. <el-input placeholder="请填写" v-model="mainForm.partsWebsitId"></el-input>
  332. </el-form-item>
  333. </el-col>
  334. <el-col :span="6">
  335. <el-form-item label="配件网点属性" prop="partsWebsitAttr">
  336. <el-radio-group v-model="mainForm.partsWebsitAttr">
  337. <el-radio :label="true">市区</el-radio>
  338. <el-radio :label="false">外区</el-radio>
  339. </el-radio-group>
  340. </el-form-item>
  341. </el-col>
  342. <el-col :span="6">
  343. <el-form-item label="配件是否支持现金" prop="partsIsCash">
  344. <el-radio-group v-model="mainForm.partsIsCash">
  345. <el-radio :label="true">支持</el-radio>
  346. <el-radio :label="false">不支持</el-radio>
  347. </el-radio-group>
  348. </el-form-item>
  349. </el-col>
  350. <el-col :span="24">
  351. <el-form-item label="通联支付" prop="isUseAllinpay">
  352. <el-switch v-model="mainForm.isUseAllinpay" active-color="#13ce66" inactive-color="#ff4949">
  353. </el-switch>
  354. <span style="margin-left: 5px; color: #fd8005">网点销售辅材配件通联支付配置开关</span>
  355. </el-form-item>
  356. </el-col>
  357. <el-col :span="24" v-if="mainForm.isUseAllinpay">
  358. <el-button
  359. v-if="!editId"
  360. type="text"
  361. @click="
  362. () => {
  363. mainForm.payConfigList.push({})
  364. }
  365. "
  366. >添加</el-button
  367. >
  368. <el-table
  369. :data="editId ? [{}, ...(mainForm.payConfigList || [])] : mainForm.payConfigList || []"
  370. style="width: 100%"
  371. >
  372. <el-table-column prop="name" label="商户名称">
  373. <template slot-scope="scope">
  374. <el-input
  375. v-if="!!~indexs.indexOf(scope.$index) || !editId"
  376. v-model="scope.row.name"
  377. placeholder="请输入内容"
  378. ></el-input>
  379. <span v-else>{{ scope.row.name }}</span>
  380. </template>
  381. </el-table-column>
  382. <el-table-column prop="orgId" label="通联集团号">
  383. <template slot-scope="scope">
  384. <el-input
  385. v-if="!!~indexs.indexOf(scope.$index) || !editId"
  386. v-model="scope.row.orgId"
  387. placeholder="请输入内容"
  388. ></el-input>
  389. <span v-else>{{ scope.row.orgId }}</span>
  390. </template>
  391. </el-table-column>
  392. <el-table-column prop="type" label="类别">
  393. <template slot-scope="scope">
  394. <el-select
  395. v-if="!!~indexs.indexOf(scope.$index) || !editId"
  396. v-model="scope.row.type"
  397. placeholder="请选择"
  398. >
  399. <el-option label="辅材" value="M" />
  400. <el-option label="配件" value="P" />
  401. </el-select>
  402. <span v-else>{{ { M: '辅材', P: '配件' }[scope.row.type] }}</span>
  403. </template>
  404. </el-table-column>
  405. <el-table-column prop="mchNo" label="通联商户号">
  406. <template slot-scope="scope">
  407. <el-input
  408. v-if="!!~indexs.indexOf(scope.$index) || !editId"
  409. v-model="scope.row.mchNo"
  410. placeholder="请输入内容"
  411. ></el-input>
  412. <span v-else>{{ scope.row.mchNo }}</span>
  413. </template>
  414. </el-table-column>
  415. <el-table-column prop="appid" label="通联商户appid">
  416. <template slot-scope="scope">
  417. <el-input
  418. v-if="!!~indexs.indexOf(scope.$index) || !editId"
  419. v-model="scope.row.appid"
  420. placeholder="请输入内容"
  421. ></el-input>
  422. <span v-else>{{ scope.row.appid }}</span>
  423. </template>
  424. </el-table-column>
  425. <el-table-column prop="status" label="状态">
  426. <template slot-scope="scope">
  427. <el-select
  428. v-if="!!~indexs.indexOf(scope.$index) || !editId"
  429. v-model="scope.row.status"
  430. placeholder="请选择"
  431. >
  432. <el-option label="开启" :value="true" />
  433. <el-option label="关闭" :value="false" />
  434. </el-select>
  435. <span v-else>{{ scope.row.type ? '开启' : '关闭' }}</span>
  436. </template>
  437. </el-table-column>
  438. <el-table-column v-if="editId" prop="createBy" label="创建人"> </el-table-column>
  439. <el-table-column v-if="editId" prop="createTime" label="创建时间"> </el-table-column>
  440. <el-table-column v-if="editId" prop="updateBy" label="修改人"> </el-table-column>
  441. <el-table-column v-if="editId" prop="" label="操作">
  442. <template slot-scope="scope">
  443. <el-button v-if="!!~indexs.indexOf(scope.$index)" type="text" @click="caozuoanniuSave(scope)"
  444. >保存</el-button
  445. >
  446. <el-button
  447. v-if="!~indexs.indexOf(scope.$index) && scope.$index > 0"
  448. type="text"
  449. @click="caozuoanniuEid(scope)"
  450. >编辑</el-button
  451. >
  452. <el-button
  453. v-if="!~indexs.indexOf(scope.$index) && scope.$index > 0"
  454. type="text"
  455. @click="caozuoanniuDel(scope)"
  456. >删除</el-button
  457. >
  458. </template>
  459. </el-table-column>
  460. </el-table>
  461. </el-col>
  462. </el-row>
  463. </el-form>
  464. <div class="footer">
  465. <el-button @click="data.removeTab()">取 消</el-button>
  466. <el-button type="primary" @click="submitMainForm(data.removeTab)">确 定</el-button>
  467. </div>
  468. </div>
  469. </div>
  470. </template>
  471. </zj-tab-page>
  472. </template>
  473. <script>
  474. import {
  475. getDepartmentList,
  476. addDepartment,
  477. editDepartment,
  478. getDepartmentDetail,
  479. deleteDepartment,
  480. adminWebsitSavePayConfig,
  481. adminWebsitDeletePayConfig,
  482. adminWebsitImport,
  483. adminWebsitExport
  484. } from '@/api/setting'
  485. import geographicalPosi from '@/components/geographicalPosi/index.vue'
  486. import { adminCompanyPayConfigList } from '@/api/paymentMerchantManagement'
  487. import { commonTemplateDownload } from '@/api/common.js'
  488. import { dictListDict } from '@/api/dataDictionary.js'
  489. import { getDataDictionary } from '@/api/dataDictionary.js'
  490. export default {
  491. components: { geographicalPosi },
  492. data() {
  493. return {
  494. PayConfigList: [],
  495. PayConfigListDianzi: [],
  496. dataList: [], // 列表数据
  497. dataList2: [], // 列表数据
  498. listLoading: true, // 列表加载loading
  499. currentPage: 1, // 当前页码
  500. pageSize: 15, // 每页数量
  501. editId: null,
  502. mainFormType: 'add',
  503. mainFormVisible: false,
  504. addressVisible: false,
  505. input: '',
  506. value1: [],
  507. levels: [],
  508. types: [
  509. { label: '平台', value: 'A' },
  510. { label: '商户', value: 'B' },
  511. { label: '网点', value: 'C' }
  512. ],
  513. mainForm: {
  514. parentId: '',
  515. name: '',
  516. linkName: '',
  517. websitId: '',
  518. websitPhone: '',
  519. lat: '',
  520. lng: '',
  521. address: '',
  522. status: true,
  523. isUseAllinpay: true,
  524. payWorkerCodeId: '',
  525. payConfigList: [],
  526. isIncre: true,
  527. joinCode: '',
  528. type: '',
  529. partsWebsitId: '',
  530. partsWebsitAttr: '',
  531. partsIsCash: '',
  532. legalName: '',
  533. legalMobile: '',
  534. legalIdCard: '',
  535. openBank: '',
  536. bankAccount: '',
  537. email: '',
  538. fax: '',
  539. zipCode: '',
  540. linkMobile: '',
  541. attr: '',
  542. level: '',
  543. insureType: ['意外险'],
  544. belongCompanyCode: '',
  545. belongCompany: '',
  546. payInsureCodeId: '',
  547. insureSteadUnit: ''
  548. },
  549. indexs: [0],
  550. BELONG_COMPANY: [],
  551. INSURE_STEAD_UNIT: []
  552. }
  553. },
  554. created() {
  555. this.getList()
  556. },
  557. computed: {
  558. mainFormRules() {
  559. return {
  560. name: [{ required: true, message: '请填写网点名称', trigger: 'blur' }],
  561. linkName: [{ required: true, message: '请填写联系人名称', trigger: 'blur' }],
  562. websitId: [{ required: true, message: '请填写网点编号', trigger: 'blur' }],
  563. websitPhone: [{ required: true, message: '请填写联系人电话', trigger: 'blur' }],
  564. address: [{ required: true, message: '请选择GPS地址', trigger: 'blur' }],
  565. payWorkerCodeId: [{ required: true, message: '请选择电子支付商户', trigger: 'blur' }],
  566. legalName: [{ required: true, message: '请输入', trigger: 'blur' }],
  567. legalMobile: [{ required: true, message: '请输入', trigger: 'blur' }],
  568. legalIdCard: [{ required: true, message: '请输入', trigger: 'blur' }],
  569. openBank: [{ required: true, message: '请输入', trigger: 'blur' }],
  570. bankAccount: [{ required: true, message: '请输入', trigger: 'blur' }],
  571. email: [{ required: true, message: '请输入', trigger: 'blur' }],
  572. zipCode: [{ required: true, message: '请输入', trigger: 'blur' }],
  573. attr: [{ required: true, message: '请输入', trigger: 'blur' }],
  574. level: [{ required: true, message: '请输入', trigger: 'blur' }],
  575. insureType: [{ required: true, message: '请输入', trigger: 'blur' }],
  576. belongCompanyCode: [{ required: true, message: '请输入', trigger: 'blur' }],
  577. payInsureCodeId: [{ required: true, message: '请输入', trigger: 'blur' }]
  578. }
  579. },
  580. showList() {
  581. return [...this.dataList]
  582. .filter(item => {
  583. return (
  584. (this.value1.length ? !!~this.value1.indexOf(item.type) : true) &&
  585. (this.input
  586. ? !!~item.name.indexOf(this.input) ||
  587. !!~item.pname.indexOf(this.input) ||
  588. !!~item.websitNumber.indexOf(this.input)
  589. : true)
  590. )
  591. })
  592. .splice((this.currentPage - 1) * this.pageSize, this.pageSize)
  593. },
  594. listTotal() {
  595. return [...this.dataList].filter(item => {
  596. return (
  597. (this.value1.length ? !!~this.value1.indexOf(item.type) : true) &&
  598. (this.input
  599. ? !!~item.name.indexOf(this.input) ||
  600. !!~item.pname.indexOf(this.input) ||
  601. !!~item.websitNumber.indexOf(this.input)
  602. : true)
  603. )
  604. }).length
  605. }
  606. },
  607. watch: {
  608. value1() {
  609. this.$nextTick(() => {
  610. this.currentPage = 1
  611. })
  612. },
  613. input() {
  614. this.$nextTick(() => {
  615. this.currentPage = 1
  616. })
  617. }
  618. },
  619. methods: {
  620. daochuqu() {
  621. adminWebsitExport({}, `网点管理`)
  622. .then(res => {
  623. this.$message({
  624. message: '导出成功',
  625. type: 'success'
  626. })
  627. })
  628. .catch(err => {
  629. this.$message.error('导出失败')
  630. })
  631. },
  632. adminWebsitImportFun(data) {
  633. const loading = this.$loading({
  634. lock: true,
  635. text: '正在导入',
  636. spinner: 'el-icon-loading',
  637. background: 'rgba(0, 0, 0, 0.7)'
  638. })
  639. var formdata = new FormData()
  640. formdata.append('file', data.file)
  641. adminWebsitImport({ formdata })
  642. .then(res => {
  643. this.getList()
  644. loading.close()
  645. this.$message({
  646. type: 'success',
  647. message: '导入成功!'
  648. })
  649. })
  650. .catch(err => {
  651. loading.close()
  652. this.$message({
  653. type: 'error',
  654. message: err.message || '导入失败'
  655. })
  656. })
  657. },
  658. // 下载导入模版
  659. handleDownload() {
  660. commonTemplateDownload({ name: '网点管理导入模板.xlsx' }, '网点管理导入模板')
  661. .then(res => {
  662. this.$message({
  663. message: '下载成功',
  664. type: 'success'
  665. })
  666. })
  667. .catch(err => {
  668. this.$message.error('下载失败')
  669. })
  670. },
  671. // 获取网点列表
  672. getList() {
  673. var list_ = []
  674. var levels = []
  675. function dg(list, level = 1, pname = []) {
  676. for (let { children, name, ...item } of list) {
  677. var n_ = ''
  678. for (var i = 1; i < level; i++) n_ += ` -> `
  679. list_.push({
  680. ...item,
  681. name: item.type == 'C' ? `${n_}(${item.websitNumber})${name}` : `${n_}${name}`,
  682. level,
  683. pname: [...pname]
  684. })
  685. if (!~levels.indexOf(level)) levels.push(level)
  686. if (children && children.length)
  687. dg(children, level + 1, [
  688. ...pname,
  689. item.type == 'C' ? `${n_}(${item.websitNumber})${name}` : `${n_}${name}`
  690. ])
  691. }
  692. }
  693. getDepartmentList().then(res => {
  694. this.dataList2 = res?.data || []
  695. dg(res?.data || [])
  696. this.dataList = list_
  697. this.levels = levels
  698. })
  699. },
  700. selectAddress(res) {
  701. this.mainForm.lng = res.center[0]
  702. this.mainForm.lat = res.center[1]
  703. this.mainForm.address = res.name
  704. },
  705. // 更改每页数量
  706. handleSizeChange(val) {
  707. this.pageSize = val
  708. this.currentPage = 1
  709. // this.getList()
  710. },
  711. // 更改当前页
  712. handleCurrentChange(val) {
  713. this.currentPage = val
  714. // this.getList()
  715. },
  716. // 操作 - 删除
  717. handleDelete(id) {
  718. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  719. confirmButtonText: '确定',
  720. cancelButtonText: '取消',
  721. showClose: false,
  722. type: 'warning'
  723. })
  724. .then(() => {
  725. deleteDepartment({ id: id }).then(res => {
  726. this.getList()
  727. this.$successMsg()
  728. })
  729. })
  730. .catch(() => {})
  731. },
  732. // 打开 新增编辑 网点表单
  733. openMainForm(type, id) {
  734. this.$refs.tabPage.addTab({
  735. // 对应显示的模块
  736. activeKey: type,
  737. // 唯一标识
  738. key: type,
  739. // 页签名称
  740. label: { edit: '编辑', add: '新增' }[type],
  741. // 打开时事件
  742. triggerEvent: () => {
  743. getDataDictionary({
  744. pageNum: 1,
  745. pageSize: -1,
  746. params: [
  747. { param: 'a.status', compare: '=', value: 'ON' },
  748. { param: 'a.dict_type', compare: '=', value: 'BELONG_COMPANY' }
  749. ]
  750. }).then(res => {
  751. this.BELONG_COMPANY = res.data.records.map(item => ({
  752. value: item.dictCode,
  753. label: item.dictValue
  754. }))
  755. })
  756. getDataDictionary({
  757. pageNum: 1,
  758. pageSize: -1,
  759. params: [
  760. { param: 'a.status', compare: '=', value: 'ON' },
  761. { param: 'a.dict_type', compare: '=', value: 'INSURE_STEAD_UNIT' }
  762. ]
  763. }).then(res => {
  764. this.INSURE_STEAD_UNIT = res.data.records.map(item => ({
  765. value: item.dictCode,
  766. label: item.dictValue
  767. }))
  768. })
  769. adminCompanyPayConfigList({
  770. pageNum: 1,
  771. pageSize: -1,
  772. params: [{ param: 'a.attr', compare: 'like', value: '保险支付' }]
  773. }).then(res => {
  774. this.PayConfigList = res.data.records.map(item => ({
  775. label: item.payMerchantName,
  776. value: item.id
  777. }))
  778. })
  779. adminCompanyPayConfigList({
  780. pageNum: 1,
  781. pageSize: -1,
  782. params: [{ param: 'a.attr', compare: 'like', value: '电子支付' }]
  783. }).then(res => {
  784. this.PayConfigListDianzi = res.data.records.map(item => ({
  785. label: item.payMerchantName,
  786. value: item.id
  787. }))
  788. })
  789. this.cancelMainForm()
  790. this.$nextTick(() => {
  791. this.mainFormType = type
  792. this.mainFormVisible = true
  793. if (type == 'add') {
  794. this.editId = null
  795. this.mainForm.parentId = id
  796. } else {
  797. this.editId = id
  798. getDepartmentDetail({ id }).then(res => {
  799. this.mainForm = {
  800. parentId: res.data.parentId,
  801. name: res.data.name,
  802. linkName: res.data.linkName,
  803. websitId: res.data.websitId,
  804. websitPhone: res.data.websitPhone,
  805. lat: res.data.lat,
  806. lng: res.data.lng,
  807. address: res.data.address,
  808. status: res.data.status,
  809. isUseAllinpay: res.data.isUseAllinpay,
  810. payWorkerCodeId: res.data.payWorkerCodeId,
  811. partsWebsitId: res.data.partsWebsitId,
  812. partsWebsitAttr: res.data.partsWebsitAttr,
  813. partsIsCash: res.data.partsIsCash,
  814. payConfigList: res.data.payConfigList || [],
  815. isIncre: res.data.isIncre,
  816. joinCode: res.data.joinCode,
  817. type: res.data.type,
  818. legalName: res.data.legalName,
  819. legalMobile: res.data.legalMobile,
  820. legalIdCard: res.data.legalIdCard,
  821. openBank: res.data.openBank,
  822. bankAccount: res.data.bankAccount,
  823. email: res.data.email,
  824. fax: res.data.fax,
  825. zipCode: res.data.zipCode,
  826. linkMobile: res.data.linkMobile,
  827. attr: res.data.attr,
  828. level: res.data.level,
  829. insureType: [...new Set((res.data.insureType ? res.data.insureType.split(',') : []).push('意外险'))],
  830. belongCompanyCode: res.data.belongCompanyCode,
  831. belongCompany: res.data.belongCompany,
  832. payInsureCodeId: res.data.payInsureCodeId,
  833. insureSteadUnit: res.data.insureSteadUnit
  834. }
  835. })
  836. }
  837. })
  838. },
  839. // 关闭时事件
  840. closeEvent: () => {}
  841. })
  842. },
  843. // 取消 新增编辑 网点表单
  844. cancelMainForm() {
  845. this.mainFormVisible = false
  846. this.$refs?.mainForm?.clearValidate()
  847. this.$refs?.mainForm?.resetFields()
  848. this.$data.mainForm = this.$options.data().mainForm
  849. },
  850. // 提交 网点表单
  851. submitMainForm(removeTab) {
  852. this.$refs.mainForm.validate(valid => {
  853. if (valid) {
  854. let parentId = null
  855. if (this.mainForm.parentId instanceof Array) {
  856. parentId = this.mainForm.parentId[this.mainForm.parentId.length - 1]
  857. } else {
  858. parentId = this.mainForm.parentId
  859. }
  860. let params = {
  861. parentId,
  862. name: this.mainForm.name,
  863. linkName: this.mainForm.linkName,
  864. websitId: this.mainForm.websitId,
  865. websitPhone: this.mainForm.websitPhone,
  866. lat: this.mainForm.lat,
  867. lng: this.mainForm.lng,
  868. address: this.mainForm.address,
  869. status: this.mainForm.status,
  870. isIncre: this.mainForm.isIncre,
  871. isUseAllinpay: this.mainForm.isUseAllinpay,
  872. payWorkerCodeId: this.mainForm.payWorkerCodeId,
  873. partsWebsitId: this.mainForm.partsWebsitId,
  874. partsWebsitAttr: this.mainForm.partsWebsitAttr,
  875. partsIsCash: this.mainForm.partsIsCash,
  876. payConfigList: this.mainForm.payConfigList,
  877. joinCode: this.mainForm.joinCode,
  878. legalName: this.mainForm.legalName,
  879. legalMobile: this.mainForm.legalMobile,
  880. legalIdCard: this.mainForm.legalIdCard,
  881. openBank: this.mainForm.openBank,
  882. bankAccount: this.mainForm.bankAccount,
  883. email: this.mainForm.email,
  884. fax: this.mainForm.fax,
  885. zipCode: this.mainForm.zipCode,
  886. linkMobile: this.mainForm.linkMobile,
  887. attr: this.mainForm.attr,
  888. level: this.mainForm.level,
  889. insureType: (this.mainForm.insureType || []).join(','),
  890. belongCompanyCode: this.mainForm.belongCompanyCode,
  891. belongCompany: this.mainForm.belongCompany,
  892. payInsureCodeId: this.mainForm.payInsureCodeId,
  893. insureSteadUnit: this.mainForm.insureSteadUnit
  894. }
  895. if (this.mainFormType == 'edit') {
  896. params.websitId = this.editId
  897. editDepartment(params).then(res => {
  898. this.getList()
  899. this.$successMsg('编辑成功')
  900. removeTab('list')
  901. })
  902. } else {
  903. addDepartment(params).then(res => {
  904. this.getList()
  905. this.$successMsg('添加成功')
  906. removeTab('list')
  907. })
  908. }
  909. }
  910. })
  911. },
  912. caozuoanniuSave(data) {
  913. adminWebsitSavePayConfig({
  914. ...{
  915. companyWechatName: JSON.parse(localStorage.getItem('greemall_user'))?.companyName || '',
  916. companyWechatId: JSON.parse(localStorage.getItem('greemall_user'))?.companyWechatId || '',
  917. websitId: this.editId
  918. },
  919. ...data.row
  920. }).then(res => {
  921. getDepartmentDetail({ id: this.editId }).then(res => {
  922. this.mainForm = {
  923. parentId: res.data.parentId,
  924. name: res.data.name,
  925. linkName: res.data.linkName,
  926. websitId: res.data.websitId,
  927. websitPhone: res.data.websitPhone,
  928. lat: res.data.lat,
  929. lng: res.data.lng,
  930. address: res.data.address,
  931. status: res.data.status,
  932. isUseAllinpay: res.data.isUseAllinpay,
  933. payWorkerCodeId: res.data.payWorkerCodeId,
  934. partsWebsitId: res.data.partsWebsitId,
  935. partsWebsitAttr: res.data.partsWebsitAttr,
  936. partsIsCash: res.data.partsIsCash,
  937. payConfigList: res.data.payConfigList || [],
  938. isIncre: res.data.isIncre,
  939. joinCode: res.data.joinCode,
  940. type: res.data.type,
  941. legalName: res.data.legalName,
  942. legalMobile: res.data.legalMobile,
  943. legalIdCard: res.data.legalIdCard,
  944. openBank: res.data.openBank,
  945. bankAccount: res.data.bankAccount,
  946. email: res.data.email,
  947. fax: res.data.fax,
  948. zipCode: res.data.zipCode,
  949. linkMobile: res.data.linkMobile,
  950. attr: res.data.attr,
  951. level: res.data.level,
  952. insureType: [...new Set((res.data.insureType ? res.data.insureType.split(',') : []).push('意外险'))],
  953. belongCompanyCode: res.data.belongCompanyCode,
  954. belongCompany: res.data.belongCompany,
  955. payInsureCodeId: res.data.payInsureCodeId,
  956. insureSteadUnit: res.data.insureSteadUnit
  957. }
  958. this.$successMsg('保存成功')
  959. if (data.$index > 0) {
  960. if (~indexs.indexOf(data.$index)) {
  961. this.indexs.splice(indexs.indexOf(data.$index), 1)
  962. }
  963. }
  964. })
  965. })
  966. },
  967. caozuoanniuDel(data) {
  968. adminWebsitDeletePayConfig({
  969. id: data.row.id
  970. }).then(res => {
  971. getDepartmentDetail({ id: this.editId }).then(res => {
  972. this.mainForm = {
  973. parentId: res.data.parentId,
  974. name: res.data.name,
  975. linkName: res.data.linkName,
  976. websitId: res.data.websitId,
  977. websitPhone: res.data.websitPhone,
  978. lat: res.data.lat,
  979. lng: res.data.lng,
  980. address: res.data.address,
  981. status: res.data.status,
  982. isUseAllinpay: res.data.isUseAllinpay,
  983. payWorkerCodeId: res.data.payWorkerCodeId,
  984. partsWebsitId: res.data.partsWebsitId,
  985. partsWebsitAttr: res.data.partsWebsitAttr,
  986. partsIsCash: res.data.partsIsCash,
  987. payConfigList: res.data.payConfigList || [],
  988. isIncre: res.data.isIncre,
  989. joinCode: res.data.joinCode,
  990. type: res.data.type,
  991. legalName: res.data.legalName,
  992. legalMobile: res.data.legalMobile,
  993. legalIdCard: res.data.legalIdCard,
  994. openBank: res.data.openBank,
  995. bankAccount: res.data.bankAccount,
  996. email: res.data.email,
  997. fax: res.data.fax,
  998. zipCode: res.data.zipCode,
  999. linkMobile: res.data.linkMobile,
  1000. attr: res.data.attr,
  1001. level: res.data.level,
  1002. insureType: [...new Set((res.data.insureType ? res.data.insureType.split(',') : []).push('意外险'))],
  1003. belongCompanyCode: res.data.belongCompanyCode,
  1004. belongCompany: res.data.belongCompany,
  1005. payInsureCodeId: res.data.payInsureCodeId,
  1006. insureSteadUnit: res.data.insureSteadUnit
  1007. }
  1008. this.$successMsg('删除成功')
  1009. if (data.$index > 0) {
  1010. if (~indexs.indexOf(data.$index)) {
  1011. this.indexs.splice(indexs.indexOf(data.$index), 1)
  1012. }
  1013. }
  1014. })
  1015. })
  1016. },
  1017. caozuoanniuEid(data) {
  1018. if (!~this.indexs.indexOf(data.$index)) {
  1019. this.indexs.push(data.$index)
  1020. }
  1021. }
  1022. }
  1023. }
  1024. </script>
  1025. <style scoped lang="scss">
  1026. .footer {
  1027. position: fixed;
  1028. bottom: 0;
  1029. left: 0;
  1030. z-index: 1;
  1031. width: 100%;
  1032. background: #fff;
  1033. padding: 15px 40px;
  1034. box-sizing: border-box;
  1035. transition: all 0.28s;
  1036. text-align: right;
  1037. box-shadow: 0 2px 5px 0 rgb(0 0 0 / 50%), 0 2px 5px 0 rgb(0 0 0 / 10%);
  1038. &.hideSidebar {
  1039. margin-left: 54px;
  1040. width: calc(100vw - 54px);
  1041. }
  1042. &.openSidebar {
  1043. margin-left: 210px;
  1044. width: calc(100vw - 210px);
  1045. }
  1046. .tips {
  1047. font-size: 12px;
  1048. color: red;
  1049. margin-top: 10px;
  1050. }
  1051. }
  1052. ::v-deep .el-checkbox {
  1053. line-height: 16px !important;
  1054. }
  1055. ::v-deep .el-checkbox {
  1056. margin-right: 5px !important;
  1057. }
  1058. </style>