lib.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view>
  3. <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
  4. <view class="scoped-estate-list">
  5. <view v-for="(item, index) in dataList" :class="curEid == item.id ? 'sel-item cur' : 'sel-item'" :key="index" @click="listItemHandle(item, index)">
  6. <view class="sel-info">
  7. <view class="p1">{{item.estate_name}}
  8. <u-tag
  9. style="margin-left: 20rpx;"
  10. :text="areaTypeObj[item.area_type]"
  11. :type="'success'"
  12. size="mini"
  13. ></u-tag>
  14. </view>
  15. <view class="more">
  16. <view class="w-box" v-if="item.moreList && item.moreList.length > 0">
  17. <view class="w-op" v-for="(tag, ti) in item.moreList" :key="ti">
  18. <view class="w-l">
  19. <view class="t" :style="'background-color: '+colorObj[tag.company]" >{{tag.company}}</view>
  20. </view>
  21. <view class="w-r">
  22. <view class="w-p1">佣金:{{tag.brokerage}}</view>
  23. <view class="w-p2">{{tag.report_visit}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="t" v-else :style="'background-color: '+colorObj[tag]" v-for="(tag, ti) in item.brokerageTag" :key="ti">{{tag}}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  33. <!-- 平台佣金政策弹窗 -->
  34. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
  35. <view class="bwin-popup">
  36. <view class="popup-header">楼盘搜索</view>
  37. <view class="popup-body">
  38. <u-input v-model="searchFormData.estate_name" border placeholder="请输入楼盘名称(支持模糊搜索)"></u-input>
  39. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  40. <u-input v-model="searchFormData.brokerage_tag" border placeholder="请输入分销渠道)"></u-input>
  41. </view>
  42. <view class="popup-footer" style="position: absolute;">
  43. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  44. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  45. </view>
  46. </view>
  47. </u-popup>
  48. <u-loadmore
  49. v-if="dataList.length > 0"
  50. marginTop="32"
  51. :line="true"
  52. :status="loadmore.status"
  53. :loading-text="loadmore.loadingText"
  54. :loadmore-text="loadmore.defaultText"
  55. :nomore-text="loadmore.nomoreText"
  56. />
  57. </view>
  58. </template>
  59. <script>
  60. import { arrToObj } from '@/utils'
  61. import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
  62. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
  63. export default {
  64. components: {
  65. wmWatermark
  66. },
  67. data() {
  68. return {
  69. colorArr: ['#fb7366', '#fb7366', '#9f7df5', '#60c68b', '#4da4ee', '#e77ad4'],
  70. colorObj: {},
  71. searchKeyword: null,
  72. searchPopupShow: false,
  73. searchFormData: {
  74. name: '',
  75. brokerage_tag: ''
  76. }, // 搜索栏数据
  77. orderMethod: 0,
  78. filterDropdownValue: {}, // 默认筛选
  79. dataList: [], // 客户列表
  80. loadmore: {
  81. status: 'loadmore',
  82. loadingText: '努力加载中',
  83. defaultText: '轻轻上拉 查看更多',
  84. nomoreText: '实在没有了',
  85. currnetPage: 1
  86. },
  87. curRoles: '',
  88. userInfo2: {},
  89. areaTypeObj: {},
  90. curEid: '',
  91. curEname: '',
  92. curAreaType: '',
  93. };
  94. },
  95. onLoad(params) {
  96. if (params.v) this.curAreaType = params.v
  97. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  98. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  99. this.getDataList()
  100. const dictObj = uni.getStorageSync('MD_dict')
  101. this.areaTypeObj = arrToObj(dictObj.area_type)
  102. let brokerage_company = dictObj.brokerage_company
  103. let colorObj = {}
  104. brokerage_company.forEach(item => {
  105. colorObj[item.key] = item.option1
  106. })
  107. this.colorObj = {...colorObj}
  108. },
  109. onReachBottom() {
  110. if (this.loadmore.status == 'nomore') return;
  111. this.loadmore.currnetPage++
  112. this.getDataList()
  113. },
  114. onPullDownRefresh() {
  115. // 防止频繁刷新
  116. },
  117. methods: {
  118. listItemHandle (item, index) {
  119. let dataList = [...this.dataList]
  120. if (dataList[index].moreList && dataList[index].moreList.length > 0) {
  121. return
  122. }
  123. uni.api.estate.apiestatelibdetail({id: item.id}).then(res => {
  124. dataList[index].moreList = res.brokerage_list || []
  125. this.dataList = [...dataList]
  126. })
  127. },
  128. copyTextHandle (item) {
  129. uniCopy({
  130. content: `${item.name}-${item.sex == 'male'?'男':'女'}-${item.phone}`,
  131. success:(res)=>{
  132. uni.showToast({
  133. title: res,
  134. icon: 'none'
  135. })
  136. },
  137. error:(e)=>{
  138. uni.showToast({
  139. title: e,
  140. icon: 'none',
  141. duration:3000,
  142. })
  143. }
  144. })
  145. },
  146. getDataList (bc) {
  147. if (this.userInfo2.roles == 1 || this.userInfo2.roles == 5 || this.userInfo2.roles == 7 || this.userInfo2.roles == 10 || this.userInfo2.roles == 11) {
  148. const that = this
  149. let params = {
  150. page_size: 30,
  151. ...this.searchFormData
  152. }
  153. if (this.curAreaType) {
  154. params.area_type = this.curAreaType
  155. }
  156. if (that.orderMethod > 0) {
  157. if (that.orderMethod === 1) {
  158. params.order_by = JSON.stringify([{
  159. field: 'create_at',
  160. sort: 'desc',
  161. }])
  162. }
  163. if (that.orderMethod === 2) {
  164. params.order_by = JSON.stringify([{
  165. field: 'create_at',
  166. sort: 'asc',
  167. }])
  168. }
  169. }
  170. uni.api.estate.apiestateliblist({
  171. page: that.loadmore.currnetPage,
  172. ...params,
  173. }).then(res => {
  174. let list = res.list || []
  175. list.map(item =>{
  176. if (item.brokerage_tag) item.brokerageTag = JSON.parse(item.brokerage_tag)
  177. })
  178. if (list.length < 10) {
  179. that.loadmore.status = 'nomore';
  180. }
  181. if (res.current_page === 1) {
  182. if (list.length === 0) {
  183. uni.$msg('无搜索结果', 'none');
  184. }
  185. that.dataList = [...list]
  186. } else {
  187. that.dataList = that.dataList.concat(list)
  188. }
  189. if (bc) bc()
  190. })
  191. }
  192. },
  193. customBack() {
  194. uni.navigateBack();
  195. },
  196. // 带监听器跳转
  197. pageTo(url, data) {
  198. /// xxxxx
  199. uni.navigateTo({
  200. url: url,
  201. events: {
  202. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  203. update: function(data) {
  204. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  205. }
  206. },
  207. success: function(res) {
  208. // 通过eventChannel向被打开页面传送数据
  209. res.eventChannel.emit('data', data);
  210. }
  211. });
  212. },
  213. searchHandle() {
  214. this.loadmore.currnetPage = 1
  215. this.getDataList(() => {
  216. this.searchPopupShow = false
  217. })
  218. },
  219. getTime(n) {
  220. let date = n ? new Date(n) : new Date()
  221. let year = date.getFullYear()
  222. let month = date.getMonth() + 1
  223. month = month > 9 ? month : '0' + month
  224. let day = date.getDate()
  225. day = day > 9 ? day : '0' + day
  226. let hour = date.getHours()
  227. hour = hour > 9 ? hour : '0' + hour
  228. let minute = date.getMinutes()
  229. minute = minute > 9 ? minute : '0' + minute
  230. let second = date.getSeconds()
  231. second = second > 9 ? second : '0' + second
  232. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  233. },
  234. }
  235. };
  236. </script>
  237. <style lang="scss">
  238. // 列表
  239. .scoped-estate-list {
  240. padding-top: 20rpx;
  241. .sel-item {
  242. box-shadow: 0 0 6rpx #ccc;
  243. margin: 0 20rpx 20rpx;
  244. padding: 20rpx;
  245. border-radius: 10rpx;
  246. }
  247. .sel-info {
  248. .p1 {
  249. font-size: 34rpx;
  250. font-weight: bold;
  251. margin-bottom: 10rpx;
  252. }
  253. .more {
  254. .t {
  255. display: inline-block;
  256. vertical-align: middle;
  257. padding: 6rpx 20rpx;
  258. border-radius: 6rpx;
  259. color: #fff;
  260. margin-right: 10rpx;
  261. font-size: 26rpx;
  262. }
  263. }
  264. .w-box {
  265. // border: 1PX solid #dcdcdc;
  266. padding: 16rpx;
  267. border-radius: 10rpx;
  268. .w-op {
  269. display: flex;
  270. border-bottom: 1PX solid #dcdcdc;
  271. &:last-child {
  272. border-bottom: 0;
  273. }
  274. .w-l {
  275. width: 160rpx;
  276. padding-top: 16rpx;
  277. }
  278. .w-r {
  279. flex: 1;
  280. font-size: 26rpx;
  281. border-left: 1PX solid #dcdcdc;
  282. padding-left: 16rpx;
  283. .w-p1 {
  284. padding-bottom: 10rpx;
  285. padding-top: 10rpx;
  286. color: #666;
  287. font-weight: bold;
  288. }
  289. .w-p2 {
  290. padding-bottom: 10rpx;
  291. color: #999;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. .float-search {
  299. opacity: 0.9;
  300. position: fixed;
  301. right: 20rpx;
  302. bottom: 40rpx;
  303. padding: 20rpx;
  304. border-radius: 50%;
  305. background-color: $u-theme-color;
  306. }
  307. .scoped-list-more-info {
  308. position: absolute;
  309. right: 20rpx;
  310. }
  311. </style>