teamList.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view>
  3. <view class="search-box">
  4. <view class="search ddflex">
  5. <image src="../static/promote/images/ssico.png"></image>
  6. <input @input="intName" placeholder="搜索客户昵称/手机" placeholder-class="placeholder" class="ipt" />
  7. </view>
  8. </view>
  9. <view style="height: 85rpx;"></view>
  10. <!-- <view class="tab dflex bgfff">
  11. <block v-if="IS_secondary_members!=1">
  12. <view :class="'li ' + (currentTab == 0 ? 'active' : '')" data-current="0" @tap="tab">
  13. 所有客户<text>({{count.total ? count.total : '0'}})</text></view>
  14. <view :class="'li ' + (currentTab == 2 ? 'active' : '')" data-current="2" @tap="tab">
  15. 本月新增<text>({{count.monthTotal ? count.monthTotal : '0'}})</text></view>
  16. </block>
  17. <block v-if="IS_secondary_members==1">
  18. <view :class="'li ' + (currentTab == 0 ? 'active' : '')" data-current="0" @tap="tab">一级成员</view>
  19. <view :class="'li ' + (currentTab == 1 ? 'active' : '')" data-current="1" @tap="tab">二级成员</view>
  20. </block>
  21. </view> -->
  22. <view class="tabcon">
  23. <!-- <view class="search dflex" v-if="!isDirect&&IS_secondary_members==1">
  24. <image src="/promote/static/promote/images/ssico.png"></image>
  25. <input placeholder="搜索推荐人" placeholder-class="placeholder" class="flex" @input="intName"
  26. @confirm="intConfirm"></input>
  27. </view> -->
  28. <block v-if="pageList.length > 0">
  29. <view v-for="(item, index) in pageList" :key="index" class="li">
  30. <!-- <view class="li-new">新客户</view> -->
  31. <view class="infos ddflex">
  32. <image :src="item.avatar" mode="aspectFit" class="userimg"></image>
  33. <view class="info flex">
  34. <view class="name ddflex">
  35. {{ item.nickName }}
  36. <text v-if="item.mobile">{{ item.mobile }}</text>
  37. <image :src="item.isTurn == 1 ? '../static/promote/images/zhuanxs_y.png' : '../static/promote/images/zhuanxs_n.png'" mode="aspectFit"></image>
  38. </view>
  39. <view class="info-sta ddflex">
  40. <view class="time ddflex">
  41. <image src="../static/promote/images/hhr_kh_ico1.png"></image>
  42. {{ item.createDate }}
  43. </view>
  44. <view class="time ddflex">
  45. <image src="../static/promote/images/hhr_kh_ico2.png"></image>
  46. {{ item.source ? item.source : '微信' }}
  47. </view>
  48. </view>
  49. <view class="jilu" v-if="item.lastTime && item.lastBrowse">{{ item.lastTime }} {{ item.lastBrowse }}</view>
  50. <!-- <view class="sta">营业额:¥{{item.money}}<text>直推:{{item.person}}人</text></view> -->
  51. <view class="ddflex">
  52. <view class="edit-customer ddflex" v-if="!item.isShowMaker" @click="showMakr(item, index)">
  53. {{ item.tagList && item.tagList.length > 0 ? (item.tagList[0] ? item.tagList[0] : '备注') : '备注' }}
  54. <image src="../static/promote/images/edit_customer.png" class="edit-img"></image>
  55. </view>
  56. <view v-else class="edit-customer ddflex">
  57. <input
  58. placeholder="输入备注内容"
  59. placeholder-class="placeholder"
  60. class="beitext"
  61. v-text="item.tagList && item.tagList.length > 0 ? item.tagList[0] : ''"
  62. @blur="setMakr"
  63. />
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- <view class="opt ddflex">
  69. <view class="lis ddflex">
  70. <image src="../static/promote/images/hhr_kh_ico3.png"></image>
  71. 备注
  72. </view>
  73. <view class="lis ddflex">
  74. <image src="../static/promote/images/hhr_kh_ico4.png"></image>
  75. 转线索
  76. </view>
  77. <view class="lis ddflex" @tap="call" :data-index="index" v-if="item.mobile && isDirect">
  78. <image src="../static/promote/images/hhr_kh_ico5.png"></image>
  79. 联系
  80. </view>
  81. </view> -->
  82. <!-- <view class="tuijian" v-if="!isDirect">
  83. 推荐人<text>{{item.pname}}</text>
  84. </view>
  85. <view class="call nophone" @tap="call" :data-index="index" v-if="item.phone && isDirect">
  86. <image src="/static/pages/images/call.png"></image>拨打
  87. </view> -->
  88. </view>
  89. </block>
  90. <view class="nodata" v-if="ishow">
  91. <image :src="picUrlss + 'empty_dd.png'"></image>
  92. <text>暂无成员</text>
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. // promote/teamList/teamList.js
  99. const app = getApp();
  100. const req = require('../../utils/request.js');
  101. export default {
  102. data() {
  103. return {
  104. picUrlss: req.public.picUrls,
  105. currentTab: 0,
  106. form: {
  107. page: 1,
  108. limit: 10
  109. },
  110. pageList: [],
  111. isDirect: true,
  112. //是否显示搜索框
  113. searchName: '',
  114. isLoad: true,
  115. IS_secondary_members: '',
  116. count: '',
  117. ishow: false,
  118. isShowMaker: false,
  119. showMakrItem: ''
  120. };
  121. },
  122. components: {},
  123. props: {},
  124. onLoad: function(options) {
  125. if (options.tab) {
  126. this.setData({
  127. currentTab: options.tab
  128. });
  129. }
  130. if (options.IS_secondary_members) {
  131. this.setData({
  132. IS_secondary_members: options.IS_secondary_members
  133. });
  134. }
  135. if (options.isDirect) {
  136. this.setData({
  137. isDirect: JSON.parse(options.isDirect)
  138. });
  139. }
  140. // console.log(options);
  141. this.query = options;
  142. this.getList(this.currentTab);
  143. // this.getCount();
  144. },
  145. onReachBottom() {
  146. // console.log("=============--------------");
  147. this.form.page++;
  148. if (this.currentTab == 0) {
  149. this.getList(this.currentTab);
  150. } else {
  151. this.getList(this.currentTab);
  152. // console.log("================================== 今日和本月");
  153. }
  154. },
  155. methods: {
  156. showMakr(item, index) {
  157. this.showMakrIndex = index;
  158. this.showMakrItem = item;
  159. this.pageList[index].isShowMaker = true;
  160. this.$forceUpdate();
  161. },
  162. setMakr(e) {
  163. var makr = e.detail.value;
  164. if (!makr) {
  165. this.pageList[this.showMakrIndex].isShowMaker = false;
  166. this.$forceUpdate();
  167. return;
  168. }
  169. var list = [];
  170. list.push(makr);
  171. //提交备注
  172. req.postRequest(
  173. '/api/v3/user/addTag',
  174. {
  175. tag: list,
  176. uid: this.showMakrItem.id
  177. },
  178. data => {
  179. this.pageList[this.showMakrIndex].isShowMaker = false;
  180. this.pageList[this.showMakrIndex].tagList = list;
  181. console.log('log>>>>', this.pageList);
  182. this.$forceUpdate();
  183. },
  184. true
  185. );
  186. },
  187. tab(event) {
  188. const tabIndex = event.currentTarget.dataset.current;
  189. if (this.currentTab === tabIndex) return false;
  190. this.isLoad = true;
  191. this.form.page = 1;
  192. this.setData({
  193. currentTab: tabIndex,
  194. searchName: ''
  195. });
  196. if (tabIndex == 1)
  197. this.setData({
  198. isDirect: false
  199. });
  200. else
  201. this.setData({
  202. isDirect: true
  203. });
  204. this.getList(tabIndex);
  205. // console.log(tabIndex);
  206. },
  207. // getCount() {
  208. // req.getRequest('/api/distribution/partner/count', {}, data => {
  209. // this.setData({
  210. // count: data
  211. // });
  212. // });
  213. // },
  214. intName(e) {
  215. this.searchName = e.detail.value;
  216. this.isLoad = true;
  217. this.form.page = 1;
  218. this.getList(this.currentTab);
  219. },
  220. intConfirm() {},
  221. getList(type) {
  222. let isShowLoading = false;
  223. if (this.form.page == 1 && !isShowLoading) {
  224. req.loadIng('加载中');
  225. isShowLoading = true;
  226. }
  227. let that = this;
  228. // console.log("===============", that.isLoad);
  229. if (!that.isLoad) return false;
  230. // console.log("11111111111111111");
  231. that.isLoad = false; // if (dayType == 0) that.data.form.dayType = '';
  232. if (this.query.IS_secondary_members != 1) {
  233. // that.form.isDistri = 1;//1是供应商 0是会员
  234. if (type == 2) {
  235. that.form.dayType = 2; // that.data.form.nickName = this.data.searchName;
  236. } else {
  237. delete that.form.dayType;
  238. }
  239. } else {
  240. if (this.currentTab == 1) {
  241. that.form.type = type;
  242. that.form.nickName = this.searchName;
  243. } else {
  244. that.form.type = '';
  245. that.form.nickName = '';
  246. }
  247. }
  248. that.form.search = this.searchName;
  249. req.getRequest('/api/v3/assistant/customer', that.form, data => {
  250. data = data.list;
  251. if (data && data.length >= 10) {
  252. that.isLoad = true;
  253. }
  254. if (that.form.page > 1) {
  255. data = that.pageList.concat(data);
  256. }
  257. that.pageList = data;
  258. if (this.pageList && this.pageList.length <= 0) {
  259. that.ishow = true;
  260. } else {
  261. that.ishow = false;
  262. }
  263. if (isShowLoading) {
  264. uni.hideLoading();
  265. isShowLoading = false;
  266. }
  267. });
  268. },
  269. call(event) {
  270. const index = event.currentTarget.dataset.index;
  271. let phone = this.pageList[index].mobile;
  272. uni.makePhoneCall({
  273. phoneNumber: phone
  274. });
  275. }
  276. }
  277. };
  278. </script>
  279. <style>
  280. @import './teamList.css';
  281. </style>