bind-detail-sound-replace.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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="bgcf5f5f5 pb0 ovh" style="padding-top:0; height:100vh;">
  18. <div id="app" v-cloak>
  19. <van-nav-bar class="mall_title bottom_line" title="替换音响码" v-if="toptitleisshow" @click-left="goback">
  20. <template #left> <img src="./static/images/left.png" alt=""></template>
  21. </van-nav-bar>
  22. <div class="ovx-y">
  23. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="min-height:90vh;" :class="codelist.length === 0 ? 'isnodata':''">
  24. <van-empty class="custom-image" image="./static/images/no-data.png" description="您的门店暂未绑定音响" v-if="codelist.length === 0"> </van-empty>
  25. <van-radio-group v-model="result">
  26. <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad" :immediate-check="false">
  27. <div class="bind_detail_collection bgcfff" v-for="item,index in codelist" :key="index" @click="toggle(index)">
  28. <div class="bind_detail_collection_card df bgcfff replacebl">
  29. <van-radio :name="item" ref="checkboxes" checked-color="#FD824D"> </van-radio><img src="./static/images/index-collectioncode.png" alt="">
  30. <div class="card_info">
  31. <div class="df">
  32. <nobr class="f12 c999 title">绑定时间</nobr>
  33. <div class="f12 c999 content">{{item.BindingTime}}</div>
  34. </div>
  35. <div class="df">
  36. <nobr class="f12 c999 title">SN码</nobr>
  37. <div class="f12 c999 content">{{item.PosSn}}</div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </van-list>
  43. </van-radio-group>
  44. </van-pull-refresh>
  45. </div>
  46. <van-goods-action class="mall-bottom">
  47. <van-goods-action-button color="#FD824D" text="确认替换" @click="onClickButton"></van-goods-action-button>
  48. </van-goods-action>
  49. <van-dialog class="option" style="border-radius:4px;" v-model="dialogisshow" message="确认替换音响码?" width="300" confirm-button-text="确认替换" show-cancel-button @confirm="replace" @cancel="dialogisshow = false"> </van-dialog>
  50. </div>
  51. <script src="./static/js/klm-vv.min.js"></script>
  52. <script src="./static/js/klm-axios-config.js"></script>
  53. <script>
  54. function OnStart(){
  55. };
  56. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  57. // 可以通过下面的方式手动注册
  58. Vue.use(vant.Lazyload);
  59. // 在 #app 标签下渲染一个按钮组件
  60. let app = new Vue({
  61. el: '#app',
  62. data() {
  63. return {
  64. roundisshow:'',
  65. result:[],
  66. dialogisshow:false,
  67. toptitleisshow:false,
  68. loading: false,
  69. finished: false,
  70. refreshing: false,
  71. codelist:[
  72. ],
  73. qrcodeId:'',
  74. pageinfo:{
  75. PageSize:10,
  76. PageNum:1,
  77. }
  78. };
  79. },
  80. created() {
  81. this.toptitleisshow = toptitleisshow;
  82. this.qrcodeId = PublicLib.getCookieInfo('collectionId');
  83. this.getsoundcodelist();
  84. },
  85. methods: {
  86. goback(){
  87. PublicLib.GoBack({Level:1});
  88. },
  89. onRefresh(){
  90. this.loading = false;
  91. this.refreshing = true;
  92. this.onLoad();
  93. },
  94. onLoad() {
  95. if (this.refreshing) {
  96. this.codelist = [];
  97. this.refreshing = false;
  98. this.pageinfo.PageNum = 0;
  99. }
  100. this.pageinfo.PageNum++;
  101. this.getsoundcodelist();
  102. },
  103. roundisshowfn(id){
  104. console.log(id)
  105. if(id === this.roundisshow) {
  106. return this.roundisshow = '';
  107. };
  108. this.roundisshow = id;
  109. },
  110. toggle(index) {
  111. this.$refs.checkboxes[index].toggle();
  112. },
  113. onClickButton(){
  114. if(this.result.length === 0 ){
  115. return;
  116. }
  117. this.dialogisshow = true;
  118. },
  119. replace(){
  120. this.onreplacecode();
  121. },
  122. //- 获取音响码列表
  123. async getsoundcodelist(){
  124. let BindMerchantId = PublicLib.getCookieInfo('userId');
  125. const res = await getRequest('/api/v1/posmachines/replacemachines?t='+Math.random(6),JSON.stringify({...this.pageinfo,BindMerchantId}));
  126. if(res.status !== '1' ) return tips(res.info);
  127. if(res.data.length < this.pageinfo.PageSize){
  128. this.finished = true;
  129. };
  130. this.codelist.push(...res.data);
  131. this.loading = false;
  132. },
  133. //- 替换音响码
  134. async onreplacecode(){
  135. let MerchantId = PublicLib.getCookieInfo('userId');
  136. const res = await postRequest('/api/v1/merchantqrcode/confirmreplace?t='+Math.random(6),JSON.stringify({MerchantId,MachineId:this.qrcodeId,QrCodeId:this.result.Id}));
  137. if(res.status !== '1' ) return tips(res.info);
  138. tips('替换音响码成功!');
  139. //- TODO:去除已经替换音响吗
  140. }
  141. }
  142. });
  143. </script>
  144. </body>
  145. </html>