settlementAyDetail.vue 7.0 KB

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