my.vue 6.8 KB

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