index.vue 10 KB

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