mall-warehouse-list.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 pt0 ovh" style="padding-top:0;">
  18. <div class="warehouse" id="app">
  19. <van-nav-bar class="user_rank_explan_title user_title_normal f16" title="发货仓库" left-arrow @click-left="goback" v-if="toptitleisshow" v-cloak>
  20. <template #left> <img src="./static/images/icon-comback@2x.png" alt=""></template>
  21. </van-nav-bar>
  22. <van-search class="top_search" v-model="searchContent" show-action placeholder="根据仓库名称搜索" @search="onSearch">
  23. <template #action>
  24. <div class="searchcolor" @click="onSearch">搜索</div>
  25. </template>
  26. </van-search>
  27. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="list.length === 0 ? 'isnodata':''">
  28. <div class="warehouse-list" style="height:calc(100vh - 20px);" v-cloak>
  29. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  30. <van-list v-model="loading" :finished="finished" @load="onLoad" :immediate-check="false">
  31. <van-address-list v-model="chosenAddressId" :list="list" @select="onSelected"></van-address-list>
  32. </van-list>
  33. </div>
  34. </van-pull-refresh>
  35. <van-goods-action class="mall-bottom">
  36. <van-goods-action-button type="default" color="#FFD500" style="color:#333;" text="确认" @click="onClickButton"></van-goods-action-button>
  37. </van-goods-action>
  38. </div>
  39. <script src="./static/js/klm-vv.min.js"></script>
  40. <script src="./static/js/appfunc.min.js"></script>
  41. <script src="./static/js/klm-axios-config.js"></script>
  42. <script src="./static/js/publicfn.js"></script>
  43. <script>
  44. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  45. // 可以通过下面的方式手动注册
  46. Vue.use(vant.Lazyload);
  47. // 在 #app 标签下渲染一个按钮组件
  48. let app = new Vue({
  49. el: '#app',
  50. data() {
  51. return {
  52. searchContent:'',
  53. isnodata:false,
  54. toptitleisshow:false,
  55. active: 0,
  56. chosenAddressId: 0,
  57. list: [
  58. ],
  59. checkaddressId:'',
  60. pageinfo:{
  61. PageSize:10,
  62. PageNum:1
  63. },
  64. loading: false,
  65. finished: false,
  66. refreshing: false,
  67. };
  68. },
  69. created() {
  70. this.toptitleisshow = toptitleisshow;
  71. this.getwarehouselist();
  72. },
  73. methods: {
  74. onLoad() {
  75. this.pageinfo.PageNum++;
  76. this.getwarehouselist();
  77. console.log(2)
  78. },
  79. onRefresh() {
  80. this.pageinfo.PageNum = 0;
  81. // 清空列表数据
  82. this.finished = false;
  83. // 重新加载数据
  84. // 将 loading 设置为 true,表示处于加载状态
  85. this.loading = true;
  86. this.refreshing = false;
  87. this.pageinfo.PageNum = 1;
  88. this.getfirwarehouselist();
  89. },
  90. onSelected(item) {
  91. this.checkaddressId = item.Id;
  92. },
  93. goback(){
  94. PublicLib.GoBack({Level:1});
  95. },
  96. async getwarehouselist(){
  97. //- PublicLib.ShowLoading({Message:''});
  98. const UserId = PublicLib.getCookieInfo('userId');
  99. const BrandId = PublicLib.getCookieInfo('wareBrandId');
  100. const res = await getRequest('api/v1/storehouse/sendstores?t='+Math.random(6),JSON.stringify({UserId,...this.pageinfo,searchContent:this.searchContent,BrandId}));
  101. if(res.status !== '1') return tips('获取仓库列表失败,请重试!')
  102. //- PublicLib.HideLoading();
  103. if(res.data.length<this.pageinfo.PageSize) {
  104. this.finished = true;
  105. };
  106. this.list.push(...this.addressfn(res.data));
  107. this.loading = false;
  108. if(this.list.length === 0) {this.isnodata = true}else{this.isnodata = false};
  109. },
  110. async getfirwarehouselist(){
  111. //- PublicLib.ShowLoading({Message:''});
  112. const UserId = PublicLib.getCookieInfo('userId');
  113. const BrandId = PublicLib.getCookieInfo('wareBrandId');
  114. const res = await getRequest('api/v1/storehouse/sendstores?t='+Math.random(6),JSON.stringify({UserId,...this.pageinfo,searchContent:this.searchContent,BrandId}));
  115. if(res.status !== '1') return tips('获取仓库列表失败,请重试!')
  116. //- PublicLib.HideLoading();
  117. if(res.data.length<this.pageinfo.PageSize) {
  118. this.finished = true;
  119. };
  120. this.list = this.addressfn(res.data);
  121. this.loading = false;
  122. if(this.list.length === 0) {this.isnodata = true}else{this.isnodata = false};
  123. },
  124. //- 地址列表处理函数
  125. addressfn(data){
  126. data.forEach((item,index)=>{
  127. item.name = item.StoreName+`(库存${item.LaveNum}台)`;
  128. item.address = item.Areas + item.Address ;
  129. item.tel = '';
  130. item.id = item.Id;
  131. })
  132. return data;
  133. },
  134. //- 确认按钮
  135. onClickButton(){
  136. if(this.checkaddressId === '') return tips('请选择发货仓库');
  137. PublicLib.putCookieInfo('warehouseId', this.checkaddressId);
  138. PublicLib.GoBack({Level:1});
  139. },
  140. onSearch(){
  141. this.list = [];
  142. this.getwarehouselist();
  143. },
  144. }
  145. });
  146. </script>
  147. </body>
  148. </html>