index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  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">
  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" v-else>
  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 class="flex-row">
  65. <view class="flex-col justify-center ">
  66. <text class="servicename">{{currService.serviceObjectName}}</text>
  67. </view>
  68. <view class="flex-col justify-center ">
  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>
  94. <text>订单编号:{{currService.orderNo}}</text>
  95. </view>
  96. <view class="flex-row justify-center ">
  97. <view class="imgs">
  98. <view class="mmImgView" :class="{floatRight: (index+1) % 2==0,marginTop:index>1}" v-for="(i,index) in 0" :key="index">
  99. <image class="mmImg" mode="widthFix" src="/static/mn1.webp"></image>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="flex-row justify-center">
  104. <view class="like">
  105. <text>{{currService.preference || '暂无'}}</text>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="flex-col" :style="{'height':sysHeight}" v-else>
  110. <view class="flex-row justify-center">
  111. <image class="dataNull" src="/static/index/dataNull.png"></image>
  112. </view>
  113. <view class="flex-row justify-center dataNullText">
  114. <text>暂无服务项目,请刷新页面</text>
  115. </view>
  116. </view>
  117. </view>
  118. <uni-popup ref="reminderPopup" type="center">
  119. <view class="reminderView">
  120. <view class="reminderTitle">
  121. <text>保存用户喜好</text>
  122. </view>
  123. <view class="textareaView flex-row justify-center ">
  124. <textarea class="textarea" v-model="content" placeholder-style="color:#999999;fontSize:28rpx"
  125. placeholder="请输入用户喜好" />
  126. </view>
  127. <view class="flex-row justify-around" :style="{'marginTop':'20rpx'}">
  128. <view class="cancelButton " @click="closeReminderPopup">
  129. <text>取消</text>
  130. </view>
  131. <view class="confirmButton" @click="preference">
  132. <text>确定</text>
  133. </view>
  134. </view>
  135. </view>
  136. </uni-popup>
  137. <uni-popup ref="addServicePopup" @change="popupChange" type="bottom">
  138. <view class="addService">
  139. <scroll-view class="scrollY1 " scroll-y>
  140. <view class="flex-col">
  141. <view class="popupTitle">
  142. <text>选择服务项目</text>
  143. </view>
  144. <view class="flex-row justify-center">
  145. <view class="serviceItems ">
  146. <view class="serviceItem "
  147. :class="{vBackGround: serviceProjectListIndex === index,marginLeft16: (index+3) % 3!==0,marginTop24:index>2}"
  148. v-for="(item,index) in serviceProjectList" :key="index" @click="selectProject(item,index)">
  149. <text>{{item.serviceName}}</text>
  150. </view>
  151. </view>
  152. </view>
  153. <view class="popupTitle marginTop24">
  154. <text>选择服务技师</text>
  155. </view>
  156. <view class="flex-row justify-center">
  157. <view class="serviceItems ">
  158. <view class="flex-col serviceTeach "
  159. :class="{marginLeft28: (index+4) % 4!==0,marginTop24:index>3}" v-for="(item,index) in servicePersonList" :key="index" @click="servicePersonListIndex = index">
  160. <image class="serviceTeachImg" :src="item.facePhotoUrl ||'/static/ud4.png'" :class="{vBackGround: servicePersonListIndex === index}"></image>
  161. <view class="serviceTeachName">
  162. <text>{{item.personName}}</text>
  163. </view>
  164. <image v-if="servicePersonListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. </scroll-view>
  170. <view class="flex-row justify-around">
  171. <view class="cancelButton " @click="closeAddServicePopup">
  172. <text>取消</text>
  173. </view>
  174. <view class="confirmButton" @click="addServiceProject">
  175. <text>确定</text>
  176. </view>
  177. </view>
  178. </view>
  179. </uni-popup>
  180. <uni-popup ref="selectServiceObjectPopup" @change="popupChange" type="bottom">
  181. <view class="addService" >
  182. <view class="popupTitle">
  183. <text>切换服务对象</text>
  184. </view>
  185. <scroll-view class="scrollY" scroll-y>
  186. <view class="flex-row objectItem" :class="{'vBackGround': selectServiceObjectIndex === index}" v-for="(item,index) in selectServiceObjectList" :key="index" @click="selectServiceObjectIndex = index">
  187. <image class="objectImage" :src="item.facePhotoUrl || '/static/ud4.png'"></image>
  188. <view class="flex-col objectName ">
  189. <text>{{item.nickName}}</text>
  190. </view>
  191. <image v-if="servicePersonListIndex === index" class="vImage" src="/static/index/xuanzhong.png"></image>
  192. </view>
  193. </scroll-view>
  194. <view class="flex-row justify-around">
  195. <view class="cancelButton" @click="closeSelectServiceObjectPopup">
  196. <text>取消</text>
  197. </view>
  198. <view class="confirmButton" @click="switchServiceObject">
  199. <text>确定</text>
  200. </view>
  201. </view>
  202. </view>
  203. </uni-popup>
  204. </view>
  205. </template>
  206. <script>
  207. import MescrollItem from "./module/mescrollUni-item.vue";
  208. import QQMapWX from '../../common/js/qqmap/myqqmap-sdk.js'
  209. export default {
  210. components: {
  211. MescrollItem
  212. },
  213. data() {
  214. return {
  215. previousServiceOrderId:'',
  216. content:'',
  217. selectServiceObjectList:[],
  218. selectServiceObjectIndex:-1,
  219. servicePersonList:[],
  220. servicePersonListIndex:0,
  221. serviceProjectList:[],
  222. serviceProjectListIndex:0,
  223. tabIndex: 0,
  224. sysHeight: '',
  225. readerHeight: '',
  226. readerWidth: '',
  227. userInfo: {},
  228. storeId: '',
  229. storeName: '',
  230. currService: null,
  231. qqMap:new QQMapWX({key: 'ZIABZ-543WB-747UM-JL5Y7-NDS4E-HWB4M',vm: this})
  232. }
  233. },
  234. onLoad() {
  235. let sysInfo = uni.getSystemInfoSync()
  236. this.sysHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 400 + 'px'
  237. this.readerHeight = sysInfo.windowHeight + 'px'
  238. this.readerWidth = sysInfo.windowWidth + 'px'
  239. this.storeId = uni.getStorageSync('storeId')
  240. this.storeName = uni.getStorageSync('storeName')
  241. this.getUserInfo()
  242. },
  243. onShow() {
  244. this.userInfo = uni.getStorageSync('userInfo')
  245. if (this.userInfo.signIn){
  246. this.currServiceInfo()
  247. }
  248. },
  249. methods: {
  250. closeReminderPopup(){
  251. this.previousServiceOrderId = ''
  252. this.$refs.reminderPopup.open()
  253. },
  254. openSelectServiceObjectPopup(){
  255. this.$api.service.getServiceObjectList({
  256. orderServiceId:this.currService.orderServiceId,
  257. }).then(res=>{
  258. this.selectServiceObjectList= res.data.data
  259. this.getServiceObjectUrl(this.selectServiceObjectList)
  260. uni.hideTabBar()
  261. this.$refs.selectServiceObjectPopup.open()
  262. })
  263. },
  264. // 获取图片
  265. getServiceObjectUrl(items) {
  266. for (let i = 0; i < items.length; i++) {
  267. let ptoto = items[i].facePhoto || items[i].personPhoto
  268. if (ptoto) {
  269. this.$api.service.getImgUrlByOssId({
  270. ossId: ptoto
  271. }).then(res => {
  272. items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  273. this.$forceUpdate()
  274. })
  275. }
  276. }
  277. },
  278. closeSelectServiceObjectPopup(){
  279. this.serviceProjectListIndex = -1
  280. this.$refs.selectServiceObjectPopup.close()
  281. },
  282. switchServiceObject(){
  283. if (this.selectServiceObjectIndex === -1){
  284. uni.showToast({
  285. icon: 'none',
  286. duration: 2000,
  287. title: '请选择服务对象'
  288. });
  289. return
  290. }
  291. this.$api.service.switchServiceObject({
  292. orderServiceId:this.currService.orderServiceId,
  293. serviceObjectId:this.selectServiceObjectList[this.selectServiceObjectIndex].id
  294. }).then(res=>{
  295. this.currServiceInfo()
  296. this.closeSelectServiceObjectPopup()
  297. })
  298. },
  299. addService() {
  300. this.serviceProjectListIndex = 0
  301. this.$api.service.serviceProjectList().then(res=>{
  302. this.serviceProjectList= res.data.data
  303. this.serviceUserList(res.data.data[0])
  304. uni.hideTabBar()
  305. this.$refs.addServicePopup.open()
  306. })
  307. },
  308. selectProject(item,index){
  309. this.serviceProjectListIndex = index
  310. this.serviceUserList(item)
  311. },
  312. serviceUserList(item){
  313. this.$api.service.serviceUserList({
  314. serviceProjectId:item.id,
  315. storeId:this.storeId
  316. }).then(res=>{
  317. this.servicePersonListIndex = 0
  318. this.servicePersonList=res.data.data
  319. this.getServiceObjectUrl(this.servicePersonList)
  320. })
  321. },
  322. closeAddServicePopup(){
  323. this.serviceProjectListIndex = 0
  324. this.$refs.addServicePopup.close()
  325. },
  326. addServiceProject(){
  327. this.previousServiceOrderId = this.currService.orderServiceId
  328. this.$api.service.addServiceProject(
  329. {
  330. orderServiceId:this.currService.orderServiceId,
  331. serviceProjectId:this.serviceProjectList[this.serviceProjectListIndex].id,
  332. serviceUserId:this.servicePersonList[this.servicePersonListIndex].personId
  333. }
  334. ).then(res=>{
  335. this.closeAddServicePopup()
  336. this.currServiceInfo()
  337. this.$refs.reminderPopup.open()
  338. })
  339. },
  340. popupChange(e) {
  341. if (!e.show) {
  342. uni.showTabBar()
  343. }
  344. },
  345. takePlace() {
  346. this.$api.service.takePlace({
  347. orderServiceId: this.currService.orderServiceId
  348. }).then(res => {
  349. uni.showToast({
  350. icon: 'success',
  351. duration: 2000,
  352. title: '操作成功'
  353. });
  354. this.currServiceInfo()
  355. })
  356. },
  357. preference(){
  358. this.$api.service.preference({
  359. serviceObjectId:this.previousServiceOrderId,
  360. preference:this.content
  361. }).then(res=>{
  362. this.previousServiceOrderId=''
  363. uni.showToast({
  364. icon: 'success',
  365. duration: 2000,
  366. title: '保存成功'
  367. });
  368. })
  369. },
  370. settle() {
  371. this.previousServiceOrderId = this.currService.orderServiceId
  372. this.$api.service.settle({
  373. orderServiceId: this.currService.orderServiceId
  374. }).then(res => {
  375. this.currServiceInfo()
  376. this.$refs.reminderPopup.open()
  377. })
  378. },
  379. start() {
  380. this.$api.service.start({
  381. orderServiceId: this.currService.orderServiceId
  382. }).then(res => {
  383. this.currServiceInfo()
  384. })
  385. },
  386. end() {
  387. this.$api.service.end({
  388. orderServiceId: this.currService.orderServiceId
  389. }).then(res => {
  390. this.currServiceInfo()
  391. })
  392. },
  393. call(){
  394. this.$api.service.call({
  395. orderServiceId: this.currService.orderServiceId
  396. }).then(res => {
  397. this.currServiceInfo()
  398. })
  399. },
  400. next() {
  401. uni.showModal({
  402. title:'温馨提示',
  403. content:'是否确定下一位',
  404. editable:false,
  405. success:(e)=>{
  406. if (e.confirm){
  407. this.$api.service.next({
  408. orderServiceId: this.currService.orderServiceId
  409. }).then(res => {
  410. this.currServiceInfo()
  411. })
  412. }
  413. }
  414. })
  415. },
  416. currServiceInfo() {
  417. if (this.storeId === '' || this.storeId === null){
  418. return
  419. }
  420. this.$api.service.currServiceInfo({
  421. storeId: this.storeId
  422. }).then(res => {
  423. console.log(res.data.data)
  424. this.currService = res.data.data
  425. this.currService.avatar=this.currService.avatar.replace(/^http:/, "https:")
  426. let serviceFee = 0
  427. res.data.data.childList.forEach(item=>{
  428. serviceFee += item.serviceFee *1
  429. })
  430. this.currService.serviceFee = serviceFee.toFixed(2)
  431. })
  432. },
  433. getUserInfo() {
  434. this.$api.user.getUserInfo().then(res => {
  435. this.userInfo = res.data.data
  436. this.getImgUrlByOssId(this.userInfo.avatar)
  437. if (this.userInfo.signIn){
  438. this.currServiceInfo()
  439. }
  440. })
  441. },
  442. getImgUrlByOssId(ossId){
  443. this.$api.service.getImgUrlByOssId({ossId:ossId}).then(res=>{
  444. this.$set(this.userInfo,'avatarUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  445. uni.setStorageSync('userInfo', this.userInfo )
  446. })
  447. },
  448. userScanCode() {
  449. let that = this
  450. uni.navigateTo({
  451. url: '/pages/scanCode/scanCode',
  452. events: {
  453. getScancode: function(data) {
  454. that.storeId = JSON.parse(data).storeId
  455. that.timestamp = JSON.parse(data).timestamp
  456. uni.setStorageSync('storeId', that.storeId)
  457. uni.setStorageSync('timestamp', that.timestamp)
  458. let param ={
  459. storeId:that.storeId,
  460. timestamp:that.timestamp
  461. }
  462. console.log(param)
  463. that.$api.service.clockIn(param).then(res=>{
  464. uni.showToast({
  465. icon: 'success',
  466. duration: 2000,
  467. title: '签到成功'
  468. });
  469. that.currServiceInfo()
  470. })
  471. },
  472. }
  473. })
  474. },
  475. clickTab(e) {
  476. this.tabIndex = e
  477. if (e === 0) {
  478. this.currServiceInfo()
  479. }
  480. },
  481. }
  482. }
  483. </script>
  484. <style lang="scss" scoped>
  485. @import './index.rpx.css';
  486. </style>