list.vue 12 KB

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