|
@@ -1,5 +1,4 @@
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
-import { copyObject } from "@/utils/util"
|
|
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -135,21 +134,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
initData() {
|
|
initData() {
|
|
|
- let that = this
|
|
|
|
|
- // getMenu().then(res=>{
|
|
|
|
|
- // if(res.code == 1){
|
|
|
|
|
- // that.globalClassData = res.data.class ? res.data.class : []
|
|
|
|
|
- // if(that.globalClassData[0]){
|
|
|
|
|
- // that.globalClassId = that.globalClassData[0].id
|
|
|
|
|
- // //保存到仓库
|
|
|
|
|
- // let currentInfo = uni.getStorageSync('selectList_'+that.selectJobType+'_target_'+that.selectJobId)
|
|
|
|
|
- // if(!that.$util.isEmpty(currentInfo)){
|
|
|
|
|
- // that.setSelectInfo({ selectJobType: that.selectJobType, info: currentInfo,selectJobId:that.selectJobId })
|
|
|
|
|
- // }
|
|
|
|
|
- // that.getGlobalProductList()
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
},
|
|
},
|
|
|
reGetGlobalProductList(){
|
|
reGetGlobalProductList(){
|
|
|
this.globalGoToTop()
|
|
this.globalGoToTop()
|
|
@@ -162,18 +146,6 @@ export default {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
let that = this
|
|
let that = this
|
|
|
- // getItemList({classId:this.globalClassId,requestType:this.globalRequestType,page:this.globalPage,search:this.globalPy,customId:this.globalCustomId}).then(res=>{
|
|
|
|
|
- // if(res.code == 1){
|
|
|
|
|
- // that.globalItemData = that.globalPage == 1 ? res.data.list : that.globalItemData.concat(res.data.list)
|
|
|
|
|
- // if(res.data.moreData == 1){
|
|
|
|
|
- // that.globalPage++
|
|
|
|
|
- // }else{
|
|
|
|
|
- // that.globalFinishGetItem = 1
|
|
|
|
|
- // }
|
|
|
|
|
- // that.globalIsRequesting = false
|
|
|
|
|
- // that.globalRememberRefresh()
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
},
|
|
},
|
|
|
globalRememberRefresh(){
|
|
globalRememberRefresh(){
|
|
|
let that = this
|
|
let that = this
|
|
@@ -187,7 +159,7 @@ export default {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
//修改数据需要复制一份,否则不会生效
|
|
//修改数据需要复制一份,否则不会生效
|
|
|
- that.globalItemData = copyObject(that.globalItemData);
|
|
|
|
|
|
|
+ that.globalItemData = this.$util.copyObject(that.globalItemData);
|
|
|
for (let i=0;i<that.globalItemData.length;i++){
|
|
for (let i=0;i<that.globalItemData.length;i++){
|
|
|
let currentProduct = that.globalItemData[i]
|
|
let currentProduct = that.globalItemData[i]
|
|
|
let currentPId = currentProduct.id
|
|
let currentPId = currentProduct.id
|
|
@@ -215,7 +187,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
pushToSave(selectData){
|
|
pushToSave(selectData){
|
|
|
this.setSelectInfo({ selectJobType: this.selectJobType, info: selectData,selectJobId:this.selectJobId })
|
|
this.setSelectInfo({ selectJobType: this.selectJobType, info: selectData,selectJobId:this.selectJobId })
|
|
|
- uni.setStorageSync('selectList_'+this.selectJobType+'_target_'+this.selectJobId, selectData)
|
|
|
|
|
|
|
+ localStorage.setItem('selectList_'+this.selectJobType+'_target_'+this.selectJobId, selectData);
|
|
|
},
|
|
},
|
|
|
globalChangeClass(index,item){
|
|
globalChangeClass(index,item){
|
|
|
this.$refs.globalClassImgRef.close()
|
|
this.$refs.globalClassImgRef.close()
|
|
@@ -231,12 +203,12 @@ export default {
|
|
|
removeFromSaveDirect(){
|
|
removeFromSaveDirect(){
|
|
|
let that = this
|
|
let that = this
|
|
|
//删除仓库
|
|
//删除仓库
|
|
|
- uni.removeStorageSync('selectList_'+that.selectJobType+'_target_'+that.selectJobId)
|
|
|
|
|
|
|
+ localStorage.removeItem('selectList_'+that.selectJobType+'_target_'+that.selectJobId)
|
|
|
that.reSetSelectInfo({selectJobType:that.selectJobType,selectJobId:that.selectJobId})
|
|
that.reSetSelectInfo({selectJobType:that.selectJobType,selectJobId:that.selectJobId})
|
|
|
//删除多颜色
|
|
//删除多颜色
|
|
|
//console.log(that.selectJobType+that.selectJobId)
|
|
//console.log(that.selectJobType+that.selectJobId)
|
|
|
if(that.selectJobType == 'bill'){
|
|
if(that.selectJobType == 'bill'){
|
|
|
- uni.removeStorageSync("xj"+that.selectJobId)
|
|
|
|
|
|
|
+ localStorage.removeItem("xj"+that.selectJobId)
|
|
|
}
|
|
}
|
|
|
//删除显示
|
|
//删除显示
|
|
|
if(!this.$util.isEmpty(this.globalItemData)){
|
|
if(!this.$util.isEmpty(this.globalItemData)){
|
|
@@ -286,7 +258,7 @@ export default {
|
|
|
//multiple 0一个一个加减 1弹框方式,多个加减
|
|
//multiple 0一个一个加减 1弹框方式,多个加减
|
|
|
//calc 当multiple=0时,add表示加,sub表示减
|
|
//calc 当multiple=0时,add表示加,sub表示减
|
|
|
replaceItemFn(product,multiple=0,calc='add',scan=0) {
|
|
replaceItemFn(product,multiple=0,calc='add',scan=0) {
|
|
|
- let item = copyObject(product)
|
|
|
|
|
|
|
+ let item = this.$util.copyObject(product)
|
|
|
if(multiple == 0){
|
|
if(multiple == 0){
|
|
|
if(Number(item.smallCount)>0){
|
|
if(Number(item.smallCount)>0){
|
|
|
if(calc == 'add'){
|
|
if(calc == 'add'){
|
|
@@ -362,7 +334,7 @@ export default {
|
|
|
this.globalRememberRefresh()
|
|
this.globalRememberRefresh()
|
|
|
},
|
|
},
|
|
|
delSelectedItem(product){
|
|
delSelectedItem(product){
|
|
|
- let item = copyObject(product)
|
|
|
|
|
|
|
+ let item = this.$util.copyObject(product)
|
|
|
const list = this.selectList
|
|
const list = this.selectList
|
|
|
let index = list.findIndex(element => element.id == item.id)
|
|
let index = list.findIndex(element => element.id == item.id)
|
|
|
if(index != -1){
|
|
if(index != -1){
|
|
@@ -435,7 +407,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.isAddModel = true;
|
|
this.isAddModel = true;
|
|
|
- this.customData = copyObject(info)
|
|
|
|
|
|
|
+ this.customData = this.$util.copyObject(info)
|
|
|
this.isAddInputFocus = false;
|
|
this.isAddInputFocus = false;
|
|
|
this.$nextTick(()=>{
|
|
this.$nextTick(()=>{
|
|
|
this.customData.smallCount = this.customData.smallCount==0?null:this.customData.smallCount;
|
|
this.customData.smallCount = this.customData.smallCount==0?null:this.customData.smallCount;
|
|
@@ -458,31 +430,31 @@ export default {
|
|
|
|
|
|
|
|
//二个都不是数值
|
|
//二个都不是数值
|
|
|
if(/(^[1-9]\d*$)/.test(this.customData.bigCount) == false && /(^[1-9]\d*$)/.test(this.customData.smallCount) == false){
|
|
if(/(^[1-9]\d*$)/.test(this.customData.bigCount) == false && /(^[1-9]\d*$)/.test(this.customData.smallCount) == false){
|
|
|
- uni.showToast({title:"请填写数值",icon:"none"})
|
|
|
|
|
|
|
+ this.$message({message: '请填写数值',type: 'warning'});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(/(^[1-9]\d*$)/.test(this.customData.bigCount)){
|
|
if(/(^[1-9]\d*$)/.test(this.customData.bigCount)){
|
|
|
if(this.customData.bigCount<=0){
|
|
if(this.customData.bigCount<=0){
|
|
|
- uni.showToast({title:"数量要大于0",icon:"none"})
|
|
|
|
|
|
|
+ this.$message({message: '数量要大于0',type: 'warning'});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(/(^[1-9]\d*$)/.test(this.customData.smallCount)){
|
|
if(/(^[1-9]\d*$)/.test(this.customData.smallCount)){
|
|
|
if(this.customData.smallCount<=0){
|
|
if(this.customData.smallCount<=0){
|
|
|
- uni.showToast({title:"数量要大于0",icon:"none"})
|
|
|
|
|
|
|
+ this.$message({message: '数量要大于0',type: 'warning'});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//只有开单和采购需要使用价格
|
|
//只有开单和采购需要使用价格
|
|
|
if(this.selectJobType == 'bill' || this.selectJobType == 'purchase'){
|
|
if(this.selectJobType == 'bill' || this.selectJobType == 'purchase'){
|
|
|
if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.customData.userPrice) == false){
|
|
if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.customData.userPrice) == false){
|
|
|
- uni.showToast({title:"金额错误",icon:"none"})
|
|
|
|
|
|
|
+ this.$message({message: '金额错误',type: 'warning'});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if(this.customData.userPrice <=0){
|
|
if(this.customData.userPrice <=0){
|
|
|
- uni.showToast({title:"金额要大于0",icon:"none"})
|
|
|
|
|
|
|
+ this.$message({message: '金额要大于0',type: 'warning'});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|