record-list.vue 13 KB

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