comedetail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view>
  3. <!-- 顶部选填情况 -->
  4. <step-bar :steps="steps" :fixeda="fixedflag" :reservatType="datainfo.reservatType"></step-bar>
  5. <view class="ytbox" :style="fixedflag?'padding-top: 152rpx;':''">
  6. <view class="code_box">
  7. <view class="cdet" v-if="yy_code">
  8. <view class="ctit">通行码</view>
  9. <view class="ycode">
  10. <!-- <view class="tit">请向工作人员出示该二维码即可扫码通行</view> -->
  11. <view class="img">
  12. <image :src="yy_code" class="codeimg" @click.stop="getPreview"></image>
  13. <view class="usebox" v-if="useflag">
  14. <image :src="useimg" class="useimg"></image>
  15. </view>
  16. </view>
  17. <view class="txt txta" v-if="useflag">通行码已使用</view>
  18. <view class="txt" v-else>点击二维码可放大哦</view>
  19. </view>
  20. </view>
  21. <!-- 预约失败 -->
  22. <view class="cdet">
  23. <view class="ctit">预约信息</view>
  24. <view class="yerror" v-if="yyerror">
  25. <image :src="errorimg"></image>
  26. <view>审核失败</view>
  27. </view>
  28. <view class="cbox">
  29. <view class="ctxt">预约时间</view>
  30. <view class="ctlist">
  31. <view class="tit">参观日期:</view>
  32. <view class="txt">{{datainfo.visitDate||''}}</view>
  33. </view>
  34. <view class="ctlist">
  35. <view class="tit">参观时间:</view>
  36. <view class="txt">{{datainfo.visitTime||''}}</view>
  37. </view>
  38. </view>
  39. <view class="cbox">
  40. <view class="ctxt">登记信息</view>
  41. <view class="ctlist">
  42. <view class="tit">游客类型:</view>
  43. <view class="txt" v-if="datainfo.reservatType">{{datainfo.reservatType=='2'?'散客':'团队'}}</view>
  44. </view>
  45. <view class="ctlist">
  46. <view class="tit">单位名称:</view>
  47. <view class="txt">{{datainfo.visitUnitName||''}}</view>
  48. </view>
  49. <view class="ctlist">
  50. <view class="tit">参观人数:</view>
  51. <view class="txt">{{datainfo.visitNum||''}}人</view>
  52. </view>
  53. <view class="ctlist">
  54. <view class="tit">联系人:</view>
  55. <view class="txt">{{datainfo.visitName||''}}</view>
  56. </view>
  57. <view class="ctlist">
  58. <view class="tit">联系电话:</view>
  59. <view class="txt">{{datainfo.visitPhone||''}}</view>
  60. </view>
  61. <view class="ctlist">
  62. <view class="tit">是否接待:</view>
  63. <view class="txt">{{datainfo.isReception=='Y'?'是':'否'||''}}</view>
  64. </view>
  65. <block v-if="datainfo.isReception=='Y'">
  66. <view class="ctlist" v-if="datainfo.receptionName">
  67. <view class="tit">接待人:</view>
  68. <view class="txt">{{datainfo.receptionName||''}}</view>
  69. </view>
  70. <view class="ctlist" v-if="datainfo.receptionPhone">
  71. <view class="tit">接待电话:</view>
  72. <view class="txt">{{datainfo.receptionPhone||''}}</view>
  73. </view>
  74. </block>
  75. <view class="ctlist">
  76. <view class="tit">备注信息:</view>
  77. <view class="txt">{{datainfo.visitRemark||''}}</view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="code_btn" v-if="!useflag">
  84. <view class="btn btn2 flex1" @click="getFail" >取消预约</view>
  85. </view>
  86. <!-- 弹窗 -->
  87. <pop-up :type="type" @getClose="getClose"></pop-up>
  88. </view>
  89. </template>
  90. <script>
  91. import * as base64 from "base-64"
  92. import stepBar from "@/components/order/stepbar.vue"
  93. import popUp from "@/components/order/popup.vue"
  94. import {getReservatDetail,getReservatDel} from "@/api/mine/order.js"
  95. import QR from "@/utils/wxqrcode.js" // 二维码生成器
  96. import config from '@/config'
  97. const baseUrlimg = config.baseUrlimg
  98. export default {
  99. components:{stepBar,popUp},
  100. data(){
  101. return{
  102. codeimg:require('@/static/images/order/comes/code.png'),
  103. useimg:require('@/static/images/order/comes/use.png'),
  104. errorimg:require('@/static/images/order/comes/error.png'),
  105. //status: 填写状态 0:未填 1:在填 2:填完
  106. steps:[{tit:'预约时间',status:1,val:0},{tit:'信息登记',status:1,val:1},{tit:'等待审核',status:0,val:2},{tit:'审核结果',status:0,val:3}],
  107. fixedflag:true,
  108. fixedflag:true,
  109. useflag:false,
  110. type:0,
  111. yy_code:'',
  112. id:'',
  113. yyerror:false,
  114. datainfo:{
  115. },
  116. }
  117. },
  118. onLoad: function(e) {
  119. this.id=base64.decode(e.id);
  120. this.getDataFn()
  121. },
  122. methods:{
  123. getClose(){
  124. this.type=0;
  125. },
  126. getFail(){
  127. var that=this;
  128. uni.showModal({
  129. title: '确认取消',
  130. content: "是否确认取消该预约",
  131. cancelText: '取消',
  132. confirmText: '确认',
  133. success: function(res) {
  134. if (res.confirm) {
  135. getReservatDel(that.id).then(res=>{
  136. if(res.code==200){
  137. that.$toast('取消成功')
  138. setTimeout(function(){
  139. uni.$emit('refreshrelist')
  140. uni.navigateBack({
  141. delta:1
  142. })
  143. },1500)
  144. }else{
  145. that.$toast(res.msg)
  146. }
  147. })
  148. } else if (res.cancel) {
  149. // console.log('用户点击取消');
  150. }
  151. }
  152. });
  153. },
  154. getPreview() {
  155. var newArr=[];
  156. var url=this.yy_code
  157. newArr.push(url)
  158. uni.previewImage({
  159. urls: newArr,
  160. current:0,
  161. success: function(data) {
  162. },
  163. fail: function(err) {
  164. }
  165. });
  166. },
  167. getDataFn(){
  168. getReservatDetail(this.id).then(res=>{
  169. if(res.code==200){
  170. this.datainfo=res.data;
  171. if(res.data.visitStatus&&res.data.visitStatus==2){
  172. this.useflag=true;
  173. }
  174. var type=res.data.visitType;
  175. var reservatType=res.data.reservatType
  176. if(reservatType==2){
  177. this.steps[2].status=2;
  178. this.steps[3].status=2;
  179. this.steps[3].tit='预约成功';
  180. this.yy_code = QR.createQrCodeImg(this.id, {
  181. size: parseInt(240),//二维码大小
  182. typeNumber:10
  183. })
  184. }else{
  185. //visitType":"预约状态 1:等待审核 2:拒绝 3:同意",
  186. if(type==1){
  187. this.steps[2].status=2;
  188. }else if(type==2){
  189. this.steps[2].status=2;
  190. this.steps[3].status=2;
  191. this.steps[3].tit='预约失败';
  192. this.yyerror=true
  193. }else if(type==3){
  194. this.steps[2].status=2;
  195. this.steps[3].status=2;
  196. this.steps[2].tit='审核完成';
  197. this.steps[3].tit='预约成功';
  198. this.yy_code = QR.createQrCodeImg(this.id, {
  199. size: parseInt(240),//二维码大小
  200. typeNumber:10
  201. })
  202. }
  203. }
  204. }else{
  205. this.$toast(res.msg)
  206. }
  207. })
  208. }
  209. },
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .ytbox{padding-bottom: 32rpx;}
  214. .code_box{
  215. width: 684rpx;background: #FFFFFF;border-radius: 6rpx;margin: 40rpx auto 0;padding:40rpx 60rpx;box-sizing: border-box;flex: 1;
  216. .cdet{
  217. .ctit{font-size: 32rpx;font-weight: bold;color: #161616;position: relative;
  218. &::before{width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 2rpx;content: '';left: -26rpx;top: 3rpx;position: absolute;bottom: 3rpx;}
  219. }
  220. .cbox{padding: 36rpx 0 12rpx;}
  221. .ctxt{font-size: 30rpx;font-weight: bold;
  222. color: $com-cd3;margin-bottom: 16rpx;}
  223. .ctlist{padding: 10rpx 0;display: flex;justify-content: space-between;
  224. .tit{font-size: 30rpx;font-weight: 500;
  225. color: #AAAAAA;flex:0 0 auto;margin-right: 20rpx;}
  226. .txt{font-size: 30rpx;font-weight: 500;color: #161616;flex: 1;text-align: right; }
  227. }
  228. .yerror{padding: 14rpx 0 30rpx;
  229. image{width: 296rpx;height: 330rpx;margin: 0 auto 16rpx;}
  230. view{font-size: 24rpx;font-weight: bold;color: #D32C26;text-align: center;}
  231. }
  232. }
  233. // 二维码
  234. .ycode{text-align: center;padding: 34rpx 0 30rpx;
  235. .tit{font-size: 28rpx;font-weight: bold;
  236. color: #FFB132;}
  237. .img{width: 270rpx;height: 270rpx;margin: 6rpx auto;padding: 10rpx;box-sizing: border-box;position: relative;
  238. .codeimg{width: 100%;height: 100%;}
  239. .usebox{
  240. position: absolute;left: 0;right: 0;top: 0;bottom: 0;background-color: rgba(255, 255, 255, 0.8);
  241. }
  242. .useimg{width: 132rpx;height: 86rpx;position: absolute;bottom: 50rpx;right: 40rpx;}
  243. }
  244. .txt{font-size: 24rpx;font-weight: bold;color: $com-cd3;
  245. &.txta{color: #AAAAAA;}
  246. }
  247. }
  248. }
  249. .code_btn{flex: 0 0 auto;padding: 40rpx 32rpx;display: flex;align-items: center;justify-content: space-between;
  250. .btn{width: 320rpx;height: 80rpx;border-radius: 40rpx;box-sizing: border-box;font-size: 32rpx;font-weight: 500;text-align: center;line-height: 80rpx;
  251. &.btn1{background: #FFFFFF;border: 2rpx solid $com-cd3;color: $com-cd3;}
  252. &.btn2{background: $com-cd3;color: #FFFFFF;}
  253. }
  254. }
  255. </style>