CustomerList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. <template>
  2. <view>
  3. <view class="top-view">
  4. <u-navbar :border-bottom="false" :is-back="false" title-color="#fff" title=" " :background="nav_background">
  5. <view class="headline">
  6. <u-search
  7. height="72"
  8. placeholder-color="#879BBA"
  9. bg-color="#ECF0F7"
  10. :show-action="false"
  11. :clearabled="true"
  12. color="#879BBA"
  13. @search="searchConfirm"
  14. placeholder="客户名称/手机号…"
  15. @clear="searchConfirm"
  16. v-model="search_form.keyword"
  17. ></u-search>
  18. </view>
  19. </u-navbar>
  20. <view class="tabs-view">
  21. <u-tabs-swiper
  22. ref="tabs"
  23. font-size="26"
  24. :current="tabs_current"
  25. :list="tabs_list"
  26. @change="tabsChange"
  27. :is-scroll="false"
  28. inactive-color="#62738E"
  29. :bar-style="{ borderRadius: '6rpx', height: '6rpx', width: '32rpx', backgroundColor: '#4076D6' }"
  30. :active-item-style="{ color: '#2D405E', fontSize: '32rpx' }"
  31. ></u-tabs-swiper>
  32. <view class="search-view clearfix">
  33. <view class="title ellipsis" @click="openSel('account_status_show')">
  34. <u-icon
  35. size="12"
  36. label-pos="left"
  37. label-color="#62738e"
  38. color="#b8c0c8"
  39. label-size="26"
  40. :label="account_status_name"
  41. name="arrow-down-fill"
  42. class="ico"
  43. ></u-icon>
  44. </view>
  45. <view class="title ellipsis" @click="goPage('/pagesT/shop/selShop')">
  46. <u-icon size="12" label-pos="left" label-color="#62738e" color="#b8c0c8" label-size="26" :label="shop_name" name="arrow-down-fill" class="ico"></u-icon>
  47. </view>
  48. <view class="title ellipsis" @click="goPage('/pagesT/staff/selStaff')">
  49. <u-icon size="12" label-pos="left" label-color="#62738e" color="#b8c0c8" label-size="26" :label="salesName" name="arrow-down-fill" class="ico"></u-icon>
  50. </view>
  51. <!-- <view class="title ellipsis" @click="openSel('from_show')">
  52. <u-icon size="12" label-pos="left" label-color="#62738e" color="#b8c0c8" label-size="26" :label="sourceName" name="arrow-down-fill" class="ico"></u-icon>
  53. </view> -->
  54. <view class="title" @click="clearValue()">
  55. <u-icon label="重置" name="reload" label-color="#62738E" color="#62738E" margin-left="8" size="24" label-size="26"></u-icon>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="explain">
  60. <view class="float_left">
  61. <text>全部</text>
  62. <text v-if="tabs_current === 1">待审核</text>
  63. <text v-else-if="tabs_current === 2">待完善资料</text>
  64. <text v-else>已审核</text>
  65. </view>
  66. <view class="float_right">共{{ total }}条</view>
  67. </view>
  68. </view>
  69. <scroll-view
  70. class="list-ul"
  71. scroll-y="true"
  72. @refresherrefresh="refresherrefresh"
  73. :refresher-enabled="true"
  74. :refresher-triggered="refresher_triggered"
  75. @scrolltolower="scrolltolower"
  76. >
  77. <view class="list-li" v-for="(item, index) in customer_list" :key="index" @click="goPage(`/pagesT/customer/CustomerDetail?id=${item.id}`)">
  78. <view class="title clearfix">
  79. <view class="float_left ellipsis" style="margin-left: 40rpx; width: 350rpx;">业务员:{{ item.salesManName || '未设置' }}</view>
  80. <view class="float_right" style="margin-right: 40rpx;">{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  81. </view>
  82. <view class="list-cont">
  83. <view class="list-cont-li clearfix">
  84. <view class="type-view" v-if="item.customerType">{{ item.customerType }}</view>
  85. <view class="custom-name">{{ item.name }}</view>
  86. <view v-if="item.enableStatus === 5" class="float_right" style="margin-right: 40rpx;margin-top: 4rpx;">
  87. <image src="../../static/img/start-using@2x.png" class="audit"></image>
  88. </view>
  89. <view v-else class="float_right" style="margin-right: 40rpx;margin-top: 4rpx;"><image src="../../static/img/forbidden.png" class="audit"></image></view>
  90. </view>
  91. <view class="list-cont-li">
  92. <text class="label">联系人</text>
  93. {{ item.contact[0].name || '无' }}
  94. </view>
  95. <view class="list-cont-li" style="line-height: 48rpx;height: 48rpx;">
  96. <text class="label">联系电话</text>
  97. <text @click.stop="callPhone(item.mobile)">{{ item.mobile }}</text>
  98. <view @click.stop="orderAdd(item)" class="float_right btn" v-if="item.status === 2 && item.enableStatus === 5">代客下单</view>
  99. <view @click.stop="goPage('/pagesT/customer/AddCustomer?id=' + item.id)" class="float_right btn" v-else-if="item.status === 0">完善资料</view>
  100. <block v-else-if="item.status === 1">
  101. <view @click.stop="openModel('确定要审核通过该客户吗?', '审核', item)" class="float_right btn" style="padding: 8rpx 21rpx;">审核通过</view>
  102. </block>
  103. </view>
  104. </view>
  105. </view>
  106. <view v-if="!customer_list.length" class="empty-view"><u-empty text="暂无客户" mode="list"></u-empty></view>
  107. <u-loadmore v-if="customer_list.length" :status="load_status" />
  108. </scroll-view>
  109. <addBtn v-if="$accessCheck($Access.CustomerListAddCustomer)" url="/pagesT/customer/AddCustomer"></addBtn>
  110. <u-popup v-model="search_show" mode="right">
  111. <view class="search-pop">
  112. <uniStatusBar></uniStatusBar>
  113. <view class="form-view" style="padding-top: 45px;">
  114. <u-form label-width="160rpx" label-position="left">
  115. <!-- <u-form-item label="注册来源">
  116. <view class="clearfix form-val" @click="openSel('from_show')">
  117. <text class="float_left ellipsis">{{ search_form.source ? sourceName : '请选择' }}</text>
  118. <view class="float_right" @click.stop="clearValue('source')">
  119. <u-icon :name="!search_form.source ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  120. </view>
  121. </view>
  122. </u-form-item> -->
  123. <u-form-item label="下单时间">
  124. <view class="clearfix form-val" @click="openSel('month_show')">
  125. <text class="float_left ellipsis">{{ search_form.time_value ? search_form.time_name : '请选择' }}</text>
  126. <view class="float_right" @click.stop="clearValue('time_value')">
  127. <u-icon :name="!search_form.time_value ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  128. </view>
  129. </view>
  130. </u-form-item>
  131. </u-form>
  132. </view>
  133. <view class="search-btn">
  134. <view class="btn-li" @click="clearValue()">重置</view>
  135. <view class="btn-li" @click="searchConfirm">确定</view>
  136. </view>
  137. </view>
  138. </u-popup>
  139. <u-select @confirm="fromChange" v-model="from_show" :list="order_from"></u-select>
  140. <u-select @confirm="accountStatusChange" v-model="account_status_show" :list="account_status"></u-select>
  141. <SelDeparment v-model="show_department" @confirm="departmentConfirm" @cancel="departmentCancel" />
  142. <RegionSel v-model="region_show" @confirm="regionConfirm" @cancel="regionCancel" />
  143. <u-modal v-model="model_show" :show-cancel-button="true" :content="model_content" @confirm="modelConfirm" @cancel="modelCancel"></u-modal>
  144. <u-select v-model="month_show" :list="tabs_list1" @confirm="confirm"></u-select>
  145. <!-- 底部tabbar -->
  146. <Tabbar v-model="tabbar_current"></Tabbar>
  147. </view>
  148. </template>
  149. <script>
  150. import RegionSel from '@/components/region/RegionSel.vue';
  151. import SelDeparment from '@/components/SelDepartment.vue';
  152. import uniStatusBar from '../../components/uni-status-bar.vue';
  153. export default {
  154. components: {
  155. RegionSel,
  156. SelDeparment,
  157. uniStatusBar
  158. },
  159. data() {
  160. return {
  161. refresher_triggered: false, //设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
  162. tabbar_current: 3,
  163. nav_background: {
  164. backgroundColor: '#fff'
  165. },
  166. model_tag: '',
  167. model_show: false,
  168. model_content: '',
  169. from_show: false,
  170. show_department: false,
  171. region_show: false,
  172. search_show: false,
  173. customer_list: [],
  174. load_status: 'nomore',
  175. page: 1,
  176. pageSize: 10,
  177. total: 0,
  178. tabs_current: 0,
  179. status: 2,
  180. salesName: '业务员',
  181. staffData: '',
  182. region_name: '',
  183. shopData: '',
  184. shop_name: '所属店铺',
  185. department_name: '',
  186. sourceName: '注册来源',
  187. search_form: {
  188. keyword: '',
  189. type: '',
  190. // provinceCode: '',
  191. // cityCode: '',
  192. // districtCode: '',
  193. enableStatus: 5,
  194. // departmentId: '',
  195. shopId: '', // 商铺Id
  196. content: '',
  197. salesManId: '',
  198. source: '',
  199. tag: '',
  200. time_name: '',
  201. time_value: ''
  202. },
  203. handel_data: {}, // 需要操作的客户
  204. order_from: [
  205. {
  206. label: 'ios',
  207. value: 1
  208. },
  209. {
  210. label: '安卓',
  211. value: 2
  212. },
  213. {
  214. label: '微信小程序',
  215. value: 3
  216. },
  217. {
  218. label: '后台创建',
  219. value: 4
  220. },
  221. {
  222. label: 'H5页面',
  223. value: 5
  224. },
  225. {
  226. label: 'pc页面',
  227. value: 6
  228. },
  229. {
  230. label: '字节跳动小程序',
  231. value: 8
  232. }
  233. ],
  234. account_status: [
  235. {
  236. value: 5,
  237. label: '已启用'
  238. },
  239. {
  240. value: 4,
  241. label: '已禁用'
  242. }
  243. ],
  244. tabs_list: [
  245. {
  246. value: 2,
  247. name: '已审核'
  248. },
  249. {
  250. value: 1,
  251. name: '待审核'
  252. },
  253. {
  254. value: 0,
  255. name: '待完善'
  256. }
  257. ],
  258. account_status_show: false,
  259. account_status_name: '状态',
  260. tabs_list1: [
  261. {
  262. label: '当月',
  263. value: 0
  264. },
  265. {
  266. label: '当日',
  267. value: 1
  268. }
  269. ],
  270. month_show: false
  271. };
  272. },
  273. watch: {
  274. staffData(val) {
  275. if (val) {
  276. this.search_form.salesManId = val.id;
  277. this.salesName = val.staffName;
  278. this.page = 1;
  279. this.getAllCustomer();
  280. }
  281. },
  282. shopData(val) {
  283. if (val) {
  284. this.search_form.shopId = val.id;
  285. this.shop_name = val.name;
  286. this.page = 1;
  287. this.getAllCustomer();
  288. }
  289. }
  290. },
  291. onLoad() {
  292. this.getAllCustomer();
  293. },
  294. methods: {
  295. //滚动到底部,上拉加载
  296. scrolltolower() {
  297. if (this.total / this.pageSize > this.page) {
  298. this.page += 1;
  299. this.getAllCustomer();
  300. }
  301. },
  302. //客户审核
  303. updateCustomerCheckStatus() {
  304. this.$u.api
  305. .updateCustomerCheckStatus({
  306. id: this.handel_data.id,
  307. status: 2
  308. })
  309. .then(res => {
  310. this.getAllCustomer();
  311. this.$u.toast('审核成功');
  312. });
  313. },
  314. //代客下单
  315. orderAdd(item) {
  316. const obj = {
  317. shopId: item.shopId,
  318. userCenterId: item.userCenterId,
  319. customerId: item.id,
  320. customerName: item.name
  321. };
  322. this.goPage('/pages/order/OrderAdd?customer=' + JSON.stringify(obj));
  323. },
  324. // 状态切换
  325. tabsChange(index) {
  326. this.tabs_current = index;
  327. this.status = this.tabs_list[index].value;
  328. this.page = 1;
  329. this.getAllCustomer();
  330. },
  331. // 获取所有客户数据
  332. getAllCustomer() {
  333. if (!this.$accessCheck(this.$Access.CustomerListGetCustomerInfo)) {
  334. this.$u.toast('抱歉,您没有权限');
  335. return;
  336. }
  337. this.load_status = 'loading';
  338. this.$u.api
  339. .getAllCustomer({
  340. page: this.page,
  341. pageSize: this.pageSize,
  342. status: this.status,
  343. ...this.search_form
  344. })
  345. .then(res => {
  346. // 设置当前下拉刷新状态为false
  347. this.refresher_triggered = false;
  348. if (this.page === 1) {
  349. this.customer_list = res.data;
  350. } else {
  351. this.customer_list = this.customer_list.concat(res.data);
  352. }
  353. this.total = res.pageTotal;
  354. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  355. })
  356. .catch(err => {
  357. // 设置当前下拉刷新状态为false
  358. this.refresher_triggered = false;
  359. });
  360. },
  361. statusChange(row) {
  362. this.search_form.enableStatus = row.value;
  363. },
  364. regionConfirm(val) {
  365. this.search_form.provinceCode = val[0].value;
  366. this.search_form.cityCode = val[1].value;
  367. this.search_form.districtCode = val[2].value;
  368. let name = '';
  369. val.forEach(item => {
  370. name += item.label;
  371. });
  372. this.region_name = name;
  373. },
  374. regionCancel(val) {
  375. this.region_show = false;
  376. },
  377. departmentConfirm(val) {
  378. this.search_form.departmentId = val[val.length - 1].value;
  379. this.department_name = val[val.length - 1].label;
  380. this.search_form.salesManId = '';
  381. this.salesName = '';
  382. },
  383. departmentCancel(val) {
  384. this.show_department = false;
  385. },
  386. // 来源筛选
  387. fromChange(e) {
  388. this.search_form.source = e[0].value;
  389. this.sourceName = e[0].label;
  390. this.page = 1;
  391. this.getAllCustomer();
  392. },
  393. openSel(key) {
  394. this[key] = true;
  395. },
  396. searchConfirm() {
  397. this.search_show = false;
  398. this.page = 1;
  399. this.getAllCustomer();
  400. },
  401. clearValue(params) {
  402. if (!params) {
  403. this.sourceName = '注册来源';
  404. this.shop_name = '所属店铺';
  405. this.salesName = '业务员';
  406. this.account_status_name = '状态';
  407. this.search_form = {
  408. keyword: '',
  409. type: '',
  410. // provinceCode: '',
  411. // cityCode: '',
  412. // districtCode: '',
  413. enableStatus: 5,
  414. // departmentId: '',
  415. shopId: '', // 商铺Id
  416. content: '',
  417. salesManId: '',
  418. source: '',
  419. tag: '',
  420. time_name: '',
  421. time_value: ''
  422. };
  423. this.searchConfirm();
  424. } else {
  425. if (Array.isArray(params)) {
  426. params.forEach(item => {
  427. this.search_form[item] = '';
  428. });
  429. this.region_name = '';
  430. } else {
  431. this.search_form[params] = '';
  432. }
  433. }
  434. },
  435. // 打开提示框
  436. openModel(content, tag, row) {
  437. this.model_content = content;
  438. this.model_show = true;
  439. this.model_tag = tag;
  440. this.handel_data = row;
  441. },
  442. // 审核
  443. modelConfirm() {
  444. switch (this.model_tag) {
  445. case '审核':
  446. this.updateCustomerCheckStatus();
  447. break;
  448. case '拒绝':
  449. this.revokeAudit();
  450. break;
  451. }
  452. },
  453. modelCancel() {},
  454. accountStatusChange(e) {
  455. this.search_form.enableStatus = e[0].value;
  456. this.account_status_name = e[0].label;
  457. this.page = 1;
  458. this.getAllCustomer();
  459. },
  460. confirm(val) {
  461. this.search_form.time_value = val[0].value;
  462. this.search_form.time_name = val[0].label;
  463. },
  464. callPhone(mobile) {
  465. uni.makePhoneCall({
  466. phoneNumber: mobile
  467. });
  468. },
  469. // 下拉刷新
  470. refresherrefresh() {
  471. this.refresher_triggered = true;
  472. this.page = 1;
  473. this.getAllCustomer();
  474. }
  475. }
  476. };
  477. </script>
  478. <style lang="scss" scoped>
  479. .headline {
  480. margin-left: 20rpx;
  481. margin-top: 10rpx;
  482. margin-bottom: 18rpx;
  483. /*#ifdef APP-PLUS*/
  484. width: 710rpx;
  485. /*#endif*/
  486. /*#ifdef MP-WEIXIN*/
  487. width: 480rpx;
  488. /*#endif*/
  489. height: 72rpx;
  490. }
  491. .top-view {
  492. // padding-top: var(--status-bar-height);
  493. .tabs-view {
  494. width: 100%;
  495. background-color: #ffffff;
  496. .search-view {
  497. width: 100%;
  498. border-top: 1px solid #ecf0f7;
  499. display: flex;
  500. .title {
  501. flex: 5;
  502. height: 84rpx;
  503. text-align: center;
  504. font-weight: 400;
  505. line-height: 84rpx;
  506. }
  507. }
  508. }
  509. .explain {
  510. width: 100%;
  511. height: 76rpx;
  512. line-height: 76rpx;
  513. color: #879bba;
  514. font-size: 24rpx;
  515. padding: 0 28rpx 0 32rpx;
  516. transform: translateY(-6rpx);
  517. }
  518. }
  519. .list-ul {
  520. height: calc(100vh - 460rpx);
  521. z-index: 1;
  522. .list-li {
  523. width: 710rpx;
  524. margin: 0 auto 24rpx;
  525. background-color: #ffffff;
  526. border-radius: 8rpx;
  527. .title {
  528. line-height: 76rpx;
  529. border-bottom: 1px solid #ecf0f7;
  530. font-size: 24rpx;
  531. color: #cad0d7;
  532. font-weight: 400;
  533. .float_rigth {
  534. .custom-icon-jinru {
  535. margin-left: 10rpx;
  536. font-size: 28rpx;
  537. }
  538. }
  539. }
  540. .list-cont {
  541. padding-bottom: 40rpx;
  542. .list-cont-li {
  543. margin-top: 24rpx;
  544. line-height: 40rpx;
  545. font-size: 28rpx;
  546. font-family: DINPro-Regular;
  547. font-weight: 400;
  548. color: #2d405e;
  549. border-radius: 8rpx;
  550. padding-left: 40rpx;
  551. .type-view {
  552. margin-right: 16rpx;
  553. display: inline-block;
  554. width: 126rpx;
  555. height: 40rpx;
  556. background: url(../../static/img/type_bg.png) no-repeat center center;
  557. background-size: 100% 100%;
  558. vertical-align: middle;
  559. color: #ffffff;
  560. font-size: 24rpx;
  561. font-weight: 400;
  562. line-height: 40rpx;
  563. text-align: center;
  564. }
  565. .custom-name {
  566. font-family: DIN-Medium;
  567. display: inline-block;
  568. vertical-align: middle;
  569. width: 400rpx;
  570. line-height: 36rpx;
  571. font-weight: 600;
  572. }
  573. .audit {
  574. width: 78rpx;
  575. height: 30rpx;
  576. }
  577. .label {
  578. display: inline-block;
  579. width: 114rpx;
  580. font-weight: 300;
  581. font-size: 28rpx;
  582. color: #b8c0c8;
  583. margin-right: 30rpx;
  584. }
  585. .btn {
  586. width: 178rpx;
  587. height: 48rpx;
  588. line-height: 48rpx;
  589. text-align: center;
  590. border: 1px solid #b8c0c8;
  591. font-size: 24rpx;
  592. font-weight: 400;
  593. color: #2d405e;
  594. border-radius: 8rpx;
  595. margin-right: 40rpx;
  596. }
  597. }
  598. }
  599. }
  600. }
  601. </style>