gongmall.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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" height="100%" 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 ? rData.totalWaitConfirm / 100 : '--',
  145. amount: rData.accountBalance.amount,
  146. totalWaitPay: rData.totalWaitPay ? rData.totalWaitPay / 100 : '--',
  147. totalSuccessPay: rData.totalSuccessPay ? rData.totalSuccessPay / 100 : '--',
  148. }
  149. return data.map(i => {
  150. let projectName = '--'
  151. let prePay = ''
  152. let servicePay = ''
  153. let getPay = ''
  154. let realGet = ''
  155. // 3 比较特殊,所以这样写
  156. if(i.entity_type === '3') {
  157. projectName = rData.periodList[i.entity_id].pro_name
  158. prePay = ((rData.periodList[i.entity_id].origin_price || 0) / 100).toFixed(2)
  159. servicePay = ((rData.periodList[i.entity_id].person_platform_fee || 0) / 100).toFixed(2)
  160. getPay = rData.periodList[i.entity_id].total_person_tax_fee || 0
  161. realGet = rData.periodList[i.entity_id].developer_fee || 0
  162. } else {
  163. if(i.entity_type === '1') projectName = rData.projectList[i.entity_id].pro_name
  164. prePay = ((rData.projectList[i.entity_id].origin_price || 0) / 100).toFixed(2)
  165. servicePay = ((rData.projectList[i.entity_id].person_platform_fee || 0) / 100).toFixed(2)
  166. getPay = rData.projectList[i.entity_id].total_person_tax_fee || 0
  167. realGet = rData.projectList[i.entity_id].developer_fee || 0
  168. }
  169. return {
  170. ...i,
  171. projectName,
  172. payTypeShow: i.pay_type === '1' ? '首付款' : '解冻款',
  173. bankCode: rData.bankAccounts[i.uid] || '--',
  174. prePay,
  175. servicePay,
  176. getPay,
  177. realGet,
  178. pay_timeShow: i.pay_time > 0 ? new Date(i.pay_time).toLocaleDateString() : '--',
  179. }
  180. })
  181. },
  182. // 获取列表数据
  183. async getTableData() {
  184. this.tableData = []
  185. const p = this.currentPage
  186. const res = await this.$post("/api/admin/gongmall/orders", { p })
  187. // console.log(res)
  188. const data = res.data
  189. const list = data.list
  190. this.tableData = this.formatTableData(list, data)
  191. this.totalCount = Number(data.total)
  192. this.totalPage = data.totalPage
  193. }
  194. }
  195. }
  196. </script>
  197. <style scoped>
  198. .table {
  199. height: 100%;
  200. height: calc(100% - 80px);
  201. }
  202. </style>