index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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" bgColor="#c90101" :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" bgColor="#01c9b2" 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" bgColor="#05695d" 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" hover-class="none" :custom-style="scanBtnStyle" shape="circle" @click="clearingOutlets" 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" hover-class="none" :custom-style="btnStyle" shape="circle" @click="openQuery" size="medium">
  42. <u-icon name="plus" class="btn-icon" :size="28" color="#606266"></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: '#01c9b2',
  62. backgroundColor: '#01c9b2',
  63. color: '#fff'
  64. },
  65. scrollTop: 0, // 滚动条位置
  66. scanBtnStyle: { // 自定义按钮样式
  67. borderColor: '#07c160',
  68. backgroundColor: '#07c160',
  69. width: '100%'
  70. },
  71. btnStyle: { // 自定义按钮样式
  72. width: '100%'
  73. }
  74. }
  75. },
  76. onShow() {
  77. // this.refresh({})
  78. },
  79. methods:{
  80. clearingOutlets(){
  81. if(this.listdata.length==0){
  82. uni.showToast({ title: '请先选择待清运网点,再进行扫码清运', icon: 'none' })
  83. }else{
  84. this.openScan()
  85. }
  86. },
  87. // 扫码清运
  88. openScan(){
  89. // 调起微信扫码
  90. scanCode().then(res => {
  91. this.code = res.result
  92. // 请求接口
  93. // return verShow(res.result)
  94. }).then(res => {
  95. if (res.status == 200) {
  96. this.info = res.data
  97. this.showInfo = true
  98. this.carNum = ''
  99. } else {
  100. wx.showToast({
  101. title: res.message,
  102. icon: 'none',
  103. duration: 2500
  104. })
  105. }
  106. })
  107. },
  108. // 增加清运网点
  109. openQuery(){
  110. uni.navigateTo({
  111. url: '/pages/cleared/chooseNetwork'
  112. })
  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. // if(this.pageNo>1){
  130. // this.listdata = this.listdata.concat(res.data.list || [])
  131. // }else{
  132. // this.listdata = res.data.list || []
  133. // this.scrollTop = 0
  134. // }
  135. // this.total = res.data.count || 0
  136. // this.noDataText = '暂无数据'
  137. // } else {
  138. // this.noDataText = res.message
  139. // this.listdata = []
  140. // this.total = 0
  141. // }
  142. // this.status = "loadmore"
  143. // })
  144. },
  145. // 移除
  146. removeFun(row){
  147. const _this = this
  148. uni.showModal({
  149. title: '提示',
  150. content: '确认移除该网点的清运单?',
  151. success(res) {
  152. if (res.confirm) {
  153. // GoldLogCancel({ id: row.id }).then(ret => {
  154. // if(ret.status == 200){
  155. // uni.showToast({ title: ret.message, icon: 'none' })
  156. // _this.searchHandle(1)
  157. // }
  158. // })
  159. }
  160. }
  161. })
  162. },
  163. // 查看详情
  164. goPage(row){
  165. uni.navigateTo({
  166. url: '/pages/cleared/details'
  167. })
  168. },
  169. // scroll-view到底部加载更多
  170. onreachBottom() {
  171. if(this.listdata.length < this.total){
  172. this.pageNo += 1
  173. this.searchHandle()
  174. }else{
  175. uni.showToast({ title: '已经到底了', icon: 'none' })
  176. this.status = "nomore"
  177. }
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. page{
  184. height: 100%;
  185. }
  186. .unclear-container {
  187. width: 100%;
  188. height: 100%;
  189. display: flex;
  190. flex-direction: column;
  191. padding-bottom: 204rpx;
  192. // 列表
  193. .scroll-con{
  194. flex: 1;
  195. overflow: auto;
  196. }
  197. // 列表样式
  198. .cell-item-con{
  199. .cell-item{
  200. margin: $uni-spacing-col-base $uni-spacing-row-base;
  201. background-color: #fff;
  202. border-radius: $uni-border-radius-base;
  203. color: $uni-text-color;
  204. font-size: $uni-font-size-base;
  205. box-shadow: 3rpx 3rpx 5rpx #eee;
  206. display: flex;
  207. justify-content: space-between;
  208. align-items: center;
  209. padding: $uni-spacing-col-base $uni-spacing-row-base;
  210. position: relative;
  211. .cell-item-pic{
  212. flex-shrink: 0;
  213. margin-right: 10rpx;
  214. }
  215. .cell-item-c{
  216. flex-grow: 1;
  217. display: flex;
  218. justify-content: space-around;
  219. align-items: center;
  220. .cell-item-info{
  221. flex-grow: 1;
  222. .cell-item-info-network{
  223. word-break: break-all;
  224. margin-bottom: $uni-spacing-col-base;
  225. display: inline-block;
  226. position: relative;
  227. }
  228. .cell-item-info-weight{
  229. font-size: 24rpx;
  230. display: flex;
  231. align-items: center;
  232. justify-content: space-between;
  233. .cell-item-weight-bar{
  234. position: relative;
  235. display: inline-block;
  236. padding-right: 50rpx;
  237. &:nth-child(2){
  238. padding-right: 76rpx;
  239. }
  240. }
  241. }
  242. }
  243. .arrow-right{
  244. flex-shrink: 0;
  245. margin-left: 64rpx;
  246. }
  247. }
  248. .handle-btn{
  249. position: absolute;
  250. right: $uni-spacing-row-sm;
  251. top: $uni-spacing-col-sm;
  252. }
  253. }
  254. }
  255. .footer-bar{
  256. width: 100%;
  257. height: 204rpx;
  258. padding: 0 10%;
  259. position: fixed;
  260. bottom: 0;
  261. left: 0;
  262. text-align: center;
  263. .footer-handle-btn{
  264. display: block;
  265. .btn-icon{
  266. margin-right: 10rpx;
  267. }
  268. }
  269. .scan-btn{
  270. margin-top: 24rpx;
  271. margin-bottom: 20rpx;
  272. }
  273. }
  274. }
  275. </style>