index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-27 17:46:12
  6. * @Description: file content
  7. * @FilePath: \oms\pages\distributor\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="distName"
  30. prefixIcon="search"
  31. prefixIconStyle="font-size: 22px;color: #909399"
  32. placeholder="请输入经销商名称"
  33. shape="circle"
  34. border="surround"></u-input>
  35. </view>
  36. <view class="search-btn" @click="searchList">搜索</view>
  37. </view>
  38. </view>
  39. <u-empty v-if="customerData.length == 0" mode="list" text="暂无数据"></u-empty>
  40. <scroll-view :scroll-y="true" class="data-list" @scrolltolower="lower" v-else>
  41. <view>
  42. <view class="data-item" v-for="(v, i) in customerData" :key="i" @click="toDetails(v)">
  43. <view class="customer-name flex">
  44. <text class="name">{{ v.distName }}</text>
  45. </view>
  46. <view class="customer-info flex">
  47. <view class="info-left flex_1">
  48. <view class="info-row flex_l">
  49. <text class="info-label">所在省份:</text>
  50. <u-text color="#323232" size="24rpx" :text="v.provinceDesc || '-'"></u-text>
  51. </view>
  52. <view class="info-row flex_l">
  53. <text class="info-label">业务范围:</text>
  54. <u-text color="#323232" size="24rpx" :text="v.businessScope || '-'"></u-text>
  55. </view>
  56. <view class="info-row flex_l">
  57. <text class="info-label">归属销售:</text>
  58. <u-text color="#323232" size="24rpx" :text="v.belongSale || '-'"></u-text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <u-loadmore :status="loadStatus" />
  64. </view>
  65. </scroll-view>
  66. </view>
  67. <!-- 新增按钮 -->
  68. <view class="fixed-btn center" @click="openAdd()">
  69. <u-icon name="plus" color="#fff" size="20"></u-icon>
  70. </view>
  71. <!-- 消息提示 -->
  72. <u-toast ref="uToast"></u-toast>
  73. </view>
  74. </template>
  75. <script>
  76. import distrApi from '../../api/base/distr'
  77. import to from 'await-to-js'
  78. export default {
  79. name: 'omsIndex',
  80. components: {},
  81. data() {
  82. return {
  83. height: '',
  84. paddingTop: '',
  85. pageNum: 0,
  86. pageSize: 10,
  87. customerData: [], //客户列表
  88. customerDataTotal: 0, //列表元素数量
  89. loadStatus: '', //加载状态
  90. distName: '', //经销商名称
  91. }
  92. },
  93. created() {
  94. const navData = uni.getMenuButtonBoundingClientRect()
  95. this.height = navData.height + 'px'
  96. this.paddingTop = navData.top + 'px'
  97. },
  98. onShow() {
  99. this.getOptions()
  100. this.searchList()
  101. },
  102. methods: {
  103. openAdd() {
  104. uni.navigateTo({
  105. //保留当前页面,跳转到应用内的某个页面
  106. url: '/pages/distributor/create',
  107. })
  108. },
  109. getOptions() {
  110. Promise.all([this.getDicts('cust_idy')])
  111. .then(([industry]) => {
  112. // this.levelOptions = level.data.values || []
  113. this.industryOptions = industry.data.values || []
  114. })
  115. .catch((err) => console.log(err))
  116. },
  117. // 确认
  118. confirmFilter() {
  119. this.searchList()
  120. },
  121. // 上拉滚动
  122. lower() {
  123. if (this.customerData.length < this.customerDataTotal && this.loadStatus != 'loading') {
  124. this.$u.throttle(this.getCustomerData(), 2000, false)
  125. }
  126. },
  127. // 查询列表
  128. searchList() {
  129. this.pageNum = 0
  130. this.getCustomerData(true)
  131. },
  132. async getCustomerData(reset) {
  133. this.loadStatus = 'loading'
  134. this.pageNum++
  135. let params = {
  136. distName: this.distName,
  137. pageNum: this.pageNum,
  138. pageSize: this.pageSize,
  139. }
  140. const [err, res] = await to(distrApi.getList(params))
  141. if (err) {
  142. this.loadStatus = 'nomore'
  143. return
  144. }
  145. if (res && res.code == 200) {
  146. if (reset) {
  147. this.customerData = res.data.list || []
  148. } else {
  149. this.customerData = [...this.customerData, ...(res.data.list || [])]
  150. }
  151. this.customerDataTotal = res.data.total
  152. this.loadStatus = this.customerData.length == this.customerDataTotal ? 'nomore' : 'loadmore'
  153. } else {
  154. this.loadStatus = 'nomore'
  155. }
  156. },
  157. goBack() {
  158. uni.navigateBack({
  159. //关闭当前页面,返回上一页面或多级页面。
  160. delta: 1,
  161. })
  162. },
  163. toDetails(v) {
  164. uni.navigateTo({
  165. //保留当前页面,跳转到应用内的某个页面
  166. url: '/pages/distributor/details?id=' + v.id,
  167. })
  168. },
  169. },
  170. }
  171. </script>
  172. <style>
  173. page {
  174. background: #f2f3f5;
  175. }
  176. </style>
  177. <style lang="scss" scoped>
  178. .home {
  179. padding-top: 188rpx;
  180. .nav {
  181. position: absolute;
  182. left: 0;
  183. top: 0;
  184. width: 100%;
  185. height: 284rpx;
  186. background: #3e7ef8;
  187. .title {
  188. position: relative;
  189. text-align: center;
  190. font-size: 32rpx;
  191. font-weight: bold;
  192. color: #ffffff;
  193. .back {
  194. position: absolute;
  195. top: 0;
  196. bottom: 0;
  197. margin: auto;
  198. left: 70rpx;
  199. display: flex;
  200. }
  201. }
  202. }
  203. .main {
  204. position: absolute;
  205. width: 100%;
  206. height: calc(100vh - 188rpx);
  207. background: #ffffff;
  208. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  209. border-radius: 31rpx 31rpx 0 0;
  210. padding: 0 32rpx;
  211. overflow: auto;
  212. padding-bottom: 64rpx;
  213. .query-wrap {
  214. padding-top: 20rpx;
  215. .search-container {
  216. display: flex;
  217. align-items: center;
  218. .search-input {
  219. flex: 1;
  220. }
  221. .search-btn {
  222. text-align: center;
  223. line-height: 60rpx;
  224. border-radius: 12rpx;
  225. width: 100rpx;
  226. height: 60rpx;
  227. font-size: 26rpx;
  228. margin: 0 0 0 12rpx;
  229. background: $u-primary;
  230. color: #ffffff;
  231. }
  232. }
  233. }
  234. .data-list {
  235. width: 100%;
  236. height: calc(100vh - 372rpx);
  237. overflow: auto;
  238. .data-item {
  239. background: rgba(242, 243, 245, 0.5);
  240. border-radius: 15rpx;
  241. padding: 28rpx 40rpx 28rpx 38rpx;
  242. margin-top: 32rpx;
  243. .customer-name {
  244. .name {
  245. flex: 1;
  246. color: #323232;
  247. font-weight: bold;
  248. font-size: 28rpx;
  249. margin-right: 12rpx;
  250. }
  251. .user-code {
  252. width: 180rpx;
  253. height: 32rpx;
  254. font-size: 24rpx;
  255. color: #323232;
  256. line-height: 32rpx;
  257. }
  258. }
  259. .customer-info {
  260. .info-left {
  261. .transfer-btn {
  262. margin-top: 20rpx;
  263. width: 150rpx;
  264. }
  265. .info-row {
  266. margin-top: 12rpx;
  267. .info-label {
  268. color: #646464;
  269. font-size: 24rpx;
  270. }
  271. }
  272. }
  273. .info-right {
  274. padding-top: 30rpx;
  275. .user-img {
  276. border-radius: 50%;
  277. width: 46rpx;
  278. height: 46rpx;
  279. }
  280. }
  281. }
  282. }
  283. }
  284. }
  285. .filter-popup {
  286. background: rgba(0, 0, 0, 0.8);
  287. position: fixed;
  288. width: 100%;
  289. height: 100%;
  290. left: 0;
  291. z-index: 1;
  292. .filter-wrap {
  293. width: 100%;
  294. padding: 20rpx;
  295. background: #ffffff;
  296. .filter-item {
  297. padding-bottom: 30rpx;
  298. .tit {
  299. font-size: 26rpx;
  300. color: #323232;
  301. font-weight: bold;
  302. padding-bottom: 20rpx;
  303. }
  304. .menu-list {
  305. display: flex;
  306. flex-wrap: wrap;
  307. .menu-item {
  308. margin-right: 40rpx;
  309. margin-bottom: 20rpx;
  310. }
  311. }
  312. }
  313. }
  314. .btn-box {
  315. width: 698rpx;
  316. height: 75px;
  317. display: flex;
  318. align-items: center;
  319. justify-content: space-between;
  320. > view {
  321. width: 320rpx;
  322. height: 40px;
  323. border-radius: 40px;
  324. border: solid 1rpx #ec652b;
  325. align-items: center;
  326. justify-content: center;
  327. text-align: center;
  328. line-height: 40px;
  329. }
  330. .reset {
  331. color: #ec652b;
  332. }
  333. .submit {
  334. color: #fff;
  335. background-color: #ec652b;
  336. }
  337. }
  338. }
  339. }
  340. </style>