balance-log.php 17 KB

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