index.vue 37 KB

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