clientManage.vue 11 KB

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