index.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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="等级" width="160" align="center">
  190. <template slot-scope="scope">
  191. <div>{{ level_arr[scope.row.gift_type][scope.row.level] }}</div>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="优惠券" align="center">
  195. <template slot-scope="scope">
  196. <div v-if="scope.row.coupon_num == 0">数量:{{ scope.row.coupon_num }}</div>
  197. <el-tooltip v-else placement="top" effect="light">
  198. <div slot="content">
  199. <div v-for="(item, index) in scope.row.coupon">
  200. 券名:{{ item.title }},数量:{{ item.num }}
  201. </div>
  202. </div>
  203. <el-button type="text">数量:{{ scope.row.coupon_num }}</el-button>
  204. </el-tooltip>
  205. </template>
  206. </el-table-column>
  207. <el-table-column prop="score" label="积分" align="center"></el-table-column>
  208. <el-table-column prop="balance" label="余额" align="center"></el-table-column>
  209. <el-table-column label="商品" align="center">
  210. <template slot-scope="scope">
  211. <template v-if="scope.row.goods_name">
  212. 商品:{{ scope.row.goods_name }}
  213. </template>
  214. <br>
  215. <template v-if="scope.row.attr_name">
  216. 规格:{{ scope.row.attr_name }}
  217. </template>
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="发放时间" width="140" align="center">
  221. <template slot-scope="scope">
  222. <div>{{ scope.row.created_at | dateTimeFormat("Y-m-d H:i")}}</div>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. </div>
  227. <!-- 分页 -->
  228. <div class="pagination_box flex">
  229. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  230. </div>
  231. </el-card>
  232. </div>
  233. <script>
  234. new Vue({
  235. el: '#app',
  236. data() {
  237. return {
  238. loading: false,
  239. gift_type_arr: {},
  240. level_arr: [],
  241. list: [],
  242. page: 1,
  243. pageCount: 0,
  244. searchForm:{
  245. user_id:null,
  246. title:null,
  247. gift_type:null,
  248. },
  249. }
  250. },
  251. mounted() {
  252. this.getList();
  253. },
  254. computed: {
  255. show_clear_search_btn: function() {
  256. return !isEmpty(this.searchForm.user_id) ||
  257. !isEmpty(this.searchForm.gift_type);
  258. },
  259. },
  260. methods: {
  261. search() {// 清空查询条件
  262. this.page = 1;
  263. this.getList(this.searchForm);
  264. },
  265. resetSearch() {// 清空查询条件
  266. this.searchForm = {
  267. user_id: null,
  268. gift_type: null,
  269. };
  270. this.page = 1;
  271. this.getList();
  272. },
  273. pagination(currentPage) {
  274. let self = this;
  275. self.page = currentPage;
  276. self.getList();
  277. },
  278. getList(search = null) {
  279. let self = this;
  280. self.loading = true;
  281. let basic_params = {
  282. r: 'upgrade-gift/grant-log/index',
  283. page: self.page,
  284. };
  285. var params = Object.assign(basic_params, search);
  286. request({
  287. params: params,
  288. method: 'get',
  289. }).then(e => {
  290. this.loading = false;
  291. if (e.data.code == 0) {
  292. self.list = e.data.data.list.list;
  293. if (self.list.length > 0) {
  294. self.list.forEach(function (item, index) {
  295. self.list[index].coupon = JSON.parse(item.coupon);
  296. });
  297. }
  298. self.gift_type_arr = e.data.data.gift_type_arr;
  299. self.level_arr = e.data.data.level_arr;
  300. self.pageCount = e.data.data.list.page_count;
  301. } else {
  302. this.$message.error(e.data.msg);
  303. }
  304. })
  305. },
  306. }
  307. })
  308. </script>