index.vue 14 KB

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