teamOrder.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="container">
  3. <tui-tabs :top="0" :tabs="statusType" :isFixed="scrollTop>=0" :currentTab="currentTab" selectedColor="#E41F19"
  4. sliderBgColor="#E41F19" @change="statusTap" itemWidth="20%"></tui-tabs>
  5. <!--选项卡逻辑自己实现即可,此处未做处理-->
  6. <view :class="{'tui-order-list':scrollTop>=0}">
  7. <view class="tui-order-item" v-for="(item,orderIndex) in orderList" :key="orderIndex">
  8. <tui-list-cell :hover="false" :lineLeft="false">
  9. <view class="tui-goods-title">
  10. <view>订单号:{{item.order_num_alias}}</view>
  11. <view class="tui-order-status">{{item.statusStr}}</view>
  12. </view>
  13. </tui-list-cell>
  14. <block v-for="(goodsitem,index) in item.goodsMap" :key="index">
  15. <tui-list-cell padding="0">
  16. <view class="tui-goods-item">
  17. <image :src="goodsitem.image" class="tui-goods-img"></image>
  18. <view class="tui-goods-center">
  19. <view class="tui-goods-name">{{goodsitem.name}}</view>
  20. <view v-if="goodsitem.label" class="tui-goods-attr">{{goodsitem.label}}</view>
  21. </view>
  22. <view class="tui-price-right">
  23. <view>¥{{goodsitem.price}}</view>
  24. <view>x{{goodsitem.quantity}}</view>
  25. </view>
  26. </view>
  27. </tui-list-cell>
  28. </block>
  29. <tui-list-cell :hover="false" unlined>
  30. <view class="tui-goods-price">
  31. <view>
  32. <!--共4件商品--> 合计:
  33. </view>
  34. <view class="tui-size-24">¥</view>
  35. <view class="tui-price-large">{{item.total}}</view>
  36. <view class="tui-size-24"></view>
  37. </view>
  38. </tui-list-cell>
  39. </view>
  40. </view>
  41. <!--加载loadding-->
  42. <tui-loadmore v-if="loadding" :index="3" type="red"></tui-loadmore>
  43. <tui-nomore v-if="!pullUpOn" backgroundColor="#fafafa"></tui-nomore>
  44. <!--加载loadding-->
  45. </view>
  46. </template>
  47. <script>
  48. import pay from '@/common/pay.js'
  49. export default {
  50. data() {
  51. return {
  52. statusType: [],
  53. currentType: 0,
  54. currentTab: 0,
  55. pageIndex: 1,
  56. loadding: false,
  57. pullUpOn: true,
  58. scrollTop: 0,
  59. orderList: [],
  60. where: {
  61. status: 0,
  62. ptype:0,
  63. keyword: '',
  64. page: 1,
  65. limit: 10,
  66. },
  67. }
  68. },
  69. onLoad: function(e) {
  70. let _this = this
  71. _this.$request.get('orderstatus.listname').then(res => {
  72. if (res.errno == 0) {
  73. _this.statusType = res.data;
  74. }
  75. })
  76. },
  77. onShow: function(e) {
  78. this.getorderlist(true);
  79. },
  80. methods: {
  81. statusTap: function(e) {
  82. this.currentTab = e.index
  83. this.currentType = this.statusType[this.currentTab].id;
  84. this.getorderlist(true);
  85. },
  86. getorderlist: function(isPage) {
  87. var _this = this
  88. console.log(_this.loadend);
  89. if (_this.loading) return;
  90. if (isPage === true) {
  91. _this.where.page = 1;
  92. _this.orderList = [];
  93. }else{
  94. if (_this.loadend) return;
  95. }
  96. _this.where.samkey = (new Date()).valueOf();
  97. _this.where.status = _this.currentType;
  98. //console.log(_this.where);
  99. _this.$request.post('order.teamorder', _this.where).then(res => {
  100. if (res.errno == 0) {
  101. _this.orderList = _this.orderList.concat(res.data.data);
  102. _this.where.page = _this.where.page + 1
  103. _this.loadend = _this.orderList.length < _this.where.limit;
  104. }
  105. _this.loading = false;
  106. })
  107. }
  108. },
  109. /**
  110. * 页面相关事件处理函数--监听用户下拉动作
  111. */
  112. onPullDownRefresh: function() {
  113. this.where.page = 1;
  114. this.loadend = false;
  115. this.orderList = [];
  116. this.getorderlist();
  117. setTimeout(() => {
  118. uni.stopPullDownRefresh()
  119. }, 200);
  120. },
  121. /**
  122. * 页面上拉触底事件的处理函数
  123. */
  124. onReachBottom() {
  125. //只是测试效果,逻辑以实际数据为准
  126. this.loadding = true
  127. this.pullUpOn = true
  128. this.getorderlist();
  129. setTimeout(() => {
  130. this.loadding = false
  131. this.pullUpOn = false
  132. }, 1000)
  133. },
  134. onPageScroll(e) {
  135. this.scrollTop = e.scrollTop;
  136. }
  137. }
  138. </script>
  139. <style>
  140. .container {
  141. padding-bottom: env(safe-area-inset-bottom);
  142. }
  143. .tui-order-list {
  144. margin-top: 80rpx;
  145. }
  146. .tui-order-item {
  147. margin-top: 20rpx;
  148. border-radius: 10rpx;
  149. overflow: hidden;
  150. }
  151. .tui-goods-title {
  152. width: 100%;
  153. font-size: 28rpx;
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-between;
  157. }
  158. .tui-order-status {
  159. color: #888;
  160. font-size: 26rpx;
  161. }
  162. .tui-goods-item {
  163. width: 100%;
  164. padding: 20rpx 30rpx;
  165. box-sizing: border-box;
  166. display: flex;
  167. justify-content: space-between;
  168. }
  169. .tui-goods-img {
  170. width: 180rpx;
  171. height: 180rpx;
  172. display: block;
  173. flex-shrink: 0;
  174. }
  175. .tui-goods-center {
  176. flex: 1;
  177. padding: 20rpx 8rpx;
  178. box-sizing: border-box;
  179. }
  180. .tui-goods-name {
  181. max-width: 310rpx;
  182. word-break: break-all;
  183. overflow: hidden;
  184. text-overflow: ellipsis;
  185. display: -webkit-box;
  186. -webkit-box-orient: vertical;
  187. -webkit-line-clamp: 2;
  188. font-size: 26rpx;
  189. line-height: 32rpx;
  190. }
  191. .tui-goods-attr {
  192. font-size: 22rpx;
  193. color: #888888;
  194. line-height: 32rpx;
  195. padding-top: 20rpx;
  196. word-break: break-all;
  197. overflow: hidden;
  198. text-overflow: ellipsis;
  199. display: -webkit-box;
  200. -webkit-box-orient: vertical;
  201. -webkit-line-clamp: 2;
  202. }
  203. .tui-price-right {
  204. text-align: right;
  205. font-size: 24rpx;
  206. color: #888888;
  207. line-height: 30rpx;
  208. padding-top: 20rpx;
  209. }
  210. .tui-color-red {
  211. color: #E41F19;
  212. padding-right: 30rpx;
  213. }
  214. .tui-goods-price {
  215. width: 100%;
  216. display: flex;
  217. align-items: flex-end;
  218. justify-content: flex-end;
  219. font-size: 24rpx;
  220. }
  221. .tui-size-24 {
  222. font-size: 24rpx;
  223. line-height: 24rpx;
  224. }
  225. .tui-price-large {
  226. font-size: 32rpx;
  227. line-height: 30rpx;
  228. font-weight: 500;
  229. }
  230. .tui-order-btn {
  231. width: 100%;
  232. display: flex;
  233. align-items: center;
  234. justify-content: flex-end;
  235. background: #fff;
  236. padding: 10rpx 30rpx 20rpx;
  237. box-sizing: border-box;
  238. }
  239. .tui-btn-ml {
  240. margin-left: 20rpx;
  241. }
  242. </style>