index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <template>
  2. <view class="page">
  3. <uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" title="首页" />
  4. <view class="flex-row tuni">
  5. <image class="profile" :src="userInfo.avatar || '/static/logo.png'"></image>
  6. <view class="tuniMsg flex-col">
  7. <text class="name">{{userInfo.nickName}}</text>
  8. <view class="flex-row dizi">
  9. <u-icon name="/static/index/dizi.png" size="18"></u-icon>
  10. <text>{{storeName || '请先报道打卡'}}</text>
  11. </view>
  12. </view>
  13. <view class="flex-col " @click="userScanCode">
  14. <view class="flex-row justify-center dakaIcon">
  15. <u-icon name="/static/index/saoma.png" size="25"></u-icon>
  16. </view>
  17. <view class="flex-row justify-center dakaText">
  18. <text>报道打卡</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="flex-row justify-center">
  23. <view class="tab flex-row">
  24. <view class="tabs" :class="{selectTabs: tabIndex === 0}" @click="clickTab(0)">
  25. <text>服务中</text>
  26. </view>
  27. <view class="tabs" :class="{selectTabs: tabIndex === 1}" @click="clickTab(1)">
  28. <text>待服务</text>
  29. </view>
  30. </view>
  31. </view>
  32. <view v-if="tabIndex === 0" class="flex-row justify-center">
  33. <view class="serviceMsg " v-if="currService">
  34. <view class="flex-row serviceInfo ">
  35. <image class="serviceProfile" :src="currService.avatar || '/static/logo.png'"></image>
  36. <view class="flex-col justify-end">
  37. <view class="flex-row">
  38. <text class="servicename">{{currService.serviceObjectName}}</text>
  39. <view class="flex-row justify-center tag" @click="openSelectServiceObjectPopup">
  40. <text>切换</text>
  41. <u-icon name="/static/index/qiehuan.png" size="18"></u-icon>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view :style="{'height':'110rpx'}"></view>
  47. <view class="flex-row justify-center " v-if="!currService.balanceFlag">
  48. <view class="flex-row hintView">
  49. <view class="hint">
  50. <text>!</text>
  51. </view>
  52. <view class="hintCentent">
  53. <text>娇宝的余额已不足,请提醒充值~</text>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="flex-col ">
  58. <view class="flex-row justify-center itemViewOut " v-for="(item,index) in currService.childList" :key="index">
  59. <view class="flex-col itemView " >
  60. <view class="flex-row justify-between item">
  61. <view class="flex-row">
  62. <u-icon name="/static/index/jiandao.png" size="20"></u-icon>
  63. <text class="key">服务项目:</text>
  64. <text class="value">{{item.serviceProject}}</text>
  65. </view>
  66. <view class="flex-row statusDesc" :class="item.status ?'statusDesc':'statusDesc1'">
  67. <text>{{item.statusDesc}}</text>
  68. </view>
  69. </view>
  70. <view class="flex-row item">
  71. <u-icon name="/static/index/riqi.png" size="20"></u-icon>
  72. <text class="key">服务日期:</text>
  73. <text class="value">{{item.serviceDate}}</text>
  74. </view>
  75. <view class="flex-row item">
  76. <view class="flex-row">
  77. <u-icon name="/static/index/aixin.png" size="20"></u-icon>
  78. <text class="key">服务人员:</text>
  79. <text class="value">{{item.serviceUserName}}</text>
  80. </view>
  81. </view>
  82. <view class="flex-row item">
  83. <view class="flex-row">
  84. <u-icon name="/static/index/shiduan.png" size="20"></u-icon>
  85. <text class="key">服务时段:</text>
  86. <text class="value">{{item.time}}</text>
  87. </view>
  88. <view class="flex-row leftBord">
  89. <text class="key">服务费用:</text>
  90. <text class="value2">¥{{item.serviceFee}}</text>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="flex-row justify-center">
  97. <view class="flex-col itemView">
  98. <view class="flex-row justify-between">
  99. <view class="flex-col justify-center">
  100. <view class="flex-row">
  101. <text class="key1">服务总金额:</text>
  102. <text class="value1">¥{{currService.serviceFee}}</text>
  103. </view>
  104. </view>
  105. <view class="flex-row justify-center tag1" v-if="currService.status == 1" @click="settle">
  106. <u-icon name="/static/index/qianbao.png" size="18"></u-icon>
  107. <text>去结算</text>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="flex-row justify-center">
  113. <view class="flex-row justify-around grid">
  114. <view @click="connect">
  115. <view class="flex-row justify-center">
  116. <u-icon name="/static/index/jiaojieban.png" size="40"></u-icon>
  117. </view>
  118. <view class="flex-row justify-center">
  119. <text class="grid-text">服务交接</text>
  120. </view>
  121. </view>
  122. <view @click="addService">
  123. <view class="flex-row justify-center">
  124. <u-icon name="/static/index/jiandao.png" size="40"></u-icon>
  125. </view>
  126. <view class="flex-row justify-center">
  127. <text class="grid-text">添加服务</text>
  128. </view>
  129. </view>
  130. <view @click="call" v-if="currService.State=='2'">
  131. <view class="flex-row justify-center">
  132. <u-icon name="/static/index/naba.png" size="40"></u-icon>
  133. </view>
  134. <view class="flex-row justify-center">
  135. <text class="grid-text">叫&nbsp;&nbsp;号</text>
  136. </view>
  137. </view>
  138. <view @click="next" v-else>
  139. <view class="flex-row justify-center">
  140. <u-icon name="/static/index/xiayige.png" size="40"></u-icon>
  141. </view>
  142. <view class="flex-row justify-center">
  143. <text class="grid-text">下一位</text>
  144. </view>
  145. </view>
  146. <view @click="takePlace">
  147. <view class="flex-row justify-center">
  148. <u-icon name="/static/index/yijiuwei.png" size="40"></u-icon>
  149. </view>
  150. <view class="flex-row justify-center">
  151. <text class="grid-text">已就位</text>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. <view class="flex-row justify-center start" @click="start" v-if="currService.status == 1">
  157. <text>开始服务</text>
  158. </view>
  159. <view class="flex-row justify-center start" @click="end" v-if="currService.status == 6">
  160. <text>结束服务</text>
  161. </view>
  162. </view>
  163. <view class="flex-col" :style="{'height':sysHeight}" v-else>
  164. <view class="flex-row justify-center">
  165. <image class="dataNull" src="/static/index/dataNull.png"></image>
  166. </view>
  167. <view class="flex-row justify-center dataNullText">
  168. <text>暂无服务项目</text>
  169. </view>
  170. </view>
  171. </view>
  172. <view v-if="tabIndex === 1" :style="{'height':sysHeight}">
  173. <mescroll-item :i="0" :index="0" :height="sysHeight">
  174. </mescroll-item>
  175. </view>
  176. <uni-popup ref="addServicePopup" @change="popupChange" type="bottom">
  177. <view class="addService">
  178. <view class="popupTitle">
  179. <text>添加服务项目</text>
  180. </view>
  181. <scroll-view class="scrollY" scroll-y>
  182. <view class="serviceItem" :class="{'vBackGround': serviceProjectListIndex === index}" v-for="(item,index) in serviceProjectList" :key="index" @click="serviceProjectListIndex = index">
  183. <view class="serviceName">
  184. <text>{{item.serviceName}}</text>
  185. </view>
  186. <view class="flex-row servicePrice">
  187. <u-icon name="rmb-circle" color="#666666"></u-icon>
  188. <text class="servicePriceKey">预约费用:</text>
  189. <text class="servicePricePrice">¥{{item.standardPrice}}</text>
  190. </view>
  191. <image v-if="serviceProjectListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  192. </view>
  193. </scroll-view>
  194. <view class="flex-row justify-around">
  195. <view class="cancelButton" @click="closeAddServicePopup">
  196. <text>取消</text>
  197. </view>
  198. <view class="confirmButton" @click="addServiceProject">
  199. <text>确定</text>
  200. </view>
  201. </view>
  202. </view>
  203. </uni-popup>
  204. <uni-popup ref="connectPopup" @change="popupChange" type="bottom">
  205. <view class="addService">
  206. <view class="popupTitle">
  207. <text>选择交接人员</text>
  208. </view>
  209. <scroll-view class="scrollY" scroll-y>
  210. <view class="flex-row teachItem" :class="{'vBackGround': servicePersonListIndex === index}" v-for="(item,index) in servicePersonList" :key="index" @click="servicePersonListIndex = index">
  211. <image class="teachImage" src="/static/index/dataNull.png"></image>
  212. <view class="flex-col teachMsg ">
  213. <view class="flex-row">
  214. <text class="techName">{{item.personName}}</text>
  215. <view v-if="i<2" class="teachTag" v-for="(iter,i) in item.postList" :key="i">
  216. <text>{{iter.levelName}}</text>
  217. </view>
  218. </view>
  219. <text class="declaration">优质服务,从我做起</text>
  220. </view>
  221. <image v-if="servicePersonListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  222. </view>
  223. </scroll-view>
  224. <view class="flex-row justify-around">
  225. <view class="cancelButton" @click="closeConnectPopup">
  226. <text>取消</text>
  227. </view>
  228. <view class="confirmButton" @click="handover">
  229. <text>确定</text>
  230. </view>
  231. </view>
  232. </view>
  233. </uni-popup>
  234. <uni-popup ref="selectServiceObjectPopup" @change="popupChange" type="bottom">
  235. <view class="addService">
  236. <view class="popupTitle">
  237. <text>切换服务对象</text>
  238. </view>
  239. <scroll-view class="scrollY" scroll-y>
  240. <view class="flex-row objectItem" :class="{'vBackGround': selectServiceObjectIndex === index}" v-for="(item,index) in selectServiceObjectList" :key="index" @click="selectServiceObjectIndex = index">
  241. <image class="objectImage" :src="item.facePhoto || '/static/index/dataNull.png'"></image>
  242. <view class="flex-col objectName ">
  243. <text>{{item.nickName}}</text>
  244. </view>
  245. <image v-if="servicePersonListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  246. </view>
  247. </scroll-view>
  248. <view class="flex-row justify-around">
  249. <view class="cancelButton" @click="closeSelectServiceObjectPopup">
  250. <text>取消</text>
  251. </view>
  252. <view class="confirmButton" @click="switchServiceObject">
  253. <text>确定</text>
  254. </view>
  255. </view>
  256. </view>
  257. </uni-popup>
  258. </view>
  259. </template>
  260. <script>
  261. import MescrollItem from "./module/mescrollUni-item.vue";
  262. import QQMapWX from '../../common/js/qqmap/myqqmap-sdk.js'
  263. export default {
  264. components: {
  265. MescrollItem
  266. },
  267. data() {
  268. return {
  269. selectServiceObjectList:[],
  270. selectServiceObjectIndex:-1,
  271. servicePersonList:[],
  272. servicePersonListIndex:-1,
  273. serviceProjectList:[],
  274. serviceProjectListIndex:-1,
  275. tabIndex: 0,
  276. sysHeight: '',
  277. readerHeight: '',
  278. readerWidth: '',
  279. userInfo: {},
  280. storeId: '1710635498257108993',
  281. storeName: '娇骄儿白云店',
  282. currService: null,
  283. qqMap:new QQMapWX({key: 'ZIABZ-543WB-747UM-JL5Y7-NDS4E-HWB4M',vm: this})
  284. }
  285. },
  286. onLoad() {
  287. let sysInfo = uni.getSystemInfoSync()
  288. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  289. this.readerHeight = sysInfo.windowHeight + 'px'
  290. this.readerWidth = sysInfo.windowWidth + 'px'
  291. // this.storeId = uni.getStorageSync('storeId')
  292. // this.storeName = uni.getStorageSync('storeName')
  293. this.getUserInfo()
  294. this.currServiceInfo()
  295. },
  296. onShow() {
  297. },
  298. methods: {
  299. openSelectServiceObjectPopup(){
  300. this.$api.service.getServiceObjectList({
  301. orderServiceId:this.currService.orderServiceId,
  302. }).then(res=>{
  303. this.selectServiceObjectList= res.data.data
  304. uni.hideTabBar()
  305. this.$refs.selectServiceObjectPopup.open()
  306. })
  307. },
  308. closeSelectServiceObjectPopup(){
  309. this.serviceProjectListIndex = -1
  310. this.$refs.selectServiceObjectPopup.close()
  311. },
  312. switchServiceObject(){
  313. if (this.selectServiceObjectIndex === -1){
  314. uni.showToast({
  315. icon: 'none',
  316. duration: 2000,
  317. title: '请选择服务对象'
  318. });
  319. return
  320. }
  321. this.$api.service.switchServiceObject({
  322. orderServiceId:this.currService.orderServiceId,
  323. serviceObjectId:this.selectServiceObjectList[this.selectServiceObjectIndex].id
  324. }).then(res=>{
  325. this.currServiceInfo()
  326. this.closeSelectServiceObjectPopup()
  327. })
  328. },
  329. addService() {
  330. this.$api.service.serviceProjectList().then(res=>{
  331. this.serviceProjectList= res.data.data
  332. uni.hideTabBar()
  333. this.$refs.addServicePopup.open()
  334. })
  335. },
  336. closeAddServicePopup(){
  337. this.serviceProjectListIndex = -1
  338. this.$refs.addServicePopup.close()
  339. },
  340. addServiceProject(){
  341. if (this.serviceProjectListIndex === -1){
  342. uni.showToast({
  343. icon: 'none',
  344. duration: 2000,
  345. title: '请选择服务项目'
  346. });
  347. return
  348. }
  349. this.$api.service.addServiceProject(
  350. {
  351. orderServiceId:this.currService.orderServiceId,
  352. serviceProjectId:this.serviceProjectList[this.serviceProjectListIndex].id
  353. }
  354. ).then(res=>{
  355. uni.showToast({
  356. icon: 'none',
  357. duration: 2000,
  358. title: '添加成功'
  359. });
  360. this.currServiceInfo()
  361. this.closeAddServicePopup()
  362. })
  363. },
  364. popupChange(e) {
  365. if (!e.show) {
  366. uni.showTabBar()
  367. }
  368. },
  369. connect() {
  370. this.$api.service.getServicePerson({storeId:this.storeId}).then((res) => {
  371. this.servicePersonList = res.data.data;
  372. uni.hideTabBar()
  373. this.$refs.connectPopup.open()
  374. })
  375. },
  376. closeConnectPopup(){
  377. this.servicePersonListIndex = -1
  378. this.$refs.connectPopup.close()
  379. },
  380. handover(){
  381. if (this.servicePersonListIndex === -1){
  382. uni.showToast({
  383. icon: 'none',
  384. duration: 2000,
  385. title: '请选择服务技师'
  386. });
  387. return
  388. }
  389. this.$api.service.handover({
  390. orderServiceId:this.currService.orderServiceId,
  391. serviceUserId:this.servicePersonList[this.servicePersonListIndex].personId
  392. }).then(res=>{
  393. this.closeConnectPopup()
  394. this.closeAddServicePopup()
  395. })
  396. },
  397. takePlace() {
  398. this.$api.service.takePlace({
  399. orderServiceId: this.currService.orderServiceId
  400. }).then(res => {
  401. this.currServiceInfo()
  402. })
  403. },
  404. settle() {
  405. this.$api.service.settle({
  406. orderServiceId: this.currService.orderServiceId
  407. }).then(res => {
  408. this.currServiceInfo()
  409. })
  410. },
  411. start() {
  412. this.$api.service.start({
  413. orderServiceId: this.currService.orderServiceId
  414. }).then(res => {
  415. this.currServiceInfo()
  416. })
  417. },
  418. end() {
  419. this.$api.service.end({
  420. orderServiceId: this.currService.orderServiceId
  421. }).then(res => {
  422. this.currServiceInfo()
  423. })
  424. },
  425. call(){
  426. this.$api.service.call({
  427. orderServiceId: this.currService.orderServiceId
  428. }).then(res => {
  429. this.currServiceInfo()
  430. })
  431. },
  432. next() {
  433. this.$api.service.next({
  434. orderServiceId: this.currService.orderServiceId
  435. }).then(res => {
  436. this.currServiceInfo()
  437. })
  438. },
  439. currServiceInfo() {
  440. if (this.storeId === '' || this.storeId === null){
  441. return
  442. }
  443. this.$api.service.currServiceInfo({
  444. storeId: this.storeId
  445. }).then(res => {
  446. console.log(res.data.data)
  447. this.currService = res.data.data
  448. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  449. let serviceFee = 0
  450. res.data.data.childList.forEach(item=>{
  451. serviceFee += item.serviceFee *1
  452. })
  453. this.currService.serviceFee = serviceFee.toFixed(2)
  454. })
  455. },
  456. getUserInfo() {
  457. this.$api.user.getUserInfo().then(res => {
  458. this.userInfo = res.data.data.user
  459. uni.setStorageSync('userInfo', this.userInfo )
  460. })
  461. },
  462. userScanCode() {
  463. let that = this
  464. uni.navigateTo({
  465. url: '/pages/scanCode/scanCode',
  466. events: {
  467. getScancode: function(data) {
  468. that.storeId = JSON.parse(data).storeId
  469. that.storeName = JSON.parse(data).storeName
  470. uni.setStorageSync('storeId', that.storeId)
  471. uni.setStorageSync('storeName', that.storeName)
  472. console.log('++++++++++getScancode+++++++++++++',that.storeId,that.storeName)
  473. uni.getLocation({
  474. type: 'gcj02',
  475. success: (e) => {
  476. console.log('++++++++++getLocation++success+++++++++++',e.longitude,e.latitude)
  477. let param ={
  478. storeId:that.storeId,
  479. longitude:e.longitude,
  480. latitude:e.latitude
  481. }
  482. that.qqMap.reverseGeocoder({
  483. location: {
  484. latitude: e.latitude,
  485. longitude: e.longitude
  486. },
  487. success: function(res1){
  488. console.log('+++++++++++++++++地址信息++++++++++++++++++++++++',res1)
  489. }
  490. })
  491. that.$api.service.clockIn(param).then(res=>{
  492. that.currServiceInfo()
  493. })
  494. },
  495. fail:(err) =>{
  496. console.log('++++++++++getLocation++fail+++++++++++',err)
  497. }
  498. })
  499. },
  500. }
  501. })
  502. },
  503. clickTab(e) {
  504. this.tabIndex = e
  505. if (e === 0) {
  506. this.currServiceInfo()
  507. }
  508. },
  509. }
  510. }
  511. </script>
  512. <style lang="scss" scoped>
  513. @import './index.rpx.css';
  514. </style>