pages-verification-verification.4d5b4d87.js
4.1 KB
import{q as e,p as s,aj as t,ak as a,I as l,o,c as r,w as c,C as n,f as i,D as d,ac as f,g as u,t as p,h,u as _,v as m,P as g,l as v,J as x}from"./index-ffa120f9.js";import{_ as y}from"./right-arrow.535a0429.js";import{_ as b}from"./_plugin-vue_export-helper.1b428a4d.js";const w=b({__name:"verification",setup(b){const w=e({loadingShow:!1,scanText:"",tipMsg:"尝试识别中..."});e({reFresh:!0,showPlayBtn:!1,showFullBtn:!1});let j=e({arr:{name:""}}),C=s("");const k=()=>{var e=_();m.$api.user.checkconsumption({store_id:e.store_id,receive_no:q._value}).then((e=>{P(),console.log("res",e)}))};t((()=>{})),a((()=>{z()}));let q=s("");const $=e=>{var s,t;e&&(console.log("id",e),w.scanText=e,s=w.scanText,t=_(),m.$api.user.checkconsumption({store_id:t.store_id,receive_no:s}).then((e=>{console.log("res",e),P(),l({icon:"none",duration:2e3,title:e.msg})})))},z=()=>{B("https://blog.minhazav.dev/assets/research/html5qrcode/html5-qrcode.min.js"),setTimeout((()=>{T()}),1e3)},Q=()=>{html5QrCode.stop().then((e=>{console.log("QR Code scanning stopped.")})).catch((e=>{console.log("Unable to stop scanning.")}))},T=()=>{Html5Qrcode.getCameras().then((e=>{console.log("devices",e),e&&e.length&&(console.log("chufa"),C=e.length>1?e[1].id:e[0].id,console.log("chufa2"),new Html5Qrcode("qr-reader").start(C,{fps:10,qrbox:250},(e=>{e&&(l({title:"扫码成功",icon:"none"}),$(e),Q())}),(e=>{})).catch((e=>{l({title:`扫码失败:${e}`})})),console.log("chufa3"))})).catch((e=>{console.log("err",e),l({title:"启用相机失败",icon:"none"})}))},B=e=>new Promise(((s,t)=>{const a=document.createElement("script");a.src=e,a.type="text/javascript",document.body.appendChild(a),a.onload=()=>{s()}})),P=()=>{var e=_();m.$api.user.getverification_cancel({store_id:e.store_id}).then((e=>{console.log("res",e),e.data?j.arr=e.data:j.arr={}}))},V=()=>{m.$router.go("/pages/verification/allverification")};return(e,s)=>{const t=n,a=g,l=v,_=x;return o(),r(t,{class:""},{default:c((()=>[i(t,{class:"verifihead"},{default:c((()=>[i(t,{class:"posr"},{default:c((()=>[i(t,{class:"sectionview"},{default:c((()=>[i(t,{id:"qr-reader",style:{width:"100%",height:"100%"}})])),_:1})])),_:1})])),_:1}),i(t,{class:"verifisearch"},{default:c((()=>[i(t,{class:"searchhead"},{default:c((()=>[i(t,{class:"ipt"},{default:c((()=>[i(a,{type:"text",modelValue:d(q),"onUpdate:modelValue":s[0]||(s[0]=e=>f(q)?q.value=e:q=e),placeholder:"请输入卡券编码进行核销",class:"inpCode","placeholder-style":"font-size:28rpx; color: #7985a4ff;"},null,8,["modelValue"])])),_:1}),i(l,{class:"confirmbtn",onClick:k},{default:c((()=>[u("确认")])),_:1})])),_:1}),i(t,{class:"",style:{"box-sizing":"border-box","background-color":"#f8f8f8"}},{default:c((()=>[i(t,{class:"verifilist",style:{"margin-bottom":"24rpx"}},{default:c((()=>[i(t,{class:"listhead",style:{"align-items":"center"}},{default:c((()=>[i(t,{class:"tle"},{default:c((()=>[u(" 核销记录 ")])),_:1}),i(t,{class:"",style:{display:"flex","align-items":"center"},onClick:V},{default:c((()=>[u(" 查看全部 "),i(t,{class:"",style:{"margin-left":"8rpx",width:"32rpx",height:"32rpx",display:"flex","align-items":"center","justify-content":"center"}},{default:c((()=>[i(_,{src:y,mode:"",style:{width:"100%",height:"100%"}})])),_:1})])),_:1})])),_:1}),d(j).arr?(o(),r(t,{key:0,class:"listbottom"},{default:c((()=>[i(t,{class:"",style:{display:"flex","justify-content":"space-between","margin-bottom":"8rpx","padding-top":"24rpx"}},{default:c((()=>[i(t,{class:""},{default:c((()=>[u(" 核销人员:"+p(d(j).arr.name),1)])),_:1}),i(t,{class:"statustab"},{default:c((()=>[u(" 已核销 ")])),_:1})])),_:1}),i(t,{class:"flex"},{default:c((()=>[i(t,{class:"tle"},{default:c((()=>{var e;return[u(p(null==(e=d(j).arr)?void 0:e.coupon_name),1)]})),_:1}),i(t,{class:""},{default:c((()=>[u(" 有效期 : "+p(d(j).arr.closetime),1)])),_:1})])),_:1}),i(t,{class:"flex"},{default:c((()=>[i(t,{class:"tle",style:{"font-size":"28rpx","font-weight":"500"}}),i(t,{class:""},{default:c((()=>[u(" 卡券码: "+p(d(j).arr.receive_no),1)])),_:1})])),_:1})])),_:1})):h("",!0)])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-d4fff105"]]);export{w as default};