Dept_PayWay.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. >
  9. <el-form-item label="油企名称" prop="deptName">
  10. <el-input
  11. v-model="queryParams.deptName"
  12. placeholder="请输入油企名称"
  13. clearable
  14. size="small"
  15. @keyup.enter.native="handleQuery"
  16. />
  17. </el-form-item>
  18. <el-form-item label="状态" prop="status">
  19. <el-select
  20. v-model="queryParams.status"
  21. placeholder="部门状态"
  22. clearable
  23. size="small"
  24. >
  25. <el-option
  26. v-for="dict in statusOptions"
  27. :key="dict.dictValue"
  28. :label="dict.dictLabel"
  29. :value="dict.dictValue"
  30. />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-button
  35. type="cyan"
  36. icon="el-icon-search"
  37. size="mini"
  38. @click="handleQuery"
  39. >搜索</el-button
  40. >
  41. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  42. >重置</el-button
  43. >
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <el-col :span="1.5">
  48. <el-button
  49. type="primary"
  50. icon="el-icon-plus"
  51. size="mini"
  52. @click="handleAdd"
  53. >新增</el-button
  54. >
  55. </el-col>
  56. <right-toolbar
  57. :showSearch.sync="showSearch"
  58. @queryTable="getList"
  59. ></right-toolbar>
  60. </el-row>
  61. <el-table :data="payList" style="width: 100%">
  62. <el-table-column prop="deptName" label="油企名称" width="180">
  63. </el-table-column>
  64. <el-table-column prop="deptName" label="ID" width="180">
  65. </el-table-column>
  66. <el-table-column prop="deptName" label="排序" width="180">
  67. </el-table-column>
  68. </el-table>
  69. <el-dialog
  70. :title="'配置支付渠道'"
  71. :visible.sync="payOpen"
  72. width="800px"
  73. append-to-body
  74. >
  75. <el-form
  76. ref="payForm"
  77. :model="payForm"
  78. :rules="rules"
  79. label-width="80px"
  80. label-position="top"
  81. >
  82. <el-col :span="23">
  83. <el-form-item label="支付渠道类型">
  84. <el-select
  85. v-model="payForm.payType"
  86. placeholder="请选择支付渠道"
  87. clearable
  88. :style="{ width: '100%' }"
  89. >
  90. <el-option label="随行付" value="1"></el-option>
  91. <el-option label="云闪付" value="2"></el-option>
  92. </el-select>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="11">
  96. <el-form-item label="使用类型">
  97. <el-select
  98. v-model="payForm.useType"
  99. placeholder="请选择支付渠道的类型"
  100. clearable
  101. :style="{ width: '100%' }"
  102. >
  103. <el-option label="消费" value="1"></el-option>
  104. <el-option label="充值" value="0"></el-option>
  105. </el-select>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="11" :offset="1">
  109. <el-form-item label="应用渠道">
  110. <el-select
  111. v-model="payForm.appType"
  112. placeholder="请选择支付渠道应用的类型"
  113. clearable
  114. :style="{ width: '100%' }"
  115. >
  116. <el-option label="微信" value="1"></el-option>
  117. <el-option label="支付宝" value="2"></el-option>
  118. <el-option label="银行卡" value="3"></el-option>
  119. </el-select>
  120. </el-form-item>
  121. </el-col>
  122. <!--
  123. <el-col :span="24">
  124. <div style="font-size: 22px; font-weight: bolder; margin-top: 20px">
  125. 随行付信息
  126. <hr />
  127. </div>
  128. </el-col>
  129. -->
  130. <el-col :span="11" v-if="payForm.payType == '1'">
  131. <el-form-item label="随行付商户号" prop="mno">
  132. <el-input
  133. v-model="payForm.mno"
  134. maxlength="50"
  135. placeholder="请输入随行付商户号"
  136. />
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="11" :offset="1" v-if="payForm.payType == '1'">
  140. <el-form-item label="是否分账">
  141. <el-select
  142. v-model="payForm.mnoStatus"
  143. placeholder="请选择是否启用分账"
  144. clearable
  145. :style="{ width: '100%' }"
  146. >
  147. <el-option label="启用分账" value="1"></el-option>
  148. <el-option label="禁用分账" value="0"></el-option>
  149. </el-select>
  150. </el-form-item>
  151. </el-col>
  152. <el-col :span="11" v-if="payForm.payType == '1'">
  153. <el-form-item label="分账收款商户编号" prop="mnoArray">
  154. <el-input
  155. v-model="payForm.mnoArray"
  156. maxlength="50"
  157. placeholder="请输入分账收款商户编号"
  158. />
  159. </el-form-item>
  160. </el-col>
  161. <el-col :span="11" :offset="1" v-if="payForm.payType == '1'">
  162. <el-form-item label="分账账号比例" prop="mnoProportion">
  163. <el-input
  164. v-model="payForm.mnoProportion"
  165. maxlength="50"
  166. placeholder="请输入分账账号比例"
  167. />
  168. </el-form-item>
  169. </el-col>
  170. <!--
  171. <el-col :span="24">
  172. <div style="font-size: 22px; font-weight: bolder; margin-top: 20px">
  173. 云闪付信息
  174. <hr />
  175. </div>
  176. </el-col>
  177. -->
  178. <el-col :span="11" v-if="payForm.payType == '2'">
  179. <el-form-item label="云闪付商户号码" prop="merchantNo">
  180. <el-input
  181. v-model="payForm.merchantNo"
  182. maxlength="50"
  183. placeholder="请输入云闪付商户号码"
  184. />
  185. </el-form-item>
  186. </el-col>
  187. <el-col :span="11" :offset="1" v-if="payForm.payType == '2'">
  188. <el-form-item label="云闪付终端号" prop="terminalId">
  189. <el-input
  190. v-model="payForm.terminalId"
  191. maxlength="50"
  192. placeholder="请输入云闪付终端号"
  193. />
  194. </el-form-item>
  195. </el-col>
  196. <el-col :span="23" v-if="payForm.payType == '2'">
  197. <el-form-item label="云闪付密钥" prop="yunKey">
  198. <el-input
  199. v-model="payForm.yunKey"
  200. maxlength="50"
  201. placeholder="请输入云闪付密钥"
  202. />
  203. </el-form-item>
  204. </el-col>
  205. </el-form>
  206. <div slot="footer" class="dialog-footer">
  207. <el-button type="primary" @click="submitForm">确 定</el-button>
  208. <el-button @click="cancel">取 消</el-button>
  209. </div>
  210. </el-dialog>
  211. </div>
  212. </template>
  213. <script>
  214. import {
  215. listDept,
  216. getDept,
  217. delDept,
  218. addDept,
  219. updateDept,
  220. listDeptExcludeChild,
  221. listTree,
  222. setMnoSplit,
  223. } from "@/api/system/dept";
  224. import Treeselect from "@riophae/vue-treeselect";
  225. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  226. import { regionData } from "element-china-area-data";
  227. import { getToken } from "@/utils/auth";
  228. export default {
  229. name: "Dept",
  230. components: { Treeselect },
  231. data() {
  232. return {
  233. regionDataOptions: regionData, // 地址组件
  234. selectedRegionData: [],
  235. // 遮罩层
  236. loading: true,
  237. // 显示搜索条件
  238. showSearch: true,
  239. // 表格树数据
  240. deptList: [],
  241. // 部门树选项
  242. deptOptions: [],
  243. // 弹出层标题
  244. title: "",
  245. // 是否显示弹出层
  246. open: false,
  247. isShow: false,
  248. showIsLngFlag: false,
  249. splitShow: false,
  250. // 状态数据字典
  251. statusOptions: [],
  252. // 查询参数
  253. queryParams: {
  254. deptName: undefined,
  255. status: undefined,
  256. },
  257. // 表单参数
  258. form: {},
  259. payWayOptions: [
  260. {
  261. label: "微信支付",
  262. value: 1,
  263. children: [
  264. {
  265. label: "随行付",
  266. value: 1,
  267. },
  268. {
  269. label: "云闪付",
  270. value: 2,
  271. },
  272. {
  273. label: "全民付",
  274. value: 3,
  275. },
  276. ],
  277. },
  278. {
  279. label: "支付宝支付",
  280. value: 2,
  281. children: [
  282. {
  283. label: "随行付",
  284. value: 1,
  285. },
  286. {
  287. label: "云闪付",
  288. value: 2,
  289. },
  290. {
  291. label: "上海富友",
  292. value: 4,
  293. },
  294. ],
  295. },
  296. {
  297. label: "银行卡",
  298. value: 3,
  299. children: [
  300. {
  301. label: "随行付",
  302. value: 1,
  303. },
  304. {
  305. label: "云闪付",
  306. value: 2,
  307. },
  308. ],
  309. },
  310. ],
  311. // 表单校验
  312. rules: {
  313. parentId: [
  314. { required: true, message: "上级部门不能为空", trigger: "blur" },
  315. ],
  316. deptName: [
  317. { required: true, message: "部门名称不能为空", trigger: "blur" },
  318. ],
  319. orderNum: [
  320. { required: true, message: "显示排序不能为空", trigger: "blur" },
  321. ],
  322. // singleStationFlag: [
  323. // { required: true, message: "站点类型不能为空", trigger: "change" }
  324. // ],
  325. email: [
  326. {
  327. type: "email",
  328. message: "'请输入正确的邮箱地址",
  329. trigger: ["blur", "change"],
  330. },
  331. ],
  332. phone: [
  333. {
  334. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  335. message: "请输入正确的手机号码",
  336. trigger: "blur",
  337. },
  338. ],
  339. },
  340. payList: [
  341. {
  342. enterpriseName: "",
  343. deptName: "李哈哈",
  344. },
  345. {
  346. enterpriseName: "",
  347. deptName: "李哈哈",
  348. },
  349. ],
  350. imgUpConfig: {
  351. headers: {
  352. Authorization: "Bearer " + getToken(),
  353. },
  354. addressUrl: process.env.VUE_APP_BASE_API + "/common/upload",
  355. limit: 5,
  356. },
  357. groupOpen: false,
  358. payOpen: true,
  359. payForm: {
  360. payType: "1", // 支付渠道类型
  361. useType: "0", // 使用类型
  362. appType: "2", // 应用渠道
  363. },
  364. };
  365. },
  366. created() {
  367. this.getList();
  368. this.getDicts("sys_normal_disable").then((response) => {
  369. this.statusOptions = response.data;
  370. });
  371. },
  372. methods: {
  373. handleAdd(row) {
  374. this.payForm = {};
  375. this.payOpen = true;
  376. },
  377. handleChangeRegionData(value) {
  378. console.log(this.form.regionData);
  379. console.log(this.form);
  380. },
  381. beforeAvatarUpload(file) {
  382. const isLt5M = file.size / 1024 / 1024 < 5;
  383. if (!isLt5M) {
  384. this.$message.error("上传头像图片大小不能超过 5MB!");
  385. }
  386. return isLt5M;
  387. },
  388. handleAvatarRemove(file, fileList) {
  389. this.form.licenseImg = fileList;
  390. },
  391. handleAvatarSuccess(response, file, fileList) {
  392. this.form.licenseImg = [
  393. ...this.form.licenseImg,
  394. {
  395. name: file.name,
  396. url: response.url,
  397. },
  398. ];
  399. },
  400. /** 查询部门列表 */
  401. getList() {
  402. this.loading = true;
  403. // listTree(this.queryParams).then(response => {
  404. // this.deptList = this.handleTree(response.data, "deptId");
  405. // this.loading = false;
  406. // });
  407. listDept(this.queryParams).then((response) => {
  408. this.deptList = this.handleTree(response.data, "deptId");
  409. this.loading = false;
  410. });
  411. },
  412. selectDepart(val) {
  413. this.form.jiBie = parseInt(val.jiBie);
  414. if (val.jiBie == 1) {
  415. this.isShow = true;
  416. this.showIsLngFlag = false;
  417. } else {
  418. this.isShow = false;
  419. this.showIsLngFlag = true;
  420. }
  421. },
  422. /** 转换部门数据结构 */
  423. normalizer(node) {
  424. if (node.children && !node.children.length) {
  425. delete node.children;
  426. }
  427. return {
  428. id: node.deptId,
  429. label: node.deptName,
  430. children: node.children,
  431. };
  432. },
  433. // 字典状态字典翻译
  434. statusFormat(row, column) {
  435. return this.selectDictLabel(this.statusOptions, row.status);
  436. },
  437. // 取消按钮
  438. cancel() {
  439. this.open = false;
  440. this.isShow = false;
  441. this.reset();
  442. },
  443. // 表单重置
  444. reset() {
  445. this.form = {
  446. deptId: undefined,
  447. parentId: undefined,
  448. deptName: undefined,
  449. orderNum: undefined,
  450. leader: undefined,
  451. phone: undefined,
  452. email: undefined,
  453. status: "0",
  454. };
  455. this.resetForm("form");
  456. },
  457. /** 搜索按钮操作 */
  458. handleQuery() {
  459. this.getList();
  460. },
  461. /** 重置按钮操作 */
  462. resetQuery() {
  463. this.resetForm("queryForm");
  464. this.handleQuery();
  465. },
  466. /** 新增按钮操作 */
  467. handleAdd1(row) {
  468. this.reset();
  469. if (row != undefined) {
  470. this.form.parentId = row.deptId;
  471. //判断级别 1是集团,如果是集团展示的是油站的所有数据
  472. if (row.jiBie == 1) {
  473. this.form.jiBie = parseInt(row.jiBie);
  474. this.isShow = true;
  475. this.isLngFlag = false;
  476. } else {
  477. this.isLngFlag = true;
  478. this.isShow = false;
  479. }
  480. }
  481. this.open = true;
  482. this.title = "添加部门";
  483. listDept().then((response) => {
  484. this.deptOptions = this.handleTree(response.data, "deptId");
  485. });
  486. },
  487. /** 修改按钮操作 */
  488. handleUpdate(row) {
  489. this.reset();
  490. getDept(row.deptId).then((response) => {
  491. this.form = response.data;
  492. this.open = true;
  493. this.title = "修改部门";
  494. });
  495. listDeptExcludeChild(row.deptId).then((response) => {
  496. this.deptOptions = this.handleTree(response.data, "deptId");
  497. });
  498. //判断级别 1是集团,如果是集团展示的是油站的所有数据
  499. if (row.jiBie == 2) {
  500. this.isShow = true;
  501. this.showIsLngFlag = false;
  502. } else {
  503. this.isShow = false;
  504. this.showIsLngFlag = true;
  505. }
  506. },
  507. //设置分账的参数
  508. handleMnoSplit(row) {
  509. this.$confirm('是否进行分账设置,点击确定跳转确认页面"', "警告", {
  510. confirmButtonText: "确定",
  511. cancelButtonText: "取消",
  512. type: "warning",
  513. })
  514. .then(() => {
  515. return setMnoSplit(row.deptId);
  516. })
  517. .then((res) => {
  518. // this.getList();
  519. window.open(res.msg, "_blank");
  520. //this.msgSuccess("分账设置成功");
  521. });
  522. },
  523. /** 提交按钮 */
  524. submitForm: function () {
  525. this.$refs["form"].validate((valid) => {
  526. if (valid) {
  527. if (this.form.deptId != undefined) {
  528. updateDept(this.form).then((response) => {
  529. //window.location=response.message;
  530. this.msgSuccess("修改成功");
  531. this.open = false;
  532. this.isShow = false;
  533. this.getList();
  534. });
  535. } else {
  536. addDept(this.form).then((response) => {
  537. this.msgSuccess("新增成功");
  538. this.open = false;
  539. this.isShow = false;
  540. this.getList();
  541. });
  542. }
  543. }
  544. });
  545. },
  546. /** 删除按钮操作 */
  547. handleDelete(row) {
  548. this.$confirm(
  549. '是否确认删除名称为"' + row.deptName + '"的数据项?',
  550. "警告",
  551. {
  552. confirmButtonText: "确定",
  553. cancelButtonText: "取消",
  554. type: "warning",
  555. }
  556. )
  557. .then(function () {
  558. return delDept(row.deptId);
  559. })
  560. .then(() => {
  561. this.getList();
  562. this.msgSuccess("删除成功");
  563. });
  564. },
  565. },
  566. };
  567. </script>