|
|
@@ -7,6 +7,8 @@
|
|
|
@component('maintenance.priceModel.operation.menu')@endcomponent
|
|
|
</div>
|
|
|
<div class="container-fluid mt-2" id="container">
|
|
|
+ @include("maintenance.priceModel.operation._addOutStorageRuleModal")
|
|
|
+ @include("maintenance.priceModel.operation._addFeature")
|
|
|
<div id="form_div"></div>
|
|
|
<table class="table table-hover table-striped text-nowrap">
|
|
|
<tr>
|
|
|
@@ -16,30 +18,108 @@
|
|
|
<th>类型</th>
|
|
|
<th>策略</th>
|
|
|
<th>项目</th>
|
|
|
+ <th>计量</th>
|
|
|
+ <th>单位</th>
|
|
|
+ <th>单价</th>
|
|
|
+ <th>优先级</th>
|
|
|
<th>特征</th>
|
|
|
<th>备注</th>
|
|
|
<th>录入时间</th>
|
|
|
<th>操作</th>
|
|
|
</tr>
|
|
|
- <tr v-for="(model,i) in models">
|
|
|
+ <tr v-for="(model,i) in models" :id="'model-'+model.id">
|
|
|
<td>@{{ i+1 }}</td>
|
|
|
<td>
|
|
|
- <button class="btn btn-sm btn-info">维护详情</button>
|
|
|
- <table class="table table-sm table-bordered table-striped">
|
|
|
- <tr>
|
|
|
-
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
+ <button v-if="model.operationType == '出库' && thisId != model.id" class="btn btn-sm btn-info" @click="showDetail(model.id)">维护详情</button>
|
|
|
+ <button v-if="model.operationType == '出库' && thisId == model.id" class="btn btn-sm btn-dark" @click="thisId = ''">关闭详情</button>
|
|
|
</td>
|
|
|
<td>@{{ model.name }}</td>
|
|
|
<td>@{{ model.operationType }}</td>
|
|
|
<td>@{{ model.strategy }}</td>
|
|
|
<td>货主们</td>
|
|
|
+ <td>
|
|
|
+ <label v-if="model.operationType == '出库'">/</label>
|
|
|
+ <label v-else>@{{ model.ownerInStorageRuleAmount }}</label>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <label v-if="model.operationType == '出库'">/</label>
|
|
|
+ <label v-else>@{{ model.ownerInStorageRuleUnitName }}</label>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <label v-if="model.operationType == '出库'">/</label>
|
|
|
+ <label v-else>@{{ model.ownerInStorageRuleUnitPrice }}</label>
|
|
|
+ </td>
|
|
|
+ <td>@{{ model.priority }}</td>
|
|
|
<td>@{{ model.feature }}</td>
|
|
|
<td>@{{ model.remark }}</td>
|
|
|
<td>@{{ model.createdAt }}</td>
|
|
|
<td></td>
|
|
|
</tr>
|
|
|
+ <tr id="detail" v-show="thisId">
|
|
|
+ <td></td>
|
|
|
+ <td colspan="9">
|
|
|
+ <table class="table table-sm table-bordered">
|
|
|
+ <tr class="text-success">
|
|
|
+ <th>操作</th>
|
|
|
+ <th>计费策略</th>
|
|
|
+ <th>起步数</th>
|
|
|
+ <th>单位</th>
|
|
|
+ <th>单价</th>
|
|
|
+ <th>优先级</th>
|
|
|
+ <th class="text-center">特征</th>
|
|
|
+ <th></th>
|
|
|
+ </tr>
|
|
|
+ <tr v-for="(item,i) in ownerOutStorageRules[thisId]">
|
|
|
+ <td>
|
|
|
+ <span v-if="updateDetailId != item.id">
|
|
|
+ <button class="btn btn-sm btn-outline-info" @click="showAddRuleModal()" v-if="i==0">新增</button>
|
|
|
+ <button class="btn btn-sm btn-outline-info" @click="showUpdateDetail(item.id)">修改</button>
|
|
|
+ </span>
|
|
|
+ <span v-else>
|
|
|
+ <button class="btn btn-sm btn-success" @click="submitUpdateDetail(item)">确定</button>
|
|
|
+ <button class="btn btn-sm btn-danger" @click="updateDetailId = ''">取消</button>
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td>@{{ item.strategy }}</td>
|
|
|
+ <td>
|
|
|
+ <label v-if="updateDetailId == item.id">
|
|
|
+ <input type="number" min="0" id="detailAmount" class="form-control form-control-sm"
|
|
|
+ :value="item.amount">
|
|
|
+ </label>
|
|
|
+ <label v-else>@{{ item.amount }}</label>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <label v-if="updateDetailId == item.id">
|
|
|
+ <select class="form-control form-control-sm" id="detailUnit">
|
|
|
+ <option v-for="unit in units" :value="unit.id" v-if="unit.id==item.unit_id" selected>@{{ unit.name }}</option>
|
|
|
+ <option v-for="unit in units" :value="unit.id" v-if="unit.id!=item.unit_id">@{{ unit.name }}</option>
|
|
|
+ </select>
|
|
|
+ </label>
|
|
|
+ <label v-else>@{{ item.unit ? item.unit.name : '' }}</label>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <label v-if="updateDetailId == item.id">
|
|
|
+ <input type="number" min="0" step="0.001" id="detailUnitPrice" class="form-control form-control-sm"
|
|
|
+ :value="item.unit_price">
|
|
|
+ </label>
|
|
|
+ <label v-else>@{{ item.unit_price }}</label>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <label v-if="updateDetailId == item.id">
|
|
|
+ <input type="number" min="0" id="detailPriority" class="form-control form-control-sm"
|
|
|
+ :value="item.priority">
|
|
|
+ </label>
|
|
|
+ <label v-else>@{{ item.priority }}</label>
|
|
|
+ </td>
|
|
|
+ <td>@{{ item.featureFormat }}</td>
|
|
|
+ <td>@{{ item.feature }}</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-sm btn-success" v-if="item.strategy == '特征'" @click="showAddFeatureModal(i,item.feature)">维护特征</button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
@stop
|
|
|
@@ -59,7 +139,11 @@
|
|
|
strategy : "{{$model->strategy}}",
|
|
|
feature : "{{$model->feature}}",
|
|
|
remark : "{{$model->remark}}",
|
|
|
+ priority : "{{$model->priority}}",
|
|
|
createdAt : "{{$model->created_at}}",
|
|
|
+ ownerInStorageRuleAmount : "{{$model->ownerInStorageRule ? $model->ownerInStorageRule->amount : ''}}",
|
|
|
+ ownerInStorageRuleUnitName : "{{$model->ownerInStorageRule ? ($model->ownerInStorageRule->unit ? $model->ownerInStorageRule->unit->name : '') : ''}}",
|
|
|
+ ownerInStorageRuleUnitPrice : "{{$model->ownerInStorageRule ? $model->ownerInStorageRule->unit_price : ''}}",
|
|
|
},
|
|
|
@endforeach
|
|
|
],
|
|
|
@@ -68,6 +152,22 @@
|
|
|
{name:"{{$owner->id}}",value:"{{$owner->name}}"},
|
|
|
@endforeach
|
|
|
],
|
|
|
+ thisId : "",
|
|
|
+ ownerOutStorageRules : [],
|
|
|
+ updateDetailId : '',
|
|
|
+ units : null,
|
|
|
+ strategy : ['起步','默认','特征'],
|
|
|
+ type : ['商品名称','订单类型','承运商','店铺类型'],
|
|
|
+ logic : ['包含','不包含','等于'],
|
|
|
+ rule : {
|
|
|
+ "strategy" : '特征',
|
|
|
+ "amount" : "",
|
|
|
+ "unit_id" : "",
|
|
|
+ "unit_price" : "",
|
|
|
+ "priority" : 0,
|
|
|
+ },
|
|
|
+ thisRuleIndex : "",
|
|
|
+ features : [],
|
|
|
},
|
|
|
mounted(){
|
|
|
let data=[
|
|
|
@@ -83,6 +183,127 @@
|
|
|
});
|
|
|
this.form.init();
|
|
|
},
|
|
|
+ methods:{
|
|
|
+ showDetail(id){
|
|
|
+ if (this.ownerOutStorageRules[id]){
|
|
|
+ this.thisId = id;
|
|
|
+ $("#model-"+id).after($("#detail"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.axios.post("{{url('maintenance/priceModel/operation/getOutStorageRule')}}",{id:id})
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.success){
|
|
|
+ this.ownerOutStorageRules[id] = res.data.data;
|
|
|
+ this.thisId = id;
|
|
|
+ $("#model-"+id).after($("#detail"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ showUpdateDetail(id){
|
|
|
+ if (!this.units)this._getUnits();
|
|
|
+ this.updateDetailId = id;
|
|
|
+ },
|
|
|
+ _getUnits(){
|
|
|
+ window.axios.post("{{url('maintenance/unit/getUnits')}}")
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.success){
|
|
|
+ this.units = res.data.data;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ submitUpdateDetail(item){
|
|
|
+ let amount = $("#detailAmount").val();
|
|
|
+ let unit_id = $("#detailUnit").val();
|
|
|
+ let unit_price = $("#detailUnitPrice").val();
|
|
|
+ let priority = $("#detailPriority").val();
|
|
|
+ window.axios.post("{{url('maintenance/priceModel/operation/updateOutStorageRule')}}",
|
|
|
+ {id:item.id,amount:amount,unit_id:unit_id,unit_price:unit_price,priority:priority})
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.success){
|
|
|
+ item.amount = amount;
|
|
|
+ if (item.unit_id != unit_id){
|
|
|
+ this.units.some((unit)=>{
|
|
|
+ if (unit_id == unit.id){
|
|
|
+ item.unit = unit;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ item.unit_id = unit_id;
|
|
|
+ }
|
|
|
+ item.unit_price = unit_price;
|
|
|
+ item.priority = priority;
|
|
|
+ this.updateDetailId = '';
|
|
|
+ window.tempTip.setDuration(2000);
|
|
|
+ window.tempTip.showSuccess("修改成功");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ showAddRuleModal(){
|
|
|
+ if (!this.units)this._getUnits();
|
|
|
+ $("#addOutStorageRule").modal("show");
|
|
|
+ },
|
|
|
+ submitRule(){
|
|
|
+ if (!this.thisId || !this.rule.strategy || !this.rule.unit_id || !this.rule.unit_price){
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("计费策略,单位,单价为必填项");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.axios.post("{{url('maintenance/priceModel/operation/createOutStorageRule')}}",
|
|
|
+ {owner_price_operation_id:this.thisId,strategy:this.rule.strategy,amount:this.rule.amount,unit_id:this.rule.unit_id,unit_price:this.rule.unit_price,priority:Number(this.rule.priority)})
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.success){
|
|
|
+ this.ownerOutStorageRules[this.thisId].unshift(res.data.data);
|
|
|
+ this.$forceUpdate();
|
|
|
+ window.tempTip.setDuration(2000);
|
|
|
+ window.tempTip.setIndex(1099);
|
|
|
+ window.tempTip.showSuccess("新增出库策略成功");
|
|
|
+ $("#addOutStorageRule").modal("hide");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.setIndex(1099);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ showAddFeatureModal(index,feature){
|
|
|
+ window.axios.post("{{url('maintenance/priceModel/operation/getFeatures')}}", {feature:feature})
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.success){
|
|
|
+ this.features = res.data.data;
|
|
|
+ this.thisIndex = index;
|
|
|
+ console.log(this.features);
|
|
|
+ $("#addFeatureModal").modal("show");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
});
|
|
|
</script>
|
|
|
@stop
|