product-machine-all-transfer.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. <style>
  17. .top0{
  18. top:0;
  19. z-index:-1;
  20. }
  21. </style>
  22. </head>
  23. <body class="bgc-back h100p ovh">
  24. <div class="transfer" id="app" v-cloak>
  25. <div class="bgcfff abs top0" ref="wrapper2" style="width:100%;"></div>
  26. <div class="search-box">
  27. <van-search v-model="value" show-action placeholder="请输入机具SN号或扫描" @search="onsearch">
  28. <template #action><span class="vm pl16 pr16 more" @click="goback">取消</span></template>
  29. <template #right-icon>
  30. <div class="pl8" @click="onScan"><img class="vm" src="./static/images/icon-scan@3x.png" alt="" width="20" height="20"></div>
  31. </template>
  32. </van-search>
  33. </div>
  34. <van-cell class="alltransfer" title="全选" clickable @click="toggleSelectAll">
  35. <template #icon>
  36. <van-checkbox class="mr16" name="selectedNum" v-model="SelectedAll" checked-color="#ec5e3b"></van-checkbox>
  37. </template>
  38. <template #default><span @click.stop="transfer">划拨</span></template>
  39. </van-cell>
  40. <van-row v-cloak>
  41. <van-col class="bgcfff" span="24">
  42. <van-checkbox-group v-model="result">
  43. <van-cell-group>
  44. <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="index" :value="item.PosSnType" value-class="f14 c333" @click="toggle(index)">
  45. <template #title>
  46. <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>
  47. </template>
  48. <template #icon>
  49. <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#ec5e3b"></van-checkbox>
  50. </template>
  51. <template #label>
  52. <div class="f12 more">活动剩余天数{{item.ActDays}}天(截止{{item.EndDate}})</div>
  53. </template>
  54. </van-cell>
  55. </van-cell-group>
  56. </van-checkbox-group>
  57. </van-col>
  58. </van-row>
  59. <van-overlay :show="nextshow" @click="closenextshow">
  60. <div class="unbindpop cm">
  61. <div class="unbindcard tc" @click.stop>
  62. <div class="f12 tc c666 title">总共划拨{{result.length}}台,请仔细核对SN号及姓名是否正确</div>
  63. <input type="text" v-model="createercode" placeholder="请输入创客编号" @focus="inputbtn">
  64. <div class="f12 tc c333 title" v-if="createrinfo.RealName !== ''">姓名:{{createrinfo.RealName}}</div>
  65. <div class="nextbutton cfff cm mt16 f14" @click="diaolignextbtn">{{createrinfo.RealName === ''? '下一步' : '确认无误划拨'}}</div>
  66. </div>
  67. </div>
  68. </van-overlay>
  69. </div>
  70. <script src="./static/js/clipboard.min.js"></script>
  71. <script src="./static/js/klm-vv.min.js"></script>
  72. <script src="./static/js/appfunc.min.js"></script>
  73. <script src="./static/js/klm-axios-config.js"></script>
  74. <script src="./static/js/publicfn.js"></script>
  75. <script>
  76. function OnStart(){
  77. allSearchContent = PublicLib.getCookieInfo("ScanContent");
  78. PublicLib.putCookieInfo('ScanContent', '');
  79. //- 拿到扫描结果进行赋值传输
  80. if(allSearchContent === undefined){
  81. return;
  82. };
  83. if(allSearchContent !== ''){
  84. app.getmachinelist(allSearchContent);
  85. };
  86. };
  87. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  88. // 可以通过下面的方式手动注册
  89. Vue.use(vant.Lazyload);
  90. PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  91. //- PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  92. // 在 #app 标签下渲染一个按钮组件
  93. let app = new Vue({
  94. el: '#app',
  95. data() {
  96. return {
  97. copyBtn: {},
  98. transactions: [
  99. ],
  100. result:[],
  101. value: '',
  102. loading: false,
  103. error: false,
  104. finished: false,
  105. refreshing: false,
  106. pageinfo:{
  107. PageSize:100,
  108. PageNum:1
  109. },
  110. SelectedAll: false,
  111. nextshow:false,
  112. createrinfo:{
  113. RealName:'',
  114. Id:'',
  115. },
  116. createercode:'',
  117. }
  118. },
  119. //- mounted(){
  120. //- scan(this.searchContent,this.getmachinelist);
  121. //- this.searchContent = PublicLib.getCookieInfo("ScanContent") && JSON.parse(PublicLib.getCookieInfo("ScanContent")).scan
  122. //- if(this.searchContent !== '') {
  123. //- this.getmachinelist();
  124. //- }
  125. //- PublicLib.putCookieInfo('ScanContent', '');
  126. //- },
  127. mounted(){
  128. this.$refs.wrapper2.style.height = `${Func.getStatusBarHeight()}px`;
  129. },
  130. methods: {
  131. //- 输入框按钮
  132. inputbtn(){
  133. this.createrinfo.RealName = '';
  134. },
  135. //- 显示提示
  136. giveToast(str){
  137. vant.Toast(str);
  138. },
  139. //- 复制SN号
  140. copySN(index){
  141. const that = this;
  142. this.$nextTick(() => {
  143. that.copyBtn = new ClipboardJS(this.$refs['copy'+index][0]);
  144. const clipboard = that.copyBtn;
  145. clipboard.on('success', function(e) {
  146. that.giveToast('复制成功');
  147. });
  148. clipboard.on('error', function(e) {
  149. that.giveToast('复制失败,请手动选择复制!');
  150. });
  151. });
  152. },
  153. //- 全选按钮
  154. toggleSelectAll(){
  155. const that = this;
  156. that.SelectedAll = !that.SelectedAll;
  157. if(that.SelectedAll){
  158. that.result = that.transactions;
  159. }else{
  160. that.result = [];
  161. };
  162. },
  163. //- 单选按钮
  164. toggle(index) {
  165. const that = this;
  166. this.$refs.checkboxes[index].toggle();
  167. setTimeout(() => {
  168. if(that.result.length === that.transactions.length) {
  169. that.SelectedAll = true;
  170. } else {
  171. that.SelectedAll = false;
  172. };
  173. },10);
  174. },
  175. //- 搜索
  176. onsearch(){
  177. this.SelectedAll = false;
  178. this.result = [];
  179. this.getmachinelist();
  180. },
  181. //- 返回
  182. goback() {
  183. PublicLib.GoBack({Level:1});
  184. },
  185. //- 扫码功能
  186. onScan(){
  187. PublicLib.ScanQRCode();
  188. },
  189. //- 获取机具列表
  190. async getmachinelist(info){
  191. if(info){
  192. this.value = info;
  193. };
  194. const machinesearchType = PublicLib.getCookieInfo('machinesearchType');
  195. let Url = '';
  196. switch(machinesearchType){
  197. case 'whole':
  198. Url = 'api/v1/posmachines/wholesearch?t='+Math.random(6);
  199. break;
  200. case 'total':
  201. Url = 'api/v1/pos/posmachines/mymachines?t='+Math.random(6);
  202. break;
  203. case 'bind':
  204. Url = 'api/v1/pos/posmachines/mymachinesforbind?t='+Math.random(6);
  205. break;
  206. case 'unbind':
  207. Url = 'api/v1/pos/posmachines/mymachinesforunbind?t='+Math.random(6);
  208. break;
  209. };
  210. //- PublicLib.ShowLoading({Message:''});
  211. const BrandId = PublicLib.getCookieInfo('productMachineId');
  212. const UserId = PublicLib.getCookieInfo('userId');
  213. const res = await getRequest(Url,JSON.stringify({...this.pageinfo,BrandId,UserId,SnNo:this.value,BrandSubId:''}));
  214. console.log(res)
  215. if(res.status !== '1') return tips('机具列表获取失败!');
  216. //- PublicLib.HideLoading();
  217. //- res.data.forEach(item=>{
  218. //- item.PosSn = '151561561561'
  219. //- });
  220. this.transactions=res.data;
  221. },
  222. //- 下一步显示
  223. transfer(){
  224. if(this.result.length === 0) return;
  225. this.nextshow = true;
  226. },
  227. //- 确认按钮
  228. diaolignextbtn:undebounce(async function(){
  229. if(this.createercode === '') return tips('请输入创客号');
  230. if(this.createrinfo.RealName === '') {
  231. const res = await getRequest('api/v1/users/forcode?t='+Math.random(6),JSON.stringify({MakerCode:this.createercode}));
  232. if(res.status !== '1')return tips(res.info);
  233. this.createrinfo = res.data;
  234. } else{
  235. const SnIds = this.result.map(item=>{
  236. return item.Id;
  237. }).join(',');
  238. const BrandId = PublicLib.getCookieInfo('productMachineId');
  239. const UserId = PublicLib.getCookieInfo('userId');
  240. const res = await postRequest('api/v1/pos/userstorechange/transfer?t='+Math.random(6),JSON.stringify({BrandId,UserId,SnIds,ToUserId:this.createrinfo.Id}));
  241. if(res.status !== '1')return tips(res.info);
  242. tips('机具划拨申请提交成功!')
  243. this.nextshow = false;
  244. this.createrinfo = {RealName:'',Id:''};
  245. this.createercode = '';
  246. this.result=[];
  247. this.SelectedAll = false;
  248. PublicLib.putCookieInfo('isallbacktransfer', 'true');
  249. setTimeout(()=>{
  250. this.goback();
  251. },2000);
  252. }
  253. }),
  254. //- 关闭弹出层
  255. closenextshow(){
  256. this.nextshow = false;
  257. this.createercode = '';
  258. this.createrinfo.RealName = '';
  259. },
  260. }
  261. });
  262. </script>
  263. </body>
  264. </html>