index.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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-07
  8. * Time: 16:22
  9. */
  10. use common\helpers\ComponentHelper;
  11. ComponentHelper::loadComponentView('com-export-dialog', '@backend/views/components/common');
  12. ?>
  13. <div id="app" v-cloak>
  14. <div class="order_stat">
  15. <div class="title">
  16. <span>会员资产</span>
  17. <com-export-dialog :field_list='exportList' :action_url="export_url" :params="searchData" @selected="exportConfirm"></com-export-dialog>
  18. </div>
  19. </div>
  20. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  21. <div class="table-body">
  22. <div class="input-item" v-if="!user_id">
  23. <el-input @keyup.enter.native="search" size="small" placeholder="请输入会员ID" v-model="searchData.user_id" clearable @clear="search">
  24. <el-button slot="append" @click="search"></el-button>
  25. </el-input>
  26. </div>
  27. <div class="input-item">
  28. <el-input @keyup.enter.native="search" size="small" placeholder="请输入昵称/手机号" v-model="searchData.keyword" clearable @clear="search">
  29. <el-button slot="append" @click="search"></el-button>
  30. </el-input>
  31. </div>
  32. <div class="input-item">
  33. <el-button type="primary" size="small" icon="el-icon-search" @click="search" class="search_button">搜索</el-button>
  34. </div>
  35. <el-table :data="form" stripe style="width: 100%" v-loading="listLoading">
  36. <el-table-column prop="id" label="ID" min-width="100" align="center"></el-table-column>
  37. <el-table-column label="用户信息" min-width="180">
  38. <template slot-scope="scope">
  39. <div class="table-info-img-text">
  40. <el-image class="table-info-img circle" :src="scope.row.avatar_url">
  41. <div slot="error" class="image-slot">
  42. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  43. </div>
  44. </el-image>
  45. <div class="table-info-text">
  46. <div class="over2" v-if="scope.row.nickname">{{scope.row.nickname}}</div>
  47. <div>{{scope.row.mobile}}</div>
  48. </div>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="scope" label="余额" min-width="200" align="left">
  53. <template slot-scope="scope">
  54. <div>当前余额:{{scope.row.balance}}</div>
  55. <div>累计余额:{{scope.row.total_balance}}</div>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="scope" label="积分" min-width="200" align="left">
  59. <template slot-scope="scope">
  60. <div>当前积分:{{scope.row.score}}</div>
  61. <div>累计积分:{{scope.row.total_score}}</div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="scope" label="佣金" min-width="200" align="left">
  65. <template slot-scope="scope">
  66. <div>当前佣金:{{scope.row.commission}}</div>
  67. <div>累计佣金:{{scope.row.total_commission}}</div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="scope" label="优惠券数量" min-width="100" align="center">
  71. <template slot-scope="scope">
  72. <div>优惠券总数:{{scope.row.coupon_count}}</div>
  73. <div>可使用总数:{{scope.row.can_coupon_count ?? 0}}</div>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. <!--工具条 批量操作和分页-->
  78. <el-col :span="24" class="toolbar">
  79. <el-pagination background layout="prev, pager, next" @current-change="pageChange" :page-count="pageCount" style="float:right;margin:15px" >
  80. </el-col>
  81. </div>
  82. </el-card>
  83. </div>
  84. <script>
  85. const app = new Vue({
  86. el: '#app',
  87. data() {
  88. return {
  89. searchData: {
  90. keyword: '',
  91. user_id: null,
  92. // date: '',
  93. // start_date: '',
  94. // end_at: '',
  95. },
  96. pageCount: 0,
  97. form: [],
  98. pagination: null,
  99. listLoading: false,
  100. pageSize: 10,
  101. user_id: null, // 外部链接传递进来的 user_id
  102. export_url: 'mall/finance/index',
  103. exportList:{},
  104. };
  105. },
  106. methods: {
  107. exportConfirm() {
  108. // this.searchData.keyword = this.keyword;
  109. // this.searchData.start_date = this.date[0];
  110. // this.searchData.end_date = this.date[1];
  111. },
  112. pageChange(currentPage) {
  113. this.page = currentPage;
  114. this.getList();
  115. },
  116. search() {
  117. this.page = 1;
  118. this.getList();
  119. },
  120. getList() {
  121. let user_id = this.user_id ? this.user_id : this.searchData.user_id;
  122. let params = {
  123. r: 'mall/finance/index',
  124. page: this.page,
  125. date: this.date,
  126. user_id: user_id,
  127. keyword: this.searchData.keyword,
  128. };
  129. if (this.searchData.date) {
  130. Object.assign(params, {
  131. start_time: this.searchData.date[0],
  132. end_time: this.searchData.date[1],
  133. });
  134. }
  135. request({
  136. params,
  137. }).then(e => {
  138. if (e.data.code === 0) {
  139. this.form = e.data.data.list;
  140. this.pagination = e.data.data.pagination;
  141. this.pageSize = e.data.data.page_size;
  142. this.pageCount = e.data.data.page_count;
  143. this.exportList = e.data.data.export_list;
  144. console.log(this.pageCount);
  145. } else {
  146. this.$message.error(e.data.msg);
  147. }
  148. this.listLoading = false;
  149. }).catch(e => {
  150. this.listLoading = false;
  151. });
  152. this.listLoading = true;
  153. },
  154. },
  155. mounted: function() {
  156. this.getList();
  157. },
  158. created: function() {
  159. this.user_id = getQuery('user_id');
  160. },
  161. });
  162. </script>
  163. <style>
  164. .table-body {
  165. padding: 20px;
  166. background-color: #fff;
  167. }
  168. .title{
  169. font-size: 18px;
  170. font-weight: bold;
  171. display: flex;
  172. align-items: center;
  173. height: 40px;
  174. display: flex;
  175. justify-content: space-between;
  176. }
  177. .order_stat > .title > .time{
  178. font-size: 13px;
  179. font-weight: 400;
  180. color: #BFBFBF;
  181. margin-left: 20px;
  182. flex: 1;
  183. }
  184. .input-item {
  185. display: inline-block;
  186. width: 250px;
  187. margin: 0 0 20px 20px;
  188. }
  189. .input-item .el-input__inner {
  190. border-right: 0;
  191. }
  192. .input-item .el-input__inner:hover {
  193. border: 1px solid #dcdfe6;
  194. border-right: 0;
  195. outline: 0;
  196. }
  197. .input-item .el-input__inner:focus {
  198. border: 1px solid #dcdfe6;
  199. border-right: 0;
  200. outline: 0;
  201. }
  202. .input-item .el-input-group__append {
  203. background-color: #fff;
  204. border-left: 0;
  205. width: 10%;
  206. padding: 0;
  207. }
  208. .input-item .el-input-group__append .el-button {
  209. padding: 0;
  210. }
  211. .input-item .el-input-group__append .el-button {
  212. margin: 0;
  213. }
  214. .table-body .el-button {
  215. padding: 0 !important;
  216. border: 0;
  217. margin: 0 5px;
  218. }
  219. .el-table th>.cell {
  220. color: #333;
  221. font-weight: bold;
  222. font-size: 14px;
  223. }
  224. .el-table__footer-wrapper,
  225. .el-table__header-wrapper {
  226. border-bottom: 1.4px solid #D6D6D6;
  227. }
  228. .search_button {
  229. /* margin-left: 108px; */
  230. margin-right: 10px;
  231. width: 80px;
  232. height: 33px;
  233. border-radius: 5px;
  234. }
  235. .default-avatar{
  236. width: 50px;
  237. height: 50px;
  238. border-radius: 50%;
  239. margin-right: 8px;
  240. }
  241. .uer-nickname {
  242. flex: 1;
  243. }
  244. .user_img{
  245. position: relative;
  246. margin-right: 8px;
  247. /* height: 50px;
  248. width: 50px; */
  249. }
  250. </style>