cloud_order copy.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <div id="cloud-balance order-wrap">
  3. <section class="top">
  4. <h3>交易订单中心</h3>
  5. <section>
  6. <div class="type-boxs">
  7. <span class="vsub">订单类型:</span>
  8. <div class="inlineb">
  9. <el-checkbox-group v-model="orderType" @change="changeOrder" size="mini">
  10. <el-checkbox-button v-for="itm in TypeList" :label="itm.id" :key="itm.id">{{itm.type}}</el-checkbox-button>
  11. </el-checkbox-group>
  12. </div>
  13. </div>
  14. <div class="type-boxs">
  15. <span class="vsub">交易类型:</span>
  16. <div class="inlineb">
  17. <el-checkbox-group v-model="tradeType" @change="changeTrade" size="mini">
  18. <el-checkbox-button
  19. v-for="itm in tradeList"
  20. :label="itm.id"
  21. :key="itm.id"
  22. >{{itm.type}}</el-checkbox-button>
  23. </el-checkbox-group>
  24. </div>
  25. </div>
  26. <div class="type-boxs">
  27. <span class="vsub">支付方式:</span>
  28. <div class="inlineb">
  29. <el-checkbox-group v-model="payType" @change="changePay" size="mini">
  30. <el-checkbox-button v-for="itm in payList" :label="itm.id" :key="itm.id">{{itm.type}}</el-checkbox-button>
  31. </el-checkbox-group>
  32. </div>
  33. </div>
  34. <div class="type-boxs">
  35. <div class="inlineb">
  36. <span class>订单类型:</span>
  37. <el-date-picker
  38. v-model="timeRange"
  39. type="daterange"
  40. align="right"
  41. unlink-panels
  42. range-separator="到"
  43. start-placeholder="开始日期"
  44. end-placeholder="结束日期"
  45. :picker-options="pickerOptions2"
  46. ></el-date-picker>
  47. </div>
  48. <div class="inlineb">
  49. <span class>时间类型:</span>
  50. <el-time-picker v-model="arriveTime" ElementUIplaceholder="到帐时间"></el-time-picker>
  51. </div>
  52. </div>
  53. <div class="type-boxs">
  54. <div class="inlineb">
  55. <span class>编号:</span>
  56. <div class="inlineb">
  57. <el-input style="width: 230px;" v-model="searchId" placeholder="订单编号/订单名称/支付编号"></el-input>
  58. </div>
  59. </div>
  60. <div class="inlineb">
  61. <span class>用户:</span>
  62. <div class="inlineb">
  63. <el-input style="width: 180px;" v-model="checkUser" placeholder="uid/昵称/姓名"></el-input>
  64. </div>
  65. </div>
  66. <div class="inlineb">
  67. <span class>项目:</span>
  68. <div class="inlineb">
  69. <el-select v-model="status" placeholder="项目状态">
  70. <el-option
  71. v-for="item of jobStatusList"
  72. :key="item.id"
  73. :label="item.name"
  74. :value="item.id"
  75. ></el-option>
  76. </el-select>
  77. </div>
  78. <div class="inlineb">
  79. <el-input style="width: 100px;" v-model="checkUser" placeholder="项目ID"></el-input>
  80. </div>
  81. </div>
  82. <div class="inlineb">
  83. <span class>状态:</span>
  84. <div class="inlineb">
  85. <el-select v-model="status" placeholder="项目状态">
  86. <el-option
  87. v-for="item of jobStatusList"
  88. :key="item.id"
  89. :label="item.name"
  90. :value="item.id"
  91. ></el-option>
  92. </el-select>
  93. </div>
  94. </div>
  95. </div>
  96. </section>
  97. </section>
  98. <!-- <section class="selector-box">
  99. <section class="selector-box-left">
  100. <el-select v-model="period" placeholder="账单状态">
  101. <el-option
  102. v-for="item of periodStatusList"
  103. :key="item.id"
  104. :label="item.name"
  105. :value="item.id"
  106. ></el-option>
  107. </el-select>
  108. <el-input style="width: 200px;" v-model="jobID" placeholder="项目ID"></el-input>
  109. <el-button @click="clickSearchConfirm">确认</el-button>
  110. </section>
  111. <el-button @click="clickExport" type="primary">导出</el-button>
  112. </section>-->
  113. <div class="table" style="width: 100%">
  114. <el-table
  115. v-if="tableData.length"
  116. height="100%"
  117. border
  118. style="width: 100%"
  119. :data="tableData"
  120. :row-class-name="tableRowClassName"
  121. >
  122. <el-table-column
  123. v-for="(prop, index) of tableProps"
  124. :key="index"
  125. :width="tableWidths[index]"
  126. :prop="prop"
  127. :label="tableHeaders[index]"
  128. >
  129. <template slot-scope="scope">
  130. <el-button
  131. type="text"
  132. v-if="prop === 'id'"
  133. @click="clickOrder(scope.row)"
  134. >{{scope.row[prop]}}</el-button>
  135. <el-button
  136. type="text"
  137. v-else-if="prop === 'job_id'"
  138. @click="clickJobID(scope.row[prop])"
  139. >{{scope.row[prop]}}</el-button>
  140. <el-button
  141. type="text"
  142. v-else-if="prop === 'company'"
  143. @click="clickCompany(scope.row['uid'])"
  144. >{{scope.row[prop]}}</el-button>
  145. <el-button
  146. type="text"
  147. v-else-if="prop === 'operate'"
  148. @click="clickOperate(scope.row)"
  149. >{{scope.row[prop]}}</el-button>
  150. <el-button
  151. type="text"
  152. v-else-if="prop === 'dev_realname'"
  153. @click="clickDev(scope.row['developer_uid'])"
  154. >{{scope.row[prop]}}</el-button>
  155. <span v-else-if="prop === 'payAround'" v-html="scope.row[prop]" />
  156. <span v-else>{{scope.row[prop]}}</span>
  157. </template>
  158. </el-table-column>
  159. </el-table>
  160. </div>
  161. <el-pagination
  162. background
  163. @current-change="getTableData"
  164. @size-change="changePageSize"
  165. :current-page.sync="currentPage"
  166. :page-sizes="[10, 20, 30, 40]"
  167. :page-size="20"
  168. layout="total, sizes, prev, pager, next, jumper"
  169. :total="totalCount"
  170. ></el-pagination>
  171. </div>
  172. </template>
  173. <script>
  174. const tableHeaders = [
  175. "项目ID",
  176. "核定价格",
  177. "托管费用",
  178. "押金",
  179. "次月托管",
  180. "结算周期",
  181. "结算金额",
  182. "退回金额",
  183. "预计发薪",
  184. "发薪日期",
  185. "状态",
  186. "负责人",
  187. "操作",
  188. "备注",
  189. "项目状态",
  190. "账单ID",
  191. "企业方",
  192. "开发者",
  193. "试用天数"
  194. ];
  195. const tableProps = [
  196. "job_id",
  197. "salary",
  198. "company_pay",
  199. "p_company_deposit",
  200. "next_period_pay",
  201. "payAround",
  202. "pay_to_dev",
  203. "return_money",
  204. "pre_send_salary_timeShow", //
  205. "send_salary_time",
  206. "p_status_name",
  207. "chk_user",
  208. "operate",
  209. "settle_msg",
  210. "j_status_name",
  211. "id",
  212. "company",
  213. "dev_realname",
  214. "probation_days"
  215. ];
  216. const tableWidths = [
  217. "80",
  218. "80",
  219. "100",
  220. "80",
  221. "100",
  222. "120",
  223. "80",
  224. "80",
  225. "90",
  226. "80",
  227. "80",
  228. "100",
  229. "80",
  230. "180",
  231. "80",
  232. "80",
  233. "100",
  234. "100",
  235. "80"
  236. ];
  237. export default {
  238. data() {
  239. return {
  240. orderType: [0],
  241. tradeType: [0],
  242. payType: [0],
  243. TypeList: [
  244. {
  245. id: 0,
  246. type: "全部"
  247. },
  248. {
  249. id: 1,
  250. type: "整包项目"
  251. },
  252. {
  253. id: 2,
  254. type: "云端工作"
  255. },
  256. {
  257. id: 3,
  258. type: "雇佣工作"
  259. }
  260. ],
  261. tradeList: [
  262. {
  263. id: 0,
  264. type: "全部"
  265. },
  266. {
  267. id: 1,
  268. type: "充值"
  269. },
  270. {
  271. id: 2,
  272. type: "提现"
  273. },
  274. {
  275. id: 3,
  276. type: "购买"
  277. },
  278. {
  279. id: 4,
  280. type: "购买"
  281. }
  282. ],
  283. payList: [
  284. {
  285. id: 0,
  286. type: "全部"
  287. },
  288. {
  289. id: 1,
  290. type: "充值"
  291. },
  292. {
  293. id: 2,
  294. type: "提现"
  295. },
  296. {
  297. id: 3,
  298. type: "购买"
  299. },
  300. {
  301. id: 4,
  302. type: "购买"
  303. }
  304. ],
  305. pickerOptions2: {
  306. shortcuts: [
  307. {
  308. text: "全部",
  309. onClick(picker) {
  310. alert("获取全部数据");
  311. }
  312. },
  313. {
  314. text: "最近7天",
  315. onClick(picker) {
  316. const end = new Date();
  317. const start = new Date();
  318. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  319. picker.$emit("pick", [start, end]);
  320. }
  321. },
  322. {
  323. text: "最近30天",
  324. onClick(picker) {
  325. const end = new Date();
  326. const start = new Date();
  327. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  328. picker.$emit("pick", [start, end]);
  329. }
  330. },
  331. {
  332. text: "本周",
  333. onClick(picker) {
  334. var week = new Date().getDay() - 1;
  335. console.log(week);
  336. if (week == -1) {
  337. week = 6;
  338. }
  339. const end = new Date();
  340. const start = new Date();
  341. start.setTime(start.getTime() - 3600 * 1000 * 24 * week);
  342. picker.$emit("pick", [start, end]);
  343. }
  344. },
  345. {
  346. text: "本月",
  347. onClick(picker) {
  348. var month = new Date().getMonth + 1;
  349. var year = new Date().getFullYear();
  350. // console.log(month, year);
  351. var day = new Date().getDate() - 1;
  352. console.log(day);
  353. const end = new Date();
  354. const start = new Date();
  355. start.setTime(start.getTime() - 3600 * 1000 * 24 * day);
  356. picker.$emit("pick", [start, end]);
  357. }
  358. },
  359. {
  360. text: "本年",
  361. onClick(picker) {
  362. var month = new Date().getMonth + 1;
  363. var year = new Date().getFullYear();
  364. // console.log(month, year);
  365. var day = new Date().getDate() - 1;
  366. var firstDay = new Date(year, 0, 1);
  367. var dateDiff = new Date() - firstDay;
  368. var msPerDay = 1000 * 60 * 60 * 24;
  369. //计算天数
  370. var diffDays = Math.ceil(dateDiff / msPerDay) - 1;
  371. console.log(diffDays);
  372. const end = new Date();
  373. const start = new Date();
  374. start.setTime(start.getTime() - 3600 * 1000 * 24 * diffDays);
  375. picker.$emit("pick", [start, end]);
  376. }
  377. }
  378. ]
  379. },
  380. timeRange: "",
  381. arriveTime: "",
  382. searchId: "",
  383. // 下发的总数据
  384. totalData: {},
  385. // 项目ID
  386. jobID: "",
  387. // 审核人
  388. period: "",
  389. status: "",
  390. // 状态列表数据
  391. jobStatusList: [],
  392. // 负责人
  393. checkUser: "",
  394. // 审核人列表
  395. periodStatusList: [],
  396. // 数据总条目
  397. totalCount: 0,
  398. currentPage: 1,
  399. currentPageSize: 20,
  400. // 列表宽度
  401. tableWidths,
  402. // 列表头显示内容
  403. tableHeaders,
  404. // 列表头字段
  405. tableProps,
  406. // 列表数据
  407. tableData: [],
  408. localData: {
  409. env: "test"
  410. }
  411. };
  412. },
  413. computed: {
  414. isTest() {
  415. return this.localData.env === "test";
  416. },
  417. whole() {
  418. return this.totalData.whole || {};
  419. },
  420. totalDeposit() {
  421. return this.whole.total_deposit;
  422. },
  423. totalFee() {
  424. return this.whole.total_fee;
  425. }
  426. },
  427. mounted() {
  428. this.getTableData();
  429. this.getEnum();
  430. },
  431. methods: {
  432. // 改变订单类型
  433. changeOrder() {
  434. var haveAll = false;
  435. for (var i = 0; i < this.orderType.length; i++) {
  436. if (this.orderType[i] == 0) {
  437. haveAll = true;
  438. }
  439. }
  440. // 选择其他的时候,去掉全部,全部在第一位
  441. if (
  442. this.orderType[0] == 0 &&
  443. 1 < this.orderType.length < this.TypeList.length
  444. ) {
  445. var arr = [];
  446. for (var i = 0; i < this.orderType.length; i++) {
  447. if (this.orderType[i] != 0) {
  448. arr.push(this.orderType[i]);
  449. }
  450. }
  451. this.orderType = arr;
  452. }
  453. // 选择全部的时候去掉其他,全部在最后一位
  454. if (this.orderType[this.orderType.length - 1] == 0) {
  455. this.orderType = [0];
  456. }
  457. if (!haveAll && this.orderType.length == this.TypeList.length - 1) {
  458. this.orderType = [0];
  459. }
  460. },
  461. // 改变交易类型
  462. changeTrade() {
  463. var haveAll = false;
  464. for (var i = 0; i < this.tradeType.length; i++) {
  465. if (this.tradeType[i] == 0) {
  466. haveAll = true;
  467. }
  468. }
  469. // 选择其他的时候,去掉全部,全部在第一位
  470. if (
  471. this.tradeType[0] == 0 &&
  472. 1 < this.tradeType.length < this.tradeList.length
  473. ) {
  474. var arr = [];
  475. for (var i = 0; i < this.tradeType.length; i++) {
  476. if (this.tradeType[i] != 0) {
  477. arr.push(this.tradeType[i]);
  478. }
  479. }
  480. this.tradeType = arr;
  481. }
  482. // 选择全部的时候去掉其他,全部在最后一位
  483. if (this.tradeType[this.tradeType.length - 1] == 0) {
  484. this.tradeType = [0];
  485. }
  486. if (!haveAll && this.tradeType.length == this.tradeList.length - 1) {
  487. this.tradeType = [0];
  488. }
  489. },
  490. // 改变支付方式
  491. changePay() {
  492. var haveAll = false;
  493. for (var i = 0; i < this.payType.length; i++) {
  494. if (this.payType[i] == 0) {
  495. haveAll = true;
  496. }
  497. }
  498. // 选择其他的时候,去掉全部,全部在第一位
  499. if (
  500. this.payType[0] == 0 &&
  501. 1 < this.payType.length < this.payList.length
  502. ) {
  503. var arr = [];
  504. for (var i = 0; i < this.payType.length; i++) {
  505. if (this.payType[i] != 0) {
  506. arr.push(this.payType[i]);
  507. }
  508. }
  509. this.payType = arr;
  510. }
  511. // 选择全部的时候去掉其他,全部在最后一位
  512. if (this.payType[this.payType.length - 1] == 0) {
  513. this.payType = [0];
  514. }
  515. if (!haveAll && this.payType.length == this.payList.length - 1) {
  516. this.payType = [0];
  517. }
  518. },
  519. clickExport() {
  520. window.open("/api/admin/job/get_all_periods?action=export");
  521. },
  522. /**
  523. * 获取筛选值
  524. */
  525. async getEnum() {
  526. let { data } = await this.$get("/api/admin/job/getEnum");
  527. console.log(data);
  528. if (data) {
  529. let { jobStatusList, periodStatusList } = data;
  530. this.jobStatusList = jobStatusList;
  531. this.periodStatusList = periodStatusList;
  532. }
  533. },
  534. // 点击操作
  535. clickOperate({ job_id, id }) {
  536. if (this.isTest)
  537. window.open(
  538. `https://dev.test-rooter.proginn.com/main/wage_settlement?job_id=${job_id}&period_id=${id}`
  539. );
  540. else
  541. window.open(
  542. `https://rooter.proginn.com/main/wage_settlement?job_id=${job_id}&period_id=${id}`
  543. );
  544. },
  545. // 点击账单
  546. clickOrder(i) {
  547. if (this.isTest)
  548. window.open(
  549. `https://dev.test-rooter.proginn.com/main/wage_details?job_id=${i.job_id}&period_id=${i.id}`
  550. );
  551. else
  552. window.open(
  553. `https://rooter.proginn.com/main/wage_details?job_id=${i.job_id}&period_id=${i.id}`
  554. );
  555. },
  556. // 点击开发者
  557. clickDev(uid) {
  558. if (this.isTest)
  559. window.open(`https://dev.test.proginn.com/rooter/user/${uid}`);
  560. else window.open(`https://www.proginn.com/rooter/user/${uid}`);
  561. },
  562. // 点击企业
  563. clickCompany(uid) {
  564. if (this.isTest)
  565. window.open(`https://dev.test.proginn.com/rooter/user/${uid}`);
  566. else window.open(`https://www.proginn.com/rooter/user/${uid}`);
  567. },
  568. // 点击账单id
  569. clickJobID(jobID) {
  570. if (this.isTest)
  571. window.open(
  572. `https://dev.test.proginn.com/rooter/cloudjobitem/${jobID}`
  573. );
  574. else window.open(`https://www.proginn.com/rooter/cloudjobitem/${jobID}`);
  575. },
  576. // 点击重试
  577. async clickRetry(id) {
  578. const res = await this.$post("/api/admin/payment/redoDraw", { id });
  579. // console.log(res)
  580. },
  581. // 根据状态显示图表样式
  582. tableRowClassName({ row, rowIndex }) {
  583. // console.log({row, rowIndex})
  584. let className = "";
  585. if (row.j_status_name === "结束合作") className = "end-row";
  586. // console.log(className)
  587. return className;
  588. },
  589. // 格式化列表数据
  590. formatTableData(data) {
  591. return data.map(i => ({
  592. ...i,
  593. payAround: `${i.start_time}<br>${i.end_time}`,
  594. pre_send_salary_timeShow: new Date(
  595. i.pre_send_salary_time * 1000
  596. ).toLocaleDateString()
  597. }));
  598. },
  599. /**
  600. * 点击筛选确认
  601. */
  602. clickSearchConfirm() {
  603. this.currentPage = 1;
  604. this.getTableData();
  605. },
  606. changePageSize(pageSize) {
  607. this.currentPageSize = pageSize;
  608. this.getTableData();
  609. },
  610. // 获取列表数据
  611. async getTableData() {
  612. this.tableData = [];
  613. let url = "/api/admin/job/get_all_periods";
  614. let body = { page: this.currentPage, page_size: this.currentPageSize };
  615. if (this.status) body.j_status = this.status;
  616. if (this.period) body.p_status = this.period;
  617. if (this.checkUser) body.chk_user = this.checkUser;
  618. if (this.jobID) body.job_id = this.jobID;
  619. const res = await this.$post(url, body);
  620. const data = res.data;
  621. this.tableData = this.formatTableData(data.list);
  622. this.totalData = data;
  623. // // console.log(this.tableData)
  624. this.totalCount = Number(data.total);
  625. this.totalPage = data.totalPage;
  626. this.localData.env = data.current_env;
  627. }
  628. }
  629. };
  630. </script>
  631. <style scoped>
  632. #order-wrap .el-date-editor .el-range-separator {
  633. width: auto;
  634. }
  635. #order-wrap {
  636. width: 100%;
  637. }
  638. #cloud-balance {
  639. white-space: nowrap;
  640. overflow-x: scroll;
  641. }
  642. .top {
  643. display: flex;
  644. flex-direction: column;
  645. justify-content: center;
  646. height: 240px;
  647. }
  648. .selector-box {
  649. /* margin-top: 10px; */
  650. }
  651. .selector-box {
  652. display: flex;
  653. justify-content: space-between;
  654. }
  655. /* .selector-box-left {
  656. } */
  657. .table {
  658. margin-top: 10px;
  659. height: calc(100% - 160px);
  660. }
  661. .order-table {
  662. height: calc(100% - 300px);
  663. }
  664. .end-row {
  665. background: rgba(0, 0, 0, 0.1);
  666. }
  667. .inlineb {
  668. display: inline-block;
  669. }
  670. .vsub {
  671. vertical-align: sub;
  672. }
  673. .type-boxs {
  674. margin-bottom: 10px;
  675. }
  676. </style>