index.vue 12 KB

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