index.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <style>
  2. .table-body {
  3. padding: 20px;
  4. background-color: #fff;
  5. }
  6. .input-item {
  7. display: inline-block;
  8. width: 250px;
  9. margin: 0 0 20px;
  10. }
  11. .input-item .el-input__inner {
  12. border-right: 0;
  13. }
  14. .input-item .el-input__inner:hover {
  15. border: 1px solid #dcdfe6;
  16. border-right: 0;
  17. outline: 0;
  18. }
  19. .input-item .el-input__inner:focus {
  20. border: 1px solid #dcdfe6;
  21. border-right: 0;
  22. outline: 0;
  23. }
  24. .input-item .el-input-group__append {
  25. background-color: #fff;
  26. border-left: 0;
  27. width: 10%;
  28. padding: 0;
  29. }
  30. .input-item .el-input-group__append .el-button {
  31. padding: 0;
  32. }
  33. .input-item .el-input-group__append .el-button {
  34. margin: 0;
  35. }
  36. .table-body .el-button {
  37. padding: 0 !important;
  38. border: 0;
  39. margin: 0 5px;
  40. }
  41. .el-table th > .cell {
  42. color: #333;
  43. font-weight: bold;
  44. font-size: 14px;
  45. }
  46. .el-table__footer-wrapper, .el-table__header-wrapper {
  47. border-bottom: 1.4px solid #D6D6D6;
  48. }
  49. .label {
  50. margin-right: 10px;
  51. }
  52. .default-goods{
  53. max-width: 50px;
  54. max-height: 50px;
  55. }
  56. .flex-x-between {
  57. display: -webkit-box;
  58. display: -webkit-flex;
  59. display: flex;
  60. -webkit-box-pack: space-between;
  61. -webkit-justify-content: space-between;
  62. -ms-flex-pack: space-between;
  63. justify-content: space-between;
  64. }
  65. .cont-title {
  66. font-size: 15px;
  67. padding-top: 20px;
  68. padding-bottom: 10px;
  69. font-weight: 700;
  70. }
  71. .cont-num {
  72. font-size: 14px;
  73. font-weight: 700;
  74. padding-bottom: 10px;
  75. }
  76. .center {
  77. text-align: center;
  78. }
  79. .el-dialog__header .el-dialog__title{
  80. font-size: 18px;
  81. }
  82. .el-dialog__wrapper .el-dialog__body{
  83. padding: 3px 20px;
  84. }
  85. /*头像样式 start*/
  86. .default-avatar{
  87. width: 50px;
  88. height: 50px;
  89. border-radius: 50%;
  90. }
  91. .user_img{
  92. position: relative;
  93. margin-right: 8px;
  94. height: 50px;
  95. width: 50px;
  96. }
  97. .el-table_1_column_2 .cell { /*-2 表示在第二行*/
  98. display: flex;
  99. }
  100. /*头像样式 end*/
  101. </style>
  102. <div id="app" v-cloak>
  103. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  104. <div slot="header">
  105. <div>
  106. <span>奖励明细</span>
  107. </div>
  108. </template>
  109. </div>
  110. <div class="table-body el-input--small">
  111. <el-form size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 12px;">
  112. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
  113. <div class="label">会员昵称</div>
  114. <el-input style="width: 200px" v-model="search.user_name" placeholder="会员昵称"></el-input>
  115. </div>
  116. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
  117. <div class="label">会员手机号码</div>
  118. <el-input style="width: 200px" v-model="search.mobile" placeholder="会员手机号码"></el-input>
  119. </div>
  120. <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px">
  121. <div class="label">会员ID</div>
  122. <el-input style="width: 200px" v-model="search.user_id" placeholder="会员ID"></el-input>
  123. </div>
  124. <div class="item-box" flex="dir:left cross:center">
  125. <div class="label">发布类型</div>
  126. <el-select v-model="search.note_type" @change='searchs' class="select" size="small">
  127. <el-option :key="0" label="全部" :value="0"></el-option>
  128. <el-option :key="1" label="文章" :value="1"></el-option>
  129. <el-option :key="2" label="视频" :value="2"></el-option>
  130. <el-option :key="3" label="广告" :value="3"></el-option>
  131. </el-select>
  132. </div>
  133. <div class="item-box" flex="dir:left cross:center">
  134. <div class="label">奖励来源</div>
  135. <el-select v-model="search.reward_source" @change='searchs' class="select" size="small">
  136. <el-option :key="0" label="全部" :value="0"></el-option>
  137. <el-option :key="1" label="阅读" :value="1"></el-option>
  138. <el-option :key="2" label="分享" :value="2"></el-option>
  139. </el-select>
  140. </div>
  141. <div class="item-box" flex="dir:left cross:center">
  142. <el-button type="primary" style="padding: 12px 34px !important;" @click="searchs">搜索
  143. </el-button>
  144. </div>
  145. </el-form>
  146. <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
  147. <el-table-column label="会员ID" min-width="80" align="center">
  148. <template slot-scope="scope">
  149. <p>{{scope.row.user_id}}</p>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="会员名称" width="180" >
  153. <template slot-scope="scope">
  154. <div class="user_img" v-if="scope.row.user_id>0">
  155. <el-image class="default-avatar" :src="scope.row.user.avatar_url">
  156. <div slot="error" class="image-slot">
  157. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  158. </div>
  159. </el-image>
  160. </div>
  161. <div class="user_img" v-else>
  162. <el-image class="default-avatar" :src="scope.row.user_avatar_url">
  163. <div slot="error" class="image-slot">
  164. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  165. </div>
  166. </el-image>
  167. </div>
  168. <div>
  169. <div style="color:#000;" v-if="scope.row.user_id>0">{{scope.row.user.nickname}}</div>
  170. <div style="color:#000;" v-else>{{scope.row.user_name}}</div>
  171. <div style="font-size: 13px;" v-if="scope.row.user_id>0">{{scope.row.user.mobile}}</div>
  172. </div>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="类型" min-width="80" align="center">
  176. <template slot-scope="scope">
  177. <p>{{scope.row.note_type_name}}</p>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="奖励来源" min-width="80" align="center">
  181. <template slot-scope="scope">
  182. <p>{{scope.row.reward_source_name}}</p>
  183. </template>
  184. </el-table-column>
  185. <el-table-column prop="scope" width="160" label="创建时间">
  186. <template slot-scope="scope">
  187. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="奖励" min-width="80" align="center">
  191. <template slot-scope="scope">
  192. <p>{{scope.row.reward_content}} </p>
  193. </template>
  194. </el-table-column>
  195. </el-table>
  196. <div style="text-align: right;margin: 20px 0;">
  197. <el-pagination v-if="pagination" :page-size="pagination.pageSize"
  198. style="display: inline-block;float: right;" background @current-change="pageChange"
  199. layout="prev, pager, next" :total="pagination.total_count">
  200. </el-pagination>
  201. </div>
  202. </div>
  203. </el-card>
  204. </div>
  205. <script>
  206. const app = new Vue({
  207. el: '#app',
  208. data() {
  209. return {
  210. listLoading: false,
  211. page: 1,
  212. pageCount: 0,
  213. //基础数据
  214. editBasisData: {
  215. materialTypeList: [],
  216. },
  217. //本地存时间,请求时不发送
  218. time: [],
  219. search: {
  220. keyword: '',
  221. user_id: '',
  222. title: '',
  223. user_name: '',
  224. note_type: '',
  225. reward_source: '',
  226. check_status: '1',
  227. date_start: null,
  228. date_end: null,
  229. },
  230. list: [],
  231. //弹框配置
  232. addForm: {
  233. id: '',
  234. name: '',
  235. },
  236. title: "",
  237. dialogFormVisible: false, //数据弹窗
  238. data_list: {
  239. source:{"type":1,"source": ['1','2']},
  240. },//数据
  241. goods_data:[],//详细数据
  242. dialogAddgsVisible: false,
  243. // 对话框显示与否
  244. dialogVisible: false,
  245. dataloading: false,
  246. pagination:null,
  247. };
  248. },
  249. methods: {
  250. searchs() {
  251. this.page = 1;
  252. this.getList();
  253. },
  254. pageChange(currentPage) {
  255. let self = this;
  256. self.page = currentPage;
  257. self.getList();
  258. },
  259. getList() {
  260. let self = this;
  261. self.listLoading = true;
  262. // 检查是否选择了搜索时间
  263. if (!self.time) {
  264. self.search.date_start = '';
  265. self.search.date_end = '';
  266. } else {
  267. self.search.date_start = self.time[0];
  268. self.search.date_end = self.time[1];
  269. }
  270. request({
  271. method: 'post',
  272. params: {
  273. r: 'operating-note/reward/index',
  274. },
  275. data: {
  276. page: self.page,
  277. // keyword: self.search.keyword,
  278. note_type: self.search.note_type,
  279. reward_source: self.search.reward_source,
  280. user_id: self.search.user_id,
  281. mobile: self.search.mobile,
  282. user_name: self.search.user_name,
  283. // check_status: self.search.check_status,
  284. // date_start: self.search.date_start,
  285. // date_end: self.search.date_end,
  286. // title: self.search.title,
  287. },
  288. }).then(e => {
  289. self.listLoading = false;
  290. self.list = e.data.data.list;
  291. this.pagination = e.data.data.pagination;
  292. this.pagination.pageSize = e.data.data.page_size;
  293. this.pagination.total_count = e.data.data.count;
  294. }).catch(e => {
  295. console.log(e);
  296. });
  297. },
  298. detail(data) {
  299. console.log(data);
  300. this.data_list = [];
  301. this.goods_data = [];
  302. this.dialogFormVisible = true;
  303. this.data_list = data;
  304. this.goods_data.push(data);
  305. },
  306. handle(type,data = null){
  307. switch (type) {
  308. case 'delete':// 删除
  309. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send({id: data.id,status:-1,type:'1'});})
  310. break;
  311. case 'enable':
  312. var status = 0;
  313. if(data.status=='0') status = 1;
  314. this.send({id: data.id,status: status,type:'1'});
  315. break;
  316. }
  317. },
  318. send(data){
  319. let self = this;
  320. self.listLoading = true;
  321. request({
  322. params: {
  323. r: 'xhs/default/edit',
  324. },
  325. method: 'post',
  326. data:data,
  327. }).then(e => {
  328. self.listLoading = false;
  329. if (e.data.code === 0) {
  330. self.$message.success(e.data.msg);
  331. } else {
  332. self.$message.error(e.data.msg);
  333. }
  334. self.getList();
  335. }).catch(e => {
  336. console.log(e);
  337. });
  338. },
  339. /**
  340. *关闭或取消模态框,清空值
  341. * @param
  342. */
  343. closeDialogAddgsVisible() {
  344. this.$refs.addForm.resetFields();//element封装的方法,清空模态框的值
  345. this.title = "" //初始化title的值
  346. this.addForm = {//初始化addForm中的值
  347. title: "",
  348. }
  349. },
  350. },
  351. mounted: function () {
  352. this.getList();
  353. }
  354. });
  355. </script>