index.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 阿源
  5. * Date: 2020/11/26
  6. * Time: 11:06
  7. */
  8. ?>
  9. <div id="app" v-cloak>
  10. <!-- body-style="background-color: #f3f3f3;" shadow="never" style="border:0" -->
  11. <el-card shadow="never" style="border:0;background-color: #f3f3f3;padding:0">
  12. <div class="card_header">
  13. 海报列表
  14. </div>
  15. <div class="card_body">
  16. <el-form size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 12px;">
  17. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px; margin-left: 20px;">
  18. <div class="label">会员编号:</div>
  19. <el-input style="width: 150px" v-model="keywords.user_id" placeholder="会员编号"></el-input>
  20. </div>
  21. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
  22. <div class="label">会员名称:</div>
  23. <el-input style="width: 150px" v-model="keywords.nickname" placeholder="会员名称"></el-input>
  24. </div>
  25. <!-- <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">-->
  26. <!-- <div class="label">邀请码:</div>-->
  27. <!-- <el-input style="width: 150px" v-model="keywords.invite_code" placeholder="邀请码"></el-input>-->
  28. <!-- </div>-->
  29. <div class="item-box" flex="dir:left cross:center">
  30. <el-button type="primary" style="padding: 10px 20px !important;" @click="search">搜索
  31. </el-button>
  32. <el-button type="danger" size="small" style="padding: 10px 20px !important;" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  33. </div>
  34. </el-form>
  35. <div>
  36. <el-table :data="tableData" v-loading="listLoading" style="width: 100%">
  37. <el-table-column prop="user_id" label="ID" width="80" align="center"></el-table-column>
  38. <el-table-column label="会员" >
  39. <template slot-scope="scope">
  40. <div flex="box:first">
  41. <div style="padding-right: 10px;">
  42. <com-image mode="aspectFill" :src="scope.row.user.avatar_url"></com-image>
  43. </div><br>
  44. <div flex="cross:top cross:center">
  45. {{scope.row.user.nickname}}
  46. <br>
  47. {{scope.row.user.mobile}}
  48. </div>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <!-- <el-table-column prop="invite_code" label="邀请码" align="center"></el-table-column>-->
  53. <el-table-column prop="num" label="邀请用户数" align="center"></el-table-column>
  54. <el-table-column prop="created_at" label="创建时间" align="center"></el-table-column>
  55. <el-table-column prop="address" label="操作" fixed="right" align="center">
  56. <template slot-scope="scope">
  57. <div class="operation flex flex-x-center">
  58. <p @click="handle('edit',scope.row)">查看</p>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. </div>
  64. <!-- 分页 -->
  65. <div style="text-align: right;margin: 20px 0;">
  66. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  67. </div>
  68. </div>
  69. </el-card>
  70. </div>
  71. <script>
  72. new Vue({
  73. el: '#app',
  74. data() {
  75. return {
  76. listLoading: false,
  77. tableData: [],
  78. value: '',
  79. page: 1,
  80. cycle: '',
  81. total_count: 0,
  82. pageCount: 0,
  83. keywords: {
  84. user_id: '',
  85. nickname: '',
  86. invite_code: '',
  87. },
  88. }
  89. },
  90. created() {
  91. this.getList();
  92. },
  93. computed: {
  94. show_clear_search_btn: function() {
  95. return !isEmpty(this.keywords.user_id)
  96. || !isEmpty(this.keywords.nickname)
  97. || !isEmpty(this.keywords.invite_code)
  98. }
  99. },
  100. methods: {
  101. resetSearch(){
  102. this.keywords = {
  103. user_id:null,
  104. nickname:null,
  105. invite_code:null,
  106. };
  107. this.page = 1;
  108. this.getList();
  109. },
  110. changeDate() {
  111. this.page = 1;
  112. var params = {
  113. cycle: this.cycle
  114. }
  115. this.getList(params);
  116. },
  117. search() {// 清空查询条件
  118. this.page = 1;
  119. this.getList(this.keywords);
  120. },
  121. // search() {
  122. // this.page = 1;
  123. // var params = {
  124. // keyword: this.keywords
  125. // }
  126. // this.getList(params);
  127. // },
  128. pagination(currentPage) {
  129. let self = this;
  130. self.page = currentPage;
  131. self.getList();
  132. },
  133. // 获取海报列表
  134. getList(search = {}) {
  135. let self = this;
  136. self.listLoading = true;
  137. let basic_data = {
  138. page: self.page,
  139. };
  140. data = Object.assign(basic_data,search);
  141. request({
  142. params: {
  143. r: 'share-redpack/invate/index',
  144. },
  145. method: 'post',
  146. data: data
  147. }).then(e => {
  148. self.listLoading = false;
  149. if (e.data.code == 0) {
  150. this.tableData = e.data.data.list;
  151. this.tableData.forEach(item => {
  152. var dates = new Date(item.created_at * 1000);
  153. var y = dates.getFullYear(),
  154. m = dates.getMonth() + 1,
  155. d = dates.getDate(),
  156. h = dates.getHours(),
  157. mm = dates.getMinutes(),
  158. s = dates.getSeconds();
  159. item.created_at = y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + this.add0(h) + ':' + this.add0(mm) + ':' + this.add0(s)
  160. });
  161. self.pageCount = e.data.data.page_count;
  162. } else {
  163. self.$message.error(e.data.msg);
  164. }
  165. }).catch(e => {
  166. self.$message.error(e.data.msg);
  167. self.listLoading = false;
  168. });
  169. },
  170. handle(type, data = null, extra = null) {
  171. console.log(type);
  172. switch (type) {
  173. case 'edit':
  174. id = data ? parseInt(data.id) : '';
  175. params = {
  176. r: 'share-redpack/invate/edit'
  177. };
  178. if (id) params = Object.assign(params, {
  179. id: id
  180. });
  181. navigateTo(params);
  182. break;
  183. }
  184. },
  185. send(params, url) {
  186. console.log(url)
  187. let self = this;
  188. request({
  189. params: {
  190. r: url,
  191. },
  192. method: 'post',
  193. data: params
  194. }).then(e => {
  195. if (e.data.code == 0) {
  196. self.$message.success(e.data.msg);
  197. self.getList();
  198. } else {
  199. self.$message.error(e.data.msg);
  200. self.getList();
  201. }
  202. }).catch(e => {
  203. console.log(e);
  204. });
  205. },
  206. add0(val) {
  207. return val < 10 ? '0' + val : val;
  208. },
  209. }
  210. })
  211. </script>
  212. <style scoped>
  213. img {
  214. display: block;
  215. }
  216. .card_header {
  217. margin-bottom: 10px;
  218. background: #ffffff;
  219. padding: 24px;
  220. border-radius: 5px;
  221. }
  222. .card_body {
  223. border-radius: 5px;
  224. background: #ffffff;
  225. padding: 24px;
  226. }
  227. .select_height {
  228. height: 30px;
  229. line-height: 30px;
  230. }
  231. .preview_img {
  232. width: 30px;
  233. height: 54px;
  234. overflow: hidden;
  235. text-align: center;
  236. margin:auto;
  237. }
  238. .preview_img2 {
  239. width: 149px;
  240. height: 232px;
  241. overflow: hidden;
  242. }
  243. .operation {
  244. cursor: pointer;
  245. }
  246. /* 公共样式 */
  247. .flex {
  248. display: -webkit-box;
  249. display: -webkit-flex;
  250. /* #ifndef APP-NVUE */
  251. display: flex;
  252. /* #endif */
  253. }
  254. .flex-x-center {
  255. display: -webkit-box;
  256. display: -webkit-flex;
  257. /* #ifndef APP-NVUE */
  258. display: flex;
  259. /* #endif */
  260. -webkit-box-pack: center;
  261. -webkit-justify-content: center;
  262. -ms-flex-pack: center;
  263. justify-content: center;
  264. }
  265. .flex-x-between {
  266. display: -webkit-box;
  267. display: -webkit-flex;
  268. /* #ifndef APP-NVUE */
  269. display: flex;
  270. /* #endif */
  271. -webkit-box-pack: space-between;
  272. -webkit-justify-content: space-between;
  273. -ms-flex-pack: space-between;
  274. justify-content: space-between;
  275. }
  276. .flex-y-center {
  277. display: -webkit-box;
  278. display: -webkit-flex;
  279. /* #ifndef APP-NVUE */
  280. display: flex;
  281. /* #endif */
  282. -webkit-box-align: center;
  283. -webkit-align-items: center;
  284. -ms-flex-align: center;
  285. -ms-grid-row-align: center;
  286. align-items: center;
  287. }
  288. /* 溢出隐藏 */
  289. .over1 {
  290. text-overflow: -o-ellipsis-lastline;
  291. overflow: hidden;
  292. text-overflow: ellipsis;
  293. display: -webkit-box;
  294. -webkit-line-clamp: 1;
  295. -webkit-box-orient: vertical;
  296. }
  297. .over2 {
  298. text-overflow: -o-ellipsis-lastline;
  299. overflow: hidden;
  300. text-overflow: ellipsis;
  301. display: -webkit-box;
  302. -webkit-line-clamp: 2;
  303. -webkit-box-orient: vertical;
  304. }
  305. .el-card__body{
  306. padding: 0;
  307. }
  308. </style>