index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="sort pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers.some((i) => i == '001')"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 10px 90px">
  27. <el-col :span="3" style="width: 748px">
  28. <div class="my-breadcrumb clear">
  29. <div
  30. class="my-breadcrumb-item"
  31. v-for="(item, index) in titleList"
  32. :key="item + index"
  33. @click="changeBreadcrumb(index)"
  34. >
  35. <span class="label">{{ item.titleName }}</span
  36. ><span class="separator" v-if="index + 1 !== titleList.length">/</span>
  37. </div>
  38. </div>
  39. </el-col>
  40. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  41. <el-button type="primary" :size="searchSize" @click="searchList">
  42. 刷新
  43. </el-button>
  44. </el-col>
  45. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  46. <el-button type="warning" :size="searchSize" @click="restSearch">
  47. 重置
  48. </el-button>
  49. </el-col>
  50. </el-row>
  51. <el-row>
  52. <el-col :span="4" style="width: 140px">
  53. <el-select
  54. v-model="parmValue.status"
  55. filterable
  56. clearable
  57. :size="searchSize"
  58. placeholder="状态"
  59. style="width: 100%"
  60. @change="
  61. pageInfo.curr = 1;
  62. parmValue.page = 1;
  63. searchList();
  64. "
  65. >
  66. <el-option
  67. v-for="item in statusList"
  68. :key="'status' + item.code"
  69. :label="item.name"
  70. :value="item.code"
  71. />
  72. </el-select>
  73. </el-col>
  74. <el-col :span="4" style="width: 390px;margin-left:10px">
  75. <el-input placeholder="支付渠道名称" clearable size="mini" v-model="parmValue['channel_name']" @blur="
  76. pageInfo.curr = 1;
  77. parmValue.page = 1;
  78. searchList();
  79. " />
  80. </el-col>
  81. <el-col :span="4" style="width: 390px; padding: 0 0 0 10px">
  82. <el-input
  83. :size="searchSize"
  84. v-model="parmValue['apply_name']"
  85. :maxlength="40"
  86. clearable
  87. @blur="
  88. pageInfo.curr = 1;
  89. parmValue.page = 1;
  90. searchList();
  91. "
  92. placeholder="创建人"
  93. ></el-input>
  94. </el-col>
  95. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  96. <el-button type="primary" :size="searchSize" @click=" setRate({}, actionTypes.CREATE)">
  97. 新建
  98. </el-button>
  99. </el-col>
  100. </el-row>
  101. </div>
  102. </template>
  103. <template #status="{ scope }">
  104. <el-tag
  105. :size="tablebtnSize"
  106. :type="scope.row.status == '1' ? '' : 'warning'"
  107. v-text="
  108. (statusOptions.find((item) => item.id == scope.row.status) || {}).label ||
  109. '禁用'
  110. "
  111. ></el-tag>
  112. </template>
  113. <template #operation="{ scope }">
  114. <el-tooltip
  115. v-if="powers.some((i) => i == '007')"
  116. effect="dark"
  117. content="查看"
  118. placement="top"
  119. >
  120. <i class="el-icon-view tb-icon" @click="setRate(scope.row, actionTypes.PREVIEW)"></i>
  121. </el-tooltip>
  122. <el-tooltip
  123. v-if="powers.some((i) => i == '005')"
  124. effect="dark"
  125. content="修改"
  126. placement="top"
  127. >
  128. <i class="el-icon-edit tb-icon" @click="setRate(scope.row,actionTypes.UPDATE)"></i>
  129. </el-tooltip>
  130. <el-tooltip
  131. v-if="powers.some((i) => i == '004') && scope.row.status + '' === '0'"
  132. effect="dark"
  133. content="启用"
  134. placement="top"
  135. >
  136. <i
  137. class="el-icon-video-play tb-icon"
  138. @click="changeStatus(scope.row.id, scope.row.status)"
  139. ></i>
  140. </el-tooltip>
  141. <el-tooltip
  142. v-if="powers.some((i) => i == '004') && scope.row.status + '' === '1'"
  143. effect="dark"
  144. content="禁用"
  145. placement="top"
  146. >
  147. <i
  148. class="el-icon-video-pause tb-icon"
  149. @click="changeStatus(scope.row.id, scope.row.status)"
  150. ></i>
  151. </el-tooltip>
  152. </template>
  153. </ex-table>
  154. <no-auth v-else />
  155. <!-- 弹窗 新增/修改 -->
  156. <add-edit-rate
  157. :id="modelRateId"
  158. :show-model="showRateModel"
  159. :sitem="sitemRate"
  160. @refresh="searchList"
  161. @cancel="showRateModel = false"
  162. :actionType="actionType"
  163. />
  164. </div>
  165. </template>
  166. <script>
  167. import addEditRate from "./addEditRate";
  168. import asyncRequest from "@/apis/service/serviceParam/paymentChannelManage";
  169. import { statusList } from "@/assets/js/statusList";
  170. import roleLevel from "@/assets/js/roleLevel";
  171. import mixinPage from "@/mixins/elPaginationHandle";
  172. import resToken from "@/mixins/resToken";
  173. import { mapGetters } from "vuex";
  174. import privateField from "@/mixins/privateField";
  175. import { actionTypes } from "@/utils/actionType";
  176. export default {
  177. name: "othsearchSort",
  178. mixins: [mixinPage, resToken, privateField],
  179. components: {
  180. addEditRate,
  181. },
  182. computed: {
  183. //组件SIZE设置
  184. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  185. powers() {
  186. const { btnList } = this.$store.getters;
  187. const tran = btnList.find((i) => i.menu_route == "paymentChannelManage") || {};
  188. const { action } = tran ?? {};
  189. return action ?? [];
  190. },
  191. },
  192. data() {
  193. return {
  194. actionTypes,
  195. actionType:'',
  196. isDetail: true,
  197. private_field: [],
  198. statusList: statusList,
  199. roleLevel: roleLevel,
  200. loading: false,
  201. sitem: {},
  202. showRateModel: false,
  203. modelRateId: "000",
  204. sitemRate: {},
  205. titleList: [],
  206. parmValue: {
  207. page: 1, // 页码
  208. size: 15, // 每页显示条数
  209. status:"",
  210. channel_name:"",
  211. apply_name:""
  212. },
  213. // 状态
  214. statusOptions: [
  215. { id: "0", label: "禁用" },
  216. { id: "1", label: "启用" },
  217. ],
  218. // 表格 - 数据
  219. tableData: [],
  220. // 表格 - 参数
  221. table: {
  222. stripe: true,
  223. border: true,
  224. _defaultHeader_: ["setcol"],
  225. },
  226. // 表格 - 分页
  227. pageInfo: {
  228. size: 15,
  229. curr: 1,
  230. total: 0,
  231. },
  232. // 表格 - 列参数
  233. columns: [
  234. {
  235. prop: "id",
  236. label: "ID",
  237. minWidth: "60px",
  238. },
  239. {
  240. prop: "channel_name",
  241. label: "支付渠道名称",
  242. width: "230px",
  243. },
  244. {
  245. prop: "companyName",
  246. label: "业务公司名称",
  247. width: "230px",
  248. },
  249. {
  250. prop: "status",
  251. label: "当前状态",
  252. width: "230px",
  253. _slot_:'status'
  254. },
  255. {
  256. prop: "apply_name",
  257. label: "创建人",
  258. width: "230px",
  259. },
  260. {
  261. prop: "addtime",
  262. label: "创建时间",
  263. width: "260px",
  264. },
  265. {
  266. prop: "",
  267. label: "操作",
  268. fixed: "right",
  269. width: "140px",
  270. _noset_: true,
  271. _slot_: "operation",
  272. },
  273. ],
  274. };
  275. },
  276. mounted() {
  277. this.parmValue.pid = "0";
  278. this.searchList();
  279. },
  280. methods: {
  281. restSearch() {
  282. // 表格 - 分页
  283. this.pageInfo = {
  284. size: 15,
  285. curr: 1,
  286. total: 0,
  287. };
  288. this.parmValue = {
  289. page: 1, // 页码
  290. size: 15, // 每页显示条数
  291. status: "",
  292. channel_name:"",
  293. apply_name:""
  294. };
  295. this.searchList();
  296. },
  297. //设置毛利率
  298. setRate(row, actionType) {
  299. this.actionType = actionType
  300. if(this.actionTypes.UPDATE === actionType && row.status !== "0"){
  301. this.$message.warning('必须在禁用后才能修改!')
  302. return
  303. }
  304. this.modelRateId = row.id;
  305. this.sitemRate = row;
  306. this.showRateModel = true;
  307. },
  308. async changeBreadcrumb(index) {
  309. if (index + 1 === this.titleList.length) {
  310. return;
  311. } else {
  312. this.parmValue.pid = this.titleList[index].id;
  313. this.parmValue.status = ""
  314. this.parmValue.cat_name = ""
  315. this.titleList = this.titleList.slice(0, index + 1);
  316. }
  317. this.parmValue.cat_name = "";
  318. this.pageInfo.curr = 1;
  319. this.parmValue.page = 1;
  320. await this.searchList();
  321. },
  322. async changeStatus(id, status) {
  323. await this.$confirm(`确定要改为${status + "" === "1" ? "禁用" : "启用"}?`, {
  324. confirmButtonText: "确定",
  325. cancelButtonText: "取消",
  326. type: "warning",
  327. })
  328. .then(async () => {
  329. this.loading = true;
  330. const model = {
  331. id,
  332. status: String(status) ? (String(status) === "1" ? "0" : "1") : "1",
  333. companyNo: this.currentCompany
  334. };
  335. const res = await asyncRequest.status(model);
  336. if (res && res.code === 0) {
  337. this.loading = false;
  338. this.$notify.success({
  339. title: "状态修改成功!",
  340. message: "",
  341. });
  342. await this.searchList();
  343. } else if (res && res.code >= 100 && res.code <= 104) {
  344. await this.logout();
  345. } else {
  346. this.loading = false;
  347. this.$message.warning(res.message);
  348. }
  349. })
  350. .catch(() => {
  351. console.log("取消");
  352. });
  353. },
  354. // 刷新表格
  355. async searchList() {
  356. if (this.loading) return;
  357. // if (!this.currentCompany) {
  358. // this.$message.warning("请选择公司!");
  359. // return;
  360. // }
  361. // this.parmValue.companyNo = this.currentCompany;
  362. this.loading = true;
  363. const { code, data } = await asyncRequest.list(this.parmValue);
  364. if (code === 0) {
  365. const { list, count } = data ?? {};
  366. this.tableData = list ?? [];
  367. this.pageInfo.total = count ?? 0;
  368. } else if (code >= 100 && code <= 104) {
  369. await this.logout();
  370. } else {
  371. this.tableData = [];
  372. this.pageInfo.total = 0;
  373. }
  374. this.loading = false;
  375. },
  376. },
  377. };
  378. </script>
  379. <style lang="scss" scoped>
  380. .sort {
  381. .my-breadcrumb {
  382. .my-breadcrumb-item {
  383. float: left;
  384. span {
  385. height: 32px;
  386. line-height: 32px;
  387. }
  388. .label {
  389. padding: 0 5px 0 0;
  390. color: 010101;
  391. }
  392. .separator {
  393. color: #787878;
  394. font-size: 13px;
  395. padding: 0 5px 0 0;
  396. }
  397. &:last-child {
  398. .label {
  399. color: #787878;
  400. }
  401. }
  402. &:hover {
  403. cursor: pointer;
  404. }
  405. &:last-child {
  406. cursor: default;
  407. }
  408. &:only-child {
  409. cursor: pointer;
  410. }
  411. }
  412. }
  413. }
  414. </style>