index.php 12 KB

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