index.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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. <!-- <div class="input-item">
  80. <el-input @keyup.enter.native="search" size="small" placeholder="请输入会员id" v-model="searchData.user_id" clearable >
  81. </el-input>
  82. </div> -->
  83. <div class="input-item">
  84. <div flex>
  85. <div flex="cross:center" class="input-search">
  86. <div class="input-item-name">结算期数:</div>
  87. <div>
  88. <el-input placeholder="请输入结算期数" v-model="searchData.num_text" size="small"></el-input>
  89. </div>
  90. </div>
  91. <div flex="cross:center" class="input-search" style='margin-left:10px;'>
  92. <div class="input-item-name"> 创建日期:</div>
  93. <div>
  94. <el-date-picker style="margin-top: 1px;"
  95. @change="changeTime"
  96. v-model="datetime"
  97. type="datetimerange"
  98. value-format="yyyy-MM-dd HH:mm:ss"
  99. range-separator="至"
  100. start-placeholder="开始日期"
  101. end-placeholder="结束日期"
  102. size="small"
  103. :default-time="['00:00:00', '23:59:59']">
  104. </el-date-picker>
  105. </div>
  106. </div>
  107. <div flex="cross:center" class="input-search" style='margin-left:10px;'>
  108. <div class="input-item-name">结算状态:</div>
  109. <div>
  110. <el-select v-model="searchData.status" placeholder="请选择" size="small">
  111. <el-option
  112. v-for="(item,index) in statusArr"
  113. :key="index"
  114. :label="item"
  115. :value="index">
  116. </el-option>
  117. </el-select>
  118. </div>
  119. </div>
  120. <div style="margin-left:30px;margin-top: 0px;">
  121. <el-button type="primary" size="small" @click="search">搜索</el-button>
  122. <el-button type="warning" @click="clereSearch" v-if="searchData.num_text || searchData.status || searchData.start || searchData.end" style="padding: 9px 15px !important;">清除搜索条件</el-button>
  123. </div>
  124. </div>
  125. </div>
  126. <el-table :data="form" stripe style="width: 100%" v-loading="listLoading" @selection-change="scFormTab" @sort-change="HandleSortChange">
  127. <el-table-column type="selection" width="50"></el-table-column>
  128. <!-- <el-table-column label="ID" prop="id" align="center" width="50"></el-table-column> -->
  129. <el-table-column label="期数" prop="num" align="center" sortable="custom" ></el-table-column>
  130. <el-table-column label="业务类型" prop="settle_method" align="center" >
  131. <template slot-scope="scope">
  132. <div>{{scope.row.settle_method==0?'积分占比分配':'权重占比分配'}}</div>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="分红用户数" prop="bonus_num" align="center" sortable="custom"></el-table-column>
  136. <el-table-column label="结算金额" prop="settle_price" align="center" sortable="custom"></el-table-column>
  137. <el-table-column label="周期分红池总额" prop="bonus_price" align="center" sortable="custom"></el-table-column>
  138. <el-table-column label="总权重" prop="total_weight" align="center" sortable="custom"></el-table-column>
  139. <el-table-column label="周期总积分" prop="total_score" align="center" sortable="custom"></el-table-column>
  140. <el-table-column label="结算状态" prop="status" align="center">
  141. <template slot-scope="scope">
  142. <el-tag effect="plain" type="success" v-if="scope.row.status==1">成功</el-tag>
  143. <el-tag effect="plain" type="danger" v-if="scope.row.status==0">失败</el-tag>
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="结算时间" prop="created_at" align="center" sortable="custom">
  147. <template slot-scope="scope">
  148. {{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="结算周期" prop="bonus_circle" align="center" >
  152. <template slot-scope="scope">
  153. {{ bonusCircleData[scope.row.bonus_circle] }}
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="操作" align="center">
  157. <template slot-scope="scope">
  158. <el-button type="text" @click="handle('check',scope.row)">查看</el-button>
  159. <!-- <el-button type="text" @click="handle('delete',scope.row)">删除</el-button> -->
  160. </template>
  161. </el-table-column>
  162. </el-table>
  163. <!--工具条 批量操作和分页-->
  164. <el-col :span="24" class="toolbar">
  165. <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>
  166. <el-pagination
  167. background
  168. layout="prev, pager, next"
  169. @current-change="pageChange"
  170. :page-size="pageSize"
  171. :current-page="currentPage"
  172. :total="pagination.totalCount"
  173. style="float:right;margin-top:15px; margin-bottom: 50px;"
  174. v-if="pagination">
  175. </el-pagination>
  176. </el-col>
  177. </div>
  178. </el-card>
  179. </div>
  180. <script>
  181. const app = new Vue({
  182. el: '#app',
  183. data() {
  184. return {
  185. searchData: {
  186. start: null,
  187. end: null,
  188. num_text: null,
  189. status: null,
  190. orderBy: null,
  191. id_str: '',
  192. },
  193. datetime: [],
  194. export_url: 'score-bonus/default/index',
  195. exportList:{},
  196. statusArr:{
  197. 0: '失败',
  198. 1: '成功',
  199. },
  200. form: [],
  201. bonusCircleData:{},
  202. selFormArr: [],
  203. page:1,
  204. pagination: null,
  205. listLoading: false,
  206. orderTotalArr: [
  207. {
  208. type: 'bonus_price',
  209. name: '本期分红池总额',
  210. value: '0.00',
  211. prompt: '分红池金额:营业额*N%=分红池金额',
  212. },{
  213. type: 'total_score',
  214. name: '当前总积分额',
  215. value: '0.00',
  216. prompt: '平台总积分',
  217. },
  218. // {
  219. // type: 'settled_commission_total',
  220. // name: '已结算佣金',
  221. // value: '0.00',
  222. // prompt: '所有会员已结算的佣金',
  223. // },
  224. {
  225. type: 'total_bonus_price',
  226. name: '已结算分红总额',
  227. value: '0.00',
  228. prompt: '基于当前已结算的金额',
  229. }
  230. ],
  231. pageSize: 20,
  232. };
  233. },
  234. methods: {
  235. scFormTab(sel){
  236. // console.info(sel);
  237. if(sel.length == this.form.length){
  238. this.checkedAll = true;
  239. }else {
  240. this.checkedAll = false;
  241. }
  242. this.selFormArr = sel;
  243. let id_str = '';
  244. this.selFormArr.forEach(v => {
  245. if (this.searchData.id_str === '') {
  246. this.searchData.id_str = v.id;
  247. } else {
  248. this.searchData.id_str = this.searchData.id_str + "," + v.id;
  249. }
  250. })
  251. // console.log(this.searchData.id_str);
  252. },
  253. // exportConfirm() {
  254. // this.search.status = this.status
  255. // },
  256. pageChange(currentPage) {
  257. this.page = currentPage;
  258. this.getList();
  259. },
  260. search() {
  261. this.page = 1;
  262. this.getList();
  263. },
  264. clereSearch() {
  265. this.searchData.start = null;
  266. this.searchData.end = null;
  267. this.searchData.status = null;
  268. this.searchData.num_text = null;
  269. this.datetime = [];
  270. this.getList();
  271. },
  272. changeTime(e) {
  273. // console.log(e)
  274. this.searchData.start = e[0]
  275. this.searchData.end = e[1]
  276. },
  277. pageSearch(){
  278. this.page_count = 1;
  279. this.getList();
  280. },
  281. getList() {
  282. let params = {
  283. r: 'score-bonus/default/index',
  284. page: this.page,
  285. num_text: this.searchData.num_text,
  286. status: this.searchData.status,
  287. start: this.searchData.start,
  288. end: this.searchData.end,
  289. orderBy: this.searchData.orderBy,
  290. };
  291. request({
  292. params,
  293. }).then(e => {
  294. if (e.data.code === 0) {
  295. this.pageSize = e.data.data.page_size;
  296. this.form = e.data.data.list;
  297. // this.searchData.date = e.data.data.date;
  298. this.pagination = e.data.data.pagination;
  299. if(this.page_count !=1) this.pageCount = e.data.data.page_count;
  300. this.currentPage = parseInt(this.page);
  301. this.bonusCircleData = e.data.data.bonus_circle;
  302. this.exportList = e.data.data.export_list;
  303. // this.searchData.date = e.data.data.date;
  304. for (const key in e.data.data.statistics_data) {
  305. let info = this.orderTotalArr.filter(v => v.type == key); //订单概况
  306. if(info.length){
  307. let index = this.orderTotalArr.findIndex(v => v.type==info[0].type);
  308. this.orderTotalArr[index].value = Number(e.data.data.statistics_data[key]).toFixed(2);
  309. }
  310. }
  311. } else {
  312. this.$message.error(e.data.msg);
  313. }
  314. this.listLoading = false;
  315. }).catch(e => {
  316. this.listLoading = false;
  317. });
  318. this.listLoading = true;
  319. },
  320. HandleSortChange({ column, prop, order }){
  321. console.log(`排序属性: ${prop}, 排序方向: ${order}`);
  322. let orderBy = '';
  323. switch (order) {
  324. case 'ascending':
  325. orderBy = prop + " asc";
  326. break;
  327. case 'descending':
  328. orderBy = prop + " desc";
  329. break;
  330. }
  331. this.searchData.orderBy = orderBy;
  332. this.getList();
  333. },
  334. exportData(){
  335. let self = this;
  336. self.listLoading = true;
  337. request({
  338. params: {
  339. r: 'score-bonus/default/index',
  340. num_text: this.searchData.num_text,
  341. status: this.searchData.status,
  342. start: this.searchData.start,
  343. end: this.searchData.end,
  344. orderBy: this.searchData.orderBy,
  345. flag: 'EXPORT'
  346. },
  347. }).then(e => {
  348. // console.log(e);return null;
  349. if (e.data.code == 0) {
  350. this.$message.success(e.data.msg);
  351. } else {
  352. this.$message.error(e.data.msg);
  353. }
  354. self.listLoading = false;
  355. }).catch(e => {
  356. self.listLoading = false;
  357. });
  358. },
  359. handle(type, data = null) {
  360. let id = data ? parseInt(data.id) : '';
  361. let params = {};
  362. switch (type) {
  363. case 'check':
  364. params = {
  365. r: 'score-bonus/default/user-settle-data'
  366. };
  367. if (id) params = Object.assign(params, {
  368. id: id
  369. });
  370. navigateTo(params);
  371. break;
  372. }
  373. },
  374. },
  375. mounted: function() {
  376. this.getList();
  377. }
  378. });
  379. </script>
  380. <style>
  381. .table-body {
  382. padding: 20px;
  383. background-color: #fff;
  384. }
  385. /* .input-item {
  386. display: inline-block;
  387. width: 250px;
  388. margin: 0 0 20px 20px;
  389. } */
  390. .input-item .el-input__inner:hover{
  391. border: 1px solid #dcdfe6;
  392. border-right: 0;
  393. outline: 0;
  394. }
  395. .input-item .el-input__inner:focus{
  396. border: 1px solid #dcdfe6;
  397. border-right: 0;
  398. outline: 0;
  399. }
  400. .input-item .el-input-group__append {
  401. background-color: #fff;
  402. border-left: 0;
  403. width: 10%;
  404. padding: 0;
  405. }
  406. /* .input-item .el-input-group__append .el-button {
  407. padding: 0;
  408. }
  409. .input-item .el-input-group__append .el-button {
  410. margin: 0;
  411. }
  412. .table-body .el-button {
  413. padding: 0!important;
  414. border: 0;
  415. margin: 0 5px;
  416. } */
  417. .el-table th>.cell{
  418. color: #333;
  419. font-weight: bold;
  420. font-size: 14px;
  421. }
  422. .el-table__footer-wrapper, .el-table__header-wrapper{
  423. border-bottom: 1.4px solid #D6D6D6;
  424. }
  425. .statistical ul {
  426. float: left;
  427. }
  428. .statistical ul li.ul-li {
  429. width: 33%;
  430. float: left;
  431. list-style-type :none;
  432. padding-bottom: 10px;
  433. }
  434. .stat_details{
  435. /* padding-bottom: 30px; */
  436. padding-top: 20px;
  437. display: flex;
  438. }
  439. .order_module{
  440. flex: 1;
  441. background: #F2F2F2;
  442. margin: 0 5px;
  443. padding: 20px 25px;
  444. }
  445. .order_module:last-child{
  446. margin-right: 0;
  447. }
  448. .order_module:first-child{
  449. margin-left: 0;
  450. }
  451. .price{
  452. font-size: 22px;
  453. font-weight: bold;
  454. }
  455. .oirder_modul_title{
  456. font-size: 12px;
  457. margin-bottom: 10px;
  458. display: flex;
  459. align-items: center;
  460. }
  461. .oirder_modul_title .text{
  462. margin-right: 10px;
  463. }
  464. .stat_icon{
  465. font-size: 19px;
  466. color: #BFBFBF;
  467. }
  468. .tag-diff{
  469. display: inline-block;
  470. background-color: rgba(112, 182, 3, 1);
  471. color: #fff;
  472. border-radius: 42px;
  473. line-height: 22px;
  474. height: 22px;
  475. padding: 0 6px;
  476. }
  477. </style>