com-refund-setting-index.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php
  2. /**
  3. * @link:http://www.gdqijianshi.com/
  4. * copyright: Copyright (c) 2020 广东七件事集团
  5. * author: zal
  6. */
  7. ?>
  8. <style>
  9. .table-body {
  10. padding: 20px;
  11. background-color: #fff;
  12. }
  13. .input-item {
  14. width: 250px;
  15. margin: 0 0 20px;
  16. }
  17. .input-item .el-input__inner {
  18. border-right: 0;
  19. }
  20. .input-item .el-input__inner:hover{
  21. border: 1px solid #dcdfe6;
  22. border-right: 0;
  23. outline: 0;
  24. }
  25. .input-item .el-input__inner:focus{
  26. border: 1px solid #dcdfe6;
  27. border-right: 0;
  28. outline: 0;
  29. }
  30. .input-item .el-input-group__append {
  31. background-color: #fff;
  32. border-left: 0;
  33. width: 10%;
  34. padding: 0;
  35. }
  36. .input-item .el-input-group__append .el-button {
  37. padding: 0;
  38. }
  39. .el-input-group__append .el-button {
  40. margin: 0;
  41. }
  42. .table-body .el-button {
  43. padding: 0!important;
  44. border: 0;
  45. margin: 0 5px;
  46. }
  47. .el-card__body {
  48. padding: 10px !important;
  49. }
  50. .el-table th>.cell{
  51. color: #333;
  52. font-weight: bold;
  53. font-size: 14px;
  54. }
  55. .el-table__footer-wrapper, .el-table__header-wrapper{
  56. border-bottom: 1.4px solid #D6D6D6;
  57. }
  58. </style>
  59. <div id="com-refund-setting-index" v-cloak>
  60. <el-card shadow="never" style="border:0;margin-top: 10px;" body-style="background-color: #f3f3f3;">
  61. <div slot="header">
  62. <div>
  63. <span>地址列表</span>
  64. <div style="float: right;margin-top: -7px">
  65. <el-button type="primary" @click="edit" size="small">添加地址</el-button>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="table-body">
  70. <div class="input-item">
  71. <el-input @keyup.enter.native="search" size="small" placeholder="请输入收件人姓名或联系方式" v-model="keyword" clearable @clear="search">
  72. <el-button slot="append" @click="search" icon="el-icon-search"></el-button>
  73. </el-input>
  74. </div>
  75. <el-table
  76. v-loading="listLoading"
  77. :data="list"
  78. stripe
  79. style="width: 100%">
  80. <el-table-column
  81. prop="id"
  82. label="ID"
  83. min-width="100"
  84. align="center">
  85. </el-table-column>
  86. <el-table-column
  87. label="收件人姓名"
  88. min-width="120"
  89. align="center">
  90. <template slot-scope="scope">
  91. <com-ellipsis :line="1">{{scope.row.name}}</com-ellipsis>
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. label="联系方式"
  96. min-width="150"
  97. align="center">
  98. <template slot-scope="scope">
  99. <com-ellipsis :line="1">{{scope.row.mobile}}</com-ellipsis>
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. label="详细地址" min-width="400" align="center">
  104. <template slot-scope="scope">
  105. <com-ellipsis :line="2">{{scope.row.address}}</com-ellipsis>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. label="备注"
  110. align="center"
  111. min-width="200">
  112. <template slot-scope="scope">
  113. <com-ellipsis :line="2">{{scope.row.remark}}</com-ellipsis>
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. label="操作"
  118. min-width="200"
  119. align="center">
  120. <template slot-scope="scope">
  121. <el-button @click="edit(scope.row.id)" size="small" type="text" circle>
  122. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  123. <img src="statics/img/mall/edit.png" alt="">
  124. </el-tooltip>
  125. </el-button>
  126. <el-button @click="destroy(scope.row, scope.$index)" type="text" size="small" circle>
  127. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  128. <img src="statics/img/mall/del.png" alt="">
  129. </el-tooltip>
  130. </el-button>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. <div style="text-align: right;margin: 20px 0;">
  135. <el-pagination
  136. @current-change="pagination"
  137. background
  138. layout="prev, pager, next"
  139. :page-count="pageCount">
  140. </el-pagination>
  141. </div>
  142. </div>
  143. </el-card>
  144. </div>
  145. <script>
  146. Vue.component('com-refund-setting-index',{
  147. template: '#com-refund-setting-index',
  148. data() {
  149. return {
  150. list: [],
  151. listLoading: false,
  152. page: 1,
  153. keyword: null,
  154. pageCount: 0,
  155. };
  156. },
  157. methods: {
  158. search: function() {
  159. this.listLoading = true;
  160. let keyword = this.keyword;
  161. request({
  162. params: {
  163. r: 'mall/refund-setting/index',
  164. keyword: keyword
  165. },
  166. method: 'get'
  167. }).then(e => {
  168. this.listLoading = false;
  169. if (e.data.code === 0) {
  170. this.$message.success(e.data.msg);
  171. this.list = e.data.data.list;
  172. this.pageCount = e.data.data.pagination.page_count;
  173. }else{
  174. this.$alert(e.data.msg, '提示', {
  175. confirmButtonText: '确定'
  176. })
  177. }
  178. }).catch(e => {
  179. this.listLoading = false;
  180. this.$alert(e.data.msg, '提示', {
  181. confirmButtonText: '确定'
  182. })
  183. });
  184. },
  185. pagination(currentPage) {
  186. let self = this;
  187. self.page = currentPage;
  188. self.getList();
  189. },
  190. getList() {
  191. let self = this;
  192. self.listLoading = true;
  193. request({
  194. params: {
  195. r: 'mall/refund-setting/index',
  196. page: self.page
  197. },
  198. method: 'get',
  199. }).then(e => {
  200. self.listLoading = false;
  201. self.list = e.data.data.list;
  202. self.pageCount = e.data.data.pagination.page_count;
  203. }).catch(e => {
  204. console.log(e);
  205. });
  206. },
  207. edit(id) {
  208. if (id) {
  209. navigateTo({
  210. r: 'mall/refund-setting/edit',
  211. id: id,
  212. });
  213. } else {
  214. navigateTo({
  215. r: 'mall/refund-setting/edit',
  216. });
  217. }
  218. },
  219. destroy(row, index) {
  220. let self = this;
  221. self.$confirm('删除该地址, 是否继续?', '提示', {
  222. confirmButtonText: '确定',
  223. cancelButtonText: '取消',
  224. type: 'warning'
  225. }).then(() => {
  226. self.listLoading = true;
  227. request({
  228. params: {
  229. r: 'mall/refund-setting/delete',
  230. },
  231. method: 'post',
  232. data: {
  233. id: row.id,
  234. }
  235. }).then(e => {
  236. self.listLoading = false;
  237. if (e.data.code === 0) {
  238. self.$message.success(e.data.msg);
  239. self.list.splice(index, 1);
  240. } else {
  241. self.$message.error(e.data.msg);
  242. }
  243. }).catch(e => {
  244. console.log(e);
  245. });
  246. }).catch(() => {
  247. self.$message.info('已取消删除')
  248. });
  249. },
  250. },
  251. mounted: function () {
  252. // this.getList();
  253. }
  254. });
  255. </script>