commission-log.php 19 KB

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