warehouse-management.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. .allnum{padding:8px 15px 8px 0;border-bottom:1px solid #eee;margin-left:15px;}
  18. .van-tab__pane .ovh-x{padding-bottom:50px; box-sizing:border-box;}
  19. .cfff-btn .van-button__text{color:#fff !important;}
  20. .pb0{padding-bottom:0px !important;}
  21. .van-list{min-height:50vh;}
  22. .mall-bottom{padding:0 .3733rem;height:54px;}
  23. .mall-bottom .button{border-radius:999px !important; height:80% !important;width:100%;}
  24. </style>
  25. </head>
  26. <body class="pb0 pt0 ovh" style="padding-top:0;background-color:#f6f6f6;height:100vh;">
  27. <div class="warehouse rel" id="app" v-cloak>
  28. <van-nav-bar class="user_rank_explan_title user_title_normal titlef16 rightc333" left-arrow title="仓库管理" v-if="toptitleisshow" right-text="小分仓" @click-left="goback" @click-right="gorecord">
  29. <template #left><img src="./static/images/left.png" alt=""></template>
  30. </van-nav-bar>
  31. <van-tabs class="tabs_btn warehouse-tab" v-model="active1" swipeable @change="changetoptab" animated line-width="20" line-height="2" :ellipsis="false" sticky>
  32. <van-tab v-for="product,index in productTypes" :title="product.ProductName" v-if="product.ProductName">
  33. <van-search class="top_search" v-model="searchContent" show-action placeholder="根据收货人姓名或电话号码搜索订单" @search="onSearch">
  34. <template #action>
  35. <div class="df">
  36. <div class="searchcolor" @click="onSearch">搜索</div>
  37. </div>
  38. </template>
  39. </van-search>
  40. <van-tabs class="type-tab df" v-model="active" line-width="30" @change="changetab">
  41. <van-tab>
  42. <template #title><span class="f12">未发货</span><span class="f12">({{uncount}})</span></template>
  43. <div class="ovh-x pb0" ref="wrapper1" v-if="active === 0">
  44. <div class="nodata c999 f12 tc mt16" v-if="loading">加载中...</div>
  45. <div class="nodata c999 f12 tc mt16" v-if="productinfo.length === 0 &amp;&amp; !loading">暂无任何记录</div>
  46. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="height:100%;min-height:10vh;">
  47. <van-list @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多数据了" :immediate-check="false" v-if="active === 0 &amp;&amp; productinfo.length !== 0">
  48. <div class="panel bgcfff rel pt16 pb16 bottom_line" v-for="item,index in productinfo">
  49. <div class="info f12 c333">
  50. <div class="item title bottom_line df aic jcsb" style="justify-content:space-between;align-items:center">
  51. <div class="df"><span class="f14 c33 mb">{{item.ProductName}}*{{item.BuyCount}}</span><span class="ml4 kind df">{{item.OrderKind}}</span></div>
  52. <div class="df" style="justify-content:flex-end;">
  53. <button class="undelive r9 f12" @click="delivergoods(item.Id)">点我发货</button>
  54. </div>
  55. </div>
  56. <div class="item mt8 df jcsb mt16" style="justify-content:space-between;">
  57. <div class="c999 f12">申请时间:</div>
  58. <div class="ml4 c333">{{item.CreateDate}}</div>
  59. </div>
  60. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  61. <div class="c999 f12">申请人:</div>
  62. <div class="ml4 c333">{{item.OrderRealName}} {{item.OrderMakerCode}}</div>
  63. </div>
  64. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  65. <div class="c999 f12">订单号:</div>
  66. <div class="ml4 c333">{{item.OrderNo}}</div>
  67. </div>
  68. </div>
  69. </div>
  70. </van-list>
  71. </van-pull-refresh>
  72. </div>
  73. </van-tab>
  74. <van-tab>
  75. <template #title><span class="f12">已发货</span></template>
  76. <div class="ovh-x pb0" ref="wrapper1" v-if="active === 1">
  77. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="height:100%;min-height:10vh;">
  78. <div class="nodata c999 f12 tc mt16" v-if="loading">加载中...</div>
  79. <div class="nodata c999 f12 tc mt16" v-if="shippedlist.length === 0 &amp;&amp; !loading">暂无任何记录</div>
  80. <van-list @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多数据了" :immediate-check="false" v-if="active === 1 &amp;&amp; shippedlist.length !== 0">
  81. <div class="panel bgcfff rel pt16 pb16 bottom_line" v-for="item,index in shippedlist">
  82. <div class="info f12 c333">
  83. <div class="df bottom_line" style="justify-content:space-between;">
  84. <div class="item title df aic" style="margin-bottom:0;align-items:center"><span class="f14 c33 mb">{{item.ProductName}}*{{item.BuyCount}}</span><span class="ml4 kind df">{{item.OrderKind}}</span></div>
  85. <div><span class="c999 f12" v-if="item.SendStatus === 1">已完成</span></div>
  86. </div>
  87. <div class="item mt8 df jcsb mt16" style="justify-content:space-between;">
  88. <div class="c999 f12">申请时间:</div>
  89. <div class="ml4 c333">{{item.CreateDate}}</div>
  90. </div>
  91. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  92. <div class="c999 f12">申请人:</div>
  93. <div class="ml4 c333">{{item.OrderRealName}} {{item.OrderMakerCode}}</div>
  94. </div>
  95. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  96. <div class="c999 f12">订单号:</div>
  97. <div class="ml4 c333">{{item.OrderNo}}</div>
  98. </div>
  99. <div class="bgcfff f12 tr df jcsb spline" style="justify-content:space-between;" v-show="index !== openindex" @click="lookdetail(item,index)"> <span>详情</span>
  100. <van-icon name="arrow-down" color="#999"></van-icon>
  101. </div>
  102. <div class="bgcfff f12 tr df jcsb spline" style="justify-content:space-between;" v-show="index === openindex" @click="openindex = -1"> <span>收起</span>
  103. <van-icon name="arrow-up" color="#999"></van-icon>
  104. </div>
  105. <transition name="van-fade" leave-active-class="van-leave-active-class">
  106. <div class="isshow rel" v-show="index === openindex">
  107. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  108. <div class="c999 f12">收货人:</div>
  109. <div class="ml4 c333">{{item.RealName}} {{item.Mobile}}</div>
  110. </div>
  111. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  112. <div class="c999 f12">收货地址:</div>
  113. <div class="ml4 c333" :id="'place'+index">
  114. <div class="tr">{{item.Areas}}</div>
  115. <div class="tr">{{item.Address}}</div>
  116. </div>
  117. </div>
  118. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  119. <div class="c999 f12">提货方式:</div>
  120. <div class="ml4 c333">{{item.DeliveryType === 2 ? '上门自提' : '邮寄到付'}}</div>
  121. </div>
  122. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  123. <div class="c999 f12">SN号:</div>
  124. <div>
  125. <div class="ml4 c333" v-for="No in item.SnNos">{{No}}</div>
  126. </div>
  127. </div>
  128. <div class="df pt4" style="justify-content:flex-end;">
  129. <div class="btn bgcfff f12 tc" style="width:2.6667rem;top:.5rem;" :data-clipboard-text="item.Areas + item.Address" data-clipboard-action="copy" :data-clipboard-target="'#place'+index" :ref="'copy'+index" @click="copyPLACE(index)" @mouseenter="copyPLACE(index)">复制收货地址</div>
  130. </div>
  131. </div>
  132. </transition>
  133. </div>
  134. </div>
  135. </van-list>
  136. </van-pull-refresh>
  137. </div>
  138. </van-tab>
  139. <van-tab>
  140. <template #title><span class="f12">全部订单</span></template>
  141. <div class="ovh-x pb0" ref="wrapper1" v-if="active === 2">
  142. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="height:100%;min-height:10vh;">
  143. <div class="nodata c999 f12 tc mt16" v-if="loading">加载中...</div>
  144. <div class="nodata c999 f12 tc mt16" v-if="alllist.length === 0 &amp;&amp; !loading">暂无任何记录</div>
  145. <van-list @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多数据了" :immediate-check="false" v-if="active === 2 &amp;&amp; alllist.length !== 0">
  146. <div class="panel bgcfff rel pt16 pb16 bottom_line ovh" v-for="item,index in alllist">
  147. <div class="info f12 c333">
  148. <div class="df bottom_line title" style="justify-content:space-between;">
  149. <div class="item df aic jcsb" style="margin-bottom:0;justify-content:space-between;align-items:center"><span class="f14 c33 mb">{{item.ProductName}}*{{item.BuyCount}}</span><span class="ml4 kind df">{{item.OrderKind}}</span></div>
  150. <div class="df" style="justify-content:flex-end;" v-if="item.SendStatus !== 1">
  151. <button class="undelive r9 f12 r16" @click="delivergoods(item.Id)" v-if="item.SendStatus !== 1">点我发货</button>
  152. </div>
  153. <div v-if="item.SendStatus === 1"><span class="c999 f12">已完成</span></div>
  154. </div>
  155. <div class="item mt8 df jcsb mt16" style="justify-content:space-between;">
  156. <div class="c999 f12">申请时间:</div>
  157. <div class="ml4 c333">{{item.CreateDate}}</div>
  158. </div>
  159. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  160. <div class="c999 f12">申请人:</div>
  161. <div class="ml4 c333">{{item.OrderRealName}} {{item.OrderMakerCode}}</div>
  162. </div>
  163. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  164. <div class="c999 f12">订单号:</div>
  165. <div class="ml4 c333 f12">{{item.OrderNo}}</div>
  166. </div>
  167. <div class="bgcfff f12 tr df jcsb spline" style="justify-content:space-between;" v-show="index !== openindex &amp;&amp; item.SendStatus === 1" @click="lookdetail(item,index)"> <span>详情</span>
  168. <van-icon name="arrow-down" color="#999"></van-icon>
  169. </div>
  170. <div class="bgcfff f12 tr df jcsb spline" style="justify-content:space-between;" v-show="index === openindex &amp;&amp; item.SendStatus === 1" @click="openindex = -1"> <span>收起</span>
  171. <van-icon name="arrow-up" color="#999"></van-icon>
  172. </div>
  173. <transition name="van-fade" leave-active-class="van-leave-active-class">
  174. <div class="isshow rel" v-show="index === openindex">
  175. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  176. <div class="c999 f12">收货人:</div>
  177. <div class="ml4 c333">{{item.RealName}} {{item.Mobile}}</div>
  178. </div>
  179. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  180. <div class="c999 f12">收货地址:</div>
  181. <div class="ml4 c333" :id="'place'+index">
  182. <div class="tr">{{item.Areas}}</div>
  183. <div class="tr">{{item.Address}}</div>
  184. </div>
  185. </div>
  186. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  187. <div class="c999 f12">提货方式:</div>
  188. <div class="ml4 c333">{{item.DeliveryType === 2 ? '上门自提' : '邮寄到付'}}</div>
  189. </div>
  190. <div class="item mt8 df jcsb pt4" style="justify-content:space-between;">
  191. <div class="c999 f12">SN号:</div>
  192. <div>
  193. <div class="ml4 c333" v-for="No in item.SnNos">{{No}}</div>
  194. </div>
  195. </div>
  196. <div class="df pt4" style="justify-content:flex-end;">
  197. <div class="btn bgcfff f12 tc" style="width:2.6667rem;top:.5rem;" :data-clipboard-text="item.Areas + item.Address" data-clipboard-action="copy" :data-clipboard-target="'#place'+index" :ref="'copy'+index" @click="copyPLACE(index)" @mouseenter="copyPLACE(index)">复制收货地址</div>
  198. </div>
  199. </div>
  200. </transition>
  201. </div>
  202. </div>
  203. </van-list>
  204. </van-pull-refresh>
  205. </div>
  206. </van-tab>
  207. <van-tab>
  208. <template #title><span class="f12">库存</span><span class="f12">({{productTypes[active1].LaveNum}})</span></template>
  209. <div class="ovh-x bgcfff pb0" ref="wrapper1" v-if="active === 3">
  210. <div class="nodata c999 f12 tc mt16" v-if="loading">加载中...</div>
  211. <div class="nodata c999 f12 tc mt16" v-if="stocklist.length === 0 &amp;&amp; !loading">暂无任何记录</div>
  212. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="height:30vh;">
  213. <van-list @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多数据了" :immedisate-check="false" v-if="active === 3 &amp;&amp; stocklist.length !== 0">
  214. <div>
  215. <div class="allnum bgcfff" v-for="item,index in stocklist" :key="index">
  216. <div class="f14 c333">{{item.PosSn}}</div>
  217. <div class="f12 c999 pt4">{{item.CreateDate}}</div>
  218. </div>
  219. </div>
  220. </van-list>
  221. </van-pull-refresh>
  222. </div>
  223. </van-tab>
  224. </van-tabs>
  225. </van-tab>
  226. </van-tabs>
  227. <van-goods-action class="mall-bottom">
  228. <div class="button df ovh">
  229. <van-goods-action-button class="kxs-btn cfff-btn" type="default" color="#EB6540" text="申请补货" @click="transfer"></van-goods-action-button>
  230. <van-goods-action-button class="kxs-btn" type="default" color="#FFD500" text="预发货到小分仓" @click="getset"></van-goods-action-button>
  231. </div>
  232. </van-goods-action>
  233. </div>
  234. <script src="./static/js/clipboard.min.js"></script>
  235. <script src="./static/js/klm-vv.min.js"></script>
  236. <script src="./static/js/appfunc.min.js"></script>
  237. <script src="./static/js/klm-axios-config.js"></script>
  238. <script src="./static/js/publicfn.js"></script>
  239. <script>
  240. async function OnStart(){
  241. await app.getallwarehouselist();
  242. app.backgetwarehouselist();
  243. };
  244. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  245. // 可以通过下面的方式手动注册
  246. Vue.use(vant.Lazyload);
  247. // 在 #app 标签下渲染一个按钮组件
  248. let app = new Vue({
  249. el: '#app',
  250. data() {
  251. return {
  252. active1:0,
  253. toptitleisshow,
  254. active: 0,
  255. lastactive:0,
  256. //- overisshow:false,
  257. loading: true,
  258. finished: false,
  259. refreshing: false,
  260. searchContent:'',
  261. openindex:-1,
  262. choosebtnindex:0,
  263. productinfo:[],
  264. stocklist:[],
  265. alllist:[],
  266. shippedlist:[],
  267. showDate: false,
  268. minDate: new Date(2020, 0, 1),
  269. maxDate: new Date(2025, 10, 1),
  270. currentDate: new Date(),
  271. startDate: '',
  272. endDate: '',
  273. pageinfo:{
  274. PageSize:20,
  275. PageNum:1
  276. },
  277. NoList:'',
  278. productTypes:[
  279. ],
  280. uncount:0,
  281. flag:0,
  282. browsernum:'',
  283. };
  284. },
  285. watch:{
  286. choosebtnindex(){
  287. const currentmouth = new Date().getMonth()+1;
  288. const currentyear = new Date().getFullYear();
  289. switch(this.choosebtnindex){
  290. case 0:
  291. this.startDate = '';
  292. this.endDate = '';
  293. break;
  294. case 1:
  295. this.startDate = currentyear + '-' + currentmouth + '-' + 1;
  296. this.endDate = currentyear + '-' + currentmouth + '-' + new Date().getDate();
  297. break;
  298. case 2:
  299. this.startDate = currentyear + '-' + (currentmouth -1) + '-' + 1;
  300. this.endDate = currentyear + '-' + (currentmouth - 1) + '-' + new Date(currentyear,currentmouth - 1,0).getDate();
  301. break;
  302. case 3:
  303. this.startDate = currentyear + '-' + (currentmouth -2) + '-' + (new Date().getDate()+1);
  304. this.endDate = currentyear + '-' + currentmouth + '-' + new Date().getDate();
  305. break;
  306. }
  307. }
  308. },
  309. async created() {
  310. await this.getallwarehouselist();
  311. this.getwarehouselist();
  312. this.browsernum = PublicLib.GetAppVersion();
  313. },
  314. beforeUpdate() {
  315. this.$refs.wrapper1.forEach(item=>{
  316. item.style.height = `${document.documentElement.clientHeight - 118}px`;
  317. });
  318. },
  319. methods: {
  320. //- 预发货
  321. getset(){
  322. PublicLib.putCookieInfo('warehouseId', this.productTypes[this.active1].Id);
  323. PublicLib.putCookieInfo('brandId', this.productTypes[this.active1].BrandId);
  324. PublicLib.putCookieInfo('warehouseSnList', JSON.stringify([]));
  325. PublicLib.putCookieInfo('warehouseName', this.productTypes[this.active1].ProductName);
  326. PublicLib.Goto({Url:'warehouse-deliver-goods-getset'});
  327. },
  328. transfer(){
  329. PublicLib.Goto({Url:'warehouse-application'});
  330. },
  331. //- 获取仓库入口
  332. async getallwarehouselist(){
  333. const UserId = PublicLib.getCookieInfo('userId');
  334. const res = await getRequest('api/v1/storehouse/indexlist?t='+Math.random(6),JSON.stringify({UserId,PageSize:15,PageNum:1}));
  335. if(res.status === '1') {
  336. const arr = [];
  337. res.data.forEach((item,index)=>{
  338. if(item.BrandId){
  339. arr.push(item)
  340. };
  341. });
  342. const productlist = [];
  343. const list = PublicLib.getCookieInfo('productCenterList') ? PublicLib.getCookieInfo('productCenterList') : '[]';
  344. const testarr = JSON.parse(list) ? JSON.parse(list) : [];
  345. const productsnum = arr.length - testarr.length;
  346. if(productsnum !== 0){
  347. for(let i = productsnum; i > 0; i--){
  348. testarr.push(arr[arr.length - i].BrandId);
  349. };
  350. };
  351. testarr.forEach((num)=>{
  352. arr.forEach((item,index)=>{
  353. if(Number(item.BrandId) === Number(num)){
  354. productlist.push(item);
  355. };
  356. });
  357. });
  358. this.productTypes = productlist;
  359. };
  360. },
  361. //- 切换顶部tab
  362. changetoptab(){
  363. this.productinfo = [];
  364. this.stocklist = [];
  365. this.alllist = [];
  366. this.shippedlist = [];
  367. this.pageinfo.PageNum = 1;
  368. this.active = 0;
  369. this.lastactive = 0;
  370. this.finished = false;
  371. this.loading = true;
  372. this.backgetwarehouselist();
  373. },
  374. changetab(){
  375. if(this.lastactive === this.active) return;
  376. this.lastactive = this.active;
  377. this.loading = true;
  378. this.pageinfo.PageNum = 1;
  379. this.openindex = -1;
  380. this.finished = false;
  381. this.backgetwarehouselist();
  382. },
  383. giveToast(str){
  384. this.$toast(str);
  385. },
  386. onLoad() {
  387. this.pageinfo.PageNum++;
  388. this.getwarehouselist();
  389. },
  390. onRefresh() {
  391. //- this.productinfo = [];
  392. //- this.stocklist = [];
  393. //- this.alllist = [];
  394. //- this.shippedlist = [];
  395. this.pageinfo.PageNum = 1;
  396. this.finished = false;
  397. this.loading = true;
  398. this.refreshing = false;
  399. this.backgetwarehouselist('refresh');
  400. },
  401. //- 点击搜索
  402. onSearch(){
  403. if(this.searchContent === '')return;
  404. this.productinfo = [];
  405. this.pageinfo.PageNum = 1;
  406. this.getwarehouselist();
  407. },
  408. //- 详情
  409. lookdetail(item,index){
  410. item.detailShow = true;
  411. this.openindex = index;
  412. },
  413. //- 复制地址
  414. copyPLACE(index){
  415. const that = this;
  416. const clipboard = new ClipboardJS(this.$refs['copy'+index][0]);
  417. clipboard.on('success', function(e) {
  418. that.giveToast('复制成功');
  419. });
  420. clipboard.on('error', function(e) {
  421. that.giveToast('复制失败,请手动选择复制!');
  422. });
  423. },
  424. //- 限制选择时间
  425. onConfirmDate(isStartDate) {
  426. this.choosebtnindex = -1;
  427. this.showDate = false;
  428. if(isStartDate){
  429. this.startDate = this.currentDate.getFullYear() + '-' + (this.currentDate.getMonth() + 1) + '-' + this.currentDate.getDate();
  430. this.minDate = new Date(this.startDate);
  431. this.maxDate = new Date(2025, 10, 1);
  432. }else{
  433. this.endDate = this.currentDate.getFullYear() + '-' + (this.currentDate.getMonth() + 1) + '-' + this.currentDate.getDate();
  434. this.maxDate = new Date(this.endDate);
  435. this.minDate = new Date(2020, 0, 1);
  436. };
  437. },
  438. //- 格式化显示时间
  439. formatter(type, val) {
  440. if (type === 'year') {
  441. return `${val}年`;
  442. } else if (type === 'month') {
  443. return `${val}月`;
  444. } else if (type === 'day') {
  445. return `${val}日`;
  446. };
  447. return val;
  448. },
  449. //- 时间参数转换
  450. onParamsDate(date){
  451. if(date === '') return '';
  452. return formatDate(new Date(date).getFullYear(),new Date(date).getMonth() + 1,new Date(date).getDate());
  453. },
  454. //- 判断是否为开始时间
  455. onShowDate(isStartDate){
  456. this.isStartDate = isStartDate ? true : false;
  457. this.showDate = !this.showDate;
  458. },
  459. //- 取消弹出层
  460. cancelbtn(){
  461. setTimeout(()=>{
  462. this.choosebtnindex = 0;
  463. this.startDate = '';
  464. this.endDate = '';
  465. },200);
  466. this.overisshow = false;
  467. },
  468. //- 确认弹出层
  469. surebtn(){
  470. setTimeout(()=>{
  471. this.choosebtnindex = 0;
  472. this.startDate = '';
  473. this.endDate = '';
  474. },200);
  475. this.searchContent = '';
  476. this.overisshow = false;
  477. this.productinfo = [];
  478. this.pageinfo.PageNum = 1;
  479. this.getwarehouselist();
  480. },
  481. //- 获取仓库列表
  482. async getwarehouselist (){
  483. //- cancelAxios.clearPending()
  484. let StoreId = this.productTypes[this.active1].Id;
  485. let Status = '';
  486. switch(this.active){
  487. case 0:
  488. Status = 2;
  489. break;
  490. case 1:
  491. Status = 1;
  492. break;
  493. case 2:
  494. Status = 0;
  495. break;
  496. };
  497. if(this.active === 3){
  498. const OutStoreId = StoreId;
  499. const res = await getRequest('api/v1/ApplyMachine/StoreStockList?t='+Math.random(6),JSON.stringify({...this.pageinfo,StoreId}));
  500. if(res.status !== '1') return tips('获取库存列表失败');
  501. if(res.data.length < this.pageinfo.PageSize) {
  502. this.finished = true;
  503. };
  504. this.loading = false;
  505. res.data.forEach(item=>{
  506. item.CreateDate = item.CreateDate.replace('T',' ')
  507. });
  508. this.stocklist.push(...res.data);
  509. }else{
  510. const StartDate = this.onParamsDate(this.startDate);
  511. const EndDate = this.onParamsDate(this.endDate);
  512. const res = await getRequest('api/v1/orders/storeorderlist?t='+Math.random(6),JSON.stringify({...this.pageinfo,StoreId,SearchKey:this.searchContent,Status,StartDate,EndDate}));
  513. if(res.status !== '1') return tips('获取仓库列表失败');
  514. if(res.data.length < this.pageinfo.PageSize) {
  515. this.finished = true;
  516. };
  517. this.loading = false;
  518. if(this.active !== 0){
  519. res.data.forEach(item=>{
  520. if(item.SnNos){
  521. item.SnNos = item.SnNos.split(',');
  522. };
  523. });
  524. };
  525. if(this.productTypes[this.active1].Id !== StoreId) return;
  526. if(this.active === 2){
  527. if(Status !== 0) return;
  528. this.alllist.push(...res.data);
  529. }else if(this.active === 1){
  530. if(Status !== 1) return;
  531. this.shippedlist.push(...res.data);
  532. }else if(this.active === 0){
  533. if(Status !== 2) return;
  534. this.productinfo.push(...res.data);
  535. }
  536. if(this.pageinfo.PageNum === 1 && this.active === 0){
  537. this.uncount = res.other.count;
  538. };
  539. //- this.productinfo.push(...res.data);
  540. }
  541. },
  542. backgetwarehouselist:undebounce(async function(type='load'){
  543. if(type === 'load'){
  544. if(this.active === 3 && this.stocklist.length !== 0){
  545. this.loading = false;
  546. return;
  547. }else if (this.active === 2 && this.alllist.length !== 0){
  548. this.loading = false;
  549. return;
  550. }else if (this.active === 1 && this.shippedlist.length !== 0){
  551. this.loading = false;
  552. return;
  553. }else if (this.active === 0 && this.productinfo.length !== 0){
  554. this.loading = false;
  555. return;
  556. };
  557. }
  558. //- cancelAxios.clearPending()
  559. let StoreId = this.productTypes[this.active1].Id;
  560. let Status = '';
  561. switch(this.active){
  562. case 0:
  563. Status = 2;
  564. break;
  565. case 1:
  566. Status = 1;
  567. break;
  568. case 2:
  569. Status = 0;
  570. break;
  571. };
  572. if(this.active === 3){
  573. const OutStoreId = StoreId;
  574. //- 库存接口
  575. //- const res = await getRequest('api/v1/pos/machinechange/orderlist?t='+Math.random(6),JSON.stringify({...this.pageinfo,OutStoreId}));
  576. const res = await getRequest('api/v1/ApplyMachine/StoreStockList?t='+Math.random(6),JSON.stringify({...this.pageinfo,StoreId}));
  577. if(res.status !== '1') return tips('获取库存列表失败');
  578. if(res.data.length < this.pageinfo.PageSize) {
  579. this.finished = true;
  580. };
  581. res.data.forEach(item=>{
  582. item.CreateDate = item.CreateDate.replace('T',' ')
  583. });
  584. this.stocklist = res.data;
  585. this.loading = false;
  586. }else{
  587. const StartDate = this.onParamsDate(this.startDate);
  588. const EndDate = this.onParamsDate(this.endDate);
  589. const res = await getRequest('api/v1/orders/storeorderlist?t='+Math.random(6),JSON.stringify({...this.pageinfo,StoreId,SearchKey:this.searchContent,Status,StartDate,EndDate}));
  590. if(res.status !== '1') return tips('获取仓库列表失败');
  591. if(res.data.length < this.pageinfo.PageSize) {
  592. this.finished = true;
  593. };
  594. if(this.active !== 0){
  595. res.data.forEach(item=>{
  596. if(item.SnNos){
  597. item.SnNos = item.SnNos.split(',');
  598. };
  599. });
  600. };
  601. if(this.productTypes[this.active1].Id !== StoreId) return;
  602. if(this.active === 2){
  603. if(Status !== 0) return;
  604. this.alllist = res.data;
  605. }else if(this.active === 1){
  606. if(Status !== 1) return;
  607. this.shippedlist = res.data;
  608. }else if(this.active === 0){
  609. if(Status !== 2) return;
  610. this.productinfo = res.data;
  611. }
  612. if(this.pageinfo.PageNum === 1 && this.active === 0){
  613. this.uncount = res.other.count;
  614. };
  615. //- this.productinfo = res.data;
  616. this.loading = false;
  617. }
  618. },300),
  619. goback(){
  620. PublicLib.GoBack({Level:1});
  621. },
  622. //- 申请记录
  623. warehouserecord(){
  624. PublicLib.Goto({Url:'warehouse-record'});
  625. },
  626. //- 点击发货
  627. delivergoods(id){
  628. PublicLib.putCookieInfo('warehouseId', this.productTypes[this.active1].Id);
  629. PublicLib.putCookieInfo('brandId', this.productTypes[this.active1].BrandId);
  630. PublicLib.putCookieInfo('warehouseSnList', JSON.stringify([]));
  631. PublicLib.putCookieInfo('orderId', id);
  632. PublicLib.putCookieInfo('warehouseName', this.productTypes[this.active1].ProductName);
  633. PublicLib.Goto({Url:'warehouse-deliver-goods'});
  634. },
  635. //- 点击售后发货
  636. async delivergoodssale(id){
  637. const StoreId = PublicLib.getCookieInfo('warehouseId');
  638. const res = await getRequest('api/v1/StoreStockChange/TransferForCheck?t='+Math.random(6),JSON.stringify({StoreId}));
  639. if(res.status !== '1')return tips('审核单数已满10条,请联系总仓审核!')
  640. PublicLib.putCookieInfo('warehouseSnList', JSON.stringify([]));
  641. PublicLib.putCookieInfo('orderId', id);
  642. PublicLib.Goto({Url:'warehouse-deliver-goods-afterSale'});
  643. },
  644. gorecord(){
  645. PublicLib.Goto({Url:'warehouse-mini-warehouse'});
  646. },
  647. }
  648. });
  649. </script>
  650. </body>
  651. </html>