index.vue 7.1 KB

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