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.

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