index.vue 20 KB

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