customer-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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="GetProductListInfo"
  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(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="[list.ischecked ? 'icon-yixuanze' : 'icon-weixuanze']"
  38. >
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!--加载loadding-->
  44. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  45. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText"></tui-nomore>
  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">下一步</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-module/cm-seller/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%, #E15616 100%)'
  97. },
  98. plain: false
  99. }
  100. ],
  101. totalRecord: 0,
  102. popupShow: true,
  103. popupShow1: false,
  104. listQuery: Object.assign({}, defaultListQuery),
  105. remarksList: [],
  106. scrollTop: 0,
  107. isEmpty: false,
  108. loadding: false,
  109. pullUpOn: true,
  110. pullFlag: true,
  111. hasNextPage: false,
  112. navbarHeight: '',
  113. nomoreText: '上拉显示更多',
  114. handleUpdataVisitorId: 0,
  115. modalType: 1,
  116. checkedIndex: 0,
  117. isClubModalShow: false,
  118. isClubpopupShow: false
  119. }
  120. },
  121. onLoad() {},
  122. filters: {
  123. NumFormat: function(value) {
  124. //处理金额
  125. if (!value) return '0.00'
  126. let number = Number(value).toFixed(2)
  127. return number
  128. }
  129. },
  130. computed: {
  131. ...mapState(['hasLogin', 'userInfo'])
  132. },
  133. methods: {
  134. ...mapMutations(['login', 'logout']),
  135. async initGetStotage() {
  136. const userInfo = await this.$api.getStorage()
  137. this.listQuery.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  138. this.GetProductListInfo()
  139. },
  140. GetProductListInfo() {
  141. this.remarksList = []
  142. this.listQuery.pageNum = 1
  143. this.UserService.getUserClubVisitorList(this.listQuery)
  144. .then(response => {
  145. let data = response.data
  146. if (data.results && data.results.length > 0) {
  147. this.isEmpty = false
  148. this.hasNextPage = data.hasNextPage
  149. this.totalRecord = data.totalRecord
  150. this.remarksList = data.results.map((el,index)=>{
  151. el.ischecked = false
  152. return el
  153. })
  154. this.pullFlag = false
  155. setTimeout(() => {
  156. this.pullFlag = true
  157. }, 500)
  158. if (this.hasNextPage) {
  159. this.pullUpOn = false
  160. this.nomoreText = '上拉显示更多'
  161. } else {
  162. if (this.remarksList.length < 8) {
  163. this.pullUpOn = true
  164. } else {
  165. this.pullUpOn = false
  166. this.loadding = false
  167. this.nomoreText = '已至底部'
  168. }
  169. }
  170. } else {
  171. this.isEmpty = true
  172. }
  173. this.isRequest = true
  174. })
  175. .catch(error => {
  176. this.$util.msg(error.msg, 2000)
  177. })
  178. },
  179. GetOnReachBottomData(index) {
  180. //上拉加载
  181. this.listQuery.pageNum += 1
  182. this.UserService.getUserClubVisitorList(this.listQuery)
  183. .then(response => {
  184. let data = response.data
  185. if (data.results && data.results.length > 0) {
  186. this.hasNextPage = data.hasNextPage
  187. this.remarksList = this.remarksList.concat(data.results)
  188. this.pullFlag = false // 防上拉暴滑
  189. setTimeout(() => {
  190. this.pullFlag = true
  191. }, 500)
  192. if (this.hasNextPage) {
  193. this.pullUpOn = false
  194. this.nomoreText = '上拉显示更多'
  195. } else {
  196. this.pullUpOn = false
  197. this.loadding = false
  198. this.nomoreText = '已至底部'
  199. }
  200. }
  201. })
  202. .catch(error => {
  203. this.$util.msg(error.msg, 2000)
  204. })
  205. },
  206. handleShowClubpopup() {
  207. // 点击操作
  208. this.isClubpopupShow = true
  209. },
  210. handleChoiceaTextData(data) {
  211. // 监听获取
  212. console.log(data)
  213. if (this.modalType == 1) {
  214. this.handleUpdateVisitor(data)
  215. } else {
  216. this.handleSaveVisitor(data)
  217. }
  218. },
  219. handleChoiceaClubData(data){
  220. // 同步机构
  221. console.log('data',data)
  222. },
  223. handleUpdateVisitor(data) {
  224. // 修改咨询人姓名
  225. this.UserService.getUserClubVisitorUpdate({
  226. questionMan: data,
  227. questionManId: this.handleUpdataVisitorId,
  228. serviceProviderId: this.listQuery.serviceProviderId
  229. })
  230. .then(response => {
  231. this.$util.msg('修改成功', 2000, true, 'success')
  232. setTimeout(() => {
  233. this.GetProductListInfo()
  234. }, 2000)
  235. })
  236. .catch(error => {
  237. console.log('=======>修改咨询姓名失败~')
  238. })
  239. },
  240. handleSaveVisitor(data) {
  241. // 添加咨询人
  242. this.UserService.getUserClubVisitorSave({
  243. name: data,
  244. serviceProviderId: this.listQuery.serviceProviderId
  245. })
  246. .then(response => {
  247. let VisitorInfo = {
  248. questionManId: response.data.questionManId,
  249. questionMan: response.data.questionMan
  250. }
  251. this.$api.setStorage('VisitorInfo', VisitorInfo)
  252. setTimeout(() => {
  253. this.$api.navigateTo('/pages/seller/remarks/record-list')
  254. }, 1000)
  255. })
  256. .catch(error => {
  257. console.log('=======>添加咨询人失败~')
  258. })
  259. },
  260. onShowClose() {
  261. //输入框失去焦点时触发
  262. if (this.listQuery.keyWord != '') {
  263. this.isShowClose = true
  264. } else {
  265. this.isShowClose = false
  266. this.listQuery.pageNum = 1
  267. this.GetProductListInfo()
  268. }
  269. },
  270. delInputText() {
  271. //清除输入框内容
  272. this.listQuery.keyWord = ''
  273. this.isShowClose = false
  274. this.listQuery.pageNum = 1
  275. this.GetProductListInfo()
  276. },
  277. checkedCoustomer(idx) {
  278. // 选择机构
  279. this.checkedIndex = idx
  280. this.remarksList.forEach((el, index) => {
  281. if (this.checkedIndex == index) {
  282. el.ischecked = !el.ischecked
  283. } else {
  284. el.ischecked = false
  285. }
  286. })
  287. },
  288. },
  289. onPageScroll(e) {
  290. //实时获取到滚动的值
  291. },
  292. onReachBottom() {
  293. if (this.hasNextPage) {
  294. this.loadding = true
  295. this.pullUpOn = true
  296. this.GetOnReachBottomData()
  297. }
  298. },
  299. onPullDownRefresh() {
  300. setTimeout(() => {
  301. this.listQuery.pageNum = 1
  302. uni.stopPullDownRefresh()
  303. }, 200)
  304. },
  305. onShow() {
  306. this.initGetStotage()
  307. }
  308. }
  309. </script>
  310. <style lang="scss">
  311. @import '@/uni.scss';
  312. page {
  313. background: #FFFFFF;
  314. }
  315. .empty-container {
  316. z-index: 99;
  317. }
  318. .club-search {
  319. width: 100%;
  320. height: 192rpx;
  321. background: #ffffff;
  322. box-sizing: border-box;
  323. position: fixed;
  324. top: 0;
  325. left: 0;
  326. z-index: 100;
  327. .search-from-title {
  328. width: 100%;
  329. height: 80rpx;
  330. line-height: 80rpx;
  331. box-sizing: border-box;
  332. padding: 0 24rpx;
  333. font-size: $font-size-26;
  334. float: left;
  335. color: #1890f9;
  336. background-color: #f2f9ff;
  337. font-weight: normal;
  338. }
  339. .club-search-form {
  340. width: 100%;
  341. height: 112rpx;
  342. background: #ffffff;
  343. box-sizing: border-box;
  344. padding: 24rpx;
  345. float: left;
  346. .search-from {
  347. width: 100%;
  348. height: 100%;
  349. background: #f7f7f7;
  350. border-radius: 32rpx;
  351. float: left;
  352. position: relative;
  353. .input {
  354. width: 500rpx;
  355. height: 64rpx;
  356. float: left;
  357. line-height: 64rpx;
  358. color: $text-color;
  359. font-size: $font-size-24;
  360. }
  361. .icon-iconfonticonfontsousuo1 {
  362. width: 64rpx;
  363. height: 64rpx;
  364. line-height: 64rpx;
  365. text-align: center;
  366. display: block;
  367. font-size: $font-size-38;
  368. float: left;
  369. color: #999999;
  370. }
  371. .icon-shanchu1 {
  372. font-size: $font-size-32;
  373. color: #999999;
  374. position: absolute;
  375. width: 64rpx;
  376. height: 64rpx;
  377. line-height: 64rpx;
  378. text-align: center;
  379. top: 0;
  380. right: 0;
  381. z-index: 10;
  382. }
  383. }
  384. }
  385. }
  386. .remarks-content {
  387. width: 100%;
  388. height: auto;
  389. position: relative;
  390. padding: 0;
  391. box-sizing: border-box;
  392. padding: 24rpx;
  393. padding-top: 212rpx;
  394. .empty-container-image {
  395. width: 260rpx;
  396. height: 260rpx;
  397. margin-top: -300rpx;
  398. }
  399. .tui-remarks-cell {
  400. width: 100%;
  401. border-radius: 16rpx;
  402. background: #ffffff;
  403. box-sizing: border-box;
  404. .tui-remarks-name {
  405. width: 100%;
  406. height: 100rpx;
  407. border-bottom: 1px solid #e1e1e1;
  408. .tui-remarks-name-le {
  409. float: left;
  410. line-height: 100rpx;
  411. font-size: $font-size-28;
  412. color: #333333;
  413. text-align: left;
  414. font-weight: bold;
  415. }
  416. .tui-remarks-name-ri {
  417. width: 40rpx;
  418. height: 100%;
  419. float: right;
  420. .checkbox {
  421. width: 40rpx;
  422. line-height: 128rpx;
  423. float: right;
  424. box-sizing: border-box;
  425. text-align: center;
  426. text-decoration: none;
  427. -webkit-tap-highlight-color: transparent;
  428. overflow: hidden;
  429. font-size: $font-size-34;
  430. &.icon-weixuanze {
  431. color: #b2b2b2;
  432. }
  433. &.icon-yixuanze {
  434. color: #e15616;
  435. }
  436. }
  437. }
  438. }
  439. .tui-remarks-button {
  440. width: 100%;
  441. height: 100rpx;
  442. line-height: 100rpx;
  443. box-sizing: border-box;
  444. text-align: center;
  445. font-size: $font-size-30;
  446. float: left;
  447. font-weight: bold;
  448. color: #1890f9;
  449. }
  450. }
  451. }
  452. .tui-popup-box {
  453. position: relative;
  454. box-sizing: border-box;
  455. min-height: 100rpx;
  456. padding: 6rpx 24rpx;
  457. .tui-popup-content {
  458. padding-top: 30rpx;
  459. }
  460. }
  461. .tui-popup-btn {
  462. width: 100%;
  463. height: auto;
  464. float: left;
  465. box-sizing: border-box;
  466. margin-top: 30rpx;
  467. .tui-button {
  468. width: 600rpx;
  469. height: 88rpx;
  470. background: $btn-confirm;
  471. line-height: 88rpx;
  472. text-align: center;
  473. color: #ffffff;
  474. font-size: $font-size-28;
  475. border-radius: 44rpx;
  476. margin: 0 auto;
  477. }
  478. .tui-button-text {
  479. width: 600rpx;
  480. height: 48rpx;
  481. line-height: 48rpx;
  482. text-align: center;
  483. color: #e15616;
  484. font-size: $font-size-26;
  485. margin: 0 auto;
  486. }
  487. }
  488. </style>