my-customer.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <style>
  2. .default-avatar{
  3. width: 50px;
  4. height: 50px;
  5. border-radius: 50%;
  6. float: left;
  7. margin-right: 8px;
  8. }
  9. </style>
  10. <div id="my_customer" v-cloak>
  11. <div class="user_info">
  12. <div class="user_detail" v-if="userInfo">
  13. <el-image style="height:50px;width:50px;border-radius: 50%;margin-right: 20px;" :src="userInfo.avatar_url? userInfo.avatar_url:'/resources/img/common/default-avatar.png'" lazy></el-image>
  14. <div>
  15. <div class="user_name">
  16. {{userInfo.nickname}}
  17. </div>
  18. <div class="info">
  19. <div>
  20. <span>手机号:</span>
  21. <span class="text">{{userInfo.mobile || '无'}}</span>
  22. </div>
  23. <div>
  24. <span>注册时间:</span>
  25. <span class="text">{{userInfo.created_at | dateTimeFormat("Y-m-d H:i")}}</span>
  26. </div>
  27. <div>
  28. <span>推荐人:</span>
  29. <span class="text">{{userInfo.p_nickname || userInfo.parent_id}}</span>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="user_total">
  35. <div class="module" >
  36. <div>团队人数</div>
  37. <div class="module_value">{{userInfo.team_num ? userInfo.team_num : 0}}</div>
  38. </div>
  39. <div class="module" >
  40. <div>好友人数</div>
  41. <div class="module_value">{{userInfo.first_num ? userInfo.first_num : 0}}</div>
  42. </div>
  43. <div class="module" >
  44. <div>粉丝人数</div>
  45. <div class="module_value">{{userInfo.second_num ? userInfo.second_num : 0}}</div>
  46. </div>
  47. <div class="module" >
  48. <div>累计消费金额</div>
  49. <div class="module_value">{{userInfo.pay_money ? userInfo.pay_money : 0.00}}</div>
  50. </div>
  51. <div class="module" >
  52. <div>累计收益</div>
  53. <div class="module_value">{{userInfo.commission ? userInfo.commission : 0.00}}</div>
  54. </div>
  55. <div class="module" >
  56. <div>待结算</div>
  57. <div class="module_value">{{userInfo.not_income ? userInfo.not_income : 0.00}}</div>
  58. </div>
  59. </div>
  60. </div>
  61. <el-card class="box-card">
  62. <template>
  63. <el-tabs v-model="activeName" @tab-click="handleClick">
  64. <el-tab-pane label="直推客户" name="1"></el-tab-pane>
  65. <el-tab-pane label="间推客户" name="2"></el-tab-pane>
  66. <el-tab-pane label="我的团队" name="3"></el-tab-pane>
  67. <el-tab-pane label="推荐人" name="4"></el-tab-pane>
  68. <el-tab-pane label="我的收益" name="5"></el-tab-pane>
  69. </el-tabs>
  70. </template>
  71. <div class="tab_search" v-if="activeName=='1' || activeName=='2' || activeName=='3' || activeName=='4'" >
  72. <div class="search_form">
  73. <el-select style="width: 200px;margin-right: 10px;" v-model="search_type" @change="selectKeyword" placeholder="请选择搜索类型">
  74. <el-option label="会员ID" value="1"></el-option>
  75. <el-option label="会员名称" value="2"></el-option>
  76. <el-option label="手机号码" value="3"></el-option>
  77. </el-select>
  78. <el-input style="margin-right: 10px;" v-model="keyword"></el-input>
  79. <el-button type="primary" @click="searchInfo">搜索</el-button>
  80. </div>
  81. </div>
  82. <div class="tab_search" v-if="activeName=='5'" >
  83. <div class="search_form">
  84. <el-select style="width: 200px;margin-right: 10px;" v-model="from_type" @change="selectFromType" placeholder="请选择搜索类型">
  85. <el-option label="佣金类型" value=""></el-option>
  86. <el-option :label="item" :value="index" v-for="(item, index) in capitalList"></el-option>
  87. </el-select>
  88. <el-button type="primary" @click="searchInfo">搜索</el-button>
  89. </div>
  90. </div>
  91. </el-card>
  92. <el-table :data="userList" stripe style="width: 100%" v-loading="listLoading" v-if="is_team">
  93. <el-table-column prop="id" label="会员ID" min-width="100" align="center"></el-table-column>
  94. <el-table-column key='3' label="会员名称" width="240" >
  95. <template slot-scope="scope">
  96. <div class="table-info-img-text">
  97. <el-image class="table-info-img circle" :src="scope.row.avatar_url">
  98. <div slot="error" class="image-slot">
  99. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  100. </div>
  101. </el-image>
  102. <div class="table-info-text">
  103. <div>{{scope.row.nickname}}</div>
  104. <div>{{scope.row.mobile}}</div>
  105. </div>
  106. </div>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="推荐人" width="240" v-if="activeName == '3' || activeName == '2'">
  110. <template slot-scope="scope">
  111. <div class="table-info-img-text">
  112. <el-image class="table-info-img circle" :src="scope.row.p_avatar_url">
  113. <div slot="error" class="image-slot">
  114. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  115. </div>
  116. </el-image>
  117. <div class="table-info-text">
  118. <div>{{scope.row.p_nickname}}</div>
  119. <div>ID:{{scope.row.p_id}}</div>
  120. </div>
  121. </div>
  122. </template>
  123. </el-table-column>
  124. <el-table-column v-if="activeName != '4'" label="绑定时间" min-width="100" align="center">
  125. <template slot-scope="scope">
  126. <div>{{scope.row.bind_time | dateTimeFormat("Y-m-d H:i:s")}}</div>
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="pay_money" label="成交金额" min-width="100" align="center">
  130. <template slot-scope="scope">
  131. {{scope.row.pay_money}}
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="pay_num" label="成交订单数" min-width="100" align="center">
  135. <template slot-scope="scope">
  136. {{scope.row.pay_num}}
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="操作" min-width="100" v-if="is_team">
  140. <template v-if="is_team" slot-scope="scope">
  141. <el-button type="text" size="small" @click="gotoUserDetail(scope.row.id)">详情</el-button>
  142. <el-button type="text" size="small" @click="gotoBy(scope.row.id)">我的客户</el-button>
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. <el-table :data="commissionList" stripe style="width: 100%" v-loading="listLoading" v-if="is_commission">
  147. <el-table-column prop="id" label="编号" min-width="100" align="center"></el-table-column>
  148. <el-table-column prop="change_num" label="变动金额" min-width="100" align="center">
  149. <template slot-scope="scope">
  150. <div style="font-size: 18px;" :style="{color: scope.row.change_type == 'add' ? '#68CF3D' : scope.row.change_type == 'sub' ? '#F6AA5A' : ''}">
  151. {{scope.row.change_type == 'add' ? '+' : scope.row.change_type == 'sub' ? '-' : ''}}
  152. {{scope.row.change_num}}
  153. </div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="current_num" label="佣金类型" min-width="200" align="center">
  157. <template slot-scope="scope">
  158. {{capitalList[scope.row.capital_type] ? capitalList[scope.row.capital_type] : ''}}
  159. </template>
  160. </el-table-column>
  161. <el-table-column prop="current_num" label="变动前金额" min-width="200" align="center">
  162. <template slot-scope="scope">
  163. {{scope.row.current_num}}
  164. </template>
  165. </el-table-column>
  166. <el-table-column prop="current_num" label="变动后金额" min-width="150" align="center">
  167. <template slot-scope="scope">
  168. <!-- <div v-if="scope.row.change_type == 'add'">{{scope.row.current_num + scope.row.change_num}}</div>-->
  169. <!-- <div v-if="scope.row.change_type == 'sub'">{{scope.row.current_num - scope.row.change_num}}</div>-->
  170. <div v-if="scope.row.change_type == 'add'">{{formatData(scope.row.current_num,scope.row.change_num,'add')}}</div>
  171. <div v-if="scope.row.change_type == 'sub'">{{formatData(scope.row.current_num,scope.row.change_num,'sub')}}</div>
  172. </template>
  173. </el-table-column>
  174. <el-table-column prop="desc" label="备注" min-width="100" align="center">
  175. <template slot-scope="scope">
  176. {{scope.row.desc}}
  177. </template>
  178. </el-table-column>
  179. <el-table-column prop="created_at" label="时间" min-width="100" align="center">
  180. <template slot-scope="scope">
  181. {{scope.row.created_at| dateTimeFormat("Y-m-d H:i:s")}}
  182. </template>
  183. </el-table-column>
  184. </el-table>
  185. <div style="text-align: right;margin: 20px 0;">
  186. <el-pagination @current-change="pagination" background layout="prev, pager, next"
  187. :page-count="pageCount" :current-page="currentPage"></el-pagination>
  188. </div>
  189. </div>
  190. <script>
  191. // getQuery('order_id'),
  192. const app = new Vue({
  193. el: '#my_customer',
  194. data() {
  195. return {
  196. userInfo: <?= $user_info?>,
  197. activeName: '1',
  198. tabArr: [],
  199. userList: [],
  200. commissionList: [],
  201. capitalList: [],
  202. listLoading: false,
  203. isType: -1,
  204. keyword: '',
  205. search_type: '',
  206. pageCount: 1,
  207. currentPage: 1,
  208. page: 1,
  209. id: '',
  210. from_type:'',
  211. is_team: true,
  212. is_commission: false
  213. }
  214. },
  215. mounted(){
  216. this.user_id = getQuery('id');
  217. console.info(getQuery('id'));
  218. /* this.$navigate({
  219. // r: this.getOrderListUrl,
  220. r: 'mall/order/index',
  221. }) */
  222. this.getList();
  223. },
  224. methods: {
  225. getList(){
  226. this.listLoading = true;
  227. this.is_team = true;
  228. this.is_commission = false;
  229. request({
  230. params: {
  231. r: 'mall/user/my-customer',
  232. user_id: this.userInfo.id,
  233. status: this.activeName,
  234. keyword: this.keyword,
  235. search_type: this.search_type,
  236. page: this.page
  237. },
  238. method: 'get',
  239. }).then(res => {
  240. this.listLoading = false;
  241. if(res.data.code == 0){
  242. this.userList = res.data.data.list;
  243. this.pageCount = res.data.data.page_count;
  244. console.log(this.userList);
  245. }else {
  246. this.listLoading = false;
  247. this.$message.error(e.data.msg);
  248. }
  249. }).catch(err => {
  250. this.$message.error(err.data.msg);
  251. })
  252. },
  253. handleClick(tab, event){
  254. this.commissionList = [];
  255. this.userList = [];
  256. this.pageCount = 1;
  257. this.page = 1;
  258. this.from_type = '';
  259. if (tab.name == 5) {
  260. this.listLoading = true;
  261. this.is_commission = true;
  262. this.is_team = false;
  263. this.getCommission();
  264. } else {
  265. this.activeName = tab.name;
  266. this.keyword = '';
  267. this.search_type = '';
  268. this.getList();
  269. }
  270. },
  271. getCommission() {
  272. this.listLoading = true;
  273. this.is_commission = true;
  274. this.is_team = false;
  275. request({
  276. params: {
  277. r: 'mall/user/my-commission',
  278. user_id: this.userInfo.id,
  279. id: this.id,
  280. capital_type: this.from_type,
  281. page: this.page
  282. },
  283. method: 'get',
  284. }).then(res => {
  285. this.listLoading = false;
  286. if(res.data.code == 0){
  287. this.commissionList = res.data.data.list;
  288. this.capitalList = res.data.data.capital_type;
  289. this.pageCount = res.data.data.page_count;
  290. }else {
  291. this.listLoading = false;
  292. this.$message.error(e.data.msg);
  293. }
  294. }).catch(err => {
  295. this.listLoading = false;
  296. this.$message.error(err.data.msg);
  297. })
  298. },
  299. selectKeyword(select){
  300. this.search_type = select;
  301. },
  302. searchInfo(){
  303. if ((this.search_type=='' || this.keyword=='') && this.from_type=='') {
  304. this.$message.error('请选择搜索项');
  305. return false;
  306. }
  307. this.commissionList = [];
  308. this.userList = [];
  309. this.pageCount = 1;
  310. this.page = 1;
  311. if (this.activeName == 5) {
  312. this.getCommission();
  313. } else {
  314. this.getList();
  315. }
  316. },
  317. pagination(currentPage){
  318. this.page = currentPage;
  319. if (this.activeName == 5) {
  320. this.getCommission()
  321. } else {
  322. this.getList();
  323. }
  324. },
  325. selectFromType(from_type) {
  326. this.capital_type = from_type;
  327. },
  328. gotoUserDetail(id){
  329. this.$navigate({
  330. r: 'mall/user/user-detail',
  331. id: id
  332. })
  333. },
  334. gotoBy(id){
  335. this.$navigate({
  336. r: 'mall/user/my-customer',
  337. user_id: id
  338. })
  339. },
  340. formatData(arg1,arg2,change_type){
  341. switch (change_type){
  342. case 'add':
  343. return (arg1+arg2).toFixed(2);
  344. case 'sub':
  345. return (arg1-arg2).toFixed(2);
  346. default:
  347. return 0;
  348. }
  349. }
  350. }
  351. })
  352. </script>
  353. <style>
  354. .user_info{
  355. background: #FFF;
  356. padding: 20px;
  357. margin-bottom: 10px;
  358. }
  359. .user_detail{
  360. display: flex;
  361. align-items: center;
  362. margin-bottom: 40px;
  363. }
  364. .user_detail .info{
  365. display: flex;
  366. font-size: 12px;
  367. color: #939393;
  368. }
  369. .user_detail .info .text{
  370. color: #000;
  371. margin-right: 40px;
  372. }
  373. .user_detail .user_name{
  374. font-size: 15px;
  375. margin-bottom: 10px;
  376. }
  377. .user_total{
  378. background: #F2F2F2;
  379. display: flex;
  380. padding: 20px 30px;
  381. }
  382. .user_total .module{
  383. flex: 1;
  384. color: #919191;
  385. }
  386. .module_value{
  387. font-size: 25px;
  388. color: #000;
  389. margin-top: 8px;
  390. }
  391. .tab_module{
  392. background: #FFF;
  393. padding: 10px 20px;
  394. }
  395. .tab_search{
  396. display: flex;
  397. }
  398. .search_but{
  399. display: flex;
  400. flex: 1;
  401. color: #797979;
  402. align-items: center;
  403. }
  404. .search_but div{
  405. border: 1px solid #E6E6E6;
  406. padding: 5px 20px;
  407. margin-right: 30px;
  408. border-radius: 30px;
  409. height: 30px;
  410. }
  411. .search_but div:hover{
  412. cursor:pointer
  413. }
  414. .search_but_sel{
  415. color: #FFF;
  416. background: #2E8FF4;
  417. }
  418. .search_form{
  419. display:flex;
  420. }
  421. </style>