123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- <template>
- <view>
- <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
- <view class="customer-list-wrap">
- <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无相关客户"></u-empty></view>
- <view v-for="(item, index) in customerList" class="customer-item" :key="index">
- <!-- @click="listItemHandle(item)" -->
- <view class="info">
- <view class="customer">
- <view class="relname">
- ({{groupTypeObj[item.group_type]}}){{ item.nickname }}
- </view>
- <view class="item">
- <u-icon class="u-m-r-5" name="phone" size="22"></u-icon>
- {{ item.phone }}
- </view>
- <!-- <view class="item">
- <u-icon class="u-m-r-5" name="home" size="22"></u-icon>
- {{ item.estate_name }}
- </view> -->
- <!-- <view class="item">
- <u-icon class="u-m-r-5" name="rmb" size="22"></u-icon>
- 预期最高收益{{ item.commission }}元
- </view> -->
- </view>
- <view class="data-wrap">
- <view class="date u-m-t-5">推荐人:{{item.referrer || '未填'}}</view>
- <!-- <view class="date">保护期截止:{{item.lock_at}}</view> -->
- </view>
- </view>
- <view class="tool-wrap">
- <view class="tag">
- <u-tag
- :text="`认证:${authStateObj[item.auth_state]}`"
- :type="item.auth_state == 1 ? 'success' : item.auth_state == 2 ? 'warning' : 'error'"
- size="mini"
- class="u-m-r-10"
- ></u-tag>
- <u-tag
- :text="item.bind_wechat == 1 ? '已绑定微信' : '未绑定微信'"
- :type="item.bind_wechat == 1 ? 'success' : 'warning'"
- size="mini"
- ></u-tag>
- </view>
- <!-- v-if="curRoles == 1 || curRoles == 3 || curRoles == 5 || curRoles == 6" -->
- <!-- <view class="scoped-list-more-info" @click="copyTextHandle(item)">
- 报备人:{{item.create_user.nickname}}
- <u-tag
- style="margin-left: 10px;"
- text="复制"
- type="primary"
- size="mini"
- ></u-tag>
- </view> -->
- <!-- <view class="tool">
- <u-icon
- v-if="item.report_step <= 1 && item.expire_time == 0"
- name="reload"
- size="32"
- label="重新报备"
- label-size="24"
- @click="pageTo('/pages/agent/recommend/create', { info: item })"
- ></u-icon>
- </view> -->
- </view>
- </view>
- </view>
- <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
- <!-- 平台佣金政策弹窗 -->
- <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
- <view class="bwin-popup">
- <view class="popup-header">用户搜索</view>
- <view class="popup-body">
- <u-input v-model="searchFormData.nickname" border placeholder="请输入昵称(支持模糊搜索)"></u-input>
- <u-divider marginTop="10" marginBottom="10">或</u-divider>
- <u-input v-model="searchFormData.phone" border placeholder="请输入手机号(可仅输入一部分)"></u-input>
- </view>
- <view class="popup-footer" style="position: absolute;">
- <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
- <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
- </view>
- </view>
- </u-popup>
- <u-loadmore
- v-if="customerList.length > 0"
- marginTop="32"
- :line="true"
- :status="loadmore.status"
- :loading-text="loadmore.loadingText"
- :loadmore-text="loadmore.defaultText"
- :nomore-text="loadmore.nomoreText"
- />
- </view>
- </template>
- <script>
- import { arrToObj } from '@/utils'
- import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
- import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
- export default {
- components: {
- wmWatermark
- },
- data() {
- return {
- searchKeyword: null,
- searchPopupShow: false,
- searchFormData: {
- name: '',
- phone: ''
- }, // 搜索栏数据
- orderMethod: 0,
- filterDropdownValue: {}, // 默认筛选
- customerList: [], // 客户列表
- loadmore: {
- status: 'loadmore',
- loadingText: '努力加载中',
- defaultText: '轻轻上拉 查看更多',
- nomoreText: '实在没有了',
- currnetPage: 1
- },
- curRoles: '',
- userInfo2: {},
- authStateObj: {},
- groupTypeObj: {},
- };
- },
- onLoad(params) {
- this.getDataList()
-
- this.userInfo2 = uni.getStorageSync('MD_userInfo2')
- this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
-
- const dictObj = uni.getStorageSync('MD_dict')
- this.authStateObj = arrToObj(dictObj.auth_state)
- this.groupTypeObj = arrToObj(dictObj.group_type)
- },
- onReachBottom() {
- if (this.loadmore.status == 'nomore') return;
- this.loadmore.currnetPage++
- this.getDataList()
- },
- onPullDownRefresh() {
- // 防止频繁刷新
- },
- methods: {
- listItemHandle (item) {
- if (item.report_state == 2) {
- if (this.curRoles == 1 || this.curRoles == 5 || this.curRoles == 7) {
- uni.$msgConfirm('当前客户报备审核中,是否前往审核?', () => {
- uni.navigateTo({
- url: `/pages/agent/recommend/check?id=${item.id}&name=${item.name}&phone=${item.phone}`
- })
- })
- } else {
- uni.$msgConfirm('当前客户报备审核中~')
- }
- } else {
- uni.navigateTo({
- url: '/pages/agent/recommend/detail?id=' + item.id
- })
- }
- },
- copyTextHandle (item) {
- uniCopy({
- content: `${item.name}-${item.sex == 'male'?'男':'女'}-${item.phone}`,
- success:(res)=>{
- uni.showToast({
- title: res,
- icon: 'none'
- })
- },
- error:(e)=>{
- uni.showToast({
- title: e,
- icon: 'none',
- duration:3000,
- })
- }
- })
- },
- getDataList (bc) {
- const that = this
- let params = {
- ...this.searchFormData
- }
-
- if (that.orderMethod > 0) {
- if (that.orderMethod === 1) {
- params.order_by = JSON.stringify([{
- field: 'create_at',
- sort: 'desc',
- }])
- }
- if (that.orderMethod === 2) {
- params.order_by = JSON.stringify([{
- field: 'create_at',
- sort: 'asc',
- }])
- }
- }
- uni.api.cust.apideptuserlist({
- page: that.loadmore.currnetPage,
- ...params,
- }).then(res => {
- const list = res.list || []
- if (list.length < 10) {
- that.loadmore.status = 'nomore';
- }
- if (res.current_page === 1) {
- if (list.length === 0) {
- uni.$msg('无搜索结果', 'none');
- }
- that.customerList = [...list]
- } else {
- that.customerList = that.customerList.concat(list)
- }
- if (bc) bc()
- })
- },
- customBack() {
- uni.navigateBack();
- },
- // 带监听器跳转
- pageTo(url, data) {
- /// xxxxx
- uni.navigateTo({
- url: url,
- events: {
- // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
- update: function(data) {
- // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
- }
- },
- success: function(res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('data', data);
- }
- });
- },
- searchHandle() {
- this.loadmore.currnetPage = 1
- this.getDataList(() => {
- this.searchPopupShow = false
- })
- },
- getTime(n) {
- let date = n ? new Date(n) : new Date()
- let year = date.getFullYear()
- let month = date.getMonth() + 1
- month = month > 9 ? month : '0' + month
- let day = date.getDate()
- day = day > 9 ? day : '0' + day
- let hour = date.getHours()
- hour = hour > 9 ? hour : '0' + hour
- let minute = date.getMinutes()
- minute = minute > 9 ? minute : '0' + minute
- let second = date.getSeconds()
- second = second > 9 ? second : '0' + second
- return `${year}-${month}-${day} ${hour}:${minute}:${second}`
- },
- }
- };
- </script>
- <style lang="scss">
- .search-wrap {
- padding: 20rpx;
- }
- .filter-wrap {
- position: relative;
- }
- // 列表
- .customer-list-wrap {
- width: 100%;
- .customer-item {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- font-size: $u-p2;
- color: $u-content-color;
- border-bottom: 1rpx solid $u-border-color;
- padding: 24rpx 32rpx;
- .info {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- width: 100%;
- margin-bottom: 10rpx;
- .customer {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- .relname {
- color: $u-main-color;
- font-size: $u-p;
- font-weight: bold;
- margin-bottom: 10rpx;
- }
- .item {
- margin-bottom: 10rpx;
- }
- }
- .data-wrap {
- text-align: right;
- .date {
- font-size: $u-sub;
- }
- }
- }
- .tool-wrap {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- }
- }
- }
- .float-search {
- opacity: 0.9;
- position: fixed;
- right: 20rpx;
- bottom: 40rpx;
- padding: 20rpx;
- border-radius: 50%;
- background-color: $u-theme-color;
- }
- .scoped-list-more-info {
- position: absolute;
- right: 20rpx;
- }
- </style>
|