list.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view>
  3. <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
  4. <view class="customer-list-wrap">
  5. <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无相关客户"></u-empty></view>
  6. <view v-for="(item, index) in customerList" class="customer-item" :key="index">
  7. <!-- @click="listItemHandle(item)" -->
  8. <view class="info">
  9. <view class="customer">
  10. <view class="relname">
  11. ({{groupTypeObj[item.group_type]}}){{ item.nickname }}
  12. </view>
  13. <view class="item">
  14. <u-icon class="u-m-r-5" name="phone" size="22"></u-icon>
  15. {{ item.phone }}
  16. </view>
  17. <!-- <view class="item">
  18. <u-icon class="u-m-r-5" name="home" size="22"></u-icon>
  19. {{ item.estate_name }}
  20. </view> -->
  21. <!-- <view class="item">
  22. <u-icon class="u-m-r-5" name="rmb" size="22"></u-icon>
  23. 预期最高收益{{ item.commission }}元
  24. </view> -->
  25. </view>
  26. <view class="data-wrap">
  27. <view class="date u-m-t-5">推荐人:{{item.referrer || '未填'}}</view>
  28. <!-- <view class="date">保护期截止:{{item.lock_at}}</view> -->
  29. </view>
  30. </view>
  31. <view class="tool-wrap">
  32. <view class="tag">
  33. <u-tag
  34. :text="`认证:${authStateObj[item.auth_state]}`"
  35. :type="item.auth_state == 1 ? 'success' : item.auth_state == 2 ? 'warning' : 'error'"
  36. size="mini"
  37. class="u-m-r-10"
  38. ></u-tag>
  39. <u-tag
  40. :text="item.bind_wechat == 1 ? '已绑定微信' : '未绑定微信'"
  41. :type="item.bind_wechat == 1 ? 'success' : 'warning'"
  42. size="mini"
  43. ></u-tag>
  44. </view>
  45. <!-- v-if="curRoles == 1 || curRoles == 3 || curRoles == 5 || curRoles == 6" -->
  46. <!-- <view class="scoped-list-more-info" @click="copyTextHandle(item)">
  47. 报备人:{{item.create_user.nickname}}
  48. <u-tag
  49. style="margin-left: 10px;"
  50. text="复制"
  51. type="primary"
  52. size="mini"
  53. ></u-tag>
  54. </view> -->
  55. <!-- <view class="tool">
  56. <u-icon
  57. v-if="item.report_step <= 1 && item.expire_time == 0"
  58. name="reload"
  59. size="32"
  60. label="重新报备"
  61. label-size="24"
  62. @click="pageTo('/pages/agent/recommend/create', { info: item })"
  63. ></u-icon>
  64. </view> -->
  65. </view>
  66. </view>
  67. </view>
  68. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  69. <!-- 平台佣金政策弹窗 -->
  70. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
  71. <view class="bwin-popup">
  72. <view class="popup-header">用户搜索</view>
  73. <view class="popup-body">
  74. <u-input v-model="searchFormData.nickname" border placeholder="请输入昵称(支持模糊搜索)"></u-input>
  75. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  76. <u-input v-model="searchFormData.phone" border placeholder="请输入手机号(可仅输入一部分)"></u-input>
  77. </view>
  78. <view class="popup-footer" style="position: absolute;">
  79. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  80. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  81. </view>
  82. </view>
  83. </u-popup>
  84. <u-loadmore
  85. v-if="customerList.length > 0"
  86. marginTop="32"
  87. :line="true"
  88. :status="loadmore.status"
  89. :loading-text="loadmore.loadingText"
  90. :loadmore-text="loadmore.defaultText"
  91. :nomore-text="loadmore.nomoreText"
  92. />
  93. </view>
  94. </template>
  95. <script>
  96. import { arrToObj } from '@/utils'
  97. import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
  98. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
  99. export default {
  100. components: {
  101. wmWatermark
  102. },
  103. data() {
  104. return {
  105. searchKeyword: null,
  106. searchPopupShow: false,
  107. searchFormData: {
  108. name: '',
  109. phone: ''
  110. }, // 搜索栏数据
  111. orderMethod: 0,
  112. filterDropdownValue: {}, // 默认筛选
  113. customerList: [], // 客户列表
  114. loadmore: {
  115. status: 'loadmore',
  116. loadingText: '努力加载中',
  117. defaultText: '轻轻上拉 查看更多',
  118. nomoreText: '实在没有了',
  119. currnetPage: 1
  120. },
  121. curRoles: '',
  122. userInfo2: {},
  123. authStateObj: {},
  124. groupTypeObj: {},
  125. };
  126. },
  127. onLoad(params) {
  128. this.getDataList()
  129. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  130. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  131. const dictObj = uni.getStorageSync('MD_dict')
  132. this.authStateObj = arrToObj(dictObj.auth_state)
  133. this.groupTypeObj = arrToObj(dictObj.group_type)
  134. },
  135. onReachBottom() {
  136. if (this.loadmore.status == 'nomore') return;
  137. this.loadmore.currnetPage++
  138. this.getDataList()
  139. },
  140. onPullDownRefresh() {
  141. // 防止频繁刷新
  142. },
  143. methods: {
  144. listItemHandle (item) {
  145. if (item.report_state == 2) {
  146. if (this.curRoles == 1 || this.curRoles == 5 || this.curRoles == 7) {
  147. uni.$msgConfirm('当前客户报备审核中,是否前往审核?', () => {
  148. uni.navigateTo({
  149. url: `/pages/agent/recommend/check?id=${item.id}&name=${item.name}&phone=${item.phone}`
  150. })
  151. })
  152. } else {
  153. uni.$msgConfirm('当前客户报备审核中~')
  154. }
  155. } else {
  156. uni.navigateTo({
  157. url: '/pages/agent/recommend/detail?id=' + item.id
  158. })
  159. }
  160. },
  161. copyTextHandle (item) {
  162. uniCopy({
  163. content: `${item.name}-${item.sex == 'male'?'男':'女'}-${item.phone}`,
  164. success:(res)=>{
  165. uni.showToast({
  166. title: res,
  167. icon: 'none'
  168. })
  169. },
  170. error:(e)=>{
  171. uni.showToast({
  172. title: e,
  173. icon: 'none',
  174. duration:3000,
  175. })
  176. }
  177. })
  178. },
  179. getDataList (bc) {
  180. const that = this
  181. let params = {
  182. ...this.searchFormData
  183. }
  184. if (that.orderMethod > 0) {
  185. if (that.orderMethod === 1) {
  186. params.order_by = JSON.stringify([{
  187. field: 'create_at',
  188. sort: 'desc',
  189. }])
  190. }
  191. if (that.orderMethod === 2) {
  192. params.order_by = JSON.stringify([{
  193. field: 'create_at',
  194. sort: 'asc',
  195. }])
  196. }
  197. }
  198. uni.api.cust.apideptuserlist({
  199. page: that.loadmore.currnetPage,
  200. ...params,
  201. }).then(res => {
  202. const list = res.list || []
  203. if (list.length < 10) {
  204. that.loadmore.status = 'nomore';
  205. }
  206. if (res.current_page === 1) {
  207. if (list.length === 0) {
  208. uni.$msg('无搜索结果', 'none');
  209. }
  210. that.customerList = [...list]
  211. } else {
  212. that.customerList = that.customerList.concat(list)
  213. }
  214. if (bc) bc()
  215. })
  216. },
  217. customBack() {
  218. uni.navigateBack();
  219. },
  220. // 带监听器跳转
  221. pageTo(url, data) {
  222. /// xxxxx
  223. uni.navigateTo({
  224. url: url,
  225. events: {
  226. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  227. update: function(data) {
  228. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  229. }
  230. },
  231. success: function(res) {
  232. // 通过eventChannel向被打开页面传送数据
  233. res.eventChannel.emit('data', data);
  234. }
  235. });
  236. },
  237. searchHandle() {
  238. this.loadmore.currnetPage = 1
  239. this.getDataList(() => {
  240. this.searchPopupShow = false
  241. })
  242. },
  243. getTime(n) {
  244. let date = n ? new Date(n) : new Date()
  245. let year = date.getFullYear()
  246. let month = date.getMonth() + 1
  247. month = month > 9 ? month : '0' + month
  248. let day = date.getDate()
  249. day = day > 9 ? day : '0' + day
  250. let hour = date.getHours()
  251. hour = hour > 9 ? hour : '0' + hour
  252. let minute = date.getMinutes()
  253. minute = minute > 9 ? minute : '0' + minute
  254. let second = date.getSeconds()
  255. second = second > 9 ? second : '0' + second
  256. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  257. },
  258. }
  259. };
  260. </script>
  261. <style lang="scss">
  262. .search-wrap {
  263. padding: 20rpx;
  264. }
  265. .filter-wrap {
  266. position: relative;
  267. }
  268. // 列表
  269. .customer-list-wrap {
  270. width: 100%;
  271. .customer-item {
  272. display: flex;
  273. flex-direction: column;
  274. align-items: flex-start;
  275. font-size: $u-p2;
  276. color: $u-content-color;
  277. border-bottom: 1rpx solid $u-border-color;
  278. padding: 24rpx 32rpx;
  279. .info {
  280. display: flex;
  281. align-items: flex-start;
  282. justify-content: space-between;
  283. width: 100%;
  284. margin-bottom: 10rpx;
  285. .customer {
  286. display: flex;
  287. flex-direction: column;
  288. align-items: flex-start;
  289. .relname {
  290. color: $u-main-color;
  291. font-size: $u-p;
  292. font-weight: bold;
  293. margin-bottom: 10rpx;
  294. }
  295. .item {
  296. margin-bottom: 10rpx;
  297. }
  298. }
  299. .data-wrap {
  300. text-align: right;
  301. .date {
  302. font-size: $u-sub;
  303. }
  304. }
  305. }
  306. .tool-wrap {
  307. display: flex;
  308. align-items: center;
  309. justify-content: space-between;
  310. width: 100%;
  311. }
  312. }
  313. }
  314. .float-search {
  315. opacity: 0.9;
  316. position: fixed;
  317. right: 20rpx;
  318. bottom: 40rpx;
  319. padding: 20rpx;
  320. border-radius: 50%;
  321. background-color: $u-theme-color;
  322. }
  323. .scoped-list-more-info {
  324. position: absolute;
  325. right: 20rpx;
  326. }
  327. </style>