orderAll.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="container">
  3. <u-sticky style="margin-top: 15rpx; margin-left: 20rpx" bgColor="#fff">
  4. <u-tabs lineWidth="40" :list="list" :current="current" @change="handlerChangeItem" />
  5. </u-sticky>
  6. <!-- 订单 -->
  7. <view class="order">
  8. <view class="order-box">
  9. <view class="order-item" v-for="(item,index) of init_list" :key='index' @click="handlerSkipDetail(item)">
  10. <view class="order-top">
  11. <view class="top-left"> 订单号:{{ item.orderSn }} </view>
  12. <view class="top-right"> {{ type }} </view>
  13. </view>
  14. <u-line margin='20rpx 0'></u-line>
  15. <view class="order-center">
  16. <view class="center-left">
  17. <image class="left-img" src="@/static/QR57a.jpg"></image>
  18. </view>
  19. <view class="center-right">
  20. <view class="right-title">
  21. {{ item.goodsInfo.goodsName }}
  22. </view>
  23. <view class="right-title">
  24. Ceshi 111
  25. </view>
  26. <view class="right-price">
  27. <view class="price"> ¥{{ item.goodsInfo.goodsPrice }} </view>
  28. <view class="numb"> x {{ item.goodsInfo.realAmount }} </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="u-border-bottom">
  33. <button @click.stop='handlerCancelOrder(item)'>取消订单</button>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- <view v-else style="margin-top: 40rpx">
  38. <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  39. </view> -->
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import { userOrdersApi , getUserOrderList , cancelOrder } from '@/api/client/order';
  45. export default {
  46. data() {
  47. return {
  48. current: 0,
  49. type: 0,
  50. size: 20,
  51. // 订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单
  52. list: [
  53. {
  54. name: '待付款',
  55. type: 0,
  56. },
  57. {
  58. name: '待发货',
  59. type: 1,
  60. },
  61. {
  62. name: '已发货',
  63. type: 2,
  64. },
  65. {
  66. name: '已完成',
  67. type: 3,
  68. },
  69. {
  70. name: '已关闭',
  71. type: 4,
  72. },
  73. {
  74. name: '无效订单',
  75. type: 5,
  76. },
  77. ],
  78. init_list: [],
  79. };
  80. },
  81. mounted() {
  82. this.userOrdersPage();
  83. },
  84. methods: {
  85. handlerChangeItem(data) {
  86. this.current = data.index;
  87. this.type = data.type;
  88. this.userOrdersPage(this.type);
  89. },
  90. async userOrdersPage(type) {
  91. let orderStatus = type == undefined ? 0 : `${type}`;
  92. let res = await getUserOrderList({
  93. status:orderStatus,
  94. paging: '1,20',
  95. });
  96. if ((res.code = 200 && res.data)) {
  97. this.init_list = res.data.records;
  98. }
  99. },
  100. // 跳转到订单详情
  101. handlerSkipDetail(e){
  102. console.log('@@@@e',e);
  103. uni.navigateTo({
  104. url:`/pages/client/clientPackage/orderDetail?orderList=${e}`
  105. })
  106. },
  107. // 取消订单
  108. handlerCancelOrder(e){
  109. cancelOrder(e.id).then(res=>{
  110. console.log('###res',res);
  111. if(res.code == 200){
  112. uni.showToast({
  113. title:'取消成功',
  114. icon:'none'
  115. })
  116. this.userOrdersPage(this.type)
  117. }else{
  118. console.log('###res',res);
  119. }
  120. })
  121. }
  122. },
  123. };
  124. </script>
  125. <style lang="scss" scoped>
  126. .order{
  127. .order-box{
  128. padding: 20rpx;
  129. .order-item{
  130. border-radius: 20rpx;
  131. padding: 20rpx;
  132. margin-bottom: 20rpx;
  133. background-color: #fff;
  134. box-shadow: 5rpx 5rpx 5rpx 5rpx rgba(0, 0, 0, 0.2);
  135. .order-top{
  136. display: flex;
  137. justify-content: space-between;
  138. .top-left{
  139. font-size: 26rpx;
  140. color: #C7C7C7;
  141. }
  142. .top-right{
  143. font-size: 28rpx;
  144. color: #C54E55;
  145. }
  146. }
  147. .order-center{
  148. display: flex;
  149. .center-left{
  150. margin-right: 20rpx;
  151. width: 30%;
  152. .left-img{
  153. width: 200rpx;
  154. height: 200rpx;
  155. border-radius: 20rpx;
  156. }
  157. }
  158. .center-right{
  159. display: flex;
  160. flex-direction: column;
  161. justify-content: space-around;
  162. width: 70%;
  163. .right-title{
  164. }
  165. .right-price{
  166. display: flex;
  167. justify-content: space-between;
  168. .price{
  169. }
  170. .numb{
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. ::deep .u-tabs__wrapper__nav__item__text {
  179. font-size: 30px;
  180. }
  181. </style>