chooseNetwork.vue 7.1 KB

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