my.vue 7.9 KB

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