index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  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.avatarUrl || '/static/ud4.png'"></image>
  6. <view class="tuniMsg">
  7. <view class="name ">
  8. <text>{{userInfo.name}}</text>
  9. </view>
  10. <view>
  11. <text class="biaoqian ">{{userInfo.post}}</text>
  12. </view>
  13. </view>
  14. <view class="flex-row justify-around tuni-right ">
  15. <view class="flex-col">
  16. <view class="flex-row justify-center dakaIcon ">
  17. <text>{{userInfo.subNumber}}</text>
  18. </view>
  19. <view class="flex-row justify-center dakaText ">
  20. <text>今日预约</text>
  21. </view>
  22. </view>
  23. <view class="flex-col" @click="promotion">
  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 && currService.callState == '2'">-->
  43. <!-- <text>叫号</text>-->
  44. <!-- </view>-->
  45. <view class="buttonItem" :class="{buttonState:buttonState[0]}" @click="next">
  46. <text>下一位</text>
  47. </view>
  48. <view class="buttonItem" :class="{buttonState:buttonState[1]}" @click="takePlace">
  49. <text>已就位</text>
  50. </view>
  51. <view class="buttonItem" :class="{buttonState:buttonState[2]}" @click="settle">
  52. <text>结算</text>
  53. </view>
  54. <view class="buttonItem" :class="{buttonState:buttonState[3]}" @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/ud4.png'" @click="avatarOpen">
  62. </image>
  63. <view class="flex-col justify-end serviceInfo-rigth ">
  64. <view class="flex-row justify-between ">
  65. <view class="">
  66. <view class="flex-row">
  67. <text class="servicename">{{currService.serviceObjectName}}</text>
  68. <text v-if="currService.isVip" class="biaoqian">会员客户</text>
  69. <text v-else class="biaoqian">现金客户</text>
  70. </view>
  71. <view class="">
  72. <text class="servicename">{{currService.no}}</text>
  73. </view>
  74. </view>
  75. <view class="flex-col justify-center ">
  76. <view class="flex-row justify-center tag" @click="openSelectServiceObjectPopup">
  77. <text>切换</text>
  78. <u-icon name="/static/index/qiehuan.png" size="18"></u-icon>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view :style="{'height':'120rpx'}"></view>
  85. <view class="flex-row justify-center" v-if="!currService.balanceFlag">
  86. <view class="flex-row justify-center hintView">
  87. <view class="hint">
  88. <text>!</text>
  89. </view>
  90. <view class="hintCentent">
  91. <text>娇宝余额不足哟~</text>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="flex-row justify-center" v-if="currService.balanceFlag && currService.balance *1 <= 200">
  96. <view class="flex-row justify-center hintView" :class="{hintViewBgColor2: currService.balance *1 <= 100,
  97. hintViewBgColor3: currService.balance *1 > 100 && currService.balance *1 <= 200}">
  98. <view class="hint">
  99. <text>!</text>
  100. </view>
  101. <view class="hintCentent">
  102. <text>娇宝余额充足~</text>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="flex-col orderMsg">
  107. <view class="flex-row justify-between">
  108. <view class="flex-row">
  109. <u-icon name="/static/index/quhao.png" size="20"></u-icon>
  110. <text class="key">排号:</text>
  111. <text class="value">{{currService.planNumber}}</text>
  112. </view>
  113. <view class="flex-col justify-center stateStr">
  114. <text>{{currService.statusDesc}}</text>
  115. </view>
  116. </view>
  117. <view class="flex-row">
  118. <u-icon name="/static/index/orderNo1.png" size="20"></u-icon>
  119. <text class="key">订单编号:</text>
  120. <text class="value">{{currService.orderNo}}</text>
  121. </view>
  122. <view class="flex-row">
  123. <u-icon name="/static/index/jiandao.png" size="20"></u-icon>
  124. <text class="key">服务项目:</text>
  125. <text class="value">{{currService.serviceProject}}</text>
  126. </view>
  127. <view class="flex-row">
  128. <u-icon name="/static/index/tel.png" size="18"></u-icon>
  129. <text class="key">手机尾号:</text>
  130. <text class="value">{{currService.phone.substring(7,11)}}</text>
  131. </view>
  132. <view class="flex-row" >
  133. <u-icon name="/static/index/quanyika.png" size="16"></u-icon>
  134. <text class="key">权益卡:</text>
  135. <template v-if="currService.cardList && currService.cardList.length">
  136. <text class="biaoqian" v-for="(card,index) in currService.cardList" :key="index">{{card.title}}</text>
  137. </template>
  138. <text class="value" v-else>无</text>
  139. </view>
  140. </view>
  141. <view class="flex-row justify-center">
  142. <view class="imgs">
  143. <view class="mmImgView" :class="{floatRight: (index+1) % 2==0,marginTop:index>1}"
  144. v-for="(i,index) in 0" :key="index">
  145. <image class="mmImg" mode="widthFix" src="/static/mn1.webp"></image>
  146. </view>
  147. </view>
  148. </view>
  149. <view class="flex-row justify-center" v-if="currService.status!==12">
  150. <view class="like">
  151. <text>{{currService.preference || '暂无'}}</text>
  152. </view>
  153. </view>
  154. </view>
  155. <view class="flex-col" :style="{'height':sysHeight}" v-else>
  156. <view class="flex-row justify-center">
  157. <image class="dataNull" src="/static/index/dataNull.png"></image>
  158. </view>
  159. <view class="flex-row justify-center dataNullText">
  160. <text>暂无服务项目,请点击下一位刷新页面</text>
  161. </view>
  162. </view>
  163. </view>
  164. <uni-popup ref="avatarPopup" type="center">
  165. <view class="avatarView " v-if="currService">
  166. <view class="flex-row justify-center">
  167. <image class="avatarOpen" mode="widthFix" :src="currService.avatar || '/static/ud4.png'"></image>
  168. </view>
  169. <view class="flex-row justify-center" :style="{'marginTop':'20rpx'}">
  170. <text>服务对象:{{currService.serviceObjectName}}</text>
  171. </view>
  172. </view>
  173. </uni-popup>
  174. <uni-popup ref="reminderPopup" type="center">
  175. <view class="reminderView ">
  176. <view class="reminderTitle">
  177. <text>保存用户喜好</text>
  178. </view>
  179. <view class="textareaView flex-row justify-center">
  180. <textarea class="textarea" v-model="content" placeholder-style="color:#999999;fontSize:28rpx"
  181. placeholder="请输入用户喜好" />
  182. </view>
  183. <view class="flex-row justify-around " :style="{'marginTop':'20rpx'}">
  184. <view class="cancelButton " @click="closeReminderPopup">
  185. <text>取消</text>
  186. </view>
  187. <view class="confirmButton " @click="preference">
  188. <text>确定</text>
  189. </view>
  190. </view>
  191. </view>
  192. </uni-popup>
  193. <uni-popup ref="addServicePopup" @change="popupChange" type="bottom">
  194. <view class="addService">
  195. <scroll-view class="scrollY1 " scroll-y>
  196. <view class="flex-col">
  197. <view class="popupTitle">
  198. <text>选择服务项目</text>
  199. </view>
  200. <view class="flex-row justify-center">
  201. <view class="serviceItems ">
  202. <view class="serviceItem "
  203. :class="{vBackGround: serviceProjectListIndex === index,marginLeft16: (index+3) % 3!==0,marginTop24:index>2}"
  204. v-for="(item,index) in serviceProjectList" :key="index"
  205. @click="selectProject(item,index)">
  206. <text>{{item.serviceName}}</text>
  207. </view>
  208. </view>
  209. </view>
  210. <view class="popupTitle marginTop24">
  211. <text>选择服务技师</text>
  212. </view>
  213. <view class="flex-row justify-center">
  214. <view class="serviceItems ">
  215. <view class="flex-col serviceTeach "
  216. :class="{marginLeft28: (index+4) % 4!==0,marginTop24:index>3}"
  217. v-for="(item,index) in servicePersonList" :key="index"
  218. @click="servicePersonListIndex = index">
  219. <image class="serviceTeachImg" :src="item.facePhotoUrl ||'/static/ud4.png'"
  220. :class="{vBackGround: servicePersonListIndex === index}"></image>
  221. <view class="serviceTeachName">
  222. <text>{{item.personName}}</text>
  223. </view>
  224. <image v-if="servicePersonListIndex === index" class="vImage"
  225. src="/static/index/xuanzhong.png"></image>
  226. </view>
  227. </view>
  228. </view>
  229. </view>
  230. </scroll-view>
  231. <view class="flex-row justify-around">
  232. <view class="cancelButton " @click="closeAddServicePopup">
  233. <text>取消</text>
  234. </view>
  235. <view class="confirmButton" @click="addServiceProject">
  236. <text>确定</text>
  237. </view>
  238. </view>
  239. </view>
  240. </uni-popup>
  241. <uni-popup ref="selectServiceObjectPopup" @change="popupChange" type="bottom">
  242. <view class="addService">
  243. <view class="popupTitle">
  244. <text>切换服务对象</text>
  245. </view>
  246. <scroll-view class="scrollY" scroll-y>
  247. <view class="flex-row objectItem" :class="{'vBackGround': selectServiceObjectIndex === index}"
  248. v-for="(item,index) in selectServiceObjectList" :key="index"
  249. @click="selectServiceObjectIndex = index">
  250. <image class="objectImage" :src="item.facePhotoUrl || '/static/ud4.png'"></image>
  251. <view class="flex-col objectName ">
  252. <text>{{item.nickName}}</text>
  253. </view>
  254. <image v-if="selectServiceObjectIndex === index" class="vImage"
  255. src="/static/index/xuanzhong.png"></image>
  256. </view>
  257. </scroll-view>
  258. <view class="flex-row justify-around">
  259. <view class="cancelButton" @click="closeSelectServiceObjectPopup">
  260. <text>取消</text>
  261. </view>
  262. <view class="confirmButton" @click="switchServiceObject">
  263. <text>确定</text>
  264. </view>
  265. </view>
  266. </view>
  267. </uni-popup>
  268. <uni-popup ref="promotionPopup" type="center">
  269. <view class="promotionView">
  270. <view class="flex-row justify-center qrcodeView">
  271. <uv-qrcode ref="qrcode" size="400rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  272. </view>
  273. <view class="flex-row justify-center">
  274. <text>娇骄儿造型</text>
  275. </view>
  276. </view>
  277. </uni-popup>
  278. </view>
  279. </template>
  280. <script>
  281. import MescrollItem from "./module/mescrollUni-item.vue";
  282. import QQMapWX from '../../common/js/qqmap/myqqmap-sdk.js'
  283. export default {
  284. components: {
  285. MescrollItem
  286. },
  287. data() {
  288. return {
  289. buttonState: [0, 0, 0, 0], //0:不禁用按钮,1:禁用按钮。
  290. previousServiceOrderId: '',
  291. content: '',
  292. selectServiceObjectList: [],
  293. selectServiceObjectIndex: -1,
  294. servicePersonList: [],
  295. servicePersonListIndex: 0,
  296. serviceProjectList: [],
  297. serviceProjectListIndex: 0,
  298. tabIndex: 0,
  299. sysHeight: '',
  300. readerHeight: '',
  301. readerWidth: '',
  302. userInfo: {},
  303. storeId: '',
  304. storeName: '',
  305. currService: null,
  306. qqMap: new QQMapWX({
  307. key: 'ZIABZ-543WB-747UM-JL5Y7-NDS4E-HWB4M',
  308. vm: this
  309. }),
  310. qrcodeUrl: 'https://jje.admin.xinyuekj.com.cn/recharge/recharge?storeId={promotionStoreId}&techNo={techNo}',
  311. options: {
  312. // 指定二维码前景,一般可在中间放logo
  313. foregroundImagePadding: 2,
  314. foregroundImageBorderRadius: 5,
  315. foregroundImageSrc: '/static/logo.png'
  316. }
  317. }
  318. },
  319. onLoad() {
  320. let sysInfo = uni.getSystemInfoSync()
  321. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  322. this.readerHeight = sysInfo.windowHeight + 'px'
  323. this.readerWidth = sysInfo.windowWidth + 'px'
  324. },
  325. onShow() {
  326. this.getUserInfo()
  327. // this.userInfo = uni.getStorageSync('userInfo')
  328. // if (this.userInfo.signIn){
  329. // this.currServiceInfo()
  330. // }
  331. },
  332. methods: {
  333. avatarOpen() {
  334. this.$refs.avatarPopup.open()
  335. },
  336. promotion() {
  337. let data = {
  338. promotionStoreId: this.userInfo.workStoreId || '',
  339. techNo: this.userInfo.techNo || ''
  340. };
  341. for (let key in data) {
  342. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  343. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  344. }
  345. console.log('++++qrcodeUrl+++++', this.qrcodeUrl)
  346. this.$refs.promotionPopup.open()
  347. },
  348. closeReminderPopup() {
  349. this.previousServiceOrderId = ''
  350. this.$refs.reminderPopup.close()
  351. },
  352. openSelectServiceObjectPopup() {
  353. this.$api.service.getServiceObjectList({
  354. orderServiceId: this.currService.orderServiceId,
  355. }).then(res => {
  356. this.selectServiceObjectList = res.data.data
  357. this.getServiceObjectUrl(this.selectServiceObjectList)
  358. uni.hideTabBar()
  359. this.$refs.selectServiceObjectPopup.open()
  360. })
  361. },
  362. // 获取图片
  363. getServiceObjectUrl(items) {
  364. for (let i = 0; i < items.length; i++) {
  365. let ptoto = items[i].facePhoto || items[i].personPhoto
  366. if (ptoto) {
  367. this.$api.service.getImgUrlByOssId({
  368. ossId: ptoto
  369. }).then(res => {
  370. items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  371. this.$forceUpdate()
  372. })
  373. }
  374. }
  375. },
  376. closeSelectServiceObjectPopup() {
  377. this.serviceProjectListIndex = -1
  378. this.$refs.selectServiceObjectPopup.close()
  379. },
  380. switchServiceObject() {
  381. if (this.selectServiceObjectIndex === -1) {
  382. uni.showToast({
  383. icon: 'none',
  384. duration: 2000,
  385. title: '请选择服务对象'
  386. });
  387. return
  388. }
  389. this.$api.service.switchServiceObject({
  390. orderServiceId: this.currService.orderServiceId,
  391. serviceObjectId: this.selectServiceObjectList[this.selectServiceObjectIndex].id
  392. }).then(res => {
  393. this.currServiceInfo()
  394. this.closeSelectServiceObjectPopup()
  395. })
  396. },
  397. addService() {
  398. if (!this.currService) {
  399. uni.showToast({
  400. icon: 'error',
  401. duration: 2000,
  402. title: '没有服务对象'
  403. });
  404. return
  405. }
  406. this.serviceProjectListIndex = 0
  407. this.$api.service.serviceProjectList().then(res => {
  408. this.serviceProjectList = res.data.data
  409. this.serviceUserList(res.data.data[0])
  410. uni.hideTabBar()
  411. this.$refs.addServicePopup.open()
  412. })
  413. },
  414. selectProject(item, index) {
  415. this.serviceProjectListIndex = index
  416. this.serviceUserList(item)
  417. },
  418. serviceUserList(item) {
  419. this.$api.service.serviceUserList({
  420. serviceProjectId: item.id,
  421. storeId: this.storeId
  422. }).then(res => {
  423. this.servicePersonListIndex = 0
  424. this.servicePersonList = res.data.data
  425. this.getServiceObjectUrl(this.servicePersonList)
  426. })
  427. },
  428. closeAddServicePopup() {
  429. this.serviceProjectListIndex = 0
  430. this.$refs.addServicePopup.close()
  431. },
  432. addServiceProject() {
  433. this.previousServiceOrderId = this.currService.serviceObjectId
  434. this.$api.service.addServiceProject({
  435. orderServiceId: this.currService.orderServiceId,
  436. serviceProjectId: this.serviceProjectList[this.serviceProjectListIndex].id,
  437. serviceUserId: this.servicePersonList[this.servicePersonListIndex].personId
  438. }).then(res => {
  439. this.closeAddServicePopup()
  440. this.currServiceInfo()
  441. this.$refs.reminderPopup.open()
  442. })
  443. },
  444. popupChange(e) {
  445. if (!e.show) {
  446. uni.showTabBar()
  447. }
  448. },
  449. takePlace() {
  450. if (!this.currService) {
  451. uni.showToast({
  452. icon: 'error',
  453. duration: 2000,
  454. title: '没有服务对象'
  455. });
  456. return
  457. }
  458. this.$api.service.takePlace({
  459. orderServiceId: this.currService.orderServiceId
  460. }).then(res => {
  461. uni.showToast({
  462. icon: 'success',
  463. duration: 2000,
  464. title: '操作成功'
  465. });
  466. this.currServiceInfo()
  467. })
  468. },
  469. preference() {
  470. this.$refs.reminderPopup.close()
  471. this.$api.service.preference({
  472. serviceObjectId: this.previousServiceOrderId,
  473. preference: this.content
  474. }).then(res => {
  475. if (this.currService) {
  476. if (this.currService.serviceObjectId == this.previousServiceOrderId) {
  477. this.currService.preference = this.content
  478. }
  479. }
  480. this.previousServiceOrderId = ''
  481. this.content = ''
  482. uni.showToast({
  483. icon: 'success',
  484. duration: 2000,
  485. title: '保存成功'
  486. });
  487. })
  488. },
  489. settle() {
  490. let that = this
  491. if (!that.currService) {
  492. uni.showToast({
  493. icon: 'error',
  494. duration: 2000,
  495. title: '没有服务对象'
  496. });
  497. return
  498. }
  499. uni.showModal({
  500. title: '温馨提示',
  501. content: '是否确定结算',
  502. editable: false,
  503. success: (e) => {
  504. console.log(e)
  505. if (e.confirm) {
  506. that.previousServiceOrderId = that.currService.serviceObjectId
  507. uni.showLoading({
  508. title: '结算中...'
  509. });
  510. that.$api.service.settle({
  511. orderServiceId: that.currService.orderServiceId
  512. }).then(res => {
  513. uni.hideLoading();
  514. that.currServiceInfo()
  515. that.$refs.reminderPopup.open()
  516. }).catch(err => {
  517. uni.hideLoading();
  518. })
  519. }
  520. }
  521. })
  522. },
  523. start() {
  524. this.$api.service.start({
  525. orderServiceId: this.currService.orderServiceId
  526. }).then(res => {
  527. this.currServiceInfo()
  528. })
  529. },
  530. end() {
  531. this.$api.service.end({
  532. orderServiceId: this.currService.orderServiceId
  533. }).then(res => {
  534. this.currServiceInfo()
  535. })
  536. },
  537. call() {
  538. this.$api.service.call({
  539. orderServiceId: this.currService.orderServiceId
  540. }).then(res => {
  541. this.currServiceInfo()
  542. })
  543. },
  544. next() {
  545. if (!this.userInfo.signIn) {
  546. uni.showToast({
  547. icon: 'error',
  548. duration: 2000,
  549. title: '请先扫码签到'
  550. });
  551. return
  552. }
  553. uni.showModal({
  554. title: '温馨提示',
  555. content: '是否确定下一位',
  556. editable: false,
  557. success: (e) => {
  558. if (e.confirm) {
  559. console.log(e.confirm)
  560. uni.showLoading({
  561. title: '叫号中...'
  562. });
  563. this.$api.service.next({
  564. orderServiceId: this.currService ? this.currService.orderServiceId :
  565. null,
  566. storeId: this.storeId
  567. }).then(res => {
  568. this.currServiceInfo(true)
  569. }).catch(err => {
  570. uni.hideLoading();
  571. })
  572. }
  573. }
  574. })
  575. },
  576. currServiceInfo(e) {
  577. if (!this.userInfo.signIn) {
  578. uni.showToast({
  579. icon: 'error',
  580. duration: 2000,
  581. title: '请先扫码签到'
  582. });
  583. return
  584. }
  585. uni.showLoading({
  586. title: '叫号中...'
  587. });
  588. this.$api.service.currServiceInfo({
  589. storeId: this.userInfo.workStoreId
  590. }).then(res => {
  591. if (e) {
  592. if (res.data.data === null) {
  593. uni.showModal({
  594. title: '温馨提示',
  595. content: '暂无需要服务的客户',
  596. editable: false,
  597. showCancel: false,
  598. success: (e) => {
  599. if (e.confirm) {
  600. }
  601. }
  602. })
  603. }
  604. }
  605. uni.hideLoading();
  606. this.currService = res.data.data
  607. console.log('当前服务对象============》', this.currService)
  608. this.setButtomState(this.currService)
  609. if (!this.currService){
  610. return
  611. }
  612. this.equityCard(this.currService)
  613. this.currService.avatar = this.currService.avatar.replace(/^http:/, "https:")
  614. }).catch(err => {
  615. uni.hideLoading();
  616. console.log("出错了+++++++++++出错了+++++++", err)
  617. })
  618. },
  619. //查询是否是有权益卡的服务对象
  620. equityCard(data) {
  621. if (!data || !data.serviceObjectId){
  622. return
  623. }
  624. this.$api.service.equityCard({
  625. serviceObjectId: data.serviceObjectId,
  626. memberId: data.userId,
  627. serviceStoreId:data.serviceStoreId
  628. }).then(res => {
  629. // data.cardList = res.data.data
  630. this.$set(data,'cardList',res.data.data)
  631. })
  632. },
  633. setButtomState(currService) {
  634. if (currService) {
  635. if (currService.status == 12) {
  636. //叫号中
  637. this.buttonState = [0, 0, 1, 1]
  638. } else if (currService.status == 8 || currService.status == 1) {
  639. //服务中
  640. this.buttonState = [1, 1, 0, 0]
  641. }
  642. } else {
  643. this.buttonState = [0, 1, 1, 1]
  644. }
  645. },
  646. getUserInfo() {
  647. this.$api.user.getUserInfo().then(res => {
  648. this.userInfo = res.data.data
  649. this.storeId = res.data.data.workStoreId
  650. uni.setStorageSync('userInfo', this.userInfo)
  651. if (this.userInfo.avatar) {
  652. this.getImgUrlByOssId(this.userInfo.avatar)
  653. }
  654. if (this.userInfo.signIn) {
  655. this.buttonState = [0, 1, 1, 1]
  656. this.currServiceInfo()
  657. }
  658. this.$forceUpdate()
  659. })
  660. },
  661. getImgUrlByOssId(ossId) {
  662. this.$api.service.getImgUrlByOssId({
  663. ossId: ossId
  664. }).then(res => {
  665. this.$set(this.userInfo, 'avatarUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  666. uni.setStorageSync('userInfo', this.userInfo)
  667. })
  668. },
  669. userScanCode() {
  670. let that = this
  671. uni.navigateTo({
  672. url: '/pages/scanCode/scanCode',
  673. events: {
  674. getScancode: function(data) {
  675. let param = {
  676. storeId: JSON.parse(data).storeId,
  677. timestamp: JSON.parse(data).timestamp
  678. }
  679. that.$api.service.clockIn(param).then(res => {
  680. uni.showToast({
  681. icon: 'success',
  682. duration: 2000,
  683. title: '签到成功'
  684. });
  685. uni.setStorageSync('userInfo', that.userInfo)
  686. that.getUserInfo()
  687. })
  688. },
  689. }
  690. })
  691. },
  692. clickTab(e) {
  693. this.tabIndex = e
  694. if (e === 0) {
  695. this.currServiceInfo()
  696. }
  697. },
  698. }
  699. }
  700. </script>
  701. <style lang="scss" scoped>
  702. @import './index.rpx.css';
  703. </style>