推广小程序前端代码
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.

190 lines
4.5 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
3 months ago
4 months ago
5 months ago
5 months ago
4 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
4 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
4 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
4 months ago
5 months ago
5 months ago
5 months ago
4 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
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 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
4 months ago
5 months ago
5 months ago
4 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. <signInQrcodePopup ref="signInQrcodePopup"/>
  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 signInQrcodePopup from '@/components/cart/signInQrcodePopup.vue'
  24. import Navbar from '@/pages/components/Navbar.vue'
  25. import {
  26. globalMixin
  27. } from '../mixins/globalMixin';
  28. export default {
  29. mixins: [globalMixin],
  30. components: {
  31. tabber,
  32. cardList,
  33. Navbar,
  34. signInQrcodePopup,
  35. },
  36. data() {
  37. this.orderId = '';
  38. return {
  39. tabCurrent:0,
  40. status: "loading",
  41. params: {
  42. state: '',
  43. pageNo: 1,
  44. pageSize: 10
  45. },
  46. tabList: [{
  47. id: '',
  48. name: '全部'
  49. },
  50. // {
  51. // id: 0,
  52. // name: '未付款'
  53. // },
  54. {
  55. id: 1,
  56. name: '待参加'
  57. },
  58. {
  59. id: 2,
  60. name: '已完成'
  61. },
  62. {
  63. id: 3,
  64. name: '已取消'
  65. },
  66. ],
  67. lineBg: require('@/static/image/cart/tabIcon.png'),
  68. totalPage: 0,
  69. cardListData: []
  70. }
  71. },
  72. onReachBottom() {
  73. if (this.params.pageNo >= this.totalPage) return
  74. this.params.pageNo++
  75. this.getOrderPageList()
  76. },
  77. onLoad(e) {
  78. if(uni.getStorageSync('currentState')) {
  79. this.tabCurrent = uni.getStorageSync('currentState')
  80. uni.removeStorageSync('currentState')
  81. }
  82. this.params.state = this.tabList[this.tabCurrent].id
  83. this.getOrderPageList()
  84. },
  85. onPullDownRefresh() {
  86. this.params.pageNo = 1
  87. this.cardListData = []
  88. this.getOrderPageList()
  89. },
  90. methods: {
  91. activeList() {
  92. uni.navigateTo({
  93. url: '/pages_my/activeList'
  94. })
  95. },
  96. getOrderPageList() {
  97. this.status = "loading"
  98. this.$api('orderPageList', this.params, res => {
  99. uni.stopPullDownRefresh()
  100. if (res.code == 200) {
  101. this.totalPage = res.result.pages
  102. this.cardListData = [...this.cardListData, ...res.result.records]
  103. if (this.params.pageNo >= this.totalPage) {
  104. this.status = "nomore"
  105. } else {
  106. this.status = "loadmore"
  107. }
  108. }
  109. })
  110. },
  111. tabs(val) {
  112. this.params.state = val.id
  113. this.params.pageNo = 1
  114. this.cardListData = []
  115. this.getOrderPageList()
  116. },
  117. toOrderDetails(val) {
  118. uni.navigateTo({
  119. url: `/pages_order/orderDetails?id=${val.id}`
  120. })
  121. },
  122. btnClick(item, type) { //0取消活动 1活动签到 2评价活动 3开具发票
  123. this.orderId = item.id;
  124. if (type == 0) {
  125. uni.showModal({
  126. title: '是否取消订单?',
  127. success : res => {
  128. if(res.confirm){
  129. this.confirm()
  130. }
  131. }
  132. })
  133. }
  134. if (type == 1) {
  135. this.$refs.signInQrcodePopup.open(this.orderId)
  136. // this.$api('signIn', {
  137. // orderId: item.id
  138. // }, res => {
  139. // if (res.code == 200) {
  140. // this.cardListData = []
  141. // this.getOrderPageList()
  142. // this.$refs.toast.show({
  143. // type: 'success',
  144. // message: res.result
  145. // })
  146. // }
  147. // })
  148. }
  149. if (type == 2) {
  150. uni.navigateTo({
  151. url: `/pages_order/orderEvaluation?activityId=${this.orderId}`
  152. })
  153. }
  154. if (type == 3) {
  155. uni.navigateTo({
  156. url: `/pages_order/invoiceIssuance?orderId=${this.orderId}`
  157. })
  158. }
  159. if (type == 4) {
  160. uni.navigateTo({
  161. url: `/pages_order/invoiceIssuance?orderId=${this.orderId}`
  162. })
  163. }
  164. },
  165. confirm() {
  166. this.$api('cancelOrder', {
  167. orderId: this.orderId
  168. }, res => {
  169. if (res.code == 200) {
  170. this.params.pageNo = 1
  171. this.cardListData = [];
  172. this.getOrderPageList();
  173. }
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style scoped lang="scss">
  180. .content {
  181. padding-bottom: 200rpx;
  182. }
  183. </style>