cloud_balance.vue 8.5 KB

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