detail-list.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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. .form-body {
  42. background-color: #fff;
  43. margin-bottom: 20px;
  44. }
  45. .el-tabs__header {
  46. background-color: #fff;
  47. }
  48. .el-tabs__item {
  49. width: 100px;
  50. text-align: center;
  51. }
  52. .el-table th>.cell {
  53. color: #333;
  54. font-weight: bold;
  55. font-size: 14px;
  56. }
  57. .el-table__footer-wrapper,
  58. .el-table__header-wrapper {
  59. border-bottom: 1.4px solid #D6D6D6;
  60. }
  61. .flex {
  62. display: flex;
  63. align-items: center;
  64. }
  65. .flex-y-center {
  66. display: -webkit-box;
  67. display: -webkit-flex;
  68. display: flex;
  69. -webkit-box-align: center;
  70. -webkit-align-items: center;
  71. -ms-flex-align: center;
  72. -ms-grid-row-align: center;
  73. align-items: center;
  74. }
  75. .coupon-info{
  76. padding: 12px 22px;
  77. background: #F8F8F8;
  78. }
  79. .coupon-info-text{
  80. color: #333;
  81. font-size: 16px;
  82. flex-direction: column;
  83. }
  84. .coupon-info-type{
  85. border: 1px solid #FF2222;
  86. padding: 2px 4px;
  87. color: #FF2222;
  88. }
  89. </style>
  90. <div id="app" v-cloak>
  91. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  92. <div class="coupon-info" flex>
  93. <el-image style="width: 76px; height: 76px;margin-right: 17px;" src="resources/img/plugins/coupon/coupon-2.png"></el-image>
  94. <div class="coupon-info-text" flex>
  95. <div style="margin-bottom: 4px;">
  96. <span>券名称 {{coupon_info.name}}</span>
  97. <span class="coupon-info-type">{{coupon_info.status_text}}</span>
  98. </div>
  99. <div style="flex: 1;color: #585858;">{{coupon_info.content}}</div>
  100. <div style="font-size: 16px;">
  101. <span class="data-info-name">使用时间:</span>
  102. <span v-if="coupon_info.expire_type==2">{{coupon_info.use_time}}</span>
  103. <span v-else-if="coupon_info.expire_type==1">领取后{{coupon_info.expire_day}}天过期</span>
  104. <span v-else-if="coupon_info.expire_type==3">领取后{{coupon_info.effect_days}}天生效,有效期{{coupon_info.expire_day}}天</span>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="table-body">
  109. <div class="flex">
  110. <div class="flex" style="margin-right: 30px;">
  111. <div class="input-title">会员ID</div>
  112. <el-input style="width: 180px;margin-left: 10px;" size="small" placeholder="请输入会员ID" prefix-icon="el-icon-search" v-model="search_data.user_id"> </el-input>
  113. </div>
  114. <div class="flex" style="margin-right: 30px;">
  115. <div class="input-title">会员</div>
  116. <el-input style="width: 180px;margin-left: 10px;" size="small" placeholder="请输入会员昵称/手机号" prefix-icon="el-icon-search" v-model="search_data.keyword"> </el-input>
  117. </div>
  118. <div class="flex" style="margin: 0 45px;">
  119. <div class="input-title" style="margin-right: 10px;">使用时间</div>
  120. <el-date-picker size="small" v-model="search_data.use_time" type="daterange" size="large" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="timestamp" @change="select_date">
  121. </el-date-picker>
  122. </div>
  123. <div class="flex">
  124. <el-button type="primary" @click="search" style="padding: 9px 15px !important;">搜索</el-button>
  125. <el-button type="warning" @click="clereSearch" v-if="search_data.user_id || search_data.keyword || search_data.use_time.length" style="padding: 9px 15px !important;">清除搜索条件</el-button>
  126. </div>
  127. </div>
  128. <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
  129. <el-table-column label="会员ID" prop="user_id" min-width="80" align="center">
  130. <template slot-scope="scope">
  131. <div size="small">{{scope.row.user_id}}</div>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="会员名称" prop="nickname" min-width="80" align="center">
  135. <template slot-scope="scope">
  136. <div size="small" class="flex-y-center">
  137. <com-image width='50px' height='50px' :src=scope.row.avatar_url style="border-radius: 50%"></com-image>
  138. <span style="padding-left: 10px;">{{scope.row.nickname}}</span>
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="券名称" prop="name" min-width="80" align="center">
  143. <template slot-scope="scope">
  144. <div size="small">{{scope.row.name}}</div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="领取时间" prop="use_time" min-width="80" align="center">
  148. <template slot-scope="scope">
  149. <div size="small">{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="使用时间" prop="use_time" min-width="80" align="center">
  153. <template slot-scope="scope">
  154. <div size="small">{{scope.row.begin_at|dateTimeFormat('Y-m-d H:i:s')}}至{{scope.row.end_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  155. </template>
  156. </el-table-column>
  157. <!-- <el-table-column label="渠道来源" prop="receive_platform" min-width="80" align="center">
  158. <template slot-scope="scope">
  159. <div size="small">{{scope.row.receive_platform}}</div>
  160. </template>
  161. </el-table-column> -->
  162. <el-table-column label="领取来源" prop="receive_type" min-width="80" align="center">
  163. <template slot-scope="scope">
  164. <div size="small">{{scope.row.receive_type}}</div>
  165. </template>
  166. </el-table-column>
  167. <el-table-column label="操作" min-width="100" align="center">
  168. <template slot-scope="scope">
  169. <el-button type="text" size="mini" @click="handleClick(scope.$index, action_type)" style="width:56px;height: 24px;" v-if="action_type=='force-failure' && scope.row.coupon_status==2 && scope.row.is_force_failure==0 && scope.row.is_use==0 && scope.row.giving_status!=2">
  170. 停止会员用券
  171. <!-- <el-tooltip class="item" effect="dark" content="action_type_text" placement="top">
  172. <img src="statics/img/mall/nopass.png" alt="">
  173. </el-tooltip> -->
  174. </el-button>
  175. <el-button type="text" size="mini" @click="handleClick(scope.$index, action_type)" style="width:56px;height: 24px;" v-if="action_type=='order-detail' && scope.row.is_use==1">
  176. 查看订单
  177. <!-- <el-tooltip class="item" effect="dark" content="action_type_text" placement="top">
  178. <img src="statics/img/mall/nopass.png" alt="">
  179. </el-tooltip> -->
  180. </el-button>
  181. </template>
  182. </el-table-column>
  183. </el-table>
  184. <div style="text-align: left;margin: 20px 0;" v-if="action_type=='force-failure' && list.length && coupon_id && status==1 && is_used_number == 0">
  185. <el-button type="info" size="small" @click="forceFailureAll()" style="padding: 9px 15px !important;">停止所有会员用券</el-button>
  186. </div>
  187. <el-col :span="24" class="toolbar">
  188. <el-pagination v-if="pagination" style="display: inline-block;float: right;" background @current-change="pageChange" layout="prev, pager, next" :page-count="pageCount">
  189. </el-pagination>
  190. </el-col>
  191. </div>
  192. </el-card>
  193. <!-- 添加弹窗 -->
  194. <!-- <el-dialog title="删除分类" :visible.sync="dialogContent">
  195. <el-form :model="lableForm">
  196. <el-form-item label="标签名称">
  197. <el-input type="text" v-model="lableForm.name" :maxlength="6" autocomplete="off"></el-input>
  198. </el-form-item>
  199. <el-form-item label="是否推荐" prop="is_check">
  200. <el-switch v-model="lableForm.is_recommend" :active-value="2" :inactive-value="1"></el-switch>
  201. </el-form-item>
  202. </el-form>
  203. <div slot="footer" class="dialog-footer">
  204. <el-button>取 消</el-button>
  205. <el-button type="primary" :loading="lableLoading">确 定</el-button>
  206. </div>
  207. </el-dialog> -->
  208. </div>
  209. <script>
  210. const app = new Vue({
  211. el: '#app',
  212. data() {
  213. return {
  214. search_data: {
  215. user_id: '',
  216. keyword: '',
  217. use_time: [],
  218. start_time: 0,
  219. end_time: 0,
  220. },
  221. list: [],
  222. listLoading: false,
  223. page: 1,
  224. pageCount: 0,
  225. btnLoading: false,
  226. action_type: 'force-failure',
  227. coupon_info: {
  228. content: '',
  229. name: '',
  230. use_time: '',
  231. status: '',
  232. },
  233. // 从优惠券列表点击进来带的 coupon_id
  234. coupon_id: null,
  235. status: null,
  236. is_used_number: 0,
  237. send_from_map:{},
  238. pageCount: 0,
  239. coupon_store_id:null,
  240. };
  241. },
  242. methods: {
  243. search() {
  244. this.page = 1;
  245. this.getList();
  246. },
  247. clereSearch() {
  248. this.search_data.user_id = '';
  249. this.search_data.keyword = '';
  250. this.search_data.use_time = [];
  251. this.search_data.start_time = 0;
  252. this.search_data.end_time = 0;
  253. this.search();
  254. },
  255. pagination(currentPage) {
  256. let self = this;
  257. self.page = currentPage;
  258. self.getList();
  259. },
  260. //分页
  261. pageChange(page) {
  262. this.page = page;
  263. this.getList();
  264. },
  265. select_date(date) {
  266. console.log(date);
  267. if (date) {
  268. this.search_data.start_time = parseInt(date[0] / 1000);
  269. this.search_data.end_time = parseInt(date[1] / 1000) + 86400;
  270. } else {
  271. this.search_data.start_time = 0;
  272. this.search_data.end_time = 0;
  273. }
  274. },
  275. getList() {
  276. let self = this;
  277. self.listLoading = true;
  278. request({
  279. params: {
  280. r: 'coupon/user-coupon/user-coupon-detail',
  281. coupon_id: self.coupon_id,
  282. status: self.status,
  283. user_id: self.search_data.user_id,
  284. keyword: self.search_data.keyword,
  285. start_time: self.search_data.start_time,
  286. end_time: self.search_data.end_time,
  287. page: this.page,
  288. // page_size: this.page_size
  289. },
  290. method: 'get'
  291. }).then(e => {
  292. // console.log(e);
  293. self.listLoading = false;
  294. if (e.data.code == 0) {
  295. self.list = e.data.data.list.list;
  296. self.send_from_map = e.data.data.send_from_map;
  297. self.coupon_info = e.data.data.coupon_info;
  298. self.pageCount = e.data.data.list.page_count;
  299. self.coupon_store_id = e.data.data.coupon_info.store_id;
  300. } else {
  301. self.$message.error(e.data.msg);
  302. }
  303. self.is_used_number = 0;
  304. for (let i = 0; i < self.list.length; i++) {
  305. if (1 == self.list[i].is_use) self.is_used_number += 1;
  306. }
  307. }).catch(e => {
  308. console.log(e);
  309. self.listLoading = false;
  310. self.$message.error('网络错误');
  311. });
  312. },
  313. handleClick(index, action_type) {
  314. // console.log(index, action_type); return null;
  315. let user_id = this.list[index].user_id;
  316. let coupon_id = this.list[index].coupon_id;
  317. if (action_type == 'force-failure') {
  318. this.$confirm('此操作将强制禁用会员已领取的优惠券, 是否继续?', '提示', {
  319. confirmButtonText: '确定',
  320. cancelButtonText: '取消',
  321. type: 'warning'
  322. }).then(() => {
  323. this.listLoading = true;
  324. request({
  325. params: {
  326. r: 'coupon/user-coupon/force-failure',
  327. user_id: user_id,
  328. coupon_id: coupon_id,
  329. },
  330. method: 'get'
  331. }).then(e => {
  332. this.listLoading = false;
  333. if (e.data.code == 0) {
  334. this.list[index].is_force_failure = 1;
  335. this.$message.success(e.data.msg);
  336. } else {
  337. this.$message.error(e.data.msg);
  338. }
  339. }).catch(e => {
  340. this.listLoading = false;
  341. console.log(e);
  342. this.$message.error('网络错误');
  343. });
  344. }).catch(() => { });
  345. } else {
  346. if (!this.coupon_store_id) {
  347. navigateTo({
  348. r: 'mall/order/index',
  349. user_id: user_id,
  350. order_id: this.list[index].order_id,
  351. });
  352. } else {
  353. navigateTo({
  354. r: 'store/store-order/index',
  355. user_id: user_id,
  356. order_id: this.list[index].order_id,
  357. });
  358. }
  359. }
  360. },
  361. forceFailureAll(index) {
  362. let coupon_id = getQuery('coupon_id');
  363. let self = this;
  364. this.$confirm('此操作将强制禁用会员已领取的优惠券, 是否继续?', '提示', {
  365. confirmButtonText: '确定',
  366. cancelButtonText: '取消',
  367. type: 'warning'
  368. }).then(() => {
  369. this.listLoading = true;
  370. request({
  371. params: {
  372. r: 'coupon/user-coupon/force-failure-all',
  373. coupon_id: coupon_id,
  374. },
  375. method: 'get'
  376. }).then(e => {
  377. this.listLoading = false;
  378. if (e.data.code == 0) {
  379. this.$message.success(e.data.msg);
  380. let num = this.list.length;
  381. for (let i = 0; i < num; i++) {
  382. this.list[i].is_force_failure = 1;
  383. }
  384. } else {
  385. this.$message.error(e.data.msg);
  386. }
  387. }).catch(e => {
  388. this.listLoading = false;
  389. console.log(e);
  390. this.$message.error('网络错误');
  391. });
  392. }).catch(() => { });
  393. },
  394. },
  395. mounted: function() {
  396. let type = getQuery('status');
  397. // console.log(type);
  398. if (1 == type) {
  399. this.action_type = 'force-failure';
  400. } else {
  401. this.action_type = 'order-detail';
  402. }
  403. this.status = getQuery('status');
  404. this.coupon_id = getQuery('coupon_id');
  405. this.getList();
  406. }
  407. });
  408. </script>