detail.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <style>
  2. </style>
  3. <div id="app" v-cloak>
  4. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  5. <div slot="header">
  6. <span>核销收益</span>
  7. </div>
  8. <div class="container">
  9. <template v-for="val in topData">
  10. <div class="item">
  11. <el-skeleton :rows="3" :animated="true" :loading="topDataLoading">
  12. <p class="num">{{val.value}}</p>
  13. <p class="title">{{val.text}}</p>
  14. </el-skeleton>
  15. </div>
  16. </template>
  17. </div>
  18. <div class="search-box">
  19. <!-- 搜索 -->
  20. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  21. <el-form-item label="使用时间">
  22. <el-date-picker size="small" v-model="searchForm.usage_time" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="使用者会员ID">
  26. <el-input placeholder="会员ID" v-model="searchForm.user_id"></el-input>
  27. </el-form-item>
  28. <el-form-item label="使用者会员昵称">
  29. <el-input placeholder="昵称/手机号" v-model="searchForm.user_name"></el-input>
  30. </el-form-item>
  31. <el-form-item label="核销员ID">
  32. <el-input placeholder="核销员ID" v-model="searchForm.clerk_user_id"></el-input>
  33. </el-form-item>
  34. <el-form-item label="核销员会员昵称">
  35. <el-input placeholder="昵称/手机号" v-model="searchForm.check_user_name"></el-input>
  36. </el-form-item>
  37. <el-form-item label="电子券名称">
  38. <el-input placeholder="请输入电子券名称" v-model="searchForm.e_coupon_name"></el-input>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="primary" @click="toSearch">搜索</el-button>
  42. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  43. </el-form-item>
  44. </el-form>
  45. </div>
  46. <div class="table-body">
  47. <el-tabs v-model="activeName">
  48. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  49. <el-table-column prop="id" min-width="30" label="ID" align="center"></el-table-column>
  50. <el-table-column label="会员">
  51. <template slot-scope="scope">
  52. <div class="user_img" flex="cross:center">
  53. <el-image class="default-avatar" :src="scope.row.user.avatar_url">
  54. <div slot="error" class="image-slot">
  55. <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
  56. </div>
  57. </el-image>
  58. <div class="uer-nickname over1" v-if="scope.row.user.nickname">{{scope.row.user.nickname}}</div>
  59. <div class="uer-nickname over1" v-else>ID:{{scope.row.user_id}}</div>
  60. </div>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="e_coupon_id" label="电子券ID" align="center"></el-table-column>
  64. <el-table-column prop="e_coupon_name" label="电子券名称" align="center"></el-table-column>
  65. <el-table-column prop="num" label="兑换数量" align="center"></el-table-column>
  66. <el-table-column label="电话" prop="mobile"></el-table-column>
  67. <el-table-column label="使用者" min-width="120">
  68. <template slot-scope="scope">
  69. <div style="display: flex;align-items: center;">
  70. <el-image fit="cover" :src="scope.row.user.avatar_url ? scope.row.user.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  71. <div>
  72. <div>{{scope.row.user.nickname}}</div>
  73. <div>ID {{scope.row.user.id}}</div>
  74. </div>
  75. </div>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="专有者" min-width="120">
  79. <template slot-scope="scope">
  80. <div style="display: flex;align-items: center;" v-if="scope.row.proper_user.id">
  81. <el-image fit="cover" :src="scope.row.proper_user.avatar_url ? scope.row.proper_user.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  82. <div>
  83. <div>{{scope.row.proper_user.nickname}}</div>
  84. <div>ID {{scope.row.proper_user.id}}</div>
  85. </div>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="核销员" min-width="120">
  90. <template slot-scope="scope">
  91. <div style="display: flex;align-items: center;" v-if="scope.row.clerk_user.id">
  92. <el-image fit="cover" :src="scope.row.clerk_user.avatar_url ? scope.row.clerk_user.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  93. <div>
  94. <div>{{scope.row.clerk_user.nickname}}</div>
  95. <div>ID {{scope.row.clerk_user.id}}</div>
  96. </div>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="核销金额" prop="amount"></el-table-column>
  101. <el-table-column label="核销收益" prop="income"></el-table-column>
  102. <el-table-column label="核销时间" align="center">
  103. <template slot-scope="scope">
  104. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </el-tabs>
  109. <div flex="box:last cross:center">
  110. <div></div>
  111. <div style="text-align: right;margin: 20px 0;">
  112. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  113. </div>
  114. </div>
  115. </div>
  116. </el-card>
  117. </div>
  118. <script>
  119. const app = new Vue({
  120. el: '#app',
  121. data: {
  122. searchForm: {
  123. user_id: '',
  124. user_name: '', //会员昵称/手机号
  125. store_id: 0,
  126. usage_time: '',
  127. e_coupon_name: null,
  128. check_user_name: null,
  129. clerk_user_id: '',
  130. },
  131. store_id: 0,
  132. list: [],
  133. pageCount: 0,
  134. edit_visible: false,
  135. loading: false,
  136. activeName: '-1',
  137. page: 1,
  138. topData: {
  139. total_time: {
  140. value: 0,
  141. text: "核销次数",
  142. },
  143. total_amount: {
  144. value: 0,
  145. text: "已核销金额",
  146. },
  147. total_income: {
  148. value: 0,
  149. text: "收益总额",
  150. },
  151. },
  152. topDataLoading: true,
  153. },
  154. computed: {
  155. show_clear_search_btn: function() {
  156. return this.searchForm.usage_time != null ||
  157. this.searchForm.user_id != null ||
  158. this.searchForm.check_user_name != null ||
  159. this.searchForm.user_name != null ||
  160. this.searchForm.e_coupon_name != null ||
  161. this.searchForm.clerk_user_id != null
  162. },
  163. },
  164. mounted() {
  165. this.loadData();
  166. },
  167. methods: {
  168. toSearch() { // 清空查询条件
  169. this.page = 1;
  170. this.loadData(this.searchForm);
  171. },
  172. pagination(currentPage) {
  173. let self = this;
  174. self.page = currentPage;
  175. self.loadData();
  176. },
  177. resetSearch() { // 清空查询条件
  178. this.searchForm.usage_time = ''
  179. this.searchForm.user_id = ''
  180. this.searchForm.check_user_name = ''
  181. this.searchForm.user_name = ''
  182. this.searchForm.e_coupon_name = ''
  183. this.searchForm.clerk_user_id = ''
  184. this.page = 1;
  185. this.loadData();
  186. },
  187. getTopData() {
  188. let params = {
  189. r: 'electron-coupon/store-log/get-top-data'
  190. };
  191. params = Object.assign(params, this.searchForm);
  192. request({
  193. params,
  194. }).then(e => {
  195. if (e.data.code === 0) {
  196. let topData = e.data.data;
  197. for (index in this.topData) {
  198. this.topData[index]['value'] = parseFloat(topData[index] ? topData[index] : 0)
  199. // this.topData[index]['value'] = this.topData[index]['value'].toLocaleString('zh-cn', {
  200. // minimumFractionDigits: 2,
  201. // maximumFractionDigits: 2,
  202. // })
  203. }
  204. } else {
  205. this.$message.error(e.data.msg);
  206. }
  207. this.topDataLoading = false;
  208. }).catch(e => {
  209. this.topDataLoading = false;
  210. });
  211. },
  212. loadData() {
  213. let self = this;
  214. self.loading = true;
  215. let basic_params = {
  216. page: self.page,
  217. };
  218. let params = Object.assign(basic_params, {});
  219. params = Object.assign(params, this.searchForm);
  220. request({
  221. params: {
  222. r: 'electron-coupon/store-log/detail'
  223. },
  224. method: 'post',
  225. data: params
  226. }).then(e => {
  227. this.loading = false;
  228. if (e.data.code == 0) {
  229. this.list = e.data.data.page_data.list;
  230. self.pageCount = e.data.data.page_data.page_count;
  231. self.getTopData();
  232. } else {
  233. this.$message.error(e.data.msg);
  234. }
  235. }).catch(e => {
  236. this.loading = false;
  237. });
  238. },
  239. pageChange(page) {
  240. this.page = page;
  241. this.loadData();
  242. },
  243. },
  244. created: function() {
  245. this.searchForm.store_id = getQuery('id');
  246. },
  247. });
  248. </script>
  249. <style>
  250. .el-tabs__header {
  251. font-size: 16px;
  252. }
  253. .table-body {
  254. padding: 20px;
  255. background-color: #fff;
  256. }
  257. .table-body .el-button {
  258. padding: 0 !important;
  259. border: 0;
  260. margin: 0 5px;
  261. }
  262. .input-item {
  263. width: 250px;
  264. margin: 0 0 20px;
  265. display: inline-block;
  266. }
  267. /*.input-item .el-input__inner {*/
  268. /* border-right: 0;*/
  269. /*}*/
  270. .input-item .el-input__inner:hover {
  271. border: 1px solid #dcdfe6;
  272. /*border-right: 0;*/
  273. outline: 0;
  274. }
  275. .input-item .el-input__inner:focus {
  276. border: 1px solid #dcdfe6;
  277. /*border-right: 0;*/
  278. outline: 0;
  279. }
  280. .input-item .el-input-group__append {
  281. background-color: #fff;
  282. border-left: 0;
  283. width: 10%;
  284. padding: 0;
  285. }
  286. .input-item .el-input-group__append .el-button {
  287. padding: 0;
  288. }
  289. .input-item .el-input-group__append .el-button {
  290. margin: 0;
  291. }
  292. .batch {
  293. margin: 0 0 20px;
  294. display: inline-block;
  295. }
  296. .batch .el-button {
  297. padding: 9px 15px !important;
  298. }
  299. .el-table th>.cell {
  300. color: #333;
  301. font-weight: bold;
  302. font-size: 14px;
  303. }
  304. .el-table__footer-wrapper,
  305. .el-table__header-wrapper {
  306. border-bottom: 1.4px solid #D6D6D6;
  307. }
  308. .el-table th>.cell {
  309. color: #333;
  310. font-weight: bold;
  311. font-size: 14px;
  312. }
  313. .table1 .el-table__footer-wrapper,
  314. .table1 .el-table__header-wrapper {
  315. border-bottom: 1.4px solid #D6D6D6;
  316. }
  317. .user_img {
  318. position: relative;
  319. margin-right: 8px;
  320. /* height: 50px;
  321. width: 50px; */
  322. }
  323. .default-avatar {
  324. width: 50px;
  325. height: 50px;
  326. border-radius: 50%;
  327. margin-right: 8px;
  328. }
  329. .uer-nickname {
  330. flex: 1;
  331. }
  332. .container {
  333. display: grid;
  334. text-align: center;
  335. grid-template-columns: repeat(auto-fill, minmax(33.333%, 1fr));
  336. padding: 5px 0;
  337. background-color: #fff;
  338. margin-bottom: 10px;
  339. }
  340. .container .item {
  341. background-color: #E3EFFA;
  342. margin: 10px;
  343. padding: 20px 0;
  344. border-radius: 3px;
  345. }
  346. .container .item .num {
  347. font-size: 22px;
  348. font-weight: bold;
  349. margin-bottom: 10px;
  350. }
  351. .container .item .title {
  352. font-size: 16px;
  353. font-weight: bold;
  354. }
  355. </style>