code.vue 8.7 KB

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