123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>搜索-总机具-产品中心-创业帮</title>
- <meta name="keywords" content="搜索-总机具-产品中心-创业帮">
- <meta name="description" content="搜索-总机具-产品中心-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="搜索-总机具-产品中心-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- <style>
- .top0{
- top:0;
- z-index:-1;
- }
- </style>
- </head>
- <body class="bgc-back h100p ovh">
- <div class="transfer" id="app" v-cloak>
- <div class="bgcfff abs top0" ref="wrapper2" style="width:100%;"></div>
- <div class="search-box">
- <van-search v-model="value" show-action placeholder="请输入机具SN号或扫描" @search="onsearch">
- <template #action><span class="vm pl16 pr16 more" @click="goback">取消</span></template>
- <template #right-icon>
- <div class="pl8" @click="onScan"><img class="vm" src="./static/images/icon-scan@3x.png" alt="" width="20" height="20"></div>
- </template>
- </van-search>
- </div>
- <van-cell class="alltransfer" title="全选" clickable @click="toggleSelectAll">
- <template #icon>
- <van-checkbox class="mr16" name="selectedNum" v-model="SelectedAll" checked-color="#ec5e3b"></van-checkbox>
- </template>
- <template #default><span @click.stop="transfer">划拨</span></template>
- </van-cell>
- <van-row v-cloak>
- <van-col class="bgcfff" span="24">
- <van-checkbox-group v-model="result">
- <van-cell-group>
- <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="index" :value="item.PosSnType" value-class="f14 c333" @click="toggle(index)">
- <template #title>
- <div class="f14 c333"><span class="vm">SN:</span><span class="vm pr6" :id="'sn'+index">{{item.PosSn}}</span><span class="dib vm" :data-clipboard-text="item.PosSn" data-clipboard-action="copy" :data-clipboard-target="'#sn'+index" :ref="'copy'+index" @click.stop="copySN(index)" @mouseenter="copySN(index)"><img src="./static/images/icon-copy.png" alt="" width="14" height="14"></span></div>
- </template>
- <template #icon>
- <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#ec5e3b"></van-checkbox>
- </template>
- <template #label>
- <div class="f12 more">活动剩余天数{{item.ActDays}}天(截止{{item.EndDate}})</div>
- </template>
- </van-cell>
- </van-cell-group>
- </van-checkbox-group>
- </van-col>
- </van-row>
- <van-overlay :show="nextshow" @click="closenextshow">
- <div class="unbindpop cm">
- <div class="unbindcard tc" @click.stop>
- <div class="f12 tc c666 title">总共划拨{{result.length}}台,请仔细核对SN号及姓名是否正确</div>
- <input type="text" v-model="createercode" placeholder="请输入创客编号" @focus="inputbtn">
- <div class="f12 tc c333 title" v-if="createrinfo.RealName !== ''">姓名:{{createrinfo.RealName}}</div>
- <div class="nextbutton cfff cm mt16 f14" @click="diaolignextbtn">{{createrinfo.RealName === ''? '下一步' : '确认无误划拨'}}</div>
- </div>
- </div>
- </van-overlay>
- </div>
- <script src="./static/js/clipboard.min.js"></script>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"></script>
- <script>
- function OnStart(){
- allSearchContent = PublicLib.getCookieInfo("ScanContent");
- PublicLib.putCookieInfo('ScanContent', '');
- //- 拿到扫描结果进行赋值传输
- if(allSearchContent === undefined){
- return;
- };
- if(allSearchContent !== ''){
- app.getmachinelist(allSearchContent);
- };
- };
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
- PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
- //- PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- copyBtn: {},
- transactions: [
- ],
- result:[],
- value: '',
- loading: false,
- error: false,
- finished: false,
- refreshing: false,
- pageinfo:{
- PageSize:100,
- PageNum:1
- },
- SelectedAll: false,
- nextshow:false,
- createrinfo:{
- RealName:'',
- Id:'',
- },
- createercode:'',
- }
- },
- //- mounted(){
- //- scan(this.searchContent,this.getmachinelist);
- //- this.searchContent = PublicLib.getCookieInfo("ScanContent") && JSON.parse(PublicLib.getCookieInfo("ScanContent")).scan
- //- if(this.searchContent !== '') {
- //- this.getmachinelist();
- //- }
- //- PublicLib.putCookieInfo('ScanContent', '');
- //- },
- mounted(){
- this.$refs.wrapper2.style.height = `${Func.getStatusBarHeight()}px`;
- },
- methods: {
- //- 输入框按钮
- inputbtn(){
- this.createrinfo.RealName = '';
- },
- //- 显示提示
- giveToast(str){
- vant.Toast(str);
- },
- //- 复制SN号
- copySN(index){
- const that = this;
- this.$nextTick(() => {
- that.copyBtn = new ClipboardJS(this.$refs['copy'+index][0]);
- const clipboard = that.copyBtn;
- clipboard.on('success', function(e) {
- that.giveToast('复制成功');
- });
- clipboard.on('error', function(e) {
- that.giveToast('复制失败,请手动选择复制!');
- });
- });
- },
- //- 全选按钮
- toggleSelectAll(){
- const that = this;
- that.SelectedAll = !that.SelectedAll;
- if(that.SelectedAll){
- that.result = that.transactions;
- }else{
- that.result = [];
- };
- },
- //- 单选按钮
- toggle(index) {
- const that = this;
- this.$refs.checkboxes[index].toggle();
- setTimeout(() => {
- if(that.result.length === that.transactions.length) {
- that.SelectedAll = true;
- } else {
- that.SelectedAll = false;
- };
- },10);
- },
- //- 搜索
- onsearch(){
- this.SelectedAll = false;
- this.result = [];
- this.getmachinelist();
- },
- //- 返回
- goback() {
- PublicLib.GoBack({Level:1});
- },
- //- 扫码功能
- onScan(){
- PublicLib.ScanQRCode();
- },
- //- 获取机具列表
- async getmachinelist(info){
- if(info){
- this.value = info;
- };
- const machinesearchType = PublicLib.getCookieInfo('machinesearchType');
- let Url = '';
- switch(machinesearchType){
- case 'whole':
- Url = 'api/v1/posmachines/wholesearch?t='+Math.random(6);
- break;
- case 'total':
- Url = 'api/v1/pos/posmachines/mymachines?t='+Math.random(6);
- break;
- case 'bind':
- Url = 'api/v1/pos/posmachines/mymachinesforbind?t='+Math.random(6);
- break;
- case 'unbind':
- Url = 'api/v1/pos/posmachines/mymachinesforunbind?t='+Math.random(6);
- break;
- };
- //- PublicLib.ShowLoading({Message:''});
- const BrandId = PublicLib.getCookieInfo('productMachineId');
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest(Url,JSON.stringify({...this.pageinfo,BrandId,UserId,SnNo:this.value,BrandSubId:''}));
- console.log(res)
- if(res.status !== '1') return tips('机具列表获取失败!');
- //- PublicLib.HideLoading();
- //- res.data.forEach(item=>{
- //- item.PosSn = '151561561561'
- //- });
- this.transactions=res.data;
- },
- //- 下一步显示
- transfer(){
- if(this.result.length === 0) return;
- this.nextshow = true;
- },
- //- 确认按钮
- diaolignextbtn:undebounce(async function(){
- if(this.createercode === '') return tips('请输入创客号');
- if(this.createrinfo.RealName === '') {
- const res = await getRequest('api/v1/users/forcode?t='+Math.random(6),JSON.stringify({MakerCode:this.createercode}));
- if(res.status !== '1')return tips(res.info);
- this.createrinfo = res.data;
- } else{
- const SnIds = this.result.map(item=>{
- return item.Id;
- }).join(',');
- const BrandId = PublicLib.getCookieInfo('productMachineId');
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await postRequest('api/v1/pos/userstorechange/transfer?t='+Math.random(6),JSON.stringify({BrandId,UserId,SnIds,ToUserId:this.createrinfo.Id}));
- if(res.status !== '1')return tips(res.info);
- tips('机具划拨申请提交成功!')
- this.nextshow = false;
- this.createrinfo = {RealName:'',Id:''};
- this.createercode = '';
- this.result=[];
- this.SelectedAll = false;
- PublicLib.putCookieInfo('isallbacktransfer', 'true');
- setTimeout(()=>{
- this.goback();
- },2000);
- }
- }),
- //- 关闭弹出层
- closenextshow(){
- this.nextshow = false;
- this.createercode = '';
- this.createrinfo.RealName = '';
- },
- }
- });
- </script>
- </body>
- </html>
|