historyOrder.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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.originalAmount || 0)}}</text>
  19. </view>
  20. <view class="cont-bot flex align_center justify_between">
  21. <view @click.stop="callPhone(item.contactMobile)" 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. callPhone(phone) {
  74. uni.makePhoneCall({
  75. phoneNumber: phone
  76. });
  77. },
  78. // 进入详情
  79. intoDetail(item) {
  80. uni.navigateTo({
  81. url: '/pages/order/hisOrderDetail?orderNo='+item.orderReserveNo
  82. })
  83. },
  84. // scroll-view到底部加载更多
  85. onreachBottom() {
  86. this.action = 'onreachBottom'
  87. if (this.list.length < this.total) {
  88. this.pageNo += 1
  89. this.getRow()
  90. } else {
  91. if(this.list.length) {
  92. uni.showToast({
  93. title: '已经到底了',
  94. icon: 'none'
  95. });
  96. }
  97. this.status = "nomore"
  98. }
  99. },
  100. // 查询列表
  101. getRow(pageNo) {
  102. this.status = "loadmore"
  103. if (pageNo) {
  104. this.pageNo = pageNo
  105. }
  106. let params = {
  107. pageNo: this.pageNo,
  108. pageSize: this.pageSize,
  109. }
  110. this.noDataText = '暂无数据'
  111. this.status = "loading"
  112. historyOrderQuery(params).then(res => {
  113. if (res.status == 200) {
  114. if (this.pageNo > 1) {
  115. this.list = this.list.concat(res.data.list || [])
  116. } else {
  117. this.list = res.data.list || []
  118. }
  119. this.total = res.data.count || 0
  120. } else {
  121. this.list = []
  122. this.total = 0
  123. this.noDataText = res.message
  124. }
  125. this.status = "loadmore"
  126. })
  127. },
  128. // 总计查询
  129. getTotalData() {
  130. historyOrderTotal({}).then(res=>{
  131. if(res.status == 200 && res.data) {
  132. this.totalWeight = res.data.totalWeight/1000 || 0
  133. this.totalMoney = res.data.originalAmount || 0
  134. }
  135. })
  136. },
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. page{
  142. height: 100%;
  143. width: 100%;
  144. }
  145. .order-content{
  146. width: 100%;
  147. height: 100%;
  148. background-color: #F5F5F5;
  149. display: flex;
  150. flex-direction: column;
  151. .total{
  152. width: 100%;
  153. height: 80rpx;
  154. background: rgba(255, 209, 0, 0.4);
  155. opacity: 1;
  156. padding-left: 32rpx;
  157. line-height: 80rpx;
  158. font-size: 30rpx;
  159. color: #191919;
  160. }
  161. .list{
  162. flex: 1;
  163. width: 100%;
  164. overflow: auto;
  165. padding: 0 26rpx;
  166. box-sizing: border-box;
  167. .list-item{
  168. width: 100%;
  169. border-radius: 24rpx;
  170. margin-top: 20rpx;
  171. background-color: #fff;
  172. .cont{
  173. padding: 24rpx 32rpx;
  174. }
  175. .title{
  176. text{
  177. color: #666E75;
  178. font-size: 28rpx;
  179. }
  180. view{
  181. color: #999999;
  182. font-size: 32rpx;
  183. .arrow-right{
  184. margin-left: 10rpx;
  185. }
  186. }
  187. }
  188. .cont-top{
  189. text:first-child{
  190. font-size: 36rpx;
  191. color: #222222;
  192. font-weight: 600;
  193. }
  194. text:last-child{
  195. font-size: 32rpx;
  196. color: #222222;
  197. }
  198. }
  199. .cont-bot{
  200. font-size: 30rpx;
  201. color: #4C4C4C;
  202. margin-top: 20rpx;
  203. .phone{
  204. width: 28rpx;
  205. height: 28rpx;
  206. margin-right: 10rpx;
  207. }
  208. // text:last-child{
  209. // font-size: 24rpx;
  210. // color: #666E75;
  211. // }
  212. }
  213. }
  214. }
  215. .nodata{
  216. padding-top: 30vh;
  217. }
  218. }
  219. </style>