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.

302 lines
6.7 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="order">
  3. <mNavbar title="订单中心" />
  4. <van-tabs v-model:active="active" title-active-color="var(--van-primary-color)" @change="clickTabs"
  5. style="position: sticky;top: 90rpx;z-index: 99;">
  6. <van-tab :title="item.name" v-for="(item, index) in tabs" :key="index"
  7. @click="getOrderList(index)"></van-tab>
  8. </van-tabs>
  9. <view v-if="orderList.length > 0" class="list">
  10. <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  11. <view class="item" v-for="(item, index) in orderList" @click="toOrderDetail(item.id)">
  12. <view class="top">
  13. <view class="service">
  14. <text>{{item.projectId_dictText}}</text>
  15. <uni-icons type="right" size="15"></uni-icons>
  16. <text>{{item.type_dictText}}</text>
  17. </view>
  18. <view class="status">
  19. <text> {{item.state_dictText}}</text>
  20. </view>
  21. </view>
  22. <view class="content">
  23. <view class="left">
  24. <image mode="aspectFill" :src="item.image"></image>
  25. <view class="tag">
  26. {{item.technicianId_dictText}}
  27. </view>
  28. </view>
  29. <view class="right">
  30. <view class="text-hidden-1">
  31. 客户姓名{{item.name}}
  32. </view>
  33. <view class="text-hidden-1">
  34. 下单时间{{item.createTime}}
  35. </view>
  36. <view class="text-hidden-1">
  37. 下单地址{{item.addressId_dictText}}
  38. </view>
  39. <view class="text-hidden-1">
  40. 总计时间{{item.useTime}}分钟
  41. </view>
  42. <view class="price">
  43. 总价格<text class="num">{{item.money}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="bottom">
  48. <view @click.stop="calcelOrder(item.id,cancelSuccess)" class="b1" v-if="item.state == 0">
  49. 取消订单
  50. </view>
  51. <view @click.stop="toPayOrder(item)" class="b2" v-if="item.state == 0">
  52. 立即付款
  53. </view>
  54. <!-- <view @click.stop="toPayOrder(item)" class="b2" v-if="item.state == 2">
  55. 立即确认
  56. </view> -->
  57. <view class="b1" @click.stop="moreOrder(item.projectId,toPlaceorder)" v-if="item.state == 3">
  58. 再来一单
  59. </view>
  60. <view class="b2" @click.stop="toEvaluate(item.id,item.projectId,item.technicianId)" v-if="item.state == 3">
  61. 立即评价
  62. </view>
  63. <view class="b2" @click.stop="moreOrder(item.projectId,toPlaceorder)" v-if="item.state == 4">
  64. 再来一单
  65. </view>
  66. </view>
  67. </view>
  68. </van-list>
  69. </view>
  70. <van-empty v-else image="/static/empty/order.png" image-size="400rpx" description="暂无订单" />
  71. </view>
  72. </template>
  73. <script>
  74. import mNavbar from '@/components/base/m-navbar.vue'
  75. import {
  76. showConfirmDialog
  77. } from 'vant';
  78. import Position from '@/utils/position.js'
  79. import order from '@/mixins/order.js'
  80. export default {
  81. components: {
  82. mNavbar,
  83. },
  84. mixins: [order],
  85. data() {
  86. return {
  87. tabs: [{
  88. name: '全部'
  89. },
  90. {
  91. name: '待付款'
  92. },
  93. {
  94. name: '已付款'
  95. },
  96. {
  97. name: '已确认'
  98. },
  99. {
  100. name: '已完成'
  101. },
  102. {
  103. name: '已取消'
  104. }
  105. ],
  106. active: this.$route.query.active ? parseInt(this.$route.query.active) : 0,
  107. queryParams: {
  108. state: -1,
  109. pageNo: 1,
  110. pageSize: 10
  111. },
  112. orderList: [], //订单列表数据
  113. loading: false,
  114. finished: false,
  115. }
  116. },
  117. onShow() {
  118. this.getOrderList()
  119. },
  120. methods: {
  121. //获取订单列表
  122. getOrderList() {
  123. this.queryParams.state = this.active - 1 > -2 ? this.active - 1 : -1
  124. this.$api('getOrderList', this.queryParams, res => {
  125. if (res.code == 200) {
  126. this.orderList = res.result.records;
  127. if (this.queryParams.pageSize > res.result.total) {
  128. this.finished = true
  129. }
  130. this.loading = false
  131. }else{
  132. this.finished = true
  133. }
  134. //用户不存在,删除token和用户信息并且需要用户重新登录
  135. if (res.code == 500 && res.message === '操作失败,用户不存在!') {
  136. localStorage.removeItem('token')
  137. localStorage.removeItem('userInfo')
  138. uni.navigateTo({
  139. url: '/pages/login/login'
  140. })
  141. }
  142. })
  143. },
  144. //点击tab栏
  145. clickTabs(index) {
  146. if (index == 0) {
  147. this.queryParams.state = -1;
  148. } else {
  149. this.queryParams.state = index - 1;
  150. }
  151. this.getOrderList()
  152. },
  153. //跳转订单详情页面
  154. toOrderDetail(id) {
  155. uni.navigateTo({
  156. url: '/pages/order/orderDetail?id=' + id
  157. })
  158. },
  159. //跳转再来一单
  160. toPlaceorder(res, projectId) {
  161. uni.navigateTo({
  162. url: `/pages/technician/selectTechnician?serviceId=${projectId}&current=order&active=${this.active}`
  163. })
  164. sessionStorage.setItem('technicianList', JSON.stringify(res.result.tenPageList))
  165. },
  166. //取消成功
  167. cancelSuccess() {
  168. uni.showToast({
  169. title: '取消成功',
  170. icon: 'none'
  171. })
  172. this.getOrderList()
  173. },
  174. //list列表滑动到底部自动新增数据列表
  175. onLoad() {
  176. this.queryParams.pageSize += 10;
  177. this.getOrderList()
  178. }
  179. }
  180. }
  181. </script>
  182. <style scoped lang="scss">
  183. body {
  184. background-color: #f3f3f3;
  185. font-family: PingFang SC;
  186. }
  187. .list {
  188. .item {
  189. width: calc(100% - 40rpx);
  190. background-color: #fff;
  191. margin: 20rpx;
  192. box-sizing: border-box;
  193. border-radius: 16rpx;
  194. padding: 30rpx;
  195. .top {
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: center;
  199. font-size: 30rpx;
  200. .service {}
  201. .status {
  202. color: var(--van-primary-color);
  203. font-size: 26rpx;
  204. font-weight: 600;
  205. }
  206. }
  207. .content {
  208. display: flex;
  209. margin: 10rpx 0;
  210. .left {
  211. width: 150rpx;
  212. height: 150rpx;
  213. border-radius: 10rpx;
  214. image {
  215. width: 150rpx;
  216. height: 150rpx;
  217. border-radius: 10rpx;
  218. }
  219. .tag {
  220. color: var(--van-primary-color);
  221. font-size: 24rpx;
  222. text-align: center;
  223. width: 100%;
  224. background-color: #e7fdf7;
  225. border: 1px solid var(--van-primary-color);
  226. border-radius: 8rpx;
  227. padding: 2rpx 0;
  228. }
  229. }
  230. .right {
  231. width: calc(100% - 160rpx);
  232. color: #777;
  233. font-size: 24rpx;
  234. padding-left: 20rpx;
  235. line-height: 40rpx;
  236. .price {
  237. font-weight: 900;
  238. text-align: right;
  239. text {
  240. color: #ff780099;
  241. font-size: 30rpx;
  242. }
  243. }
  244. }
  245. }
  246. .bottom {
  247. display: flex;
  248. justify-content: flex-end;
  249. font-size: 25rpx;
  250. .b1 {
  251. border: 1px solid #777;
  252. color: #777;
  253. box-sizing: border-box;
  254. }
  255. .b2 {
  256. background: linear-gradient(178deg, #4FD3BC, #60C285);
  257. color: #fff;
  258. }
  259. view {
  260. margin: 12rpx;
  261. border-radius: 28rpx;
  262. padding: 8rpx 28rpx;
  263. margin-bottom: 0;
  264. }
  265. }
  266. }
  267. }
  268. </style>