| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- @extends('layouts.app')
- @section('title')商品绑定型号-入库管理@endsection
- @section('content')
- <div class="container-fluid d-none" id="container">
- <div class="mt-3 col-8 offset-2">
- <div class="form-group row">
- <label for="barCode">商品条码</label>
- <input id="barCode" type="text" class="form-control" v-model="barCode"></input>
- </div>
- <div class="input-group row mt-5">
- <button type="submit" id="submit" class="btn btn-info offset-2 col-10" @click="searchBarCode()">检索</button>
- </div>
- </div>
- @include("store.inStorage._setMaximum")
- @include("store.inStorage._commodities")
- </div>
- @stop
- @section('lastScript')
- <script type="text/javascript">
- new Vue({
- el:"#container",
- data:{
- models:[@foreach($models as $model)@json($model),@endforeach],
- commodityIndex:0,
- commodities:[],
- isAndroid:false,
- barCode:"",
- },
- mounted(){
- if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
- this.pageInit();
- $("#container").removeClass("d-none");
- },
- methods:{
- //页面初始化
- pageInit(){
- if (!this.isAndroid)return;
- let element = document.getElementById("navbarSupportedContent").parentElement;
- element.className = "row";
- element.children[0].className += " col-5";
- element.children[0].href = "#";
- element.innerHTML = element.children[0].outerHTML;
- let e1 = document.getElementById("menu");
- let e2 = document.getElementById("demand-div");
- if (e1)e1.remove();
- if (e2)e2.remove();
- document.getElementById("container").style.height = (window.innerHeight-100)+"px";
- },
- searchBarCode(){
- if(!this.barCode)return;
- window.tempTip.postBasicRequest("{{url('store/inStorage/searchBarCode')}}",{barCode:this.barCode},res=>{
- this.commodities = res;
- if (res.length>1){
- $("#commodities").modal("show");
- return;
- }
- this.selectedCommodity(0);
- },true)
- },
- selectedCommodity(index){
- this.commodityIndex = index;
- window.tempTip.postBasicRequest("{{url('store/inStorage/searchModel')}}",{id:this.commodities[this.commodityIndex].id},res=>{
- this.models.forEach((model,i)=>{
- this.$set(this.models[i],"maximum",res ? (res[model.id] ? res[model.id] : null) : null);
- });
- $("#commodities").modal("hide");
- $("#maximumModal").modal("show");
- });
- },
- settingModelMaximum(){
- let models = [];
- this.models.forEach(model=>{
- if (model.maximum)models.push(model);
- });
- if (models.length<1){
- window.tempTip.setDuration(3000);
- window.tempTip.setIndex(1099);
- window.tempTip.show("请至少设定一个上限型号");
- return;
- }
- window.tempTip.postBasicRequest("{{url('store/inStorage/setMaximum')}}",
- {models:models,commodityId:this.commodities[this.commodityIndex].id},res=>{
- this.barCode = "";
- $("#maximumModal").modal("hide");
- return "商品型号上限设定成功";
- },true);
- }
- },
- });
- </script>
- @stop
|