index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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'" @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="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="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. showLike:false,
  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?promotionStoreId={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.showLike = true
  426. this.$api.service.takePlace({
  427. orderServiceId: this.currService.orderServiceId
  428. }).then(res => {
  429. uni.showToast({
  430. icon: 'success',
  431. duration: 2000,
  432. title: '操作成功'
  433. });
  434. this.$api.service.currServiceInfo({
  435. storeId: this.storeId
  436. }).then(res => {
  437. console.log(res.data.data)
  438. this.currService = res.data.data
  439. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  440. let serviceFee = 0
  441. res.data.data.childList.forEach(item=>{
  442. serviceFee += item.serviceFee *1
  443. })
  444. this.currService.serviceFee = serviceFee.toFixed(2)
  445. })
  446. })
  447. },
  448. preference(){
  449. this.$refs.reminderPopup.close()
  450. this.$api.service.preference({
  451. serviceObjectId:this.previousServiceOrderId,
  452. preference:this.content
  453. }).then(res=>{
  454. this.previousServiceOrderId=''
  455. this.content=''
  456. uni.showToast({
  457. icon: 'success',
  458. duration: 2000,
  459. title: '保存成功'
  460. });
  461. })
  462. },
  463. settle() {
  464. let that = this
  465. if (!that.currService){
  466. uni.showToast({
  467. icon: 'error',
  468. duration: 2000,
  469. title: '没有服务对象'
  470. });
  471. return
  472. }
  473. uni.showModal({
  474. title:'温馨提示',
  475. content:'是否确定结算',
  476. editable:false,
  477. success:(e)=>{
  478. if (e.confirm){
  479. that.previousServiceOrderId = that.currService.serviceObjectId
  480. that.$api.service.settle({
  481. orderServiceId: that.currService.orderServiceId
  482. }).then(res => {
  483. that.currServiceInfo()
  484. that.$refs.reminderPopup.open()
  485. })
  486. }
  487. }
  488. })
  489. },
  490. start() {
  491. this.$api.service.start({
  492. orderServiceId: this.currService.orderServiceId
  493. }).then(res => {
  494. this.currServiceInfo()
  495. })
  496. },
  497. end() {
  498. this.$api.service.end({
  499. orderServiceId: this.currService.orderServiceId
  500. }).then(res => {
  501. this.currServiceInfo()
  502. })
  503. },
  504. call(){
  505. this.$api.service.call({
  506. orderServiceId: this.currService.orderServiceId
  507. }).then(res => {
  508. this.currServiceInfo()
  509. })
  510. },
  511. next() {
  512. if (!this.userInfo.signIn){
  513. uni.showToast({
  514. icon: 'error',
  515. duration: 2000,
  516. title: '请先扫码签到'
  517. });
  518. return
  519. }
  520. this.showLike = false
  521. uni.showModal({
  522. title:'温馨提示',
  523. content:'是否确定下一位',
  524. editable:false,
  525. success:(e)=>{
  526. if (e.confirm){
  527. console.log(e.confirm)
  528. this.$api.service.next({
  529. orderServiceId: this.currService ? this.currService.orderServiceId : null,
  530. storeId:this.storeId
  531. }).then(res => {
  532. this.currServiceInfo()
  533. })
  534. }
  535. }
  536. })
  537. },
  538. currServiceInfo() {
  539. if (!this.userInfo.signIn){
  540. uni.showToast({
  541. icon: 'error',
  542. duration: 2000,
  543. title: '请先扫码签到'
  544. });
  545. return
  546. }
  547. this.$api.service.currServiceInfo({
  548. storeId: this.userInfo.workStoreId
  549. }).then(res => {
  550. console.log(res.data.data)
  551. this.currService = res.data.data
  552. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  553. let serviceFee = 0
  554. res.data.data.childList.forEach(item=>{
  555. serviceFee += item.serviceFee *1
  556. })
  557. this.currService.serviceFee = serviceFee.toFixed(2)
  558. })
  559. },
  560. getUserInfo() {
  561. this.$api.user.getUserInfo().then(res => {
  562. this.userInfo = res.data.data
  563. this.storeId = res.data.data.workStoreId
  564. uni.setStorageSync('userInfo', this.userInfo )
  565. if (this.userInfo.avatar){
  566. this.getImgUrlByOssId(this.userInfo.avatar)
  567. }
  568. if (this.userInfo.signIn){
  569. this.currServiceInfo()
  570. }
  571. this.$forceUpdate()
  572. })
  573. },
  574. getImgUrlByOssId(ossId){
  575. this.$api.service.getImgUrlByOssId({ossId:ossId}).then(res=>{
  576. this.$set(this.userInfo,'avatarUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  577. uni.setStorageSync('userInfo', this.userInfo )
  578. })
  579. },
  580. userScanCode() {
  581. let that = this
  582. uni.navigateTo({
  583. url: '/pages/scanCode/scanCode',
  584. events: {
  585. getScancode: function(data) {
  586. let param ={
  587. storeId:JSON.parse(data).storeId,
  588. timestamp:JSON.parse(data).timestamp
  589. }
  590. that.$api.service.clockIn(param).then(res=>{
  591. uni.showToast({
  592. icon: 'success',
  593. duration: 2000,
  594. title: '签到成功'
  595. });
  596. uni.setStorageSync('userInfo', that.userInfo )
  597. that.getUserInfo()
  598. })
  599. },
  600. }
  601. })
  602. },
  603. clickTab(e) {
  604. this.tabIndex = e
  605. if (e === 0) {
  606. this.currServiceInfo()
  607. }
  608. },
  609. }
  610. }
  611. </script>
  612. <style lang="scss" scoped>
  613. @import './index.rpx.css';
  614. </style>