clientManage.vue 11 KB

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