index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="unclear-container">
  3. <scroll-view class="scroll-con" scroll-y :scroll-top="scrollTop" @scrolltolower="onreachBottom">
  4. <!-- 列表数据 -->
  5. <view class="cell-item-con">
  6. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  7. <u-image class="cell-item-pic" src="/static/logo.jpg" width="140rpx" height="140rpx"></u-image>
  8. <view class="cell-item-c" @tap="goPage(item)">
  9. <view class="cell-item-info">
  10. <view class="cell-item-info-network">
  11. 咸阳市秦都区文彩舫东区
  12. <u-badge type="success" :count="8" :offset="[-10,-32]" size="mini"></u-badge>
  13. </view>
  14. <view class="cell-item-info-weight">
  15. <view class="cell-item-weight-bar">
  16. 15.25kg
  17. <u-badge class="badge" type="primary" count="总" :offset="[0,0]"></u-badge>
  18. </view>
  19. <view class="cell-item-weight-bar">
  20. 15.25kg
  21. <u-badge class="badge" type="warning" count="最大" :offset="[0,0]"></u-badge>
  22. </view>
  23. </view>
  24. </view>
  25. <u-icon name="arrow-right" class="arrow-right" :size="28" color="#999"></u-icon>
  26. </view>
  27. <u-button size="mini" class="handle-btn" hover-class="none" :custom-style="customBtnStyle" @click="removeFun(item)">移除</u-button>
  28. </view>
  29. </view>
  30. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  31. <view class="loadmore">
  32. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  33. </view>
  34. </scroll-view>
  35. <view class="footer-bar">
  36. <u-button class="footer-handle-btn scan-btn" :custom-style="btnStyle" shape="circle" @click="openQuery" size="medium" type="primary">
  37. <u-icon name="scan" class="btn-icon" :size="28" color="#fff"></u-icon>
  38. <text>扫码清运</text>
  39. </u-button>
  40. <u-button class="footer-handle-btn" :custom-style="btnStyle" shape="circle" @click="openQuery" size="medium">
  41. <u-icon name="plus" class="btn-icon" :size="28" color="#fff"></u-icon>
  42. <text>增加清运网点</text>
  43. </u-button>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { getGoldLogList, GoldLogCancel, GoldLogTotal } from '@/api/officialPartnerGoldLog.js'
  49. export default {
  50. data() {
  51. return {
  52. listdata: [{},{}],
  53. pageNo: 1, // 当前页码
  54. pageSize: 10, // 每页条数
  55. total: 0, // 数据总条数
  56. noDataText: '暂无数据', // 列表请求状态提示语
  57. status: 'loadmore', // 加载中状态
  58. customBtnStyle: { // 撤销单据 自定义按钮样式
  59. borderColor: '#2ab4e5',
  60. backgroundColor: '#2ab4e5',
  61. color: '#fff'
  62. },
  63. scrollTop: 0, // 滚动条位置
  64. btnStyle: { // 撤销单据 自定义按钮样式
  65. width: '100%'
  66. }
  67. }
  68. },
  69. onShow() {
  70. this.refresh({})
  71. console.log(wx.getMenuButtonBoundingClientRect())
  72. },
  73. methods:{
  74. // 获取查询参数 刷新列表
  75. refresh(params){
  76. this.listdata = []
  77. this.total = 0
  78. this.searchHandle(1)
  79. },
  80. // 搜索查询
  81. searchHandle (pageNo) {
  82. this.status = "loading"
  83. pageNo ? this.pageNo = pageNo : null
  84. getGoldLogList({
  85. pageNo: this.pageNo,
  86. pageSize: this.pageSize
  87. }).then(res => {
  88. if (res.status == 200) {
  89. if(this.pageNo>1){
  90. this.listdata = this.listdata.concat(res.data.list || [])
  91. }else{
  92. this.listdata = res.data.list || []
  93. this.scrollTop = 0
  94. }
  95. this.total = res.data.count || 0
  96. this.noDataText = '暂无数据'
  97. } else {
  98. this.noDataText = res.message
  99. this.listdata = []
  100. this.total = 0
  101. }
  102. this.status = "loadmore"
  103. })
  104. },
  105. // 移除
  106. removeFun(row){
  107. const _this = this
  108. uni.showModal({
  109. title: '提示',
  110. content: '确认移除该网点的清运单?',
  111. success(res) {
  112. if (res.confirm) {
  113. // GoldLogCancel({ id: row.id }).then(ret => {
  114. // if(ret.status == 200){
  115. // uni.showToast({ title: ret.message, icon: 'none' })
  116. // _this.searchHandle(1)
  117. // }
  118. // })
  119. }
  120. }
  121. })
  122. },
  123. // 查看详情
  124. goPage(row){
  125. uni.navigateTo({
  126. url: '/pages/cleared/details'
  127. })
  128. },
  129. // scroll-view到底部加载更多
  130. onreachBottom() {
  131. if(this.listdata.length < this.total){
  132. this.pageNo += 1
  133. this.searchHandle()
  134. }else{
  135. uni.showToast({ title: '已经到底了', icon: 'none' })
  136. this.status = "nomore"
  137. }
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. page{
  144. height: 100%;
  145. }
  146. .unclear-container {
  147. width: 100%;
  148. height: 100%;
  149. display: flex;
  150. flex-direction: column;
  151. padding-bottom: 204rpx;
  152. // 列表
  153. .scroll-con{
  154. flex: 1;
  155. overflow: auto;
  156. }
  157. // 列表样式
  158. .cell-item-con{
  159. .cell-item{
  160. margin: $uni-spacing-col-base $uni-spacing-row-base;
  161. background-color: #fff;
  162. border-radius: $uni-border-radius-base;
  163. color: $uni-text-color;
  164. font-size: $uni-font-size-base;
  165. box-shadow: 3rpx 3rpx 5rpx #eee;
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. padding: $uni-spacing-col-base $uni-spacing-row-base;
  170. position: relative;
  171. .cell-item-pic{
  172. flex-shrink: 0;
  173. margin-right: 10rpx;
  174. }
  175. .cell-item-c{
  176. flex-grow: 1;
  177. display: flex;
  178. justify-content: space-around;
  179. align-items: center;
  180. .cell-item-info{
  181. flex-grow: 1;
  182. .cell-item-info-network{
  183. word-break: break-all;
  184. margin-bottom: $uni-spacing-col-base;
  185. display: inline-block;
  186. position: relative;
  187. }
  188. .cell-item-info-weight{
  189. font-size: 24rpx;
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. .cell-item-weight-bar{
  194. position: relative;
  195. display: inline-block;
  196. padding-right: 50rpx;
  197. &:nth-child(2){
  198. padding-right: 76rpx;
  199. }
  200. }
  201. }
  202. }
  203. .arrow-right{
  204. flex-shrink: 0;
  205. margin-left: 64rpx;
  206. }
  207. }
  208. .handle-btn{
  209. position: absolute;
  210. right: $uni-spacing-row-sm;
  211. top: $uni-spacing-col-sm;
  212. }
  213. }
  214. }
  215. .footer-bar{
  216. width: 100%;
  217. height: 204rpx;
  218. padding: 0 10%;
  219. position: fixed;
  220. bottom: 0;
  221. left: 0;
  222. text-align: center;
  223. .footer-handle-btn{
  224. display: block;
  225. .btn-icon{
  226. margin-right: 10rpx;
  227. }
  228. }
  229. .scan-btn{
  230. margin-top: 24rpx;
  231. margin-bottom: 20rpx;
  232. }
  233. }
  234. }
  235. </style>