宜轩到家/服务到家第三版,换个颜色
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.

473 lines
11 KiB

8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 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
7 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 Quantity" 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.addressId_dictText}}
  81. </view>
  82. <view class="text-hidden-1">
  83. 总计时间{{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. onLoad() {
  161. this.dateList = []
  162. let today = this.dayjs()
  163. // this.selectDate = today;
  164. this.dateList.push(today)
  165. for (let i = 1; i < 7; i++) {
  166. this.dateList.push(today.add(i, 'day'))
  167. }
  168. },
  169. onShow() {
  170. this.getOrderList(this.queryParams.state)
  171. this.getConfig()
  172. },
  173. methods: {
  174. onLoad() {
  175. this.queryParams.pageSize += 10
  176. this.getOrderList()
  177. },
  178. //获取订单列表
  179. getOrderList(state, order) {
  180. let params = {
  181. ...this.queryParams,
  182. }
  183. if (this.selectDate) {
  184. params.serviceDate = this.selectDate.format('YYYY-MM-DD')
  185. }
  186. this.$api('getTenOrderPageList', params, res => {
  187. if (res.code == 200) {
  188. res.result.records.forEach(item => {
  189. item.isTimeout = true; //是否服务时间已过
  190. if (item && item.startServiceTime) { //有开始服务时间说明技师已开始服务
  191. let isTimeout = new Date(item.startServiceTime).valueOf() + item.useTime *
  192. 1000 * 60
  193. if (Date.now() <= isTimeout) {
  194. item.isTimeout = false
  195. }
  196. }
  197. })
  198. this.orderList = res.result.records;
  199. //统计各种状态订单数量
  200. let titles = ['completedQuantity', 'confirmedQuantity', 'numberOfVisits']
  201. let current = titles[state]
  202. this[current] = res.result.total
  203. //打开倒计时页面
  204. if (order && order.id) {
  205. this.orderList.forEach(item => {
  206. if (item.id == order.id) {
  207. this.toCountdown(item)
  208. }
  209. })
  210. }
  211. if (this.queryParams.pageSize > this.orderList.length) {
  212. this.finished = true
  213. }
  214. } else {
  215. this.finished = true
  216. }
  217. this.loading = false
  218. })
  219. },
  220. selectTenState(state) {
  221. this.queryParams.pageSize = 10
  222. this.queryParams.state = state;
  223. this.getOrderList(state)
  224. },
  225. onSelectDate(selectDate) {
  226. if (this.selectDate == selectDate) {
  227. this.selectDate = null
  228. } else {
  229. this.selectDate = selectDate
  230. }
  231. this.queryParams.pageSize = 10
  232. this.queryParams.serviceTime = this.dayjs(selectDate).format('YYYY-MM-DD')
  233. this.getOrderList(this.queryParams.state)
  234. },
  235. toEvaluate(id, projectId, terId) {
  236. uni.navigateTo({
  237. url : `/pages/order/evaluate?id=${id}&projectId=${projectId}&terId=${terId}`
  238. })
  239. },
  240. toOrderDetail(id) {
  241. uni.navigateTo({
  242. url: '/pages/order/orderDetail?id=' + id
  243. })
  244. },
  245. getConfig() {
  246. this.vid = uni.getStorageSync("ivcode");
  247. this.$api('getConfig', {}, res => {
  248. if (res.code == 200) {
  249. res.result.forEach(n => {
  250. if (n.keyValue == 'notice') {
  251. this.notice = n.content
  252. }
  253. })
  254. this.config = res.result
  255. }
  256. })
  257. },
  258. //获取当前查询订单状态
  259. getStatus() {
  260. let titles = ['暂无已完成订单', '暂无待确认订单', '暂无待上门']
  261. return titles[this.queryParams.state]
  262. },
  263. //跳转倒计时
  264. toCountdown(order) {
  265. let {
  266. useTime,
  267. startServiceTime
  268. } = order
  269. let isTimeout = new Date(startServiceTime).valueOf() + useTime * 1000 * 60
  270. if (Date.now() >= isTimeout) {
  271. return uni.showToast({
  272. title: '服务时间已过',
  273. icon: 'none'
  274. })
  275. }
  276. uni.navigateTo({
  277. url: `/pages/mine/countdown?time=${useTime}&startTime=${startServiceTime}`
  278. })
  279. },
  280. //开始服务回调
  281. startServiceCallback(order) {
  282. this.getOrderList(this.queryParams.state, order)
  283. }
  284. }
  285. }
  286. </script>
  287. <style scoped lang="scss">
  288. body {
  289. background-color: #f3f3f3;
  290. font-family: PingFang SC;
  291. }
  292. .Quantity{
  293. &>view{
  294. display: flex;
  295. justify-content: center;
  296. align-items: center;
  297. }
  298. }
  299. .rr {
  300. height: 52rpx;
  301. background: #fbecdd;
  302. border-radius: 16rpx;
  303. width: calc(710rpx - 40rpx);
  304. padding: 20rpx;
  305. margin: 20rpx 0;
  306. }
  307. .xx {
  308. width: 602rpx;
  309. height: 56rpx;
  310. font-size: 20rpx;
  311. font-family: PingFang SC, PingFang SC-Regular;
  312. font-weight: 400;
  313. text-align: left;
  314. color: #323232;
  315. display: flex;
  316. align-items: center;
  317. }
  318. .status-card {
  319. width: 132rpx;
  320. height: 92rpx;
  321. background-color: #fff;
  322. border-radius: 16rpx;
  323. padding: 40rpx;
  324. text-align: center;
  325. color: #ccc;
  326. .num {
  327. color: #0d0d0d;
  328. font-size: 42rpx;
  329. }
  330. }
  331. .status-card.select {
  332. background-color: var(--van-primary-color);
  333. color: #eee;
  334. .num {
  335. color: #fff;
  336. }
  337. }
  338. .select {
  339. color: var(--van-primary-color);
  340. font-weight: 900;
  341. }
  342. .item {
  343. width: calc(100% - 40rpx);
  344. background-color: #fff;
  345. margin: 20rpx;
  346. box-sizing: border-box;
  347. border-radius: 16rpx;
  348. padding: 30rpx;
  349. .top {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. font-size: 30rpx;
  354. .service {}
  355. .status {
  356. color: var(--van-primary-color);
  357. font-size: 26rpx;
  358. font-weight: 600;
  359. }
  360. }
  361. .content {
  362. display: flex;
  363. margin: 10rpx 0;
  364. .left {
  365. width: 150rpx;
  366. height: 150rpx;
  367. overflow: hidden;
  368. border-radius: 10rpx;
  369. image {
  370. width: 150rpx;
  371. height: 150rpx;
  372. }
  373. .tag {
  374. color: var(--van-primary-color);
  375. font-size: 24rpx;
  376. text-align: center;
  377. width: 100%;
  378. background-color: #e7fdf7;
  379. border: 1px solid var(--van-primary-color);
  380. border-radius: 8rpx;
  381. padding: 2rpx 0;
  382. }
  383. }
  384. .right {
  385. width: calc(100% - 160rpx);
  386. color: #777;
  387. font-size: 24rpx;
  388. padding-left: 20rpx;
  389. line-height: 40rpx;
  390. .price {
  391. font-weight: 900;
  392. text-align: right;
  393. text {
  394. color: #ff780099;
  395. font-size: 30rpx;
  396. }
  397. }
  398. }
  399. }
  400. .bottom {
  401. display: flex;
  402. justify-content: flex-end;
  403. font-size: 25rpx;
  404. .b1,
  405. .b3 {
  406. border: 1px solid #777;
  407. color: #777;
  408. box-sizing: border-box;
  409. }
  410. .b2 {
  411. background: $uni-bg-color;
  412. color: $uni-color;
  413. }
  414. .b3 {
  415. background: transparent;
  416. }
  417. view {
  418. margin: 12rpx;
  419. border-radius: 28rpx;
  420. padding: 8rpx 28rpx;
  421. margin-bottom: 0;
  422. }
  423. }
  424. }
  425. </style>