index.vue 25 KB

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