index.vue 13 KB

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