chooseNetwork.vue 7.7 KB

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