clientManage.vue 9.2 KB

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