电子结算单

This commit is contained in:
2024-04-16 17:16:00 +08:00
parent a0b52f8a4c
commit dfbafd8ea8
11 changed files with 1171 additions and 207 deletions

View File

@@ -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">
@@ -170,6 +170,7 @@
isBoxShow: false,
productDate: {
productStatus: '1',
newMark: 1,
images: []
},
productList: [],
@@ -268,16 +269,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 {
@@ -294,6 +297,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'
@@ -383,7 +393,7 @@
if (this.checkedList.length < index + 1) {
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
checked: item.attributesList[index].value
})
} else {
let checked = []
@@ -456,7 +466,7 @@
let _that = this
let imageUrl = ''
uni.chooseImage({
count: 10, //默认9
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function(res) {
@@ -493,17 +503,25 @@
})
},
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'
})
}
},
setMainImage(items, index) {
let obj = items
@@ -528,6 +546,9 @@
url: '/pages/index/index'
})
},
isNumber(value) {
return /^[0-9]+$/.test(value);
},
addCompleted() {
if (this.radioItem[0].checked = true) {
this.productDate.newMark == '1'
@@ -539,6 +560,109 @@
} else {
this.productDate.recommend == '2'
}
if (!this.productDate.attributesTypeId) {
uni.showToast({
title: '请选择请选择规格',
icon: 'none'
})
return
}
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 (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.saveProduct(this.productDate).then(res => {

View File

@@ -31,9 +31,9 @@
:style="{background:statusEnum[item.auditStatus].color}">{{statusEnum[item.auditStatus].value}}
</view>
<view class="footer">
<view class="button" @click="orderDelete">删除</view>
<view class="button" @click="orderDelete(item)">删除</view>
<view class="button" @click="toEditOrder(item)">编辑</view>
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'':''}}</view>
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'':''}}</view>
</view>
</view>
<view style="height: 30rpx; background: #fff;"></view>
@@ -72,7 +72,7 @@
<view class="title">是否删除该商品</view>
<view class="buttons">
<view @click="$refs.delete.close()">取消</view>
<view>确认</view>
<view @click="deleteIntegral">确认</view>
</view>
</view>
</uni-popup>
@@ -167,7 +167,7 @@
methods: {
selectOptions(index) {
this.currentIndex = index
console.log(index, 'index')
this.paramter.currentPage = 1
if (index == 0) {
this.paramter.params = {}
} else if (index == 1) {
@@ -215,7 +215,7 @@
productByPage() {
serve.productByPage(this.paramter).then(res => {
if (res.code === 20000) {
if (!res.data.list.length) {
if (!res.data.list.length&&this.paramter.currentPage!=1) {
uni.showToast({
title: '没有更多订单啦~',
icon: 'none'
@@ -241,8 +241,19 @@
})
this.$refs.detail.open('center')
},
orderDelete() {
orderDelete(item) {
this.$refs.delete.open('center')
this.deleteData = item
},
deleteIntegral(){
serve.deleteProductById({id:this.deleteData.id}).then(res=>{
uni.showToast({
title: res.msg,
icon: 'none'
})
this.$refs.delete.close()
this.search()
})
},
toEditOrder(item) {
uni.navigateTo({

View File

@@ -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`
})
})