index.vue 15 KB

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