list.vue 12 KB

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