index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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. foregroundImagePadding:2,
  281. foregroundImageBorderRadius:5,
  282. foregroundImageSrc: '/static/logo.png'
  283. }
  284. }
  285. },
  286. onLoad() {
  287. let sysInfo = uni.getSystemInfoSync()
  288. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  289. this.readerHeight = sysInfo.windowHeight + 'px'
  290. this.readerWidth = sysInfo.windowWidth + 'px'
  291. },
  292. onShow() {
  293. this.getUserInfo()
  294. // this.userInfo = uni.getStorageSync('userInfo')
  295. // if (this.userInfo.signIn){
  296. // this.currServiceInfo()
  297. // }
  298. },
  299. methods: {
  300. avatarOpen(){
  301. this.$refs.avatarPopup.open()
  302. },
  303. promotion(){
  304. let data = {
  305. promotionStoreId: this.userInfo.workStoreId || '',
  306. techNo: this.userInfo.techNo || ''
  307. };
  308. for (let key in data) {
  309. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  310. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  311. }
  312. console.log('++++qrcodeUrl+++++',this.qrcodeUrl)
  313. this.$refs.promotionPopup.open()
  314. },
  315. closeReminderPopup(){
  316. this.previousServiceOrderId = ''
  317. this.$refs.reminderPopup.close()
  318. },
  319. openSelectServiceObjectPopup(){
  320. this.$api.service.getServiceObjectList({
  321. orderServiceId:this.currService.orderServiceId,
  322. }).then(res=>{
  323. this.selectServiceObjectList= res.data.data
  324. this.getServiceObjectUrl(this.selectServiceObjectList)
  325. uni.hideTabBar()
  326. this.$refs.selectServiceObjectPopup.open()
  327. })
  328. },
  329. // 获取图片
  330. getServiceObjectUrl(items) {
  331. for (let i = 0; i < items.length; i++) {
  332. let ptoto = items[i].facePhoto || items[i].personPhoto
  333. if (ptoto) {
  334. this.$api.service.getImgUrlByOssId({
  335. ossId: ptoto
  336. }).then(res => {
  337. items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  338. this.$forceUpdate()
  339. })
  340. }
  341. }
  342. },
  343. closeSelectServiceObjectPopup(){
  344. this.serviceProjectListIndex = -1
  345. this.$refs.selectServiceObjectPopup.close()
  346. },
  347. switchServiceObject(){
  348. if (this.selectServiceObjectIndex === -1){
  349. uni.showToast({
  350. icon: 'none',
  351. duration: 2000,
  352. title: '请选择服务对象'
  353. });
  354. return
  355. }
  356. this.$api.service.switchServiceObject({
  357. orderServiceId:this.currService.orderServiceId,
  358. serviceObjectId:this.selectServiceObjectList[this.selectServiceObjectIndex].id
  359. }).then(res=>{
  360. this.currServiceInfo()
  361. this.closeSelectServiceObjectPopup()
  362. })
  363. },
  364. addService() {
  365. if (!this.currService){
  366. uni.showToast({
  367. icon: 'error',
  368. duration: 2000,
  369. title: '没有服务对象'
  370. });
  371. return
  372. }
  373. this.serviceProjectListIndex = 0
  374. this.$api.service.serviceProjectList().then(res=>{
  375. this.serviceProjectList= res.data.data
  376. this.serviceUserList(res.data.data[0])
  377. uni.hideTabBar()
  378. this.$refs.addServicePopup.open()
  379. })
  380. },
  381. selectProject(item,index){
  382. this.serviceProjectListIndex = index
  383. this.serviceUserList(item)
  384. },
  385. serviceUserList(item){
  386. this.$api.service.serviceUserList({
  387. serviceProjectId:item.id,
  388. storeId:this.storeId
  389. }).then(res=>{
  390. this.servicePersonListIndex = 0
  391. this.servicePersonList=res.data.data
  392. this.getServiceObjectUrl(this.servicePersonList)
  393. })
  394. },
  395. closeAddServicePopup(){
  396. this.serviceProjectListIndex = 0
  397. this.$refs.addServicePopup.close()
  398. },
  399. addServiceProject(){
  400. this.previousServiceOrderId = this.currService.serviceObjectId
  401. this.$api.service.addServiceProject(
  402. {
  403. orderServiceId:this.currService.orderServiceId,
  404. serviceProjectId:this.serviceProjectList[this.serviceProjectListIndex].id,
  405. serviceUserId:this.servicePersonList[this.servicePersonListIndex].personId
  406. }
  407. ).then(res=>{
  408. this.closeAddServicePopup()
  409. this.currServiceInfo()
  410. this.$refs.reminderPopup.open()
  411. })
  412. },
  413. popupChange(e) {
  414. if (!e.show) {
  415. uni.showTabBar()
  416. }
  417. },
  418. takePlace() {
  419. if (!this.currService){
  420. uni.showToast({
  421. icon: 'error',
  422. duration: 2000,
  423. title: '没有服务对象'
  424. });
  425. return
  426. }
  427. this.$api.service.takePlace({
  428. orderServiceId: this.currService.orderServiceId
  429. }).then(res => {
  430. uni.showToast({
  431. icon: 'success',
  432. duration: 2000,
  433. title: '操作成功'
  434. });
  435. this.currServiceInfo()
  436. })
  437. },
  438. preference(){
  439. this.$refs.reminderPopup.close()
  440. this.$api.service.preference({
  441. serviceObjectId:this.previousServiceOrderId,
  442. preference:this.content
  443. }).then(res=>{
  444. if (this.currService){
  445. if (this.currService.serviceObjectId == this.previousServiceOrderId ){
  446. this.currService.preference = this.content
  447. }
  448. }
  449. this.previousServiceOrderId=''
  450. this.content=''
  451. uni.showToast({
  452. icon: 'success',
  453. duration: 2000,
  454. title: '保存成功'
  455. });
  456. })
  457. },
  458. settle() {
  459. let that = this
  460. if (!that.currService){
  461. uni.showToast({
  462. icon: 'error',
  463. duration: 2000,
  464. title: '没有服务对象'
  465. });
  466. return
  467. }
  468. uni.showModal({
  469. title:'温馨提示',
  470. content:'是否确定结算',
  471. editable:false,
  472. success:(e)=>{
  473. if (e.confirm){
  474. that.previousServiceOrderId = that.currService.serviceObjectId
  475. that.$api.service.settle({
  476. orderServiceId: that.currService.orderServiceId
  477. }).then(res => {
  478. that.currServiceInfo()
  479. that.$refs.reminderPopup.open()
  480. })
  481. }
  482. }
  483. })
  484. },
  485. start() {
  486. this.$api.service.start({
  487. orderServiceId: this.currService.orderServiceId
  488. }).then(res => {
  489. this.currServiceInfo()
  490. })
  491. },
  492. end() {
  493. this.$api.service.end({
  494. orderServiceId: this.currService.orderServiceId
  495. }).then(res => {
  496. this.currServiceInfo()
  497. })
  498. },
  499. call(){
  500. this.$api.service.call({
  501. orderServiceId: this.currService.orderServiceId
  502. }).then(res => {
  503. this.currServiceInfo()
  504. })
  505. },
  506. next() {
  507. if (!this.userInfo.signIn){
  508. uni.showToast({
  509. icon: 'error',
  510. duration: 2000,
  511. title: '请先扫码签到'
  512. });
  513. return
  514. }
  515. uni.showModal({
  516. title:'温馨提示',
  517. content:'是否确定下一位',
  518. editable:false,
  519. success:(e)=>{
  520. if (e.confirm){
  521. console.log(e.confirm)
  522. this.$api.service.next({
  523. orderServiceId: this.currService ? this.currService.orderServiceId : null,
  524. storeId:this.storeId
  525. }).then(res => {
  526. this.currServiceInfo()
  527. })
  528. }
  529. }
  530. })
  531. },
  532. currServiceInfo() {
  533. if (!this.userInfo.signIn){
  534. uni.showToast({
  535. icon: 'error',
  536. duration: 2000,
  537. title: '请先扫码签到'
  538. });
  539. return
  540. }
  541. this.$api.service.currServiceInfo({
  542. storeId: this.userInfo.workStoreId
  543. }).then(res => {
  544. console.log(res.data.data)
  545. if (res.data.data === null){
  546. uni.showModal({
  547. title:'温馨提示',
  548. content:'暂无需要服务的客户',
  549. editable:false,
  550. showCancel:false,
  551. success:(e)=>{
  552. if (e.confirm){
  553. }
  554. }
  555. })
  556. }
  557. this.currService = res.data.data
  558. this.setButtomState(this.currService)
  559. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  560. }).catch(err=>{
  561. console.log("出错了+++++++++++出错了+++++++",err)
  562. })
  563. },
  564. setButtomState(currService){
  565. if (currService){
  566. if (currService.status == 12){
  567. //叫号中
  568. this.buttonState=[0,0,1,1]
  569. }else if (currService.status == 8){
  570. //服务中
  571. this.buttonState=[1,1,0,0]
  572. }
  573. }else {
  574. this.buttonState=[0,1,1,1]
  575. }
  576. },
  577. getUserInfo() {
  578. this.$api.user.getUserInfo().then(res => {
  579. this.userInfo = res.data.data
  580. this.storeId = res.data.data.workStoreId
  581. uni.setStorageSync('userInfo', this.userInfo )
  582. if (this.userInfo.avatar){
  583. this.getImgUrlByOssId(this.userInfo.avatar)
  584. }
  585. if (this.userInfo.signIn){
  586. this.buttonState=[0,1,1,1]
  587. this.currServiceInfo()
  588. }
  589. this.$forceUpdate()
  590. })
  591. },
  592. getImgUrlByOssId(ossId){
  593. this.$api.service.getImgUrlByOssId({ossId:ossId}).then(res=>{
  594. this.$set(this.userInfo,'avatarUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  595. uni.setStorageSync('userInfo', this.userInfo )
  596. })
  597. },
  598. userScanCode() {
  599. let that = this
  600. uni.navigateTo({
  601. url: '/pages/scanCode/scanCode',
  602. events: {
  603. getScancode: function(data) {
  604. let param ={
  605. storeId:JSON.parse(data).storeId,
  606. timestamp:JSON.parse(data).timestamp
  607. }
  608. that.$api.service.clockIn(param).then(res=>{
  609. uni.showToast({
  610. icon: 'success',
  611. duration: 2000,
  612. title: '签到成功'
  613. });
  614. uni.setStorageSync('userInfo', that.userInfo )
  615. that.getUserInfo()
  616. })
  617. },
  618. }
  619. })
  620. },
  621. clickTab(e) {
  622. this.tabIndex = e
  623. if (e === 0) {
  624. this.currServiceInfo()
  625. }
  626. },
  627. }
  628. }
  629. </script>
  630. <style lang="scss" scoped>
  631. @import './index.rpx.css';
  632. </style>