detail-list.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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_type" min-width="80" align="center">
  158. <template slot-scope="scope">
  159. <div size="small">{{scope.row.receive_type}}</div>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="操作" min-width="100" align="center">
  163. <template slot-scope="scope">
  164. <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.is_force_failure==0 && scope.row.is_use==0 && scope.row.giving_status!=2">
  165. 停止会员用券
  166. </el-button>
  167. <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">
  168. 查看订单
  169. </el-button>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. <div style="text-align: left;margin: 20px 0;" v-if="action_type=='force-failure' && list.length && coupon_id && status==1 && is_used_number == 0">
  174. <el-button type="info" size="small" @click="forceFailureAll()" style="padding: 9px 15px !important;">停止所有会员用券</el-button>
  175. </div>
  176. <el-col :span="24" class="toolbar">
  177. <el-pagination v-if="pagination" style="display: inline-block;float: right;" background @current-change="pageChange" layout="prev, pager, next" :page-count="pageCount">
  178. </el-pagination>
  179. </el-col>
  180. </div>
  181. </el-card>
  182. </div>
  183. <script>
  184. const app = new Vue({
  185. el: '#app',
  186. data() {
  187. return {
  188. search_data: {
  189. user_id: '',
  190. keyword: '',
  191. use_time: [],
  192. start_time: 0,
  193. end_time: 0,
  194. },
  195. list: [],
  196. listLoading: false,
  197. page: 1,
  198. pageCount: 0,
  199. btnLoading: false,
  200. action_type: 'force-failure',
  201. coupon_info: {
  202. content: '',
  203. name: '',
  204. use_time: '',
  205. status: '',
  206. },
  207. // 从优惠券列表点击进来带的 coupon_id
  208. coupon_id: null,
  209. status: null,
  210. is_used_number: 0,
  211. send_from_map:{},
  212. pageCount: 0,
  213. };
  214. },
  215. methods: {
  216. search() {
  217. this.page = 1;
  218. this.getList();
  219. },
  220. clereSearch() {
  221. this.search_data.user_id = '';
  222. this.search_data.keyword = '';
  223. this.search_data.use_time = [];
  224. this.search_data.start_time = 0;
  225. this.search_data.end_time = 0;
  226. this.search();
  227. },
  228. pagination(currentPage) {
  229. let self = this;
  230. self.page = currentPage;
  231. self.getList();
  232. },
  233. //分页
  234. pageChange(page) {
  235. this.page = page;
  236. this.getList();
  237. },
  238. select_date(date) {
  239. console.log(date);
  240. if (date) {
  241. this.search_data.start_time = parseInt(date[0] / 1000);
  242. this.search_data.end_time = parseInt(date[1] / 1000) + 86400;
  243. } else {
  244. this.search_data.start_time = 0;
  245. this.search_data.end_time = 0;
  246. }
  247. },
  248. getList() {
  249. let self = this;
  250. self.listLoading = true;
  251. request({
  252. params: {
  253. r: 'store/client/coupon/user-coupon-detail',
  254. coupon_id: self.coupon_id,
  255. status: self.status,
  256. user_id: self.search_data.user_id,
  257. keyword: self.search_data.keyword,
  258. start_time: self.search_data.start_time,
  259. end_time: self.search_data.end_time,
  260. page: this.page,
  261. // page_size: this.page_size
  262. },
  263. method: 'get'
  264. }).then(e => {
  265. // console.log(e);
  266. self.listLoading = false;
  267. if (e.data.code == 0) {
  268. self.list = e.data.data.list.list;
  269. self.send_from_map = e.data.data.send_from_map;
  270. self.coupon_info = e.data.data.coupon_info;
  271. self.pageCount = e.data.data.list.page_count;
  272. } else {
  273. self.$message.error(e.data.msg);
  274. }
  275. for (let i = 0; i < self.list.length; i++) {
  276. if (1 == self.list[i].is_use) self.is_used_number += 1;
  277. }
  278. }).catch(e => {
  279. console.log(e);
  280. self.listLoading = false;
  281. self.$message.error('网络错误');
  282. });
  283. },
  284. handleClick(index, action_type) {
  285. // console.log(index, action_type); return null;
  286. let user_id = this.list[index].user_id;
  287. let coupon_id = this.list[index].coupon_id;
  288. if (action_type == 'force-failure') {
  289. this.$confirm('此操作将强制禁用会员已领取的优惠券, 是否继续?', '提示', {
  290. confirmButtonText: '确定',
  291. cancelButtonText: '取消',
  292. type: 'warning'
  293. }).then(() => {
  294. this.listLoading = true;
  295. request({
  296. params: {
  297. r: 'store/client/coupon/force-failure',
  298. user_id: user_id,
  299. coupon_id: coupon_id,
  300. },
  301. method: 'get'
  302. }).then(e => {
  303. this.listLoading = false;
  304. if (e.data.code == 0) {
  305. this.list[index].is_force_failure = 1;
  306. this.$message.success(e.data.msg);
  307. } else {
  308. this.$message.error(e.data.msg);
  309. }
  310. }).catch(e => {
  311. this.listLoading = false;
  312. console.log(e);
  313. this.$message.error('网络错误');
  314. });
  315. }).catch(() => { });
  316. } else {
  317. navigateTo({
  318. r: 'store/client/order/index',
  319. user_id: user_id,
  320. order_id: this.list[index].order_id,
  321. });
  322. }
  323. },
  324. forceFailureAll(index) {
  325. let coupon_id = getQuery('coupon_id');
  326. let self = this;
  327. this.$confirm('此操作将强制禁用会员已领取的优惠券, 是否继续?', '提示', {
  328. confirmButtonText: '确定',
  329. cancelButtonText: '取消',
  330. type: 'warning'
  331. }).then(() => {
  332. this.listLoading = true;
  333. request({
  334. params: {
  335. r: 'store/client/coupon/force-failure-all',
  336. coupon_id: coupon_id,
  337. },
  338. method: 'get'
  339. }).then(e => {
  340. this.listLoading = false;
  341. if (e.data.code == 0) {
  342. this.$message.success(e.data.msg);
  343. let num = this.list.length;
  344. for (let i = 0; i < num; i++) {
  345. this.list[i].is_force_failure = 1;
  346. }
  347. } else {
  348. this.$message.error(e.data.msg);
  349. }
  350. }).catch(e => {
  351. this.listLoading = false;
  352. console.log(e);
  353. this.$message.error('网络错误');
  354. });
  355. }).catch(() => { });
  356. },
  357. },
  358. mounted: function() {
  359. let type = getQuery('status');
  360. // console.log(type);
  361. if (1 == type) {
  362. this.action_type = 'force-failure';
  363. } else {
  364. this.action_type = 'order-detail';
  365. }
  366. this.status = getQuery('status');
  367. this.coupon_id = getQuery('coupon_id');
  368. this.getList();
  369. }
  370. });
  371. </script>