1
0

index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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.isSettle == 0" @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. <u-icon name="/static/index/jiaojieban.png" size="40"></u-icon>
  116. <text class="grid-text">服务交接</text>
  117. </view>
  118. <view @click="addService">
  119. <u-icon name="/static/index/jiandao.png" size="40"></u-icon>
  120. <text class="grid-text">添加服务</text>
  121. </view>
  122. <view @click="next">
  123. <u-icon name="/static/index/xiayige.png" size="40"></u-icon>
  124. <text class="grid-text">下一位</text>
  125. </view>
  126. <view @click="takePlace">
  127. <u-icon name="/static/index/yijiuwei.png" size="40"></u-icon>
  128. <text class="grid-text">已就位</text>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="flex-row justify-center start" @click="start" v-if="currService.status == 1">
  133. <text>开始服务</text>
  134. </view>
  135. <view class="flex-row justify-center start" @click="end" v-if="currService.status == 6">
  136. <text>结束服务</text>
  137. </view>
  138. </view>
  139. <view class="flex-col" :style="{'height':sysHeight}" v-else>
  140. <view class="flex-row justify-center">
  141. <image class="dataNull" src="/static/index/dataNull.png"></image>
  142. </view>
  143. <view class="flex-row justify-center dataNullText">
  144. <text>暂无服务项目</text>
  145. </view>
  146. </view>
  147. </view>
  148. <view v-if="tabIndex === 1" :style="{'height':sysHeight}">
  149. <mescroll-item :i="0" :index="0" :height="sysHeight">
  150. </mescroll-item>
  151. </view>
  152. <uni-popup ref="addServicePopup" @change="popupChange" type="bottom">
  153. <view class="addService">
  154. <view class="popupTitle">
  155. <text>添加服务项目</text>
  156. </view>
  157. <scroll-view class="scrollY" scroll-y>
  158. <view class="serviceItem" :class="{'vBackGround': serviceProjectListIndex === index}" v-for="(item,index) in serviceProjectList" :key="index" @click="serviceProjectListIndex = index">
  159. <view class="serviceName">
  160. <text>{{item.serviceName}}</text>
  161. </view>
  162. <view class="flex-row servicePrice">
  163. <u-icon name="rmb-circle" color="#666666"></u-icon>
  164. <text class="servicePriceKey">预约费用:</text>
  165. <text class="servicePricePrice">¥{{item.standardPrice}}</text>
  166. </view>
  167. <image v-if="serviceProjectListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  168. </view>
  169. </scroll-view>
  170. <view class="flex-row justify-around">
  171. <view class="cancelButton" @click="closeAddServicePopup">
  172. <text>取消</text>
  173. </view>
  174. <view class="confirmButton" @click="addServiceProject">
  175. <text>确定</text>
  176. </view>
  177. </view>
  178. </view>
  179. </uni-popup>
  180. <uni-popup ref="connectPopup" @change="popupChange" type="bottom">
  181. <view class="addService">
  182. <view class="popupTitle">
  183. <text>选择交接人员</text>
  184. </view>
  185. <scroll-view class="scrollY" scroll-y>
  186. <view class="flex-row teachItem" :class="{'vBackGround': servicePersonListIndex === index}" v-for="(item,index) in servicePersonList" :key="index" @click="servicePersonListIndex = index">
  187. <image class="teachImage" src="/static/index/dataNull.png"></image>
  188. <view class="flex-col teachMsg ">
  189. <view class="flex-row">
  190. <text class="techName">{{item.personName}}</text>
  191. <view v-if="i<2" class="teachTag" v-for="(iter,i) in item.postList" :key="i">
  192. <text>{{iter.levelName}}</text>
  193. </view>
  194. </view>
  195. <text class="declaration">优质服务,从我做起</text>
  196. </view>
  197. <image v-if="servicePersonListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  198. </view>
  199. </scroll-view>
  200. <view class="flex-row justify-around">
  201. <view class="cancelButton" @click="closeConnectPopup">
  202. <text>取消</text>
  203. </view>
  204. <view class="confirmButton" @click="handover">
  205. <text>确定</text>
  206. </view>
  207. </view>
  208. </view>
  209. </uni-popup>
  210. <uni-popup ref="selectServiceObjectPopup" @change="popupChange" type="bottom">
  211. <view class="addService">
  212. <view class="popupTitle">
  213. <text>切换服务对象</text>
  214. </view>
  215. <scroll-view class="scrollY" scroll-y>
  216. <view class="flex-row objectItem" :class="{'vBackGround': selectServiceObjectIndex === index}" v-for="(item,index) in selectServiceObjectList" :key="index" @click="selectServiceObjectIndex = index">
  217. <image class="objectImage" :src="item.facePhoto || '/static/index/dataNull.png'"></image>
  218. <view class="flex-col objectName ">
  219. <text>{{item.nickName}}</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="closeSelectServiceObjectPopup">
  226. <text>取消</text>
  227. </view>
  228. <view class="confirmButton" @click="switchServiceObject">
  229. <text>确定</text>
  230. </view>
  231. </view>
  232. </view>
  233. </uni-popup>
  234. </view>
  235. </template>
  236. <script>
  237. import MescrollItem from "./module/mescrollUni-item.vue";
  238. import QQMapWX from '../../common/js/qqmap/myqqmap-sdk.js'
  239. export default {
  240. components: {
  241. MescrollItem
  242. },
  243. data() {
  244. return {
  245. selectServiceObjectList:[],
  246. selectServiceObjectIndex:-1,
  247. servicePersonList:[],
  248. servicePersonListIndex:-1,
  249. serviceProjectList:[],
  250. serviceProjectListIndex:-1,
  251. tabIndex: 0,
  252. sysHeight: '',
  253. readerHeight: '',
  254. readerWidth: '',
  255. userInfo: {},
  256. storeId: '1710635498257108993',
  257. storeName: '娇骄儿白云店',
  258. currService: null,
  259. qqMap:new QQMapWX({key: 'ZIABZ-543WB-747UM-JL5Y7-NDS4E-HWB4M',vm: this})
  260. }
  261. },
  262. onLoad() {
  263. let sysInfo = uni.getSystemInfoSync()
  264. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  265. this.readerHeight = sysInfo.windowHeight + 'px'
  266. this.readerWidth = sysInfo.windowWidth + 'px'
  267. this.storeId = uni.getStorageSync('storeId')
  268. this.storeName = uni.getStorageSync('storeName')
  269. this.getUserInfo()
  270. // this.currServiceInfo()
  271. },
  272. onShow() {
  273. },
  274. methods: {
  275. openSelectServiceObjectPopup(){
  276. this.$api.service.getServiceObjectList({
  277. orderServiceId:this.currService.orderServiceId,
  278. }).then(res=>{
  279. this.selectServiceObjectList= res.data.data
  280. uni.hideTabBar()
  281. this.$refs.selectServiceObjectPopup.open()
  282. })
  283. },
  284. closeSelectServiceObjectPopup(){
  285. this.serviceProjectListIndex = -1
  286. this.$refs.selectServiceObjectPopup.close()
  287. },
  288. switchServiceObject(){
  289. if (this.selectServiceObjectIndex === -1){
  290. uni.showToast({
  291. icon: 'none',
  292. duration: 2000,
  293. title: '请选择服务对象'
  294. });
  295. return
  296. }
  297. this.$api.service.switchServiceObject({
  298. orderServiceId:this.currService.orderServiceId,
  299. serviceObjectId:this.selectServiceObjectList[this.selectServiceObjectIndex].id
  300. }).then(res=>{
  301. this.currServiceInfo()
  302. this.closeSelectServiceObjectPopup()
  303. })
  304. },
  305. addService() {
  306. this.$api.service.serviceProjectList().then(res=>{
  307. this.serviceProjectList= res.data.data
  308. uni.hideTabBar()
  309. this.$refs.addServicePopup.open()
  310. })
  311. },
  312. closeAddServicePopup(){
  313. this.serviceProjectListIndex = -1
  314. this.$refs.addServicePopup.close()
  315. },
  316. addServiceProject(){
  317. if (this.serviceProjectListIndex === -1){
  318. uni.showToast({
  319. icon: 'none',
  320. duration: 2000,
  321. title: '请选择服务项目'
  322. });
  323. return
  324. }
  325. this.$api.service.addServiceProject(
  326. {
  327. orderServiceId:this.currService.orderServiceId,
  328. serviceProjectId:this.serviceProjectList[this.serviceProjectListIndex].id
  329. }
  330. ).then(res=>{
  331. uni.showToast({
  332. icon: 'none',
  333. duration: 2000,
  334. title: '添加成功'
  335. });
  336. this.currServiceInfo()
  337. this.closeAddServicePopup()
  338. })
  339. },
  340. popupChange(e) {
  341. if (!e.show) {
  342. uni.showTabBar()
  343. }
  344. },
  345. connect() {
  346. this.$api.service.getServicePerson({storeId:this.storeId}).then((res) => {
  347. this.servicePersonList = res.data.data;
  348. uni.hideTabBar()
  349. this.$refs.connectPopup.open()
  350. })
  351. },
  352. closeConnectPopup(){
  353. this.servicePersonListIndex = -1
  354. this.$refs.connectPopup.close()
  355. },
  356. handover(){
  357. if (this.servicePersonListIndex === -1){
  358. uni.showToast({
  359. icon: 'none',
  360. duration: 2000,
  361. title: '请选择服务技师'
  362. });
  363. return
  364. }
  365. this.$api.service.handover({
  366. orderServiceId:this.currService.orderServiceId,
  367. serviceUserId:this.servicePersonList[this.servicePersonListIndex].personId
  368. }).then(res=>{
  369. this.closeConnectPopup()
  370. this.closeAddServicePopup()
  371. })
  372. },
  373. takePlace() {
  374. this.$api.service.takePlace({
  375. orderServiceId: this.currService.orderServiceId
  376. }).then(res => {
  377. this.currServiceInfo()
  378. })
  379. },
  380. settle() {
  381. this.$api.service.settle({
  382. orderServiceId: this.currService.orderServiceId
  383. }).then(res => {
  384. this.currServiceInfo()
  385. })
  386. },
  387. start() {
  388. this.$api.service.start({
  389. orderServiceId: this.currService.orderServiceId
  390. }).then(res => {
  391. this.currServiceInfo()
  392. })
  393. },
  394. end() {
  395. this.$api.service.end({
  396. orderServiceId: this.currService.orderServiceId
  397. }).then(res => {
  398. this.currServiceInfo()
  399. })
  400. },
  401. next() {
  402. this.$api.service.next({
  403. orderServiceId: this.currService.orderServiceId
  404. }).then(res => {
  405. this.currServiceInfo()
  406. })
  407. },
  408. currServiceInfo() {
  409. if (this.storeId === '' || this.storeId === null){
  410. return
  411. }
  412. this.$api.service.currServiceInfo({
  413. storeId: this.storeId
  414. }).then(res => {
  415. console.log(res.data.data)
  416. this.currService = res.data.data
  417. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  418. let serviceFee = 0
  419. res.data.data.childList.forEach(item=>{
  420. serviceFee += item.serviceFee *1
  421. })
  422. this.currService.serviceFee = serviceFee.toFixed(2)
  423. })
  424. },
  425. getUserInfo() {
  426. this.$api.user.getUserInfo().then(res => {
  427. this.userInfo = res.data.data.user
  428. uni.setStorageSync('userInfo', this.userInfo )
  429. })
  430. },
  431. userScanCode() {
  432. let that = this
  433. uni.navigateTo({
  434. url: '/pages/scanCode/scanCode',
  435. events: {
  436. getScancode: function(data) {
  437. that.storeId = JSON.parse(data).storeId
  438. that.storeName = JSON.parse(data).storeName
  439. uni.setStorageSync('storeId', that.storeId)
  440. uni.setStorageSync('storeName', that.storeName)
  441. console.log('++++++++++getScancode+++++++++++++',that.storeId,that.storeName)
  442. uni.getLocation({
  443. type: 'gcj02',
  444. success: (e) => {
  445. console.log('++++++++++getLocation++success+++++++++++',e.longitude,e.latitude)
  446. let param ={
  447. storeId:that.storeId,
  448. longitude:e.longitude,
  449. latitude:e.latitude
  450. }
  451. that.qqMap.reverseGeocoder({
  452. location: {
  453. latitude: e.latitude,
  454. longitude: e.longitude
  455. },
  456. success: function(res1){
  457. console.log('+++++++++++++++++地址信息++++++++++++++++++++++++',res1)
  458. }
  459. })
  460. that.$api.service.clockIn(param).then(res=>{
  461. that.currServiceInfo()
  462. })
  463. },
  464. fail:(err) =>{
  465. console.log('++++++++++getLocation++fail+++++++++++',err)
  466. }
  467. })
  468. },
  469. }
  470. })
  471. },
  472. clickTab(e) {
  473. this.tabIndex = e
  474. if (e === 0) {
  475. this.currServiceInfo()
  476. }
  477. },
  478. }
  479. }
  480. </script>
  481. <style lang="scss" scoped>
  482. @import './index.rpx.css';
  483. </style>