historyOrder.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="order-content">
  3. <view class="total">
  4. 总计:{{totalWeight}}kg,{{totalMoney}}元
  5. </view>
  6. <scroll-view scroll-y class="list" @scrolltolower="onreachBottom">
  7. <view class="list-item" v-for="item in list" :key="item.id" @click="intoDetail(item)">
  8. <view class="cont title flex align_center justify_between">
  9. <text>{{item.createDate}}</text>
  10. <view class="flex align_center">
  11. <text>查看详情</text>
  12. <u-icon class="arrow-right" name="arrow-right" color="#999999" size="32"></u-icon>
  13. </view>
  14. </view>
  15. <view class="cont">
  16. <view class="cont-top flex align_center justify_between">
  17. <text>{{item.contactName||'--'}}</text>
  18. <text>{{item.payAmount?'¥'+item.payAmount:'--'}}</text>
  19. </view>
  20. <view class="cont-bot flex align_center justify_between">
  21. <view class="flex align_center">
  22. <u-icon class="phone" name="icon_phone" custom-prefix="custom-icon" size="28" color="#999999"></u-icon>
  23. <text>{{item.contactMobile}}</text>
  24. </view>
  25. <text>{{item.payTypeDictValue||'--'}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="nodata" v-if="list.length==0 && status!='loading'">
  30. <u-empty src="/static/def_result.png" :text="noDataText" icon-size="260" ></u-empty>
  31. </view>
  32. <view v-if="index==current" style="padding: 20upx;">
  33. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  34. </view>
  35. </scroll-view>
  36. </view>
  37. </template>
  38. <script>
  39. import { historyOrderQuery, historyOrderTotal } from '@/api/order.js'
  40. export default {
  41. data() {
  42. return {
  43. list: [], // 列表数据
  44. pageNo: 1, // 当前页码
  45. pageSize: 10, // 每页条数
  46. total: 0, // 数据总条数
  47. noDataText: '暂无数据', // 列表请求状态提示语
  48. status: 'loadmore', // 加载中状态
  49. totalWeight: 0, // 总重量
  50. totalMoney: 0, //总金额
  51. }
  52. },
  53. onLoad() {
  54. this.pageInit()
  55. // 开启分享
  56. uni.showShareMenu({
  57. withShareTicket: true,
  58. menus: ['shareAppMessage', 'shareTimeline']
  59. })
  60. },
  61. methods: {
  62. pageInit() {
  63. this.pageNo = 1
  64. this.pageSize = 10
  65. this.total = 0
  66. this.totalWeight = 0
  67. this.totalMoney = 0
  68. this.list = []
  69. this.getRow(1)
  70. this.getTotalData()
  71. },
  72. // 进入详情
  73. intoDetail(item) {
  74. uni.navigateTo({
  75. url: '/pages/order/hisOrderDetail?orderNo='+item.orderReserveNo
  76. })
  77. },
  78. // scroll-view到底部加载更多
  79. onreachBottom() {
  80. this.action = 'onreachBottom'
  81. if (this.list.length < this.total) {
  82. this.pageNo += 1
  83. this.getRow()
  84. } else {
  85. if(this.list.length) {
  86. uni.showToast({
  87. title: '已经到底了',
  88. icon: 'none'
  89. });
  90. }
  91. this.status = "nomore"
  92. }
  93. },
  94. // 查询列表
  95. getRow(pageNo) {
  96. this.status = "loadmore"
  97. if (pageNo) {
  98. this.pageNo = pageNo
  99. }
  100. let params = {
  101. pageNo: this.pageNo,
  102. pageSize: this.pageSize,
  103. }
  104. this.noDataText = '暂无数据'
  105. this.status = "loading"
  106. historyOrderQuery(params).then(res => {
  107. if (res.status == 200) {
  108. if (this.pageNo > 1) {
  109. this.list = this.list.concat(res.data.list || [])
  110. } else {
  111. this.list = res.data.list || []
  112. }
  113. this.total = res.data.count || 0
  114. } else {
  115. this.list = []
  116. this.total = 0
  117. this.noDataText = res.message
  118. }
  119. this.status = "loadmore"
  120. })
  121. },
  122. // 总计查询
  123. getTotalData() {
  124. historyOrderTotal({}).then(res=>{
  125. if(res.status == 200 && res.data) {
  126. this.totalWeight = res.data.totalAllWeight/1000 || 0
  127. this.totalMoney = res.data.originalAllAmount || 0
  128. }
  129. })
  130. },
  131. }
  132. }
  133. </script>
  134. <style lang="scss">
  135. page{
  136. height: 100%;
  137. width: 100%;
  138. }
  139. .order-content{
  140. width: 100%;
  141. height: 100%;
  142. background-color: #F5F5F5;
  143. display: flex;
  144. flex-direction: column;
  145. .total{
  146. width: 100%;
  147. height: 80rpx;
  148. background: rgba(255, 209, 0, 0.4);
  149. opacity: 1;
  150. padding-left: 32rpx;
  151. line-height: 80rpx;
  152. font-size: 30rpx;
  153. color: #191919;
  154. }
  155. .list{
  156. flex: 1;
  157. width: 100%;
  158. overflow: auto;
  159. padding: 0 26rpx;
  160. box-sizing: border-box;
  161. .list-item{
  162. width: 100%;
  163. border-radius: 24rpx;
  164. margin-top: 20rpx;
  165. background-color: #fff;
  166. .cont{
  167. padding: 24rpx 32rpx;
  168. }
  169. .title{
  170. text{
  171. color: #666E75;
  172. font-size: 28rpx;
  173. }
  174. view{
  175. color: #999999;
  176. font-size: 32rpx;
  177. .arrow-right{
  178. margin-left: 10rpx;
  179. }
  180. }
  181. }
  182. .cont-top{
  183. text:first-child{
  184. font-size: 36rpx;
  185. color: #222222;
  186. font-weight: 600;
  187. }
  188. text:last-child{
  189. font-size: 32rpx;
  190. color: #222222;
  191. }
  192. }
  193. .cont-bot{
  194. font-size: 28rpx;
  195. color: #4C4C4C;
  196. margin-top: 20rpx;
  197. .phone{
  198. width: 28rpx;
  199. height: 28rpx;
  200. margin-right: 10rpx;
  201. }
  202. text:last-child{
  203. font-size: 24rpx;
  204. color: #666E75;
  205. }
  206. }
  207. }
  208. }
  209. .nodata{
  210. padding-top: 30vh;
  211. }
  212. }
  213. </style>