123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <view class="pages">
- <view class="" :style="{height: navHeight+'px' }"></view>
- <view class="page-wrap">
- <view class="title-wrap">
- <img style="width: 226rpx;height: 108rpx" src="../../static/img/index-title.png" alt="">
- </view>
- <view class="search-wrap u-flex">
- <u-search
- placeholder="请输入核销码"
- color="#009AEF"
- searchIconColor="#009AEF"
- bgColor="#F5F9FC"
- @search="getCheckGoods"
- @custom="getCheckGoods"
- @clear="clearCode"
- :inputStyle="{height:'88rpx'}"
- :actionStyle="{'background-color':'#3ebbff',width:'88rpx',height:'88rpx','line-height':'88rpx',color:'#fff','border-radius':'16rpx'}"
- v-model="exchangeCode">
- </u-search>
- <view class="qr-link" @click="openScan"></view>
- </view>
- <view class="goods-wrap" v-if="showResult&&showEmpty==false">
- <view class="title">搜索结果</view>
- <view class="goods u-flex u-col-top">
- <img class="img" :src="checkGoods.mainImg" alt="">
- <view class="text">
- <view class="title ellipsis-2">{{checkGoods.goodsName}}</view>
- <view class="credit">{{checkGoods.credit}}积分</view>
- <view class="bottom u-flex u-row-between">
- <view class="left">
- <view class="quantity">兑换数量:{{checkGoods.quantity}}</view>
- <view class="userinfo">姓名:{{checkGoods.name}} / {{checkGoods.dept}} </view>
- </view>
- <u-button
- @click.native.stop="check()"
- type="primary"
- :customStyle="{height:'58rpx',width: 'auto','margin-right': 'unset'}"
- text="核销">
- </u-button>
- </view>
- </view>
- </view>
- </view>
- <u-empty mode="data" :text="emptyText" v-if="showEmpty&&!showResult"></u-empty>
-
- <tabbar :tabbarIndexProps='0' />
- </view>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import { systemInfo } from "@/mixin.js";
- import {
- BrowserMultiFormatReader,
- ChecksumException,
- FormatException,
- } from "@zxing/library";
- import { LOG } from "@zxing/library/esm/core/datamatrix/encoder/constants";
- import tabbar from "../../components/tabbar.vue";
- export default {
- components:{
- tabbar,
- },
- mixins:[systemInfo],
- data() {
- return {
- exchangeCode:'',
- checkGoods:{},
- showResult:false,
- emptyText:'',
- showEmpty:false,
- }
- },
- onLoad() {
- let that = this;
- this.getMemberInfo();
- // this.initEvent()
-
- },
- mounted() {
- },
- onShow() {
- this.exchangeCode = this.vuexExchangeCode;
- },
- beforeDestroy() {
-
- },
- watch: {
- exchangeCode:{
- handler(val){
- if(val.length>=8){
- this.getCheckGoods()
- }
- }
- }
- },
- methods: {
- getCheckGoods(){
- this.$u.api.getCheckGood({exchangeCode:this.exchangeCode}).then(res=>{
- this.checkGoods = res.data;
- this.showResult = true;
- this.showEmpty = false;
- // console.log('getCheckGood',this.checkGoods);
- }).catch(err=>{
- this.showEmpty = true;
- this.showResult = false;
- this.emptyText = err.msg;
- console.log('getCheckGood',err);
- })
- },
- clearCode(){
- this.showEmpty = true;
- this.showResult = true;
- },
- check(){//核销
- this.$u.api.check({exchangeCode:this.exchangeCode}).then(res=>{
- this.checkGoods = {};
- this.showResult = false;
- uni.showToast({
- title:res.msg,
- icon:"success"
- })
- this.$u.vuex('vuexExchangeCode', '');
- uni.reLaunch({url: `/center/checksuccess?success=true`});
- // console.log('check',this.checkGoods);
- }).catch(err=>{
- console.log('check',err);
- })
- },
- async openScan() {
- // uni.$u.route('/center/scan');
- uni.navigateTo({
- url:'/center/scan',
- fail(e) {
- console.log('navigateTo',e);
- }
- })
-
- },
- getMemberInfo(){
- this.$u.api.memberInfo().then(res=>{
- this.$u.vuex('vuex_member_info', res.data);
- }).catch(err=>{
- console.log('memberInfo',err.data);
- })
- },
-
- }
- }
- </script>
- <style>
- page{
- background-color: #fff;
- }
- </style>
- <style lang="scss" scoped>
- .title-wrap{
- text-align: center;
- margin: 100rpx auto 60rpx;
- }
- .qr-link{
- margin-left: 10rpx;
- width: 88rpx;
- height: 88rpx;
- background: url(../../static/img/qr-ico.png) no-repeat center;
- background-color: rgba(0,154,239,0.2);
- border-radius: 16rpx;
- }
- .loop_line {
- height: 3px;
- width: 80%;
- background-color: aliceblue;
- border-radius: 50%;
- box-shadow: 1px -4px 25px 7px rgba(255, 255, 255, 0.5);
- position: absolute;
- left: 50%;
- top: 5%;
- transform: translateX(-50%);
- animation: myfirst 3s infinite;
- z-index: 999999;
- }
- @keyframes myfirst {
- from {
- top: 5%;
- }
- to {
- top: 80%;
- }
- }
- #video_nav_id {
- height: 100%;
- width: 100%;
- }
- /deep/.uni-video-cover {
- display: none;
- }
- .scan {
- position: fixed;
- left: 0;
- top: 0;
- z-index: 99;
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #ff9900;
- width: 100%;
- height: 100vh;
- background: #000;
- .video-container {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- /deep/ #video-1{
- width: 100%;
- height: 100%;
- }
- @media (min-width: 500px) {
- video {
- // width: 80vh;
- max-width: 96vw;
- height: 80vh;
- }
- }
- }
- .camera-container {
- margin-top: 5vh;
- width: 80%;
- height: 50px;
- line-height: 44px;
- border-radius: 10px;
- border: 3px solid #ff9900;
- display: flex;
- justify-content: center;
- select {
- width: calc(100% - 80px);
- color: #ff9900;
- background: transparent;
- border: none;
- outline: none;
- }
- }
- .close{
- position: absolute;
- right: 40rpx;
- top: 40rpx;
- z-index: 100;
- }
- }
- .goods-wrap{
- margin-top: 42rpx;
- .title{
- font-size: 32rpx;
- font-weight: 400;
- color: #999999;
- line-height: 44rpx;
- margin-bottom: 20rpx;
- }
- .goods{
- padding: 28rpx 0;
- background-color: #fff;
- .img{
- width: 200rpx;
- height: 202rpx;
- }
- .text{
- flex: 1;
- margin-left: 40rpx;
- .title{
- font-size: 30rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 42rpx;
- margin-bottom: 20rpx;
- }
- .credit{
- font-size: 32rpx;
- font-family: PingFangSC-Semibold, PingFang SC;
- font-weight: 600;
- color: #FFB100;
- line-height: 44rpx;
- margin-bottom: 20rpx;
- }
- .left{
- font-size: 28rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #999999;
- line-height: 40rpx;
- }
- }
- &:not(:last-of-type){
- border-bottom: 0.5px solid #ddd;
- padding-bottom: 20rpx;
- }
- }
- }
- </style>
|