index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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] |filterType}}
  30. </view>
  31. </view>
  32. <view class="order-box">
  33. <zs-img radius="full" :src="formatImg(item.goodsModelList[0])" width="164rpx" height="164rpx"></zs-img>
  34. <view class="info">
  35. <view class="title">
  36. {{item.goodsModelList[0].goodsInfo.activityName||item.goodsModelList[0].goodsInfo.goodsName}}
  37. </view>
  38. <view class="time">
  39. {{$u.timeFormat(item.createTime,'yyyy-mm-dd hh:MM:ss')}}
  40. </view>
  41. <view class="price">
  42. ¥{{item.payAmount}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </zs-list>
  48. </view>
  49. </template>
  50. <script>
  51. import {getOrderList} from '@/api/order.js'
  52. export default {
  53. data() {
  54. return {
  55. status: 'more',
  56. loading: false,
  57. query:{
  58. orderType:null,
  59. channel:'ZhongShu',
  60. page:0,
  61. size:10,
  62. userId:JSON.parse(uni.getStorageSync('userInfo')).userId
  63. },
  64. total:0,
  65. list: [],
  66. requestTask:null,
  67. imgUrl:{
  68. Kfc:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/xgJrwD0vChsW012ac1e138a0aa5a970e8f8c59dab926.png/1.png',
  69. MDL:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/K64jffEqRIDr487e8cab971c3b890d4066a26f5856d2.png/1.png',
  70. XBK:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/xMwtPkICBcam5513c4ac644054e60009cb8b1eb52e8f.png/1.png',
  71. NXDC:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/U9j6fgVmKeAt522ed50aa1a72f798260e0e30138d4c6.png/1.png',
  72. RXKF:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/zS5Q8sC9AAQca76eef36da2bd5a2ec234d75d8dcc044.png/1.png',
  73. XC:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/fA95my16Qunf967a9d992fc41134332926bcb5665881.png/1.png',
  74. KD:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/wk5eyuvhighG206a7ea081e3f0b783ff2a9555375e85.png/1.png',
  75. }
  76. }
  77. },
  78. filters: {
  79. filterType: function(val) {
  80. if(val.refundLog&&val.refundLog.refund == 'REFUSAL_REFUND'){
  81. return '拒绝退款'
  82. }
  83. else if(val.jobFlowMap == 'Hotel'&&val.extend.orderInfo){
  84. return val.extend.orderInfo.orderStatus
  85. }
  86. else if(val.goodsState == 'APPLY_REFUND'){
  87. return '退款审核中'
  88. }else if(val.goodsState == 'CLOSE'){
  89. return '关闭订单'
  90. }else if(val.goodsState == 'REFUNDED'){
  91. return '已退款'
  92. }else if(val.goodsState == 'REFUSAL_REFUND'){
  93. return '拒绝退款'
  94. }else if(val.goodsState == 'APPLY_REFUNDING'){
  95. return '退款中'
  96. }else if(val.goodsState == 'USED'){
  97. return '订单已完成'
  98. }else if(val.goodsState == 'WAIT_PAYMENT'){
  99. return '待付款'
  100. }else if(val.goodsState == 'WAIT_USE'){
  101. return '待使用'
  102. }else{
  103. return ''
  104. }
  105. }
  106. },
  107. methods: {
  108. formatImg(item){
  109. if(item.jobFlowMap == 'Kfc'){
  110. return this.imgUrl[item.goodsInfo.ot]
  111. }else if(item.jobFlowMap == 'Activity'){
  112. return item.goodsInfo.activityCover
  113. }else{
  114. return item.goodsInfo.goodsPath
  115. }
  116. },
  117. handleTab(val){
  118. this.query.orderType = val
  119. this.query.page = 0
  120. this.list = []
  121. this.getOrderList()
  122. },
  123. loadMore() {
  124. this.getOrderList()
  125. },
  126. jump(item) {
  127. // uni.setStorageSync('order',JSON.stringify(item))
  128. // 研学类型商品统一走研学订单详情
  129. if(item.goodsModelList[0].goodsInfo.isStudy){
  130. uni.navigateTo({
  131. url: '/study/pay/orderPay?id='+item.orderNo
  132. })
  133. return
  134. }
  135. if(item.goodsModelList[0].jobFlowMap == 'Ticket'){
  136. uni.navigateTo({
  137. url: '/my/order/scenic/detail?id='+item.orderNo
  138. })
  139. }
  140. else if(item.goodsModelList[0].jobFlowMap == 'Hotel'){
  141. uni.navigateTo({
  142. url: '/my/order/hotel/detail?id='+item.orderNo
  143. })
  144. }
  145. else if(item.goodsModelList[0].jobFlowMap == 'YPP'){
  146. uni.navigateTo({
  147. url: '/my/order/movie/detail?id='+item.orderNo
  148. })
  149. }
  150. else if(item.goodsModelList[0].jobFlowMap == 'Kfc'){
  151. uni.navigateTo({
  152. url: '/my/order/foodOrder/detail?id='+item.orderNo
  153. })
  154. }
  155. else if(item.goodsModelList[0].goodsInfo.activityName){
  156. uni.navigateTo({
  157. url: '/my/order/signUp/signUpDetail?id='+item.orderNo
  158. })
  159. }else if(item.goodsModelList[0].jobFlowMap == 'QiuXiang'){
  160. uni.navigateTo({
  161. url: '/my/order/trip/detail?id='+item.orderNo
  162. })
  163. }else{
  164. uni.navigateTo({
  165. url: './detail?id='+item.orderNo
  166. })
  167. }
  168. },
  169. getOrderList(){
  170. this.requestTask&&this.requestTask.abort()
  171. this.status = 'loading'
  172. getOrderList(this.query).then(res=>{
  173. this.requestTask =res.task
  174. if(res.state == 'Success'){
  175. this.total = res.content.totalElements
  176. this.list = this.list.concat(res.content.content)
  177. this.list.length>=this.total?this.status = 'noMore':this.status = 'more'
  178. this.query.page++
  179. uni.stopPullDownRefresh()
  180. }
  181. })
  182. }
  183. },
  184. onPullDownRefresh() {
  185. this.query.page = 0
  186. this.list = []
  187. this.status = 'more'
  188. this.getOrderList()
  189. },
  190. onLoad(option) {
  191. this.query.orderType = option.type || null
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. .order {
  197. background: #efefef;
  198. padding: 90rpx 30rpx 0;
  199. min-height: 100vh;
  200. .tab-box{
  201. display: flex;
  202. position: fixed;
  203. width: 750rpx;
  204. height: 70rpx;
  205. left: 0%;
  206. top: 0%;
  207. z-index: 9;
  208. background: #fff;
  209. .tab{
  210. flex: 1;
  211. text-align: center;
  212. padding: 15rpx 0;
  213. font-size: 28rpx;
  214. color: #999999;
  215. }
  216. .tab.active{
  217. font-size: 32rpx;
  218. color: #222222;
  219. position: relative;
  220. &::after{
  221. content: '';
  222. width: 40rpx;
  223. height: 8rpx;
  224. box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
  225. border-radius: 46rpx 46rpx 46rpx 46rpx;
  226. background: $uni-color-primary;
  227. position: absolute;
  228. bottom: 0%;
  229. left: 50%;
  230. transform: translateX(-50%);
  231. }
  232. }
  233. }
  234. .zs-list {
  235. .order-item {
  236. background-color: #fff;
  237. border-radius: 8px;
  238. margin-bottom: 20rpx;
  239. .top-box{
  240. display: flex;
  241. justify-content: space-between;
  242. align-items: center;
  243. padding: 20rpx;
  244. border-bottom:2rpx solid #F3F3F3;
  245. .label{
  246. font-weight: bold;
  247. color: #222222;
  248. font-size: 32rpx;
  249. width: 500rpx;
  250. white-space: nowrap;
  251. overflow: hidden;
  252. text-overflow: ellipsis;
  253. }
  254. .status{
  255. font-size: 28rpx;
  256. color: #999999;
  257. }
  258. }
  259. .order-box {
  260. padding: 25rpx;
  261. display: flex;
  262. .icon {
  263. width: 164rpx;
  264. height: 164rpx;
  265. border-radius: 16rpx;
  266. background-color: #999;
  267. }
  268. .info {
  269. margin-left: 25rpx;
  270. display: flex;
  271. flex-direction: column;
  272. justify-content: space-between;
  273. .title {
  274. color: #0F0F0F;
  275. font-size: 28rpx;
  276. }
  277. .time {
  278. font-size: 26rpx;
  279. color: #999999;
  280. }
  281. .price{
  282. font-weight: bold;
  283. color: #181818;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. }
  290. </style>