exchange-record.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. ?>
  3. <style>
  4. .table-body {
  5. padding: 20px;
  6. background-color: #fff;
  7. }
  8. .table-body .el-button {
  9. padding: 0 !important;
  10. border: 0;
  11. margin: 0 5px;
  12. }
  13. .input-item {
  14. width: 200px;
  15. margin: 0 0 20px;
  16. display: inline-block;
  17. }
  18. /*.input-item .el-input__inner {*/
  19. /* border-right: 0;*/
  20. /*}*/
  21. .input-item .el-input__inner:hover {
  22. border: 1px solid #dcdfe6;
  23. /*border-right: 0;*/
  24. outline: 0;
  25. }
  26. .input-item .el-input__inner:focus {
  27. border: 1px solid #dcdfe6;
  28. /*border-right: 0;*/
  29. outline: 0;
  30. }
  31. .input-item .el-input-group__append {
  32. background-color: #fff;
  33. border-left: 0;
  34. width: 10%;
  35. padding: 0;
  36. }
  37. .input-item .el-input-group__append .el-button {
  38. padding: 0;
  39. }
  40. .input-item .el-input-group__append .el-button {
  41. margin: 0;
  42. }
  43. </style>
  44. <div id="app" v-cloak>
  45. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  46. <div slot="header">
  47. <span>兑换记录</span>
  48. </div>
  49. <div class="table-body">
  50. <el-form :inline="true" :model="search" size="small" >
  51. <div class="input-item">
  52. <el-input size="small" placeholder="请输入商品名称" v-model="search.goods_name"></el-input>
  53. </div>
  54. <div class="input-item">
  55. <el-input size="small" placeholder="请输入会员ID" v-model="search.user_id"></el-input>
  56. </div>
  57. <el-date-picker size="small" placeholder="选择日期" v-model="search.date" type="month" value-format="yyyy-MM">
  58. </el-date-picker>
  59. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="send('search')">搜索</el-button>
  60. <el-button type="danger" size="small" style="padding: 9px 15px !important;"
  61. @click="send('clearSearch')" v-if="search.goods_name != '' || search.user_id != '' ">清除条件</el-button>
  62. </el-form>
  63. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  64. <el-table-column label="会员ID" prop="user_id" align="center"></el-table-column>
  65. <el-table-column align="left" label="会员" width="280">
  66. <template slot-scope="scope">
  67. <div class="table-info-img-text">
  68. <el-image class="table-info-img circle" :src="scope.row.avatar_url">
  69. <div slot="error" class="image-slot" >
  70. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  71. </div>
  72. </el-image>
  73. <div class="table-info-text">
  74. <!-- <div>{{scope.row.nickname}}</div>-->
  75. <div>
  76. <com-ellipsis :line=1 :text="scope.row.nickname"> </com-ellipsis>
  77. </div>
  78. <div>{{scope.row.mobile}}</div>
  79. </div>
  80. </div>
  81. </template>
  82. </el-table-column>
  83. <el-table-column align="left" label="商品" width="250">
  84. <template slot-scope="scope">
  85. <div class="table-info-img-text">
  86. <el-image class="table-info-img" :src="scope.row.pic_url">
  87. <div slot="error" class="image-slot">
  88. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  89. </div>
  90. </el-image>
  91. <div class="table-info-text" style="flex: 1">
  92. <div>
  93. <com-ellipsis :line=2 :text="scope.row.goods_name"> </com-ellipsis>
  94. </div>
  95. <div style="color: #ff2727">{{scope.row.exchange_price}}</div>
  96. </div>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="订单编号" prop="order_no" align="center"></el-table-column>
  101. <el-table-column label="兑换数量" prop="num" align="center"></el-table-column>
  102. <el-table-column label="创建时间" prop="created_at" align="center"></el-table-column>
  103. <el-table-column label="操作" width="300px" align="center">
  104. <template slot-scope="scope">
  105. <el-button size="small" type="text" @click="handle('orderDetail', scope.row.order_id)">订单详情</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <div flex="box:last cross:center">
  110. <div></div>
  111. <div>
  112. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  113. style="display: inline-block;float: right;" background @current-change="pageChange"
  114. layout="prev, pager, next" :total="pagination.totalCount">
  115. </el-pagination>
  116. </div>
  117. </div>
  118. </div>
  119. </el-card>
  120. </div>
  121. <script>
  122. const app = new Vue({
  123. el: '#app',
  124. data: {
  125. search: {
  126. goods_name: '',
  127. user_id: '',
  128. date: ''
  129. },
  130. loading: false,
  131. page: 1,
  132. pagination: null,
  133. list: []
  134. },
  135. mounted() {
  136. this.send('getData');
  137. },
  138. methods: {
  139. send(type) {
  140. switch (type) {
  141. case 'getData':
  142. this.loading = true;
  143. if (this.search.date) {
  144. let date = this.search.date.split('-');
  145. this.search.date = date[0] + '-' + date[1];
  146. }
  147. let params = Object.assign({r: 'score-mall/default/exchange-record', page: this.page}, this.search);
  148. request({
  149. params: params,
  150. method: 'get'
  151. }).then(e=>{
  152. this.loading = false;
  153. if (e.data.code == 0) {
  154. this.pagination = e.data.data.pagination;
  155. this.list = e.data.data.list;
  156. this.search.date = e.data.data.date;
  157. } else {
  158. this.$message.error(e.data.msg);
  159. }
  160. }).catch(e => {
  161. this.loading = false;
  162. self.$message.error(e.data.msg);
  163. });
  164. break;
  165. case 'search':
  166. this.page = 1;
  167. this.send('getData');
  168. break;
  169. case 'clearSearch':
  170. this.page = 1;
  171. this.search.goods_name = '';
  172. this.search.user_id = '';
  173. this.send('getData');
  174. break;
  175. }
  176. },
  177. handle(type, param1 = null, param2 = null) {
  178. switch (type){
  179. case 'orderDetail':
  180. let params = {
  181. r: 'mall/order/detail'
  182. };
  183. if (param1) params = Object.assign(params, {
  184. id: param1
  185. });
  186. navigateTo(params);
  187. }
  188. },
  189. pageChange(page) {
  190. this.page = page;
  191. this.send('getData');
  192. },
  193. }
  194. })
  195. </script>