index.php 14 KB

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