电子结算单
This commit is contained in:
@@ -51,12 +51,12 @@
|
||||
|
||||
<view id="instruction" :class="currentBoxId == 'instruction' ? 'show' : 'hidden'">
|
||||
<uni-forms :modelValue="productDate" label-width="200rpx">
|
||||
<uni-forms-item label="属性类别:">
|
||||
<uni-forms-item label="选择规格:">
|
||||
<uni-data-select v-model="productDate.attributesTypeId" :localdata="attributesTypeList"
|
||||
placeholder="请选择商品品牌" @change="attributesData"></uni-data-select>
|
||||
placeholder="请选择规格" @change="attributesData"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<view class="content" v-show="productDate.attributesTypeId">
|
||||
<view style="margin: 10rpx 0;">商品类型:</view>
|
||||
<view style="margin: 10rpx 0;">商品规格:</view>
|
||||
<view>
|
||||
<uni-section type="line">
|
||||
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
||||
@@ -323,16 +323,18 @@
|
||||
checkbox(e) {
|
||||
var index = e; //获取当前点击的下标
|
||||
var checkboxArr = this.radioItem; //选项集合
|
||||
// if (checkboxArr[index].checked) return;//如果点击的当前已选中则返回
|
||||
// checkboxArr.forEach(item => {
|
||||
// item.checked = false
|
||||
// })
|
||||
if (checkboxArr[index].checked == false) {
|
||||
checkboxArr[index].checked = true; //改变当前选中的checked值
|
||||
if (checkboxArr[index].checked) return; //如果点击的当前已选中则返回
|
||||
checkboxArr.forEach(item => {
|
||||
item.checked = false
|
||||
})
|
||||
checkboxArr[index].checked = true; //改变当前选中的checked值
|
||||
|
||||
} else {
|
||||
checkboxArr[index].checked = false; //改变当前选中的checked值
|
||||
}
|
||||
// if (checkboxArr[index].checked == false) {
|
||||
// checkboxArr[index].checked = true; //改变当前选中的checked值
|
||||
|
||||
// } else {
|
||||
// checkboxArr[index].checked = false; //改变当前选中的checked值
|
||||
// }
|
||||
if (checkboxArr[0].checked == true) {
|
||||
this.productDate.newMark = 1
|
||||
} else {
|
||||
@@ -349,6 +351,13 @@
|
||||
let currentFlag = e.currentTarget.id;
|
||||
if (currentFlag == 'next') {
|
||||
this.$refs.productForm.validate().then(res => {
|
||||
if (this.isNumber(this.productDate.price) == false) {
|
||||
uni.showToast({
|
||||
title: '商品售价请输入数字',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
switch (currentFlag) {
|
||||
case 'next':
|
||||
this.currentBoxId = 'instruction'
|
||||
@@ -439,7 +448,7 @@
|
||||
if (this.checkedList.length < index + 1) {
|
||||
this.checkedList.push({
|
||||
attributeId: item.id,
|
||||
checked: this.radioAttributes
|
||||
checked: item.attributesList[index].value
|
||||
})
|
||||
} else {
|
||||
let checked = []
|
||||
@@ -541,21 +550,28 @@
|
||||
fail(err) {}
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
console.log('相机调用失败')
|
||||
fail(err) {
|
||||
console.log('相机调用失败',err)
|
||||
}
|
||||
})
|
||||
},
|
||||
getImage(imageUrl) {
|
||||
if (JSON.stringify(this.productDate.images) == '[]') {
|
||||
this.productDate.images.push({
|
||||
url: imageUrl,
|
||||
mainMark: 1
|
||||
})
|
||||
if (this.productDate.images.length < 10) {
|
||||
if (JSON.stringify(this.productDate.images) == '[]') {
|
||||
this.productDate.images.push({
|
||||
url: imageUrl,
|
||||
mainMark: 1
|
||||
})
|
||||
} else {
|
||||
this.productDate.images.push({
|
||||
url: imageUrl,
|
||||
mainMark: ''
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.productDate.images.push({
|
||||
url: imageUrl,
|
||||
mainMark: ''
|
||||
uni.showToast({
|
||||
title: '最多只能上传十张图片~',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -580,6 +596,9 @@
|
||||
closed() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
isNumber(value) {
|
||||
return /^[0-9]+$/.test(value);
|
||||
},
|
||||
addCompleted() {
|
||||
if (this.radioItem[0].checked = true) {
|
||||
this.productDate.newMark == '1'
|
||||
@@ -591,6 +610,108 @@
|
||||
} else {
|
||||
this.productDate.recommend == '2'
|
||||
}
|
||||
if(this.attributesList.length==1){
|
||||
if(!this.radioAttributes){
|
||||
uni.showToast({
|
||||
title: '请选择商品规格',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if(this.attributesList.length>1){
|
||||
if(JSON.stringify(this.checkboxAttributes) == '[]'){
|
||||
uni.showToast({
|
||||
title: '请选择商品规格',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (!this.productDate.attributesTypeId) {
|
||||
uni.showToast({
|
||||
title: '请选择规格',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (JSON.stringify(this.stockList.length) == '[]') {
|
||||
uni.showToast({
|
||||
title: '请选择商品规格',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
} else {
|
||||
this.stockList.forEach(tab => {
|
||||
if (!tab.marketPrice) {
|
||||
uni.showToast({
|
||||
title: '市场价格必填!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`市场价格必填!`)
|
||||
} else {
|
||||
if (this.isNumber(tab.marketPrice) == false) {
|
||||
uni.showToast({
|
||||
title: '市场价格不是数字!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`市场价格不是数字!`)
|
||||
}
|
||||
}
|
||||
if (!tab.sellPrice) {
|
||||
uni.showToast({
|
||||
title: '销售价格必填!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`销售价格必填!`)
|
||||
} else {
|
||||
if (this.isNumber(tab.sellPrice) == false) {
|
||||
uni.showToast({
|
||||
title: '销售价格不是数字!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`销售价格不是数字!`)
|
||||
}
|
||||
}
|
||||
if (!tab.stock) {
|
||||
uni.showToast({
|
||||
title: '库存数量必填!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`库存数量必填!`)
|
||||
} else {
|
||||
if (this.isNumber(tab.stock) == false) {
|
||||
uni.showToast({
|
||||
title: '库存数量不是数字!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`库存数量不是数字!`)
|
||||
}
|
||||
}
|
||||
if (!tab.integral) {
|
||||
uni.showToast({
|
||||
title: '积分价值必填!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`积分价值必填!`)
|
||||
} else {
|
||||
if (this.isNumber(tab.integral) == false) {
|
||||
uni.showToast({
|
||||
title: '积分价值不是数字!',
|
||||
icon: 'none'
|
||||
})
|
||||
throw Error(`积分价值不是数字!`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (JSON.stringify(this.productDate.images) == '[]') {
|
||||
uni.showToast({
|
||||
title: '请上传商品图片',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.productDate.checkedList = this.checkedList
|
||||
this.productDate.stockList = this.stockList
|
||||
serve.updateProduct(this.productDate).then(res => {
|
||||
@@ -598,7 +719,7 @@
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
uni.navigateTo({
|
||||
wx.navigateBack({
|
||||
url: `../productList/index`
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user