lib.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. };
  93. },
  94. onLoad(params) {
  95. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  96. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  97. this.getDataList()
  98. const dictObj = uni.getStorageSync('MD_dict')
  99. this.areaTypeObj = arrToObj(dictObj.area_type)
  100. let brokerage_company = dictObj.brokerage_company
  101. let colorObj = {}
  102. brokerage_company.forEach(item => {
  103. colorObj[item.key] = item.option1
  104. })
  105. this.colorObj = {...colorObj}
  106. },
  107. onReachBottom() {
  108. if (this.loadmore.status == 'nomore') return;
  109. this.loadmore.currnetPage++
  110. this.getDataList()
  111. },
  112. onPullDownRefresh() {
  113. // 防止频繁刷新
  114. },
  115. methods: {
  116. listItemHandle (item, index) {
  117. let dataList = [...this.dataList]
  118. if (dataList[index].moreList && dataList[index].moreList.length > 0) {
  119. return
  120. }
  121. uni.api.estate.apiestatelibdetail({id: item.id}).then(res => {
  122. dataList[index].moreList = res.brokerage_list || []
  123. this.dataList = [...dataList]
  124. })
  125. },
  126. copyTextHandle (item) {
  127. uniCopy({
  128. content: `${item.name}-${item.sex == 'male'?'男':'女'}-${item.phone}`,
  129. success:(res)=>{
  130. uni.showToast({
  131. title: res,
  132. icon: 'none'
  133. })
  134. },
  135. error:(e)=>{
  136. uni.showToast({
  137. title: e,
  138. icon: 'none',
  139. duration:3000,
  140. })
  141. }
  142. })
  143. },
  144. getDataList (bc) {
  145. if (this.userInfo2.roles == 1 || this.userInfo2.roles == 5 || this.userInfo2.roles == 7) {
  146. const that = this
  147. let params = {
  148. // page_size: 1000,
  149. ...this.searchFormData
  150. }
  151. if (that.orderMethod > 0) {
  152. if (that.orderMethod === 1) {
  153. params.order_by = JSON.stringify([{
  154. field: 'create_at',
  155. sort: 'desc',
  156. }])
  157. }
  158. if (that.orderMethod === 2) {
  159. params.order_by = JSON.stringify([{
  160. field: 'create_at',
  161. sort: 'asc',
  162. }])
  163. }
  164. }
  165. uni.api.estate.apiestateliblist({
  166. page: that.loadmore.currnetPage,
  167. ...params,
  168. }).then(res => {
  169. let list = res.list || []
  170. list.map(item =>{
  171. if (item.brokerage_tag) item.brokerageTag = JSON.parse(item.brokerage_tag)
  172. })
  173. if (list.length < 10) {
  174. that.loadmore.status = 'nomore';
  175. }
  176. if (res.current_page === 1) {
  177. if (list.length === 0) {
  178. uni.$msg('无搜索结果', 'none');
  179. }
  180. that.dataList = [...list]
  181. } else {
  182. that.dataList = that.dataList.concat(list)
  183. }
  184. if (bc) bc()
  185. })
  186. }
  187. },
  188. customBack() {
  189. uni.navigateBack();
  190. },
  191. // 带监听器跳转
  192. pageTo(url, data) {
  193. /// xxxxx
  194. uni.navigateTo({
  195. url: url,
  196. events: {
  197. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  198. update: function(data) {
  199. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  200. }
  201. },
  202. success: function(res) {
  203. // 通过eventChannel向被打开页面传送数据
  204. res.eventChannel.emit('data', data);
  205. }
  206. });
  207. },
  208. searchHandle() {
  209. this.loadmore.currnetPage = 1
  210. this.getDataList(() => {
  211. this.searchPopupShow = false
  212. })
  213. },
  214. getTime(n) {
  215. let date = n ? new Date(n) : new Date()
  216. let year = date.getFullYear()
  217. let month = date.getMonth() + 1
  218. month = month > 9 ? month : '0' + month
  219. let day = date.getDate()
  220. day = day > 9 ? day : '0' + day
  221. let hour = date.getHours()
  222. hour = hour > 9 ? hour : '0' + hour
  223. let minute = date.getMinutes()
  224. minute = minute > 9 ? minute : '0' + minute
  225. let second = date.getSeconds()
  226. second = second > 9 ? second : '0' + second
  227. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  228. },
  229. }
  230. };
  231. </script>
  232. <style lang="scss">
  233. // 列表
  234. .scoped-estate-list {
  235. padding-top: 20rpx;
  236. .sel-item {
  237. box-shadow: 0 0 6rpx #ccc;
  238. margin: 0 20rpx 20rpx;
  239. padding: 20rpx;
  240. border-radius: 10rpx;
  241. }
  242. .sel-info {
  243. .p1 {
  244. font-size: 34rpx;
  245. font-weight: bold;
  246. margin-bottom: 10rpx;
  247. }
  248. .more {
  249. .t {
  250. display: inline-block;
  251. vertical-align: middle;
  252. padding: 6rpx 20rpx;
  253. border-radius: 6rpx;
  254. color: #fff;
  255. margin-right: 10rpx;
  256. font-size: 26rpx;
  257. }
  258. }
  259. .w-box {
  260. // border: 1PX solid #dcdcdc;
  261. padding: 16rpx;
  262. border-radius: 10rpx;
  263. .w-op {
  264. display: flex;
  265. border-bottom: 1PX solid #dcdcdc;
  266. &:last-child {
  267. border-bottom: 0;
  268. }
  269. .w-l {
  270. width: 160rpx;
  271. padding-top: 16rpx;
  272. }
  273. .w-r {
  274. flex: 1;
  275. font-size: 26rpx;
  276. border-left: 1PX solid #dcdcdc;
  277. padding-left: 16rpx;
  278. .w-p1 {
  279. padding-bottom: 10rpx;
  280. padding-top: 10rpx;
  281. color: #666;
  282. font-weight: bold;
  283. }
  284. .w-p2 {
  285. padding-bottom: 10rpx;
  286. color: #999;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. .float-search {
  294. opacity: 0.9;
  295. position: fixed;
  296. right: 20rpx;
  297. bottom: 40rpx;
  298. padding: 20rpx;
  299. border-radius: 50%;
  300. background-color: $u-theme-color;
  301. }
  302. .scoped-list-more-info {
  303. position: absolute;
  304. right: 20rpx;
  305. }
  306. </style>