index.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <style>
  2. .header {
  3. padding: 18px 20px;
  4. background: #fff;
  5. margin-bottom: 10px;
  6. border-radius: 5px;
  7. border: 1px solid #EBEEF5;
  8. }
  9. .el-card {
  10. box-shadow: none !important;
  11. }
  12. .inquires_box {
  13. flex-wrap: wrap;
  14. }
  15. .condition {
  16. width: 450px;
  17. }
  18. .condition2 {
  19. margin-right: 30px;
  20. margin-bottom: 20px;
  21. }
  22. .operat_btn_list .el-button {
  23. padding: 8px 20px;
  24. }
  25. .table_box {
  26. margin-top: 30px;
  27. }
  28. .give_btn {
  29. border-radius: 5px;
  30. background: #fff;
  31. padding: 2px 0;
  32. border: 1px solid #DCDFE6;
  33. width: 80px;
  34. cursor: pointer;
  35. }
  36. .el-table .cell {
  37. display: flex;
  38. justify-content: center;
  39. }
  40. .operat1 {
  41. color: #3399FF;
  42. margin-right: 20px;
  43. cursor: pointer;
  44. }
  45. .operat2 {
  46. color: #FF336E;
  47. cursor: pointer;
  48. }
  49. .pagination_box {
  50. margin-top: 30px;
  51. justify-content: flex-end;
  52. }
  53. .types {
  54. cursor: pointer;
  55. }
  56. .coupon_type_list_box {
  57. flex-wrap: wrap;
  58. }
  59. .coupon_type_list {
  60. background: #F4F4F4;
  61. border-radius: 4px;
  62. padding: 8px 6px;
  63. width: 110px;
  64. margin-bottom: 15px;
  65. margin-right: 15px;
  66. }
  67. /* .coupon_type_list:last-child */
  68. .coupon_type_list_box :nth-child(5n) {
  69. margin-right: 0px;
  70. }
  71. .coupon_type_title {
  72. font-size: 16px;
  73. margin-bottom: 10px;
  74. }
  75. .coupon_type_content {
  76. font-size: 12px;
  77. margin-bottom: 4px;
  78. }
  79. .el-dialog__body {
  80. padding: 20px 20px 10px;
  81. }
  82. .date_item {
  83. margin-right: 20px;
  84. }
  85. .flex .el-date-editor--daterange.el-input__inner {
  86. width: 420px;
  87. }
  88. /* 公共样式 */
  89. .flex {
  90. display: -webkit-box;
  91. display: -webkit-flex;
  92. /* #ifndef APP-NVUE */
  93. display: flex;
  94. /* #endif */
  95. }
  96. .flex-x-center {
  97. display: -webkit-box;
  98. display: -webkit-flex;
  99. /* #ifndef APP-NVUE */
  100. display: flex;
  101. /* #endif */
  102. -webkit-box-pack: center;
  103. -webkit-justify-content: center;
  104. -ms-flex-pack: center;
  105. justify-content: center;
  106. }
  107. .flex-x-between {
  108. display: -webkit-box;
  109. display: -webkit-flex;
  110. /* #ifndef APP-NVUE */
  111. display: flex;
  112. /* #endif */
  113. -webkit-box-pack: space-between;
  114. -webkit-justify-content: space-between;
  115. -ms-flex-pack: space-between;
  116. justify-content: space-between;
  117. }
  118. .flex-y-center {
  119. display: -webkit-box;
  120. display: -webkit-flex;
  121. /* #ifndef APP-NVUE */
  122. display: flex;
  123. /* #endif */
  124. -webkit-box-align: center;
  125. -webkit-align-items: center;
  126. -ms-flex-align: center;
  127. -ms-grid-row-align: center;
  128. align-items: center;
  129. }
  130. /* 溢出隐藏 */
  131. .over1 {
  132. text-overflow: -o-ellipsis-lastline;
  133. overflow: hidden;
  134. text-overflow: ellipsis;
  135. display: -webkit-box;
  136. -webkit-line-clamp: 1;
  137. -webkit-box-orient: vertical;
  138. }
  139. .over2 {
  140. text-overflow: -o-ellipsis-lastline;
  141. overflow: hidden;
  142. text-overflow: ellipsis;
  143. display: -webkit-box;
  144. -webkit-line-clamp: 2;
  145. -webkit-box-orient: vertical;
  146. }
  147. .avatar_url img {
  148. border-radius: 50%;
  149. }
  150. </style>
  151. <div id='app' v-cloak>
  152. <div class="header">规则统计</div>
  153. <el-card v-loading='loading'>
  154. <!-- 搜索 -->
  155. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  156. <el-form-item label="用户ID">
  157. <el-input placeholder="请输入用户ID" v-model="searchForm.user_id"></el-input>
  158. </el-form-item>
  159. <el-form-item label="礼包类型">
  160. <el-select v-model="searchForm.gift_type" placeholder="请选择礼包类型">
  161. <el-option v-for="(name,index) in gift_type_arr" :label="name" :value="index" :key="index"></el-option>
  162. </el-select>
  163. </el-form-item>
  164. <el-form-item>
  165. <el-button type="primary" @click="search">搜索</el-button>
  166. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  167. </el-form-item>
  168. </el-form>
  169. <!-- 表格 -->
  170. <div class="table_box">
  171. <el-table :data="list" stripe style="width: 100%;font-size:13px">
  172. <el-table-column label="序号" width="80" align="center">
  173. <template slot-scope="scope">
  174. <div>{{ scope.row.id }}</div>
  175. </template>
  176. </el-table-column>
  177. <el-table-column prop="user_id" width="80" label="用户ID" align="center"></el-table-column>
  178. <el-table-column label="基本信息" align="center">
  179. <template slot-scope="scope">
  180. <com-image style="float: left;margin-right: 5px;" class="avatar_url" mode="aspectFill" :src="scope.row.user.avatar_url ? scope.row.user.avatar_url : '/resources/img/common/default-avatar.png'"></com-image>
  181. <div>{{scope.row.user.nickname}}<br/>{{scope.row.user.mobile}}</div>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="礼包类型" width="160" align="center">
  185. <template slot-scope="scope">
  186. <div>{{ gift_type_arr[scope.row.gift_type] }}</div>
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="优惠券" align="center">
  190. <template slot-scope="scope">
  191. <div v-if="scope.row.coupon_num == 0">数量:{{ scope.row.coupon_num }}</div>
  192. <el-tooltip v-else placement="top" effect="light">
  193. <div slot="content">
  194. <div v-for="(item, index) in scope.row.coupon">
  195. 券名:{{ item.title }},数量:{{ item.num }}
  196. </div>
  197. </div>
  198. <el-button type="text">数量:{{ scope.row.coupon_num }}</el-button>
  199. </el-tooltip>
  200. </template>
  201. </el-table-column>
  202. <el-table-column prop="score" label="积分" align="center"></el-table-column>
  203. <el-table-column prop="balance" label="余额" align="center"></el-table-column>
  204. <el-table-column label="发放时间" width="140" align="center">
  205. <template slot-scope="scope">
  206. <div>{{ scope.row.created_at | dateTimeFormat("Y-m-d H:i")}}</div>
  207. </template>
  208. </el-table-column>
  209. </el-table>
  210. </div>
  211. <!-- 分页 -->
  212. <div class="pagination_box flex">
  213. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  214. </div>
  215. </el-card>
  216. </div>
  217. <script>
  218. new Vue({
  219. el: '#app',
  220. data() {
  221. return {
  222. loading: false,
  223. gift_type_arr: {},
  224. list: [],
  225. page: 1,
  226. pageCount: 0,
  227. searchForm:{
  228. user_id:null,
  229. gift_type:null,
  230. },
  231. }
  232. },
  233. mounted() {
  234. this.getList();
  235. },
  236. computed: {
  237. show_clear_search_btn: function() {
  238. return !isEmpty(this.searchForm.user_id) ||
  239. !isEmpty(this.searchForm.gift_type);
  240. },
  241. },
  242. methods: {
  243. search() {// 清空查询条件
  244. this.page = 1;
  245. this.getList(this.searchForm);
  246. },
  247. resetSearch() {// 清空查询条件
  248. this.searchForm = {
  249. user_id: null,
  250. gift_type: null,
  251. };
  252. this.page = 1;
  253. this.getList();
  254. },
  255. pagination(currentPage) {
  256. let self = this;
  257. self.page = currentPage;
  258. self.getList();
  259. },
  260. getList(search = null) {
  261. let self = this;
  262. self.loading = true;
  263. let basic_params = {
  264. r: 'user-gift/grant-log/index',
  265. page: self.page,
  266. };
  267. var params = Object.assign(basic_params, search);
  268. request({
  269. params: params,
  270. method: 'get',
  271. }).then(e => {
  272. this.loading = false;
  273. if (e.data.code == 0) {
  274. self.list = e.data.data.list.list;
  275. if (self.list.length > 0) {
  276. self.list.forEach(function (item, index) {
  277. self.list[index].coupon = JSON.parse(item.coupon);
  278. });
  279. }
  280. self.gift_type_arr = e.data.data.gift_type_arr;
  281. self.pageCount = e.data.data.list.page_count;
  282. } else {
  283. this.$message.error(e.data.msg);
  284. }
  285. })
  286. },
  287. }
  288. })
  289. </script>