myCustomer.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <u-search placeholder="输入名称搜索" v-model="searchKey" @custom="search()" @search="search()"></u-search>
  5. </view>
  6. <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  7. <view class="customer-list">
  8. <view class="customer-item" v-for="(item) in dataList" @click="navTo('/pages/user/crm/customerDetails?customerId='+item.customerId)" >
  9. <view class="name-box">
  10. <view class="name">{{item.customerName}}</view>
  11. <view class="btns">
  12. <image class="btn" src="../../../static/images/sms.png"></image>
  13. <image class="btn" src="../../../static/images/phone.png"></image>
  14. </view>
  15. </view>
  16. <view class="desc-box">
  17. <view class="label">最后跟进:</view>
  18. <view class="value">{{item.startTime}}</view>
  19. </view>
  20. <view class="desc-box">
  21. <view class="label">所在地区:</view>
  22. <view class="value">{{item.address}}</view>
  23. </view>
  24. <view class="desc-box">
  25. <view class="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</view>
  26. <view class="value">{{item.remark}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </mescroll-body>
  31. </view>
  32. </template>
  33. <script>
  34. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  35. import {getMyCustomerList} from '@/api/crm.js'
  36. export default {
  37. mixins: [MescrollMixin], // 使用mixin
  38. data() {
  39. return {
  40. searchKey:"",
  41. mescroll:null,
  42. downOption: {
  43. auto:false//不要自动加载
  44. },
  45. upOption: {
  46. onScroll:false,
  47. use: true, // 是否启用上拉加载; 默认true
  48. page: {
  49. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  50. size: 10 // 每页数据的数量,默认10
  51. },
  52. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  53. textNoMore:"已经到底了",
  54. empty: {
  55. icon:'/static/images/empty.png',
  56. tip: '暂无数据'
  57. }
  58. },
  59. dataList: []
  60. }
  61. },
  62. onShow() {
  63. },
  64. methods: {
  65. search(){
  66. this.mescroll.resetUpScroll()
  67. },
  68. navTo(url){
  69. uni.navigateTo({
  70. url: url
  71. })
  72. },
  73. mescrollInit(mescroll) {
  74. this.mescroll = mescroll;
  75. },
  76. /*下拉刷新的回调 */
  77. downCallback(mescroll) {
  78. mescroll.resetUpScroll()
  79. },
  80. upCallback(page) {
  81. //联网加载数据
  82. var that = this;
  83. var data={
  84. customerName:this.searchKey,
  85. pageNum: page.num,
  86. pageSize: page.size
  87. };
  88. uni.showLoading({
  89. title:"加载中..."
  90. })
  91. getMyCustomerList(data).then(res => {
  92. uni.hideLoading()
  93. if(res.code==200){
  94. //设置列表数据
  95. if (page.num == 1) {
  96. that.dataList = res.data.list;
  97. } else {
  98. that.dataList = that.dataList.concat(res.data.list);
  99. }
  100. that.mescroll.endBySize(res.data.list.length, res.data.total);
  101. }else{
  102. uni.showToast({
  103. icon:'none',
  104. title: "请求失败",
  105. });
  106. that.dataList = null;
  107. that.mescroll.endErr();
  108. }
  109. });
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. page{
  116. height: 100%;
  117. background: #f6f6f6;
  118. }
  119. </style>
  120. <style scoped lang="scss">
  121. .content{
  122. height: 100%;
  123. padding: 0rpx;
  124. position: relative;
  125. .top{
  126. z-index: 10000;
  127. width: 100%;
  128. position: absolute;
  129. top:0rpx;
  130. left:0rpx;
  131. height: 88rpx;
  132. background-color: #fff;
  133. padding: 0rpx 15rpx;
  134. }
  135. .customer-list{
  136. display: flex;
  137. flex-direction: column;
  138. padding: 15rpx;
  139. .customer-item{
  140. padding: 15rpx;
  141. border-radius: 15rpx;
  142. background-color: #fff;
  143. margin-bottom: 15rpx;
  144. width: 100%;
  145. .name-box{
  146. width: 100%;
  147. display: flex;
  148. align-items: center;
  149. justify-content: flex-start;
  150. .name{
  151. flex: 1;
  152. font-size: 38rpx;
  153. color:#111;
  154. }
  155. .btns{
  156. .btn{
  157. margin-left: 10rpx;
  158. width: 45rpx;
  159. height:45rpx;
  160. }
  161. }
  162. }
  163. .desc-box{
  164. margin-top: 15rpx;
  165. width: 100%;
  166. display: flex;
  167. align-items: center;
  168. justify-content: flex-start;
  169. .label{
  170. font-size: 28rpx;
  171. color: #a8a8a8;
  172. }
  173. .value{
  174. font-size: 28rpx;
  175. color: #a8a8a8;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. </style>