clientManage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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 style="margin: 0rpx 0rpx 0 20rpx;color: #2A82FD;text-align: right;font-size: 26rpx;" @click="jumpUrl('/mine/allDynamic/allDynamic')">客户动态></view>
  11. </view>
  12. <view class="filter ddflex">
  13. <view :class="'filter-item fflex ddflex '+(filterType==2&&isShowPop?'f-active':'')" @click="changeFilterType(2)">
  14. <text style="max-width: 150rpx;" class="tover">{{stateIndex!=-1?stateList[stateIndex].label:'智能筛选'}}</text>
  15. <image class="filter-item-icon" :style="filterType==2&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  16. </view>
  17. <view :class="'filter-item fflex ddflex '+(filterType==1&&isShowPop?'f-active':'')" @click="changeFilterType(1)">
  18. 筛选
  19. <image class="filter-item-icon" :style="filterType==1&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="ceng" v-if="isShowPop" @click="hidePop()"></view>
  24. <view class="hx-pop" :style="'top:calc(' +popBottom+' + '+(isShowPop?190:0)+'rpx' ">
  25. <view class="pop-con" v-if="filterType==1">
  26. <view class="pop-list">
  27. <view v-for="(item, index) in dateList" :key="index" style="margin-bottom: 30rpx;">
  28. <view>{{ item.title }}</view>
  29. <view class="ddflex">
  30. <view :class="'opt' + (it.isActive? ' opt-active' : '')" v-for="(it, idx) in item.option" :key="idx" @click="switchFilterType(index,idx)">
  31. <view>{{ it.label }}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="pop-con" v-if="filterType==2">
  38. <view class="pop-list">
  39. <view :class="'li' + (stateIndex == index ? ' active' : '')" v-for="(item, index) in stateList" :key="index" @click="switchType(index)">
  40. {{ item.label }}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="pop-btn ddflex" v-if="filterType!=2">
  45. <view @click="reset">重置</view>
  46. <view class="fflex" @click="confirm">确定</view>
  47. </view>
  48. </view>
  49. <view style="height: 190rpx;"></view>
  50. <!-- 订单列表 -->
  51. <view style="position: relative;overflow: hidden;" v-if="dataList.length>0">
  52. <view class="register-box" v-for="item,index in dataList" :key="index" @click="jumpUrl('/mine/clientDetail/clientDetail?id='+item.id)">
  53. <view class="register-title dflex fflex">
  54. <image class="register-title-icon" :src="item.avatar?item.avatar:'/static/images/userimg.png'"></image>
  55. <view class="flex" style="min-width: 0;">
  56. <view class="ddflex">
  57. <view class="card-name fflex tover">{{item.nickName?item.nickName:''}}</view>
  58. <view v-if="item.mobile">
  59. <image style="width: 140rpx;height: 64rpx;margin-left: 20rpx;" src="/mine/static/images/lx.png" @click.stop="goPhone(item.mobile)"></image>
  60. </view>
  61. </view>
  62. <view class="card-name" style="line-height: 48rpx;margin-bottom: 10rpx;" v-if="item.realName">({{item.realName}})</view>
  63. <view class="ddflex" style="margin-top: 4rpx;">
  64. <block v-if="item.customTypeName&&item.customTypeName.length>0">
  65. <view class="card-tag" v-for="it,idx in item.customTypeName" :key="idx+'s'">{{it}}</view>
  66. </block>
  67. <block v-if="item.labelName&&item.labelName.length>0">
  68. <view class="card-tag card-tag-t" v-for="it,idx in item.labelName" :key="idx+'l'">{{it}}</view>
  69. </block>
  70. </view>
  71. <view class="ddflex" style="font-size: 24rpx;color: #999;font-weight: 400;margin: 20rpx 0;">
  72. <text>保单</text><text style="color: #000000;">{{item.warrantyCount?item.warrantyCount:0}}</text>
  73. <view class="card-line" style="height: 23rpx;margin: 0 10rpx;"></view>
  74. <text>共计保费</text><text style="color: #FF5700;">{{item.warrantyMoney?item.warrantyMoney:0}}元</text>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- <view class="ddflex" style="margin-top: 41rpx;font-size: 24rpx;padding: 0 30rpx;">
  79. <view class="ddflex fflex">
  80. <view style="color: #999;margin-right: 16rpx;">服务策略</view>
  81. <view style="color: #333333;">刺激消费频率</view>
  82. </view>
  83. <view v-if="item.mobile">
  84. <image style="width: 140rpx;height: 64rpx;margin-left: 20rpx;" src="/mine/static/images/lx.png" @click.stop="goPhone(item.mobile)"></image>
  85. </view>
  86. </view> -->
  87. </view>
  88. </view>
  89. <view v-else class="nodata">
  90. <image src="../../card/static/images/empty.png" mode="widthFix"></image>
  91. <view>暂无数据</view>
  92. </view>
  93. </view>
  94. </template>
  95. <script>
  96. const app = getApp();
  97. const req = require("../../utils/request.js");
  98. const util = require('../../utils/util.js');
  99. export default {
  100. components: {},
  101. props: {},
  102. data() {
  103. return {
  104. filterType:null,
  105. popBottom: '-100%',
  106. isShowPop: false,
  107. dateIndex: -1,
  108. // 时间类型 1、今日 2、昨日 3、近7日 4、近30天 5、本月 6、本季度 7、本年度
  109. dateList: [
  110. {
  111. title:'性别',
  112. key:'sex',
  113. option:[
  114. {
  115. label: '男',
  116. value: 1
  117. },{
  118. label: '女',
  119. value: 2
  120. },
  121. ]
  122. },{
  123. title:'客户类型',
  124. key:'custom_type',
  125. option:[]
  126. },{
  127. title:'客户标签',
  128. key:'custom_label',
  129. option:[
  130. {
  131. label: '经理',
  132. value: 1
  133. },{
  134. label: '负责人',
  135. value: 2
  136. },{
  137. label: '业务员',
  138. value: 3
  139. }
  140. ]
  141. }
  142. ],
  143. stateIndex: 0,
  144. stateList:[{
  145. label: '智能推荐',
  146. value: null
  147. },{
  148. label: '保费从高到低',
  149. value: 'warranty_money',
  150. behavior:'desc'
  151. },
  152. {
  153. label: '保费从低到高',
  154. value: 'warranty_money',
  155. behavior:'asc'
  156. },
  157. {
  158. label: '保单从高到低',
  159. value: 'warranty_count',
  160. behavior:'desc'
  161. },{
  162. label: '保单从低到高',
  163. value: 'warranty_count',
  164. behavior:'asc'
  165. }],
  166. page: 1,
  167. limit: 10,
  168. isLoad: true,
  169. searchVal: '',
  170. dataList: [],
  171. isReference:false,
  172. }
  173. },
  174. async onLoad(options) {
  175. await this.getDict()
  176. await this.getDictCustomType()
  177. this.getDataList()
  178. },
  179. onShow() {
  180. if(this.isReference){
  181. this.isReference = false
  182. this.page=1;
  183. this.isLoad = true
  184. this.getDataList();
  185. }
  186. },
  187. onReachBottom() {
  188. this.page++;
  189. this.getDataList();
  190. },
  191. methods: {
  192. jumpUrl(url) {
  193. uni.navigateTo({
  194. url: url
  195. })
  196. this.hidePop()
  197. },
  198. // 客户标签字典
  199. getDict(){
  200. return new Promise((r,j)=>{
  201. req.getRequest('/api/other/dict/info',{dictType:'custom_label'},res=>{
  202. this.dateList.map(item=>{
  203. if(item.key=='custom_label'){
  204. item.option = []
  205. res.map(it=>{
  206. item.option.push({
  207. label:it.dictName,
  208. value:it.dictValue
  209. })
  210. })
  211. }
  212. })
  213. r(res)
  214. })
  215. })
  216. },
  217. // 客户类型字典
  218. getDictCustomType(){
  219. return new Promise((r,j)=>{
  220. req.getRequest('/api/other/dict/info',{dictType:'custom_type'},res=>{
  221. this.dateList.map(item=>{
  222. if(item.key=='custom_type'){
  223. item.option = []
  224. res.map(it=>{
  225. item.option.push({
  226. label:it.dictName,
  227. value:it.dictValue
  228. })
  229. })
  230. }
  231. })
  232. r(res)
  233. })
  234. })
  235. },
  236. // 切换筛选类型
  237. changeFilterType(type){
  238. // if(this.filterType==type) return false
  239. this.filterType = type
  240. if(type==3) {
  241. this.hidePop()
  242. return false
  243. }
  244. this.openPop()
  245. },
  246. // 打开弹窗
  247. openPop(){
  248. this.isShowPop = true
  249. this.popBottom = '0%'
  250. },
  251. // 关闭弹窗
  252. hidePop() {
  253. this.isShowPop = false;
  254. this.popBottom = '-100%';
  255. },
  256. // 筛选
  257. switchType(index) {
  258. if (this.stateIndex == index) return false;
  259. this.stateIndex = index;
  260. this.confirm()
  261. },
  262. switchFilterType(index,idx) {
  263. // 可多选
  264. if(this.dateList[index].key=='custom_label' || this.dateList[index].key=='custom_type'){
  265. if(!this.dateList[index].option[idx].isActive){
  266. this.dateList[index].option[idx].isActive = true
  267. }else{
  268. this.dateList[index].option[idx].isActive = false
  269. }
  270. }else{
  271. if(!this.dateList[index].option[idx].isActive){
  272. this.dateList[index].option.map(item=>{
  273. item.isActive = false
  274. })
  275. this.dateList[index].option[idx].isActive = true
  276. }else{
  277. this.dateList[index].option[idx].isActive = false
  278. }
  279. }
  280. this.dateList = JSON.parse(JSON.stringify(this.dateList))
  281. },
  282. confirm() {
  283. this.hidePop();
  284. this.isLoad = true;
  285. this.page=1;
  286. this.isLoad = true
  287. this.getDataList();
  288. },
  289. reset() {
  290. this.dateIndex = -1;
  291. this.stateIndex = 0;
  292. this.dateList.map(item=>{
  293. item.option.map(it=>{
  294. it.isActive = false
  295. })
  296. })
  297. this.dateList = JSON.parse(JSON.stringify(this.dateList))
  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.nickName = this.searchVal
  311. }
  312. // 状态筛选
  313. if (this.stateIndex != -1) {
  314. queryParams.orderField = this.stateList[this.stateIndex].value;
  315. if(this.stateList[this.stateIndex].behavior){
  316. queryParams.order = this.stateList[this.stateIndex].behavior;
  317. }
  318. }
  319. this.dateList.map(item=>{
  320. if(item.key=="sex"){
  321. let sl = item.option.filter(it=>{return it.isActive})
  322. if(sl.length>0){
  323. queryParams.gender = sl[0].value
  324. }
  325. }
  326. if(item.key=="custom_label"){
  327. let jl = item.option.filter(it=>{return it.isActive})
  328. if(jl.length>0){
  329. // queryParams.label = jl[0].value
  330. queryParams.label = jl.map(item => {return item.value}).join(',')
  331. }
  332. }
  333. if(item.key=="custom_type"){
  334. let tl = item.option.filter(it=>{return it.isActive})
  335. if(tl.length>0){
  336. queryParams.type = tl.map(item => {return item.value}).join(',')
  337. }
  338. }
  339. })
  340. req.getRequest('/api/user/getUserBySaleNo', queryParams, data => {
  341. data = data.list
  342. if (data != null && data.length == this.limit) {
  343. this.isLoad = true;
  344. }
  345. if (this.page == 1) {
  346. this.dataList = [];
  347. }
  348. if (this.page > 0) {
  349. data = this.dataList.concat(data);
  350. }
  351. this.dataList = data;
  352. console.log('列表数据>>>', this.dataList);
  353. })
  354. },
  355. // 搜索
  356. searchFn() {
  357. this.page = 1;
  358. this.isLoad = true;
  359. this.page=1;
  360. this.getDataList();
  361. },
  362. // 拨打电话
  363. goPhone(phone) {
  364. if(!phone) return false
  365. uni.makePhoneCall({
  366. phoneNumber: phone,
  367. success(res){
  368. }
  369. }); // 传参带入号码即可
  370. },
  371. },
  372. mounted() {
  373. }
  374. }
  375. </script>
  376. <style>
  377. @import "./clientManage.css";
  378. </style>