customer-list.vue 10 KB

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