order.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='我的订单'></cus-header>
  4. <view class="tab adfac">
  5. <view class="tab-pre" :class="{'active':tindex===index}" @click="changeTab(item,index)"
  6. v-for="(item,index) in statusList" :key="index">{{item.name}}</view>
  7. </view>
  8. <view class="list">
  9. <view class="list-pre" v-for="(item,index) in list" :key="index" @click.prevent="handleDetail(item)">
  10. <view class="list-pre-top adfacjb">
  11. <view class="list-pre-top-no">订单号:{{item.orderNo}}</view>
  12. <view class="list-pre-top-status" :class="statusColor[item.orderStatus]">{{statusCfg[item.orderStatus]}}</view>
  13. </view>
  14. <view class="list-pre-info adf">
  15. <view class="list-pre-info-left adfac">
  16. <image class="list-pre-info-left-img" :src="imgBase+'order_img.png'"></image>
  17. <view class="list-pre-info-left-texts">
  18. <view class="list-pre-info-left-texts-num">{{typeCfg[item.type]}}{{item.totalFrequency}}次,剩余{{item.useFrequency}}次可用</view>
  19. <view class="list-pre-info-left-texts-date">有效期至 {{item.expirationTime}}</view>
  20. </view>
  21. </view>
  22. <view class="list-pre-info-right">¥{{(+item.totalAmount||0).toFixed(2)}}</view>
  23. </view>
  24. <view class="list-pre-btns adf">
  25. <view class="list-pre-btns-pre cancel" v-if="item.orderStatus==0" @click.stop="orderCancel">取消订单</view>
  26. <view class="list-pre-btns-pre" @click.stop="buyAgain">再次购买</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data(){
  35. return {
  36. tindex:0,
  37. statusList:[
  38. {state:'',name:'全部'},
  39. {state:'1',name:'已支付'},
  40. {state:'0',name:'待支付'},
  41. {state:'-2',name:'已取消'}
  42. ],
  43. statusCfg:{
  44. '-3':'已退款',
  45. '-2':'已取消',
  46. '-1':'已失效',
  47. 0:'待支付',
  48. 1:'已支付',
  49. 2:'已完成'
  50. },
  51. statusColor:{
  52. 0:'dzf',
  53. 1:'yzf',
  54. 2:'yzf',
  55. '-2':'yqx'
  56. },
  57. typeCfg:{
  58. 1:'基础版',
  59. 2:'专业版'
  60. },
  61. query:{
  62. page:1,
  63. limit:10,
  64. orderStatus:'',
  65. userId:''
  66. },
  67. isOver:false,
  68. list:[]
  69. }
  70. },
  71. onReachBottom() {
  72. if(this.isOver) return
  73. this.getList()
  74. },
  75. onLoad(options) {
  76. try{
  77. this.query.userId = JSON.parse(uni.getStorageSync('userInfo')).id;
  78. this.getList()
  79. }catch(e){
  80. this.query.userId = '';
  81. }
  82. },
  83. methods:{
  84. init(){
  85. this.query.page = 1;
  86. this.isOver = false;
  87. this.list = [];
  88. this.getList()
  89. },
  90. getList(){
  91. this.$api.get('/que/order/page',this.query).then(({data:res})=>{
  92. if(res.code!==0) return this.$showToast(res.msg)
  93. this.list = [...this.list,...res.data.list]
  94. if(this.list.length < res.data.total) this.query.page++
  95. else this.isOver = true
  96. })
  97. },
  98. changeTab(item,index){
  99. this.tindex = index;
  100. this.query.orderStatus = item.state;
  101. this.init()
  102. },
  103. handleDetail(item){
  104. uni.navigateTo({
  105. url:'/pagesMy/orderDetail?item='+encodeURIComponent(JSON.stringify(item))
  106. })
  107. },
  108. orderCancel(){
  109. },
  110. buyAgain(){
  111. uni.navigateTo({
  112. url:'/pagesPublish/rechargeCenter'
  113. })
  114. },
  115. }
  116. }
  117. </script>
  118. <style scoped lang="scss">
  119. .default_page{
  120. padding: 0 24rpx 40rpx;
  121. box-sizing: border-box;
  122. background: #F7F7F7;
  123. .tab{
  124. position: fixed;
  125. left: 0;
  126. right: 0;
  127. height: 90rpx;
  128. background: #FFFFFF;
  129. &-pre{
  130. width: 25%;
  131. height: 90rpx;
  132. font-family: PingFangSC, PingFang SC;
  133. font-weight: 400;
  134. font-size: 28rpx;
  135. color: #667E90;
  136. line-height: 90rpx;
  137. text-align: center;
  138. position: relative;
  139. &.active{
  140. font-weight: bold;
  141. font-size: 32rpx;
  142. color: #002846;
  143. &::after{
  144. content: '';
  145. width: 48rpx;
  146. height: 6rpx;
  147. background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);;
  148. border-radius: 5rpx;
  149. position: absolute;
  150. left: 50%;
  151. margin-left: -24rpx;
  152. bottom: 4rpx;
  153. }
  154. }
  155. }
  156. }
  157. .list{
  158. padding-top: 110rpx;
  159. &-pre{
  160. background: #FFFFFF;
  161. border-radius: 25rpx;
  162. margin-top: 20rpx;
  163. padding: 36rpx 24rpx 29rpx;
  164. &:first-child{
  165. margin-top: 0;
  166. }
  167. &-top{
  168. &-no{
  169. font-family: PingFangSC, PingFang SC;
  170. font-weight: 400;
  171. font-size: 26rpx;
  172. color: #667E90;
  173. line-height: 30rpx;
  174. }
  175. &-status{
  176. padding: 6rpx 13rpx;
  177. border-radius: 6rpx;
  178. font-family: PingFangSC, PingFang SC;
  179. font-weight: 400;
  180. font-size: 24rpx;
  181. line-height: 30rpx;
  182. &.yzf{
  183. color: #33A7A7;
  184. background: rgba(51,167,167,0.08);
  185. }
  186. &.dzf{
  187. color: #FD4F66;
  188. background: rgba(244,101,122,0.1);
  189. }
  190. &.yqx{
  191. color: #667E90;
  192. background: #F0F2F8;
  193. }
  194. }
  195. }
  196. &-info{
  197. margin-top: 16rpx;
  198. border-top: 1rpx solid #EFEFEF;
  199. padding-top: 32rpx;
  200. justify-content: space-between;
  201. &-left{
  202. &-img{
  203. width: 64rpx;
  204. height: 64rpx;
  205. }
  206. &-texts{
  207. margin-left: 20rpx;
  208. &-num{
  209. font-family: PingFang-SC, PingFang-SC;
  210. font-weight: bold;
  211. font-size: 30rpx;
  212. color: #002846;
  213. line-height: 30rpx;
  214. }
  215. &-date{
  216. font-family: PingFangSC, PingFang SC;
  217. font-weight: 400;
  218. font-size: 26rpx;
  219. color: #667E90;
  220. line-height: 30rpx;
  221. margin-top: 20rpx;
  222. }
  223. }
  224. }
  225. &-right{
  226. font-family: PingFang-SC, PingFang-SC;
  227. font-weight: bold;
  228. font-size: 30rpx;
  229. color: #1D2129;
  230. line-height: 30rpx;
  231. text-align: right;
  232. }
  233. }
  234. &-btns{
  235. justify-content: flex-end;
  236. margin-top: 30rpx;
  237. &-pre{
  238. background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);;
  239. border-radius: 27rpx;
  240. border: 1rpx solid #33A7A7;
  241. font-family: PingFangSC, PingFang SC;
  242. font-weight: 400;
  243. font-size: 24rpx;
  244. color: #FFFFFF;
  245. line-height: 30rpx;
  246. padding: 12rpx 26rpx;
  247. letter-spacing: 2rpx;
  248. margin-left: 30rpx;
  249. &.cancel{
  250. background: #FFFFFF;
  251. border: 1rpx solid #E2E2E2;
  252. color: #95A5B1;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. </style>