index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="order">
  3. <view class="tab-box">
  4. <view class="tab" :class="[query.orderType == null ? 'active' : '']" @click="handleTab(null)">
  5. 全部
  6. </view>
  7. <!-- <view class="tab" :class="[query.orderType == 'USED'?'active':'']" @click="handleTab('USED')">
  8. 已使用
  9. </view> -->
  10. <view class="tab" :class="[query.orderType == 'WAIT_PAYMENT' ? 'active' : '']" @click="handleTab('WAIT_PAYMENT')">
  11. 待付款
  12. </view>
  13. <view class="tab" :class="[query.orderType == 'WAIT_USE' ? 'active' : '']" @click="handleTab('WAIT_USE')">
  14. 待使用
  15. </view>
  16. <view class="tab" :class="[query.orderType == 'APPLY_REFUND' ? 'active' : '']" @click="handleTab('APPLY_REFUND')">
  17. 退款
  18. </view>
  19. </view>
  20. <u-empty v-if="!list.length && status == 'noMore'" mode="order" iconSize="200rpx" textSize="28rpx">
  21. </u-empty>
  22. <zs-list mt="0" @load="loadMore" :status="status">
  23. <view class="order-item" v-for="(item, index) in list" :key="index" @click="jump(item)">
  24. <view class="top-box">
  25. <view class="label">
  26. {{ item.shopInfo.shopName }}
  27. </view>
  28. <view class="status">
  29. {{ item.goodsModelList[0].goodsState | filterType }}
  30. </view>
  31. </view>
  32. <view class="order-box">
  33. <zs-img radius="full"
  34. :src="item.goodsModelList[0].goodsInfo.goodsPath || item.goodsModelList[0].goodsInfo.activityCover"
  35. width="164rpx" height="164rpx"></zs-img>
  36. <view class="info">
  37. <view class="title">
  38. {{ item.goodsModelList[0].goodsInfo.goodsName || item.goodsModelList[0].goodsInfo.activityName }}
  39. </view>
  40. <view class="time">
  41. {{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
  42. </view>
  43. <view class="price">
  44. ¥{{ item.payAmount }}
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </zs-list>
  50. </view>
  51. </template>
  52. <script>
  53. import { getOrderList } from '@/api/order.js'
  54. import { getActivityDetail } from '@/api/activity.js'
  55. export default {
  56. data() {
  57. return {
  58. status: 'more',
  59. loading: false,
  60. query: {
  61. orderType: null,
  62. page: 0,
  63. size: 10,
  64. channel:"GuiDa",
  65. userId: JSON.parse(uni.getStorageSync('userInfo')).userId
  66. },
  67. activity: null,
  68. total: 0,
  69. list: []
  70. }
  71. },
  72. filters: {
  73. filterType: function (val) {
  74. if (val == 'APPLY_REFUND') {
  75. return '申请退款'
  76. } else if (val == 'CLOSE') {
  77. return '关闭订单'
  78. } else if (val == 'REFUNDED') {
  79. return '已退款'
  80. } else if (val == 'REFUSAL_REFUND') {
  81. return '拒绝退款'
  82. } else if (val == 'USED') {
  83. return '已使用'
  84. } else if (val == 'WAIT_PAYMENT') {
  85. return '待付款'
  86. } else if (val == 'WAIT_USE') {
  87. return '待使用'
  88. }
  89. }
  90. },
  91. methods: {
  92. handleTab(val) {
  93. this.query.orderType = val
  94. this.query.page = 0
  95. this.list = []
  96. this.getOrderList()
  97. },
  98. loadMore() {
  99. this.getOrderList()
  100. },
  101. jump(item) {
  102. // 如果是活动则跳转到活动支付页
  103. if (item.goodsModelList[0].goodsInfo.hasOwnProperty('activityEnable')) {
  104. const enable = item.goodsModelList[0].goodsInfo.activityEnable
  105. if (enable) {
  106. uni.showLoading({
  107. title: '获取信息中...'
  108. })
  109. getActivityDetail({
  110. id: item.goodsModelList[0].goodsInfo.id
  111. }).then(res => {
  112. this.activity = res.content
  113. this.activity.activityDetail = res.content.activityDetail.replace(/<img/gi, '<img class="img_class" ')
  114. let { activityStartTime, activityEndTime, limited, activityName, id, price, shopId } = this.activity
  115. let obj = {
  116. activityStartTime,
  117. activityEndTime,
  118. limited,
  119. activityName,
  120. id,
  121. price,
  122. shopId
  123. }
  124. uni.hideLoading()
  125. uni.setStorageSync('activity', JSON.stringify(obj))
  126. // uni.navigateTo({
  127. // url: '/signUp/makeOut?id=' + item.activityId
  128. // })
  129. uni.redirectTo({
  130. url: "/signUp/orderDetail?id=" + item.orderNo,
  131. success() {
  132. // this.loading = false;
  133. uni.hideLoading();
  134. },
  135. });
  136. })
  137. } else {
  138. uni.showToast({
  139. title: '活动已结束',
  140. icon: 'none'
  141. })
  142. }
  143. return
  144. } else {
  145. uni.setStorageSync('order', JSON.stringify(item))
  146. uni.navigateTo({
  147. url: './detail?id=' + item.orderNo
  148. })
  149. }
  150. },
  151. getOrderList() {
  152. this.status = 'loading'
  153. getOrderList(this.query).then(res => {
  154. if (res.state == 'Success') {
  155. this.total = res.content.totalElements
  156. this.list = this.list.concat(res.content.content)
  157. this.list.length >= this.total ? this.status = 'noMore' : this.status = 'more'
  158. this.query.page++
  159. uni.stopPullDownRefresh()
  160. }
  161. })
  162. }
  163. },
  164. onPullDownRefresh() {
  165. this.query.page = 0
  166. this.list = []
  167. this.status = 'more'
  168. this.getOrderList()
  169. },
  170. onLoad(option) {
  171. this.query.orderType = option.type || null
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. .order {
  177. background: #efefef;
  178. padding: 90rpx 30rpx 0;
  179. min-height: 100vh;
  180. .tab-box {
  181. display: flex;
  182. position: fixed;
  183. width: 750rpx;
  184. height: 70rpx;
  185. left: 0%;
  186. top: 0%;
  187. z-index: 9;
  188. background: #fff;
  189. .tab {
  190. flex: 1;
  191. text-align: center;
  192. padding: 15rpx 0;
  193. font-size: 28rpx;
  194. color: #999999;
  195. }
  196. .tab.active {
  197. font-size: 32rpx;
  198. color: #222222;
  199. position: relative;
  200. &::after {
  201. content: '';
  202. width: 40rpx;
  203. height: 8rpx;
  204. box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255, 255, 255, 0.16);
  205. border-radius: 46rpx 46rpx 46rpx 46rpx;
  206. background: $uni-color-primary;
  207. position: absolute;
  208. bottom: 0%;
  209. left: 50%;
  210. transform: translateX(-50%);
  211. }
  212. }
  213. }
  214. .zs-list {
  215. .order-item {
  216. background-color: #fff;
  217. border-radius: 8px;
  218. margin-bottom: 20rpx;
  219. .top-box {
  220. display: flex;
  221. justify-content: space-between;
  222. align-items: center;
  223. padding: 20rpx;
  224. border-bottom: 2rpx solid #F3F3F3;
  225. .label {
  226. font-weight: bold;
  227. color: #222222;
  228. font-size: 32rpx;
  229. width: 500rpx;
  230. white-space: nowrap;
  231. overflow: hidden;
  232. text-overflow: ellipsis;
  233. }
  234. .status {
  235. font-size: 28rpx;
  236. color: #999999;
  237. }
  238. }
  239. .order-box {
  240. padding: 25rpx;
  241. display: flex;
  242. .icon {
  243. width: 164rpx;
  244. height: 164rpx;
  245. border-radius: 16rpx;
  246. background-color: #999;
  247. }
  248. .info {
  249. margin-left: 25rpx;
  250. display: flex;
  251. flex-direction: column;
  252. justify-content: space-between;
  253. .title {
  254. color: #0F0F0F;
  255. font-size: 28rpx;
  256. }
  257. .time {
  258. font-size: 26rpx;
  259. color: #999999;
  260. }
  261. .price {
  262. font-weight: bold;
  263. color: #181818;
  264. }
  265. }
  266. }
  267. }
  268. }
  269. }
  270. </style>