settlementAyDetail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="settlement-pages">
  3. <!-- 授信结算 -->
  4. <view class="sxjs-box" v-if="totalMount">
  5. <view class="sxjs-head flex flex_column align-center justify_center">
  6. <view>累计待结算</view>
  7. <view class="edu">
  8. ¥<text>{{totalMount}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="monthSel">
  13. <u-dropdown>
  14. <u-dropdown-item @change="changeMonth" v-model="month" :title="mothTitle" :options="monthList"></u-dropdown-item>
  15. </u-dropdown>
  16. </view>
  17. <view class="ds-box">
  18. <scroll-view style="height: calc(100vh - 370upx);position: relative;" scroll-y @scrolltolower="loadMore">
  19. <!-- 列表 -->
  20. <view class="ds-list" v-for="item in shelfOrderList" :key="item.id">
  21. <view class="flex align_center">
  22. <view class="orderNo">{{item.shelfOrderNo}}</view>
  23. <view class="time">{{item.createDate}}</view>
  24. </view>
  25. <view class="flex align_center">
  26. <view class="carImage flex flex_column justify_center">
  27. <u-image :src="item.vehicleLogo" border-radius="30" width="100" height="100" bg-color="#EBEBEB" ></u-image>
  28. </view>
  29. <view class="carModel">
  30. {{item.vehicleModel}}
  31. </view>
  32. <view class="price">¥{{item.settleAmount}}</view>
  33. </view>
  34. </view>
  35. <view style="padding-top: 10%;border:0" v-if="shelfOrderList.length==0 && status!='loading'">
  36. <u-empty :src="`/static/nodata.png`" icon-size="180" text="暂无记录" img-width="180" mode="list"></u-empty>
  37. </view>
  38. <view style="padding: 20upx;">
  39. <u-loadmore load-text="正在加载..." v-if="(allData.length>=shelfOrderList.length&&shelfOrderList.length)||status=='loading'" :status="status" />
  40. </view>
  41. </scroll-view>
  42. </view>
  43. <view class="footer" v-if="totalMount">
  44. <u-button :throttle-time="100" @click="toPay" :style="{background:'#1283d4',color:'#fff'}" shape="circle" type="success">
  45. 立即支付(¥{{totalMount}})
  46. </u-button>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import { waitSettleForMonth } from '@/api/shelf.js'
  52. export default {
  53. data() {
  54. return {
  55. month: -1,
  56. info: null,
  57. monthList: [],
  58. mothTitle: '全部待结算',
  59. waitSettleAmount: 0, // 总金额
  60. curSettleAmount: 0, // 当前总金额
  61. shelfOrderList: [],
  62. pageNo:1,
  63. pageSize:10,
  64. baseData: [],
  65. allData: [],
  66. status: 'loading'
  67. }
  68. },
  69. computed: {
  70. totalMount() {
  71. let tm = 0
  72. this.shelfOrderList.map(item => {
  73. tm = tm + item.settleAmount
  74. })
  75. return tm.toFixed(2)
  76. },
  77. shelfOrderSnList(){
  78. let tm = []
  79. this.shelfOrderList.map(item => {
  80. tm.push(item.shelfOrderSn)
  81. })
  82. return tm
  83. }
  84. },
  85. onLoad(opts) {
  86. this.info = JSON.parse(decodeURIComponent(opts.data.replace(/%/g, '%25')))
  87. this.month = opts.month
  88. this.mothTitle = (opts.month!=-1?(opts.month+'月'):'全部') + '待结算'
  89. this.waitSettleAmount = this.info.waitSettleAmount
  90. this.monthList = [
  91. {
  92. label: '全部',
  93. value: -1
  94. }
  95. ]
  96. this.getAyDjsList()
  97. },
  98. methods: {
  99. // 去支付
  100. toPay(){
  101. this.info.shelfOrderSnList = this.shelfOrderSnList
  102. this.info.waitSettleAmount = this.totalMount
  103. uni.navigateTo({
  104. url:'/pages/pay/settlementPay/settlementPay?data='+encodeURIComponent(JSON.stringify(this.info))
  105. })
  106. },
  107. // 获取待结算列表
  108. getAyDjsList(){
  109. waitSettleForMonth().then(res => {
  110. console.log(res)
  111. const list = res.data || []
  112. list.map(item => {
  113. this.monthList.push({label:item.month,value:item.month})
  114. })
  115. this.baseData = list
  116. // 分页格式化数据
  117. this.formatData()
  118. })
  119. },
  120. formatData(){
  121. // 全部
  122. if(this.month == -1){
  123. let all = []
  124. this.baseData.map(item => {
  125. all = all.concat(item.shelfOrderList)
  126. })
  127. this.allData = all
  128. this.curSettleAmount = this.waitSettleAmount
  129. }else{
  130. // 某一月
  131. const curRow = this.baseData.find(item => item.month == this.month)
  132. this.allData = curRow.shelfOrderList
  133. this.curSettleAmount = curRow.settleAmount
  134. }
  135. // 默认显示第一页
  136. const allTotal = this.allData.length
  137. this.shelfOrderList = this.allData.slice(0,allTotal<=this.pageSize?allTotal:this.pageSize)
  138. this.status = allTotal>=this.shelfOrderList.length ? "nomore" : 'loadmore'
  139. },
  140. changeMonth(e){
  141. console.log(e)
  142. this.mothTitle = (e!=-1?(e+'月'):'全部') + '待结算'
  143. this.pageNo = 1
  144. this.status = "loading"
  145. this.formatData()
  146. },
  147. loadMore(event){
  148. console.log(event,'滚动到底部')
  149. const curCount = this.shelfOrderList.length
  150. const total = this.allData.length
  151. if(curCount<total){
  152. // 下页
  153. this.pageNo = this.pageNo + 1
  154. this.status = "loading"
  155. setTimeout(()=>{
  156. const end = this.pageNo * this.pageSize
  157. this.shelfOrderList = this.allData.slice(0,end)
  158. this.status = total>=this.shelfOrderList.length ? "nomore" : 'loadmore'
  159. },500)
  160. }else{
  161. this.status = "nomore"
  162. }
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="less">
  168. .settlement-pages{
  169. height: 100vh;
  170. display: flex;
  171. flex-direction: column;
  172. > view{
  173. padding: 30rpx 50rpx;
  174. }
  175. .monthSel{
  176. padding: 0;
  177. margin-top: -20rpx;
  178. > view{
  179. .u-dropdown__menu{
  180. width: 40%;
  181. }
  182. }
  183. }
  184. .sxjs-box{
  185. > view{
  186. background-color: #fff;
  187. border-radius: 25rpx;
  188. min-height: 100rpx;
  189. padding: 30rpx;
  190. color: #666;
  191. }
  192. .sxjs-head{
  193. width: 100%;
  194. text-align: center;
  195. font-size: 30rpx;
  196. margin-bottom: 0;
  197. > .edu{
  198. color: #FA3534;
  199. padding: 10rpx 0;
  200. font-size: 36rpx;
  201. text{
  202. font-size: 46rpx;
  203. font-style: italic;
  204. font-weight: 900;
  205. }
  206. }
  207. }
  208. }
  209. .ds-box{
  210. flex-grow: 1;
  211. padding: 0 50rpx;
  212. overflow: auto;
  213. .ds-list{
  214. background-color: #fff;
  215. border-radius: 25rpx;
  216. margin-bottom: 20rpx;
  217. min-height: 100rpx;
  218. padding: 10rpx;
  219. color: #666;
  220. > view{
  221. padding: 10rpx;
  222. font-size: 28rpx;
  223. &:first-child{
  224. justify-content: space-between;
  225. }
  226. .time{
  227. color: #666E75;
  228. font-size: 24rpx;
  229. }
  230. .price{
  231. color: #FA3534;
  232. font-size: 32rpx;
  233. padding-left: 20rpx;
  234. }
  235. .carImage{
  236. padding-right: 20rpx;
  237. }
  238. .carModel{
  239. color: #222;
  240. font-size: 28rpx;
  241. flex-grow: 1;
  242. }
  243. .orderNo{
  244. font-size: 28rpx;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. </style>