index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <template>
  2. <view class="page">
  3. <view class="periodDate">
  4. <text>服务日期:{{orderParam.serviceDate}}</text>
  5. </view>
  6. <view class="store-wrap">
  7. <view class="store-info">
  8. <view class="logo">
  9. <image src="../../static/index/u55.png" mode=""></image>
  10. </view>
  11. <view @click="gotoStoreChoose()" class="store-content">
  12. <view class="h-row">
  13. <view class="store-desc">
  14. <view class="store-name">
  15. <view class="">{{ storeInfo.storeName }}</view>
  16. </view>
  17. </view>
  18. <view class="arrow-right">
  19. <view class="change-store">更换门店</view>
  20. <u-icon name="arrow-right" color="#333" size="16"></u-icon>
  21. </view>
  22. </view>
  23. <view class="h-row">
  24. <text class="address">地址:{{ storeInfo.address }}</text>
  25. <text class="address1">{{storeInfo.distanceDesc}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="flex-col group">
  31. <view class="serob"><text>服务对象</text></view>
  32. <u-grid :border="false" col="4">
  33. <u-grid-item v-for="(item,index) in serviceObjectList" :key="index">
  34. <view class="serobItem flex-col">
  35. <view class="serobImgView" @click="selectServiceObject(item)">
  36. <image class="serobImg" mode="aspectFill" :src="item.facePhotoUrl || '/static/me/ud4.png'">
  37. </image>
  38. </view>
  39. <text class="serobName">{{item.nickName || '未填写'}}</text>
  40. <view class="serobV" v-if="item.select === true">
  41. <image class="serobVicon" src="/static/order/ud20.png"></image>
  42. </view>
  43. </view>
  44. </u-grid-item>
  45. </u-grid>
  46. </view>
  47. <view class="flex-col group" v-for="(item,index) in orderParam.childService">
  48. <view class="flex-row ">
  49. <image class="selectSerobImg" mode="aspectFill" :src="item.facePhotoUrl || '/static/me/ud4.png'"></image>
  50. <text class="selectSerobName">{{item.nickName || '未填写'}}</text>
  51. </view>
  52. <view class="serob" >
  53. <text>服务时段</text>
  54. </view>
  55. <view v-if="!item.serviceStartTime" class="noTime flex-row justify-center">
  56. <text>暂无可用的服务时段</text>
  57. </view>
  58. <view v-else>
  59. <u-grid :border="false" col="5">
  60. <u-grid-item v-if="item2.total > 0" v-for="(item2,index2) in item.periodTimeList" :key="index2">
  61. <view class="timeItemView">
  62. <view class="flex-col justify-center timeItem " :class="{selectBack: item2.select}" @click="selectServiceTime(item.periodTimeList,index,index2)">
  63. <view class="flex-row justify-center">
  64. <text class="time">{{item2.label}}</text>
  65. </view>
  66. <!-- <view class="flex-row justify-center">-->
  67. <!-- <text class="price">¥{{item2.price}}</text>-->
  68. <!-- </view>-->
  69. </view>
  70. </view>
  71. </u-grid-item>
  72. </u-grid>
  73. </view>
  74. </view>
  75. <view class="flex-col group ">
  76. <view class="groupItemKey">
  77. <text>取号规则</text>
  78. </view>
  79. <view v-for=" (item,index) in takeNumberRules " class="serobReminder">
  80. <text>{{index+1}}.{{item.dictValue}}。</text>
  81. </view>
  82. <!-- <view class="serobReminder">-->
  83. <!-- <text>1.你已进入不挑师傅不挑时段的单剪造型占位理发服务。</text>-->
  84. <!-- </view>-->
  85. <!-- <view class="serobReminder">-->
  86. <!-- <text>2.预约需要一人一号。</text>-->
  87. <!-- </view>-->
  88. <!-- <view class="serobReminder">-->
  89. <!-- <text>3.到门店先签到,过时没有签到占位时段失效。</text>-->
  90. <!-- </view>-->
  91. <!-- <view class="serobReminder">-->
  92. <!-- <text>4.服务费用到店享受相应服务以后在另行收取。</text>-->
  93. <!-- </view>-->
  94. </view>
  95. <view class="tabBarLineHeight "></view>
  96. <view class="tabBarView">
  97. <view class="submitButton " @click="openSetting">提交</view>
  98. </view>
  99. <uni-popup ref="sameDayQueuePopup">
  100. <uni-popup-dialog :type="msgType" cancelText="不再提示" confirmText="已知晓" title="提示" :content="configContent" @confirm="dialogConfirm"
  101. @close="dialogClose"></uni-popup-dialog>
  102. </uni-popup>
  103. <uni-popup ref="showExpireEquityCard">
  104. <view class="flex-col justify-start expirePopup" >
  105. <view class="flex-row justify-center">
  106. <text class="popupTitle">到期提醒</text>
  107. </view>
  108. <scroll-view scroll-y class="flex-col justify-start" :class="[ expireEquityCard.length > 1 ? 'scroll-y1':'scroll-y']" >
  109. <view class="flex-row listView" v-for="(item,index) in expireEquityCard">
  110. <view class="h-text flex-col justify-center ">
  111. <view class="money">
  112. <text>{{ item.faceValue }}</text>
  113. </view>
  114. </view>
  115. <view class="h-center-content flex-col justify-around">
  116. <view class="h-value">
  117. <text>{{ item.title }}</text>
  118. </view>
  119. <view class="title">
  120. 服务对象:{{ item.serviceObjectName || '' }}
  121. </view>
  122. <view class="title">
  123. 适用门店:{{ item.useStoreDesc || '' }}
  124. </view>
  125. <view class="title">
  126. 到期时间:{{ item.effectiveEndTime.slice(0,10) }}
  127. </view>
  128. </view>
  129. <view class="h-right-content flex-col justify-center ">
  130. <view class="btn" @click="navigateTo(item)">
  131. <text>续费</text>
  132. </view>
  133. </view>
  134. </view>
  135. </scroll-view>
  136. </view>
  137. </uni-popup>
  138. </view>
  139. </template>
  140. <script>
  141. export default {
  142. components: {
  143. },
  144. data() {
  145. return {
  146. msgType:null,
  147. configContent:'',
  148. timeoutId:null,
  149. templateId:[],
  150. periodTimeList:[],
  151. userInfo: {},
  152. store: {},
  153. serviceObjectList: [],
  154. requestStatus: false,
  155. orderParam: {
  156. orderType: 1,
  157. serviceAttribute: 1,
  158. serviceStoreId: '',
  159. remark: '',
  160. serviceDate: '',
  161. childService: [
  162. // {
  163. // periodDate:'',//回显需要,不做参数
  164. // serviceObjectId: '',
  165. // facePhotoUrl:'', //回显需要,不做参数
  166. // nickName:'', //回显需要,不做参数
  167. // serviceUserId: '',
  168. // personName:'',//回显需要,不做参数
  169. // fee:'',//回显需要,不做参数
  170. // serviceStartTime: ''
  171. // }
  172. ]
  173. },
  174. takeNumberData:{
  175. pageNum:1,
  176. pageSize:10,
  177. dictType:'today_make_rule'
  178. },
  179. takeNumberRules:[],
  180. storeInfo: {},
  181. expireEquityCard:[], //过期的权益卡
  182. }
  183. },
  184. onLoad() {
  185. this.store = uni.getStorageSync('storeInfo')
  186. this.userInfo = uni.getStorageSync('userInfo')
  187. this.orderParam.serviceStoreId = this.store.storeId
  188. let date = new Date();
  189. this.orderParam.serviceDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' +
  190. date.getDate()).slice(-2)
  191. this.timeoutId = setTimeout(()=>{
  192. uni.showModal({
  193. title:'温馨提示',
  194. content:'您在下单页面停留太久,请重新进入!',
  195. showCancel:false,
  196. success:res=>{
  197. if (res.confirm){
  198. uni.switchTab({
  199. url: '/pages/index/index',
  200. })
  201. }
  202. }
  203. })
  204. },1000*60*5)
  205. this.getExpireEquityCard()
  206. },
  207. onShow() {
  208. //获取弹窗设置
  209. let sameDayQueueContent = uni.getStorageSync('same_day_queue_content');
  210. if (!sameDayQueueContent){
  211. this.getConfigKey('same_day_queue_content')
  212. }
  213. // 查询门店信息
  214. const data = uni.getStorageSync('storeInfo');
  215. this.store = uni.getStorageSync('storeInfo')
  216. this.userInfo = uni.getStorageSync('userInfo')
  217. if (!data) {
  218. // 获取位置信息查询门店列表数据
  219. this.getLocation();
  220. } else {
  221. this.storeInfo = data;
  222. }
  223. this.getServicePersonTime()
  224. this.getTemplateList()
  225. this.getSelectionRules(this.takeNumberData)
  226. this.orderParam.childService = []
  227. },
  228. onUnload(){
  229. clearTimeout(this.timeoutId);
  230. },
  231. methods: {
  232. navigateTo(item){
  233. if(item.activityId){
  234. let list = item.activityId.split(',')
  235. if (list.length == 1){
  236. uni.navigateTo({
  237. url:'/orderPages/activityDetail/activityDetail?id=' + item.activityId +'&renewServiceObjectId=' + item.serviceObjectId
  238. })
  239. }else {
  240. uni.navigateTo({
  241. url:'/orderPages/activityList/activityList?renewServiceObjectId=' + item.serviceObjectId + '&equityCardId=' + item.equityCardId
  242. })
  243. }
  244. }else{
  245. uni.navigateTo({
  246. url:'/orderPages/activityList/activityList'
  247. })
  248. }
  249. },
  250. getExpireEquityCard(){
  251. this.$api.getExpireEquityCard({
  252. serviceObjectId:0
  253. }).then((res)=>{
  254. this.expireEquityCard = res.data.data;
  255. // if (this.expireEquityCard.length > 0){
  256. // uni.showModal({
  257. // title:'温馨提示',
  258. // content:'您有' + this.expireEquityCard.length + '张权益卡即将到期',
  259. // confirmText:'立即续费',
  260. // success:(res)=>{
  261. // if (res.confirm) {
  262. // console.log('用户点击确定');
  263. // uni.navigateTo({
  264. // url:'/storePages/myRights/index'
  265. // })
  266. // } else if (res.cancel) {
  267. // console.log('用户点击取消');
  268. // }
  269. // }
  270. // })
  271. // }
  272. if (this.expireEquityCard.length > 0){
  273. this.$refs.showExpireEquityCard.open()
  274. }
  275. })
  276. },
  277. dialogConfirm(){
  278. this.configContent = '';
  279. },
  280. dialogClose(){
  281. uni.setStorageSync('same_day_queue_content',true);
  282. this.configContent = '';
  283. },
  284. getConfigKey(key){
  285. this.$api.getConfigKey({key:key}).then(res=>{
  286. console.log('获取到的配置信息',res.data.msg)
  287. if (res.data.msg){
  288. //打开弹窗
  289. this.configContent = res.data.msg
  290. this.$refs.sameDayQueuePopup.open()
  291. }
  292. })
  293. },
  294. // 获取门店列表数据
  295. getStoreListData(data) {
  296. let that = this;
  297. // 用户绑定门店
  298. this.$api.storeList(data).then((res) => {
  299. console.log(res.data.data[0])
  300. that.storeInfo = res.data.data[0]
  301. // 更新用户选择的门店信息
  302. uni.setStorageSync('storeInfo', res.data.data[0])
  303. })
  304. },
  305. // 获取经纬度信息
  306. getLocation() {
  307. let that = this
  308. console.log('+++++++++++++开始获取位置信息++++++++++++++++')
  309. uni.getLocation({
  310. type: 'gcj02',
  311. success: function (res) {
  312. console.log(res)
  313. let latitude = res.latitude; // 纬度
  314. let longitude = res.longitude; // 经度
  315. let speed = res.speed; // 速度
  316. let accuracy = res.accuracy; // 精确度
  317. // 在这里可以对位置信息进行处理
  318. console.log("纬度:" + latitude + ";经度" + longitude)
  319. that.reqParm.latitude = latitude
  320. that.reqParm.longitude = longitude
  321. uni.setStorageSync('location', that.reqParm)
  322. that.getStoreListData(that.reqParm)
  323. },
  324. fail:function (fail) {
  325. console.log('获取用户地址失败==》',fail)
  326. that.getStoreListData(that.reqParm)
  327. },
  328. complete:function (complete) {
  329. console.log('获取用户地址失败or成功==》',complete)
  330. }
  331. });
  332. },
  333. // 去选择门店
  334. gotoStoreChoose() {
  335. uni.setStorageSync('router','1')
  336. uni.navigateTo({
  337. url: '/storePages/store/store-choose?type=1',
  338. })
  339. },
  340. back(){
  341. uni.switchTab({
  342. url: '/pages/index/index',
  343. })
  344. },
  345. selectServiceTime(items,index,index2){
  346. items.forEach(e=>{
  347. e.select=false
  348. })
  349. let oidTime = this.orderParam.childService[index].serviceStartTime
  350. items[index2].select =true // 新选中的时间
  351. this.orderParam.childService[index].serviceStartTime = items[index2].label
  352. for (let i=0;i<this.orderParam.childService.length;i++){
  353. if (index != i){
  354. for (const time of this.orderParam.childService[i].periodTimeList) {
  355. if (time.label == oidTime){
  356. time.total = time.total + 1
  357. }
  358. if (time.label == items[index2].label) {
  359. time.total = time.total - 1
  360. }
  361. }
  362. }
  363. }
  364. this.$forceUpdate()
  365. },
  366. // 查询服务对象信息列表
  367. listServiceObject() {
  368. this.$api.listServiceObject(this.reqParm).then((res) => {
  369. this.serviceObjectList = res.data.data
  370. this.getImgUrlByBannerOssId(this.serviceObjectList);
  371. //不再默认选中第一个
  372. // if (this.periodTimeList.length >0){
  373. // this.orderParam.childService = [],
  374. // this.serviceObjectList[0].select = true
  375. // let periodTimeList = JSON.parse(JSON.stringify(this.periodTimeList))
  376. // periodTimeList[0].select = true
  377. // let childService = {
  378. // periodDate: '',
  379. // serviceObjectId: this.serviceObjectList[0].id,
  380. // facePhotoUrl: this.serviceObjectList[0].facePhotoUrl,
  381. // nickName: this.serviceObjectList[0].nickName,
  382. // serviceUserId: -1,
  383. // fee: '',
  384. // serviceStartTime: periodTimeList[0].label,
  385. // periodTimeList:periodTimeList
  386. // }
  387. // this.orderParam.childService.push(childService)
  388. // }
  389. })
  390. },
  391. // 获取图片
  392. getImgUrlByBannerOssId(items) {
  393. for (let i = 0; i < items.length; i++) {
  394. if (items[i].facePhoto) {
  395. this.$api.getImgUrlByOssId({
  396. ossId: items[i].facePhoto
  397. }).then(res => {
  398. items[i].facePhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  399. this.$set(this.serviceObjectList, i, items[i])
  400. if (i === 0) {
  401. this.orderParam.childService[0].facePhotoUrl = res.data.data[0].url.replace(
  402. /^http:/, "https:")
  403. }
  404. })
  405. }
  406. }
  407. },
  408. addServiceObject() {
  409. uni.navigateTo({
  410. url: '/myPages/ServiceObjectManagement/index'
  411. })
  412. },
  413. getServicePersonTime(){
  414. this.$api.getServicePersonTime({
  415. personId: -1,
  416. date: this.orderParam.serviceDate,
  417. storeId:this.store.storeId
  418. }).then(res=>{
  419. this.periodTimeList = res.data.data
  420. if (this.periodTimeList.length===0){
  421. uni.$u.toast('暂无可预约排班')
  422. }
  423. // 服务对象
  424. this.listServiceObject()
  425. })
  426. },
  427. selectServiceObject(item) {
  428. if (item.select) {
  429. this.orderParam.childService = this.orderParam.childService.filter(selectServiceObject =>
  430. selectServiceObject.serviceObjectId !== item.id)
  431. } else {
  432. let periodTimeList = JSON.parse(JSON.stringify(this.periodTimeList))
  433. periodTimeList.forEach(i=>{
  434. this.orderParam.childService.forEach(i1=>{
  435. if (i.label == i1.serviceStartTime){
  436. i.total = i.total -1
  437. }
  438. })
  439. })
  440. let childService = {
  441. periodDate: '',
  442. serviceObjectId: item.id,
  443. facePhotoUrl: item.facePhotoUrl,
  444. nickName: item.nickName,
  445. serviceUserId: -1,
  446. fee: '',
  447. serviceStartTime: '',
  448. periodTimeList:periodTimeList
  449. }
  450. for (const time of periodTimeList) {
  451. if (time.total>0){
  452. time.select = true
  453. childService.serviceStartTime = time.label
  454. for (const childService of this.orderParam.childService) {
  455. for (const periodTime of childService.periodTimeList) {
  456. if (time.label == periodTime.label) {
  457. periodTime.total = periodTime.total - 1
  458. }
  459. }
  460. }
  461. break
  462. }
  463. }
  464. this.orderParam.childService.push(childService)
  465. }
  466. item.select = !item.select
  467. this.price = 0
  468. for (let childService of this.orderParam.childService) {
  469. this.price = this.price * 1 + childService.fee * 1
  470. }
  471. },
  472. getTemplateList(){
  473. this.$api.getTemplateList({
  474. type:1
  475. }).then(res=>{
  476. this.templateId=res.data.data.data.map(item=>{
  477. return item.priTmplId
  478. })
  479. })
  480. },
  481. getSelectionRules(data){
  482. this.$api.getSelectionRules(data).then(res=>{
  483. this.takeNumberRules = res.data.rows
  484. })
  485. },
  486. openSetting(){
  487. if (!this.userInfo.phone){
  488. uni.showModal({
  489. title:'温馨提示',
  490. content:'预约叫号是通过手机尾号进行查询,是否确认绑定手机号!',
  491. success:res=>{
  492. if (res.confirm){
  493. uni.navigateTo({
  494. url: '/myPages/setting/setting-telphone',
  495. })
  496. }
  497. }
  498. })
  499. return
  500. }
  501. uni.requestSubscribeMessage({
  502. tmplIds: this.templateId,
  503. success: (res) =>{
  504. let {errMsg,...param} = res
  505. console.log('+++++++++++++success+++++++++++++',param)
  506. this.$api.updateSubscribe(param).then(res=>{
  507. console.log('+++++++++++++updateSubscribe+++++++++++++',res)
  508. })
  509. },
  510. fail:(err)=>{
  511. console.log('+++++++++++++fail+++++++++++++',err)
  512. },
  513. complete:(complete)=>{
  514. console.log('+++++++++++++complete+++++++++++++',complete)
  515. this.commonGeneralOrder()
  516. }
  517. })
  518. },
  519. commonGeneralOrder() {
  520. if (!this.orderParam.childService.length) {
  521. uni.$u.toast('请选择服务对象')
  522. return
  523. }
  524. let flag = false
  525. this.orderParam.childService.forEach(i=>{
  526. if (!i.serviceStartTime){
  527. uni.$u.toast('请选择服务时段')
  528. flag= true
  529. }
  530. })
  531. if (flag){
  532. return;
  533. }
  534. if (this.requestStatus) {
  535. return;
  536. }
  537. this.requestStatus = true
  538. uni.showLoading({
  539. title: '加载中'
  540. });
  541. this.$api.commonGeneralOrder(this.orderParam).then(res => {
  542. this.requestStatus = false
  543. uni.hideLoading();
  544. uni.$u.toast('预约成功')
  545. setTimeout(() => {
  546. uni.switchTab({
  547. url: '/pages/order/index'
  548. })
  549. }, 500)
  550. }).catch(err => {
  551. this.requestStatus = false
  552. })
  553. }
  554. }
  555. }
  556. </script>
  557. <style scoped lang="scss">
  558. @import './index.rpx.scss';
  559. .store-wrap {
  560. margin-top: 10rpx;
  561. background-color: white;
  562. .store-info {
  563. display: flex;
  564. .logo {
  565. width: 10%;
  566. text-align: center;
  567. display: flex;
  568. justify-content: center;
  569. align-items: center;
  570. image {
  571. width: 30px;
  572. height: 30px;
  573. }
  574. }
  575. .store-content {
  576. width: 90%;
  577. padding-bottom: 13px;
  578. .h-row {
  579. display: flex;
  580. align-items: center;
  581. justify-content: space-between;
  582. .store-desc {
  583. width: 90%;
  584. display: flex;
  585. line-height: 30px;
  586. font-size: 14px;
  587. .store-name {
  588. }
  589. }
  590. .arrow-right {
  591. text-align: right;
  592. margin: 0 auto;
  593. cursor: pointer;
  594. padding-top: 3px;
  595. width: 100px;
  596. display: flex;
  597. font-size: 14px;
  598. .change-store {
  599. text-align: right;
  600. color: #666;
  601. }
  602. image {
  603. width: 18px;
  604. height: 18px;
  605. }
  606. }
  607. .address {
  608. color: #999999;
  609. width: 450rpx;
  610. font-size: 24rpx;
  611. }
  612. .address1 {
  613. color: #999999;
  614. font-size: 24rpx;
  615. padding-right: 40rpx;
  616. }
  617. }
  618. }
  619. }
  620. .adress {
  621. font-size: 22rpx;
  622. white-space: nowrap;
  623. overflow: hidden;
  624. text-overflow: ellipsis;
  625. padding-left: 80rpx;
  626. color: #666;
  627. }
  628. }
  629. </style>