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.

423 lines
9.3 KiB

9 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
9 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
9 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
9 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
9 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
9 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
9 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
9 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
9 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
9 months ago
9 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. {{ userInfo.orderMoney - item.price }} {{ $store.state.unit }}
  57. </view>
  58. <view v-else>
  59. {{ item.price }} {{ $store.state.unit }}
  60. </view>
  61. </view> -->
  62. <!-- <template
  63. v-if="item.state == 0 && userInfo.money < item.price">
  64. <view class="con">
  65. <view>
  66. {{ $t('page.order.total') }}
  67. </view>
  68. <view>
  69. {{ item.price }} {{ $store.state.unit }}
  70. </view>
  71. </view>
  72. <view class="con">
  73. <view>
  74. {{ $t('page.order.Total_Amount') }}
  75. </view>
  76. <view>
  77. {{ item.price }} {{ $store.state.unit }}
  78. </view>
  79. </view>
  80. <view class="con">
  81. <view>
  82. {{ $t('page.order.BalancePayment') }}
  83. </view>
  84. <view>
  85. {{ (userInfo.money - item.price).toFixed(2) }} {{ $store.state.unit }}
  86. </view>
  87. </view>
  88. </template> -->
  89. <!-- 商品价格 -->
  90. <view class="con">
  91. <view>
  92. {{ $t('page.order.Total_Amount') }}
  93. </view>
  94. <view>
  95. {{ item.price }} {{ $store.state.unit }}
  96. </view>
  97. </view>
  98. <!-- 支付后剩余钱包金额 -->
  99. <view class="con"
  100. style="font-size: 24rpx;"
  101. v-if="item.state == 0 && userInfo.money < item.price">
  102. <view>
  103. {{ $t('page.order.BalancePayment') }}
  104. </view>
  105. <view>
  106. {{ (userInfo.money - item.price).toFixed(2) }} {{ $store.state.unit }}
  107. </view>
  108. </view>
  109. <!-- 商品佣金 -->
  110. <view class="con" style="color: #b00;font-size: 26rpx;">
  111. <view>
  112. {{ $t('page.order.Profit') }}
  113. </view>
  114. <view>
  115. {{ item.giveMoney }} {{ $store.state.unit }}
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="buttom">
  121. <!-- <view class="btn">
  122. {{ $t('page.order.Submit_New') }}
  123. </view> -->
  124. <view class="btn" v-if="item.state == 0" @click="order = item;show = true">
  125. {{ $t('page.order.payment') }}
  126. </view>
  127. </view>
  128. <view class="buttom">
  129. <!-- <view class="btn">
  130. {{ $t('page.order.Submit_New') }}
  131. </view> -->
  132. <view class="btn" v-if="item.state == 1">
  133. {{ $t('page.order.complete') }}
  134. </view>
  135. </view>
  136. </view>
  137. <view style="justify-content: center;display: flex;
  138. margin-top: 150rpx;" v-if="loading">
  139. <u-loading-icon mode="semicircle" size="30"></u-loading-icon>
  140. </view>
  141. </u-list>
  142. </view>
  143. <!-- <view class="list"
  144. v-if="!noOrder">
  145. <view class="item">
  146. </view>
  147. </view> -->
  148. <view v-else class="no-order">
  149. <view class="box">
  150. <view class="no-product-title">{{ $t('page.order.no-Order') }}</view>
  151. <view @click="toHome()" class="to-home">{{ $t('page.order.take-stroll')}}</view>
  152. </view>
  153. </view>
  154. <u-modal :show="show" :title="$t('page.order.confirm_pay')" :confirmText="$t('page.order.ok')"
  155. :cancelText="$t('page.order.no')" @cancel="show = false;$play()" @confirm="payOrder"
  156. :showCancelButton="true"></u-modal>
  157. <sTabbar select="1" />
  158. </view>
  159. </template>
  160. <script>
  161. import navbar from '@/components/base/m-navbar.vue'
  162. import sTabbar from '@/components/base/tabBar.vue'
  163. export default {
  164. components: {
  165. navbar,
  166. sTabbar
  167. },
  168. data() {
  169. return {
  170. classifyList: [{
  171. name: this.$t('page.order.class_1')
  172. },
  173. {
  174. name: this.$t('page.order.class_2')
  175. },
  176. {
  177. name: this.$t('page.order.class_3')
  178. },
  179. // {
  180. // name: this.$t('page.order.class_4')
  181. // },
  182. ],
  183. userInfo : {},
  184. productList: [],
  185. currentIndex: 0, //当前选择的标签index
  186. queryParams: {
  187. pageNo: 1,
  188. pageSize: 10
  189. },
  190. noOrder: false,
  191. loading: false,
  192. show: false,
  193. order: {}
  194. }
  195. },
  196. onShow() {
  197. this.getOrderList();
  198. this.getUserInfo();
  199. this.currentIndex = localStorage.getItem('orderIndex') ?
  200. parseInt(localStorage.getItem('orderIndex')) : 0
  201. localStorage.removeItem('orderIndex')
  202. // setInterval(() => {
  203. // // 调用请求
  204. // this.loadData()
  205. // }, 3000)
  206. },
  207. methods: {
  208. //获取用户信息
  209. getUserInfo() {
  210. this.request('userInfo').then(res => {
  211. if (res.code == 200) {
  212. this.userInfo = res.result.userInfo
  213. }
  214. })
  215. },
  216. getOrderList() { //获取订单列表
  217. this.loading = true
  218. let data = {
  219. ...this.queryParams,
  220. }
  221. if (this.currentIndex) data.state = this.currentIndex - 1
  222. this.request('orderPage', {}, data).then(res => {
  223. if (res.code == 200) {
  224. this.loading = false
  225. this.productList = res.result.records
  226. }
  227. })
  228. },
  229. tabChange(index) {
  230. if (index != this.currentIndex) {
  231. this.currentIndex = index
  232. this.$play()
  233. this.getOrderList();
  234. }
  235. },
  236. payOrder() {
  237. this.$play()
  238. uni.showLoading()
  239. this.request('pay', {}, {
  240. id: this.order.id
  241. }).then(res => {
  242. uni.hideLoading()
  243. this.show = false
  244. if (res.code == 200) {
  245. this.getOrderList();
  246. }
  247. })
  248. },
  249. toHome() { //去首页
  250. this.$play()
  251. uni.switchTab({
  252. url: '/pages/home/home'
  253. })
  254. },
  255. scrolltolower() {
  256. this.queryParams.pageSize += 10
  257. this.getOrderList()
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss" scoped>
  263. .order {
  264. padding-bottom: 200rpx;
  265. background-color: #f7f7f7;
  266. // background-image: url('@/static/home/bg.png');
  267. background-size: 100%;
  268. color: #000;
  269. font-weight: bold;
  270. min-height: 100vh;
  271. padding-bottom: 200rpx;
  272. .type {
  273. display: flex;
  274. background-color: #fff;
  275. // position: fixed;
  276. width: 100%;
  277. top: 0;
  278. left: 0;
  279. height: 90rpx;
  280. justify-content: center;
  281. align-items: center;
  282. color: #989898;
  283. font-size: 28rpx;
  284. &>view {
  285. flex: 1;
  286. display: flex;
  287. justify-content: center;
  288. align-items: center;
  289. }
  290. .select {
  291. color: #000;
  292. text {
  293. padding-bottom: 10rpx;
  294. border-bottom: 3px solid #000;
  295. }
  296. }
  297. }
  298. .order-list {
  299. box-sizing: border-box;
  300. // margin-top: 50px;
  301. .order-item {
  302. position: relative;
  303. padding: 20rpx;
  304. border-radius: 5px;
  305. background-color: $uni-bg-color;
  306. box-shadow: 0px 0px 5rpx 5rpx #00000010;
  307. margin: 0rpx 20rpx 20rpx 20rpx;
  308. .top {
  309. display: flex;
  310. justify-content: space-between;
  311. }
  312. .center-box {
  313. display: flex;
  314. padding: 20rpx 0;
  315. .img-box {
  316. width: 200rpx;
  317. height: 200rpx;
  318. overflow: hidden;
  319. border-radius: 10rpx;
  320. display: flex;
  321. align-items: center;
  322. image {
  323. width: 100%;
  324. height: 100%;
  325. }
  326. }
  327. .content {
  328. font-weight: 500;
  329. width: 430rpx;
  330. font-size: 28rpx;
  331. padding-left: 10rpx;
  332. padding-top: 10rpx;
  333. .title {
  334. overflow: hidden;
  335. text-overflow: ellipsis;
  336. display: -webkit-box;
  337. -webkit-line-clamp: 2;
  338. -webkit-box-orient: vertical;
  339. width: 100%;
  340. }
  341. .con {
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-between;
  345. margin-top: 15rpx;
  346. }
  347. }
  348. }
  349. .buttom {
  350. display: flex;
  351. justify-content: flex-end;
  352. .btn {
  353. padding: 10rpx 20rpx;
  354. margin: 0 20rpx;
  355. font-size: 26rpx;
  356. font-weight: 500;
  357. background-color: #f33;
  358. color: #fff;
  359. border-radius: 10rpx;
  360. }
  361. }
  362. }
  363. }
  364. .no-order {
  365. height: calc(100vh - 138px);
  366. display: flex;
  367. align-items: center;
  368. justify-content: center;
  369. .box {
  370. font-size: 26rpx;
  371. text-align: center;
  372. .to-home {
  373. padding: 20rpx 140rpx;
  374. border: 1px solid #ccc;
  375. border-radius: 5px;
  376. text-align: center;
  377. margin: 20rpx 0px;
  378. }
  379. }
  380. }
  381. }
  382. </style>