推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
3.9 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="cart">
  3. <view class="head-box"></view>
  4. <Navbar title="我的订单" :bgColor="bgColor" leftIconSize="0px" height="100rpx" :titleStyle="{color:fontColor}" />
  5. <view class="content contentPosition_">
  6. <uv-sticky offsetTop="220rpx" :bgColor="bgColor">
  7. <uv-tabs :scrollable="false" @click="tabs" :list="tabList" lineWidth="40" :current="tabCurrent"
  8. :lineColor="`url(${lineBg}) 100% 100%`"
  9. :activeStyle="{color: '#FD5C5C', fontWeight: 'bold',transform: 'scale(1.05)'}"
  10. :inactiveStyle="{color: '#999', transform: 'scale(1)'}"
  11. itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"></uv-tabs>
  12. </uv-sticky>
  13. <cardList :cardListData="cardListData" @btnClick="btnClick" @toOrderDetails="toOrderDetails" />
  14. <uv-load-more :status="status" fontSize="24rpx" dashed line />
  15. </view>
  16. <uv-modal ref="modal" align="center" content='是否取消订单?' @confirm="confirm"></uv-modal>
  17. <tabber select="cart" />
  18. </view>
  19. </template>
  20. <script>
  21. import tabber from '@/components/base/tabbar.vue'
  22. import cardList from '@/components/cart/CardList.vue'
  23. import Navbar from '@/pages/components/Navbar.vue'
  24. import {
  25. globalMixin
  26. } from '../mixins/globalMixin';
  27. export default {
  28. mixins: [globalMixin],
  29. components: {
  30. tabber,
  31. cardList,
  32. Navbar
  33. },
  34. data() {
  35. this.orderId = '';
  36. return {
  37. tabCurrent:0,
  38. status: "loading",
  39. params: {
  40. state: '',
  41. pageNo: 1,
  42. pageSize: 10
  43. },
  44. tabList: [{
  45. id: '',
  46. name: '全部'
  47. },
  48. {
  49. id: 0,
  50. name: '未付款'
  51. },
  52. {
  53. id: 1,
  54. name: '待参加'
  55. },
  56. {
  57. id: 2,
  58. name: '已完成'
  59. },
  60. {
  61. id: 3,
  62. name: '已取消'
  63. },
  64. ],
  65. lineBg: require('@/static/image/cart/tabIcon.png'),
  66. totalPage: 0,
  67. cardListData: []
  68. }
  69. },
  70. onReachBottom() {
  71. if (this.params.pageNo >= this.totalPage) return
  72. this.params.pageNo++
  73. this.getOrderPageList()
  74. },
  75. onLoad(e) {
  76. if(uni.getStorageSync('currentState')) {
  77. this.tabCurrent = uni.getStorageSync('currentState')
  78. uni.removeStorageSync('currentState')
  79. }
  80. this.params.state = this.tabList[this.tabCurrent].id
  81. this.getOrderPageList()
  82. },
  83. methods: {
  84. activeList() {
  85. uni.navigateTo({
  86. url: '/pages_my/activeList'
  87. })
  88. },
  89. getOrderPageList() {
  90. this.status = "loading"
  91. this.$api('orderPageList', this.params, res => {
  92. if (res.code == 200) {
  93. this.totalPage = res.result.pages
  94. this.cardListData = [...this.cardListData, ...res.result.records]
  95. if (this.params.pageNo >= this.totalPage) {
  96. this.status = "nomore"
  97. } else {
  98. this.status = "loadmore"
  99. }
  100. }
  101. })
  102. },
  103. tabs(val) {
  104. this.params.state = val.id
  105. this.params.pageNo = 1
  106. this.cardListData = []
  107. this.getOrderPageList()
  108. },
  109. toOrderDetails(val) {
  110. uni.navigateTo({
  111. url: `/pages_order/orderDetails?id=${val.id}`
  112. })
  113. },
  114. btnClick(item, type) { //0取消活动 1活动签到 2评价活动 3开具发票
  115. this.orderId = item.id;
  116. if (type == 0) {
  117. this.$refs.modal.open();
  118. }
  119. if (type == 1) {
  120. this.$api('signIn', {
  121. orderId: item.id
  122. }, res => {
  123. if (res.code == 200) {
  124. this.cardListData = []
  125. this.getOrderPageList()
  126. this.$refs.toast.show({
  127. type: 'success',
  128. message: res.result
  129. })
  130. }
  131. })
  132. }
  133. if (type == 2) {
  134. uni.navigateTo({
  135. url: `/pages_order/orderEvaluation?activityId=${this.orderId}`
  136. })
  137. }
  138. if (type == 3) {
  139. uni.navigateTo({
  140. url: `/pages_order/invoiceIssuance?orderId=${this.orderId}`
  141. })
  142. }
  143. },
  144. confirm() {
  145. this.$api('cancelOrder', {
  146. orderId: this.orderId
  147. }, res => {
  148. if (res.code == 200) {
  149. this.cardListData = [];
  150. this.getOrderPageList();
  151. }
  152. })
  153. }
  154. }
  155. }
  156. </script>
  157. <style scoped lang="scss">
  158. .content {
  159. padding-bottom: 200rpx;
  160. }
  161. </style>