list.vue 15 KB

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