customer-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view class="container product clearfix">
  3. <view class="club-search clearfix">
  4. <view class="club-search-form">
  5. <view class="search-from name">
  6. <text class="iconfont icon-iconfonticonfontsousuo1"></text>
  7. <input
  8. class="input"
  9. type="text"
  10. confirm-type="search"
  11. v-model="listQuery.keyWord"
  12. @input="onShowClose"
  13. @confirm="getUserClubVisitorList"
  14. placeholder="搜索关键词"
  15. maxlength="16"
  16. />
  17. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
  18. </view>
  19. </view>
  20. <view class="search-from-title"> 请选择一个咨询人,将他所有的咨询记录同步到一个机构中去 </view>
  21. </view>
  22. <view class="remarks-content" :style="{ paddingBottom: isIphoneX ? '216rpx' : '168rpx' }">
  23. <view :class="{ 'tui-order-list': scrollTop >= 0 }" class="clearfix">
  24. <!-- 空白页 -->
  25. <view class="empty-container" v-if="isEmpty">
  26. <image class="empty-container-image" :src="StaticUrl + '/icon/icon-remarks-empty@2x.png'"></image>
  27. <text class="error-text">暂无任何数据~</text>
  28. </view>
  29. <template v-else>
  30. <!-- 列表 -->
  31. <view class="tui-remarks-cell tui-mtop" v-for="(list, index) in remarksList" :key="index">
  32. <view class="tui-remarks-name" @click.stop="checkedCoustomer(list,index)">
  33. <view class="tui-remarks-name-le">{{ list.questionMan }}</view>
  34. <view class="tui-remarks-name-ri">
  35. <view
  36. class="checkbox iconfont"
  37. :class="[checkedIndex == index ? 'icon-yixuanze' : 'icon-weixuanze']"
  38. >
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!--加载loadding-->
  44. <tui-loadmore :visible="loadding" :index="3" type="black" />
  45. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText" />
  46. <!--加载loadding-->
  47. </template>
  48. </view>
  49. </view>
  50. <!-- 下一步 -->
  51. <tui-bottom-popup :radius="false" :mask="false" :show="popupShow">
  52. <view class="tui-popup-box clearfix">
  53. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  54. <view class="tui-flex-1">
  55. <view class="tui-button" @click="handleShowClubpopup" v-if="!isEmpty">下一步</view>
  56. </view>
  57. </view>
  58. </view>
  59. </tui-bottom-popup>
  60. <!-- 添加记录 -->
  61. <cm-clubpopup
  62. ref="clubpopup"
  63. v-if="isClubpopupShow"
  64. :show="isClubpopupShow"
  65. @handleChoiceaClub="handleChoiceaClubData"
  66. >
  67. </cm-clubpopup>
  68. </view>
  69. </template>
  70. <script>
  71. import cmClubpopup from '../components/cm-clubpopup'
  72. import { mapState, mapMutations } from 'vuex'
  73. const defaultListQuery = {
  74. serviceProviderId: 0,
  75. pageNum: 1,
  76. pageSize: 10
  77. }
  78. export default {
  79. components: {
  80. cmClubpopup
  81. },
  82. data() {
  83. return {
  84. StaticUrl: this.$Static,
  85. isIphoneX: this.$store.state.isIphoneX,
  86. modalButton: [
  87. {
  88. text: '取消',
  89. type: 'gray',
  90. plain: true //是否空心
  91. },
  92. {
  93. text: '确认',
  94. customStyle: {
  95. color: '#fff',
  96. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  97. },
  98. plain: false
  99. }
  100. ],
  101. totalRecord: 0,
  102. questionManId:'',
  103. popupShow: true,
  104. popupShow1: false,
  105. listQuery: Object.assign({}, defaultListQuery),
  106. remarksList: [],
  107. scrollTop: 0,
  108. isEmpty: false,
  109. loadding: false,
  110. pullUpOn: true,
  111. pullFlag: true,
  112. hasNextPage: false,
  113. navbarHeight: '',
  114. nomoreText: '上拉显示更多',
  115. handleUpdataVisitorId: 0,
  116. modalType: 1,
  117. checkedIndex: 0,
  118. isClubModalShow: false,
  119. isClubpopupShow: false,
  120. }
  121. },
  122. onLoad() {},
  123. filters: {
  124. NumFormat: function(value) {
  125. //处理金额
  126. if (!value) return '0.00'
  127. let number = Number(value).toFixed(2)
  128. return number
  129. }
  130. },
  131. computed: {
  132. ...mapState(['hasLogin', 'userInfo'])
  133. },
  134. methods: {
  135. ...mapMutations(['login', 'logout']),
  136. async initGetStotage() {
  137. const userInfo = await this.$api.getStorage()
  138. this.listQuery.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  139. this.getUserClubVisitorList()
  140. },
  141. getUserClubVisitorList() {
  142. this.remarksList = []
  143. this.listQuery.pageNum = 1
  144. this.UserService.getUserClubVisitorList(this.listQuery)
  145. .then(response => {
  146. let data = response.data
  147. if (data.results && data.results.length > 0) {
  148. this.isEmpty = false
  149. this.hasNextPage = data.hasNextPage
  150. this.totalRecord = data.totalRecord
  151. this.remarksList = data.results.map((el,index)=>{
  152. el.ischecked = false
  153. return el
  154. })
  155. this.questionManId = this.remarksList[0].questionManId
  156. this.pullFlag = false
  157. setTimeout(() => {
  158. this.pullFlag = true
  159. }, 500)
  160. if (this.hasNextPage) {
  161. this.pullUpOn = false
  162. this.nomoreText = '上拉显示更多'
  163. } else {
  164. if (this.remarksList.length < 8) {
  165. this.pullUpOn = true
  166. } else {
  167. this.pullUpOn = false
  168. this.loadding = false
  169. this.nomoreText = '已至底部'
  170. }
  171. }
  172. } else {
  173. this.isEmpty = true
  174. }
  175. this.isRequest = true
  176. })
  177. .catch(error => {
  178. this.$util.msg(error.msg, 2000)
  179. })
  180. },
  181. GetOnReachBottomData(index) {
  182. //上拉加载
  183. this.listQuery.pageNum += 1
  184. this.UserService.getUserClubVisitorList(this.listQuery)
  185. .then(response => {
  186. let data = response.data
  187. if (data.results && data.results.length > 0) {
  188. this.hasNextPage = data.hasNextPage
  189. this.remarksList = this.remarksList.concat(data.results)
  190. this.pullFlag = false // 防上拉暴滑
  191. setTimeout(() => {
  192. this.pullFlag = true
  193. }, 500)
  194. if (this.hasNextPage) {
  195. this.pullUpOn = false
  196. this.nomoreText = '上拉显示更多'
  197. } else {
  198. this.pullUpOn = false
  199. this.loadding = false
  200. this.nomoreText = '已至底部'
  201. }
  202. }
  203. })
  204. .catch(error => {
  205. this.$util.msg(error.msg, 2000)
  206. })
  207. },
  208. handleShowClubpopup() {
  209. // 点击操作
  210. this.isClubpopupShow = true
  211. },
  212. handleChoiceaClubData(data){
  213. // 同步机构
  214. console.log('data',data)
  215. this.UserService.getUserRemarksConcactVisit(
  216. {
  217. clubId: data.clubId,
  218. questionManId:this.questionManId
  219. }
  220. )
  221. .then(response => {
  222. this.$util.msg('同步成功', 2000, true, 'success')
  223. setTimeout(() => {
  224. this.$api.redirectTo('/pages/seller/remarks/list')
  225. }, 2000)
  226. })
  227. .catch(error => {
  228. this.$util.msg(error.msg, 2000)
  229. })
  230. },
  231. onShowClose() {
  232. //输入框失去焦点时触发
  233. if (this.listQuery.keyWord != '') {
  234. this.isShowClose = true
  235. } else {
  236. this.isShowClose = false
  237. this.listQuery.pageNum = 1
  238. this.getUserClubVisitorList()
  239. }
  240. },
  241. delInputText() {
  242. //清除输入框内容
  243. this.listQuery.keyWord = ''
  244. this.isShowClose = false
  245. this.listQuery.pageNum = 1
  246. this.getUserClubVisitorList()
  247. },
  248. checkedCoustomer(list,idx) {
  249. // 选择机构
  250. this.checkedIndex = idx
  251. this.questionManId = list.questionManId
  252. console.log('questionManId',this.questionManId)
  253. },
  254. },
  255. onPageScroll(e) {
  256. //实时获取到滚动的值
  257. },
  258. onReachBottom() {
  259. if (this.hasNextPage) {
  260. this.loadding = true
  261. this.pullUpOn = true
  262. this.GetOnReachBottomData()
  263. }
  264. },
  265. onPullDownRefresh() {
  266. setTimeout(() => {
  267. this.listQuery.pageNum = 1
  268. uni.stopPullDownRefresh()
  269. }, 200)
  270. },
  271. onShow() {
  272. this.initGetStotage()
  273. }
  274. }
  275. </script>
  276. <style lang="scss">
  277. @import '@/uni.scss';
  278. page {
  279. background: #FFFFFF;
  280. }
  281. .empty-container {
  282. z-index: 99;
  283. }
  284. .club-search {
  285. width: 100%;
  286. height: 192rpx;
  287. background: #ffffff;
  288. box-sizing: border-box;
  289. position: fixed;
  290. top: 0;
  291. left: 0;
  292. z-index: 100;
  293. .search-from-title {
  294. width: 100%;
  295. height: 80rpx;
  296. line-height: 80rpx;
  297. box-sizing: border-box;
  298. padding: 0 24rpx;
  299. font-size: $font-size-26;
  300. float: left;
  301. color: #1890f9;
  302. background-color: #f2f9ff;
  303. font-weight: normal;
  304. }
  305. .club-search-form {
  306. width: 100%;
  307. height: 112rpx;
  308. background: #ffffff;
  309. box-sizing: border-box;
  310. padding: 24rpx;
  311. float: left;
  312. .search-from {
  313. width: 100%;
  314. height: 100%;
  315. background: #f7f7f7;
  316. border-radius: 32rpx;
  317. float: left;
  318. position: relative;
  319. .input {
  320. width: 500rpx;
  321. height: 64rpx;
  322. float: left;
  323. line-height: 64rpx;
  324. color: $text-color;
  325. font-size: $font-size-24;
  326. }
  327. .icon-iconfonticonfontsousuo1 {
  328. width: 64rpx;
  329. height: 64rpx;
  330. line-height: 64rpx;
  331. text-align: center;
  332. display: block;
  333. font-size: $font-size-38;
  334. float: left;
  335. color: #999999;
  336. }
  337. .icon-shanchu1 {
  338. font-size: $font-size-32;
  339. color: #999999;
  340. position: absolute;
  341. width: 64rpx;
  342. height: 64rpx;
  343. line-height: 64rpx;
  344. text-align: center;
  345. top: 0;
  346. right: 0;
  347. z-index: 10;
  348. }
  349. }
  350. }
  351. }
  352. .remarks-content {
  353. width: 100%;
  354. height: auto;
  355. position: relative;
  356. padding: 0;
  357. box-sizing: border-box;
  358. padding: 24rpx;
  359. padding-top: 212rpx;
  360. .empty-container-image {
  361. width: 260rpx;
  362. height: 260rpx;
  363. margin-top: -300rpx;
  364. }
  365. .tui-remarks-cell {
  366. width: 100%;
  367. border-radius: 16rpx;
  368. background: #ffffff;
  369. box-sizing: border-box;
  370. .tui-remarks-name {
  371. width: 100%;
  372. height: 100rpx;
  373. border-bottom: 1px solid #e1e1e1;
  374. .tui-remarks-name-le {
  375. float: left;
  376. line-height: 100rpx;
  377. font-size: $font-size-28;
  378. color: #333333;
  379. text-align: left;
  380. font-weight: bold;
  381. }
  382. .tui-remarks-name-ri {
  383. width: 40rpx;
  384. height: 100%;
  385. float: right;
  386. .checkbox {
  387. width: 40rpx;
  388. line-height: 128rpx;
  389. float: right;
  390. box-sizing: border-box;
  391. text-align: center;
  392. text-decoration: none;
  393. -webkit-tap-highlight-color: transparent;
  394. overflow: hidden;
  395. font-size: $font-size-34;
  396. &.icon-weixuanze {
  397. color: #b2b2b2;
  398. }
  399. &.icon-yixuanze {
  400. color: #FF5B00;
  401. }
  402. }
  403. }
  404. }
  405. .tui-remarks-button {
  406. width: 100%;
  407. height: 100rpx;
  408. line-height: 100rpx;
  409. box-sizing: border-box;
  410. text-align: center;
  411. font-size: $font-size-30;
  412. float: left;
  413. font-weight: bold;
  414. color: #1890f9;
  415. }
  416. }
  417. }
  418. .tui-popup-box {
  419. position: relative;
  420. box-sizing: border-box;
  421. min-height: 100rpx;
  422. padding: 6rpx 24rpx;
  423. .tui-popup-content {
  424. padding-top: 30rpx;
  425. }
  426. }
  427. .tui-popup-btn {
  428. width: 100%;
  429. height: auto;
  430. float: left;
  431. box-sizing: border-box;
  432. margin-top: 30rpx;
  433. .tui-button {
  434. width: 600rpx;
  435. height: 88rpx;
  436. background: $btn-confirm;
  437. line-height: 88rpx;
  438. text-align: center;
  439. color: #ffffff;
  440. font-size: $font-size-28;
  441. border-radius: 44rpx;
  442. margin: 0 auto;
  443. &.none{
  444. background: #E1E1E1;
  445. }
  446. }
  447. .tui-button-text {
  448. width: 600rpx;
  449. height: 48rpx;
  450. line-height: 48rpx;
  451. text-align: center;
  452. color: #FF5B00;
  453. font-size: $font-size-26;
  454. margin: 0 auto;
  455. }
  456. }
  457. </style>