commission-log.php 15 KB

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