index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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. // console.log(this.loadStatus)
  154. } else {
  155. this.loadStatus = 'nomore'
  156. }
  157. },
  158. goBack() {
  159. uni.navigateBack({
  160. //关闭当前页面,返回上一页面或多级页面。
  161. delta: 1,
  162. })
  163. },
  164. toDetails(v) {
  165. uni.navigateTo({
  166. //保留当前页面,跳转到应用内的某个页面
  167. url: '/pages/distributor/details?id=' + v.id,
  168. })
  169. },
  170. },
  171. }
  172. </script>
  173. <style>
  174. page {
  175. background: #f2f3f5;
  176. }
  177. </style>
  178. <style lang="scss" scoped>
  179. .home {
  180. padding-top: 188rpx;
  181. .nav {
  182. position: absolute;
  183. left: 0;
  184. top: 0;
  185. width: 100%;
  186. height: 284rpx;
  187. background: #3e7ef8;
  188. .title {
  189. position: relative;
  190. text-align: center;
  191. font-size: 32rpx;
  192. font-weight: bold;
  193. color: #ffffff;
  194. .back {
  195. position: absolute;
  196. top: 0;
  197. bottom: 0;
  198. margin: auto;
  199. left: 70rpx;
  200. display: flex;
  201. }
  202. }
  203. }
  204. .main {
  205. position: absolute;
  206. width: 100%;
  207. height: calc(100vh - 188rpx);
  208. background: #ffffff;
  209. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  210. border-radius: 31rpx 31rpx 0 0;
  211. padding: 0 32rpx;
  212. overflow: auto;
  213. padding-bottom: 64rpx;
  214. .query-wrap {
  215. padding-top: 20rpx;
  216. .search-container {
  217. display: flex;
  218. align-items: center;
  219. .search-input {
  220. flex: 1;
  221. }
  222. .search-btn {
  223. text-align: center;
  224. line-height: 60rpx;
  225. border-radius: 12rpx;
  226. width: 100rpx;
  227. height: 60rpx;
  228. font-size: 26rpx;
  229. margin: 0 0 0 12rpx;
  230. background: $u-primary;
  231. color: #ffffff;
  232. }
  233. }
  234. }
  235. .data-list {
  236. width: 100%;
  237. height: calc(100vh - 372rpx);
  238. overflow: auto;
  239. .data-item {
  240. background: rgba(242, 243, 245, 0.5);
  241. border-radius: 15rpx;
  242. padding: 28rpx 40rpx 28rpx 38rpx;
  243. margin-top: 32rpx;
  244. .customer-name {
  245. .name {
  246. flex: 1;
  247. color: #323232;
  248. font-weight: bold;
  249. font-size: 28rpx;
  250. margin-right: 12rpx;
  251. }
  252. .user-code {
  253. width: 180rpx;
  254. height: 32rpx;
  255. font-size: 24rpx;
  256. color: #323232;
  257. line-height: 32rpx;
  258. }
  259. }
  260. .customer-info {
  261. .info-left {
  262. .transfer-btn {
  263. margin-top: 20rpx;
  264. width: 150rpx;
  265. }
  266. .info-row {
  267. margin-top: 12rpx;
  268. .info-label {
  269. color: #646464;
  270. font-size: 24rpx;
  271. }
  272. }
  273. }
  274. .info-right {
  275. padding-top: 30rpx;
  276. .user-img {
  277. border-radius: 50%;
  278. width: 46rpx;
  279. height: 46rpx;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. }
  286. .filter-popup {
  287. background: rgba(0, 0, 0, 0.8);
  288. position: fixed;
  289. width: 100%;
  290. height: 100%;
  291. left: 0;
  292. z-index: 1;
  293. .filter-wrap {
  294. width: 100%;
  295. padding: 20rpx;
  296. background: #ffffff;
  297. .filter-item {
  298. padding-bottom: 30rpx;
  299. .tit {
  300. font-size: 26rpx;
  301. color: #323232;
  302. font-weight: bold;
  303. padding-bottom: 20rpx;
  304. }
  305. .menu-list {
  306. display: flex;
  307. flex-wrap: wrap;
  308. .menu-item {
  309. margin-right: 40rpx;
  310. margin-bottom: 20rpx;
  311. }
  312. }
  313. }
  314. }
  315. .btn-box {
  316. width: 698rpx;
  317. height: 75px;
  318. display: flex;
  319. align-items: center;
  320. justify-content: space-between;
  321. > view {
  322. width: 320rpx;
  323. height: 40px;
  324. border-radius: 40px;
  325. border: solid 1rpx #ec652b;
  326. align-items: center;
  327. justify-content: center;
  328. text-align: center;
  329. line-height: 40px;
  330. }
  331. .reset {
  332. color: #ec652b;
  333. }
  334. .submit {
  335. color: #fff;
  336. background-color: #ec652b;
  337. }
  338. }
  339. }
  340. }
  341. </style>