score-log.php 16 KB

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