list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <view class="container product clearfix">
  3. <view class="remarks-content" :style="{ paddingBottom: isIphoneX ? '168rpx' : '0' }">
  4. <view :class="{ 'tui-order-list': scrollTop >= 0 }" class="clearfix">
  5. <!-- 空白页 -->
  6. <view class="empty-container" v-if="isEmpty">
  7. <image class="empty-container-image" :src="StaticUrl + '/icon/icon-remarks-empty@2x.png'"></image>
  8. <text class="error-text">暂无任何资料备注~</text>
  9. </view>
  10. <!-- 列表 -->
  11. <view class="tui-remarks-cell tui-mtop" v-for="(remark, index) in remarksList" :key="index" @click.stop="details(remark)">
  12. <view class="tui-remarks-time">{{ remark.time }}</view>
  13. <view class="tui-remarks-content">{{ remark.content }}</view>
  14. <view class="tui-remarks-button">
  15. <view class="btn">修改</view> <view class="btn" @click="deleteRemark(remark)">删除</view>
  16. </view>
  17. </view>
  18. <!--加载loadding-->
  19. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  20. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText"></tui-nomore>
  21. <!--加载loadding-->
  22. </view>
  23. </view>
  24. <!-- 取消收藏操作 -->
  25. <tui-bottom-popup :radius="false" :mask="false" :show="popupShow">
  26. <view class="tui-popup-box clearfix">
  27. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  28. <view class="tui-flex-1">
  29. <view class="tui-button" @click="handleAllUnder">添加资料备注</view>
  30. </view>
  31. </view>
  32. </view>
  33. </tui-bottom-popup>
  34. <!-- 弹窗提示 -->
  35. <tui-modal
  36. :show="modal"
  37. @click="handleClick"
  38. @cancel="hideMobel"
  39. :content="contentModalText"
  40. :button="modalButton"
  41. color="#333"
  42. :size="32"
  43. shape="circle"
  44. :maskClosable="false"
  45. >
  46. </tui-modal>
  47. </view>
  48. </template>
  49. <script>
  50. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  51. import tuiNomore from '@/components/tui-components/nomore/nomore'
  52. import { mapState, mapMutations } from 'vuex'
  53. const defaultListQuery = {
  54. userId: 0,
  55. pageNum: 1,
  56. pageSize: 10
  57. }
  58. export default {
  59. components: {
  60. tuiLoadmore,
  61. tuiNomore
  62. },
  63. data() {
  64. return {
  65. StaticUrl: this.$Static,
  66. isIphoneX: this.$store.state.isIphoneX,
  67. modalButton: [
  68. {
  69. text: '取消',
  70. type: 'gray',
  71. plain: true //是否空心
  72. },
  73. {
  74. text: '确认',
  75. customStyle: {
  76. color: '#fff',
  77. bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
  78. },
  79. plain: false
  80. }
  81. ],
  82. totalRecord: 0,
  83. popupShow: true,
  84. popupShow1: false,
  85. isProductChecked: false,
  86. listQuery: Object.assign({}, defaultListQuery),
  87. remarksList: [
  88. {
  89. time: '2021.09.07 16:20:10',
  90. content:
  91. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  92. },
  93. {
  94. time: '2021.09.07 16:20:10',
  95. content:
  96. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  97. },
  98. {
  99. time: '2021.09.07 16:20:10',
  100. content:
  101. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  102. },
  103. {
  104. time: '2021.09.07 16:20:10',
  105. content:
  106. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  107. },
  108. {
  109. time: '2021.09.07 16:20:10',
  110. content:
  111. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  112. },
  113. {
  114. time: '2021.09.07 16:20:10',
  115. content:
  116. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  117. },
  118. {
  119. time: '2021.09.07 16:20:10',
  120. content:
  121. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  122. },
  123. {
  124. time: '2021.09.07 16:20:10',
  125. content:
  126. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  127. },
  128. {
  129. time: '2021.09.07 16:20:10',
  130. content:
  131. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  132. },
  133. {
  134. time: '2021.09.07 16:20:10',
  135. content:
  136. '半岛超声炮是目前国内唯一一台获得NMPA认证的“国产超声刀”,采用大焦域和超脉冲技术的方式,利用超声波能量精准加热皮下SMAS筋膜层、真皮层、浅脂肪层...'
  137. }
  138. ],
  139. handleData: {},
  140. number: 0,
  141. buyRetailPrice: 0,
  142. buyRetailPriceStep: 1,
  143. isQuantity: false,
  144. scrollTop: 0,
  145. isEmpty: false,
  146. isAllChecked: false,
  147. loadding: false,
  148. pullUpOn: true,
  149. pullFlag: true,
  150. hasNextPage: false,
  151. navbarHeight: '',
  152. nomoreText: '上拉显示更多',
  153. contentModalText: '', //操作文字提示语句
  154. modal: false,
  155. userIdentity: 0
  156. }
  157. },
  158. onLoad() {
  159. // this.initGetStotage()
  160. },
  161. filters: {
  162. NumFormat: function(value) {
  163. //处理金额
  164. if (!value) return '0.00'
  165. let number = Number(value).toFixed(2)
  166. return number
  167. }
  168. },
  169. computed: {
  170. ...mapState(['hasLogin', 'userInfo'])
  171. },
  172. methods: {
  173. ...mapMutations(['login', 'logout']),
  174. async initGetStotage() {
  175. const userInfo = await this.$api.getStorage()
  176. this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
  177. this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
  178. this.GetProductListInfo()
  179. },
  180. GetProductListInfo() {
  181. this.productList = []
  182. this.listQuery.pageNum = 1
  183. this.ProductService.getProductUserLikeList(this.listQuery)
  184. .then(response => {
  185. let data = response.data
  186. if (data.results && data.results.length > 0) {
  187. this.isEmpty = false
  188. this.hasNextPage = data.hasNextPage
  189. this.totalRecord = data.totalRecord
  190. this.productList = data.results
  191. this.pullFlag = false
  192. setTimeout(() => {
  193. this.pullFlag = true
  194. }, 500)
  195. if (this.hasNextPage) {
  196. this.pullUpOn = false
  197. this.nomoreText = '上拉显示更多'
  198. } else {
  199. if (this.productList.length < 8) {
  200. this.pullUpOn = true
  201. } else {
  202. this.pullUpOn = false
  203. this.loadding = false
  204. this.nomoreText = '已至底部'
  205. }
  206. }
  207. } else {
  208. this.isEmpty = true
  209. }
  210. this.isRequest = true
  211. })
  212. .catch(error => {
  213. this.$util.msg(error.msg, 2000)
  214. })
  215. },
  216. GetOnReachBottomData(index) {
  217. //上拉加载
  218. this.listQuery.pageNum += 1
  219. this.ProductService.getProductUserLikeList(this.listQuery)
  220. .then(response => {
  221. let data = response.data
  222. if (data.results && data.results.length > 0) {
  223. this.hasNextPage = data.hasNextPage
  224. this.productList = this.productList.concat(data.results)
  225. this.pullFlag = false // 防上拉暴滑
  226. setTimeout(() => {
  227. this.pullFlag = true
  228. }, 500)
  229. if (this.hasNextPage) {
  230. this.pullUpOn = false
  231. this.nomoreText = '上拉显示更多'
  232. } else {
  233. this.pullUpOn = false
  234. this.loadding = false
  235. this.nomoreText = '已至底部'
  236. }
  237. }
  238. })
  239. .catch(error => {
  240. this.$util.msg(error.msg, 2000)
  241. })
  242. },
  243. deleteRemark() {
  244. this.modal = true
  245. this.contentModalText = '确定删除这条备注信息吗?'
  246. },
  247. handleAllUnder() {
  248. //跳转添加资料备注
  249. this.$api.navigateTo('/pages/seller/remarks/add')
  250. },
  251. handleClick(e) {
  252. //取消收藏
  253. if (e.index == 1) {
  254. this.handleDeleteUserLike()
  255. }
  256. this.modal = false
  257. },
  258. handleDeleteUserLike() {
  259. //操作取消收藏
  260. this.ProductService.getDeleteUserLike({
  261. productIds: this.productIds,
  262. userId: this.listQuery.userId
  263. })
  264. .then(response => {
  265. this.$util.msg('取消收藏成功', 2000, true, 'success')
  266. setTimeout(() => {
  267. this.GetProductListInfo()
  268. }, 2000)
  269. })
  270. .catch(error => {
  271. this.$util.msg(error.msg, 2000)
  272. })
  273. },
  274. hideMobel() {
  275. this.modal = false
  276. },
  277. updateCheckAllBtn() {
  278. //勾选单个判断全选
  279. let goodsCheckedLength = 0
  280. this.productList.forEach(item => {
  281. if (item.isChecked) {
  282. goodsCheckedLength++
  283. }
  284. })
  285. this.isAllChecked = goodsCheckedLength === this.productList.length
  286. if (goodsCheckedLength > 0) {
  287. this.isProductChecked = true
  288. } else {
  289. this.isProductChecked = false
  290. }
  291. },
  292. updateBothCheckBtn() {
  293. //全选勾选判断
  294. this.productList.forEach(item => {
  295. item.isChecked = this.isAllChecked
  296. })
  297. },
  298. isCheckedAll() {
  299. //全选
  300. this.isAllChecked = !this.isAllChecked
  301. if (this.isAllChecked) {
  302. this.isProductChecked = true
  303. } else {
  304. this.isProductChecked = false
  305. }
  306. this.updateBothCheckBtn()
  307. },
  308. checkedSoperv(item) {
  309. //选择
  310. item.isChecked = !item.isChecked
  311. console.log(item)
  312. this.updateCheckAllBtn()
  313. },
  314. PromotionsFormat(promo) {
  315. //促销活动类型数据处理
  316. if (promo != null) {
  317. if (promo.type == 1 && promo.mode == 1) {
  318. return true
  319. } else {
  320. return false
  321. }
  322. }
  323. return false
  324. },
  325. changeCountAdd() {
  326. //popup弹窗数量增加按钮
  327. if (this.buyRetailPriceStep == 2) {
  328. this.number += this.minBuyNumber
  329. } else {
  330. this.number++
  331. }
  332. this.calculatPerice()
  333. },
  334. changeCountSub() {
  335. //popup弹窗数量减按钮
  336. if (this.number <= this.minBuyNumber) {
  337. this.number = this.minBuyNumber
  338. this.isQuantity = true
  339. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`, 2000)
  340. return
  341. } else {
  342. if (this.buyRetailPriceStep == 2) {
  343. this.number -= this.minBuyNumber
  344. } else {
  345. this.number--
  346. }
  347. this.calculatPerice()
  348. this.isQuantity = false
  349. }
  350. },
  351. changeNumber(e) {
  352. let _value = e.detail.value
  353. if (!this.$api.isNumber(_value)) {
  354. this.number = this.minBuyNumber
  355. } else if (_value < this.minBuyNumber) {
  356. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`, 2000)
  357. this.number = this.minBuyNumber
  358. } else if (_value % this.minBuyNumber != 0) {
  359. this.$util.msg('购买量必须为起订量的整数倍', 2000)
  360. this.number = this.minBuyNumber
  361. } else {
  362. this.number = e.detail.value
  363. this.calculatPerice()
  364. }
  365. },
  366. calculatPerice() {
  367. //判断是否为阶梯价然后做计算价格处理
  368. if (this.handleData.ladderPriceFlag == 1) {
  369. this.handleData.ladderPrices.forEach((item, index) => {
  370. if (this.number >= item.buyNum) {
  371. this.buyRetailPrice = item.buyPrice
  372. }
  373. })
  374. }
  375. },
  376. toConfirmation() {
  377. //跳转确认订单页面
  378. this.popupShow1 = false
  379. let productStp = {
  380. allPrice: this.number * this.buyRetailPrice,
  381. allCount: this.number,
  382. productID: this.handleData.productId,
  383. productCount: this.number
  384. }
  385. this.$api.navigateTo(
  386. `/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({ data: productStp })}`
  387. )
  388. },
  389. getAddProductCart() {
  390. //增加购物车成功和toast弹窗提示成功
  391. this.ProductService.shoppingAddCart({
  392. productID: this.handleData.productId,
  393. userID: this.listQuery.userId,
  394. productCount: this.number
  395. })
  396. .then(response => {
  397. this.popupShow1 = false
  398. this.$util.msg('加入购物车成功', 1500, true, 'success')
  399. })
  400. .catch(error => {
  401. this.$util.msg(error.msg, 2000)
  402. })
  403. },
  404. showPopup(index, pros) {
  405. // 弹窗显示
  406. switch (index) {
  407. case 0:
  408. this.popupShow = true
  409. break
  410. case 1:
  411. this.popupShow1 = true
  412. this.handleData = pros
  413. console.log(this.handleData)
  414. this.buyRetailPrice = this.handleData.price
  415. this.buyRetailPriceStep = this.handleData.step
  416. if (this.handleData.ladderPriceFlag == 1) {
  417. this.number = this.handleData.maxBuyNumber ? this.handleData.maxBuyNumber : 1
  418. } else {
  419. this.number = this.handleData.minBuyNumber
  420. }
  421. break
  422. }
  423. },
  424. hidePopup(index) {
  425. // 弹窗隐藏
  426. switch (index) {
  427. case 0:
  428. this.popupShow = false
  429. break
  430. case 1:
  431. this.popupShow1 = false
  432. break
  433. }
  434. },
  435. details(id) {
  436. this.$api.navigateTo(`/pages/seller/remarks/details?id=${id}`)
  437. }
  438. },
  439. onPageScroll(e) {
  440. //实时获取到滚动的值
  441. },
  442. onReachBottom() {
  443. if (this.hasNextPage) {
  444. this.loadding = true
  445. this.pullUpOn = true
  446. this.GetOnReachBottomData()
  447. }
  448. },
  449. onPullDownRefresh() {
  450. setTimeout(() => {
  451. this.listQuery.pageNum = 1
  452. uni.stopPullDownRefresh()
  453. }, 200)
  454. },
  455. onShow() {}
  456. }
  457. </script>
  458. <style lang="scss">
  459. @import '@/uni.scss';
  460. page {
  461. background: #f7f7f7;
  462. }
  463. .empty-container {
  464. z-index: 99;
  465. }
  466. .remarks-content {
  467. width: 100%;
  468. height: auto;
  469. position: relative;
  470. padding: 0;
  471. box-sizing: border-box;
  472. padding: 24rpx;
  473. .empty-container-image {
  474. width: 260rpx;
  475. height: 260rpx;
  476. margin-top: -300rpx;
  477. }
  478. .tui-remarks-cell {
  479. width: 100%;
  480. height: 316rpx;
  481. border-radius: 16rpx;
  482. background: #ffffff;
  483. margin-bottom: 24rpx;
  484. box-sizing: border-box;
  485. padding: 25rpx 32rpx;
  486. .tui-remarks-time {
  487. width: 100%;
  488. height: 37rpx;
  489. line-height: 37rpx;
  490. text-align: left;
  491. font-size: $font-size-26;
  492. color: #666666;
  493. margin-bottom: 24rpx;
  494. }
  495. .tui-remarks-content {
  496. width: 100%;
  497. line-height: 44rpx;
  498. text-align: left;
  499. font-size: $font-size-26;
  500. color: #333333;
  501. text-overflow: ellipsis;
  502. overflow: hidden;
  503. display: -webkit-box;
  504. -webkit-line-clamp: 3;
  505. line-clamp: 3;
  506. -webkit-box-orient: vertical;
  507. margin-bottom: 24rpx;
  508. }
  509. .tui-remarks-button {
  510. width: 100%;
  511. height: 48rpx;
  512. .btn {
  513. width: 104rpx;
  514. line-height: 48rpx;
  515. box-sizing: border-box;
  516. border: 1px solid #707070;
  517. text-align: center;
  518. border-radius: 30rpx;
  519. color: #666666;
  520. font-size: $font-size-24;
  521. float: right;
  522. margin-left: 24rpx;
  523. }
  524. }
  525. }
  526. }
  527. .tui-popup-box {
  528. position: relative;
  529. box-sizing: border-box;
  530. min-height: 100rpx;
  531. padding: 6rpx 24rpx;
  532. .tui-popup-content {
  533. padding-top: 30rpx;
  534. }
  535. }
  536. .tui-popup-btn {
  537. width: 100%;
  538. height: auto;
  539. float: left;
  540. box-sizing: border-box;
  541. margin-top: 30rpx;
  542. .tui-button {
  543. width: 600rpx;
  544. height: 88rpx;
  545. background: $btn-confirm;
  546. line-height: 88rpx;
  547. text-align: center;
  548. color: #ffffff;
  549. font-size: $font-size-28;
  550. border-radius: 44rpx;
  551. margin: 0 auto;
  552. }
  553. }
  554. </style>