gongmall.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div id="cloud-job">
  3. <div
  4. class="title"
  5. >企业账户:可用余额{{titleInfo.availableAmount}}元 待确认金额{{titleInfo.totalWaitConfirm}}元 帐户总金额{{titleInfo.amount}}元 待付款金额{{titleInfo.totalWaitPay}}元 成功支付金额{{titleInfo.totalSuccessPay}}元</div>
  6. <div class="table">
  7. <el-table v-if="tableData.length" border style="width: 100%" :data="tableData">
  8. <el-table-column
  9. v-for="(prop, index) of tableProps"
  10. :key="index"
  11. :prop="prop"
  12. :label="tableHeaders[index]"
  13. >
  14. <template slot-scope="scope">
  15. <a
  16. v-if="prop === 'projectName'"
  17. :href="scope.row | projectLink"
  18. target="_blank"
  19. >{{scope.row[prop]}}</a>
  20. <a
  21. v-else-if="prop === 'nickname'"
  22. :href="`/rooter/user/${scope.row['uid']}`"
  23. target="_blank"
  24. >{{scope.row[prop]}}</a>
  25. <span v-else-if="prop === 'create_time'">{{scope.row[prop] | toDate}}</span>
  26. <template v-else-if="prop === 'state'">
  27. <el-button
  28. v-if="scope.row[prop] === '1'"
  29. type="primary"
  30. @click="confirmPay(scope.row)"
  31. >确认付款</el-button>
  32. <span v-else-if="scope.row[prop] === '4'">已提交</span>
  33. <span v-else-if="scope.row[prop] === '8'">已成功</span>
  34. <el-button
  35. v-else-if="scope.row[prop] === '16'"
  36. type="danger"
  37. @click="rePay(scope.row)"
  38. >失败重试</el-button>
  39. <span v-else>--</span>
  40. </template>
  41. <span v-else>{{scope.row[prop]}}</span>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. </div>
  46. <el-pagination
  47. @current-change="changePagination"
  48. :current-page.sync="currentPage"
  49. :page-size="10"
  50. layout="total, prev, pager, next"
  51. :total="totalCount"
  52. ></el-pagination>
  53. </div>
  54. </template>
  55. <script>
  56. const tableHeaders = [
  57. "项目名称",
  58. "付款类型",
  59. "用户昵称",
  60. "银行卡号",
  61. "税前应付",
  62. "平台服务费",
  63. "所得税费",
  64. "开发者净收入",
  65. "本次应付",
  66. "实际到账",
  67. "结算时间",
  68. "付款流水号",
  69. "付款时间",
  70. "操作"
  71. ];
  72. const tableProps = [
  73. "projectName",
  74. "payTypeShow",
  75. "nickname",
  76. "bankCode",
  77. "prePay",
  78. "servicePay",
  79. "getPay",
  80. "realGet",
  81. "current_gongmall",
  82. "amount",
  83. "create_time",
  84. "gongmall_order_id",
  85. "pay_timeShow",
  86. "state"
  87. ];
  88. export default {
  89. data() {
  90. return {
  91. // 头部信息
  92. titleInfo: {},
  93. // 数据总条目
  94. totalCount: 0,
  95. // 当前页面
  96. currentPage: 1,
  97. // 列表头显示内容
  98. tableHeaders,
  99. // 列表头字段
  100. tableProps,
  101. // 列表数据
  102. tableData: []
  103. };
  104. },
  105. mounted() {
  106. this.getTableData();
  107. },
  108. filters: {
  109. toDate(val) {
  110. return new Date(val * 1000).toLocaleDateString();
  111. },
  112. projectLink(i) {
  113. const type = i.entity_type;
  114. let link = "javascript:void(0);";
  115. if (type === "1") link = `/rooter/outsourceitem/${i.entity_id}>`;
  116. else if (type === "3") link = `/rooter/wagedetails?job_id=${i.entity_id}`;
  117. return link;
  118. }
  119. },
  120. methods: {
  121. // 重新支付
  122. async rePay(i) {
  123. const res = await this.$post("/api/admin/gongmall/confirm_pay", {
  124. id: i.id,
  125. amount: i.current_gongmall,
  126. nickname: i.nickname
  127. });
  128. if (res) {
  129. this.getTableData();
  130. }
  131. },
  132. // 确认支付
  133. confirmPay(i) {
  134. this.rePay(i);
  135. },
  136. // 页码变动
  137. changePagination() {
  138. this.getTableData();
  139. },
  140. // 格式化列表数据
  141. formatTableData(data, rData) {
  142. this.titleInfo = {
  143. availableAmount: rData.accountBalance.availableAmount,
  144. totalWaitConfirm: rData.totalWaitConfirm
  145. ? (rData.totalWaitConfirm / 100).toFixed(2)
  146. : "--",
  147. amount: rData.accountBalance.amount,
  148. totalWaitPay: rData.totalWaitPay ? rData.totalWaitPay / 100 : "--",
  149. totalSuccessPay: rData.totalSuccessPay
  150. ? rData.totalSuccessPay / 100
  151. : "--"
  152. };
  153. return data.map(i => {
  154. let projectName = "--";
  155. let prePay = "";
  156. let servicePay = "";
  157. let getPay = "";
  158. let realGet = "";
  159. // 3 比较特殊,所以这样写
  160. if (i.entity_type === "3") {
  161. projectName = rData.periodList[i.entity_id].pro_name;
  162. prePay = (
  163. (rData.projectList[i.entity_id]?rData.projectList[i.entity_id].origin_price || 0:0) / 100
  164. ).toFixed(2);
  165. servicePay = (
  166. (rData.periodList[i.entity_id].person_platform_fee || 0) / 100
  167. ).toFixed(2);
  168. getPay = rData.periodList[i.entity_id].total_person_tax_fee || 0;
  169. realGet = rData.periodList[i.entity_id].developer_fee || 0;
  170. } else {
  171. if (i.entity_type === "1")
  172. projectName = rData.projectList[i.entity_id].pro_name;
  173. prePay = (
  174. (rData.projectList[i.entity_id]?rData.projectList[i.entity_id].origin_price || 0:0) / 100
  175. ).toFixed(2);
  176. servicePay = (
  177. (rData.projectList[i.entity_id].person_platform_fee || 0) / 100
  178. ).toFixed(2);
  179. getPay = rData.projectList[i.entity_id].total_person_tax_fee || 0;
  180. realGet = rData.projectList[i.entity_id].developer_fee || 0;
  181. }
  182. return {
  183. ...i,
  184. projectName,
  185. payTypeShow: i.pay_type === "1" ? "首付款" : "解冻款",
  186. bankCode: rData.bankAccounts[i.uid] || "--",
  187. prePay,
  188. servicePay,
  189. getPay,
  190. realGet,
  191. pay_timeShow:
  192. i.pay_time > 0 ? new Date(i.pay_time).toLocaleDateString() : "--"
  193. };
  194. });
  195. },
  196. // 获取列表数据
  197. async getTableData() {
  198. this.tableData = [];
  199. const p = this.currentPage;
  200. const res = await this.$post("/api/admin/gongmall/orders", { p });
  201. // console.log(res)
  202. const data = res.data;
  203. const list = data.list;
  204. this.tableData = this.formatTableData(list, data);
  205. this.totalCount = Number(data.total);
  206. this.totalPage = data.totalPage;
  207. }
  208. }
  209. };
  210. </script>
  211. <style scoped>
  212. .table {
  213. height: 100%;
  214. height: calc(100% - 80px);
  215. }
  216. </style>