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

195 lines
4.6 KiB

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