order.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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" @click="orderDetail(item.id)">
  16. <view class="tui-goods-item">
  17. <image :src="goodsitem.image" mode="widthFix" 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 class="tui-order-btn">
  40. <view class="tui-btn-ml">
  41. <tui-button @click="orderDetail(item.id)" type="black" plain width="152rpx" height="56rpx" :size="26"
  42. shape="circle">订单详情</tui-button>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <!--加载loadding-->
  48. <tui-loadmore v-if="loadding" :index="3" type="red"></tui-loadmore>
  49. <tui-nomore v-if="!pullUpOn" backgroundColor="#fafafa"></tui-nomore>
  50. <!--加载loadding-->
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. tabBar: [
  58. ],
  59. statusType: [],
  60. ptype:2,
  61. currentType: 0,
  62. currentTab: 0,
  63. pageIndex: 1,
  64. loadding: false,
  65. pullUpOn: true,
  66. scrollTop: 0,
  67. orderList: [],
  68. where: {
  69. status: 0,
  70. ptype:0,
  71. keyword: '',
  72. page: 1,
  73. limit: 10,
  74. },
  75. }
  76. },
  77. onLoad: function(e) {
  78. let _this = this
  79. if(e.currentTab){
  80. _this.currentTab = e.currentTab;
  81. }
  82. _this.$request.get('orderstatus.listname',{ptype:'service'}).then(res => {
  83. if (res.errno == 0) {
  84. _this.statusType = res.data;
  85. }
  86. })
  87. },
  88. onShow: function(e) {
  89. this.where.page = 1;
  90. this.getorderlist(true);
  91. },
  92. methods: {
  93. statusTap: function(e) {
  94. this.currentTab = e.index
  95. this.currentType = this.statusType[this.currentTab].id;
  96. this.loadend = false;
  97. this.loading = false;
  98. this.where.page = 1;
  99. this.getorderlist(true);
  100. },
  101. getorderlist: function(isPage) {
  102. var _this = this
  103. console.log(_this.loadend);
  104. console.log(_this.loading);
  105. if (_this.loadend) return;
  106. if (_this.loading) return;
  107. if (isPage === true) {
  108. _this.orderList = [];
  109. _this.where.page =1;
  110. }
  111. _this.where.samkey = (new Date()).valueOf();
  112. _this.where.ptype = _this.ptype;
  113. _this.where.status = _this.currentType;
  114. _this.where.currentTab = _this.currentTab;
  115. //console.log(_this.where.status);
  116. _this.$request.post('order.adminorder', _this.where).then(res => {
  117. if (res.errno == 0) {
  118. _this.orderList = _this.orderList.concat(res.data.data);
  119. _this.loadend = _this.orderList.length < _this.where.limit;
  120. _this.loading = false;
  121. _this.where.page = _this.where.page + 1
  122. }
  123. })
  124. },
  125. orderDetail: function(orderid) {
  126. var url = '/pagesA/my/admin/orderDetail?id='+orderid;
  127. uni.navigateTo({
  128. url: url
  129. })
  130. },
  131. },
  132. /**
  133. * 页面相关事件处理函数--监听用户下拉动作
  134. */
  135. onPullDownRefresh: function() {
  136. this.where.page = 1;
  137. this.loadend = false;
  138. this.orderList = [];
  139. this.getorderlist();
  140. setTimeout(() => {
  141. uni.stopPullDownRefresh()
  142. }, 200);
  143. },
  144. /**
  145. * 页面上拉触底事件的处理函数
  146. */
  147. onReachBottom() {
  148. //只是测试效果,逻辑以实际数据为准
  149. this.loadding = true
  150. this.pullUpOn = true
  151. this.getorderlist();
  152. setTimeout(() => {
  153. this.loadding = false
  154. this.pullUpOn = false
  155. }, 1000)
  156. },
  157. onPageScroll(e) {
  158. this.scrollTop = e.scrollTop;
  159. }
  160. }
  161. </script>
  162. <style>
  163. .container {
  164. padding-bottom: env(safe-area-inset-bottom);
  165. }
  166. .tui-order-list {
  167. margin-top: 80rpx;
  168. }
  169. .tui-order-item {
  170. margin-top: 20rpx;
  171. border-radius: 10rpx;
  172. overflow: hidden;
  173. }
  174. .tui-goods-title {
  175. width: 100%;
  176. font-size: 28rpx;
  177. display: flex;
  178. align-items: center;
  179. justify-content: space-between;
  180. }
  181. .tui-order-status {
  182. color: #888;
  183. font-size: 26rpx;
  184. }
  185. .tui-goods-item {
  186. width: 100%;
  187. padding: 20rpx 30rpx;
  188. box-sizing: border-box;
  189. display: flex;
  190. justify-content: space-between;
  191. }
  192. .tui-goods-img {
  193. width: 180rpx;
  194. height: 180rpx;
  195. display: block;
  196. flex-shrink: 0;
  197. }
  198. .tui-goods-center {
  199. flex: 1;
  200. padding: 20rpx 8rpx;
  201. box-sizing: border-box;
  202. }
  203. .tui-goods-name {
  204. max-width: 310rpx;
  205. word-break: break-all;
  206. overflow: hidden;
  207. text-overflow: ellipsis;
  208. display: -webkit-box;
  209. -webkit-box-orient: vertical;
  210. -webkit-line-clamp: 2;
  211. font-size: 26rpx;
  212. line-height: 32rpx;
  213. }
  214. .tui-goods-attr {
  215. font-size: 22rpx;
  216. color: #888888;
  217. line-height: 32rpx;
  218. padding-top: 20rpx;
  219. word-break: break-all;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. display: -webkit-box;
  223. -webkit-box-orient: vertical;
  224. -webkit-line-clamp: 2;
  225. }
  226. .tui-price-right {
  227. text-align: right;
  228. font-size: 24rpx;
  229. color: #888888;
  230. line-height: 30rpx;
  231. padding-top: 20rpx;
  232. }
  233. .tui-color-red {
  234. color: #E41F19;
  235. padding-right: 30rpx;
  236. }
  237. .tui-goods-price {
  238. width: 100%;
  239. display: flex;
  240. align-items: flex-end;
  241. justify-content: flex-end;
  242. font-size: 24rpx;
  243. }
  244. .tui-size-24 {
  245. font-size: 24rpx;
  246. line-height: 24rpx;
  247. }
  248. .tui-price-large {
  249. font-size: 32rpx;
  250. line-height: 30rpx;
  251. font-weight: 500;
  252. }
  253. .tui-order-btn {
  254. width: 100%;
  255. display: flex;
  256. align-items: center;
  257. justify-content: flex-end;
  258. background: #fff;
  259. padding: 10rpx 30rpx 20rpx;
  260. box-sizing: border-box;
  261. }
  262. .tui-btn-ml {
  263. margin-left: 20rpx;
  264. }
  265. </style>