list.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <zj-page-layout
  4. :hasFooter="false"
  5. :isScroll="true"
  6. :refresherTriggered="refresherTriggered"
  7. @refresherrefresh="refresherrefresh"
  8. @scrolltolower="scrolltolower">
  9. <template slot="header">
  10. <view class="header-container">
  11. <u-tabs
  12. :scrollable="false"
  13. :list="tabList"
  14. :current="tabCurrent"
  15. @click="clickTab"
  16. lineColor="#01C30B"
  17. :activeStyle="{
  18. color: '#01C30B'
  19. }"
  20. :inactiveStyle="{
  21. color: '#666666'
  22. }"
  23. itemStyle="padding-left: 0; padding-right: 0; height: 88rpx;">
  24. </u-tabs>
  25. </view>
  26. </template>
  27. <view class="common-order-list">
  28. <view class="item" v-for="(item, index) in dataList" :key="index" @tap="toDetail(item.orderId)">
  29. <view class="top">
  30. <image src="@/static/common/logo.png"></image>
  31. <view class="user">
  32. <view class="name">{{item.userName}}</view>
  33. <view class="time">{{item.goodsCreateTime | timeFilter}}发布</view>
  34. </view>
  35. <view class="status">{{item.status | statusFilter}}</view>
  36. </view>
  37. <view class="goods">
  38. <image :src="imageUrl + item.goodsPicUrl"></image>
  39. <view class="main">
  40. <view class="name">{{item.goodsTitle}}</view>
  41. <view class="des">{{item.content}}</view>
  42. <view class="price"><text>{{item.goodsAmount | priceFilter2}}</text>数量:{{item.num}}</view>
  43. </view>
  44. </view>
  45. <view class="total">订单总金额<text>{{item.price | priceFilter2}}</text></view>
  46. <view class="bottom">
  47. <view class="left-location"><text class="iconfont icon-dingwei"></text>{{item.city}} {{item.area}}</view>
  48. <view class="right-btn" @tap.stop>
  49. <block v-if="item.status == 'WAIT'">
  50. <u-button text="取消订单" shape="circle"></u-button>
  51. <u-button text="去支付" shape="circle" type="primary" plain @tap="toPay(item.goodsId, item.orderId)"></u-button>
  52. </block>
  53. <block v-if="~['SEND', 'COMPLETE'].indexOf(item.status)">
  54. <u-button text="查看物流" shape="circle" @tap="toLogistics(item.logisticsNum)"></u-button>
  55. </block>
  56. <u-button text="申请售后" shape="circle" @tap="toReturn(item.orderId)"></u-button>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <Loading :loadStatus="loadStatus" :dataList="dataList" />
  62. </zj-page-layout>
  63. <!-- #endif -->
  64. <!-- #ifndef H5 -->
  65. <web-view :src="webViewHref(`/pages/mine/myBuy/list`, pam)"></web-view>
  66. <!-- #endif -->
  67. </template>
  68. <script>
  69. // #ifdef H5
  70. export default {
  71. filters: {
  72. statusFilter(val) {
  73. const MAP = {
  74. WAIT: '待支付',
  75. CANCEL: '取消支付',
  76. TIMEOUT: '超时取消',
  77. PAID: '已支付',
  78. WAIT_SEND: '待发货',
  79. SEND: '已发货',
  80. COMPLETE: '已完成',
  81. AFTER_WAIT: '售后中',
  82. REFUND: '退款成功',
  83. NO_REFUND: '不退款',
  84. }
  85. return MAP[val];
  86. }
  87. },
  88. data() {
  89. return {
  90. imageUrl: this.$imageUrl,
  91. tabList: [
  92. {name: '全部', value: 0},
  93. {name: '待付款', value: 1},
  94. {name: '待发货', value: 2},
  95. {name: '待收货', value: 3},
  96. {name: '已收货', value: 4},
  97. {name: '售后中', value: 5},
  98. ],
  99. tabCurrent: 0,
  100. dataList: [],
  101. pageNum: 1,
  102. loadStatus: 0,
  103. refresherTriggered: false,
  104. }
  105. },
  106. async onLoad({tab}) {
  107. this.tabCurrent = tab ? Number(tab) : 0;
  108. await this.getList();
  109. },
  110. methods: {
  111. //获取列表数据
  112. async getList() {
  113. const statusMap = {
  114. 0: '',
  115. 1: 'WAIT',
  116. 2: 'WAIT_SEND',
  117. 3: 'SEND',
  118. 4: 'COMPLETE',
  119. 5: 'AFTER_WAIT',
  120. }
  121. this.$api.post('/orderPay/list', {
  122. pageNum: this.pageNum,
  123. pageSize: 10,
  124. params: [{
  125. param: 'a.status',
  126. compare: '=',
  127. value: statusMap[this.tabCurrent]
  128. }, {
  129. param: 'a.buyer_user_id',
  130. compare: '=',
  131. value: this.$store.state.user.userId
  132. }]
  133. }).then(res => {
  134. this.loadStatus = 0;
  135. let list = res.data.records;
  136. if(list.length < 10){
  137. this.loadStatus = 2;
  138. }
  139. this.dataList = this.dataList.concat(list);
  140. }).catch(() => {
  141. this.loadStatus = 2;
  142. }).finally(res => {
  143. this.refresherTriggered = false;
  144. })
  145. },
  146. // 滚动到底部
  147. scrolltolower(e) {
  148. if (this.loadStatus === 0) {
  149. this.pageNum++;
  150. this.getList();
  151. }
  152. },
  153. // 触发下拉刷新
  154. refresherrefresh(e) {
  155. this.refresherTriggered = true;
  156. this.refreshLish();
  157. },
  158. refreshLish() {
  159. this.dataList = [];
  160. this.pageNum = 1;
  161. this.getList();
  162. },
  163. clickTab(item) {
  164. this.tabCurrent = item.value;
  165. this.refreshLish();
  166. },
  167. toDetail(orderId) {
  168. this.$navToPage({
  169. url: `/pages/mine/myBuy/detail?orderId=${orderId}`
  170. })
  171. },
  172. toLogistics(logisticsNum) {
  173. this.$navToPage({
  174. url: `/pages/mine/myBuy/logistics?logisticsNum=${logisticsNum}`
  175. })
  176. },
  177. toPay(goodsId, orderId) {
  178. this.$navToPage({
  179. url: `/pages/goods/order?goodsId=${goodsId}&orderId=${orderId}`
  180. })
  181. },
  182. toReturn(orderId) {
  183. this.$navToPage({
  184. url: `/pages/mine/myBuy/return?orderId=${orderId}`
  185. })
  186. }
  187. }
  188. }
  189. // #endif
  190. // #ifndef H5
  191. export default {
  192. data() {
  193. return {
  194. pam: {},
  195. }
  196. },
  197. onLoad(pam) {
  198. this.pam = pam;
  199. },
  200. }
  201. // #endif
  202. </script>
  203. <style lang="scss" scoped>
  204. .header-container {
  205. background: #ffffff;
  206. }
  207. </style>