three.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div class="m-container">
  3. <div class="m-core">
  4. <div @click="chargeOperation('create')" v-permission="'paymentConfig/addTypeRoute'" class="newBand">添加</div>
  5. <!-- 列表 -->
  6. <div class="tableWrap">
  7. <el-table :data="tableList" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  8. <el-table-column align="center" prop="organName" label="分部"></el-table-column>
  9. <el-table-column align="center" label="收费方式">
  10. <template slot-scope="scope">
  11. <div v-if="scope.row.typeRouteScale && scope.row.typeRouteScale.length > 0">
  12. <p v-for="(item, index) in scope.row.typeRouteScale" :key="index">
  13. {{ getOrganToStr(item.organId) }}--{{ getTypes(item.feeType) }} {{ item.scale }}%
  14. </p>
  15. </div>
  16. </template>
  17. </el-table-column>
  18. <el-table-column align="center" width="250px" label="操作">
  19. <template slot-scope="scope">
  20. <el-button
  21. @click="chargeOperation('update', scope.row)"
  22. v-permission="'paymentConfig/updateTypeRoute'"
  23. type="text"
  24. >修改</el-button>
  25. <el-button
  26. @click="chargeDel(scope.row)"
  27. v-permission="'paymentConfig/delTypeRoute'"
  28. type="text"
  29. >删除</el-button>
  30. </template>
  31. </el-table-column>
  32. </el-table>
  33. <pagination
  34. :total="pageInfo.total"
  35. :page.sync="pageInfo.page"
  36. :limit.sync="pageInfo.limit"
  37. :page-sizes="pageInfo.page_size"
  38. @pagination="getList"
  39. />
  40. </div>
  41. </div>
  42. <el-dialog
  43. :title="formTitle[formActionTitle]"
  44. :visible.sync="chargeStatus"
  45. v-if="chargeStatus"
  46. width="700px"
  47. >
  48. <share-model :detail.sync="rowDetail"
  49. :branchList="branchList"
  50. :formActionTitle="formActionTitle"
  51. :close="onFormClose"
  52. :getList="getList" />
  53. </el-dialog>
  54. </div>
  55. </template>
  56. <script>
  57. import pagination from "@/components/Pagination/index";
  58. import {
  59. paymentConfigQueryPage
  60. } from "@/api/systemManage";
  61. import { delTypeRoute } from "./api";
  62. import { branchQueryPage } from "@/api/specialSetting";
  63. import ShareModel from './share-model'
  64. export default {
  65. name: "chargeProfitManager",
  66. components: { pagination, ShareModel },
  67. data() {
  68. return {
  69. tableList: [],
  70. pageInfo: {
  71. // 分页规则
  72. limit: 10, // 限制显示条数
  73. page: 1, // 当前页
  74. total: 0, // 总条数
  75. page_size: [10, 20, 40, 50] // 选择限制显示条数
  76. },
  77. chargeStatus: false,
  78. branchList: [], // 分部列表
  79. formActionTitle: "create",
  80. formTitle: {
  81. create: "添加分润",
  82. update: "修改分润"
  83. },
  84. rowDetail: {}
  85. };
  86. },
  87. mounted() {
  88. this.getList();
  89. this.getRoleList()
  90. },
  91. methods: {
  92. getOrganToStr(id) {
  93. let name = null
  94. this.branchList.forEach(item => {
  95. if(item.value == id) {
  96. name = item.label
  97. }
  98. })
  99. return name
  100. },
  101. getTypes(type) {
  102. let template = {
  103. 'SERVICE': '服务收入',
  104. 'SELL': '销售收入'
  105. }
  106. return template[type]
  107. },
  108. getList() {
  109. let params = {
  110. hasTypeRoute: 1
  111. };
  112. params.rows = this.pageInfo.limit;
  113. params.page = this.pageInfo.page;
  114. paymentConfigQueryPage(params).then(res => {
  115. if (res.code == 200 && res.data) {
  116. res.data.rows.forEach(item => {
  117. if(item.typeRouteScale) {
  118. item.typeRouteScale = JSON.parse(item.typeRouteScale)
  119. }
  120. })
  121. this.tableList = res.data.rows;
  122. this.pageInfo.total = res.data.total;
  123. }
  124. });
  125. },
  126. async getRoleList(val) {
  127. await branchQueryPage({
  128. // 获取分部
  129. delFlag: 0,
  130. rows: 9999
  131. }).then(res => {
  132. if (res.code == 200 && res.data && res.data.rows) {
  133. res.data.rows.forEach(item => {
  134. this.branchList.push({
  135. label: item.name,
  136. value: item.id
  137. });
  138. });
  139. }
  140. });
  141. },
  142. chargeOperation(type, data) {
  143. this.formActionTitle = type;
  144. this.chargeStatus = true;
  145. // 修改的时候
  146. if (type == "update") {
  147. this.rowDetail = data
  148. }
  149. },
  150. chargeDel(row) {
  151. // 删除数据
  152. // paymentConfigDel
  153. this.$confirm("你确定删除?", "提示", {
  154. confirmButtonText: "确定",
  155. cancelButtonText: "取消",
  156. type: "warning"
  157. })
  158. .then(() => {
  159. delTypeRoute({ id: row.id }).then(res => {
  160. this.messageTips("删除", res);
  161. });
  162. })
  163. .catch();
  164. },
  165. messageTips(title, res) {
  166. if (res.code == 200) {
  167. this.$message.success(title + "成功");
  168. this.chargeStatus = false;
  169. this.getList();
  170. } else {
  171. this.$message.error(res.msg);
  172. }
  173. },
  174. onFormClose(formName) {
  175. this.chargeStatus = false
  176. // this.$refs[formName].resetFields();
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss" scoped>
  182. /deep/.el-button--primary {
  183. background: #14928a;
  184. border-color: #14928a;
  185. color: #fff;
  186. &:hover,
  187. &:active,
  188. &:focus {
  189. background: #14928a;
  190. border-color: #14928a;
  191. color: #fff;
  192. }
  193. }
  194. /deep/.el-select,
  195. /deep/.el-date-editor.el-input {
  196. width: 100% !important;
  197. }
  198. .moreRule {
  199. background: #f0f0f0;
  200. position: relative;
  201. .el-form-item__error {
  202. color: #f56c6c;
  203. font-size: 12px;
  204. line-height: 1;
  205. position: absolute;
  206. left: 100px;
  207. top: 100%;
  208. margin-top: -21px;
  209. }
  210. }
  211. </style>