order.vue 7.1 KB

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