customer-list.vue 10 KB

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