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.

354 lines
7.5 KiB

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