Commit 8f8312e1 authored by xiangzj's avatar xiangzj

sap接口服务调整

parent 2a22a070
...@@ -22,6 +22,7 @@ const config = { ...@@ -22,6 +22,7 @@ const config = {
// 设置后台接口服务的基础地址 // 设置后台接口服务的基础地址
config.baseUrl = 'http://192.168.3.91:8080'; config.baseUrl = 'http://192.168.3.91:8080';
config.baseSapUrl = 'http://192.168.3.109:8080'; //sap接口服务
//config.baseUrl = "http://101.43.244.58:8080/"; //config.baseUrl = "http://101.43.244.58:8080/";
//config.baseUrl = "/api"; //config.baseUrl = "/api";
//config.baseUrl = "http://101.200.162.168:8080"; //config.baseUrl = "http://101.200.162.168:8080";
......
This diff is collapsed.
...@@ -11,6 +11,7 @@ const install = (Vue, vm) => { ...@@ -11,6 +11,7 @@ const install = (Vue, vm) => {
// 请求参数默认配置 // 请求参数默认配置
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
baseUrl: vm.vuex_config.baseUrl, baseUrl: vm.vuex_config.baseUrl,
baseSapUrl: vm.vuex_config.baseSapUrl,
originalData: true, originalData: true,
// 默认头部,http2约定header名称统一小写 aidex // 默认头部,http2约定header名称统一小写 aidex
header: { header: {
......
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
<view class="bottomTitle" @tap="show = !show"> <view class="bottomTitle" @tap="show = !show">
<view class="desc">卷条码明细</view> <view class="desc">卷条码明细</view>
<view class="topIcons"> <view class="topIcons">
<text v-if="show"> <view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon> <u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开 展开
</text> </view>
<text v-else> <view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon> <u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起 收起
</text> </view>
</view> </view>
</view> </view>
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
<view class="bottomTitle" @tap="show = !show"> <view class="bottomTitle" @tap="show = !show">
<view class="desc">展开调整明细</view> <view class="desc">展开调整明细</view>
<view class="topIcons"> <view class="topIcons">
<text v-if="show"> <view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon> <u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开 展开
</text> </view>
<text v-else> <view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon> <u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起 收起
</text> </view>
</view> </view>
</view> </view>
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view class="inventoryDetail"> <view class="inventoryDetail">
<view class="detailTitle">盘点明细</view> <view class="detailTitle">盘点明细</view>
<view class=""> <view class="">
<u-button size="mini" class="" type="success" @click="handleClickWork()"> <u-button size="mini" class="" type="success" @click="addShowModel = true">
<u-icon name="plus"></u-icon> <u-icon name="plus"></u-icon>
新增 新增
</u-button> </u-button>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<view class="boxRight"> <view class="boxRight">
<view class="items">891/1000pcs</view> <view class="items">891/1000pcs</view>
<view class="itemsBtn"> <view class="itemsBtn">
<u-button size="mini" class="" type="primary" @click="handleClickWork()">盘点</u-button> <u-button size="mini" class="" type="primary" @click="checkShowModel=true">盘点</u-button>
</view> </view>
</view> </view>
</view> </view>
...@@ -60,6 +60,23 @@ ...@@ -60,6 +60,23 @@
</view> </view>
</view> </view>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
<u-modal v-model="addShowModel" @confirm="addConfirm" ref="addShowModel" :show-title="false" :show-cancel-button="true">
<view class="slot-content">
<u-form :model="addForm" ref="addForm">
<u-form-item label="批号"><u-input v-model="addForm.name" /></u-form-item>
<u-form-item label="批次"><u-input v-model="addForm.name" /></u-form-item>
<u-form-item label="数量"><u-input v-model="addForm.name" /></u-form-item>
</u-form>
</view>
</u-modal>
<u-modal v-model="checkShowModel" @confirm="addConfirm" ref="checkShowModel" :show-title="false" :show-cancel-button="true">
<view class="slot-content">
<u-form :model="checkForm" ref="checkForm">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="checkForm.name" focus placeholder="请扫描盘点库位条码" @input="handleInput"></uni-easyinput>
<u-form-item label="数量"><u-input v-model="checkForm.name" /></u-form-item>
</u-form>
</view>
</u-modal>
</view> </view>
</template> </template>
...@@ -76,7 +93,7 @@ export default { ...@@ -76,7 +93,7 @@ export default {
data() { data() {
return { return {
value: '', value: '',
show: false, show: true,
btnArr: [ btnArr: [
{ {
style: '', style: '',
...@@ -84,12 +101,19 @@ export default { ...@@ -84,12 +101,19 @@ export default {
text: '盘点确认', text: '盘点确认',
way: 'goBack' way: 'goBack'
} }
] ],
addShowModel: false,
checkShowModel: false,
addForm: {
name: ''
},
checkForm: {
name: ''
},
}; };
}, },
computed: {}, computed: {},
methods: { methods: {
handleClickWork() {},
handleInput(e) { handleInput(e) {
console.log(e, 'eee'); console.log(e, 'eee');
}, },
...@@ -102,7 +126,10 @@ export default { ...@@ -102,7 +126,10 @@ export default {
}, },
ontabtap(e, type) { ontabtap(e, type) {
console.log('切换tab', e, type); console.log('切换tab', e, type);
} },
addConfirm(){
this.addShowModel = false
},
} }
}; };
</script> </script>
...@@ -205,4 +232,10 @@ export default { ...@@ -205,4 +232,10 @@ export default {
justify-content: space-between; justify-content: space-between;
border-bottom: 1px solid #333; border-bottom: 1px solid #333;
} }
.slot-content{
padding: 20rpx;
.u-form-item{
padding: 0;
}
}
</style> </style>
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
<view class="bottomTitle" @tap="show = !show"> <view class="bottomTitle" @tap="show = !show">
<view class="desc">卷条码明细</view> <view class="desc">卷条码明细</view>
<view class="topIcons"> <view class="topIcons">
<text v-if="show"> <view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon> <u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开 展开
</text> </view>
<text v-else> <view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon> <u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起 收起
</text> </view>
</view> </view>
</view> </view>
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
...@@ -122,28 +122,28 @@ export default { ...@@ -122,28 +122,28 @@ export default {
style: '', style: '',
type: 'warning', type: 'warning',
text: '返回', text: '返回',
way: 'goBack', way: 'goBack'
}, },
{ {
style: '', style: '',
type: 'primary', type: 'primary',
text: '提交', text: '提交',
way: 'goSubmit', way: 'goSubmit'
} }
], ]
}; };
}, },
methods: { methods: {
getBtnHandle(row){ getBtnHandle(row) {
this[row.way]() this[row.way]();
}, },
goBack(){ goBack() {
uni.navigateBack(); uni.navigateBack();
}, },
goSubmit(){}, goSubmit() {},
handleInput(e) { handleInput(e) {
console.log(e, 'eee'); console.log(e, 'eee');
}, }
} }
}; };
</script> </script>
......
...@@ -15,7 +15,7 @@ class Request { ...@@ -15,7 +15,7 @@ class Request {
let interceptorRequest = this.interceptor.request(options); let interceptorRequest = this.interceptor.request(options);
if (interceptorRequest === false) { if (interceptorRequest === false) {
// 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调 // 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调
return new Promise(()=>{}); return new Promise(() => {});
} }
this.options = interceptorRequest; this.options = interceptorRequest;
} }
...@@ -34,7 +34,7 @@ class Request { ...@@ -34,7 +34,7 @@ class Request {
clearTimeout(this.config.timer); clearTimeout(this.config.timer);
this.config.timer = null; this.config.timer = null;
// 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data // 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
if(this.config.originalData) { if (this.config.originalData) {
// 判断是否存在拦截器 // 判断是否存在拦截器
if (this.interceptor.response && typeof this.interceptor.response === 'function') { if (this.interceptor.response && typeof this.interceptor.response === 'function') {
let resInterceptors = this.interceptor.response(response); let resInterceptors = this.interceptor.response(response);
...@@ -51,7 +51,8 @@ class Request { ...@@ -51,7 +51,8 @@ class Request {
} }
} else { } else {
if (response.statusCode == 200) { if (response.statusCode == 200) {
if (this.interceptor.response && typeof this.interceptor.response === 'function') { if (this.interceptor.response && typeof this.interceptor.response ===
'function') {
let resInterceptors = this.interceptor.response(response.data); let resInterceptors = this.interceptor.response(response.data);
if (resInterceptors !== false) { if (resInterceptors !== false) {
resolve(resInterceptors); resolve(resInterceptors);
...@@ -73,15 +74,21 @@ class Request { ...@@ -73,15 +74,21 @@ class Request {
} }
} }
} }
// 处理sap接口
let url= this.config.baseUrl
if(options.url.indexOf('sap') > -1){
url = this.config.baseSapUrl
// options.url = options.url.replace('/sap','')
options.header = {...options.header,'Authorization':'Basic cmVzdF91c2VyOkJzbjEyMzQ1Ng=='}
}
// 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法 // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
options.url = validate.url(options.url) ? options.url : (this.config.baseUrl + (options.url.indexOf('/') == 0 ? options.url = validate.url(options.url) ? options.url : (url + (options.url.indexOf('/') == 0 ?
options.url : '/' + options.url)); options.url : '/' + options.url));
// 是否显示loading // 是否显示loading
// 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id // 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
// 而没有清除前者的定时器,导致前者超时,一直显示loading // 而没有清除前者的定时器,导致前者超时,一直显示loading
if(this.config.showLoading && !this.config.timer) { if (this.config.showLoading && !this.config.timer) {
this.config.timer = setTimeout(() => { this.config.timer = setTimeout(() => {
uni.showLoading({ uni.showLoading({
title: this.config.loadingText, title: this.config.loadingText,
...@@ -102,6 +109,7 @@ class Request { ...@@ -102,6 +109,7 @@ class Request {
constructor() { constructor() {
this.config = { this.config = {
baseUrl: '', // 请求的根域名 baseUrl: '', // 请求的根域名
baseSapUrl: '', // SAP请求的根域名
// 默认的请求头 // 默认的请求头
header: {}, header: {},
method: 'POST', method: 'POST',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment