index.vue 25 KB

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