record-list.vue 14 KB

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