index.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <?php
  2. /*
  3. * @Descripttion:
  4. * @copyright: Copyright (c) 2021 广东七件事集团
  5. * @Author: lun
  6. * @Date: 2021-12-28 23:01:04
  7. */
  8. ?>
  9. <style>
  10. .link_url {
  11. text-align: left;
  12. font-size: 14px;
  13. }
  14. .showqr .el-dialog__body {
  15. text-align: center;
  16. padding-bottom: 10px;
  17. }
  18. .el-dialog {
  19. min-width: 400px;
  20. }
  21. </style>
  22. <div id="app" v-cloak>
  23. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  24. <div slot="header">
  25. <span>发放统计</span>
  26. </div>
  27. <div class="search-box">
  28. <!-- 搜索 -->
  29. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  30. <el-form-item label="创建日期">
  31. <el-date-picker
  32. size="small"
  33. v-model="searchForm.create_time"
  34. type="datetimerange"
  35. value-format="yyyy-MM-dd HH:mm:ss"
  36. range-separator="至"
  37. start-placeholder="开始日期"
  38. end-placeholder="结束日期">
  39. </el-date-picker>
  40. </el-form-item>
  41. <el-form-item label="活动名称">
  42. <el-input placeholder="请输入活动名称" v-model="searchForm.name"></el-input>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="primary" @click="search">搜索</el-button>
  46. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  47. </el-form-item>
  48. </el-form>
  49. </div>
  50. <div class="table-body">
  51. <el-tabs>
  52. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  53. <el-table-column prop="id" min-width="30" label="ID" align="center"></el-table-column>
  54. <el-table-column label="名称" align="center">
  55. <template slot-scope="scope">
  56. {{ scope.row.rule.name }}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="对象类型" min-width="40" align="center">
  60. <template slot-scope="scope">
  61. <span v-if="scope.row.grant_object==1"> 全部会员</span>
  62. <span v-if="scope.row.grant_object==2">会员等级</span>
  63. <span v-if="scope.row.grant_object==3">会员标签</span>
  64. <span v-if="scope.row.grant_object==4">会员ID</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="use_time" label="发放内容" min-width="80" align="center">
  68. <template slot-scope="scope">
  69. <span @click="get_setting_data(scope.row)" style="cursor: pointer;">详情</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="发放次数" align="center">
  73. <template slot-scope="scope">
  74. {{ scope.row.send_times }}
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="use_time" label="创建时间" min-width="80" align="center">
  78. <template slot-scope="scope">
  79. {{ scope.row.created_at | dateTimeFormat('Y-m-d H:i') }}
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <div style="text-align: right;margin: 20px 0;">
  84. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  85. </div>
  86. </el-tabs>
  87. </div>
  88. </el-card>
  89. <!-- 弹框基本信息开始-->
  90. <el-dialog title="基本信息" width="30%" :visible.sync="setting_data"
  91. @close="setting_data = false" :modal-append-to-body="false">
  92. <el-form :model="addForm" ref="addForm" :inline="true" @submit.native.prevent label-width="300px">
  93. <el-form-item label="" style="width: 100%;margin-bottom:0px;" v-if="detail_one.rule">
  94. 活动名称:{{detail_one.rule.name}}
  95. </el-form-item>
  96. <el-form-item label="" style="width: 100%; margin-bottom:0px;" v-if=" detail_one.redpack_num">
  97. 红包充值:{{detail_one.redpack_num}}
  98. </el-form-item>
  99. <el-form-item label="" style="width: 100%; margin-bottom:0px;" v-if=" detail_one.score_num">
  100. 积分充值:{{detail_one.score_num}}
  101. </el-form-item>
  102. <el-form-item label="" style="width: 100%; margin-bottom:0px;" v-if=" detail_one.balance_num">
  103. 余额充值:{{detail_one.balance_num}}
  104. </el-form-item>
  105. <el-form-item label="" style="width: 100%; margin-bottom:0px;" v-if=" detail_one.coupon_num ">
  106. 优惠卷:{{detail_one.coupon_num}}张
  107. </el-form-item>
  108. <el-form-item label="" style="width: 100%; margin-bottom:0px;" v-if=" detail_one.e_coupon_num">
  109. 电子劵:{{detail_one.e_coupon_num}}张
  110. </el-form-item>
  111. </el-form>
  112. <span slot="footer" class="dialog-footer">
  113. <el-button @click="setting_data = false">取 消</el-button>
  114. </span>
  115. </el-dialog>
  116. <!-- 弹框基本信息结束-->
  117. </div>
  118. <script>
  119. const app = new Vue({
  120. el: '#app',
  121. data: {
  122. loading: false,
  123. btnLoading:false,
  124. delLoading: false,
  125. dialogAddgsVisible:false,
  126. setting_data:false,
  127. page: 1,
  128. active_id:'',
  129. detail_one:[],
  130. pageCount: 0,
  131. list: [],
  132. now_time: 0,
  133. searchForm:{
  134. name:null,
  135. type:null,
  136. goods_type:null,
  137. store_type:null,
  138. status:null,
  139. code:null,
  140. },
  141. addForm:{
  142. code:'',
  143. id:'',
  144. }
  145. },
  146. mounted() {
  147. if(getQuery('active_id')) this.active_id = getQuery('active_id');
  148. this.getList();
  149. },
  150. computed: {
  151. show_clear_search_btn: function() {
  152. return this.searchForm.name != null ||
  153. this.searchForm.type != null ||
  154. this.searchForm.goods_type != null ||
  155. this.searchForm.store_type != null ||
  156. this.searchForm.create_time != null ||
  157. this.searchForm.status != null ||
  158. this.searchForm.code != null;
  159. },
  160. },
  161. methods: {
  162. get_setting_data(row){
  163. this.detail_one = row;
  164. this.setting_data = true;
  165. },
  166. pagination(currentPage) {
  167. let self = this;
  168. self.page = currentPage;
  169. self.getList();
  170. },
  171. search() {// 清空查询条件
  172. this.page = 1;
  173. this.getList(this.searchForm);
  174. this.addForm.code = this.searchForm.code;
  175. },
  176. handle(type, data = null) {
  177. switch (type){
  178. case 'send':
  179. this.dialogAddgsVisible = true;
  180. this.addForm.id = data.id;
  181. break;
  182. case 'edit':
  183. navigateTo({r:"issue-coupons/default/edit",id:data.id},true);
  184. break;
  185. case 'delecte':
  186. var param = {id: data.id,status:-1};
  187. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send('issue-coupons/default/handle',param)})
  188. break;
  189. }
  190. },
  191. send(url, params, callback = null) {
  192. let self = this;
  193. request({
  194. params: {
  195. r: url,
  196. },
  197. method: 'post',
  198. data: params
  199. }).then(e => {
  200. if (e.data.code == 0) {
  201. self.$message.success(e.data.msg);
  202. self.getList();
  203. } else {
  204. self.$message.error(e.data.msg);
  205. }
  206. }).catch(e => {
  207. console.log(e);
  208. });
  209. if(callback) return e.data;
  210. },
  211. resetSearch() {// 清空查询条件
  212. this.searchForm = {
  213. name: null,
  214. type: null,
  215. goods_type: null,
  216. store_type: null,
  217. status: null,
  218. create_time:null,
  219. code:null,
  220. };
  221. this.page = 1;
  222. this.getList();
  223. },
  224. getList(search = {}) {
  225. let self = this;
  226. self.loading = true;
  227. let basic_params = {
  228. page: self.page,
  229. };
  230. params = Object.assign(basic_params, search);
  231. if(this.active_id) { params.active_id = this.active_id;}
  232. request({
  233. params: {
  234. r: 'issue-coupons/statistics/index'
  235. },
  236. method: 'post',
  237. data: params
  238. }).then(e => {
  239. this.loading = false;
  240. if (e.data.code == 0) {
  241. self.list = e.data.data.list;
  242. self.now_time = e.data.data.now_time;
  243. self.pageCount = e.data.data.page_count;
  244. } else {
  245. self.$message.error(e.data.msg);
  246. }
  247. }).catch(e => {
  248. self.loading = false;
  249. });
  250. }
  251. }
  252. });
  253. </script>
  254. <style>
  255. /*头像样式 start*/
  256. .default-avatar{
  257. width: 50px;
  258. height: 50px;
  259. border-radius: 50%;
  260. }
  261. .user_img{
  262. position: relative;
  263. margin-right: 8px;
  264. height: 50px;
  265. width: 50px;
  266. }
  267. .el-table_1_column_3 .cell { /*-2 表示在第二行*/
  268. display: flex;
  269. }
  270. /*头像样式 end*/
  271. .el-tabs__header {
  272. font-size: 16px;
  273. }
  274. .table-body {
  275. padding: 20px;
  276. background-color: #fff;
  277. }
  278. .table-body .el-button {
  279. padding: 0 !important;
  280. border: 0;
  281. margin: 0 5px;
  282. }
  283. .input-item {
  284. width: 250px;
  285. margin: 0 0 20px;
  286. display: inline-block;
  287. }
  288. .input-item .el-input__inner {
  289. border-right: 0;
  290. }
  291. .input-item .el-input__inner:hover {
  292. border: 1px solid #dcdfe6;
  293. border-right: 0;
  294. outline: 0;
  295. }
  296. .input-item .el-input__inner:focus {
  297. border: 1px solid #dcdfe6;
  298. border-right: 0;
  299. outline: 0;
  300. }
  301. .input-item .el-input-group__append {
  302. background-color: #fff;
  303. border-left: 0;
  304. width: 10%;
  305. padding: 0;
  306. }
  307. .input-item .el-input-group__append .el-button {
  308. padding: 0;
  309. }
  310. .input-item .el-input-group__append .el-button {
  311. margin: 0;
  312. }
  313. .batch {
  314. margin: 0 0 20px;
  315. display: inline-block;
  316. }
  317. .batch .el-button {
  318. padding: 9px 15px !important;
  319. }
  320. .el-table th>.cell{
  321. color: #333;
  322. font-weight: bold;
  323. font-size: 14px;
  324. }
  325. .el-table__footer-wrapper, .el-table__header-wrapper{
  326. border-bottom: 1.4px solid #D6D6D6;
  327. }
  328. .search-box {
  329. padding: 10px 0 0 10px;
  330. background-color: #fff;
  331. margin-bottom: 10px;
  332. }
  333. </style>