balance_change.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template >
  2. <div id="mainBody" v-if="coins" style="padding-bottom: 60px;">
  3. <el-row>
  4. <el-col :span="24">
  5. <h3>用户余额订单</h3>
  6. <div class="type-boxs top">
  7. <span class="vsub">订单类型:</span>
  8. <div class="inlineb">
  9. <el-checkbox-group v-model="orderType" @change="orderStatus" size="mini">
  10. <el-checkbox-button
  11. v-for="allorder in orders"
  12. :label="allorder"
  13. :key="allorder"
  14. >{{allorder}}</el-checkbox-button>
  15. </el-checkbox-group>
  16. </div>
  17. </div>
  18. </el-col>
  19. </el-row>
  20. <el-form ref="form" label-width="40px" :model="form">
  21. <el-row :gutter="20">
  22. <el-col :span="3">
  23. <el-form-item label="用户">
  24. <el-input placeholder="UID" v-model="user"></el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="3">
  28. <el-form-item label="编号">
  29. <el-input placeholder="订单编号" v-model="order_no"></el-input>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="7">
  33. <el-form-item label="时间范围" label-width="80px">
  34. <el-date-picker
  35. v-model="timeRange"
  36. type="daterange"
  37. range-separator="至"
  38. start-placeholder="开始时间"
  39. end-placeholder="结束时间"
  40. ></el-date-picker>
  41. </el-form-item>
  42. </el-col>
  43. <el-button type="primary" plain @click="getFinanceList">筛选</el-button>
  44. <el-button plain>导出报表</el-button>
  45. </el-row>
  46. </el-form>
  47. <el-table :data="coins" border style="width: 100%">
  48. <el-table-column prop="date" label="ID" width="60">
  49. <template slot-scope="scope">{{scope.row.id}}</template>
  50. </el-table-column>
  51. <el-table-column prop="name" label="用户" width="180">
  52. <template slot-scope="scope">
  53. <a
  54. :href="scope.row.user_url"
  55. class="link-type"
  56. target="_blank"
  57. >{{scope.row.nickname}}({{scope.row.uid}})</a>
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="address" label="变动金额">
  61. <template slot-scope="scope">{{scope.row.use}}</template>
  62. </el-table-column>
  63. <el-table-column prop="address" :label="changedCoins">
  64. <template slot-scope="scope">{{scope.row.total}}</template>
  65. </el-table-column>
  66. <el-table-column prop="address" label="变动前总金额">
  67. <template slot-scope="scope">{{scope.row.before_total_balance}}</template>
  68. </el-table-column>
  69. <el-table-column prop="address" label="变动后充值余额">
  70. <template slot-scope="scope">{{scope.row.total_recharge}}</template>
  71. </el-table-column>
  72. <el-table-column prop="address" label="变动后收入余额">
  73. <template slot-scope="scope">{{scope.row.total_income}}</template>
  74. </el-table-column>
  75. <el-table-column prop="address" label="变动前收入余额">
  76. <template slot-scope="scope">{{scope.row.before_income_balance}}</template>
  77. </el-table-column>
  78. <el-table-column prop="address" label="创建时间">
  79. <template slot-scope="scope">{{scope.row.time}}</template>
  80. </el-table-column>
  81. <el-table-column prop="address" label="更新时间">
  82. <template slot-scope="scope">{{scope.row.update_time}}</template>
  83. </el-table-column>
  84. <el-table-column prop="address" label="订单编号">
  85. <template slot-scope="scope">{{scope.row.order_no}}</template>
  86. </el-table-column>
  87. </el-table>
  88. <div class="order-footer">
  89. <el-pagination
  90. background
  91. @current-change="getFinanceList"
  92. @size-change="changePageSize"
  93. :current-page.sync="currentPage"
  94. :page-sizes="[10, 20, 30, 40]"
  95. :page-size="20"
  96. layout="total, sizes, prev, pager, next, jumper"
  97. :total="count"
  98. ></el-pagination>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. const allorderOptions = ["全部", "可用余额"];
  104. export default {
  105. data() {
  106. return {
  107. currentPage: 1,
  108. currentPageSize: 20,
  109. coins: [],
  110. count: 1,
  111. user: "",
  112. order_no: "",
  113. timeRange: [],
  114. orderType: [
  115. this.$route.query && this.$route.query.orderType
  116. ? this.$route.query.orderType
  117. : "全部"
  118. ],
  119. orders: allorderOptions,
  120. changedCoins: "变动后总金额"
  121. };
  122. },
  123. mounted() {
  124. console.log(this.$route.query);
  125. this.getFinanceList();
  126. },
  127. methods: {
  128. changePageSize(val) {
  129. this.getFinanceList();
  130. },
  131. async getFinanceList() {
  132. this.user = this.$route.query.user;
  133. let body = {
  134. page: this.currentPage,
  135. size: this.currentPageSize,
  136. user: this.user,
  137. orderType: this.orderType
  138. };
  139. if (this.order_no) {
  140. body.order_no = this.order_no;
  141. }
  142. if (this.timeRange.length > 0) {
  143. console.log(this.timeRange);
  144. body.start_time = this.timeRange[0] / 1000;
  145. body.end_time = this.timeRange[1] / 1000;
  146. }
  147. const res = await this.$post("/api/admin/order/get_coins", body);
  148. this.coins = res.data.list;
  149. this.count = Number(res.data.count);
  150. },
  151. async downFinanceList() {
  152. let body = {
  153. page: this.currentPage,
  154. page_size: this.currentPageSize,
  155. user: this.$route.query.user
  156. };
  157. var url =
  158. window.location.host + "/api/admin/order/export?" + "artificial_mark=1";
  159. window.location.href = "http://" + url;
  160. },
  161. async orderStatus(val) {
  162. // this.orderType = ['全部'];
  163. if (this.orderType[0] == "全部") {
  164. this.orderType = ["可用余额"];
  165. this.changedCoins = "当前余额";
  166. } else if (this.orderType[0] == "可用余额") {
  167. this.orderType = ["全部"];
  168. this.changedCoins = "变动后总金额";
  169. } else {
  170. this.orderType = ["全部"];
  171. this.changedCoins = "变动后总金额";
  172. }
  173. let body = {
  174. page: this.currentPage,
  175. size: this.currentPageSize
  176. };
  177. if (this.orderType) {
  178. body.orderType = this.orderType;
  179. }
  180. const res = await this.$post("/api/admin/order/get_coins", body);
  181. this.coins = res.data.list;
  182. this.count = Number(res.data.count);
  183. }
  184. }
  185. };
  186. </script>
  187. <style lang="scss" scoped>
  188. .order-footer {
  189. position: absolute;
  190. bottom: 10px;
  191. left: 10px;
  192. }
  193. #mainBody {
  194. white-space: nowrap;
  195. height: calc(100% - 40px);
  196. }
  197. .top {
  198. padding: 10px;
  199. }
  200. </style>