balance-log.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-export-dialog', '@backend/views/components/common');
  4. ?>
  5. <style>
  6. .order_stat{
  7. background: #FFF;
  8. padding: 10px 10px 0;
  9. margin-bottom: 10px;
  10. }
  11. .title{
  12. font-size: 18px;
  13. font-weight: bold;
  14. display: flex;
  15. align-items: center;
  16. height: 40px;
  17. }
  18. .order_stat > .title > .time{
  19. font-size: 13px;
  20. font-weight: 400;
  21. color: #BFBFBF;
  22. margin-left: 20px;
  23. flex: 1;
  24. }
  25. .order_stat .stat_details{
  26. padding: 30px 0;
  27. display: flex;
  28. }
  29. .default-avatar{
  30. width: 50px;
  31. height: 50px;
  32. border-radius: 50%;
  33. margin-right: 8px;
  34. }
  35. .uer-nickname {
  36. flex: 1;
  37. }
  38. .user_img{
  39. position: relative;
  40. margin-right: 8px;
  41. /* height: 50px;
  42. width: 50px; */
  43. }
  44. .search_button{
  45. margin-right: 20px;
  46. }
  47. </style>
  48. <div id="app" v-cloak>
  49. <div class="order_stat">
  50. <div class="title">余额明细</div>
  51. </div>
  52. <el-card shadow="never" style="border:0;min-width: 800px;">
  53. <div class="input-item">
  54. <el-input @keyup.enter.native="search" size="small" placeholder="请输入会员id" v-model="searchData.user_id" clearable>
  55. </el-input>
  56. </div>
  57. <div class="input-item">
  58. <el-input @keyup.enter.native="search" size="small" placeholder="会员昵称/手机号" v-model="searchData.keyword" clearable>
  59. </el-input>
  60. </div>
  61. <div class="input-item">
  62. <el-input @keyup.enter.native="search" size="small" placeholder="订单号" v-model="searchData.order_no" clearable >
  63. </el-input>
  64. </div>
  65. <el-date-picker size="small" placeholder="下单时间" @change="changeTime" v-model="datetime" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"></el-date-picker>
  66. <el-select size="small" v-model="searchData.balance_from_type" @change='search' class="select">
  67. <el-option key="all" label="类型" value=""></el-option>
  68. <el-option :key="index" :label="item" :value="index" v-for="(item, index) in incomeCapitalTypeList"></el-option>
  69. </el-select>
  70. <div class="input-item">
  71. <el-button type="primary" size="small" icon="el-icon-search" @click="search" class="search_button">搜索</el-button>
  72. <!-- <com-export-dialog :field_list='exportList' :action_url="export_url" :params="searchData" @selected="exportConfirm"></com-export-dialog>-->
  73. </div>
  74. <el-table :data="form" stripe style="width: 100%" v-loading="listLoading">
  75. <el-table-column prop="user_id" label="会员ID" min-width="100" align="center"></el-table-column>
  76. <el-table-column label="会员" width="200">
  77. <template slot-scope="scope">
  78. <div class="table-info-img-text">
  79. <el-image class="table-info-img circle" :src="scope.row.avatar_url">
  80. <div slot="error" class="image-slot">
  81. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  82. </div>
  83. </el-image>
  84. <div class="table-info-text">
  85. <div v-if="scope.row.nickname">{{scope.row.nickname}}</div>
  86. <div>{{scope.row.mobile}}</div>
  87. </div>
  88. </div>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="order_no" label="订单编号" min-width="200" align="center"></el-table-column>
  92. <el-table-column prop="lucky_group_level" label="拼团等级" min-width="200" align="center"></el-table-column>
  93. <el-table-column prop="source_text" v-model="searchData.balance_from_type" min-width="100" label="类型" align="center">
  94. <template slot-scope="scope">
  95. <div v-if="scope.row.source_text">{{scope.row.source_text}}</div>
  96. <div v-else>--</div>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="收入/支出" min-width="180" align="center">
  100. <template slot-scope="scope">
  101. <div style="font-size: 18px;" :style="{color: scope.row.change_type == 'add' ? '#68CF3D' : scope.row.change_type == 'sub' ? '#F6AA5A' : ''}">
  102. {{scope.row.change_type == 'add' ? '+' : scope.row.change_type == 'sub' ? '-' : ''}}
  103. {{scope.row.change_num}}
  104. </div>
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="current_num" label="变动前余额" min-width="200" align="center"></el-table-column>
  108. <el-table-column prop="current_num" label="变动后余额" min-width="150" align="center">
  109. <template slot-scope="scope">
  110. <div v-if="scope.row.change_type == 'add'">{{(scope.row.current_num + scope.row.change_num).toFixed(2)}}</div>
  111. <div v-if="scope.row.change_type == 'sub'">{{(scope.row.current_num - scope.row.change_num).toFixed(2)}}</div>
  112. </template>
  113. </el-table-column>
  114. <el-table-column prop="desc" label="备注" min-width="300" align="left"></el-table-column>
  115. <el-table-column prop="created_at" min-width="200" label="奖励时间" align="center"></el-table-column>
  116. </el-table>
  117. <div style="text-align: right;margin: 20px 0;">
  118. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  119. </div>
  120. </el-card>
  121. </div>
  122. <script>
  123. const app = new Vue({
  124. el: '#app',
  125. data() {
  126. return {
  127. searchData: {
  128. keyword: '',
  129. date: '',
  130. user_id: '',
  131. remark: '',
  132. balance_from_type: '',
  133. start: '',
  134. end: '',
  135. order_no: '',
  136. },
  137. datetime: [],
  138. status: 1,
  139. actionName: 'settlement',
  140. form: [],
  141. pageCount: 0,
  142. listLoading: false,
  143. exportList: {},
  144. incomeCapitalTypeList: [],
  145. export_url: 'lucky-group/finance/balance-log',
  146. orderTotalArr: [{
  147. type: 'income_capital_total',
  148. name: '累计余额',
  149. value: '0.00',
  150. prompt: '累计所有平台产生的余额',
  151. }, {
  152. type: 'expend_capital_total',
  153. name: '已使用',
  154. value: '0.00',
  155. prompt: '使用余额支付或者使用余额抵扣统计',
  156. }, {
  157. type: 'available_capital_total',
  158. name: '会员账户余额',
  159. value: '0.00',
  160. prompt: '所有会员现有账户的余额',
  161. }, {
  162. type: 'cash_out_total',
  163. name: '已提现余额',
  164. value: '0.00',
  165. prompt: '已提现的累计余额',
  166. }, {
  167. type: 'service_charges_tatoal',
  168. name: '手续费扣除',
  169. value: '0.00',
  170. prompt: '余额互转和提现产生的手续费',
  171. }]
  172. };
  173. },
  174. methods: {
  175. exportConfirm() {
  176. this.search.status = this.status
  177. },
  178. pagination(currentPage) {
  179. this.page = currentPage;
  180. this.getList();
  181. },
  182. search() {
  183. this.page = 1;
  184. this.getList();
  185. },
  186. changeTime(e) {
  187. this.searchData.start = e[0]
  188. this.searchData.end = e[1]
  189. },
  190. getList() {
  191. this.listLoading = true;
  192. let self = this;
  193. request({
  194. params: {
  195. r: 'lucky-group/finance/balance-log',
  196. page: self.page,
  197. user_id: self.searchData.user_id,
  198. keyword: self.searchData.keyword,
  199. start: self.searchData.start,
  200. end: self.searchData.end,
  201. remark: self.searchData.remark,
  202. balance_from_type: self.searchData.balance_from_type,
  203. status: this.status,
  204. order_no: this.searchData.order_no,
  205. },
  206. }).then(e => {
  207. // console.log(e);return null;
  208. if (e.data.code === 0) {
  209. self.form = e.data.data.list;
  210. self.exportList = e.data.data.export_list;
  211. self.pageCount = e.data.data.page_count;
  212. self.incomeCapitalTypeList = e.data.data.incomeCapitalTypeList;
  213. let statistics_data = e.data.data.statistics_data;
  214. //self.searchData.date = e.data.data.date;
  215. if (statistics_data) {
  216. // console.log(23222424);
  217. for (const key in statistics_data) {
  218. let info = self.orderTotalArr.filter(v => v.type == key); //订单概况
  219. console.info(info);
  220. if (info.length) {
  221. let index = self.orderTotalArr.findIndex(v => v.type == info[0].type);
  222. self.orderTotalArr[index].value = Number(statistics_data[key]).toFixed(2);
  223. }
  224. }
  225. }
  226. } else {
  227. if (e.data.msg == 'User Id必须是整数。') {
  228. e.data.msg = '会员id必须是整数';
  229. }
  230. self.$message.error(e.data.msg);
  231. }
  232. self.listLoading = false;
  233. }).catch(e => {
  234. self.listLoading = false;
  235. });
  236. },
  237. selectDateTime(e) {
  238. this.searchData.date = e;
  239. this.page = 1;
  240. this.search();
  241. },
  242. change_tab(tab, event) {
  243. if (tab.name == 'settlement') {
  244. this.status = 1;
  245. } else {
  246. this.status = 0;
  247. }
  248. for(let i in this.searchData) {
  249. this.searchData[i] = '';
  250. }
  251. this.search();
  252. },
  253. exportData(){
  254. let self = this;
  255. self.listLoading = true;
  256. request({
  257. params: {
  258. r: 'mall/finance/balance-log',
  259. user_id: self.searchData.user_id,
  260. keyword: self.searchData.keyword,
  261. date: self.searchData.date,
  262. remark: self.searchData.remark,
  263. balance_from_type: self.searchData.balance_from_type,
  264. status: this.status,
  265. flag: 'EXPORT'
  266. },
  267. }).then(e => {
  268. // console.log(e);return null;
  269. if (e.data.code == 0) {
  270. this.$message.success(e.data.msg);
  271. } else {
  272. this.$message.error(e.data.msg);
  273. }
  274. self.listLoading = false;
  275. }).catch(e => {
  276. self.listLoading = false;
  277. });
  278. }
  279. },
  280. mounted: function() {
  281. this.user_id = getQuery('user_id');
  282. this.searchData.user_id = this.user_id;
  283. this.getList();
  284. // this.getTotalData();
  285. }
  286. });
  287. </script>
  288. <style>
  289. .table-body {
  290. padding: 20px;
  291. background-color: #fff;
  292. }
  293. .input-item {
  294. display: inline-block;
  295. width: 250px;
  296. margin: 0 0 20px 20px;
  297. }
  298. .input-item .el-input__inner:hover {
  299. border: 1px solid #dcdfe6;
  300. border-right: 0;
  301. outline: 0;
  302. }
  303. .input-item .el-input__inner:focus {
  304. border: 1px solid #dcdfe6;
  305. border-right: 0;
  306. outline: 0;
  307. }
  308. .input-item .el-input-group__append {
  309. background-color: #fff;
  310. border-left: 0;
  311. width: 10%;
  312. padding: 0;
  313. }
  314. /* .input-item .el-input-group__append .el-button {
  315. padding: 0;
  316. }
  317. .input-item .el-input-group__append .el-button {
  318. margin: 0;
  319. }
  320. .table-body .el-button {
  321. padding: 0 !important;
  322. border: 0;
  323. margin: 0 5px;
  324. } */
  325. .el-table th>.cell {
  326. color: #333;
  327. font-weight: bold;
  328. font-size: 14px;
  329. }
  330. .el-table__footer-wrapper,
  331. .el-table__header-wrapper {
  332. border-bottom: 1.4px solid #D6D6D6;
  333. }
  334. .stat_details {
  335. padding-bottom: 30px;
  336. display: flex;
  337. }
  338. .order_module {
  339. flex: 1;
  340. background: #F2F2F2;
  341. margin: 0 5px;
  342. padding: 20px 25px;
  343. }
  344. .order_module:last-child {
  345. margin-right: 0;
  346. }
  347. .order_module:first-child {
  348. margin-left: 0;
  349. }
  350. .price {
  351. font-size: 22px;
  352. font-weight: bold;
  353. }
  354. .oirder_modul_title {
  355. font-size: 12px;
  356. margin-bottom: 10px;
  357. display: flex;
  358. align-items: center;
  359. }
  360. .oirder_modul_title .text {
  361. margin-right: 10px;
  362. }
  363. .stat_icon {
  364. font-size: 19px;
  365. color: #BFBFBF;
  366. }
  367. </style>