代码优化
This commit is contained in:
parent
4783bdf3e0
commit
01e63e51d9
|
|
@ -25,7 +25,7 @@ class HttpConfig {
|
||||||
// systemPath = `${this.baseUrl}/dev-api/system`
|
// systemPath = `${this.baseUrl}/dev-api/system`
|
||||||
// basePath = `${this.baseUrl}/dev-api/base`
|
// basePath = `${this.baseUrl}/dev-api/base`
|
||||||
// materialPath = `${this.baseUrl}/dev-api/material`
|
// materialPath = `${this.baseUrl}/dev-api/material`
|
||||||
baseUrl = ENV === "production" ? "http://192.168.0.56:21627" : this.target;
|
baseUrl = ENV === "production" ? "http://112.29.103.165:21626" : this.target;
|
||||||
authPath =
|
authPath =
|
||||||
ENV === "production"
|
ENV === "production"
|
||||||
? `${this.baseUrl}/dev-api/auth`
|
? `${this.baseUrl}/dev-api/auth`
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="search-bar">
|
<view class="search-bar">
|
||||||
<uni-easyinput prefixIcon="search" v-model="inputs" placeholder="请输入名称"></uni-easyinput>
|
<uni-easyinput
|
||||||
|
prefixIcon="search"
|
||||||
|
v-model="inputs"
|
||||||
|
placeholder="请输入名称"></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
<view class="dataInfo">
|
<view class="dataInfo">
|
||||||
<view class="dataList" v-for="(item,index) in searchData" :key="index">
|
<view
|
||||||
|
class="dataList"
|
||||||
|
v-for="(item, index) in searchData"
|
||||||
|
:key="index">
|
||||||
<!-- <checkbox-group @change="checkClick(item)">
|
<!-- <checkbox-group @change="checkClick(item)">
|
||||||
<checkbox :checked="item.checked" />
|
<checkbox :checked="item.checked" />
|
||||||
</checkbox-group> -->
|
</checkbox-group> -->
|
||||||
|
|
@ -13,9 +19,9 @@
|
||||||
<image :src="item.url"></image>
|
<image :src="item.url"></image>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<text>类型名称:{{item.typeName}}</text>
|
<text>类型名称:{{ item.typeName }}</text>
|
||||||
<text>规格编号:{{item.typeCode}}</text>
|
<text>规格编号:{{ item.typeCode }}</text>
|
||||||
<text>退料数量:{{item.num}}</text>
|
<text>退料数量:{{ item.num }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="action">
|
<!-- <view class="action">
|
||||||
|
|
@ -41,19 +47,18 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { basePath } from '../../public';
|
import { basePath } from "../../public";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
iptVal: '',
|
iptVal: "",
|
||||||
allChecked: false,
|
allChecked: false,
|
||||||
inputs: "",
|
inputs: "",
|
||||||
list: [
|
list: [],
|
||||||
],
|
totalFine: "",
|
||||||
totalFine: '',
|
|
||||||
cartList: [],
|
cartList: [],
|
||||||
typeId: ''
|
typeId: "",
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
totalNum() {
|
totalNum() {
|
||||||
|
|
@ -64,10 +69,10 @@ import { basePath } from '../../public';
|
||||||
str += this.searchData[i].num;
|
str += this.searchData[i].num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.totalFine = str
|
this.totalFine = str;
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
searchData: function() {
|
searchData: function () {
|
||||||
//模糊查询
|
//模糊查询
|
||||||
if (!this.inputs) {
|
if (!this.inputs) {
|
||||||
return this.list;
|
return this.list;
|
||||||
|
|
@ -78,116 +83,123 @@ import { basePath } from '../../public';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
iconClick () {
|
iconClick() {
|
||||||
console.log(this.iptVal);
|
console.log(this.iptVal);
|
||||||
},
|
},
|
||||||
add(item) { //加加
|
add(item) {
|
||||||
let num = item.offNum
|
//加加
|
||||||
|
let num = item.offNum;
|
||||||
if (num >= item.num) {
|
if (num >= item.num) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: "none",
|
||||||
title: '退料数量不可大于当前在用量!'
|
title: "退料数量不可大于当前在用量!",
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
item.offNum = num + 1
|
item.offNum = num + 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reduce(item) { //减减
|
reduce(item) {
|
||||||
let num = item.offNum
|
//减减
|
||||||
|
let num = item.offNum;
|
||||||
if (num > 1) {
|
if (num > 1) {
|
||||||
num -= 1
|
num -= 1;
|
||||||
} else if (num = 1) {
|
} else if ((num = 1)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: "none",
|
||||||
title: "该器具无法再减少"
|
title: "该器具无法再减少",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
item.offNum = num
|
item.offNum = num;
|
||||||
},
|
},
|
||||||
// 单个商品的选择
|
// 单个商品的选择
|
||||||
checkClick(item) {
|
checkClick(item) {
|
||||||
item.checked = !item.checked
|
item.checked = !item.checked;
|
||||||
if (!item.checked) {
|
if (!item.checked) {
|
||||||
this.allChecked = false
|
this.allChecked = false;
|
||||||
} else {
|
} else {
|
||||||
// 判断每一个商品是否是被选择的状态
|
// 判断每一个商品是否是被选择的状态
|
||||||
const goods = this.list.every(item => {
|
const goods = this.list.every((item) => {
|
||||||
return item.checked === true
|
return item.checked === true;
|
||||||
})
|
});
|
||||||
if (goods) {
|
if (goods) {
|
||||||
this.allChecked = true
|
this.allChecked = true;
|
||||||
} else {
|
} else {
|
||||||
this.allChecked = false
|
this.allChecked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkAll() {
|
checkAll() {
|
||||||
this.allChecked = !this.allChecked
|
this.allChecked = !this.allChecked;
|
||||||
if (this.allChecked) {
|
if (this.allChecked) {
|
||||||
this.list.map(item => {
|
this.list.map((item) => {
|
||||||
item.checked = true
|
item.checked = true;
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.list.map(item => {
|
this.list.map((item) => {
|
||||||
item.checked = false
|
item.checked = false;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
finishCart () {
|
finishCart() {
|
||||||
let that = this
|
let that = this;
|
||||||
that.cartList = that.list.filter((item) => {
|
that.cartList = that.list.filter((item) => {
|
||||||
return item.checked == true
|
return item.checked == true;
|
||||||
})
|
});
|
||||||
if (that.cartList.length == 0) {
|
if (that.cartList.length == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: "none",
|
||||||
title: '请选择退料项!'
|
title: "请选择退料项!",
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
let subList = []
|
let subList = [];
|
||||||
for (let i = 0; i < that.cartList.length; i++) {
|
for (let i = 0; i < that.cartList.length; i++) {
|
||||||
subList.push(that.cartList[i].offNum)
|
subList.push(that.cartList[i].offNum);
|
||||||
}
|
}
|
||||||
subList = subList.join(',')
|
subList = subList.join(",");
|
||||||
console.log(subList, that.typeId);
|
console.log(subList, that.typeId);
|
||||||
// 提交退料清单
|
// 提交退料清单
|
||||||
that.$api.exitMaterial.subExitMaterial({
|
that.$api.exitMaterial
|
||||||
|
.subExitMaterial({
|
||||||
typeId: that.typeId,
|
typeId: that.typeId,
|
||||||
num: subList
|
num: subList,
|
||||||
}).then(res => {
|
|
||||||
console.log(res);
|
|
||||||
}).catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
})
|
||||||
}
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
onLoad(params) {
|
onLoad(params) {
|
||||||
let that = this
|
let that = this;
|
||||||
console.log(params.id);
|
console.log(params.id);
|
||||||
that.typeId = params.typeId
|
that.typeId = params.typeId;
|
||||||
// 退料详情查看
|
// 退料详情查看
|
||||||
that.$api.exitMaterial.exitMaterialDetail({
|
that.$api.exitMaterial
|
||||||
id: params.id
|
.exitMaterialDetail({
|
||||||
}).then(res => {
|
id: params.id,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
for (let i = 0; i < res.data.data.length; i++) {
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
res.data.data[i].num = Number(res.data.data[i].num.split('.')[0])
|
// res.data.data[i].num = Number(res.data.data[i].num.split('.')[0])
|
||||||
res.data.data[i].offNum = 1
|
res.data.data[i].offNum = 1;
|
||||||
}
|
}
|
||||||
console.log(res);
|
console.log(res);
|
||||||
that.list = res.data.data
|
that.list = res.data.data;
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
})
|
||||||
}
|
.catch((err) => {
|
||||||
}
|
console.log(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.search-bar{
|
.search-bar {
|
||||||
width: 95%;
|
width: 95%;
|
||||||
margin: 20rpx auto;
|
margin: 20rpx auto;
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +211,7 @@ import { basePath } from '../../public';
|
||||||
/deep/uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
|
/deep/uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
|
||||||
border-color: #ddd;
|
border-color: #ddd;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: #2DCF8C !important;
|
background-color: #2dcf8c !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/uni-checkbox .uni-checkbox-input {
|
/deep/uni-checkbox .uni-checkbox-input {
|
||||||
|
|
@ -238,8 +250,6 @@ import { basePath } from '../../public';
|
||||||
height: 34rpx;
|
height: 34rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.dataInfo {
|
.dataInfo {
|
||||||
width: 95%;
|
width: 95%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
@ -249,7 +259,7 @@ import { basePath } from '../../public';
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border-bottom: 2px solid #F1F1F1;
|
border-bottom: 2px solid #f1f1f1;
|
||||||
padding: 25rpx 0;
|
padding: 25rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,7 +291,7 @@ import { basePath } from '../../public';
|
||||||
.dataInfo .dataList .action text {
|
.dataInfo .dataList .action text {
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
color: #000;
|
color: #000;
|
||||||
border: 1px solid #C8C7CC;
|
border: 1px solid #c8c7cc;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
line-height: 50rpx;
|
line-height: 50rpx;
|
||||||
width: 60rpx;
|
width: 60rpx;
|
||||||
|
|
@ -324,12 +334,11 @@ import { basePath } from '../../public';
|
||||||
|
|
||||||
.buy .total .price {
|
.buy .total .price {
|
||||||
padding-right: 20rpx;
|
padding-right: 20rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.buy .total .price text {
|
.buy .total .price text {
|
||||||
font-size: 27rpx;
|
font-size: 27rpx;
|
||||||
color: #C8C7CC;
|
color: #c8c7cc;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue