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.

286 lines
6.6 KiB

10 months ago
9 months ago
9 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
  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 class="con"
  76. v-if="item.state == 0 && userInfo.money < item.price"
  77. style="margin-top: 10rpx;
  78. color: #f40;font-weight: 900;font-size: 28rpx;">
  79. <view style="flex: 1;">
  80. {{ $t('page.order.Need') }}
  81. </view>
  82. <view style="flex: 1;">
  83. USDT {{ (userInfo.money - item.price).toFixed(2) }}
  84. </view>
  85. </view>
  86. </view>
  87. <view style="justify-content: center;display: flex;
  88. margin-top: 150rpx;" v-if="loading">
  89. <u-loading-icon
  90. mode="semicircle"
  91. size="30"></u-loading-icon>
  92. </view>
  93. </u-list>
  94. </view>
  95. <view v-else class="no-order">
  96. <view class="box">
  97. <view class="no-product-title">{{ $t('page.order.no-Order') }}</view>
  98. <view @click="toHome()" class="to-home">{{ $t('page.order.take-stroll')}}</view>
  99. </view>
  100. </view>
  101. <u-modal :show="show"
  102. :title="$t('page.order.confirm_pay')"
  103. :confirmText="$t('page.order.ok')"
  104. :cancelText="$t('page.order.no')"
  105. @cancel="show = false;$play()"
  106. @confirm="payOrder"
  107. :showCancelButton="true"
  108. ></u-modal>
  109. <sTabbar select="2"/>
  110. </view>
  111. </template>
  112. <script>
  113. import navbar from '@/components/base/m-navbar.vue'
  114. import sTabbar from '@/components/base/tabBar.vue'
  115. export default {
  116. components: {
  117. navbar,
  118. sTabbar
  119. },
  120. data() {
  121. return {
  122. classifyList: [
  123. {
  124. name: this.$t('page.order.class_1')
  125. },
  126. {
  127. name: this.$t('page.order.class_2')
  128. },
  129. {
  130. name: this.$t('page.order.class_3')
  131. },
  132. {
  133. name: this.$t('page.order.class_4')
  134. },
  135. ],
  136. productList: [],
  137. currentIndex: 0, //当前选择的标签index
  138. queryParams: {
  139. pageNo: 1,
  140. pageSize: 10
  141. },
  142. noOrder: false,
  143. loading : false,
  144. show : false,
  145. order : {},
  146. userInfo: {},
  147. }
  148. },
  149. onShow() {
  150. this.getUserInfo();
  151. this.getOrderList();
  152. this.currentIndex = localStorage.getItem('orderIndex') ?
  153. parseInt(localStorage.getItem('orderIndex')) : 0
  154. localStorage.removeItem('orderIndex')
  155. },
  156. methods: {
  157. getUserInfo() {
  158. this.request('userInfo').then(res => {
  159. if (res.code == 200) {
  160. this.userInfo = res.result.userInfo
  161. this.vipInfo = res.result.vip
  162. }
  163. })
  164. },
  165. getOrderList() { //获取订单列表
  166. this.loading = true
  167. let data = {
  168. ...this.queryParams,
  169. }
  170. if(this.currentIndex) data.state = this.currentIndex - 1
  171. this.request('orderPage', {}, data).then(res => {
  172. if(res.code == 200){
  173. this.loading = false
  174. this.productList = res.result.records
  175. }
  176. })
  177. },
  178. tabChange(index) {
  179. if (index != this.currentIndex) {
  180. this.currentIndex = index
  181. this.$play()
  182. this.getOrderList();
  183. }
  184. },
  185. payOrder() {
  186. this.$play()
  187. uni.showLoading()
  188. this.request('pay', {}, {
  189. id : this.order.id
  190. }).then(res => {
  191. uni.hideLoading()
  192. this.show = false
  193. if (res.code == 200) {
  194. this.getOrderList();
  195. }
  196. })
  197. },
  198. toHome(){ //去首页
  199. this.$play()
  200. uni.switchTab({
  201. url: '/pages/home/home'
  202. })
  203. },
  204. scrolltolower(){
  205. this.queryParams.pageSize += 10
  206. this.getOrderList()
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. body{
  213. background-color: #000 !important;
  214. }
  215. .order {
  216. padding-bottom: 200rpx;
  217. background-color: black;
  218. background-image: url('@/static/home/bg.png');
  219. background-size: 100%;
  220. color: white;
  221. font-weight: bold;
  222. min-height: 100vh;
  223. padding-bottom: 200rpx;
  224. .act{
  225. background-color: #afc056;
  226. border-radius: 10rpx;
  227. color: black;
  228. }
  229. .order-list {
  230. box-sizing: border-box;
  231. margin-top: 50px;
  232. .order-item {
  233. position: relative;
  234. background: white;
  235. padding: 20rpx;
  236. border-radius: 5px;
  237. background-color: #333333;
  238. margin: 0rpx 20rpx 20rpx 20rpx;
  239. .top{
  240. display: flex;
  241. justify-content: space-between;
  242. }
  243. .con{
  244. display: flex;
  245. align-items: center;
  246. }
  247. }
  248. }
  249. .no-order {
  250. height: calc(100vh - 138px);
  251. display: flex;
  252. align-items: center;
  253. justify-content: center;
  254. .box {
  255. font-size: 26rpx;
  256. text-align: center;
  257. .to-home {
  258. padding: 20rpx 140rpx;
  259. border: 1px solid #ccc;
  260. border-radius: 5px;
  261. text-align: center;
  262. margin: 20rpx 0px;
  263. }
  264. }
  265. }
  266. }
  267. </style>