selectServiceProvider.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="search-box">
  3. <up-search placeholder="搜索关键词" v-model="keyword" height="35" @blur="onSearch" :clearabled="false"
  4. :showAction="false" />
  5. <view v-if="content.where.condition" class="clear" @click.stop="onSearch('')">
  6. <up-icon name="close-circle-fill" size="20" />
  7. </view>
  8. </view>
  9. <view style="height: 20rpx; " />
  10. <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
  11. <view class="item" hover-class="navigator-hover" v-for="item in list" :key="item.sys_enterpriseid"
  12. @click="selected(item)">
  13. <view class="content" >
  14. <view class="row" style="font-size: 30rpx;font-weight: bold;">
  15. {{ item.enterprisename || ' --' }}
  16. </view>
  17. <view class="row" style="color: #276BF0;" @click.stop="callPhonenumber(item.phonenumber)">
  18. <text class="label">
  19. 联系方式
  20. </text>
  21. {{ item.phonenumber || ' --' }}
  22. </view>
  23. <view class="row">
  24. <text class="label">
  25. 服务商简称
  26. </text>
  27. {{ item.abbreviation || ' --' }}
  28. </view>
  29. <view class="row">
  30. <text class="label">
  31. 服务区域
  32. </text>
  33. {{ item.salearea || ' --' }}
  34. </view>
  35. <view class="row">
  36. <text class="label">
  37. 省市县
  38. </text>
  39. {{ item.province ? item.province + item.city + item.county : ' --' }}
  40. </view>
  41. <view class="row">
  42. <text class="label">
  43. 地址
  44. </text>
  45. {{ item.address || ' --' }}
  46. </view>
  47. <view class="row">
  48. <text class="label">
  49. 合作状态
  50. </text>
  51. {{ item.signingstate || ' --' }}
  52. </view>
  53. </view>
  54. </view>
  55. <view style="height: 30px;" />
  56. </My_listbox>
  57. </template>
  58. <script setup>
  59. import { ref, reactive, getCurrentInstance } from 'vue';
  60. const { $Http } = getCurrentInstance().proxy;
  61. import { onLoad } from '@dcloudio/uni-app';
  62. const keyword = ref('');
  63. const listBox = ref(null);
  64. const content = reactive({
  65. loading: false,
  66. "pageNumber": 1,
  67. "pageSize": 20,
  68. "where": {
  69. "condition": "",
  70. status: "1"
  71. }
  72. });
  73. function onSearch(e) {
  74. if (content.where.condition == e) return;
  75. content.where.condition = e;
  76. keyword.value = e;
  77. getList(true);
  78. }
  79. const list = ref([])
  80. onLoad(() => {
  81. getList();
  82. });
  83. function getList(init = false) {
  84. if (content.loading) {
  85. listBox.value.refreshToComplete();
  86. listBox.value.setHeight();
  87. return
  88. };
  89. content.loading = true;
  90. if (init) content.pageNumber = 1;
  91. $Http.basic({
  92. "id": "20230427101304",
  93. content
  94. }).then(res => {
  95. content.loading = false;
  96. if (res.code != 1) return uni.showToast({
  97. title: res.msg,
  98. icon: 'none'
  99. });
  100. console.log("获取客户档案列表", res)
  101. listBox.value.refreshToComplete();
  102. listBox.value.setHeight();
  103. if (res.code == 1) {
  104. list.value = reactive(res.firstPage ? res.data : list.value.concat(res.data));
  105. content.pageTotal = res.pageTotal;
  106. content.pageNumber = res.pageNumber;
  107. } else {
  108. if (res.msg) uni.showToast({
  109. title: res.msg,
  110. icon: 'none'
  111. });
  112. }
  113. })
  114. }
  115. function callPhonenumber(item) {
  116. if (!item) return;
  117. uni.makePhoneCall({
  118. phoneNumber: item
  119. });
  120. }
  121. function selected(item) {
  122. $Http.onSelectServiceProvider && $Http.onSelectServiceProvider(item)
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .search-box {
  127. position: relative;
  128. padding: 20rpx;
  129. background: #fff;
  130. .clear {
  131. position: absolute;
  132. display: flex;
  133. align-items: center;
  134. right: 0;
  135. top: 50%;
  136. transform: translateY(-50%);
  137. width: 80rpx;
  138. padding-left: 10rpx;
  139. height: 70rpx;
  140. z-index: 2;
  141. }
  142. }
  143. .item {
  144. position: relative;
  145. display: flex;
  146. width: 95%;
  147. box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
  148. border-radius: 10rpx;
  149. box-sizing: border-box;
  150. padding: 20rpx 30rpx;
  151. overflow: hidden;
  152. margin: 0 auto 20rpx;
  153. background: #fff;
  154. .content {
  155. margin-left: 20rpx;
  156. .row {
  157. display: flex;
  158. line-height: 32rpx;
  159. font-family: Microsoft YaHei, Microsoft YaHei;
  160. font-size: 26rpx;
  161. padding-bottom: 20rpx;
  162. .label {
  163. color: #666;
  164. flex-shrink: 0;
  165. }
  166. .label::after {
  167. content: ':';
  168. }
  169. }
  170. }
  171. }
  172. </style>