score-log.php 14 KB

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