customer-list.vue 11 KB

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