warehouse-application.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. .van-field__right-icon i{
  18. transform:rotate(90deg);
  19. }
  20. .warehouse-application .head .center{margin:.2133rem 0;}
  21. .warehouse-application .head .center2{margin:.16rem 0 .3467rem 0;}
  22. .count{font-size:.5333rem;}
  23. .warehouse-application .topline{border-top:1px solid #f2f2f2;}
  24. .van-goods-action{height:1.5467rem;}
  25. .b{font-weight:500;}
  26. .warehouse-application .tips{bottom:1.5467rem;}
  27. </style>
  28. </head>
  29. <body class="pb0 ovh pt0" style="padding-top:0;">
  30. <div class="warehouse rel merchant-verification warehouse-application" id="app" v-cloak style="height:100vh;background-color:#f6f6f6">
  31. <van-nav-bar class="user_rank_explan_title user_title_normal titlef16 rightc333" left-arrow title="申请补货" right-text="申请记录" @click-right="onClickRight" v-if="toptitleisshow" @click-left="goback">
  32. <template #left><img src="./static/images/left.png" alt=""></template>
  33. </van-nav-bar>
  34. <div class="head tc rel topline">
  35. <van-icon class="abs rule" name="info-o" size="14" color="#FE5A32" @click="showRule = true">申请规则</van-icon>
  36. <div class="total df fl-dir-col jc-cen">
  37. <div class="f17 c333 b">可用额度</div>
  38. <div class="center" :class="{heighligt:Amount &lt; 0}"><span class="f16" v-if="Amount &lt; 0">已超额</span><span class="f16">¥</span><span class="f28" style="font-weight:bold;">{{abs(Math.abs(Amount))}}</span></div>
  39. <div class="f12 c999"> <span>总额度</span><span>¥</span><span>{{abs(totalQuota)}} </span></div>
  40. </div>
  41. <div class="rol-line m0a"></div>
  42. <div class="bottom df jcar">
  43. <div class="left c333 df fl-dir-col jc-cen">
  44. <div class="f17 b">本月固定额度</div>
  45. <div class="f12 center2"><span>¥</span><span>{{abs(FixedAmount)}}</span></div>
  46. <div class="f13 c999">{{arriveTime}} 到期</div>
  47. </div>
  48. <div class="right c333 df fl-dir-col jc-cen">
  49. <div class="f17 b">临时额度</div>
  50. <div class="f12 center2"><span>¥</span><span>{{abs(TempAmount)}}</span></div>
  51. <div class="df jcsb">
  52. <div @click="addQuota"><span class="heighligt">增加临额 </span>
  53. <van-icon name="arrow" color="#FE5A32"> </van-icon>
  54. </div>
  55. <div @click="reductQuota"><span class="heighligt">减少临额</span>
  56. <van-icon name="arrow" color="#FE5A32"> </van-icon>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="foot mt8">
  63. <div class="title f17 df jcsb aic c333">
  64. <div class="b">机具类型</div>
  65. <div class="b">申请数量(台)</div>
  66. </div>
  67. <div class="scoll-warp ovh-x">
  68. <div class="list df jcsb aic" v-for="(item,index) in jijuList">
  69. <div class="c999 f15">{{item.BrandName}}</div>
  70. <van-stepper v-model="item.ApplyNum" theme="round" button-size="22" disable-input min="0" step="10"></van-stepper>
  71. </div>
  72. </div>
  73. <div class="van-goods-action">
  74. <div class="f14 tc" style="width:40%;flex:1;"><span class="f14 c333">所需额度:</span><span class="heighligt ml4 b">¥</span><span class="heighligt b count">{{needPay}}</span></div>
  75. <van-goods-action-button color="#FDD500" text="购买额度" v-if="needPay &gt; Amount" @click="showPicker = true"></van-goods-action-button>
  76. <van-goods-action-button color="#FDD500" text="确认申请" :disabled="needPay === 0" v-else @click="apply"></van-goods-action-button>
  77. <div class="tips df aic" v-show="needPay &gt; Amount" @click="showRule = true">
  78. <van-icon name="warning-o" color="#FE5A32" size="16"></van-icon>
  79. <div class="f14 c333 ml6">可用额度不足,请先增加临时额度</div>
  80. </div>
  81. </div>
  82. </div>
  83. <van-action-sheet v-model="showRule" title="申请规则">
  84. <div v-html="rules"></div>
  85. </van-action-sheet>
  86. <van-popup v-model="showPicker" position="bottom" round>
  87. <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" title="增加临额"></van-picker>
  88. </van-popup>
  89. <van-popup v-model="applicationFaild" style="border-radius:.4267rem;width:83%;">
  90. <div class="warp-box" style="height:4.8533rem">
  91. <div class="f16 c333 tc b">申请失败</div>
  92. <div class="f14 mt8 c333">{{errInfo}}</div>
  93. <van-button class="btn" round color="#FDD500" block @click="applicationFaild = false">确定</van-button>
  94. </div>
  95. </van-popup>
  96. <van-popup v-model="applicationSuccess" style="border-radius:.4267rem;width:83%;">
  97. <div class="warp-box" style="height:4.4133rem">
  98. <div class="f16 c333 tc b">申请成功</div>
  99. <van-button class="btn" round color="#FDD500" block @click="applicationSuccess = false">好的</van-button>
  100. </div>
  101. </van-popup>
  102. </div>
  103. <script src="./static/js/klm-vv.min.js"></script>
  104. <script src="./static/js/appfunc.min.js"></script>
  105. <script src="./static/js/klm-axios-config.js"></script>
  106. <script src="./static/js/publicfn.js"></script>
  107. <script>
  108. Vue.use(vant.Lazyload);
  109. // 在 #app 标签下渲染一个按钮组件
  110. let app = new Vue({
  111. el: '#app',
  112. data(){
  113. return{
  114. TempAmount:0,
  115. FixedAmount:0,
  116. Amount:0,
  117. needPay:0,
  118. arriveTime:'',
  119. topheight:0,
  120. rules:'',
  121. jijuList:[
  122. //- {
  123. //- BrandName:'金控电签',
  124. //- ApplyNum:0,
  125. //- Price:200,
  126. //- },
  127. //- {
  128. //- BrandName:'金控大POS',
  129. //- ApplyNum:0,
  130. //- Price:200,
  131. //- },
  132. //- {
  133. //- BrandName:'立刷',
  134. //- ApplyNum:0,
  135. //- Price:200,
  136. //- },
  137. //- {
  138. //- BrandName:'金控电签',
  139. //- ApplyNum:0,
  140. //- Price:200,
  141. //- },
  142. //- {
  143. //- BrandName:'金控大POS',
  144. //- ApplyNum:0,
  145. //- Price:200,
  146. //- },
  147. //- {
  148. //- BrandName:'立刷',
  149. //- ApplyNum:0,
  150. //- Price:200,
  151. //- },
  152. //- {
  153. //- BrandName:'金控电签',
  154. //- ApplyNum:0,
  155. //- Price:200,
  156. //- },
  157. //- {
  158. //- BrandName:'金控大POS',
  159. //- ApplyNum:0,
  160. //- Price:200,
  161. //- },
  162. //- {
  163. //- BrandName:'立刷',
  164. //- ApplyNum:0,
  165. //- Price:200,
  166. //- },
  167. ],
  168. showRule:false,
  169. showPicker:false,
  170. toptitleisshow,
  171. applicationFaild:false,
  172. applicationSuccess:false,
  173. columns:[
  174. '2000元额度',
  175. '10000元额度',
  176. '20000元额度'
  177. ],
  178. //- increaseQuota:0,
  179. rules:``,
  180. initInfo:{
  181. mustTai:0,
  182. mustXiang:0,
  183. many:0,
  184. },
  185. formInfo:{
  186. type:'',
  187. factor:0,
  188. Id:'',
  189. },
  190. errInfo:'',
  191. }
  192. },
  193. computed:{
  194. totalQuota:function(){
  195. return this.TempAmount + this.FixedAmount
  196. },
  197. },
  198. watch:{
  199. jijuList:{
  200. handler(val){
  201. let res = 0
  202. val.forEach((item,index)=>{
  203. res += item.ApplyNum * item.Price
  204. })
  205. this.needPay = res
  206. },
  207. immediate: true,
  208. deep:true
  209. }
  210. },
  211. created(){
  212. this.getMyamount();
  213. this.getRules();
  214. this.getProductList();
  215. let date = new Date()
  216. let year = date.getFullYear()
  217. let month = date.getMonth()+2
  218. if(month>12){
  219. year = year + 1
  220. month = 1
  221. }
  222. this.arriveTime = `${year} - ${fillzero(month)} - 01`
  223. },
  224. mounted(){
  225. //- const type = browsertype.versions.ios ? 'ios' : 'android';
  226. //- if(type === 'ios'){
  227. //- if(isFringe()){
  228. //- this.topheight = 48;
  229. //- }else{
  230. //- this.topheight = 20;
  231. //- };
  232. //- }else{
  233. //- this.topheight = PublicLib.getStatusBarHeight();
  234. //- };
  235. this.$nextTick(() => {
  236. setTimeout(()=>{
  237. const y1 = document.getElementsByClassName('title')[0].getBoundingClientRect().bottom
  238. const y2 = document.getElementsByClassName('van-goods-action')[0].getBoundingClientRect().height
  239. document.getElementsByClassName('scoll-warp')[0].style.height = `calc(100vh - ${ y1 + y2 }px)`
  240. },100)
  241. });
  242. },
  243. methods:{
  244. addQuota(){
  245. this.showPicker = true
  246. },
  247. reductQuota(){
  248. //- if(this.TempAmount > 0){
  249. PublicLib.putCookieInfo('Amount',this.TempAmount)
  250. PublicLib.Goto({Url:'warehouse-application-adjustQuota'});
  251. //- }else{
  252. //- return tips('不可降低临额!')
  253. //- }
  254. },
  255. onClickRight(){
  256. PublicLib.Goto({Url:'warehouse-application-record'});
  257. },
  258. goback(){
  259. PublicLib.GoBack({Level:1});
  260. },
  261. onConfirm(value) {
  262. //- this.increaseQuota = value
  263. //- console.log()
  264. this.showPicker = false
  265. this.toBuy(value)
  266. },
  267. toBuy(value){
  268. let mallinfo = {};
  269. switch(value){
  270. case '2000元额度':
  271. mallinfo = {cartMessages: {},goodsId: 30, messages: {}, selectedNum: 1,selectedSkuComb:{id:'',price: 1000,stock_num: 100000,property_price: 0}};
  272. break;
  273. case '10000元额度':
  274. mallinfo = {cartMessages: {},goodsId: 31, messages: {}, selectedNum: 1,selectedSkuComb:{id:'',price: 5000,stock_num: 100000,property_price: 0}};
  275. break;
  276. case '20000元额度':
  277. mallinfo = {cartMessages: {},goodsId: 32, messages: {}, selectedNum: 1,selectedSkuComb:{id:'',price: 10000,stock_num: 100000,property_price: 0}};
  278. break;
  279. };
  280. PublicLib.putCookieInfo('checkmallInfo', JSON.stringify(mallinfo));
  281. PublicLib.Goto({Url:'mall-deal-check-coupon'});
  282. },
  283. apply(){
  284. vant.Dialog.confirm({
  285. title: '确认申请',
  286. message: '申请后不可撤销',
  287. })
  288. .then(() => {
  289. const UserId = PublicLib.getCookieInfo('userId');
  290. const NeedPay = this.needPay
  291. const filterList = this.jijuList.filter(item => item.ApplyNum > 0)
  292. const ApplyList = [];
  293. filterList.forEach(item=>{
  294. ApplyList.push({ApplyNum:item.ApplyNum,BrandId:item.BrandId})
  295. });
  296. postRequest('api/v1/storemachineapply/confirmapply',JSON.stringify({ApplyList,NeedPay,UserId}))
  297. .then((res)=>{
  298. if(res.status !== '1'){
  299. this.applicationFaild = true;
  300. this.errInfo = res.info
  301. }
  302. if(res.status === '1'){
  303. this.applicationSuccess = true
  304. this.getMyamount();
  305. }
  306. })
  307. })
  308. },
  309. async getMyamount(){
  310. const UserId = PublicLib.getCookieInfo('userId');
  311. const res = await getRequest('api/v1/useraccount/myamount?='+Math.random(6),JSON.stringify({UserId}));
  312. if(res.status === '1'){
  313. this.TempAmount = res.data.TempAmount
  314. this.FixedAmount = res.data.FixedAmount
  315. this.Amount = res.data.Amount
  316. }else{
  317. tips('初始化失败!请重试')
  318. }
  319. },
  320. async getProductList(){
  321. const UserId = PublicLib.getCookieInfo('userId');
  322. const res = await getRequest('api/v1/StoreMachineApply/ProductList?t='+Math.random(6),JSON.stringify({UserId}));
  323. if(res.status === '1'){
  324. res.data.forEach((item)=>{
  325. item.ApplyNum = 0
  326. })
  327. this.jijuList = res.data
  328. //- console.log(res.data)
  329. }else{
  330. tips('获取数据失败,请重试!')
  331. }
  332. },
  333. //获取规则
  334. async getRules(){
  335. const res = await getRequest('api/v1/pageinfo/detail?t='+Math.random(6),JSON.stringify({Id:8}));
  336. if(res.status !== '1')return tips('规则获取失败!');
  337. this.rules = res.data.Contents
  338. },
  339. },
  340. })
  341. </script>
  342. </body>
  343. </html>