artificial_orders.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <div id="cloud-balance">
  3. <!-- <section class="top"> -->
  4. <!-- <h3>交易订单中心</h3> -->
  5. <!-- <section> -->
  6. <div class="type-boxs">
  7. <div class="clear">
  8. <div class="floatr">
  9. <<<<<<< HEAD
  10. <nuxt-link :to="{path:'/main/order_detail'}">
  11. <el-button type="primary">新增订单</el-button>
  12. </nuxt-link>
  13. =======
  14. <el-button type="primary" @click="createOrder()">新增订单</el-button>
  15. >>>>>>> 42fa5027cccf279afcd8b7554c0fbfe0c734a7cf
  16. <el-button>导出报表</el-button>
  17. </div>
  18. </div>
  19. </div>
  20. <!-- </section> -->
  21. <!-- </section> -->
  22. <div class="trcenter" style="height: calc(100%) ">
  23. <!-- height="250" -->
  24. <el-table :data="finaceList" border style="width: 100%;" height="100%">
  25. <el-table-column label="订单名称">
  26. <template slot-scope="scope">
  27. <!-- @click="clickDev(scope.row.uid)" -->
  28. <span class="lblue point">
  29. <nuxt-link
  30. :to="{path:'/main/orders_detail?id='+scope.row.id}"
  31. >{{scope.row.product_title}}</nuxt-link>
  32. </span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="用户">
  36. <template slot-scope="scope">{{scope.row.user_info.nickname}}({{scope.row.uid }})</template>
  37. </el-table-column>
  38. <el-table-column label="实际金额">
  39. <template slot-scope="scope">
  40. <span
  41. v-if="parseInt(scope.row.real_amount)>=0"
  42. class="green"
  43. >+{{scope.row.real_amount/100}}</span>
  44. <span v-else class="orange">+{{scope.row.real_amount/100}}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="收支类型">
  48. <template slot-scope="scope">
  49. <span>{{parseInt(scope.row.real_amount)>=0?"收入":"支出"}}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="channel" label="支付方式"></el-table-column>
  53. <el-table-column prop="order_type_name" label="交易类型">
  54. <template slot-scope="scope">
  55. <span>{{scope.row.order_type_name}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="product_type_name" width="100" label="订单状态">
  59. <template slot-scope="scope">
  60. {{scope.row.product_type_name}}
  61. <!-- order_type -->
  62. <!-- <span v-if="scope.row.state==1" class="state-success state-border">成功</span>
  63. <span v-if="scope.row.state==2" class="state-wait state-border">待提交</span>
  64. <span v-if="scope.row.state==3" class="state-load state-border">提交中</span>
  65. <span v-if="scope.row.state==4" class="state-faile state-border">失败</span>-->
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="创建时间">
  69. <template slot-scope="scope">
  70. <span>{{formatDate(scope.row.created_at)}}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="operator_uid" label="创建者"></el-table-column>
  74. <el-table-column prop="order_no" label="订单编号"></el-table-column>
  75. <el-table-column prop="out_order_id" label="支付编号"></el-table-column>
  76. <el-table-column label="关联项目">
  77. <template slot-scope="scope">
  78. <a :href="scope.row.related_project.url?scope.row.related_project.url:'#'">
  79. <span
  80. class="lblue"
  81. >{{scope.row.related_project.name?scope.row.related_project.name:"--"}}</span>
  82. </a>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="编辑">
  86. <template slot-scope="scope">
  87. <!-- 需求是状态等于“待提交的时候显示”给我一个状态_name 或者是待提交的id -->
  88. <nuxt-link :to="{path:'/main/order_detail?id='+scope.row.id}">
  89. <span v-if="scope.row.status==0" class="lblue point">编辑</span>
  90. </nuxt-link>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </div>
  95. <div class="order-footer">
  96. <el-pagination
  97. background
  98. @current-change="getFinanceList"
  99. @size-change="changePageSize"
  100. :current-page.sync="currentPage"
  101. :page-sizes="[10, 20, 30, 40]"
  102. :page-size="20"
  103. layout="total, sizes, prev, pager, next, jumper"
  104. :total="totalCount"
  105. ></el-pagination>
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. const tableHeaders = [
  111. "项目ID",
  112. "核定价格",
  113. "托管费用",
  114. "押金",
  115. "次月托管",
  116. "结算周期",
  117. "结算金额",
  118. "退回金额",
  119. "预计发薪",
  120. "发薪日期",
  121. "状态",
  122. "负责人",
  123. "操作",
  124. "备注",
  125. "项目状态",
  126. "账单ID",
  127. "企业方",
  128. "开发者",
  129. "试用天数"
  130. ];
  131. const tableProps = [
  132. "job_id",
  133. "salary",
  134. "company_pay",
  135. "p_company_deposit",
  136. "next_period_pay",
  137. "payAround",
  138. "pay_to_dev",
  139. "return_money",
  140. "pre_send_salary_timeShow", //
  141. "send_salary_time",
  142. "p_status_name",
  143. "chk_user",
  144. "operate",
  145. "settle_msg",
  146. "j_status_name",
  147. "id",
  148. "company",
  149. "dev_realname",
  150. "probation_days"
  151. ];
  152. const tableWidths = [
  153. "80",
  154. "80",
  155. "100",
  156. "80",
  157. "100",
  158. "120",
  159. "80",
  160. "80",
  161. "90",
  162. "80",
  163. "80",
  164. "100",
  165. "80",
  166. "180",
  167. "80",
  168. "80",
  169. "100",
  170. "100",
  171. "80"
  172. ];
  173. export default {
  174. data() {
  175. return {
  176. tradeList: [
  177. {
  178. id: 0,
  179. type: "全部"
  180. },
  181. {
  182. id: 1,
  183. type: "充值"
  184. },
  185. {
  186. id: 2,
  187. type: "提现"
  188. },
  189. {
  190. id: 3,
  191. type: "购买"
  192. },
  193. {
  194. id: 4,
  195. type: "购买"
  196. }
  197. ],
  198. finaceList: [],
  199. // 下发的总数据
  200. totalData: {},
  201. // 项目ID
  202. jobID: "",
  203. // 审核人
  204. period: "",
  205. status: "",
  206. // 负责人
  207. checkUser: "",
  208. // 审核人列表
  209. periodStatusList: [],
  210. // 数据总条目
  211. totalCount: 1,
  212. currentPage: 1,
  213. currentPageSize: 20,
  214. // 列表宽度
  215. tableWidths,
  216. // 列表头显示内容
  217. tableHeaders,
  218. // 列表头字段
  219. tableProps,
  220. // 列表数据
  221. tableData: [],
  222. localData: {
  223. env: "test"
  224. }
  225. };
  226. },
  227. computed: {
  228. isTest() {
  229. return this.localData.env === "test";
  230. }
  231. },
  232. mounted() {
  233. this.getTableData();
  234. this.getFinanceList();
  235. },
  236. methods: {
  237. clickDev(uid) {
  238. this.$router.push({ path: "/main/orders_detail", params: { id: uid } });
  239. },
  240. changePageSize(val) {
  241. this.getFinanceList();
  242. },
  243. // 格式化列表数据
  244. formatTableData(data) {
  245. return data.map(i => ({
  246. ...i,
  247. payAround: `${i.start_time}<br>${i.end_time}`,
  248. pre_send_salary_timeShow: new Date(
  249. i.pre_send_salary_time * 1000
  250. ).toLocaleDateString()
  251. }));
  252. },
  253. formatDate(time) {
  254. var now = new Date(time * 1000);
  255. var year = now.getFullYear();
  256. var month = now.getMonth() + 1;
  257. var date = now.getDate();
  258. var hour = now.getHours();
  259. var minute = now.getMinutes();
  260. var second = now.getSeconds();
  261. if (hour < 10) {
  262. hour = "0" + hour;
  263. }
  264. if (minute < 10) {
  265. minute = "0" + minute;
  266. }
  267. if (second < 10) {
  268. second = "0" + second;
  269. }
  270. return (
  271. year +
  272. "-" +
  273. month +
  274. "-" +
  275. date +
  276. " " +
  277. hour +
  278. ":" +
  279. minute +
  280. ":" +
  281. second
  282. );
  283. },
  284. // 获取列表数据
  285. async getTableData() {
  286. this.tableData = [];
  287. let url = "/api/admin/job/get_all_periods";
  288. let body = { page: this.currentPage, page_size: this.currentPageSize };
  289. if (this.status) body.j_status = this.status;
  290. if (this.period) body.p_status = this.period;
  291. if (this.checkUser) body.chk_user = this.checkUser;
  292. if (this.jobID) body.job_id = this.jobID;
  293. const res = await this.$post(url, body);
  294. const data = res.data;
  295. this.tableData = this.formatTableData(data.list);
  296. this.totalData = data;
  297. // // console.log(this.tableData)
  298. // this.totalCount = Number(data.total);
  299. // this.totalPage = data.totalPage;
  300. this.localData.env = data.current_env;
  301. },
  302. async getFinanceList() {
  303. let body = {
  304. page: this.currentPage,
  305. page_size: this.currentPageSize,
  306. artificial_mark: 1
  307. };
  308. const res = await this.$post("/api/admin/order/get_orders", body);
  309. var data = res.data;
  310. this.finaceList = data.orders;
  311. this.totalCount = Number(data.count);
  312. },
  313. createOrder() {
  314. this.$router.push({
  315. path:'artificial_order/',
  316. query:{
  317. type:'create'
  318. }}
  319. )
  320. }
  321. }
  322. };
  323. </script>
  324. <style scoped>
  325. .order-footer {
  326. position: absolute;
  327. bottom: 10px;
  328. left: 10px;
  329. }
  330. #order-wrap {
  331. width: 100%;
  332. }
  333. #cloud-balance {
  334. white-space: nowrap;
  335. overflow-x: scroll;
  336. height: calc(100% - 40px);
  337. }
  338. .top {
  339. display: flex;
  340. flex-direction: column;
  341. justify-content: center;
  342. height: 270px;
  343. }
  344. .selector-box {
  345. /* margin-top: 10px; */
  346. }
  347. .selector-box {
  348. display: flex;
  349. justify-content: space-between;
  350. }
  351. /* .selector-box-left {
  352. } */
  353. .table {
  354. margin-top: 10px;
  355. height: calc(100% - 320px);
  356. }
  357. .order-table {
  358. /* height: calc(100% - 300px); */
  359. }
  360. .end-row {
  361. background: rgba(0, 0, 0, 0.1);
  362. }
  363. .inlineb {
  364. display: inline-block;
  365. }
  366. .vsub {
  367. vertical-align: sub;
  368. }
  369. .type-boxs {
  370. margin-bottom: 10px;
  371. }
  372. .green {
  373. color: rgba(37, 155, 36, 1);
  374. }
  375. .orange {
  376. color: rgba(255, 152, 0, 1);
  377. }
  378. .state-success {
  379. display: inline-block;
  380. padding: 0px 8px;
  381. text-align: center;
  382. border: 1px solid rgb(48, 142, 255);
  383. }
  384. .state-wait {
  385. display: inline-block;
  386. padding: 0px 8px;
  387. text-align: center;
  388. border: 1px solid rgb(134, 130, 130);
  389. }
  390. .state-load {
  391. display: inline-block;
  392. padding: 0px 8px;
  393. text-align: center;
  394. border: 1px solid rgb(37, 155, 36);
  395. }
  396. .state-faile {
  397. display: inline-block;
  398. padding: 0px 8px;
  399. text-align: center;
  400. border: 1px solid rgb(229, 28, 35);
  401. }
  402. </style>