|
|
|
@ -39,10 +39,10 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-forms-item> |
|
|
|
<!-- <uni-forms-item label="客户价格" name="categoryId" v-if="customerCategoryList != null"> |
|
|
|
<uni-forms-item label="客户价格" name="categoryId"> |
|
|
|
<view class="content-list"> |
|
|
|
<view class="list-val"> |
|
|
|
<input type="text" placeholder="根据客户分类自定义价格" disabled :value="formData.userCategoryName" |
|
|
|
<input type="text" placeholder="根据客户分类自定义价格" disabled |
|
|
|
style="border-bottom: 1px solid #fff;text-align: center;" @tap="addCustomPrice"> |
|
|
|
<uni-icons type="right" size="16" |
|
|
|
style="margin-left: 40rpx;line-height: 70rpx;"></uni-icons> |
|
|
|
@ -56,7 +56,7 @@ |
|
|
|
{{item.categoryName}}:{{item.categoryPrice}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
<uni-forms-item label="添加规格" name="categoryId"> |
|
|
|
<view class="content-list"> |
|
|
|
<view class="list-val"> |
|
|
|
@ -435,7 +435,7 @@ |
|
|
|
typeItem: {}, |
|
|
|
arrtChange: [], |
|
|
|
categoryId: '', |
|
|
|
dataList: [], |
|
|
|
dataList: {}, |
|
|
|
zPrice: 0, |
|
|
|
type: 'add', |
|
|
|
customerCategoryList:[], |
|
|
|
@ -513,8 +513,10 @@ |
|
|
|
if (this.typeItem) { |
|
|
|
this.formData.categoryId = this.typeItem.id |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
this.getCustomerCategoryList() |
|
|
|
if (option.dataList) { |
|
|
|
this.dataList = JSON.parse(option.dataList) |
|
|
|
this.tui.request("/app/product/getById/" + this.dataList.id, "POST", { |
|
|
|
@ -522,13 +524,15 @@ |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.type = 'edit' |
|
|
|
this.customerCategoryList = JSON.parse(res.result.customerCategoryRule) |
|
|
|
this.customerCategoryList = this.checkPriceRule((res.result.customerCategoryRule != '' && res.result.customerCategoryRule != null)? JSON.parse(res.result.customerCategoryRule): null) |
|
|
|
console.log('customerCategoryList',this.customerCategoryList) |
|
|
|
this.formData.attrId = res.result.attrId |
|
|
|
this.formData.productName = res.result.productName |
|
|
|
this.formData.barcode = res.result.barcode |
|
|
|
this.formData.price = res.result.price |
|
|
|
this.formData.productSn = res.result.productSn |
|
|
|
this.formData.stockCount = this.dataList.stockCount |
|
|
|
this.formData.minusStockCount = this.dataList.minusStockCount |
|
|
|
this.formData.purchasePrice = res.result.purchasePrice |
|
|
|
this.oldPurchasePrice = res.result.purchasePrice |
|
|
|
this.formData.wholesalePrice = res.result.wholesalePrice |
|
|
|
@ -543,8 +547,6 @@ |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
}else{ |
|
|
|
this.getCustomerCategoryList() |
|
|
|
} |
|
|
|
this.userType = uni.getStorageSync('type') |
|
|
|
|
|
|
|
@ -752,7 +754,14 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
addCustomPrice(){ |
|
|
|
this.$refs.customPopup.open() |
|
|
|
if(this.customerCategoryList == null){ |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/index/customClassList' |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
this.$refs.customPopup.open() |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
generateSn(value) { |
|
|
|
this.tui.request("/app/productSn/getNewProductSn", "POST", { |
|
|
|
@ -782,6 +791,31 @@ |
|
|
|
this.$refs.customPopup.close() |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
checkPriceRule(ruleArr){ |
|
|
|
if(ruleArr != null && ruleArr != ''){ |
|
|
|
if(this.customerCategoryList != '' && this.customerCategoryList != null){ |
|
|
|
let categorySon = [] |
|
|
|
for(let i=0;i<this.customerCategoryList.length;i++){ |
|
|
|
let isHae = false |
|
|
|
for(let j=0;j<ruleArr.length;j++){ |
|
|
|
if(this.customerCategoryList[i].categoryId == ruleArr[j].categoryId){ |
|
|
|
isHae = true |
|
|
|
} |
|
|
|
} |
|
|
|
if(isHae == false){ |
|
|
|
ruleArr.push(this.customerCategoryList[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
ruleArr = this.customerCategoryList |
|
|
|
} |
|
|
|
}else{ |
|
|
|
ruleArr = this.customerCategoryList |
|
|
|
} |
|
|
|
|
|
|
|
return ruleArr |
|
|
|
}, |
|
|
|
async startGetSn() { |
|
|
|
var that = this; |
|
|
|
if (this.prefixRule == '') { |
|
|
|
@ -942,7 +976,7 @@ |
|
|
|
} else { |
|
|
|
this.formData.purchasePrice = e.target.value |
|
|
|
console.log('改变', this.formData) |
|
|
|
if (this.dataList == '') { |
|
|
|
if (this.dataList.id) { |
|
|
|
uni.hideLoading() |
|
|
|
return |
|
|
|
} |
|
|
|
@ -1015,20 +1049,22 @@ |
|
|
|
}, |
|
|
|
//货号是否重复 |
|
|
|
getSnIsRepeat() { |
|
|
|
this.tui.request('/app/product/getByProductSn', "post", { |
|
|
|
productSn: this.formData.productSn |
|
|
|
}, false, true).then((res1) => { |
|
|
|
if (res1.code == 200) { |
|
|
|
if (res1.result != '') { |
|
|
|
this.tui.toast('当前货号已被商品:“' + res1.result[0].productName + '”占用,请重新输入') |
|
|
|
this.formData.productSn = '' |
|
|
|
if(this.formData.productSn != '' && this.dataList.productSn != this.formData.productSn){ |
|
|
|
this.tui.request('/app/product/getByProductSn', "post", { |
|
|
|
productSn: this.formData.productSn |
|
|
|
}, false, true).then((res1) => { |
|
|
|
if (res1.code == 200) { |
|
|
|
if (res1.result != '') { |
|
|
|
this.tui.toast('当前货号已被商品:“' + res1.result[0].productName + '”占用,请重新输入') |
|
|
|
this.formData.productSn = '' |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
ejectRuleSelect() { |
|
|
|
if (this.dataList != '') { |
|
|
|
if (this.dataList.id) { |
|
|
|
//颜色 |
|
|
|
for (let m = 0; m < this.multipleList[0].productAttributeValueVoList.length; m++) { |
|
|
|
let isTrue = true |
|
|
|
@ -1064,7 +1100,7 @@ |
|
|
|
} |
|
|
|
this.$nextTick(() => { |
|
|
|
this.oldMultipleList = this.multipleList |
|
|
|
if (this.dataList == '') { |
|
|
|
if (this.dataList.id) { |
|
|
|
this.multipleList = [] |
|
|
|
} |
|
|
|
this.$refs.addTypeDialog.open('bottom') |
|
|
|
@ -1075,7 +1111,7 @@ |
|
|
|
let that = this; |
|
|
|
let url = '' |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
if (that.dataList != '') { |
|
|
|
if (that.dataList.id) { |
|
|
|
url = '/app/product/edit' |
|
|
|
this.formData.id = that.dataList.id |
|
|
|
this.formData.stockCount = that.dataList.stockCount |
|
|
|
@ -1112,7 +1148,7 @@ |
|
|
|
console.log('purchasePrice', this.formData) |
|
|
|
that.tui.request(url, "post", this.formData, false, false).then((res1) => { |
|
|
|
if (res1.code == 200) { |
|
|
|
if (that.dataList != '') { //编辑商品 |
|
|
|
if (that.dataList.id) { //编辑商品 |
|
|
|
let pages = getCurrentPages(); |
|
|
|
let prevPage = pages[pages.length - 3]; |
|
|
|
let shopList = prevPage.$vm.shopList |
|
|
|
|