my.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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="580rpx" 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. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  96. <u-input v-model="searchFormData.remark" border placeholder="请输入备注"></u-input>
  97. </view>
  98. <view class="popup-footer" style="position: absolute;">
  99. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  100. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  101. </view>
  102. </view>
  103. </u-popup>
  104. <u-loadmore
  105. v-if="customerList.length > 0"
  106. marginTop="32"
  107. :line="true"
  108. :status="loadmore.status"
  109. :loading-text="loadmore.loadingText"
  110. :loadmore-text="loadmore.defaultText"
  111. :nomore-text="loadmore.nomoreText"
  112. />
  113. </view>
  114. </template>
  115. <script>
  116. var that;
  117. export default {
  118. data() {
  119. return {
  120. searchKeyword: null,
  121. searchPopupShow: false,
  122. searchFormData: {
  123. name: '',
  124. phone: '',
  125. remark: '',
  126. }, // 搜索栏数据
  127. customerList: [],
  128. loadmore: {
  129. status: 'loadmore',
  130. loadingText: '努力加载中',
  131. defaultText: '轻轻上拉 查看更多',
  132. nomoreText: '实在没有了',
  133. currnetPage: 1
  134. }
  135. };
  136. },
  137. onLoad(params) {
  138. that = this;
  139. // 默认筛选项
  140. if (params.filterStepStatus !== undefined) {
  141. that.filterStepStatus = parseInt(params.filterStepStatus);
  142. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  143. }
  144. this.getDataList()
  145. },
  146. onShow () {
  147. // this.getDataList()
  148. },
  149. onReachBottom() {
  150. if (that.loadmore.status == 'nomore') return;
  151. that.loadmore.currnetPage++
  152. this.getDataList()
  153. },
  154. onPullDownRefresh() {
  155. // 防止频繁刷新
  156. },
  157. methods: {
  158. delHandle (item) {
  159. uni.$msgConfirm('确定删除吗?', () => {
  160. uni.api.cust.apiprivatecustomerdel({
  161. id: item.id
  162. }).then(res => {
  163. uni.$msg('删除成功~')
  164. this.loadmore.currnetPage = 1
  165. this.getDataList()
  166. })
  167. })
  168. },
  169. getDataList (bc) {
  170. const that = this
  171. let params = {
  172. ...this.searchFormData
  173. }
  174. uni.api.cust.apiprivatecustomerlist({
  175. page: that.loadmore.currnetPage,
  176. ...params,
  177. }).then(res => {
  178. const list = res.list || []
  179. if (list.length < 10) {
  180. that.loadmore.status = 'nomore';
  181. }
  182. if (res.current_page === 1) {
  183. if (list.length == 0) {
  184. uni.$msg('无搜索结果', 'none');
  185. }
  186. that.customerList = [...list]
  187. } else {
  188. that.customerList = that.customerList.concat(list)
  189. }
  190. if (bc) bc()
  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. that.loadmore.currnetPage = 1
  215. this.getDataList(() => {
  216. this.searchPopupShow = false
  217. })
  218. },
  219. }
  220. };
  221. </script>
  222. <style lang="scss">
  223. .search-wrap {
  224. padding: 20rpx;
  225. }
  226. .filter-wrap {
  227. position: relative;
  228. }
  229. // 列表
  230. .customer-list-wrap {
  231. width: 100%;
  232. .customer-item {
  233. display: flex;
  234. flex-direction: column;
  235. align-items: flex-start;
  236. font-size: $u-p2;
  237. color: $u-content-color;
  238. border-bottom: 1rpx solid $u-border-color;
  239. padding: 24rpx 32rpx;
  240. .info {
  241. display: flex;
  242. align-items: flex-start;
  243. justify-content: space-between;
  244. width: 100%;
  245. margin-bottom: 10rpx;
  246. .customer {
  247. display: flex;
  248. flex-direction: column;
  249. align-items: flex-start;
  250. width: 80%;
  251. .relname {
  252. color: $u-main-color;
  253. font-size: $u-p;
  254. font-weight: bold;
  255. margin-bottom: 10rpx;
  256. .s {
  257. display: inline-block;
  258. }
  259. }
  260. .n-key {
  261. display: inline-block;
  262. .n {
  263. background: #f00;
  264. color: #fff;
  265. width: 40rpx;
  266. height: 40rpx;
  267. line-height: 38rpx;
  268. text-align: center;
  269. border-radius: 50%;
  270. display: inline-block;
  271. margin-right: 10rpx;
  272. }
  273. }
  274. .item {
  275. margin-bottom: 10rpx;
  276. .s {
  277. display: inline-block;
  278. }
  279. }
  280. }
  281. .data-wrap {
  282. text-align: right;
  283. .date {
  284. font-size: $u-sub;
  285. }
  286. }
  287. }
  288. .more-wrap {
  289. background: #fdf6ec;
  290. color: #666;
  291. padding: 10rpx;
  292. border-radius: 10rpx;
  293. font-size: 26rpx;
  294. }
  295. .tool-wrap {
  296. display: flex;
  297. align-items: center;
  298. justify-content: space-between;
  299. width: 100%;
  300. }
  301. }
  302. }
  303. .float-search {
  304. opacity: 0.9;
  305. position: fixed;
  306. right: 20rpx;
  307. bottom: 40rpx;
  308. padding: 20rpx;
  309. border-radius: 50%;
  310. background-color: $u-theme-color;
  311. }
  312. .float-search2 {
  313. opacity: 0.9;
  314. position: fixed;
  315. right: 20rpx;
  316. bottom: 150rpx;
  317. padding: 20rpx;
  318. border-radius: 50%;
  319. background-color: $u-theme-color;
  320. }
  321. </style>