product-machine-search.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>搜索-总机具-产品中心-创业帮</title>
  6. <meta name="keywords" content="搜索-总机具-产品中心-创业帮">
  7. <meta name="description" content="搜索-总机具-产品中心-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="搜索-总机具-产品中心-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgc-back h100p ovh">
  18. <div id="app" v-cloak>
  19. <div class="search-box">
  20. <van-search v-model="value" show-action placeholder="请输入机具SN号或扫描" @search="onsearch">
  21. <template #action><span class="vm pl16 pr16 more" @click="goback">取消</span></template>
  22. <template #right-icon><span class="pl8" @click="onScan"><img class="vm" src="./static/images/icon-scan@3x.png" alt="" width="20" height="20"></span></template>
  23. </van-search>
  24. </div>
  25. <van-row v-cloak>
  26. <van-col class="bgcfff" span="24">
  27. <div class="ovh-x" ref="wrapper2">
  28. <van-cell-group class="top_line machine-list" v-for="item,index in transactions" :key="item.Id">
  29. <van-cell :border="false" :value="item.PosSnType" value-class="f12 c333">
  30. <template #title>
  31. <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="copySN(index)" @mouseenter="copySN(index)"><img src="./static/images/icon-copy.png" alt="" width="12" height="12"></span></div>
  32. </template>
  33. </van-cell>
  34. <van-cell class="spcell" :border="false" :title="'来自:'+item.FromStore" title-class="f12 c999">
  35. <template #default v-if="item.BrandName"><span class="brandcard" @click="screenisshow = true">{{item.BrandName}}</span></template>
  36. </van-cell>
  37. <van-cell :border="false" :title="item.CreateDate" title-class="f12 c999"></van-cell>
  38. </van-cell-group>
  39. </div>
  40. </van-col>
  41. </van-row>
  42. </div>
  43. <script src="./static/js/clipboard.min.js"></script>
  44. <script src="./static/js/klm-vv.min.js"></script>
  45. <script src="./static/js/appfunc.min.js"></script>
  46. <script src="./static/js/klm-axios-config.js"></script>
  47. <script src="./static/js/publicfn.js"></script>
  48. <script>
  49. function OnStart(){
  50. app.searchContent = PublicLib.getCookieInfo("ScanContent");
  51. PublicLib.putCookieInfo('ScanContent', '');
  52. //- 拿到扫描结果进行赋值传输
  53. app.getmachinelist();
  54. };
  55. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  56. // 可以通过下面的方式手动注册
  57. Vue.use(vant.Lazyload);
  58. PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  59. // 在 #app 标签下渲染一个按钮组件
  60. let app = new Vue({
  61. el: '#app',
  62. data() {
  63. return {
  64. copyBtn: {},
  65. transactions: [
  66. ],
  67. value: '',
  68. loading: false,
  69. error: false,
  70. finished: false,
  71. refreshing: false,
  72. pageinfo:{
  73. PageSize:100,
  74. PageNum:1
  75. }
  76. };
  77. },
  78. beforeUpdate() {
  79. this.$nextTick(() => {
  80. this.$refs.wrapper2.style.height = `${document.documentElement.clientHeight - 55}px`;
  81. });
  82. },
  83. methods: {
  84. giveToast(str){
  85. vant.Toast(str);
  86. },
  87. copySN(index){
  88. const that = this;
  89. this.$nextTick(() => {
  90. that.copyBtn = new ClipboardJS(this.$refs['copy'+index][0]);
  91. const clipboard = that.copyBtn;
  92. clipboard.on('success', function(e) {
  93. that.giveToast('复制成功');
  94. });
  95. clipboard.on('error', function(e) {
  96. that.giveToast('复制失败,请手动选择复制!');
  97. });
  98. });
  99. },
  100. onsearch(){
  101. this.getmachinelist();
  102. },
  103. goback() {
  104. PublicLib.GoBack({Level:1});
  105. },
  106. onScan(){
  107. PublicLib.ScanQRCode();
  108. },
  109. async getmachinelist(){
  110. //- PublicLib.ShowLoading({Message:''});
  111. const machinesearchType = PublicLib.getCookieInfo('machinesearchType');
  112. let Url = '';
  113. switch(machinesearchType){
  114. case 'total':
  115. Url = 'api/v1/pos/posmachines/mymachines?t='+Math.random(6);
  116. break;
  117. case 'bind':
  118. Url = 'api/v1/pos/posmachines/mymachinesforbind?t='+Math.random(6);
  119. break;
  120. case 'unbind':
  121. Url = 'api/v1/pos/posmachines/mymachinesforunbind?t='+Math.random(6);
  122. break;
  123. };
  124. const BrandId = PublicLib.getCookieInfo('productMachineId');
  125. const UserId = PublicLib.getCookieInfo('userId');
  126. const res = await getRequest(Url,JSON.stringify({...this.pageinfo,BrandId,UserId,SnNo:this.value,BrandSubId:''}));
  127. if(res.status !== '1')return tips('机具列表获取失败!');
  128. //- PublicLib.HideLoading();
  129. this.transactions=res.data;
  130. },
  131. }
  132. });
  133. </script>
  134. </body>
  135. </html>