cloud_balance.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <div id="cloud-balance">
  3. <section class="top">
  4. <h3>云端财务列表</h3>
  5. <section>
  6. <span>
  7. 托管总金额:
  8. <b>{{totalFee}}</b>
  9. </span>
  10. <span>
  11. 押金总金额:
  12. <b>{{totalDeposit}}</b>
  13. </span>
  14. </section>
  15. </section>
  16. <section class="selector-box">
  17. <section class="selector-box-left">
  18. <el-select v-model="status" placeholder="项目状态">
  19. <el-option
  20. v-for="item of jobStatusList"
  21. :key="item.id"
  22. :label="item.name"
  23. :value="item.id"
  24. ></el-option>
  25. </el-select>
  26. <el-select v-model="period" placeholder="账单状态">
  27. <el-option
  28. v-for="item of periodStatusList"
  29. :key="item.id"
  30. :label="item.name"
  31. :value="item.id"
  32. ></el-option>
  33. </el-select>
  34. <el-input style="width: 200px;" v-model="checkUser" placeholder="负责人"></el-input>
  35. <el-input style="width: 200px;" v-model="jobID" placeholder="项目ID"></el-input>
  36. <el-button @click="clickSearchConfirm">确认</el-button>
  37. </section>
  38. <el-button @click="clickExport" type="primary">导出</el-button>
  39. </section>
  40. <div class="table">
  41. <el-table
  42. v-if="tableData.length"
  43. border
  44. style="width: 100%"
  45. :data="tableData"
  46. :row-class-name="tableRowClassName"
  47. >
  48. <el-table-column
  49. v-for="(prop, index) of tableProps"
  50. :key="index"
  51. :width="tableWidths[index]"
  52. :prop="prop"
  53. :label="tableHeaders[index]"
  54. >
  55. <template slot-scope="scope">
  56. <el-button
  57. type="text"
  58. v-if="prop === 'id'"
  59. @click="clickOrder(scope.row)"
  60. >{{scope.row[prop]}}</el-button>
  61. <el-button
  62. type="text"
  63. v-else-if="prop === 'job_id'"
  64. @click="clickJobID(scope.row[prop])"
  65. >{{scope.row[prop]}}</el-button>
  66. <el-button
  67. type="text"
  68. v-else-if="prop === 'company'"
  69. @click="clickCompany(scope.row['uid'])"
  70. >{{scope.row[prop]}}</el-button>
  71. <el-button
  72. type="text"
  73. v-else-if="prop === 'operate'"
  74. @click="clickOperate(scope.row)"
  75. >{{scope.row[prop]}}</el-button>
  76. <el-button
  77. type="text"
  78. v-else-if="prop === 'dev_realname'"
  79. @click="clickDev(scope.row['developer_uid'])"
  80. >{{scope.row[prop]}}</el-button>
  81. <span v-else-if="prop === 'payAround'" v-html="scope.row[prop]" />
  82. <span v-else>{{scope.row[prop]}}</span>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </div>
  87. <el-pagination
  88. background
  89. @current-change="getTableData"
  90. @size-change="changePageSize"
  91. :current-page.sync="currentPage"
  92. :page-sizes="[10, 20, 30, 40]"
  93. :page-size="20"
  94. layout="total, sizes, prev, pager, next, jumper"
  95. :total="totalCount"
  96. ></el-pagination>
  97. </div>
  98. </template>
  99. <script>
  100. const tableHeaders = [
  101. "项目ID",
  102. "核定价格",
  103. "托管费用",
  104. "押金",
  105. "次月托管",
  106. "结算周期",
  107. "结算金额",
  108. "退回金额",
  109. "预计发薪",
  110. "发薪日期",
  111. "状态",
  112. "负责人",
  113. "操作",
  114. "备注",
  115. "项目状态",
  116. "账单ID",
  117. "企业方",
  118. "开发者",
  119. "试用天数"
  120. ];
  121. const tableProps = [
  122. "job_id",
  123. "salary",
  124. "company_pay",
  125. "p_company_deposit",
  126. "next_period_pay",
  127. "payAround",
  128. "pay_to_dev",
  129. "return_money",
  130. "pre_send_salary_timeShow", //
  131. "send_salary_time",
  132. "p_status_name",
  133. "chk_user",
  134. "operate",
  135. "settle_msg",
  136. "j_status_name",
  137. "id",
  138. "company",
  139. "dev_realname",
  140. "probation_days"
  141. ];
  142. const tableWidths = [
  143. "80",
  144. "80",
  145. "100",
  146. "80",
  147. "100",
  148. "120",
  149. "80",
  150. "80",
  151. "90",
  152. "80",
  153. "80",
  154. "100",
  155. "80",
  156. "180",
  157. "80",
  158. "80",
  159. "100",
  160. "100",
  161. "80"
  162. ];
  163. export default {
  164. data() {
  165. return {
  166. // 下发的总数据
  167. totalData: {},
  168. // 项目ID
  169. jobID: "",
  170. // 审核人
  171. period: "",
  172. status: "",
  173. // 状态列表数据
  174. jobStatusList: [],
  175. // 负责人
  176. checkUser: "",
  177. // 审核人列表
  178. periodStatusList: [],
  179. // 数据总条目
  180. totalCount: 0,
  181. currentPage: 1,
  182. currentPageSize: 20,
  183. // 列表宽度
  184. tableWidths,
  185. // 列表头显示内容
  186. tableHeaders,
  187. // 列表头字段
  188. tableProps,
  189. // 列表数据
  190. tableData: [],
  191. localData: {
  192. env: "test"
  193. }
  194. };
  195. },
  196. computed: {
  197. isTest() {
  198. return this.localData.env === "test";
  199. },
  200. whole() {
  201. return this.totalData.whole || {};
  202. },
  203. totalDeposit() {
  204. return this.whole.total_deposit;
  205. },
  206. totalFee() {
  207. return this.whole.total_fee;
  208. }
  209. },
  210. mounted() {
  211. this.getTableData();
  212. this.getEnum();
  213. },
  214. methods: {
  215. clickExport() {
  216. window.open("/api/admin/job/get_all_periods?action=export");
  217. },
  218. /**
  219. * 获取筛选值
  220. */
  221. async getEnum() {
  222. let { data } = await this.$get("/api/admin/job/getEnum");
  223. console.log(data);
  224. if (data) {
  225. let { jobStatusList, periodStatusList } = data;
  226. this.jobStatusList = jobStatusList;
  227. this.periodStatusList = periodStatusList;
  228. }
  229. },
  230. // 点击操作
  231. clickOperate({ job_id, id }) {
  232. window.open(
  233. this.$store.state.domainConfig.rooterUrl +
  234. `/main/wage_settlement?job_id=${job_id}&period_id=${id}`
  235. );
  236. },
  237. // 点击账单
  238. clickOrder(i) {
  239. window.open(
  240. this.$store.state.domainConfig.rooterUrl +
  241. `/main/wage_details?job_id=${i.job_id}&period_id=${i.id}`
  242. );
  243. },
  244. // 点击开发者
  245. clickDev(uid) {
  246. window.open(
  247. this.$store.state.domainConfig.siteUrl + `/rooter/user/${uid}`
  248. );
  249. },
  250. // 点击企业
  251. clickCompany(uid) {
  252. window.open(
  253. this.$store.state.domainConfig.siteUrl + `/rooter/user/${uid}`
  254. );
  255. },
  256. // 点击账单id
  257. clickJobID(jobID) {
  258. window.open(
  259. this.$store.state.domainConfig.siteUrl + `/rooter/cloudjobitem/${jobID}`
  260. );
  261. },
  262. // 点击重试
  263. async clickRetry(id) {
  264. const res = await this.$post("/api/admin/payment/redoDraw", { id });
  265. // console.log(res)
  266. },
  267. // 根据状态显示图表样式
  268. tableRowClassName({ row, rowIndex }) {
  269. // console.log({row, rowIndex})
  270. let className = "";
  271. if (row.j_status_name === "结束合作") className = "end-row";
  272. // console.log(className)
  273. return className;
  274. },
  275. // 格式化列表数据
  276. formatTableData(data) {
  277. return data.map(i => ({
  278. ...i,
  279. payAround: `${i.start_time}<br>${i.end_time}`,
  280. pre_send_salary_timeShow: new Date(
  281. i.pre_send_salary_time * 1000
  282. ).toLocaleDateString()
  283. }));
  284. },
  285. /**
  286. * 点击筛选确认
  287. */
  288. clickSearchConfirm() {
  289. this.currentPage = 1;
  290. this.getTableData();
  291. },
  292. changePageSize(pageSize) {
  293. this.currentPageSize = pageSize;
  294. this.getTableData();
  295. },
  296. // 获取列表数据
  297. async getTableData() {
  298. this.tableData = [];
  299. let url = "/api/admin/job/get_all_periods";
  300. let body = { page: this.currentPage, page_size: this.currentPageSize };
  301. if (this.status) body.j_status = this.status;
  302. if (this.period) body.p_status = this.period;
  303. if (this.checkUser) body.chk_user = this.checkUser;
  304. if (this.jobID) body.job_id = this.jobID;
  305. const res = await this.$post(url, body);
  306. const data = res.data;
  307. this.tableData = this.formatTableData(data.list);
  308. this.totalData = data;
  309. // // console.log(this.tableData)
  310. this.totalCount = Number(data.total);
  311. this.totalPage = data.totalPage;
  312. this.localData.env = data.current_env;
  313. }
  314. }
  315. };
  316. </script>
  317. <style scoped>
  318. #cloud-balance {
  319. white-space: nowrap;
  320. overflow-x: scroll;
  321. }
  322. .top {
  323. display: flex;
  324. flex-direction: column;
  325. justify-content: center;
  326. height: 60px;
  327. }
  328. .selector-box {
  329. margin-top: 10px;
  330. }
  331. .selector-box {
  332. display: flex;
  333. justify-content: space-between;
  334. }
  335. /* .selector-box-left {
  336. } */
  337. .table {
  338. margin-top: 10px;
  339. height: calc(100% - 160px);
  340. margin-bottom: 14px;
  341. }
  342. .end-row {
  343. background: rgba(0, 0, 0, 0.1);
  344. }
  345. .el-form-item {
  346. margin-bottom: 0;
  347. }
  348. .el-form:last-child {
  349. margin-bottom: 22px;
  350. }
  351. td,
  352. th {
  353. padding: 4px 0;
  354. }
  355. </style>