my.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view>
  3. <view class="customer-list-wrap">
  4. <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无相关客户"></u-empty></view>
  5. <view v-for="(item, index) in customerList" class="customer-item" :key="index">
  6. <view class="info">
  7. <view class="customer" @click="pageTo(`/pages/cust/myrecord?id=${item.id}&str=${item.name}(${item.sex === 'male' ? '男' : '女'})-${item.phone}`)">
  8. <view class="relname">
  9. <View class="n-key">
  10. <view class="n" v-if="item.remind">{{item.remind}}</view>
  11. [{{item.nickname}}]
  12. {{ item.name }}
  13. <u-icon
  14. class="u-m-l-5"
  15. :name="item.sex == 'male' ? 'man' : 'woman'"
  16. size="22"
  17. :color="item.sex == 'male' ? '#2080f0' : '#f85f69'"
  18. ></u-icon>
  19. </View>
  20. <u-icon
  21. name="list-dot"
  22. size="32"
  23. label="跟进记录"
  24. label-size="28"
  25. class="u-m-l-30"
  26. color="#2d8cf0"
  27. label-color="#2d8cf0"
  28. ></u-icon>
  29. </view>
  30. <view class="item">
  31. <u-icon class="u-m-r-5" name="phone" size="22"></u-icon>
  32. {{ item.phone }}
  33. <view class="s" v-if="item.realname">
  34. [{{ item.realname }}]
  35. </view>
  36. </view>
  37. <view class="item" v-if="item.remark">
  38. {{ item.remark }}
  39. </view>
  40. </view>
  41. <view class="data-wrap">
  42. <u-tag
  43. icon="attach"
  44. :text="'快速报备'"
  45. :type="'success'"
  46. class="u-m-r-10"
  47. @click="pageTo('/pages/agent/recommend/create', { info: item })"
  48. >
  49. </u-tag>
  50. <u-gap height="20"></u-gap>
  51. <u-tag
  52. icon="edit-pen"
  53. :text="'编辑'"
  54. :type="'primary'"
  55. class="u-m-r-10"
  56. @click="pageTo('/pages/cust/mycreate', { info: item })"
  57. >
  58. </u-tag>
  59. <!-- <u-icon
  60. name="attach"
  61. size="32"
  62. label="快速报备"
  63. label-size="28"
  64. class="u-m-r-10 u-m-t-30"
  65. color="#19be6b"
  66. label-color="#19be6b"
  67. @click="pageTo('/pages/agent/recommend/create', { info: item })"
  68. ></u-icon> -->
  69. <!-- <view class="u-m-t-20">
  70. <u-tag
  71. @click="delHandle(item)"
  72. plain
  73. :text="'删除'"
  74. :type="'error'"
  75. class="u-m-r-10"
  76. >
  77. </u-tag>
  78. </view> -->
  79. </view>
  80. </view>
  81. <view class="more-wrap" v-if="item.record && item.record.record_remark" @click="pageTo(`/pages/cust/myrecord?id=${item.id}&str=${item.name}(${item.sex === 'male' ? '男' : '女'})-${item.phone}`)">
  82. 最新跟进({{item.record.create_at}}):{{ item.record.action ? item.record.action + ':' : '' }}{{ item.record.estate_name ? `[${item.record.estate_name}]--` : '' }} {{ item.record.record_remark }}
  83. </view>
  84. </view>
  85. </view>
  86. <view class="float-search2" @click="pageTo('/pages/cust/mycreate')"><u-icon name="plus" size="42" color="#fff"></u-icon></view>
  87. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  88. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
  89. <view class="bwin-popup">
  90. <view class="popup-header">客户搜索</view>
  91. <view class="popup-body">
  92. <u-input v-model="searchFormData.name" border placeholder="请输入客户姓名(支持模糊搜索)"></u-input>
  93. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  94. <u-input v-model="searchFormData.phone" border placeholder="请输入客户手机号(可仅输入一部分)"></u-input>
  95. </view>
  96. <view class="popup-footer" style="position: absolute;">
  97. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  98. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  99. </view>
  100. </view>
  101. </u-popup>
  102. <u-loadmore
  103. v-if="customerList.length > 0"
  104. marginTop="32"
  105. :line="true"
  106. :status="loadmore.status"
  107. :loading-text="loadmore.loadingText"
  108. :loadmore-text="loadmore.defaultText"
  109. :nomore-text="loadmore.nomoreText"
  110. />
  111. </view>
  112. </template>
  113. <script>
  114. var that;
  115. export default {
  116. data() {
  117. return {
  118. searchKeyword: null,
  119. searchPopupShow: false,
  120. searchFormData: {
  121. name: '',
  122. phone: ''
  123. }, // 搜索栏数据
  124. customerList: [],
  125. loadmore: {
  126. status: 'loadmore',
  127. loadingText: '努力加载中',
  128. defaultText: '轻轻上拉 查看更多',
  129. nomoreText: '实在没有了',
  130. currnetPage: 1
  131. }
  132. };
  133. },
  134. onLoad(params) {
  135. that = this;
  136. // 默认筛选项
  137. if (params.filterStepStatus !== undefined) {
  138. that.filterStepStatus = parseInt(params.filterStepStatus);
  139. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  140. }
  141. this.getDataList()
  142. },
  143. onShow () {
  144. // this.getDataList()
  145. },
  146. onReachBottom() {
  147. if (that.loadmore.status == 'nomore') return;
  148. that.loadmore.currnetPage++
  149. this.getDataList()
  150. },
  151. onPullDownRefresh() {
  152. // 防止频繁刷新
  153. },
  154. methods: {
  155. delHandle (item) {
  156. uni.$msgConfirm('确定删除吗?', () => {
  157. uni.api.cust.apiprivatecustomerdel({
  158. id: item.id
  159. }).then(res => {
  160. uni.$msg('删除成功~')
  161. this.loadmore.currnetPage = 1
  162. this.getDataList()
  163. })
  164. })
  165. },
  166. getDataList (bc) {
  167. const that = this
  168. let params = {
  169. ...this.searchFormData
  170. }
  171. uni.api.cust.apiprivatecustomerlist({
  172. page: that.loadmore.currnetPage,
  173. ...params,
  174. }).then(res => {
  175. const list = res.list || []
  176. if (list.length < 10) {
  177. that.loadmore.status = 'nomore';
  178. }
  179. if (res.current_page === 1) {
  180. if (list.length == 0) {
  181. uni.$msg('无搜索结果', 'none');
  182. }
  183. that.customerList = [...list]
  184. } else {
  185. that.customerList = that.customerList.concat(list)
  186. }
  187. if (bc) bc()
  188. })
  189. },
  190. customBack() {
  191. uni.navigateBack();
  192. },
  193. // 带监听器跳转
  194. pageTo(url, data) {
  195. /// xxxxx
  196. uni.navigateTo({
  197. url: url,
  198. events: {
  199. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  200. update: function(data) {
  201. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  202. }
  203. },
  204. success: function(res) {
  205. // 通过eventChannel向被打开页面传送数据
  206. res.eventChannel.emit('data', data);
  207. }
  208. });
  209. },
  210. searchHandle() {
  211. that.loadmore.currnetPage = 1
  212. this.getDataList(() => {
  213. this.searchPopupShow = false
  214. })
  215. },
  216. }
  217. };
  218. </script>
  219. <style lang="scss">
  220. .search-wrap {
  221. padding: 20rpx;
  222. }
  223. .filter-wrap {
  224. position: relative;
  225. }
  226. // 列表
  227. .customer-list-wrap {
  228. width: 100%;
  229. .customer-item {
  230. display: flex;
  231. flex-direction: column;
  232. align-items: flex-start;
  233. font-size: $u-p2;
  234. color: $u-content-color;
  235. border-bottom: 1rpx solid $u-border-color;
  236. padding: 24rpx 32rpx;
  237. .info {
  238. display: flex;
  239. align-items: flex-start;
  240. justify-content: space-between;
  241. width: 100%;
  242. margin-bottom: 10rpx;
  243. .customer {
  244. display: flex;
  245. flex-direction: column;
  246. align-items: flex-start;
  247. width: 80%;
  248. .relname {
  249. color: $u-main-color;
  250. font-size: $u-p;
  251. font-weight: bold;
  252. margin-bottom: 10rpx;
  253. .s {
  254. display: inline-block;
  255. }
  256. }
  257. .n-key {
  258. display: inline-block;
  259. .n {
  260. background: #f00;
  261. color: #fff;
  262. width: 40rpx;
  263. height: 40rpx;
  264. line-height: 38rpx;
  265. text-align: center;
  266. border-radius: 50%;
  267. display: inline-block;
  268. margin-right: 10rpx;
  269. }
  270. }
  271. .item {
  272. margin-bottom: 10rpx;
  273. .s {
  274. display: inline-block;
  275. }
  276. }
  277. }
  278. .data-wrap {
  279. text-align: right;
  280. .date {
  281. font-size: $u-sub;
  282. }
  283. }
  284. }
  285. .more-wrap {
  286. background: #fdf6ec;
  287. color: #666;
  288. padding: 10rpx;
  289. border-radius: 10rpx;
  290. font-size: 26rpx;
  291. }
  292. .tool-wrap {
  293. display: flex;
  294. align-items: center;
  295. justify-content: space-between;
  296. width: 100%;
  297. }
  298. }
  299. }
  300. .float-search {
  301. opacity: 0.9;
  302. position: fixed;
  303. right: 20rpx;
  304. bottom: 40rpx;
  305. padding: 20rpx;
  306. border-radius: 50%;
  307. background-color: $u-theme-color;
  308. }
  309. .float-search2 {
  310. opacity: 0.9;
  311. position: fixed;
  312. right: 20rpx;
  313. bottom: 150rpx;
  314. padding: 20rpx;
  315. border-radius: 50%;
  316. background-color: $u-theme-color;
  317. }
  318. </style>