index.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <style>
  2. .link_url {
  3. text-align: left;
  4. font-size: 14px;
  5. }
  6. .showqr .el-dialog__body {
  7. text-align: center;
  8. padding-bottom: 10px;
  9. }
  10. .el-dialog {
  11. min-width: 400px;
  12. }
  13. </style>
  14. <div id="app" v-cloak>
  15. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  16. <div slot="header">
  17. <span>招商员列表</span>
  18. <!-- <div style="float: right;margin-top: -5px;margin-left: 15px;">-->
  19. <!-- <el-button type="primary"-->
  20. <!-- @click=""-->
  21. <!-- size="small">导出-->
  22. <!-- </el-button>-->
  23. <!-- </div>-->
  24. <div style="float: right;margin-top: -5px">
  25. <el-button type="primary"
  26. @click="$navigate({r: 'business-bonus/default/edit'})"
  27. size="small">新增招商员
  28. </el-button>
  29. </div>
  30. </div>
  31. <div class="search-box">
  32. <!-- 搜索 -->
  33. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  34. <el-form-item label="会员ID">
  35. <el-input placeholder="会员ID" v-model="searchForm.user_id"></el-input>
  36. </el-form-item>
  37. <el-form-item label="会员昵称">
  38. <el-input placeholder="昵称/手机号" v-model="searchForm.nickname"></el-input>
  39. </el-form-item>
  40. <el-form-item label="等级">
  41. <el-select v-model="searchForm.business_bonus_level" placeholder="请选择等级">
  42. <el-option v-for="(item, index) in level_list" :label="item.level_name" :value="item.level" :key="index"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="成为招商员时间">
  46. <el-date-picker
  47. size="small"
  48. v-model="searchForm.created_at"
  49. type="datetimerange"
  50. value-format="yyyy-MM-dd HH:mm:ss"
  51. range-separator="至"
  52. start-placeholder="开始日期"
  53. end-placeholder="结束日期">
  54. </el-date-picker>
  55. </el-form-item>
  56. <el-form-item label="状态">
  57. <el-select v-model="searchForm.status" placeholder="请选择状态">
  58. <el-option v-for="(item, index) in status_option" :label="item.name" :value="item.index" :key="index"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item>
  62. <el-button type="primary" @click="search">搜索</el-button>
  63. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  64. </el-form-item>
  65. </el-form>
  66. </div>
  67. <div class="table-body">
  68. <el-tabs>
  69. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  70. <el-table-column prop="id" label="序号" align="center"></el-table-column>
  71. <el-table-column
  72. label="会员"
  73. min-width="120">
  74. <template slot-scope="scope" v-if="scope.row.user">
  75. <div style="display: flex;align-items: center;">
  76. <el-image fit="cover" :src="scope.row.user.avatar_url ? scope.row.user.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  77. <div>
  78. <div>{{scope.row.user.nickname}}</div>
  79. <div>ID {{scope.row.user.id}}</div>
  80. </div>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="手机号码" align="center">
  85. <template slot-scope="scope">
  86. {{scope.row.user.mobile}}
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="level_info.level_name" label="招商员等级" align="center"></el-table-column>
  90. <el-table-column label="分红比例(%)" align="center">
  91. <template slot-scope="scope" v-if="scope.row.level_info">
  92. {{ scope.row.level_info.bonus_rate}}
  93. </template>
  94. </el-table-column>
  95. <el-table-column prop="history_bonus_amount" label="历史累计分红" align="center"></el-table-column>
  96. <el-table-column prop="store_number" label="门店数量" align="center"></el-table-column>
  97. <el-table-column prop="mch_number" label="商户数量" align="center"></el-table-column>
  98. <el-table-column label="状态" min-width="90" align="center">
  99. <template slot-scope="scope">
  100. <el-switch
  101. v-model="scope.row.status"
  102. @change="((val)=>{switchFun(val,scope.row.id,'status')})"
  103. :active-value="1"
  104. :inactive-value="0"
  105. active-text=""
  106. inactive-text=""
  107. >
  108. </el-switch>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="成为招商员时间" min-width="105" align="center">
  112. <template slot-scope="scope">
  113. {{ scope.row.register_time | dateTimeFormat('Y-m-d H:i') }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="操作" align="center" fixed="right" >
  117. <template slot-scope="scope">
  118. <el-button type="text" @click="handle('edit',scope.row)">编辑</el-button>
  119. <el-button type="text" @click="handle('detail',scope.row)">查看</el-button>
  120. <!-- <el-button type="text" @click="handle('destroy',scope.row)">删除</el-button>-->
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <div style="text-align: right;margin: 20px 0;">
  125. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  126. </div>
  127. </el-tabs>
  128. </div>
  129. </el-card>
  130. </div>
  131. <script>
  132. const app = new Vue({
  133. el: '#app',
  134. data: {
  135. loading: false,
  136. page: 1,
  137. pageCount: 0,
  138. list: [],
  139. searchForm:{
  140. user_id: null,
  141. nickname: null,
  142. business_bonus_level: null,
  143. created_at: null,
  144. status: null
  145. },
  146. level_list: [], // 等级列表
  147. status_option: [
  148. {index: 0, name: '禁用'},
  149. {index: 1, name: '启用'},
  150. ]
  151. },
  152. mounted() {
  153. this.getList();
  154. this.getBusinessBonusLevel();
  155. },
  156. computed: {
  157. show_clear_search_btn: function() {
  158. return this.searchForm.business_bonus_level != null ||
  159. this.searchForm.user_id != null ||
  160. this.searchForm.created_at != null ||
  161. this.searchForm.status != null ||
  162. this.searchForm.nickname != null;
  163. },
  164. },
  165. methods: {
  166. pagination(currentPage) {
  167. let self = this;
  168. self.page = currentPage;
  169. self.getList(this.searchForm);
  170. },
  171. search() {// 清空查询条件
  172. this.page = 1;
  173. this.getList(this.searchForm);
  174. },
  175. resetSearch() {// 清空查询条件
  176. this.searchForm = {
  177. user_id: null,
  178. nickname: null,
  179. business_bonus_level: null,
  180. created_at: null,
  181. status: null
  182. };
  183. this.page = 1;
  184. this.getList();
  185. },
  186. switchFun(val, id, field) {
  187. if (field == 'status') {
  188. let param = {id: id, status: val};
  189. this.send('business-bonus/default/handle',param)
  190. }
  191. },
  192. handle(type, data = null) {
  193. let id = data ? parseInt(data.id) : '';
  194. switch (type) {
  195. case 'edit':
  196. let params = {
  197. r: 'business-bonus/default/edit'
  198. };
  199. if (id) params = Object.assign(params, {
  200. id: id
  201. });
  202. navigateTo(params);
  203. break;
  204. case 'detail':
  205. let param = {
  206. r: 'business-bonus/default/detail'
  207. };
  208. if (id) param = Object.assign(param, {
  209. id: id
  210. });
  211. navigateTo(param);
  212. break;
  213. case 'destroy':
  214. param = {id: data.id,status: -1};
  215. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send('business-bonus/default/handle',param)})
  216. break;
  217. }
  218. },
  219. send(url, params, callback = null) {
  220. let self = this;
  221. request({
  222. params: {
  223. r: url,
  224. },
  225. method: 'post',
  226. data: params
  227. }).then(e => {
  228. if (e.data.code == 0) {
  229. self.$message.success(e.data.msg);
  230. self.getList();
  231. } else {
  232. self.$message.error(e.data.msg);
  233. }
  234. }).catch(e => {
  235. console.log(e);
  236. });
  237. if(callback) return e.data;
  238. },
  239. getList(search = {}) {
  240. let self = this;
  241. self.loading = true;
  242. let basic_params = {
  243. page: self.page,
  244. };
  245. let params = Object.assign(basic_params, search);
  246. request({
  247. params: {
  248. r: 'business-bonus/default/index'
  249. },
  250. method: 'post',
  251. data: params
  252. }).then(e => {
  253. self.loading = false;
  254. if (e.data.code == 0) {
  255. self.list = e.data.data.page_data.list;
  256. self.pageCount = e.data.data.page_data.page_count;
  257. } else {
  258. self.$message.error(e.data.msg);
  259. }
  260. }).catch(e => {
  261. self.loading = false;
  262. });
  263. },
  264. getBusinessBonusLevel()
  265. {
  266. let self = this;
  267. request({
  268. params: {
  269. r: 'business-bonus/default/business-bonus-level'
  270. },
  271. method: 'post',
  272. data: {}
  273. }).then(e => {
  274. if (e.data.code == 0) {
  275. self.level_list = e.data.data.level_list;
  276. } else {
  277. self.$message.error(e.data.msg);
  278. }
  279. }).catch(e => {
  280. });
  281. }
  282. }
  283. });
  284. </script>
  285. <style>
  286. .el-tabs__header {
  287. font-size: 16px;
  288. }
  289. .table-body {
  290. padding: 20px;
  291. background-color: #fff;
  292. }
  293. .table-body .el-button {
  294. padding: 0 !important;
  295. border: 0;
  296. margin: 0 5px;
  297. }
  298. .input-item {
  299. width: 250px;
  300. margin: 0 0 20px;
  301. display: inline-block;
  302. }
  303. .input-item .el-input__inner {
  304. border-right: 0;
  305. }
  306. .input-item .el-input__inner:hover {
  307. border: 1px solid #dcdfe6;
  308. border-right: 0;
  309. outline: 0;
  310. }
  311. .input-item .el-input__inner:focus {
  312. border: 1px solid #dcdfe6;
  313. border-right: 0;
  314. outline: 0;
  315. }
  316. .input-item .el-input-group__append {
  317. background-color: #fff;
  318. border-left: 0;
  319. width: 10%;
  320. padding: 0;
  321. }
  322. .input-item .el-input-group__append .el-button {
  323. padding: 0;
  324. }
  325. .input-item .el-input-group__append .el-button {
  326. margin: 0;
  327. }
  328. .batch {
  329. margin: 0 0 20px;
  330. display: inline-block;
  331. }
  332. .batch .el-button {
  333. padding: 9px 15px !important;
  334. }
  335. .el-table th>.cell{
  336. color: #333;
  337. font-weight: bold;
  338. font-size: 14px;
  339. }
  340. .el-table__footer-wrapper, .el-table__header-wrapper{
  341. border-bottom: 1.4px solid #D6D6D6;
  342. }
  343. .search-box {
  344. padding: 10px 0 0 10px;
  345. background-color: #fff;
  346. margin-bottom: 10px;
  347. }
  348. </style>