index.vue 18 KB

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