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.

465 lines
11 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="content">
  3. <view style="width: 710rpx; margin: 40rpx auto 20rpx;">
  4. <view class="flex rr" style="align-items: center;">
  5. <uni-icons type="sound" size="50rpx" color="#FBA54F"></uni-icons>
  6. <view class="xx" v-html="notice">
  7. </view>
  8. <!-- 长沙市刘师傅在服务过程中客户投诉服务过程中有不文明的行为,扣信用分5分罚款500元公布三日望引以为戒 -->
  9. </view>
  10. <view
  11. style="width: 670rpx;height: 80rpx;background-color: #fff; border-radius: 16rpx;padding: 15rpx 20rpx;">
  12. <view class="flex-sb" style="line-height: 40rpx; font-size: 28rpx;">
  13. <view :class="{'sb-w8' : true, select : item == selectDate}" @click="onSelectDate(item)"
  14. v-for="(item, index) in dateList">
  15. <view class="">
  16. {{ item.format('dddd')[2] }}
  17. </view>
  18. <view class="">
  19. {{ index == 0 ? '今' : index == 1 ? '明' : item.format('DD') }}
  20. </view>
  21. </view>
  22. <!-- <view class="sb-w8" style="border-left: 1rpx solid #999;"><uni-icons type="list" size="34rpx"/></view> -->
  23. </view>
  24. <!-- <view class="flex-sb" style="line-height: 48rpx;">
  25. <view class="sb-w8" v-for="(item, index) in dateList">
  26. {{ index == 0 ? '今' : index == 1 ? '明' : item.format('DD') }}
  27. </view> -->
  28. <!-- <view class="sb-w8" style="border-left: 1rpx solid #999;"><uni-icons type="down" size="34rpx"/></view> -->
  29. <!-- </view> -->
  30. </view>
  31. <view class="flex-sb" style="margin-top: 20rpx;">
  32. <view :class="{'status-card' : true, select : queryParams.state == 0}" @click="selectTenState(0)">
  33. <view>
  34. <view class="num">{{ completedQuantity }}</view>
  35. <view>已完成</view>
  36. </view>
  37. </view>
  38. <view :class="{'status-card' : true, select : queryParams.state == 1}" @click="selectTenState(1)">
  39. <view>
  40. <view class="num">{{ confirmedQuantity }}</view>
  41. <view>待确认</view>
  42. </view>
  43. </view>
  44. <view :class="{'status-card' : true, select : queryParams.state == 2}" @click="selectTenState(2)">
  45. <view>
  46. <view class="num">{{ numberOfVisits }}</view>
  47. <view>待上门</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="mt20">
  52. <van-list v-if="orderList.length > 0" v-model:loading="loading" :finished="finished" @load="onLoad">
  53. <view class="item" v-for="(item, index) in orderList"
  54. @click="toOrderDetail(item.id)">
  55. <view class="top">
  56. <view class="service">
  57. <text>{{item.projectId_dictText}}</text>
  58. <uni-icons type="right" size="15"></uni-icons>
  59. <text>{{item.type_dictText}}</text>
  60. </view>
  61. <view class="status">
  62. <text> {{item.tenState_dictText}}</text>
  63. </view>
  64. </view>
  65. <view class="content">
  66. <view class="left">
  67. <image mode="aspectFill" :src="item.image"></image>
  68. <view class="tag">
  69. {{item.technicianId_dictText}}
  70. </view>
  71. </view>
  72. <view class="right">
  73. <view class="text-hidden-1">
  74. 客户姓名{{item.name}}
  75. </view>
  76. <view class="text-hidden-1">
  77. 下单时间{{item.createTime}}
  78. </view>
  79. <view class="text-hidden-1">
  80. 下单地址{{item.address}}{{item.addressDetails || ''}}
  81. </view>
  82. <view class="text-hidden-1">
  83. 服务时间{{item.serviceDate}} {{item.serviceTime}}服务{{item.useTime}}分钟
  84. </view>
  85. <view class="price">
  86. 总价格<text class="num">{{item.money}}</text>
  87. </view>
  88. </view>
  89. </view>
  90. <view v-if="item.state !=4" class="bottom">
  91. <view class="b2" v-if="item.tenState == 0"
  92. @click.stop="confirmVipOrder(item, getOrderList)">
  93. 确认订单
  94. </view>
  95. <view class="b2" v-if="item.tenState == 1" @click.stop="startVipOrder(item, getOrderList)">
  96. 技师出发
  97. </view>
  98. <view class="b2" v-if="item.tenState == 2" @click.stop="arriveVipOrder(item, getOrderList)">
  99. 到达打卡
  100. </view>
  101. <view class="b2" v-if="item.tenState == 3"
  102. @click.stop="startVipService(item, startServiceCallback)">
  103. 开始服务
  104. </view>
  105. <view class="b1" v-if="item.tenState == 4 && !item.isTimeout"
  106. @click.stop="toCountdown(item)">
  107. 服务时间
  108. </view>
  109. <view class="b2" v-if="item.tenState == 4"
  110. @click.stop="endVipService(item, toEvaluate, item.id, item.projectId,item.technicianId)">
  111. 结束服务
  112. </view>
  113. <!-- <view class="b1" @click.stop="toEvaluate()" v-if="item.tenState == 5">
  114. 投诉举报
  115. </view> -->
  116. <view class="b2" @click.stop="toEvaluate(item.id,item.projectId,item.technicianId)"
  117. v-if="item.tenState == 5">
  118. 立即评价
  119. </view>
  120. </view>
  121. <view v-else class="bottom">
  122. <view @click.stop="()=>{}" class="b3">
  123. 用户取消
  124. </view>
  125. </view>
  126. </view>
  127. </van-list>
  128. <van-empty v-else image="/static/empty/order.png" image-size="400rpx" :description="getStatus()" />
  129. </view>
  130. </view>
  131. </view>
  132. </template>
  133. <script>
  134. import orderMixins from '@/mixins/order.js'
  135. export default {
  136. mixins: [orderMixins],
  137. data() {
  138. return {
  139. dateList: [],
  140. active: 0,
  141. queryParams: {
  142. state: 1,
  143. pageNo: 1,
  144. pageSize: 10
  145. },
  146. orderList: [], //订单列表数据
  147. loading: false,
  148. finished: false,
  149. tenState: 0,
  150. selectDate: null,
  151. config: [],
  152. notice: '',
  153. completedQuantity: 0,
  154. confirmedQuantity: 0,
  155. numberOfVisits: 0,
  156. countdownOrder: uni.getStorageSync('countdownOrder') ? JSON.parse(uni.getStorageSync('countdownOrder')) :
  157. {}
  158. }
  159. },
  160. onShow() {
  161. this.getOrderList(this.queryParams.state)
  162. this.getConfig()
  163. this.dateList = []
  164. let today = this.dayjs()
  165. // this.selectDate = today;
  166. this.dateList.push(today)
  167. for (let i = 1; i < 7; i++) {
  168. this.dateList.push(today.add(i, 'day'))
  169. }
  170. },
  171. methods: {
  172. onLoad() {
  173. this.queryParams.pageSize += 10
  174. this.getOrderList()
  175. },
  176. //获取订单列表
  177. getOrderList(state, order) {
  178. let params = {
  179. ...this.queryParams,
  180. tenstate : this.queryParams.state,
  181. }
  182. if (this.selectDate) {
  183. params.serviceDate = this.selectDate.format('YYYY-MM-DD')
  184. }
  185. this.$api('getTenOrderPageList', params, res => {
  186. if (res.code == 200) {
  187. res.result.records.forEach(item => {
  188. item.isTimeout = true; //是否服务时间已过
  189. if (item && item.startServiceTime) { //有开始服务时间说明技师已开始服务
  190. let isTimeout = new Date(item.startServiceTime).valueOf() + item.useTime *
  191. 1000 * 60
  192. if (Date.now() <= isTimeout) {
  193. item.isTimeout = false
  194. }
  195. }
  196. })
  197. this.orderList = res.result.records;
  198. //统计各种状态订单数量
  199. let titles = ['completedQuantity', 'confirmedQuantity', 'numberOfVisits']
  200. let current = titles[state]
  201. this[current] = res.result.total
  202. //打开倒计时页面
  203. if (order && order.id) {
  204. this.orderList.forEach(item => {
  205. if (item.id == order.id) {
  206. this.toCountdown(item)
  207. }
  208. })
  209. }
  210. if (this.queryParams.pageSize > this.orderList.length) {
  211. this.finished = true
  212. }
  213. } else {
  214. this.finished = true
  215. }
  216. this.loading = false
  217. })
  218. },
  219. selectTenState(state) {
  220. this.queryParams.pageSize = 10
  221. this.queryParams.state = state;
  222. this.getOrderList(state)
  223. },
  224. onSelectDate(selectDate) {
  225. if (this.selectDate == selectDate) {
  226. this.selectDate = null
  227. } else {
  228. this.selectDate = selectDate
  229. }
  230. this.queryParams.pageSize = 10
  231. this.queryParams.serviceTime = this.dayjs(selectDate).format('YYYY-MM-DD')
  232. this.getOrderList(this.queryParams.state)
  233. },
  234. toEvaluate(id, projectId, terId) {
  235. uni.navigateTo({
  236. url : `/pages/order/evaluate?id=${id}&projectId=${projectId}&terId=${terId}`
  237. })
  238. },
  239. toOrderDetail(id) {
  240. uni.navigateTo({
  241. url: '/pages/order/orderDetail?id=' + id
  242. })
  243. },
  244. getConfig() {
  245. this.vid = uni.getStorageSync("ivcode");
  246. this.$api('getConfig', {}, res => {
  247. if (res.code == 200) {
  248. res.result.forEach(n => {
  249. if (n.keyValue == 'notice') {
  250. this.notice = n.content
  251. }
  252. })
  253. this.config = res.result
  254. }
  255. })
  256. },
  257. //获取当前查询订单状态
  258. getStatus() {
  259. let titles = ['暂无已完成订单', '暂无待确认订单', '暂无待上门']
  260. return titles[this.queryParams.state]
  261. },
  262. //跳转倒计时
  263. toCountdown(order) {
  264. let {
  265. useTime,
  266. startServiceTime
  267. } = order
  268. let isTimeout = new Date(startServiceTime).valueOf() + useTime * 1000 * 60
  269. if (Date.now() >= isTimeout) {
  270. return uni.showToast({
  271. title: '服务时间已过',
  272. icon: 'none'
  273. })
  274. }
  275. uni.navigateTo({
  276. url: `/pages/mine/countdown?time=${useTime}&startTime=${startServiceTime}`
  277. })
  278. },
  279. //开始服务回调
  280. startServiceCallback(order) {
  281. this.getOrderList(this.queryParams.state, order)
  282. }
  283. }
  284. }
  285. </script>
  286. <style scoped lang="scss">
  287. body {
  288. background-color: #f3f3f3;
  289. font-family: PingFang SC;
  290. }
  291. .rr {
  292. height: 52rpx;
  293. background: #fbecdd;
  294. border-radius: 16rpx;
  295. width: calc(710rpx - 40rpx);
  296. padding: 20rpx;
  297. margin: 20rpx 0;
  298. }
  299. .xx {
  300. width: 602rpx;
  301. height: 56rpx;
  302. font-size: 20rpx;
  303. font-family: PingFang SC, PingFang SC-Regular;
  304. font-weight: 400;
  305. text-align: left;
  306. color: #323232;
  307. display: flex;
  308. align-items: center;
  309. }
  310. .status-card {
  311. width: 132rpx;
  312. height: 92rpx;
  313. background-color: #fff;
  314. border-radius: 16rpx;
  315. padding: 40rpx;
  316. text-align: center;
  317. color: #ccc;
  318. .num {
  319. color: #0d0d0d;
  320. font-size: 42rpx;
  321. }
  322. }
  323. .status-card.select {
  324. background-color: var(--van-primary-color);
  325. color: #eee;
  326. .num {
  327. color: #fff;
  328. }
  329. }
  330. .select {
  331. color: var(--van-primary-color);
  332. font-weight: 900;
  333. }
  334. .item {
  335. width: calc(100% - 40rpx);
  336. background-color: #fff;
  337. margin: 20rpx;
  338. box-sizing: border-box;
  339. border-radius: 16rpx;
  340. padding: 30rpx;
  341. .top {
  342. display: flex;
  343. justify-content: space-between;
  344. align-items: center;
  345. font-size: 30rpx;
  346. .service {}
  347. .status {
  348. color: var(--van-primary-color);
  349. font-size: 26rpx;
  350. font-weight: 600;
  351. }
  352. }
  353. .content {
  354. display: flex;
  355. margin: 10rpx 0;
  356. .left {
  357. width: 150rpx;
  358. height: 150rpx;
  359. overflow: hidden;
  360. border-radius: 10rpx;
  361. image {
  362. width: 150rpx;
  363. height: 150rpx;
  364. }
  365. .tag {
  366. color: var(--van-primary-color);
  367. font-size: 24rpx;
  368. text-align: center;
  369. width: 100%;
  370. background-color: #e7fdf7;
  371. border: 1px solid var(--van-primary-color);
  372. border-radius: 8rpx;
  373. padding: 2rpx 0;
  374. }
  375. }
  376. .right {
  377. width: calc(100% - 160rpx);
  378. color: #777;
  379. font-size: 24rpx;
  380. padding-left: 20rpx;
  381. line-height: 40rpx;
  382. .price {
  383. font-weight: 900;
  384. text-align: right;
  385. text {
  386. color: #ff780099;
  387. font-size: 30rpx;
  388. }
  389. }
  390. }
  391. }
  392. .bottom {
  393. display: flex;
  394. justify-content: flex-end;
  395. font-size: 25rpx;
  396. .b1,
  397. .b3 {
  398. border: 1px solid #777;
  399. color: #777;
  400. box-sizing: border-box;
  401. }
  402. .b2 {
  403. background: linear-gradient(178deg, #4FD3BC, #60C285);
  404. color: #fff;
  405. }
  406. .b3 {
  407. background: transparent;
  408. }
  409. view {
  410. margin: 12rpx;
  411. border-radius: 28rpx;
  412. padding: 8rpx 28rpx;
  413. margin-bottom: 0;
  414. }
  415. }
  416. }
  417. </style>