index.vue 25 KB

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