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.

251 lines
5.7 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="order bx">
  3. <u-sticky>
  4. <view style="width: 100%;display: flex;padding: 20rpx 0rpx;font-size: 28rpx;">
  5. <view style="flex: 1;
  6. text-align: center;padding: 10rpx 0;
  7. margin: 20rpx;"
  8. :class="{act : currentIndex == index}"
  9. @click="tabChange(index)"
  10. v-for="(item, index) in classifyList">
  11. {{ item.name }}
  12. </view>
  13. </view>
  14. </u-sticky>
  15. <view v-if="!noOrder" class="order-list">
  16. <u-list @scrolltolower="scrolltolower" height="calc(100vh - 90rpx)">
  17. <view v-for="(item,index) in productList" :key="index"
  18. class="order-item">
  19. <view class="top">
  20. <view style="font-size: 28rpx;" class="time">
  21. {{ item.createTime }}
  22. </view>
  23. <view style="color: #333;border: 1px solid #333;
  24. padding: 7rpx 15rpx;font-size: 24rpx;"
  25. v-if="item.state != 0">
  26. {{ $t('page.order.Submit_New') }}
  27. </view>
  28. <view style="color: #f90;border: 1px solid #f90;
  29. padding: 7rpx 15rpx;font-size: 24rpx;"
  30. v-else @click="order = item;show = true;$play()">
  31. {{ $t('page.order.pay') }}
  32. </view>
  33. </view>
  34. <view class="con"
  35. style="border-bottom: 1px solid #333;
  36. padding: 20rpx 0;">
  37. <view class="img-box" style="width: 150rpx;height: 150rpx;
  38. overflow: hidden;border-radius: 10rpx;display: flex;
  39. align-items: center;">
  40. <image :src="item.image" mode="widthFix" style="width: 150rpx;"></image>
  41. </view>
  42. <view style="font-weight: 900;margin-left: 20rpx;font-size: 28rpx;color: #333;">
  43. {{ item.subTitle }}
  44. </view>
  45. </view>
  46. <view class="con"
  47. style="margin-top: 20rpx;font-size: 28rpx;font-weight: 500;">
  48. <view style="flex: 1;">
  49. {{ $t('page.order.Total_Amount') }}
  50. </view>
  51. <view style="flex: 1;">
  52. {{ $t('page.order.Profit') }}
  53. </view>
  54. </view>
  55. <view class="con"
  56. style="margin-top: 10rpx;
  57. color: #333;font-weight: 900;font-size: 28rpx;">
  58. <view style="flex: 1;">
  59. USDT {{ item.price }}
  60. </view>
  61. <view style="flex: 1;">
  62. USDT {{ item.giveMoney }}
  63. </view>
  64. </view>
  65. </view>
  66. <view style="justify-content: center;display: flex;
  67. margin-top: 150rpx;" v-if="loading">
  68. <u-loading-icon
  69. mode="semicircle"
  70. size="30"></u-loading-icon>
  71. </view>
  72. </u-list>
  73. </view>
  74. <view v-else class="no-order">
  75. <view class="box">
  76. <view class="no-product-title">{{ $t('page.order.no-Order') }}</view>
  77. <view @click="toHome()" class="to-home">{{ $t('page.order.take-stroll')}}</view>
  78. </view>
  79. </view>
  80. <u-modal :show="show"
  81. :title="$t('page.order.confirm_pay')"
  82. :confirmText="$t('page.order.ok')"
  83. :cancelText="$t('page.order.no')"
  84. @cancel="show = false;$play()"
  85. @confirm="payOrder"
  86. :showCancelButton="true"
  87. ></u-modal>
  88. <sTabbar select="1"/>
  89. </view>
  90. </template>
  91. <script>
  92. import navbar from '@/components/base/m-navbar.vue'
  93. import sTabbar from '@/components/base/tabBar.vue'
  94. export default {
  95. components: {
  96. navbar,
  97. sTabbar
  98. },
  99. data() {
  100. return {
  101. classifyList: [
  102. {
  103. name: this.$t('page.order.class_1')
  104. },
  105. {
  106. name: this.$t('page.order.class_2')
  107. },
  108. {
  109. name: this.$t('page.order.class_3')
  110. },
  111. {
  112. name: this.$t('page.order.class_4')
  113. },
  114. ],
  115. productList: [],
  116. currentIndex: 0, //当前选择的标签index
  117. queryParams: {
  118. pageNo: 1,
  119. pageSize: 10
  120. },
  121. noOrder: false,
  122. loading : false,
  123. show : false,
  124. order : {}
  125. }
  126. },
  127. onShow() {
  128. this.getOrderList();
  129. this.currentIndex = localStorage.getItem('orderIndex') ?
  130. parseInt(localStorage.getItem('orderIndex')) : 0
  131. localStorage.removeItem('orderIndex')
  132. },
  133. methods: {
  134. getOrderList() { //获取订单列表
  135. this.loading = true
  136. let data = {
  137. ...this.queryParams,
  138. }
  139. if(this.currentIndex) data.state = this.currentIndex - 1
  140. this.request('orderPage', {}, data).then(res => {
  141. if(res.code == 200){
  142. this.loading = false
  143. this.productList = res.result.records
  144. }
  145. })
  146. },
  147. tabChange(index) {
  148. if (index != this.currentIndex) {
  149. this.currentIndex = index
  150. this.$play()
  151. this.getOrderList();
  152. }
  153. },
  154. payOrder() {
  155. this.$play()
  156. uni.showLoading()
  157. this.request('pay', {}, {
  158. id : this.order.id
  159. }).then(res => {
  160. uni.hideLoading()
  161. this.show = false
  162. if (res.code == 200) {
  163. this.getOrderList();
  164. }
  165. })
  166. },
  167. toHome(){ //去首页
  168. this.$play()
  169. uni.switchTab({
  170. url: '/pages/home/home'
  171. })
  172. },
  173. scrolltolower(){
  174. this.queryParams.pageSize += 10
  175. this.getOrderList()
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .order {
  182. padding-bottom: 200rpx;
  183. background-color: #f7f7f7;
  184. // background-image: url('@/static/home/bg.png');
  185. background-size: 100%;
  186. color: #000;
  187. font-weight: bold;
  188. min-height: 100vh;
  189. padding-bottom: 200rpx;
  190. .act{
  191. background-color: #000;
  192. border-radius: 10rpx;
  193. color: #fff;
  194. }
  195. .order-list {
  196. box-sizing: border-box;
  197. margin-top: 50px;
  198. .order-item {
  199. position: relative;
  200. padding: 20rpx;
  201. border-radius: 5px;
  202. background-color: $uni-bg-color;
  203. box-shadow: 0px 0px 5rpx 5rpx #00000023;
  204. margin: 0rpx 20rpx 20rpx 20rpx;
  205. .top{
  206. display: flex;
  207. justify-content: space-between;
  208. }
  209. .con{
  210. display: flex;
  211. align-items: center;
  212. }
  213. }
  214. }
  215. .no-order {
  216. height: calc(100vh - 138px);
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. .box {
  221. font-size: 26rpx;
  222. text-align: center;
  223. .to-home {
  224. padding: 20rpx 140rpx;
  225. border: 1px solid #ccc;
  226. border-radius: 5px;
  227. text-align: center;
  228. margin: 20rpx 0px;
  229. }
  230. }
  231. }
  232. }
  233. </style>