yuyueOrder.vue 7.1 KB

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