price-log.php 17 KB

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