index.vue 12 KB

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