clientManage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <view class="search-box ddflex">
  5. <view class="search-input ddflex fflex">
  6. <image src="/static/images/ssico.png"></image>
  7. <input @confirm="searchFn" confirm-type="search" @input="searchFn" v-model="searchVal" class="fflex"
  8. placeholder="请输入关键词" />
  9. </view>
  10. </view>
  11. <view class="filter ddflex">
  12. <view :class="'filter-item fflex ddflex '+(filterType==2&&isShowPop?'f-active':'')" @click="changeFilterType(2)">
  13. <text style="max-width: 150rpx;" class="tover">{{stateIndex!=-1?stateList[stateIndex].label:'智能筛选'}}</text>
  14. <image class="filter-item-icon" :style="filterType==2&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  15. </view>
  16. <view class="fflex">
  17. <picker mode="region" v-model="regionIndex" @change="regionChange">
  18. <view :class="'filter-item fflex ddflex '+(areaIndex!=-1?'f-active':'')" @click="changeFilterType(3)">
  19. <text style="max-width: 150rpx;" class="tover">{{regionText?regionText:'地区'}}</text>
  20. <image class="filter-item-icon" :style="filterType==1&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  21. </view>
  22. </picker>
  23. </view>
  24. <view :class="'filter-item fflex ddflex '+(filterType==1&&isShowPop?'f-active':'')" @click="changeFilterType(1)">
  25. 筛选
  26. <image class="filter-item-icon" :style="filterType==1&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="ceng" v-if="isShowPop" @click="hidePop()"></view>
  31. <view class="hx-pop" :style="'top:calc(' +popBottom+' + '+(isShowPop?190:0)+'rpx' ">
  32. <view class="pop-con" v-if="filterType==1">
  33. <view class="pop-list">
  34. <view v-for="(item, index) in dateList" :key="index" style="margin-bottom: 30rpx;">
  35. <view>{{ item.title }}</view>
  36. <view class="ddflex">
  37. <view :class="'opt' + (it.isActive? ' opt-active' : '')" v-for="(it, idx) in item.option" :key="idx" @click="switchFilterType(index,idx)">
  38. <view>{{ it.label }}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="pop-con" v-if="filterType==2">
  45. <view class="pop-list">
  46. <view :class="'li' + (stateIndex == index ? ' active' : '')" v-for="(item, index) in stateList" :key="index" @click="switchType(index)">
  47. {{ item.label }}
  48. </view>
  49. </view>
  50. </view>
  51. <view class="pop-btn ddflex" v-if="filterType!=2">
  52. <view @click="reset">重置</view>
  53. <view class="fflex" @click="confirm">确定</view>
  54. </view>
  55. </view>
  56. <view style="height: 190rpx;"></view>
  57. <!-- 订单列表 -->
  58. <view style="position: relative;overflow: hidden;" v-if="dataList.length>0">
  59. <view class="register-box" v-for="item,index in dataList" :key="index" @click="jumpUrl('/mine/clientDetail/clientDetail?id='+item.id)">
  60. <view class="register-title dflex fflex">
  61. <image class="register-title-icon" :src="item.avatar?item.avatar:'/static/images/userimg.png'"></image>
  62. <view class="flex" style="min-width: 0;">
  63. <view class="ddflex">
  64. <view class="card-name fflex tover">{{item.realName?item.realName:''}}</view>
  65. </view>
  66. <view class="ddflex" style="margin-top: 4rpx;">
  67. <view class="card-tag">{{ item.jobName }}</view>
  68. <view class="card-tag">入司{{item.inDate?monthDayDiff(item.inDate):'1年'}}</view>
  69. </view>
  70. <view class="ddflex" style="font-size: 24rpx;color: #999;font-weight: 400;margin: 20rpx 0;">
  71. <text>保单</text><text style="color: #000000;">1</text>
  72. <view class="card-line" style="height: 23rpx;margin: 0 10rpx;"></view>
  73. <text>共计保费</text><text style="color: #FF5700;">139元</text>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="ddflex" style="margin-top: 41rpx;font-size: 24rpx;padding: 0 30rpx;">
  78. <view class="ddflex fflex">
  79. <view style="color: #999;margin-right: 16rpx;">服务策略</view>
  80. <view style="color: #333333;">刺激消费频率</view>
  81. </view>
  82. <view>
  83. <image style="width: 140rpx;height: 64rpx;margin-left: 20rpx;" src="/mine/static/images/lx.png"></image>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view v-else class="nodata">
  89. <image src="../../card/static/images/empty.png" mode="widthFix"></image>
  90. <view>暂无数据</view>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. const app = getApp();
  96. const req = require("../../utils/request.js");
  97. const util = require('../../utils/util.js');
  98. const QQMapWX = require("../../utils/qqmap.js");
  99. export default {
  100. components: {},
  101. props: {},
  102. data() {
  103. return {
  104. statusBarHeight:0,
  105. filterType:null,
  106. popBottom: '-100%',
  107. isShowPop: false,
  108. dateIndex: -1,
  109. // 时间类型 1、今日 2、昨日 3、近7日 4、近30天 5、本月 6、本季度 7、本年度
  110. dateList: [
  111. {
  112. title:'性别',
  113. key:'sex',
  114. option:[
  115. {
  116. label: '男',
  117. value: 1
  118. },{
  119. label: '女',
  120. value: 2
  121. },
  122. ]
  123. },{
  124. title:'入司时间',
  125. key:'inDate',
  126. option:[
  127. {
  128. label: '1~2年',
  129. value: 1
  130. },{
  131. label: '2~3年',
  132. value: 2
  133. },{
  134. label: '3~4年',
  135. value: 3
  136. },{
  137. label: '4年以上',
  138. value: 4
  139. }
  140. ]
  141. },{
  142. title:'职务',
  143. key:'job',
  144. option:[
  145. {
  146. label: '经理',
  147. value: 1
  148. },{
  149. label: '负责人',
  150. value: 2
  151. },{
  152. label: '业务员',
  153. value: 3
  154. }
  155. ]
  156. }
  157. ],
  158. startTime: '',
  159. endTime: '',
  160. regionText:'',
  161. regionCode:[],
  162. areaIndex:-1,
  163. stateIndex: 0,
  164. stateList:[{
  165. label: '智能推荐',
  166. value: null
  167. },{
  168. label: '评价分从高到低',
  169. value: 'avage'
  170. },
  171. {
  172. label: '浏览量从高到低',
  173. value: 'bCount',
  174. behavior:4
  175. },
  176. {
  177. label: '点赞量从高到低',
  178. value: 'bCount',
  179. behavior:3
  180. }],
  181. page: 1,
  182. limit: 10,
  183. isLoad: true,
  184. searchVal: '',
  185. dataList: [],
  186. isReference:false,
  187. latitude: '23.027923',
  188. longitude: '113.753815',
  189. }
  190. },
  191. onLoad(options) {
  192. QQMapWX.initMap();
  193. req.getLocation(async res => {
  194. const to = {
  195. latitude: res.latitude,
  196. longitude: res.longitude
  197. };
  198. this.latitude = res.latitude;
  199. this.longitude = res.longitude;
  200. await this.getDict()
  201. this.getDataList()
  202. });
  203. },
  204. onShow() {
  205. if(this.isReference){
  206. this.isReference = false
  207. this.page=1;
  208. this.isLoad = true
  209. this.getDataList();
  210. }
  211. },
  212. onReachBottom() {
  213. this.page++;
  214. this.getDataList();
  215. },
  216. methods: {
  217. jumpUrl(url) {
  218. uni.navigateTo({
  219. url: url
  220. })
  221. },
  222. getDict(){
  223. return new Promise((r,j)=>{
  224. req.getRequest('/api/other/dict/info',{dictType:'job'},res=>{
  225. this.dateList.map(item=>{
  226. if(item.key=='job'){
  227. item.option = []
  228. res.map(it=>{
  229. item.option.push({
  230. label:it.dictName,
  231. value:it.dictValue
  232. })
  233. })
  234. }
  235. })
  236. r(res)
  237. })
  238. })
  239. },
  240. // 切换筛选类型
  241. changeFilterType(type){
  242. // if(this.filterType==type) return false
  243. this.filterType = type
  244. if(type==3) {
  245. this.hidePop()
  246. return false
  247. }
  248. this.openPop()
  249. },
  250. // 打开弹窗
  251. openPop(){
  252. this.isShowPop = true
  253. this.popBottom = '0%'
  254. },
  255. // 关闭弹窗
  256. hidePop() {
  257. this.isShowPop = false;
  258. this.popBottom = '-100%';
  259. },
  260. // 筛选
  261. switchType(index) {
  262. if (this.stateIndex == index) return false;
  263. this.stateIndex = index;
  264. this.confirm()
  265. },
  266. switchFilterType(index,idx) {
  267. if(!this.dateList[index].option[idx].isActive){
  268. this.dateList[index].option.map(item=>{
  269. item.isActive = false
  270. })
  271. this.dateList[index].option[idx].isActive = true
  272. }else{
  273. this.dateList[index].option[idx].isActive = false
  274. }
  275. this.dateList = JSON.parse(JSON.stringify(this.dateList))
  276. },
  277. regionChange(e){
  278. this.regionText = e.detail.value.join('')
  279. this.regionCode = e.detail.code
  280. this.confirm()
  281. },
  282. confirm() {
  283. this.hidePop();
  284. this.isLoad = true;
  285. this.getDataList();
  286. },
  287. reset() {
  288. this.dateIndex = -1;
  289. this.stateIndex = 0;
  290. this.dateList.map(item=>{
  291. item.option.map(it=>{
  292. it.isActive = false
  293. })
  294. })
  295. this.dateList = JSON.parse(JSON.stringify(this.dateList))
  296. this.regionText=''
  297. this.regionCode=[]
  298. },
  299. // 分页查询
  300. getDataList() {
  301. if (!this.isLoad) return false;
  302. this.isLoad = false;
  303. let queryParams = {
  304. page: this.page,
  305. limit: this.limit,
  306. latitude: this.latitude,
  307. longitude: this.longitude,
  308. }
  309. if (this.searchVal) {
  310. queryParams.realName = this.searchVal
  311. }
  312. // 时间筛选
  313. if (this.dateIndex != -1) {
  314. queryParams.dateType = this.dateList[this.dateIndex].value;
  315. }else if (this.dateIndex == -1) {
  316. } else {
  317. queryParams.dateType = 8
  318. queryParams.end = this.endTime?this.endTime:null;
  319. queryParams.start = this.startTime?this.startTime:null;
  320. }
  321. // 状态筛选
  322. if (this.stateIndex != -1) {
  323. queryParams.orderFiled = this.stateList[this.stateIndex].value;
  324. if(this.stateList[this.stateIndex].behavior){
  325. queryParams.behavior = this.stateList[this.stateIndex].behavior;
  326. }
  327. }
  328. if(this.regionCode.length>0){
  329. queryParams.areaCode = this.regionCode[2]
  330. }
  331. this.dateList.map(item=>{
  332. if(item.key=="sex"){
  333. let sl = item.option.filter(it=>{return it.isActive})
  334. if(sl.length>0){
  335. queryParams.gender = sl[0].value
  336. }
  337. }
  338. if(item.key=="job"){
  339. let jl = item.option.filter(it=>{return it.isActive})
  340. if(jl.length>0){
  341. queryParams.job = jl[0].value
  342. }
  343. }
  344. if(item.key=="inDate"){
  345. console.log('indate')
  346. let il = item.option.filter(it=>{return it.isActive})
  347. console.log(il)
  348. if(il.length>0){
  349. let d = il[0].value
  350. if(d==4){
  351. queryParams.endTime = this.getYear(d+1)
  352. }else{
  353. queryParams.startTime = this.getYear(d)
  354. queryParams.endTime = this.getYear(d+1)
  355. }
  356. }
  357. }
  358. if(item.key=="job"){
  359. // queryParams.gender = item.option.filter(it=>{return it.isActive})[0].value
  360. }
  361. })
  362. req.getRequest('/api/visiting/card/cardInfoList', queryParams, data => {
  363. data = data.list
  364. if (data != null && data.length == this.limit) {
  365. this.isLoad = true;
  366. }
  367. if (this.page == 1) {
  368. this.dataList = [];
  369. }
  370. if (this.page > 0) {
  371. data = this.dataList.concat(data);
  372. }
  373. this.dataList = data;
  374. console.log('列表数据>>>', this.dataList);
  375. })
  376. },
  377. getYear(index){
  378. let dateTime = new Date().getFullYear(); /* 获取现在的年份 */
  379. dateTime = new Date(new Date().setFullYear(dateTime-index))
  380. let y = dateTime.getFullYear()
  381. let m = dateTime.getMonth()+1<10?('0'+(dateTime.getMonth()+1)):dateTime.getMonth()+1
  382. let d = dateTime.getDate()<10?('0'+(dateTime.getDate())):dateTime.getDate()
  383. return y+'-'+m+'-'+d
  384. },
  385. // 搜索
  386. searchFn() {
  387. this.page = 1;
  388. this.isLoad = true;
  389. this.getDataList();
  390. },
  391. formatTimeFn(data) {
  392. if (data) {
  393. return utils.formatTimeCommStr(data, 'Y-M-D')
  394. } else {
  395. return '';
  396. }
  397. },
  398. monthDayDiff(date) {
  399. return util.monthDayDiff(date)
  400. },
  401. },
  402. mounted() {
  403. const systemInfo = uni.getSystemInfoSync();
  404. // px转换到rpx的比例
  405. let pxToRpxScale = 750 / systemInfo.windowWidth;
  406. this.statusBarHeight = uni.getSystemInfoSync().windowTop*pxToRpxScale
  407. }
  408. }
  409. </script>
  410. <style>
  411. @import "./clientManage.css";
  412. </style>