index.vue 14 KB

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