child-list.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0;min-width: 1500px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <div flex="cross:center box:first">
  5. <div><span @click="$navigate({r:'members-card/default/list'})" class="text">亲友卡列表 </span>/子卡列表</div>
  6. </div>
  7. </div>
  8. <div class="table-body">
  9. <div class="input-item">
  10. <el-input @keyup.enter.native="loadData" size="small" placeholder="亲友卡名称" v-model="search.keyword"
  11. clearable @clear="toSearch">
  12. </el-input>
  13. </div>
  14. <div class="input-item">
  15. <el-input @keyup.enter.native="loadData" size="small" placeholder="会员信息" v-model="search.keyword2"
  16. clearable @clear="toSearch">
  17. </el-input>
  18. </div>
  19. <!-- <el-select size="small" v-model="search.type" @change='toSearch' class="select" placeholder="请选择">
  20. <el-option :key="item.value" :label="item.label" :value="item.value"
  21. v-for="(item, index) in incomeCapitalTypeList"></el-option>
  22. </el-select> -->
  23. <el-date-picker
  24. style="margin-right: 20px;"
  25. size="small"
  26. v-model="selectData"
  27. type="daterange"
  28. value-format="yyyy-MM-dd"
  29. range-separator="至"
  30. start-placeholder="开始日期"
  31. end-placeholder="结束日期">
  32. </el-date-picker>
  33. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="toSearch">搜索</el-button>
  34. <el-tabs v-model="activeName" @tab-click="handleClick">
  35. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;"
  36. @selection-change="handleSelectionChange">
  37. <el-table-column prop="id" label="编码" align="center"></el-table-column>
  38. <el-table-column prop="user_id" label="用户ID" align="center"></el-table-column>
  39. <el-table-column label="基本信息" >
  40. <template slot-scope="scope">
  41. <div class="user_img" flex="cross:center">
  42. <el-image class="default-avatar" :src="scope.row.avatar_url">
  43. <div slot="error" class="image-slot">
  44. <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
  45. </div>
  46. </el-image>
  47. <div class="uer-nickname over1" v-if="scope.row.nickname">{{scope.row.nickname}}</div>
  48. <div class="uer-nickname over1" v-else >ID:{{scope.row.user_id}}</div>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="卡的编号" prop="mobile" align="center" >
  53. <template slot-scope="scope">
  54. <div>{{scope.row.card_no}}</div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="名称" prop="mobile" align="center" >
  58. <template slot-scope="scope">
  59. <div>{{scope.row.name}}</div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="样式" prop="background_url" align="center" style="width: 50px;height: 50px;">
  63. <template slot-scope="scope">
  64. <div>
  65. <el-image :src="scope.row.background_url" :preview-src-list="[scope.row.background_url]">
  66. </el-image>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="折扣" prop="discount" align="center" >
  71. <template slot-scope="scope">
  72. <div>{{scope.row.discount}}</div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="领取时间" align="center">
  76. <template slot-scope="scope">
  77. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="过期时间" align="center">
  81. <template slot-scope="scope">
  82. {{scope.row.expired_at|dateTimeFormat('Y-m-d H:i:s')}}
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="是否已回收" align="center">
  86. <template slot-scope="scope">
  87. <div v-if="scope.row.is_recycle">是</div>
  88. <div v-else>否</div>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="回收时间" align="center">
  92. <template slot-scope="scope">
  93. {{scope.row.recycle_at|dateTimeFormat('Y-m-d H:i:s')}}
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="操作" min-width="150" align="center">
  97. <template slot-scope="scope">
  98. <el-button type="text" @click="edit(scope.row.id)">消费记录</el-button>
  99. <el-button v-if="!scope.row.is_recycle" type="text" @click="operate('destroy',scope.row)">回收亲友卡</el-button>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. </el-tabs>
  104. <div flex="box:last cross:center">
  105. <div></div>
  106. <div>
  107. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  108. style="display: inline-block;float: right;" background @current-change="pageChange"
  109. layout="prev, pager, next" :total="pagination.totalCount">
  110. </el-pagination>
  111. </div>
  112. </div>
  113. </div>
  114. </el-card>
  115. </div>
  116. <script>
  117. const app = new Vue({
  118. el: '#app',
  119. data: {
  120. avatar: '',
  121. nickname: '',
  122. search: {
  123. keyword: '',
  124. keyword2:'',
  125. page: 1,
  126. start:'',
  127. end:'',
  128. id:0,
  129. // type:'',
  130. },
  131. loading: false,
  132. activeName: '-1',
  133. list: [],
  134. pagination: null,
  135. dialogChild: false,
  136. dialogLoading: false,
  137. dialogContent: false,
  138. remarksForm: {
  139. remarks: '',
  140. user_id: '',
  141. id: '',
  142. },
  143. remarksLoading: false,
  144. exportList: {},
  145. userEdit: {
  146. show: false,
  147. },
  148. level: {
  149. show: false,
  150. agent: null,
  151. },
  152. commission_arr: {},
  153. agentLevelList: [],
  154. levelList: {},
  155. choose_list: [],
  156. sort: 0,
  157. sort_id: 0,
  158. incomeCapitalTypeList:[
  159. {
  160. value:1,
  161. label:'母卡',
  162. },
  163. {
  164. value:2,
  165. label:'子卡',
  166. },
  167. ],
  168. selectData:'',
  169. },
  170. mounted() {
  171. if (getQuery('id')) {
  172. this.search.id = getQuery('id');
  173. }
  174. this.loadData();
  175. },
  176. methods: {
  177. loadData() {
  178. this.loading = true;
  179. let params = {
  180. r: 'members-card/default/child-list'
  181. };
  182. params = Object.assign(params, this.search);
  183. request({
  184. params: params,
  185. method: 'get',
  186. }).then(e => {
  187. this.loading = false;
  188. if (e.data.code == 0) {
  189. this.list = e.data.data.list;
  190. this.pagination = e.data.data.pagination;
  191. } else {
  192. this.$message.error(e.data.msg);
  193. }
  194. }).catch(e => {
  195. this.loading = false;
  196. });
  197. },
  198. pageChange(page) {
  199. this.search.page = page;
  200. this.loadData();
  201. },
  202. handleClick(tab, event) {
  203. this.search.page = 1;
  204. this.search.status = this.activeName;
  205. this.loadData()
  206. },
  207. toSearch() {
  208. if(this.selectData && this.selectData[0]){
  209. this.search.start = this.selectData[0];
  210. this.search.end = this.selectData[1];
  211. }else{
  212. this.search.start = '';
  213. this.search.end = '';
  214. }
  215. this.search.page = 1;
  216. this.loadData();
  217. },
  218. switchFun(event,id){
  219. console.log(event);
  220. this.listLoading = true;
  221. request({
  222. params: {
  223. r: 'members-card/default/update-status'
  224. },
  225. method: 'post',
  226. data:{
  227. id:id,
  228. is_enable:event,
  229. }
  230. }).then(e => {
  231. this.listLoading = false;
  232. if (e.data.code == 0) {
  233. this.$message.success('更改状态成功');
  234. } else {
  235. this.$message.error(e.data.msg);
  236. }
  237. this.loadData();
  238. }).catch(e => {
  239. this.$message.error(e.data.msg);
  240. this.listLoading = false;
  241. this.loadData();
  242. });
  243. },
  244. // 跳转编辑页
  245. edit(id) {
  246. id = parseInt(id);
  247. let params = {
  248. r: 'members-card/default/used-list',
  249. };
  250. if (id) params = Object.assign(params, {
  251. id: id
  252. });
  253. navigateTo(params);
  254. },
  255. operate(type, data = null) {
  256. let param = { id: data.id, type: type };
  257. switch (type) {
  258. case 'destroy':
  259. this.$confirm('确认要回收该亲友卡, 是否继续?', '警告', {
  260. type: 'warning'
  261. }).then(() => {
  262. this.send(param)
  263. })
  264. break;
  265. }
  266. },
  267. send(params) {
  268. let self = this;
  269. request({
  270. params: {
  271. r: 'members-card/default/child-label',
  272. },
  273. method: 'post',
  274. data: params
  275. }).then(e => {
  276. if (e.data.code == 0) {
  277. self.$message.success(e.data.msg);
  278. self.loadData();
  279. } else {
  280. self.$message.error(e.data.msg);
  281. }
  282. }).catch(e => {
  283. console.log(e);
  284. });
  285. }
  286. }
  287. });
  288. </script>
  289. <style>
  290. .el-tabs__header {
  291. font-size: 16px;
  292. }
  293. .table-body {
  294. padding: 20px;
  295. background-color: #fff;
  296. }
  297. .table-body .el-button {
  298. padding: 0 !important;
  299. border: 0;
  300. margin: 0 5px;
  301. }
  302. .input-item {
  303. width: 250px;
  304. margin: 0 0 20px;
  305. display: inline-block;
  306. }
  307. /*.input-item .el-input__inner {*/
  308. /* border-right: 0;*/
  309. /*}*/
  310. .input-item .el-input__inner:hover {
  311. border: 1px solid #dcdfe6;
  312. /*border-right: 0;*/
  313. outline: 0;
  314. }
  315. .input-item .el-input__inner:focus {
  316. border: 1px solid #dcdfe6;
  317. /*border-right: 0;*/
  318. outline: 0;
  319. }
  320. .input-item .el-input-group__append {
  321. background-color: #fff;
  322. border-left: 0;
  323. width: 10%;
  324. padding: 0;
  325. }
  326. .input-item .el-input-group__append .el-button {
  327. padding: 0;
  328. }
  329. .input-item .el-input-group__append .el-button {
  330. margin: 0;
  331. }
  332. .batch {
  333. margin: 0 0 20px;
  334. display: inline-block;
  335. }
  336. .batch .el-button {
  337. padding: 9px 15px !important;
  338. }
  339. .el-table th>.cell{
  340. color: #333;
  341. font-weight: bold;
  342. font-size: 14px;
  343. }
  344. .el-table__footer-wrapper, .el-table__header-wrapper{
  345. border-bottom: 1.4px solid #D6D6D6;
  346. }
  347. .el-table th>.cell {
  348. color: #333;
  349. font-weight: bold;
  350. font-size: 14px;
  351. }
  352. .table1 .el-table__footer-wrapper,
  353. .table1 .el-table__header-wrapper {
  354. border-bottom: 1.4px solid #D6D6D6;
  355. }
  356. .user_img{
  357. position: relative;
  358. margin-right: 8px;
  359. /* height: 50px;
  360. width: 50px; */
  361. }
  362. .default-avatar{
  363. width: 50px;
  364. height: 50px;
  365. border-radius: 50%;
  366. margin-right: 8px;
  367. }
  368. .uer-nickname {
  369. flex: 1;
  370. }
  371. </style>