index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. openScan(){
  77. // 调起微信扫码
  78. scanCode().then(res => {
  79. this.code = res.result
  80. // 请求接口
  81. // return verShow(res.result)
  82. }).then(res => {
  83. if (res.status == 200) {
  84. this.info = res.data
  85. this.showInfo = true
  86. this.carNum = ''
  87. } else {
  88. wx.showToast({
  89. title: res.message,
  90. icon: 'none',
  91. duration: 2500
  92. })
  93. }
  94. })
  95. },
  96. // 增加清运网点
  97. openQuery(){
  98. uni.navigateTo({
  99. url: '/pages/cleared/chooseNetwork'
  100. })
  101. },
  102. // 获取查询参数 刷新列表
  103. refresh(params){
  104. this.listdata = []
  105. this.total = 0
  106. this.searchHandle(1)
  107. },
  108. // 搜索查询
  109. searchHandle (pageNo) {
  110. this.status = "loading"
  111. pageNo ? this.pageNo = pageNo : null
  112. getGoldLogList({
  113. pageNo: this.pageNo,
  114. pageSize: this.pageSize
  115. }).then(res => {
  116. if (res.status == 200) {
  117. if(this.pageNo>1){
  118. this.listdata = this.listdata.concat(res.data.list || [])
  119. }else{
  120. this.listdata = res.data.list || []
  121. this.scrollTop = 0
  122. }
  123. this.total = res.data.count || 0
  124. this.noDataText = '暂无数据'
  125. } else {
  126. this.noDataText = res.message
  127. this.listdata = []
  128. this.total = 0
  129. }
  130. this.status = "loadmore"
  131. })
  132. },
  133. // 移除
  134. removeFun(row){
  135. const _this = this
  136. uni.showModal({
  137. title: '提示',
  138. content: '确认移除该网点的清运单?',
  139. success(res) {
  140. if (res.confirm) {
  141. // GoldLogCancel({ id: row.id }).then(ret => {
  142. // if(ret.status == 200){
  143. // uni.showToast({ title: ret.message, icon: 'none' })
  144. // _this.searchHandle(1)
  145. // }
  146. // })
  147. }
  148. }
  149. })
  150. },
  151. // 查看详情
  152. goPage(row){
  153. uni.navigateTo({
  154. url: '/pages/cleared/details'
  155. })
  156. },
  157. // scroll-view到底部加载更多
  158. onreachBottom() {
  159. if(this.listdata.length < this.total){
  160. this.pageNo += 1
  161. this.searchHandle()
  162. }else{
  163. uni.showToast({ title: '已经到底了', icon: 'none' })
  164. this.status = "nomore"
  165. }
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. page{
  172. height: 100%;
  173. }
  174. .unclear-container {
  175. width: 100%;
  176. height: 100%;
  177. display: flex;
  178. flex-direction: column;
  179. padding-bottom: 204rpx;
  180. // 列表
  181. .scroll-con{
  182. flex: 1;
  183. overflow: auto;
  184. }
  185. // 列表样式
  186. .cell-item-con{
  187. .cell-item{
  188. margin: $uni-spacing-col-base $uni-spacing-row-base;
  189. background-color: #fff;
  190. border-radius: $uni-border-radius-base;
  191. color: $uni-text-color;
  192. font-size: $uni-font-size-base;
  193. box-shadow: 3rpx 3rpx 5rpx #eee;
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. padding: $uni-spacing-col-base $uni-spacing-row-base;
  198. position: relative;
  199. .cell-item-pic{
  200. flex-shrink: 0;
  201. margin-right: 10rpx;
  202. }
  203. .cell-item-c{
  204. flex-grow: 1;
  205. display: flex;
  206. justify-content: space-around;
  207. align-items: center;
  208. .cell-item-info{
  209. flex-grow: 1;
  210. .cell-item-info-network{
  211. word-break: break-all;
  212. margin-bottom: $uni-spacing-col-base;
  213. display: inline-block;
  214. position: relative;
  215. }
  216. .cell-item-info-weight{
  217. font-size: 24rpx;
  218. display: flex;
  219. align-items: center;
  220. justify-content: space-between;
  221. .cell-item-weight-bar{
  222. position: relative;
  223. display: inline-block;
  224. padding-right: 50rpx;
  225. &:nth-child(2){
  226. padding-right: 76rpx;
  227. }
  228. }
  229. }
  230. }
  231. .arrow-right{
  232. flex-shrink: 0;
  233. margin-left: 64rpx;
  234. }
  235. }
  236. .handle-btn{
  237. position: absolute;
  238. right: $uni-spacing-row-sm;
  239. top: $uni-spacing-col-sm;
  240. }
  241. }
  242. }
  243. .footer-bar{
  244. width: 100%;
  245. height: 204rpx;
  246. padding: 0 10%;
  247. position: fixed;
  248. bottom: 0;
  249. left: 0;
  250. text-align: center;
  251. .footer-handle-btn{
  252. display: block;
  253. .btn-icon{
  254. margin-right: 10rpx;
  255. }
  256. }
  257. .scan-btn{
  258. margin-top: 24rpx;
  259. margin-bottom: 20rpx;
  260. }
  261. }
  262. }
  263. </style>