settlementAyDetail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 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" :custom-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, findStoreShelfSettleRule } 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.getDetail()
  88. this.month = opts.month
  89. this.mothTitle = (opts.month!=-1?(opts.month+'月'):'全部') + '待结算'
  90. this.monthList = [
  91. {
  92. label: '全部',
  93. value: -1
  94. }
  95. ]
  96. },
  97. methods: {
  98. // 查询详情
  99. getDetail(){
  100. findStoreShelfSettleRule().then(res => {
  101. console.log(res)
  102. if(res.status == 200){
  103. this.info = res.data
  104. this.waitSettleAmount = this.info.waitSettleAmount
  105. this.getAyDjsList()
  106. }
  107. })
  108. },
  109. // 去支付
  110. toPay(){
  111. this.info.shelfOrderSnList = this.shelfOrderSnList
  112. this.info.waitSettleAmount = this.totalMount
  113. uni.navigateTo({
  114. url:'/pages/pay/settlementPay/settlementPay?data='+encodeURIComponent(JSON.stringify(this.info))
  115. })
  116. },
  117. // 获取待结算列表
  118. getAyDjsList(){
  119. waitSettleForMonth().then(res => {
  120. console.log(res)
  121. const list = res.data || []
  122. list.map(item => {
  123. this.monthList.push({label:item.month,value:item.month})
  124. })
  125. this.baseData = list
  126. // 分页格式化数据
  127. this.formatData()
  128. })
  129. },
  130. formatData(){
  131. // 全部
  132. if(this.month == -1){
  133. let all = []
  134. this.baseData.map(item => {
  135. all = all.concat(item.shelfOrderList)
  136. })
  137. this.allData = all
  138. this.curSettleAmount = this.waitSettleAmount
  139. }else{
  140. // 某一月
  141. const curRow = this.baseData.find(item => item.month == this.month)
  142. this.allData = curRow.shelfOrderList
  143. this.curSettleAmount = curRow.settleAmount
  144. }
  145. // 默认显示第一页
  146. const allTotal = this.allData.length
  147. this.shelfOrderList = this.allData.slice(0,allTotal<=this.pageSize?allTotal:this.pageSize)
  148. this.status = allTotal>=this.shelfOrderList.length ? "nomore" : 'loadmore'
  149. },
  150. changeMonth(e){
  151. console.log(e)
  152. this.mothTitle = (e!=-1?(e+'月'):'全部') + '待结算'
  153. this.pageNo = 1
  154. this.status = "loading"
  155. this.formatData()
  156. },
  157. loadMore(event){
  158. console.log(event,'滚动到底部')
  159. const curCount = this.shelfOrderList.length
  160. const total = this.allData.length
  161. if(curCount<total){
  162. // 下页
  163. this.pageNo = this.pageNo + 1
  164. this.status = "loading"
  165. setTimeout(()=>{
  166. const end = this.pageNo * this.pageSize
  167. this.shelfOrderList = this.allData.slice(0,end)
  168. this.status = total>=this.shelfOrderList.length ? "nomore" : 'loadmore'
  169. },500)
  170. }else{
  171. this.status = "nomore"
  172. }
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="less">
  178. .settlement-pages{
  179. width: 100%;
  180. height: 100vh;
  181. display: flex;
  182. flex-direction: column;
  183. > view{
  184. padding: 30rpx 50rpx;
  185. }
  186. .monthSel{
  187. padding: 0;
  188. margin-top: -20rpx;
  189. > view{
  190. .u-dropdown__menu{
  191. width: 40%;
  192. }
  193. }
  194. }
  195. .sxjs-box{
  196. > view{
  197. background-color: #fff;
  198. border-radius: 25rpx;
  199. min-height: 100rpx;
  200. padding: 30rpx;
  201. color: #666;
  202. }
  203. .sxjs-head{
  204. width: 100%;
  205. text-align: center;
  206. font-size: 30rpx;
  207. margin-bottom: 0;
  208. > .edu{
  209. color: #FA3534;
  210. padding: 10rpx 0;
  211. font-size: 36rpx;
  212. text{
  213. font-size: 46rpx;
  214. font-style: italic;
  215. font-weight: 900;
  216. }
  217. }
  218. }
  219. }
  220. .ds-box{
  221. flex-grow: 1;
  222. padding: 0 50rpx;
  223. overflow: auto;
  224. .ds-list{
  225. background-color: #fff;
  226. border-radius: 25rpx;
  227. margin-bottom: 20rpx;
  228. min-height: 100rpx;
  229. padding: 10rpx;
  230. color: #666;
  231. > view{
  232. padding: 10rpx;
  233. font-size: 28rpx;
  234. &:first-child{
  235. justify-content: space-between;
  236. }
  237. .time{
  238. color: #666E75;
  239. font-size: 24rpx;
  240. }
  241. .price{
  242. color: #FA3534;
  243. font-size: 32rpx;
  244. padding-left: 20rpx;
  245. }
  246. .carImage{
  247. padding-right: 20rpx;
  248. }
  249. .carModel{
  250. color: #222;
  251. font-size: 28rpx;
  252. flex-grow: 1;
  253. }
  254. .orderNo{
  255. font-size: 24rpx;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. </style>