index.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-export-dialog');
  4. ?>
  5. <style>
  6. .link_url {
  7. text-align: left;
  8. font-size: 14px;
  9. }
  10. .showqr .el-dialog__body {
  11. text-align: center;
  12. padding-bottom: 10px;
  13. }
  14. .el-dialog {
  15. min-width: 400px;
  16. }
  17. </style>
  18. <div id="app" v-cloak>
  19. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  20. <div slot="header">
  21. <span>{{store_name}}列表</span>
  22. <com-export-dialog :field_list='export_list' :action_url="export_url" :params="searchForm" style="display: block;float: right;margin-top: -6px">
  23. </com-export-dialog>
  24. </div>
  25. <div class="search-box">
  26. <!-- 搜索 -->
  27. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  28. <el-form-item :label="store_name">
  29. <el-input :placeholder="store_name + `名称`" v-model="searchForm.store_name"></el-input>
  30. </el-form-item>
  31. <el-form-item label="店主ID">
  32. <el-input placeholder="会员ID" v-model="searchForm.user_id"></el-input>
  33. </el-form-item>
  34. <el-form-item label="店主昵称">
  35. <el-input placeholder="昵称/手机号" v-model="searchForm.nickname"></el-input>
  36. </el-form-item>
  37. <el-form-item label="招商员ID">
  38. <el-input placeholder="会员ID" v-model="searchForm.business_user_id"></el-input>
  39. </el-form-item>
  40. <el-form-item label="招商员昵称">
  41. <el-input placeholder="昵称/手机号" v-model="searchForm.business_nickname"></el-input>
  42. </el-form-item>
  43. <el-form-item label="地址">
  44. <div class="block">
  45. <el-cascader
  46. :options="optionList"
  47. v-model="searchForm.region_option"
  48. @change="handleChangeRegion">
  49. </el-cascader>
  50. </div>
  51. </el-form-item>
  52. <el-form-item label="创建时间">
  53. <el-date-picker
  54. size="small"
  55. v-model="searchForm.created_at"
  56. type="datetimerange"
  57. value-format="yyyy-MM-dd HH:mm:ss"
  58. range-separator="至"
  59. start-placeholder="开始日期"
  60. end-placeholder="结束日期">
  61. </el-date-picker>
  62. </el-form-item>
  63. <el-form-item>
  64. <el-button type="primary" @click="search">搜索</el-button>
  65. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  66. </el-form-item>
  67. </el-form>
  68. </div>
  69. <div class="table-body">
  70. <el-tabs v-model="activeName" @tab-click="handleClick">
  71. <el-tab-pane label="门店列表" name="1"></el-tab-pane>
  72. <el-tab-pane label="商户列表" name="2"></el-tab-pane>
  73. </el-tabs>
  74. <el-tabs>
  75. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  76. <el-table-column prop="id" label="序号" align="center"></el-table-column>
  77. <el-table-column :label="store_name" align="left" min-width="125">
  78. <template slot-scope="scope" v-if="scope.row.store_info">
  79. {{scope.row.store_info.store_name}}
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. label="店长"
  84. min-width="130">
  85. <template slot-scope="scope" v-if="scope.row.storeUser">
  86. <div style="display: flex;align-items: center;">
  87. <el-image fit="cover" :src="scope.row.storeUser.avatar_url ? scope.row.storeUser.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  88. <div>
  89. <div>{{scope.row.storeUser.nickname}}</div>
  90. <div>ID {{scope.row.storeUser.id}}</div>
  91. </div>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="店长手机号" min-width="135" align="center">
  96. <template slot-scope="scope" v-if="scope.row.storeUser">
  97. {{ scope.row.storeUser.mobile }}
  98. </template>
  99. </el-table-column>
  100. <el-table-column :label="store_name + `地址`" min-width="135" align="center">
  101. <template slot-scope="scope" v-if="scope.row.store_info">
  102. {{ getWholeAddress(scope.row.store_info.province_id, scope.row.store_info.city_id, scope.row.store_info.district_id, scope.row.store_info.address) }}
  103. </template>
  104. </el-table-column>
  105. <el-table-column
  106. label="招商员"
  107. min-width="130">
  108. <template slot-scope="scope" v-if="scope.row.businessUser">
  109. <div style="display: flex;align-items: center;">
  110. <el-image fit="cover" :src="scope.row.businessUser.avatar_url ? scope.row.businessUser.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
  111. <div>
  112. <div>{{scope.row.businessUser.nickname}}</div>
  113. <div>ID {{scope.row.businessUser.id}}</div>
  114. </div>
  115. </div>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="招商员手机号" min-width="135" align="center">
  119. <template slot-scope="scope" v-if="scope.row.businessUser">
  120. {{ scope.row.businessUser.mobile }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column prop="history_income" label="累计收入" align="center"></el-table-column>
  124. <el-table-column prop="history_earn" label="累计利润" align="center"></el-table-column>
  125. <el-table-column :label="store_name + `会员总数`" align="center">
  126. <template slot-scope="scope" v-if="scope.row.store_info">
  127. {{ scope.row.store_info.user_nums }}
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="有效期" min-width="135" align="center">
  131. <template slot-scope="scope" v-if="scope.row.store_info">
  132. {{ scope.row.store_info.expire_time | dateTimeFormat('Y-m-d H:i') }}
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="创建时间" min-width="135" align="center">
  136. <template slot-scope="scope">
  137. {{ scope.row.store_created_at | dateTimeFormat('Y-m-d H:i') }}
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <div style="text-align: right;margin: 20px 0;">
  142. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  143. </div>
  144. </el-tabs>
  145. </div>
  146. </el-card>
  147. </div>
  148. <script>
  149. const app = new Vue({
  150. el: '#app',
  151. data: {
  152. loading: false,
  153. page: 1,
  154. pageCount: 0,
  155. list: [],
  156. searchForm:{
  157. store_name: null,
  158. user_id: null,
  159. nickname: null,
  160. created_at: null,
  161. business_user_id: null,
  162. business_nickname: null,
  163. store_type: 1,
  164. region_option: []
  165. },
  166. level_list: [], // 等级列表
  167. status_option: [
  168. {index: 0, name: '待结算'},
  169. {index: 1, name: '已结算'},
  170. ],
  171. activeName: '1',
  172. export_list: {},
  173. export_url: '/business-bonus/store/index',
  174. regionList: [],
  175. optionList: [],
  176. },
  177. mounted() {
  178. this.getList(this.searchForm);
  179. this.getRegionList();
  180. },
  181. computed: {
  182. show_clear_search_btn: function() {
  183. return this.searchForm.user_id != null ||
  184. this.searchForm.created_at != null ||
  185. this.searchForm.store_name != null ||
  186. this.searchForm.business_nickname != null ||
  187. this.searchForm.business_user_id != null ||
  188. this.searchForm.region_option.length > 0 ||
  189. this.searchForm.nickname != null;
  190. },
  191. store_name() {
  192. return this.activeName == 1 ? '门店' : '商户';
  193. },
  194. },
  195. methods: {
  196. handleChangeRegion() {
  197. this.getList(this.searchForm);
  198. },
  199. handleClick() {
  200. this.searchForm.store_type = this.activeName;
  201. this.getList(this.searchForm);
  202. },
  203. pagination(currentPage) {
  204. let self = this;
  205. self.page = currentPage;
  206. self.getList(this.searchForm);
  207. },
  208. search() {// 清空查询条件
  209. this.page = 1;
  210. this.getList(this.searchForm);
  211. },
  212. resetSearch() {// 清空查询条件
  213. this.searchForm = {
  214. user_id: null,
  215. nickname: null,
  216. created_at: null,
  217. store_name: null,
  218. business_user_id: null,
  219. business_nickname: null,
  220. region_option: [],
  221. store_type: this.activeName
  222. };
  223. this.page = 1;
  224. this.getList(this.searchForm);
  225. },
  226. switchFun(val, id, field) {
  227. if (field == 'status') {
  228. let param = {id: id, status: val};
  229. this.send('business-bonus/default/handle',param)
  230. }
  231. },
  232. handle(type, data = null) {
  233. let id = data ? parseInt(data.id) : '';
  234. switch (type) {
  235. case 'edit':
  236. let params = {
  237. r: 'business-bonus/default/edit'
  238. };
  239. if (id) params = Object.assign(params, {
  240. id: id
  241. });
  242. navigateTo(params);
  243. break;
  244. case 'detail':
  245. let param = {
  246. r: 'business-bonus/default/detail'
  247. };
  248. if (id) param = Object.assign(param, {
  249. id: id
  250. });
  251. navigateTo(param);
  252. break;
  253. case 'destroy':
  254. param = {id: data.id,status: -1};
  255. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send('business-bonus/default/handle',param)})
  256. break;
  257. }
  258. },
  259. send(url, params, callback = null) {
  260. let self = this;
  261. request({
  262. params: {
  263. r: url,
  264. },
  265. method: 'post',
  266. data: params
  267. }).then(e => {
  268. if (e.data.code == 0) {
  269. self.$message.success(e.data.msg);
  270. self.getList(this.searchForm);
  271. } else {
  272. self.$message.error(e.data.msg);
  273. }
  274. }).catch(e => {
  275. console.log(e);
  276. });
  277. if(callback) return e.data;
  278. },
  279. getList(search = {}) {
  280. let self = this;
  281. self.loading = true;
  282. let basic_params = {
  283. page: self.page,
  284. };
  285. let params = Object.assign(basic_params, search);
  286. request({
  287. params: {
  288. r: 'business-bonus/store/index'
  289. },
  290. method: 'post',
  291. data: params
  292. }).then(e => {
  293. self.loading = false;
  294. if (e.data.code == 0) {
  295. self.list = e.data.data.page_data.list;
  296. self.pageCount = e.data.data.page_data.page_count;
  297. self.export_list = e.data.data.page_data.export_list;
  298. } else {
  299. self.$message.error(e.data.msg);
  300. }
  301. }).catch(e => {
  302. self.loading = false;
  303. });
  304. },
  305. getBusinessBonusLevel()
  306. {
  307. let self = this;
  308. request({
  309. params: {
  310. r: 'business-bonus/default/business-bonus-level'
  311. },
  312. method: 'post',
  313. data: {}
  314. }).then(e => {
  315. if (e.data.code == 0) {
  316. self.level_list = e.data.data.level_list;
  317. } else {
  318. self.$message.error(e.data.msg);
  319. }
  320. }).catch(e => {
  321. });
  322. },
  323. getRegionList()
  324. {
  325. let that = this;
  326. request({
  327. params: {
  328. r: 'common/region/list',
  329. level: 3
  330. },
  331. }).then(res => {
  332. that.regionList = res.data.data.list;
  333. that.optionList = that.getOptionList(that.regionList);
  334. })
  335. },
  336. getOptionList(regionList)
  337. {
  338. let that = this;
  339. let list = [];
  340. regionList.map(function (item) {
  341. let temp = {
  342. value: item.id,
  343. label: item.name
  344. }
  345. if (item.children != undefined) {
  346. temp.children = that.getOptionList(item.children);
  347. }
  348. list.push(temp);
  349. });
  350. return list;
  351. },
  352. getWholeAddress(province_id, city_id, district_id, address)
  353. {
  354. let wholeAddress = '';
  355. this.regionList.map(function (province) {
  356. if (province.id == province_id) {
  357. wholeAddress += province.name;
  358. province.children.map(function (city) {
  359. if (city.id == city_id) {
  360. wholeAddress += city.name;
  361. city.children.map(function (district) {
  362. if (district.id == district_id) {
  363. wholeAddress += district.name;
  364. }
  365. });
  366. }
  367. });
  368. }
  369. });
  370. return wholeAddress + address;
  371. }
  372. }
  373. });
  374. </script>
  375. <style>
  376. .el-tabs__header {
  377. font-size: 16px;
  378. }
  379. .table-body {
  380. padding: 20px;
  381. background-color: #fff;
  382. }
  383. .table-body .el-button {
  384. padding: 0 !important;
  385. border: 0;
  386. margin: 0 5px;
  387. }
  388. .input-item {
  389. width: 250px;
  390. margin: 0 0 20px;
  391. display: inline-block;
  392. }
  393. .input-item .el-input__inner {
  394. border-right: 0;
  395. }
  396. .input-item .el-input__inner:hover {
  397. border: 1px solid #dcdfe6;
  398. border-right: 0;
  399. outline: 0;
  400. }
  401. .input-item .el-input__inner:focus {
  402. border: 1px solid #dcdfe6;
  403. border-right: 0;
  404. outline: 0;
  405. }
  406. .input-item .el-input-group__append {
  407. background-color: #fff;
  408. border-left: 0;
  409. width: 10%;
  410. padding: 0;
  411. }
  412. .input-item .el-input-group__append .el-button {
  413. padding: 0;
  414. }
  415. .input-item .el-input-group__append .el-button {
  416. margin: 0;
  417. }
  418. .batch {
  419. margin: 0 0 20px;
  420. display: inline-block;
  421. }
  422. .batch .el-button {
  423. padding: 9px 15px !important;
  424. }
  425. .el-table th>.cell{
  426. color: #333;
  427. font-weight: bold;
  428. font-size: 14px;
  429. }
  430. .el-table__footer-wrapper, .el-table__header-wrapper{
  431. border-bottom: 1.4px solid #D6D6D6;
  432. }
  433. .search-box {
  434. padding: 10px 0 0 10px;
  435. background-color: #fff;
  436. margin-bottom: 10px;
  437. }
  438. </style>