index.vue 38 KB

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