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.

265 lines
6.0 KiB

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