index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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. this[target] = item.key
  171. },
  172. // 选择日期
  173. async pickDate(e) {
  174. this.followUpDate = e.fulldate
  175. },
  176. // 重置
  177. reset() {
  178. this.followUpDate = ''
  179. this.industryChecked = ''
  180. // this.levelChecked = 0
  181. },
  182. // 确认
  183. confirmFilter() {
  184. this.filterVisible = false
  185. this.searchList()
  186. },
  187. // 上拉滚动
  188. lower() {
  189. // console.log(this.list.length)
  190. // console.log(this.customerDataTotal)
  191. // console.log(this.loadStatus)
  192. if (this.list.length < this.customerDataTotal && this.loadStatus != 'loading') {
  193. this.$u.throttle(this.fetchData(), 2000, false)
  194. }
  195. },
  196. // 查询列表
  197. searchList() {
  198. this.pageNum = 0
  199. this.fetchData(true)
  200. },
  201. async fetchData(reset) {
  202. this.loadStatus = 'loading'
  203. this.pageNum++
  204. let params = {
  205. approStatus: this.industryChecked,
  206. isPublic: false,
  207. pageNum: this.pageNum,
  208. pageSize: this.pageSize,
  209. contractName: this.contractName
  210. }
  211. const [err, res] = await to(contApi.getList(params))
  212. if (err) {
  213. this.loadStatus = 'nomore'
  214. return
  215. }
  216. if (res && res.code == 200) {
  217. if (reset) {
  218. this.list = res.data.list || []
  219. } else {
  220. this.list = [...this.list, ...(res.data.list || [])]
  221. }
  222. this.customerDataTotal = res.data.total
  223. this.loadStatus = this.list.length == this.customerDataTotal ? 'nomore' : 'loadmore'
  224. // console.log(this.loadStatus)
  225. } else {
  226. this.loadStatus = 'nomore'
  227. }
  228. },
  229. openFilter() {
  230. if (this.filterVisible) {
  231. this.reset()
  232. this.filterVisible = false
  233. } else {
  234. this.filterVisible = true
  235. }
  236. },
  237. goBack() {
  238. uni.navigateBack({
  239. //关闭当前页面,返回上一页面或多级页面。
  240. delta: 1,
  241. })
  242. },
  243. openAdd() {
  244. uni.navigateTo({
  245. //保留当前页面,跳转到应用内的某个页面
  246. url: '/pages/customer/add',
  247. })
  248. },
  249. toDetails(v) {
  250. uni.navigateTo({
  251. //保留当前页面,跳转到应用内的某个页面
  252. url: '/pages/contract/detail?id=' + v.id + '&type=private',
  253. })
  254. },
  255. },
  256. }
  257. </script>
  258. <style>
  259. page {
  260. background: #f2f3f5;
  261. }
  262. </style>
  263. <style lang="scss" scoped>
  264. .home {
  265. padding-top: 188rpx;
  266. .nav {
  267. position: absolute;
  268. left: 0;
  269. top: 0;
  270. width: 100%;
  271. height: 284rpx;
  272. background: #3e7ef8;
  273. .title {
  274. position: relative;
  275. text-align: center;
  276. font-size: 32rpx;
  277. font-weight: bold;
  278. color: #ffffff;
  279. .back {
  280. position: absolute;
  281. top: 0;
  282. bottom: 0;
  283. margin: auto;
  284. left: 70rpx;
  285. display: flex;
  286. }
  287. }
  288. }
  289. .main {
  290. position: absolute;
  291. width: 100%;
  292. height: calc(100vh - 188rpx);
  293. background: #ffffff;
  294. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  295. border-radius: 31rpx 31rpx 0 0;
  296. padding: 0 32rpx;
  297. overflow: hidden;
  298. padding-bottom: 64rpx;
  299. .query-wrap {
  300. padding-top: 20rpx;
  301. .search-container {
  302. display: flex;
  303. align-items: center;
  304. .search-input {
  305. flex: 1;
  306. }
  307. .search-btn {
  308. text-align: center;
  309. line-height: 60rpx;
  310. border-radius: 12rpx;
  311. width: 100rpx;
  312. height: 60rpx;
  313. font-size: 26rpx;
  314. margin: 0 0 0 12rpx;
  315. background: $u-primary;
  316. color: #ffffff;
  317. }
  318. }
  319. }
  320. .data-list {
  321. width: 100%;
  322. height: calc(100vh - 372rpx);
  323. overflow: auto;
  324. .data-item {
  325. background: rgba(242, 243, 245, 0.5);
  326. border-radius: 15rpx;
  327. padding: 28rpx 40rpx 28rpx 38rpx;
  328. margin-top: 32rpx;
  329. .customer-name {
  330. .name {
  331. flex: 1;
  332. color: #323232;
  333. font-weight: bold;
  334. font-size: 28rpx;
  335. margin-right: 12rpx;
  336. }
  337. .user-code {
  338. width: 180rpx;
  339. height: 32rpx;
  340. font-size: 24rpx;
  341. color: #323232;
  342. line-height: 32rpx;
  343. }
  344. }
  345. .customer-info {
  346. .info-left {
  347. .transfer-btn {
  348. margin-top: 20rpx;
  349. width: 150rpx;
  350. }
  351. .info-row {
  352. margin-top: 12rpx;
  353. .info-label {
  354. color: #646464;
  355. font-size: 24rpx;
  356. }
  357. }
  358. }
  359. .info-right {
  360. padding-top: 30rpx;
  361. .user-img {
  362. border-radius: 50%;
  363. width: 46rpx;
  364. height: 46rpx;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. }
  371. .filter-popup {
  372. background: rgba(0, 0, 0, 0.8);
  373. position: fixed;
  374. width: 100%;
  375. height: 100%;
  376. left: 0;
  377. z-index: 1;
  378. .filter-wrap {
  379. width: 100%;
  380. padding: 20rpx;
  381. background: #ffffff;
  382. .filter-item {
  383. padding-bottom: 30rpx;
  384. .tit {
  385. font-size: 26rpx;
  386. color: #323232;
  387. font-weight: bold;
  388. padding-bottom: 20rpx;
  389. }
  390. .menu-list {
  391. display: flex;
  392. flex-wrap: wrap;
  393. .menu-item {
  394. margin-right: 40rpx;
  395. margin-bottom: 20rpx;
  396. }
  397. }
  398. }
  399. }
  400. .btn-box {
  401. width: 698rpx;
  402. height: 75px;
  403. display: flex;
  404. align-items: center;
  405. justify-content: space-between;
  406. >view {
  407. width: 320rpx;
  408. height: 40px;
  409. border-radius: 40px;
  410. border: solid 1rpx #ec652b;
  411. align-items: center;
  412. justify-content: center;
  413. text-align: center;
  414. line-height: 40px;
  415. }
  416. .reset {
  417. color: #ec652b;
  418. }
  419. .submit {
  420. color: #fff;
  421. background-color: #ec652b;
  422. }
  423. }
  424. }
  425. }
  426. </style>