index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <view class="page">
  3. <uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" title="首页" />
  4. <view class="flex-row tuni ">
  5. <image class="profile" :src="userInfo.avatarUrl || '/static/ud4.png'"></image>
  6. <view class="tuniMsg">
  7. <view class="name ">
  8. <text >{{userInfo.name}}</text>
  9. </view>
  10. <view>
  11. <text class="biaoqian ">{{userInfo.post}}</text>
  12. </view>
  13. </view>
  14. <view class="flex-row justify-around tuni-right ">
  15. <view class="flex-col">
  16. <view class="flex-row justify-center dakaIcon ">
  17. <text>{{userInfo.subNumber}}</text>
  18. </view>
  19. <view class="flex-row justify-center dakaText ">
  20. <text>今日预约</text>
  21. </view>
  22. </view>
  23. <view class="flex-col" @click="promotion">
  24. <view class="flex-row justify-center dakaIcon ">
  25. <u-icon name="/static/index/erweima.png" size="35"></u-icon>
  26. </view>
  27. <view class="flex-row justify-center dakaText " >
  28. <text>拓客码</text>
  29. </view>
  30. </view>
  31. <view class="flex-col " @click="userScanCode">
  32. <view class="flex-row justify-center dakaIcon ">
  33. <u-icon name="/static/index/saoma.png" size="25"></u-icon>
  34. </view>
  35. <view class="flex-row justify-center dakaText ">
  36. <text>报到打卡</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="flex-row justify-around buttons">
  42. <!-- <view class="buttonItem" @click="call" v-if="currService && currService.callState == '2'">-->
  43. <!-- <text>叫号</text>-->
  44. <!-- </view>-->
  45. <view class="buttonItem" :class="{buttonState:buttonState[0]}" @click="next">
  46. <text>下一位</text>
  47. </view>
  48. <view class="buttonItem" :class="{buttonState:buttonState[1]}" @click="takePlace">
  49. <text>已就位</text>
  50. </view>
  51. <view class="buttonItem" :class="{buttonState:buttonState[2]}" @click="settle">
  52. <text>结算</text>
  53. </view>
  54. <view class="buttonItem" :class="{buttonState:buttonState[3]}" @click="addService">
  55. <text>添加服务</text>
  56. </view>
  57. </view>
  58. <view class="flex-row justify-center ">
  59. <view class="serviceMsg " v-if="currService">
  60. <view class="flex-row serviceInfo ">
  61. <image class="serviceProfile" :src="currService.avatar || '/static/ud4.png'" @click="avatarOpen"></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.substring(7,11)}}</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="currService.status!==12">
  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="avatarPopup" type="center">
  143. <view class="avatarView "v-if="currService">
  144. <view class="flex-row justify-center" >
  145. <image class="avatarOpen" mode="widthFix" :src="currService.avatar || '/static/ud4.png'"></image>
  146. </view>
  147. <view class="flex-row justify-center" :style="{'marginTop':'20rpx'}">
  148. <text>服务对象:{{currService.serviceObjectName}}</text>
  149. </view>
  150. </view>
  151. </uni-popup>
  152. <uni-popup ref="reminderPopup" type="center">
  153. <view class="reminderView ">
  154. <view class="reminderTitle">
  155. <text>保存用户喜好</text>
  156. </view>
  157. <view class="textareaView flex-row justify-center ">
  158. <textarea class="textarea" v-model="content" placeholder-style="color:#999999;fontSize:28rpx"
  159. placeholder="请输入用户喜好" />
  160. </view>
  161. <view class="flex-row justify-around" :style="{'marginTop':'20rpx'}">
  162. <view class="cancelButton " @click="closeReminderPopup">
  163. <text>取消</text>
  164. </view>
  165. <view class="confirmButton " @click="preference">
  166. <text>确定</text>
  167. </view>
  168. </view>
  169. </view>
  170. </uni-popup>
  171. <uni-popup ref="addServicePopup" @change="popupChange" type="bottom">
  172. <view class="addService">
  173. <scroll-view class="scrollY1 " scroll-y>
  174. <view class="flex-col">
  175. <view class="popupTitle">
  176. <text>选择服务项目</text>
  177. </view>
  178. <view class="flex-row justify-center">
  179. <view class="serviceItems ">
  180. <view class="serviceItem "
  181. :class="{vBackGround: serviceProjectListIndex === index,marginLeft16: (index+3) % 3!==0,marginTop24:index>2}"
  182. v-for="(item,index) in serviceProjectList" :key="index" @click="selectProject(item,index)">
  183. <text>{{item.serviceName}}</text>
  184. </view>
  185. </view>
  186. </view>
  187. <view class="popupTitle marginTop24">
  188. <text>选择服务技师</text>
  189. </view>
  190. <view class="flex-row justify-center">
  191. <view class="serviceItems ">
  192. <view class="flex-col serviceTeach "
  193. :class="{marginLeft28: (index+4) % 4!==0,marginTop24:index>3}" v-for="(item,index) in servicePersonList" :key="index" @click="servicePersonListIndex = index">
  194. <image class="serviceTeachImg" :src="item.facePhotoUrl ||'/static/ud4.png'" :class="{vBackGround: servicePersonListIndex === index}"></image>
  195. <view class="serviceTeachName">
  196. <text>{{item.personName}}</text>
  197. </view>
  198. <image v-if="servicePersonListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. </scroll-view>
  204. <view class="flex-row justify-around">
  205. <view class="cancelButton " @click="closeAddServicePopup">
  206. <text>取消</text>
  207. </view>
  208. <view class="confirmButton" @click="addServiceProject">
  209. <text>确定</text>
  210. </view>
  211. </view>
  212. </view>
  213. </uni-popup>
  214. <uni-popup ref="selectServiceObjectPopup" @change="popupChange" type="bottom">
  215. <view class="addService" >
  216. <view class="popupTitle">
  217. <text>切换服务对象</text>
  218. </view>
  219. <scroll-view class="scrollY" scroll-y>
  220. <view class="flex-row objectItem" :class="{'vBackGround': selectServiceObjectIndex === index}" v-for="(item,index) in selectServiceObjectList" :key="index" @click="selectServiceObjectIndex = index">
  221. <image class="objectImage" :src="item.facePhotoUrl || '/static/ud4.png'"></image>
  222. <view class="flex-col objectName ">
  223. <text>{{item.nickName}}</text>
  224. </view>
  225. <image v-if="selectServiceObjectIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  226. </view>
  227. </scroll-view>
  228. <view class="flex-row justify-around">
  229. <view class="cancelButton" @click="closeSelectServiceObjectPopup">
  230. <text>取消</text>
  231. </view>
  232. <view class="confirmButton" @click="switchServiceObject">
  233. <text>确定</text>
  234. </view>
  235. </view>
  236. </view>
  237. </uni-popup>
  238. <uni-popup ref="promotionPopup" type="center">
  239. <view class="promotionView" >
  240. <view class="flex-row justify-center qrcodeView">
  241. <uv-qrcode ref="qrcode" size="400rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  242. </view>
  243. <view class="flex-row justify-center">
  244. <text>娇骄儿造型</text>
  245. </view>
  246. </view>
  247. </uni-popup>
  248. </view>
  249. </template>
  250. <script>
  251. import MescrollItem from "./module/mescrollUni-item.vue";
  252. import QQMapWX from '../../common/js/qqmap/myqqmap-sdk.js'
  253. export default {
  254. components: {
  255. MescrollItem
  256. },
  257. data() {
  258. return {
  259. buttonState:[0,0,0,0],//0:不禁用按钮,1:禁用按钮。
  260. previousServiceOrderId:'',
  261. content:'',
  262. selectServiceObjectList:[],
  263. selectServiceObjectIndex:-1,
  264. servicePersonList:[],
  265. servicePersonListIndex:0,
  266. serviceProjectList:[],
  267. serviceProjectListIndex:0,
  268. tabIndex: 0,
  269. sysHeight: '',
  270. readerHeight: '',
  271. readerWidth: '',
  272. userInfo: {},
  273. storeId: '',
  274. storeName: '',
  275. currService: null,
  276. qqMap:new QQMapWX({key: 'ZIABZ-543WB-747UM-JL5Y7-NDS4E-HWB4M',vm: this}),
  277. qrcodeUrl:'https://jje.admin.xinyuekj.com.cn/recharge/recharge?storeId={promotionStoreId}&techNo={techNo}',
  278. options: {
  279. // 指定二维码前景,一般可在中间放logo
  280. foregroundImageSrc: '/static/logo.png'
  281. }
  282. }
  283. },
  284. onLoad() {
  285. let sysInfo = uni.getSystemInfoSync()
  286. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  287. this.readerHeight = sysInfo.windowHeight + 'px'
  288. this.readerWidth = sysInfo.windowWidth + 'px'
  289. },
  290. onShow() {
  291. this.getUserInfo()
  292. // this.userInfo = uni.getStorageSync('userInfo')
  293. // if (this.userInfo.signIn){
  294. // this.currServiceInfo()
  295. // }
  296. },
  297. methods: {
  298. avatarOpen(){
  299. this.$refs.avatarPopup.open()
  300. },
  301. promotion(){
  302. let data = {
  303. promotionStoreId: this.userInfo.workStoreId || '',
  304. techNo: this.userInfo.techNo || ''
  305. };
  306. for (let key in data) {
  307. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  308. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  309. }
  310. console.log('++++qrcodeUrl+++++',this.qrcodeUrl)
  311. this.$refs.promotionPopup.open()
  312. },
  313. closeReminderPopup(){
  314. this.previousServiceOrderId = ''
  315. this.$refs.reminderPopup.close()
  316. },
  317. openSelectServiceObjectPopup(){
  318. this.$api.service.getServiceObjectList({
  319. orderServiceId:this.currService.orderServiceId,
  320. }).then(res=>{
  321. this.selectServiceObjectList= res.data.data
  322. this.getServiceObjectUrl(this.selectServiceObjectList)
  323. uni.hideTabBar()
  324. this.$refs.selectServiceObjectPopup.open()
  325. })
  326. },
  327. // 获取图片
  328. getServiceObjectUrl(items) {
  329. for (let i = 0; i < items.length; i++) {
  330. let ptoto = items[i].facePhoto || items[i].personPhoto
  331. if (ptoto) {
  332. this.$api.service.getImgUrlByOssId({
  333. ossId: ptoto
  334. }).then(res => {
  335. items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  336. this.$forceUpdate()
  337. })
  338. }
  339. }
  340. },
  341. closeSelectServiceObjectPopup(){
  342. this.serviceProjectListIndex = -1
  343. this.$refs.selectServiceObjectPopup.close()
  344. },
  345. switchServiceObject(){
  346. if (this.selectServiceObjectIndex === -1){
  347. uni.showToast({
  348. icon: 'none',
  349. duration: 2000,
  350. title: '请选择服务对象'
  351. });
  352. return
  353. }
  354. this.$api.service.switchServiceObject({
  355. orderServiceId:this.currService.orderServiceId,
  356. serviceObjectId:this.selectServiceObjectList[this.selectServiceObjectIndex].id
  357. }).then(res=>{
  358. this.currServiceInfo()
  359. this.closeSelectServiceObjectPopup()
  360. })
  361. },
  362. addService() {
  363. if (!this.currService){
  364. uni.showToast({
  365. icon: 'error',
  366. duration: 2000,
  367. title: '没有服务对象'
  368. });
  369. return
  370. }
  371. this.serviceProjectListIndex = 0
  372. this.$api.service.serviceProjectList().then(res=>{
  373. this.serviceProjectList= res.data.data
  374. this.serviceUserList(res.data.data[0])
  375. uni.hideTabBar()
  376. this.$refs.addServicePopup.open()
  377. })
  378. },
  379. selectProject(item,index){
  380. this.serviceProjectListIndex = index
  381. this.serviceUserList(item)
  382. },
  383. serviceUserList(item){
  384. this.$api.service.serviceUserList({
  385. serviceProjectId:item.id,
  386. storeId:this.storeId
  387. }).then(res=>{
  388. this.servicePersonListIndex = 0
  389. this.servicePersonList=res.data.data
  390. this.getServiceObjectUrl(this.servicePersonList)
  391. })
  392. },
  393. closeAddServicePopup(){
  394. this.serviceProjectListIndex = 0
  395. this.$refs.addServicePopup.close()
  396. },
  397. addServiceProject(){
  398. this.previousServiceOrderId = this.currService.serviceObjectId
  399. this.$api.service.addServiceProject(
  400. {
  401. orderServiceId:this.currService.orderServiceId,
  402. serviceProjectId:this.serviceProjectList[this.serviceProjectListIndex].id,
  403. serviceUserId:this.servicePersonList[this.servicePersonListIndex].personId
  404. }
  405. ).then(res=>{
  406. this.closeAddServicePopup()
  407. this.currServiceInfo()
  408. this.$refs.reminderPopup.open()
  409. })
  410. },
  411. popupChange(e) {
  412. if (!e.show) {
  413. uni.showTabBar()
  414. }
  415. },
  416. takePlace() {
  417. if (!this.currService){
  418. uni.showToast({
  419. icon: 'error',
  420. duration: 2000,
  421. title: '没有服务对象'
  422. });
  423. return
  424. }
  425. this.$api.service.takePlace({
  426. orderServiceId: this.currService.orderServiceId
  427. }).then(res => {
  428. uni.showToast({
  429. icon: 'success',
  430. duration: 2000,
  431. title: '操作成功'
  432. });
  433. this.currServiceInfo()
  434. })
  435. },
  436. preference(){
  437. this.$refs.reminderPopup.close()
  438. this.$api.service.preference({
  439. serviceObjectId:this.previousServiceOrderId,
  440. preference:this.content
  441. }).then(res=>{
  442. if (this.currService){
  443. if (this.currService.serviceObjectId == this.previousServiceOrderId ){
  444. this.currService.preference = this.content
  445. }
  446. }
  447. this.previousServiceOrderId=''
  448. this.content=''
  449. uni.showToast({
  450. icon: 'success',
  451. duration: 2000,
  452. title: '保存成功'
  453. });
  454. })
  455. },
  456. settle() {
  457. let that = this
  458. if (!that.currService){
  459. uni.showToast({
  460. icon: 'error',
  461. duration: 2000,
  462. title: '没有服务对象'
  463. });
  464. return
  465. }
  466. uni.showModal({
  467. title:'温馨提示',
  468. content:'是否确定结算',
  469. editable:false,
  470. success:(e)=>{
  471. if (e.confirm){
  472. that.previousServiceOrderId = that.currService.serviceObjectId
  473. that.$api.service.settle({
  474. orderServiceId: that.currService.orderServiceId
  475. }).then(res => {
  476. that.currServiceInfo()
  477. that.$refs.reminderPopup.open()
  478. })
  479. }
  480. }
  481. })
  482. },
  483. start() {
  484. this.$api.service.start({
  485. orderServiceId: this.currService.orderServiceId
  486. }).then(res => {
  487. this.currServiceInfo()
  488. })
  489. },
  490. end() {
  491. this.$api.service.end({
  492. orderServiceId: this.currService.orderServiceId
  493. }).then(res => {
  494. this.currServiceInfo()
  495. })
  496. },
  497. call(){
  498. this.$api.service.call({
  499. orderServiceId: this.currService.orderServiceId
  500. }).then(res => {
  501. this.currServiceInfo()
  502. })
  503. },
  504. next() {
  505. if (!this.userInfo.signIn){
  506. uni.showToast({
  507. icon: 'error',
  508. duration: 2000,
  509. title: '请先扫码签到'
  510. });
  511. return
  512. }
  513. uni.showModal({
  514. title:'温馨提示',
  515. content:'是否确定下一位',
  516. editable:false,
  517. success:(e)=>{
  518. if (e.confirm){
  519. console.log(e.confirm)
  520. this.$api.service.next({
  521. orderServiceId: this.currService ? this.currService.orderServiceId : null,
  522. storeId:this.storeId
  523. }).then(res => {
  524. this.currServiceInfo()
  525. })
  526. }
  527. }
  528. })
  529. },
  530. currServiceInfo() {
  531. if (!this.userInfo.signIn){
  532. uni.showToast({
  533. icon: 'error',
  534. duration: 2000,
  535. title: '请先扫码签到'
  536. });
  537. return
  538. }
  539. this.$api.service.currServiceInfo({
  540. storeId: this.userInfo.workStoreId
  541. }).then(res => {
  542. console.log(res.data.data)
  543. this.currService = res.data.data
  544. this.setButtomState(this.currService)
  545. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  546. })
  547. },
  548. setButtomState(currService){
  549. if (currService){
  550. if (currService.status == 12){
  551. //叫号中
  552. this.buttonState=[0,0,1,1]
  553. }else if (currService.status == 8){
  554. //服务中
  555. this.buttonState=[1,1,0,0]
  556. }
  557. }else {
  558. this.buttonState=[0,1,1,1]
  559. }
  560. },
  561. getUserInfo() {
  562. this.$api.user.getUserInfo().then(res => {
  563. this.userInfo = res.data.data
  564. this.storeId = res.data.data.workStoreId
  565. uni.setStorageSync('userInfo', this.userInfo )
  566. if (this.userInfo.avatar){
  567. this.getImgUrlByOssId(this.userInfo.avatar)
  568. }
  569. if (this.userInfo.signIn){
  570. this.currServiceInfo()
  571. }
  572. this.$forceUpdate()
  573. })
  574. },
  575. getImgUrlByOssId(ossId){
  576. this.$api.service.getImgUrlByOssId({ossId:ossId}).then(res=>{
  577. this.$set(this.userInfo,'avatarUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  578. uni.setStorageSync('userInfo', this.userInfo )
  579. })
  580. },
  581. userScanCode() {
  582. let that = this
  583. uni.navigateTo({
  584. url: '/pages/scanCode/scanCode',
  585. events: {
  586. getScancode: function(data) {
  587. let param ={
  588. storeId:JSON.parse(data).storeId,
  589. timestamp:JSON.parse(data).timestamp
  590. }
  591. that.$api.service.clockIn(param).then(res=>{
  592. uni.showToast({
  593. icon: 'success',
  594. duration: 2000,
  595. title: '签到成功'
  596. });
  597. uni.setStorageSync('userInfo', that.userInfo )
  598. that.getUserInfo()
  599. })
  600. },
  601. }
  602. })
  603. },
  604. clickTab(e) {
  605. this.tabIndex = e
  606. if (e === 0) {
  607. this.currServiceInfo()
  608. }
  609. },
  610. }
  611. }
  612. </script>
  613. <style lang="scss" scoped>
  614. @import './index.rpx.css';
  615. </style>