list.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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.remarksId)">
  12. <view class="tui-remarks-time">{{ remark.addTime }}</view>
  13. <view class="tui-remarks-content">{{ remark.remarks }}</view>
  14. <view class="tui-remarks-button">
  15. <view class="btn" @click.stop="handEditRemark(remark.remarksId)">修改</view>
  16. <view class="btn" @click.stop="deleteRemark(remark.remarksId)">删除</view>
  17. </view>
  18. </view>
  19. <!--加载loadding-->
  20. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  21. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText"></tui-nomore>
  22. <!--加载loadding-->
  23. </view>
  24. </view>
  25. <!-- 取消收藏操作 -->
  26. <tui-bottom-popup :radius="false" :mask="false" :show="popupShow">
  27. <view class="tui-popup-box clearfix">
  28. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  29. <view class="tui-flex-1">
  30. <view class="tui-button" @click="handleAllUnder">添加资料备注</view>
  31. </view>
  32. </view>
  33. </view>
  34. </tui-bottom-popup>
  35. <!-- 弹窗提示 -->
  36. <tui-modal
  37. :show="modal"
  38. @click="handleClick"
  39. @cancel="hideMobel"
  40. :content="contentModalText"
  41. :button="modalButton"
  42. color="#333"
  43. :size="32"
  44. shape="circle"
  45. :maskClosable="false"
  46. >
  47. </tui-modal>
  48. </view>
  49. </template>
  50. <script>
  51. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  52. import tuiNomore from '@/components/tui-components/nomore/nomore'
  53. import { mapState, mapMutations } from 'vuex'
  54. const defaultListQuery = {
  55. clubId: 0,
  56. pageNum: 1,
  57. pageSize: 10
  58. }
  59. export default {
  60. components: {
  61. tuiLoadmore,
  62. tuiNomore
  63. },
  64. data() {
  65. return {
  66. StaticUrl: this.$Static,
  67. isIphoneX: this.$store.state.isIphoneX,
  68. modalButton: [
  69. {
  70. text: '取消',
  71. type: 'gray',
  72. plain: true //是否空心
  73. },
  74. {
  75. text: '确认',
  76. customStyle: {
  77. color: '#fff',
  78. bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
  79. },
  80. plain: false
  81. }
  82. ],
  83. totalRecord: 0,
  84. popupShow: true,
  85. popupShow1: false,
  86. listQuery: Object.assign({}, defaultListQuery),
  87. remarksList: [],
  88. scrollTop: 0,
  89. isEmpty: false,
  90. loadding: false,
  91. pullUpOn: true,
  92. pullFlag: true,
  93. hasNextPage: false,
  94. navbarHeight: '',
  95. nomoreText: '上拉显示更多',
  96. contentModalText: '', //操作文字提示语句
  97. modal: false,
  98. handleRemarksId:0
  99. }
  100. },
  101. onLoad() {
  102. },
  103. filters: {
  104. NumFormat: function(value) {
  105. //处理金额
  106. if (!value) return '0.00'
  107. let number = Number(value).toFixed(2)
  108. return number
  109. }
  110. },
  111. computed: {
  112. ...mapState(['hasLogin', 'userInfo'])
  113. },
  114. methods: {
  115. ...mapMutations(['login', 'logout']),
  116. async initGetStotage() {
  117. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  118. this.listQuery.clubId = clubInfo.clubID ? clubInfo.clubID : 0
  119. this.GetProductListInfo()
  120. },
  121. GetProductListInfo() {
  122. this.remarksList = []
  123. this.listQuery.pageNum = 1
  124. this.UserService.getUserClubRemarksList(this.listQuery)
  125. .then(response => {
  126. let data = response.data
  127. if (data.results && data.results.length > 0) {
  128. this.isEmpty = false
  129. this.hasNextPage = data.hasNextPage
  130. this.totalRecord = data.totalRecord
  131. this.remarksList = data.results
  132. this.pullFlag = false
  133. setTimeout(() => {
  134. this.pullFlag = true
  135. }, 500)
  136. if (this.hasNextPage) {
  137. this.pullUpOn = false
  138. this.nomoreText = '上拉显示更多'
  139. } else {
  140. if (this.remarksList.length < 8) {
  141. this.pullUpOn = true
  142. } else {
  143. this.pullUpOn = false
  144. this.loadding = false
  145. this.nomoreText = '已至底部'
  146. }
  147. }
  148. } else {
  149. this.isEmpty = true
  150. }
  151. this.isRequest = true
  152. })
  153. .catch(error => {
  154. this.$util.msg(error.msg, 2000)
  155. })
  156. },
  157. GetOnReachBottomData(index) {
  158. //上拉加载
  159. this.listQuery.pageNum += 1
  160. this.UserService.getUserClubRemarksList(this.listQuery)
  161. .then(response => {
  162. let data = response.data
  163. if (data.results && data.results.length > 0) {
  164. this.hasNextPage = data.hasNextPage
  165. this.remarksList = this.remarksList.concat(data.results)
  166. this.pullFlag = false // 防上拉暴滑
  167. setTimeout(() => {
  168. this.pullFlag = true
  169. }, 500)
  170. if (this.hasNextPage) {
  171. this.pullUpOn = false
  172. this.nomoreText = '上拉显示更多'
  173. } else {
  174. this.pullUpOn = false
  175. this.loadding = false
  176. this.nomoreText = '已至底部'
  177. }
  178. }
  179. })
  180. .catch(error => {
  181. this.$util.msg(error.msg, 2000)
  182. })
  183. },
  184. deleteRemark(remarksId) {
  185. this.handleRemarksId = remarksId
  186. this.modal = true
  187. this.contentModalText = '确定删除这条备注信息吗?'
  188. },
  189. handEditRemark(remarksId){
  190. //跳转修改资料备注
  191. this.$api.navigateTo(`/pages/seller/remarks/add?type=edit&remarksId=${remarksId}`)
  192. },
  193. handleAllUnder() {
  194. //跳转添加资料备注
  195. this.$api.navigateTo('/pages/seller/remarks/add')
  196. },
  197. handleClick(e) {
  198. //取消收藏
  199. if (e.index == 1) {
  200. this.handleDeleteUserLike()
  201. }
  202. this.modal = false
  203. },
  204. handleDeleteUserLike() {
  205. //操作删除资料备注
  206. this.UserService.getUserClubRemarksDelete({
  207. remarksId: this.handleRemarksId
  208. })
  209. .then(response => {
  210. this.$util.msg('删除成功', 2000, true, 'success')
  211. setTimeout(() => {
  212. this.GetProductListInfo()
  213. }, 2000)
  214. })
  215. .catch(error => {
  216. this.$util.msg(error.msg, 2000)
  217. })
  218. },
  219. hideMobel() {
  220. this.modal = false
  221. },
  222. details(remarksId) {
  223. this.$api.navigateTo(`/pages/seller/remarks/details?remarksId=${remarksId}`)
  224. }
  225. },
  226. onPageScroll(e) {
  227. //实时获取到滚动的值
  228. },
  229. onReachBottom() {
  230. if (this.hasNextPage) {
  231. this.loadding = true
  232. this.pullUpOn = true
  233. this.GetOnReachBottomData()
  234. }
  235. },
  236. onPullDownRefresh() {
  237. setTimeout(() => {
  238. this.listQuery.pageNum = 1
  239. uni.stopPullDownRefresh()
  240. }, 200)
  241. },
  242. onShow() {
  243. this.initGetStotage()
  244. }
  245. }
  246. </script>
  247. <style lang="scss">
  248. @import '@/uni.scss';
  249. page {
  250. background: #f7f7f7;
  251. }
  252. .empty-container {
  253. z-index: 99;
  254. }
  255. .remarks-content {
  256. width: 100%;
  257. height: auto;
  258. position: relative;
  259. padding: 0;
  260. box-sizing: border-box;
  261. padding: 24rpx;
  262. .empty-container-image {
  263. width: 260rpx;
  264. height: 260rpx;
  265. margin-top: -300rpx;
  266. }
  267. .tui-remarks-cell {
  268. width: 100%;
  269. height: 316rpx;
  270. border-radius: 16rpx;
  271. background: #ffffff;
  272. margin-bottom: 24rpx;
  273. box-sizing: border-box;
  274. padding: 25rpx 32rpx;
  275. .tui-remarks-time {
  276. width: 100%;
  277. height: 37rpx;
  278. line-height: 37rpx;
  279. text-align: left;
  280. font-size: $font-size-26;
  281. color: #666666;
  282. margin-bottom: 24rpx;
  283. }
  284. .tui-remarks-content {
  285. width: 100%;
  286. line-height: 44rpx;
  287. text-align: justify;
  288. font-size: $font-size-26;
  289. color: #333333;
  290. text-overflow: ellipsis;
  291. overflow: hidden;
  292. display: -webkit-box;
  293. -webkit-line-clamp: 3;
  294. line-clamp: 3;
  295. -webkit-box-orient: vertical;
  296. margin-bottom: 24rpx;
  297. }
  298. .tui-remarks-button {
  299. width: 100%;
  300. height: 48rpx;
  301. .btn {
  302. width: 104rpx;
  303. line-height: 48rpx;
  304. box-sizing: border-box;
  305. border: 1px solid #707070;
  306. text-align: center;
  307. border-radius: 30rpx;
  308. color: #666666;
  309. font-size: $font-size-24;
  310. float: right;
  311. margin-left: 24rpx;
  312. }
  313. }
  314. }
  315. }
  316. .tui-popup-box {
  317. position: relative;
  318. box-sizing: border-box;
  319. min-height: 100rpx;
  320. padding: 6rpx 24rpx;
  321. .tui-popup-content {
  322. padding-top: 30rpx;
  323. }
  324. }
  325. .tui-popup-btn {
  326. width: 100%;
  327. height: auto;
  328. float: left;
  329. box-sizing: border-box;
  330. margin-top: 30rpx;
  331. .tui-button {
  332. width: 600rpx;
  333. height: 88rpx;
  334. background: $btn-confirm;
  335. line-height: 88rpx;
  336. text-align: center;
  337. color: #ffffff;
  338. font-size: $font-size-28;
  339. border-radius: 44rpx;
  340. margin: 0 auto;
  341. }
  342. }
  343. </style>