index.vue 18 KB

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