index.vue 9.1 KB

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