index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-16 09:31:20
  6. * @Description: file content
  7. * @FilePath: \oms\pages\openSeaCustomer\index.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" @click="goBack()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>公海客户</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <view class="query-wrap">
  23. <view class="search-container">
  24. <view class="search-input">
  25. <u-input
  26. clearable
  27. placeholderStyle="font-size:26rpx"
  28. :customStyle="{ height: '66rpx' }"
  29. v-model="custName"
  30. prefixIcon="search"
  31. prefixIconStyle="font-size: 22px;color: #909399"
  32. placeholder="请输入客户名称"
  33. shape="circle"
  34. border="surround"
  35. @change="change"></u-input>
  36. </view>
  37. <view class="search-btn" @click="openFilter">筛选</view>
  38. <view class="search-btn" @click="searchList">搜索</view>
  39. </view>
  40. <!-- 筛选 -->
  41. <view class="filter-popup" v-if="filterVisible">
  42. <view class="filter-wrap">
  43. <view class="filter-item">
  44. <view class="tit">客户行业</view>
  45. <view class="menu-list">
  46. <view class="menu-item" v-for="(item, index) in industryOptions" :key="index">
  47. <u-tag
  48. shape="circle"
  49. :text="item.value"
  50. :plain="industryChecked != item.key"
  51. :name="item.key"
  52. @click="radioClick(item, 'industryChecked')"></u-tag>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- <view class="filter-item">
  57. <view class="tit">客户级别</view>
  58. <view class="menu-list">
  59. <view class="menu-item" v-for="(item, index) in levelOptions" :key="index">
  60. <u-tag
  61. shape="circle"
  62. :text="item.value"
  63. :plain="levelChecked != item.key"
  64. :name="item.key"
  65. @click="radioClick(item, 'levelChecked')"></u-tag>
  66. </view>
  67. </view>
  68. </view> -->
  69. <view class="filter-item">
  70. <view class="tit">最后跟进时间</view>
  71. <view class="menu-list">
  72. <u-button v-if="!followUpDate" type="primary" text="选择时间" @click="$refs.calendar.open()"></u-button>
  73. <view style="width: 100%" v-else @click="$refs.calendar.open()">
  74. {{ followUpDate }}
  75. </view>
  76. </view>
  77. </view>
  78. <view class="btn-box">
  79. <view class="reset" @click="reset()">重置</view>
  80. <view class="submit" @click="confirmFilter()">确定</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <scroll-view :scroll-top="scrollTop" :scroll-y="true" class="data-list" @scrolltolower="lower">
  86. <view>
  87. <view class="data-item" v-for="(v, i) in customerData" :key="i" @click="toDetails(v)">
  88. <view class="customer-name flex">
  89. <text class="name">{{ v.custName }}</text>
  90. <view class="user-code">
  91. <text>{{ v.custCode }}</text>
  92. </view>
  93. </view>
  94. <view class="customer-info flex">
  95. <view class="info-left flex_1">
  96. <view class="info-row flex_l">
  97. <text class="info-label">所在省市:</text>
  98. <u-text color="#323232" size="24rpx" :text="v.custProvince + '' + v.custCity"></u-text>
  99. </view>
  100. <view class="info-row flex_l">
  101. <text class="info-label">客户类别:</text>
  102. <u-text color="#323232" size="24rpx" :text="v.custIndustry"></u-text>
  103. </view>
  104. <view class="info-row flex_l">
  105. <text class="info-label">最后跟进时间:</text>
  106. <u-text color="#323232" size="24rpx" :text="v.followUpDate || '-'"></u-text>
  107. </view>
  108. <view class="flex_l">
  109. <view class="transfer-btn mr20" @click.stop="$refs.collection.open(v.id)">
  110. <u-button type="primary" size="small" text="领取"></u-button>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="info-right flex_l flex-column">
  115. <image class="user-img" src="@/static/images/user.jpg" mode="scaleToFill" />
  116. <u-text color="#646464" size="20rpx" :text="v.salesName"></u-text>
  117. </view>
  118. </view>
  119. </view>
  120. <u-loadmore :status="loadStatus" />
  121. </view>
  122. </scroll-view>
  123. </view>
  124. <!-- 新增按钮 -->
  125. <view class="fixed-btn center" @click="openAdd()">
  126. <u-icon name="plus" color="#fff" size="20"></u-icon>
  127. </view>
  128. <!-- 选择最后跟进日期 -->
  129. <uni-calendar ref="calendar" :insert="false" @confirm="pickDate" :clearDate="true" />
  130. <!-- 消息提示 -->
  131. <u-toast ref="uToast"></u-toast>
  132. <!-- 领用 -->
  133. <collection-customer ref="collection" @fetchList="searchList()"></collection-customer>
  134. </view>
  135. </template>
  136. <script>
  137. import customerApi from '../../api/customer'
  138. import to from 'await-to-js'
  139. import CollectionCustomer from '../openSeaCustomer/components/collectionCustomer'
  140. export default {
  141. name: 'omsIndex',
  142. components: { CollectionCustomer },
  143. data() {
  144. return {
  145. custStatus: {
  146. 10: '正常',
  147. 20: '异常',
  148. },
  149. height: '',
  150. paddingTop: '',
  151. pageNum: 0,
  152. pageSize: 10,
  153. customerData: [], //客户列表
  154. customerDataTotal: 0, //列表元素数量
  155. loadStatus: '', //加载状态
  156. filterVisible: false, //筛选组件状态
  157. custName: '', //客户名称
  158. followUpDate: '', //最后跟进时间
  159. industryChecked: 0, //选择的行业id
  160. industryOptions: [],
  161. // levelChecked: 0, //选择的级别id
  162. // levelOptions: [],
  163. }
  164. },
  165. created() {
  166. const navData = uni.getMenuButtonBoundingClientRect()
  167. this.height = navData.height + 'px'
  168. this.paddingTop = navData.top + 'px'
  169. },
  170. onShow() {
  171. this.getOptions()
  172. this.searchList()
  173. },
  174. methods: {
  175. getOptions() {
  176. Promise.all([this.getDicts('cust_idy')])
  177. .then(([industry]) => {
  178. // this.levelOptions = level.data.values || []
  179. this.industryOptions = industry.data.values || []
  180. })
  181. .catch((err) => console.log(err))
  182. },
  183. // 筛选下的单选
  184. radioClick(item, target) {
  185. console.log(item.key, target)
  186. this[target] = item.key
  187. },
  188. // 选择日期
  189. async pickDate(e) {
  190. console.log(e)
  191. this.followUpDate = e.fulldate
  192. },
  193. // 重置
  194. reset() {
  195. this.followUpDate = ''
  196. this.industryChecked = 0
  197. // this.levelChecked = 0
  198. },
  199. // 确认
  200. confirmFilter() {
  201. this.filterVisible = false
  202. this.searchList()
  203. },
  204. // 上拉滚动
  205. lower: function (e) {
  206. console.log(this.customerData.length)
  207. console.log(this.customerDataTotal)
  208. console.log(this.loadStatus)
  209. if (this.customerData.length < this.customerDataTotal && this.loadStatus != 'loading') {
  210. this.$u.throttle(this.getCustomerData(), 2000, false)
  211. }
  212. },
  213. // 查询列表
  214. searchList() {
  215. this.pageNum = 0
  216. this.getCustomerData(true)
  217. },
  218. async getCustomerData(reset) {
  219. this.loadStatus = 'loading'
  220. this.pageNum++
  221. let params = {
  222. custName: this.custName,
  223. followUpDate: this.followUpDate,
  224. indusTry: this.industryChecked,
  225. isPublic: true,
  226. pageNum: this.pageNum,
  227. pageSize: this.pageSize,
  228. }
  229. const [err, res] = await to(customerApi.getList(params))
  230. if (err) {
  231. this.loadStatus = 'nomore'
  232. return
  233. }
  234. if (res && res.code == 200 && res.data.total > 0) {
  235. if (reset) {
  236. this.customerData = res.data.list
  237. } else {
  238. this.customerData = [...this.customerData, ...res.data.list]
  239. }
  240. this.customerDataTotal = res.data.total
  241. this.loadStatus = this.customerData.length == this.customerDataTotal ? 'nomore' : 'loadmore'
  242. console.log(this.loadStatus)
  243. } else {
  244. this.loadStatus = 'nomore'
  245. }
  246. },
  247. openFilter() {
  248. if (this.filterVisible) {
  249. this.reset()
  250. this.filterVisible = false
  251. } else {
  252. this.filterVisible = true
  253. }
  254. },
  255. // 移入公海
  256. moveInOpenSea(item) {
  257. console.log(item)
  258. this.openSeaObj.ids = [item.id]
  259. this.showMoveInModel = true
  260. },
  261. goBack() {
  262. uni.navigateBack({
  263. //关闭当前页面,返回上一页面或多级页面。
  264. delta: 1,
  265. })
  266. },
  267. openAdd() {
  268. uni.navigateTo({
  269. //保留当前页面,跳转到应用内的某个页面
  270. url: '/pages/customer/add',
  271. })
  272. },
  273. toDetails(v) {
  274. uni.navigateTo({
  275. //保留当前页面,跳转到应用内的某个页面
  276. url: '/pages/customer/details?id=' + v.id + '&type=public',
  277. })
  278. },
  279. },
  280. }
  281. </script>
  282. <style>
  283. page {
  284. background: #f2f3f5;
  285. }
  286. </style>
  287. <style lang="scss" scoped>
  288. .home {
  289. padding-top: 188rpx;
  290. .nav {
  291. position: absolute;
  292. left: 0;
  293. top: 0;
  294. width: 100%;
  295. height: 284rpx;
  296. background: #3e7ef8;
  297. .title {
  298. position: relative;
  299. text-align: center;
  300. font-size: 32rpx;
  301. font-weight: bold;
  302. color: #ffffff;
  303. .back {
  304. position: absolute;
  305. top: 0;
  306. bottom: 0;
  307. margin: auto;
  308. left: 70rpx;
  309. display: flex;
  310. }
  311. }
  312. }
  313. .main {
  314. position: absolute;
  315. width: 100%;
  316. height: calc(100vh - 188rpx);
  317. background: #ffffff;
  318. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  319. border-radius: 31rpx 31rpx 0 0;
  320. padding: 0 32rpx;
  321. overflow: auto;
  322. padding-bottom: 64rpx;
  323. .query-wrap {
  324. padding-top: 20rpx;
  325. .search-container {
  326. display: flex;
  327. align-items: center;
  328. .search-input {
  329. flex: 1;
  330. }
  331. .search-btn {
  332. text-align: center;
  333. line-height: 60rpx;
  334. border-radius: 12rpx;
  335. width: 100rpx;
  336. height: 60rpx;
  337. font-size: 26rpx;
  338. margin: 0 0 0 12rpx;
  339. background: $u-primary;
  340. color: #ffffff;
  341. }
  342. }
  343. }
  344. .data-list {
  345. width: 100%;
  346. height: calc(100vh - 372rpx);
  347. overflow: auto;
  348. .data-item {
  349. background: rgba(242, 243, 245, 0.5);
  350. border-radius: 15rpx;
  351. padding: 28rpx 40rpx 28rpx 38rpx;
  352. margin-top: 32rpx;
  353. .customer-name {
  354. .name {
  355. flex: 1;
  356. color: #323232;
  357. font-weight: bold;
  358. font-size: 28rpx;
  359. margin-right: 12rpx;
  360. }
  361. .user-code {
  362. width: 180rpx;
  363. height: 32rpx;
  364. font-size: 24rpx;
  365. color: #323232;
  366. line-height: 32rpx;
  367. }
  368. }
  369. .customer-info {
  370. .info-left {
  371. .transfer-btn {
  372. margin-top: 20rpx;
  373. width: 150rpx;
  374. }
  375. .info-row {
  376. margin-top: 12rpx;
  377. .info-label {
  378. color: #646464;
  379. font-size: 24rpx;
  380. }
  381. }
  382. }
  383. .info-right {
  384. padding-top: 30rpx;
  385. .user-img {
  386. border-radius: 50%;
  387. width: 46rpx;
  388. height: 46rpx;
  389. }
  390. }
  391. }
  392. }
  393. }
  394. }
  395. .filter-popup {
  396. background: rgba(0, 0, 0, 0.8);
  397. position: fixed;
  398. width: 100%;
  399. height: 100%;
  400. left: 0;
  401. z-index: 1;
  402. .filter-wrap {
  403. width: 100%;
  404. padding: 20rpx;
  405. background: #ffffff;
  406. .filter-item {
  407. padding-bottom: 30rpx;
  408. .tit {
  409. font-size: 26rpx;
  410. color: #323232;
  411. font-weight: bold;
  412. padding-bottom: 20rpx;
  413. }
  414. .menu-list {
  415. display: flex;
  416. flex-wrap: wrap;
  417. .menu-item {
  418. margin-right: 40rpx;
  419. margin-bottom: 20rpx;
  420. }
  421. }
  422. }
  423. }
  424. .btn-box {
  425. width: 698rpx;
  426. height: 75px;
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. > view {
  431. width: 320rpx;
  432. height: 40px;
  433. border-radius: 40px;
  434. border: solid 1rpx #ec652b;
  435. align-items: center;
  436. justify-content: center;
  437. text-align: center;
  438. line-height: 40px;
  439. }
  440. .reset {
  441. color: #ec652b;
  442. }
  443. .submit {
  444. color: #fff;
  445. background-color: #ec652b;
  446. }
  447. }
  448. }
  449. }
  450. </style>