index.vue 9.1 KB

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