chooseNetwork.vue 5.8 KB

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