index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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 class="flex-row justify-center">
  277. <text>{{codeTime}}</text>
  278. </view>
  279. </view>
  280. </uni-popup>
  281. </view>
  282. </template>
  283. <script>
  284. import MescrollItem from "./module/mescrollUni-item.vue";
  285. import QQMapWX from '../../common/js/qqmap/myqqmap-sdk.js'
  286. import {date} from "../../uni_modules/uv-ui-tools/libs/function/test";
  287. export default {
  288. components: {
  289. MescrollItem
  290. },
  291. data() {
  292. return {
  293. buttonState: [0, 0, 0, 0], //0:不禁用按钮,1:禁用按钮。
  294. previousServiceOrderId: '',
  295. content: '',
  296. selectServiceObjectList: [],
  297. selectServiceObjectIndex: -1,
  298. servicePersonList: [],
  299. servicePersonListIndex: 0,
  300. serviceProjectList: [],
  301. serviceProjectListIndex: 0,
  302. tabIndex: 0,
  303. sysHeight: '',
  304. readerHeight: '',
  305. readerWidth: '',
  306. userInfo: {},
  307. storeId: '',
  308. storeName: '',
  309. currService: null,
  310. qqMap: new QQMapWX({
  311. key: 'ZIABZ-543WB-747UM-JL5Y7-NDS4E-HWB4M',
  312. vm: this
  313. }),
  314. qrcodeUrl: 'https://jje.admin.xinyuekj.com.cn/recharge/recharge?storeId={promotionStoreId}&techNo={techNo}',
  315. options: {
  316. // 指定二维码前景,一般可在中间放logo
  317. foregroundImagePadding: 2,
  318. foregroundImageBorderRadius: 5,
  319. foregroundImageSrc: '/static/logo.png'
  320. },
  321. codeTime:null,
  322. }
  323. },
  324. onLoad() {
  325. let sysInfo = uni.getSystemInfoSync()
  326. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  327. this.readerHeight = sysInfo.windowHeight + 'px'
  328. this.readerWidth = sysInfo.windowWidth + 'px'
  329. },
  330. onShow() {
  331. this.getUserInfo()
  332. // this.userInfo = uni.getStorageSync('userInfo')
  333. // if (this.userInfo.signIn){
  334. // this.currServiceInfo()
  335. // }
  336. },
  337. methods: {
  338. avatarOpen() {
  339. this.$refs.avatarPopup.open()
  340. },
  341. promotion() {
  342. console.log('------',this.userInfo)
  343. if(!this.userInfo.workStoreId || !this.userInfo.techNo){
  344. uni.showToast({
  345. icon: 'error',
  346. duration: 2000,
  347. title: '请刷新页面重试'
  348. });
  349. return
  350. }
  351. let date = new Date();
  352. this.codeTime = date.toLocaleString();
  353. let data = {
  354. promotionStoreId: this.userInfo.workStoreId ,
  355. techNo: this.userInfo.techNo
  356. };
  357. for (let key in data) {
  358. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  359. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  360. }
  361. console.log('++++qrcodeUrl+++++', this.qrcodeUrl)
  362. this.$refs.promotionPopup.open()
  363. },
  364. closeReminderPopup() {
  365. this.previousServiceOrderId = ''
  366. this.$refs.reminderPopup.close()
  367. },
  368. openSelectServiceObjectPopup() {
  369. this.$api.service.getServiceObjectList({
  370. orderServiceId: this.currService.orderServiceId,
  371. }).then(res => {
  372. this.selectServiceObjectList = res.data.data
  373. this.getServiceObjectUrl(this.selectServiceObjectList)
  374. uni.hideTabBar()
  375. this.$refs.selectServiceObjectPopup.open()
  376. })
  377. },
  378. // 获取图片
  379. getServiceObjectUrl(items) {
  380. for (let i = 0; i < items.length; i++) {
  381. let ptoto = items[i].facePhoto || items[i].personPhoto
  382. if (ptoto) {
  383. this.$api.service.getImgUrlByOssId({
  384. ossId: ptoto
  385. }).then(res => {
  386. items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  387. this.$forceUpdate()
  388. })
  389. }
  390. }
  391. },
  392. closeSelectServiceObjectPopup() {
  393. this.serviceProjectListIndex = -1
  394. this.$refs.selectServiceObjectPopup.close()
  395. },
  396. switchServiceObject() {
  397. if (this.selectServiceObjectIndex === -1) {
  398. uni.showToast({
  399. icon: 'none',
  400. duration: 2000,
  401. title: '请选择服务对象'
  402. });
  403. return
  404. }
  405. this.$api.service.switchServiceObject({
  406. orderServiceId: this.currService.orderServiceId,
  407. serviceObjectId: this.selectServiceObjectList[this.selectServiceObjectIndex].id
  408. }).then(res => {
  409. this.currServiceInfo()
  410. this.closeSelectServiceObjectPopup()
  411. })
  412. },
  413. addService() {
  414. if (!this.currService) {
  415. uni.showToast({
  416. icon: 'error',
  417. duration: 2000,
  418. title: '没有服务对象'
  419. });
  420. return
  421. }
  422. this.serviceProjectListIndex = 0
  423. this.$api.service.serviceProjectList().then(res => {
  424. this.serviceProjectList = res.data.data
  425. this.serviceUserList(res.data.data[0])
  426. uni.hideTabBar()
  427. this.$refs.addServicePopup.open()
  428. })
  429. },
  430. selectProject(item, index) {
  431. this.serviceProjectListIndex = index
  432. this.serviceUserList(item)
  433. },
  434. serviceUserList(item) {
  435. this.$api.service.serviceUserList({
  436. serviceProjectId: item.id,
  437. storeId: this.storeId
  438. }).then(res => {
  439. this.servicePersonListIndex = 0
  440. this.servicePersonList = res.data.data
  441. this.getServiceObjectUrl(this.servicePersonList)
  442. })
  443. },
  444. closeAddServicePopup() {
  445. this.serviceProjectListIndex = 0
  446. this.$refs.addServicePopup.close()
  447. },
  448. addServiceProject() {
  449. this.previousServiceOrderId = this.currService.serviceObjectId
  450. this.$api.service.addServiceProject({
  451. orderServiceId: this.currService.orderServiceId,
  452. serviceProjectId: this.serviceProjectList[this.serviceProjectListIndex].id,
  453. serviceUserId: this.servicePersonList[this.servicePersonListIndex].personId
  454. }).then(res => {
  455. this.closeAddServicePopup()
  456. this.currServiceInfo()
  457. this.$refs.reminderPopup.open()
  458. })
  459. },
  460. popupChange(e) {
  461. if (!e.show) {
  462. uni.showTabBar()
  463. }
  464. },
  465. takePlace() {
  466. if (!this.currService) {
  467. uni.showToast({
  468. icon: 'error',
  469. duration: 2000,
  470. title: '没有服务对象'
  471. });
  472. return
  473. }
  474. this.$api.service.takePlace({
  475. orderServiceId: this.currService.orderServiceId
  476. }).then(res => {
  477. uni.showToast({
  478. icon: 'success',
  479. duration: 2000,
  480. title: '操作成功'
  481. });
  482. this.currServiceInfo()
  483. })
  484. },
  485. preference() {
  486. this.$refs.reminderPopup.close()
  487. this.$api.service.preference({
  488. serviceObjectId: this.previousServiceOrderId,
  489. preference: this.content
  490. }).then(res => {
  491. if (this.currService) {
  492. if (this.currService.serviceObjectId == this.previousServiceOrderId) {
  493. this.currService.preference = this.content
  494. }
  495. }
  496. this.previousServiceOrderId = ''
  497. this.content = ''
  498. uni.showToast({
  499. icon: 'success',
  500. duration: 2000,
  501. title: '保存成功'
  502. });
  503. })
  504. },
  505. settle() {
  506. let that = this
  507. if (!that.currService) {
  508. uni.showToast({
  509. icon: 'error',
  510. duration: 2000,
  511. title: '没有服务对象'
  512. });
  513. return
  514. }
  515. uni.showModal({
  516. title: '温馨提示',
  517. content: '是否确定结算',
  518. editable: false,
  519. success: (e) => {
  520. console.log(e)
  521. if (e.confirm) {
  522. that.previousServiceOrderId = that.currService.serviceObjectId
  523. uni.showLoading({
  524. title: '结算中...'
  525. });
  526. that.$api.service.settle({
  527. orderServiceId: that.currService.orderServiceId
  528. }).then(res => {
  529. uni.hideLoading();
  530. that.currServiceInfo()
  531. that.$refs.reminderPopup.open()
  532. }).catch(err => {
  533. uni.hideLoading();
  534. })
  535. }
  536. }
  537. })
  538. },
  539. start() {
  540. this.$api.service.start({
  541. orderServiceId: this.currService.orderServiceId
  542. }).then(res => {
  543. this.currServiceInfo()
  544. })
  545. },
  546. end() {
  547. this.$api.service.end({
  548. orderServiceId: this.currService.orderServiceId
  549. }).then(res => {
  550. this.currServiceInfo()
  551. })
  552. },
  553. call() {
  554. this.$api.service.call({
  555. orderServiceId: this.currService.orderServiceId
  556. }).then(res => {
  557. this.currServiceInfo()
  558. })
  559. },
  560. next() {
  561. if (!this.userInfo.signIn) {
  562. uni.showToast({
  563. icon: 'error',
  564. duration: 2000,
  565. title: '请先扫码签到'
  566. });
  567. return
  568. }
  569. uni.showModal({
  570. title: '温馨提示',
  571. content: '是否确定下一位',
  572. editable: false,
  573. success: (e) => {
  574. if (e.confirm) {
  575. console.log(e.confirm)
  576. uni.showLoading({
  577. title: '叫号中...'
  578. });
  579. this.$api.service.next({
  580. orderServiceId: this.currService ? this.currService.orderServiceId :
  581. null,
  582. storeId: this.storeId
  583. }).then(res => {
  584. this.currServiceInfo(true)
  585. }).catch(err => {
  586. uni.hideLoading();
  587. })
  588. }
  589. }
  590. })
  591. },
  592. currServiceInfo(e) {
  593. if (!this.userInfo.signIn) {
  594. uni.showToast({
  595. icon: 'error',
  596. duration: 2000,
  597. title: '请先扫码签到'
  598. });
  599. return
  600. }
  601. uni.showLoading({
  602. title: '叫号中...'
  603. });
  604. this.$api.service.currServiceInfo({
  605. storeId: this.userInfo.workStoreId
  606. }).then(res => {
  607. if (e) {
  608. if (res.data.data === null) {
  609. uni.showModal({
  610. title: '温馨提示',
  611. content: '暂无需要服务的客户',
  612. editable: false,
  613. showCancel: false,
  614. success: (e) => {
  615. if (e.confirm) {
  616. }
  617. }
  618. })
  619. }
  620. }
  621. uni.hideLoading();
  622. this.currService = res.data.data
  623. console.log('当前服务对象============》', this.currService)
  624. this.setButtomState(this.currService)
  625. if (!this.currService){
  626. return
  627. }
  628. this.equityCard(this.currService)
  629. this.currService.avatar = this.currService.avatar.replace(/^http:/, "https:")
  630. }).catch(err => {
  631. uni.hideLoading();
  632. console.log("出错了+++++++++++出错了+++++++", err)
  633. })
  634. },
  635. //查询是否是有权益卡的服务对象
  636. equityCard(data) {
  637. if (!data || !data.serviceObjectId){
  638. return
  639. }
  640. this.$api.service.equityCard({
  641. serviceObjectId: data.serviceObjectId,
  642. memberId: data.userId,
  643. serviceStoreId:data.serviceStoreId
  644. }).then(res => {
  645. // data.cardList = res.data.data
  646. this.$set(data,'cardList',res.data.data)
  647. })
  648. },
  649. setButtomState(currService) {
  650. if (currService) {
  651. if (currService.status == 12) {
  652. //叫号中
  653. this.buttonState = [0, 0, 1, 1]
  654. } else if (currService.status == 8 || currService.status == 1) {
  655. //服务中
  656. this.buttonState = [1, 1, 0, 0]
  657. }
  658. } else {
  659. this.buttonState = [0, 1, 1, 1]
  660. }
  661. },
  662. getUserInfo() {
  663. this.$api.user.getUserInfo().then(res => {
  664. this.userInfo = res.data.data
  665. this.storeId = res.data.data.workStoreId
  666. uni.setStorageSync('userInfo', this.userInfo)
  667. if (this.userInfo.avatar) {
  668. this.getImgUrlByOssId(this.userInfo.avatar)
  669. }
  670. if (this.userInfo.signIn) {
  671. this.buttonState = [0, 1, 1, 1]
  672. this.currServiceInfo()
  673. }
  674. this.$forceUpdate()
  675. })
  676. },
  677. getImgUrlByOssId(ossId) {
  678. this.$api.service.getImgUrlByOssId({
  679. ossId: ossId
  680. }).then(res => {
  681. this.$set(this.userInfo, 'avatarUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  682. uni.setStorageSync('userInfo', this.userInfo)
  683. })
  684. },
  685. userScanCode() {
  686. let that = this
  687. uni.navigateTo({
  688. url: '/pages/scanCode/scanCode',
  689. events: {
  690. getScancode: function(data) {
  691. let param = {
  692. storeId: JSON.parse(data).storeId,
  693. timestamp: JSON.parse(data).timestamp
  694. }
  695. that.$api.service.clockIn(param).then(res => {
  696. uni.showToast({
  697. icon: 'success',
  698. duration: 2000,
  699. title: '签到成功'
  700. });
  701. uni.setStorageSync('userInfo', that.userInfo)
  702. that.getUserInfo()
  703. })
  704. },
  705. }
  706. })
  707. },
  708. clickTab(e) {
  709. this.tabIndex = e
  710. if (e === 0) {
  711. this.currServiceInfo()
  712. }
  713. },
  714. }
  715. }
  716. </script>
  717. <style lang="scss" scoped>
  718. @import './index.rpx.css';
  719. </style>