wangfukang 3 years ago
parent
commit
0009b4f2ea
  1. 6
      pages/index/shareStyle.vue
  2. 119
      pages/inventory/AIInventory.vue
  3. 27
      pages/inventory/addinventory.vue
  4. 223
      pages/inventory/goodsList1.vue

6
pages/index/shareStyle.vue

@ -277,7 +277,11 @@
}, },
//点击分享按钮 //点击分享按钮
clickShareBtn(e) { clickShareBtn(e) {
if(e != 'all' && this.carList == ''){
this.tui.toast("请勾选商品后再分享")
return
}
if (e == 'all') { if (e == 'all') {
this.data = { this.data = {
shareType: '1', //1 分享全部 shareType: '1', //1 分享全部

119
pages/inventory/AIInventory.vue

@ -225,8 +225,18 @@
</uni-popup> </uni-popup>
<!-- 新增分类输入框 --> <!-- 新增分类输入框 -->
<uni-popup ref="addGateDialog" type="dialog"> <uni-popup ref="addGateDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="新增分类" placeholder="请输入分类名称" <view class="type-popup" style="width:600rpx;margin-bottom: 0;border-radius: 0;height: 400rpx;border-radius: 10px;">
@confirm="addGategory"></uni-popup-dialog> <view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
修改规格值
</view>
<view style="width: 90%;margin: 80rpx auto;">
<uni-easyinput type="text" v-model="categoryText" @blur="handleBlur" placeholder="请输入规格值" />
</view>
<view style="width: 100%;height: 90rpx;line-height: 90rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;display: flex;position: absolute;bottom: 0;">
<view style="width:50%;" @tap="$refs.addGateDialog.close()">取消</view>
<view style="width:50%;background: linear-gradient(90deg, #FF9797, #FFC1E0);" @tap="addGategory">确认</view>
</view>
</view>
</uni-popup> </uni-popup>
<!-- 弹出合并商品 --> <!-- 弹出合并商品 -->
<uni-popup ref="mergePopup" background-color="#fff" :is-mask-click="true"> <uni-popup ref="mergePopup" background-color="#fff" :is-mask-click="true">
@ -291,10 +301,19 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" background-color="#fff" :is-mask-click="true">
<uni-popup-dialog ref="inputClose" mode="input" :title="dialogTit" :value="inputVal" placeholder="请输入名称" <view class="type-popup" style="width:600rpx;margin-bottom: 0;border-radius: 0;height: 400rpx;border-radius: 10px;">
@confirm="dialogInputConfirm" @close="dialogClose"> <view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
</uni-popup-dialog> 修改规格值
</view>
<view style="width: 90%;margin: 80rpx auto;">
<uni-easyinput type="text" v-model="categoryText" @blur="handleBlur" placeholder="请输入规格值" />
</view>
<view style="width: 100%;height: 90rpx;line-height: 90rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;display: flex;position: absolute;bottom: 0;">
<view style="width:50%;" @tap="dialogClose">取消</view>
<view style="width:50%;background: linear-gradient(90deg, #FF9797, #FFC1E0);" @tap="dialogInputConfirm">确认</view>
</view>
</view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
@ -334,7 +353,8 @@
goodsList: [], goodsList: [],
mergeId:'', mergeId:'',
newTemList: [], newTemList: [],
pecsList: [], pecsList: [],
categoryText:'',
dataObj: new Map(), dataObj: new Map(),
isPlusAndMinus:false, isPlusAndMinus:false,
indexList:[], indexList:[],
@ -476,10 +496,8 @@
// that.carList.get(id).productCount; // that.carList.get(id).productCount;
} }
this.carList1 = [] this.carList1 = []
} else { //当前页有数据 } else { //当前页有数据
console.log('回来1111')
for (let i = 0; i < this.carList1.length; i++) { for (let i = 0; i < this.carList1.length; i++) {
console.log('回来2222')
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
if (this.carList.has(this.carList1[i].id) == true) { //商品相同 if (this.carList.has(this.carList1[i].id) == true) { //商品相同
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
@ -685,6 +703,9 @@
this.$refs.getaPopup.close() this.$refs.getaPopup.close()
}, 200) }, 200)
}, },
handleBlur(e){
this.categoryText = e.detail.value
},
inputDialogToggle(item) { inputDialogToggle(item) {
this.inputVal = ''; this.inputVal = '';
this.isOpenId = item; this.isOpenId = item;
@ -709,10 +730,13 @@
return return
} }
this.tui.request("/app/productAttributeValue/save", "post", { this.tui.request("/app/productAttributeValue/save", "post", {
value: e, value: this.categoryText,
attributeId: this.isOpenId attributeId: this.isOpenId
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.categoryText = ''
this.$refs.inputDialog.close()
this.getGategoryLowList() this.getGategoryLowList()
this.$forceUpdate() this.$forceUpdate()
uni.showToast({ uni.showToast({
@ -726,12 +750,11 @@
}) })
} }
}).catch((res) => {}) }).catch((res) => {})
this.$refs.inputClose.val = ''
}, },
dialogClose() { dialogClose() {
this.inputVal = ''; this.inputVal = '';
this.$refs.inputClose.val = '' this.$refs.inputDialog.close()
this.categoryText = ''
}, },
combination(arr) { combination(arr) {
let result = [ let result = [
@ -756,6 +779,7 @@
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.indexList = res.result; this.indexList = res.result;
this.categoryText = ""
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
@ -866,7 +890,7 @@
}] }]
}] }]
this.tui.request("/app/productCategory/batchSaveCategoryAndAttribute", "post", { this.tui.request("/app/productCategory/batchSaveCategoryAndAttribute", "post", {
categoryName: e, categoryName: this.categoryText,
productAttributeOfAddVos:multipleList productAttributeOfAddVos:multipleList
}, false, false).then((res) => { }, false, false).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -881,7 +905,7 @@
icon: 'none' icon: 'none'
}) })
} }
this.$refs.addGateDialog.close()
}).catch((res) => {}) }).catch((res) => {})
}, },
allChange(e){ allChange(e){
@ -1106,6 +1130,9 @@
this.$refs.mergePopup.open() this.$refs.mergePopup.open()
} }
}, },
shiqujiaodian(e){
console.log("11111",e);
},
//合并已有 //合并已有
clickMerge(value,key){ clickMerge(value,key){
let that = this; let that = this;
@ -1147,7 +1174,6 @@
return return
} }
that.goodsDetail = res.result; that.goodsDetail = res.result;
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
@ -1172,7 +1198,6 @@
isChecked: false isChecked: false
}) })
that.dataObj.set(newObj[val][i], val) that.dataObj.set(newObj[val][i], val)
// isTrue = false
} }
newArr.push({ newArr.push({
name: val, name: val,
@ -1206,13 +1231,10 @@
} }
}).catch((res) => {}) }).catch((res) => {})
}, 300) }, 300)
})
})
this.pageOldTemList = [] this.pageOldTemList = []
that.temporaryList = [] that.temporaryList = []
if (that.carList.size > 0) { if (that.carList.size > 0) {
// let isTrue = false
that.carList.forEach(function(value, key) { that.carList.forEach(function(value, key) {
value.stockLogList.forEach(function(values, keys) { value.stockLogList.forEach(function(values, keys) {
if(value.stockLogList1.length == 0){ if(value.stockLogList1.length == 0){
@ -1237,15 +1259,14 @@
} }
} }
} }
} }
}) })
}) })
that.zNum = 0 that.zNum = 0
console.log('id',id)
that.$nextTick(() => { that.$nextTick(() => {
that.carList.forEach(function(value, key) { that.carList.forEach(function(value, key) {
if (value.productId == id) { if (value.productId == id || value.productId == id.productId) {
that.zNum = value.productCount that.zNum = value.productCount
that.temporaryList = value.stockLogList1 that.temporaryList = value.stockLogList1
that.pageOldTemList = value.stockLogList1 that.pageOldTemList = value.stockLogList1
@ -1254,12 +1275,10 @@
value.stockLogList1 = [] value.stockLogList1 = []
}) })
}) })
} }
setTimeout(res => { setTimeout(res => {
this.getKCList(current == 1?id.id:id); this.getKCList(current == 1?id.id:id);
}, 300) }, 300)
}, },
//库存商品详情 //库存商品详情
getKCList(id) { getKCList(id) {
@ -1290,8 +1309,7 @@
temporaryCheck() { temporaryCheck() {
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
console.log('goodsDetail',this.goodsDetail);
let that = this, let that = this,
carList1 = [] carList1 = []
let data = { let data = {
@ -1320,9 +1338,7 @@
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) { for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false this.goodsDetail.attributeList[i].value[m].isChecked = false
} }
} }
console.log('测试',carList1);
console.log('carList',this.carList);
if (this.carList.size == 0) { //当前页没有数据 if (this.carList.size == 0) { //当前页没有数据
for (let i = 0; i < carList1.length; i++) { for (let i = 0; i < carList1.length; i++) {
let obj = { let obj = {
@ -1360,21 +1376,28 @@
} else { //当前页有数据 } else { //当前页有数据
for (let i = 0; i < carList1.length; i++) { for (let i = 0; i < carList1.length; i++) {
// if(this.carList.get(carList1[i].id)){
// this.carList.get(carList1[i].id).productCount = 0
// }
if (this.carList.has(carList1[i].id) == true) { //商品相同 if (this.carList.has(carList1[i].id) == true) { //商品相同
if(this.carList.get(carList1[i].id)){
this.carList.get(carList1[i].id).productCount = 0
}
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i] if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
.saleDetailQueryDTO[ .saleDetailQueryDTO[
m].attributeList) == true) { //规格相同 m].attributeList) == true) { //规格相同
var data1 = {
this.carList.get(carList1[i].id).stockLogList.get(carList1[i] productCount: carList1[i].saleDetailQueryDTO[m].productCount,
.saleDetailQueryDTO[m].attributeList).productCount += carList1[i] name: carList1[i].saleDetailQueryDTO[m].name,
.saleDetailQueryDTO[m].productCount uuid:'A'+generateUUID()
this.carList.get(carList1[i].id).price1 = this.carList.get(carList1[i].id).productCount * this.goodsDetail.purchasePrice }
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
// this.carList.get(carList1[i].id).stockLogList.get(carList1[i]
// .saleDetailQueryDTO[m].attributeList).productCount += carList1[i]
// .saleDetailQueryDTO[m].productCount
// this.carList.get(carList1[i].id).price1 = this.carList.get(carList1[i].id).productCount * this.goodsDetail.purchasePrice
} else { //规格不同 } else { //规格不同
var data1 = { var data1 = {
@ -1396,7 +1419,8 @@
price:this.goodsDetail.price, price:this.goodsDetail.price,
price1: 0, price1: 0,
productCount: 0, productCount: 0,
productId: carList1[i].id, productId: carList1[i].id,
categoryId:this.goodsDetail.categoryId,
productName: carList1[i].productName, productName: carList1[i].productName,
wholesalePrice: this.goodsDetail.wholesalePrice, wholesalePrice: this.goodsDetail.wholesalePrice,
lsprice: this.goodsDetail.price, lsprice: this.goodsDetail.price,
@ -1454,8 +1478,9 @@
}, },
//计算欠款 //计算欠款
changePay(e) { changePay(e) {
this.alreadyPay = e.target.value > this.shouldPay ? this.shouldPay : e.target.value this.alreadyPay = Number(e.target.value) > Number(this.shouldPay) ? this.shouldPay : e.target.value
this.noPay = this.shouldPay - this.alreadyPay this.noPay = this.shouldPay - this.alreadyPay
this.noPay = this.noPay.toFixed(2)
}, },
//跳转选择供应商 //跳转选择供应商
goPopleList(popleType) { goPopleList(popleType) {
@ -1491,7 +1516,7 @@
var that = this; var that = this;
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "确定删除此条商品吗?", content: "确定删除此条规格吗?",
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
if(that.carList.get(id).stockLogList.size == 1){ if(that.carList.get(id).stockLogList.size == 1){

27
pages/inventory/addinventory.vue

@ -875,24 +875,10 @@
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i].saleDetailQueryDTO[m].attributeList) == true) { //规格相同 if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i].saleDetailQueryDTO[m].attributeList) == true) { //规格相同
var data1 = { var data1 = {
productCount: this.carList.get(carList1[i].id).stockLogList.get(carList1[i].saleDetailQueryDTO[m].attributeList).productCount + carList1[i].saleDetailQueryDTO[m].productCount, productCount: this.carList.get(carList1[i].id).stockLogList.get(carList1[i].saleDetailQueryDTO[m].attributeList).productCount,
name: carList1[i].saleDetailQueryDTO[m].name name: carList1[i].saleDetailQueryDTO[m].name
} }
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
// var data1 = {
// productCount: carList1[i].saleDetailQueryDTO[m].productCount,
// name: carList1[i].saleDetailQueryDTO[m].name
// }
// this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[
// m].attributeList, data1)
// this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
// .saleDetailQueryDTO[
// m].attributeList, this.carList.get(carList1[i].id).stockLogList.get(
// carList1[i].saleDetailQueryDTO[m].attributeList) + carList1[i]
// .saleDetailQueryDTO[m].productCount)
} else { //规格不同 } else { //规格不同
var data1 = { var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount, productCount: carList1[i].saleDetailQueryDTO[m].productCount,
@ -940,15 +926,16 @@
this.$refs.shopPopup.close() this.$refs.shopPopup.close()
setTimeout(res => { setTimeout(res => {
uni.hideLoading(); uni.hideLoading();
}, 2000) }, 500)
}, },
changessPrice() { changessPrice() {
this.noPay = this.shouldPay - this.alreadyPay; this.noPay = this.shouldPay - this.alreadyPay;
}, },
//计算欠款 //计算欠款
changePay(e) { changePay(e) {
this.alreadyPay = e.target.value > this.shouldPay ? this.shouldPay : e.target.value this.alreadyPay = Number(e.target.value) > Number(this.shouldPay) ? this.shouldPay : e.target.value
this.noPay = this.shouldPay - this.alreadyPay this.noPay = this.shouldPay - this.alreadyPay
this.noPay = this.noPay.toFixed(2)
}, },
//跳转选择供应商 //跳转选择供应商
goPopleList(popleType) { goPopleList(popleType) {

223
pages/inventory/goodsList1.vue

@ -108,7 +108,9 @@
库存 库存
</text> </text>
</view> </view>
<view style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;">数量</view> <view style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;">
数量
</view>
</view> </view>
<view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)" <view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)"
:key='keys' :id="values[1].uuid"> :key='keys' :id="values[1].uuid">
@ -649,7 +651,7 @@
recordState:false, recordState:false,
currentAnchor: '', currentAnchor: '',
temporaryNum:0, temporaryNum:0,
isInventory:false, isInventory:true,
noList:[], noList:[],
aiNotRecognition:'', aiNotRecognition:'',
getMsg:'' getMsg:''
@ -913,7 +915,7 @@
disNoAmount:this.carList1[i].wholesalePrice || 0, //折前价,用于计算整体折扣 disNoAmount:this.carList1[i].wholesalePrice || 0, //折前价,用于计算整体折扣
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 wholesalePrice: this.carList1[i].wholesalePrice, //批发价
lsprice: this.carList1[i].price, //零售价 lsprice: this.carList1[i].price, //零售价
productCount: this.carList1[i].productCount, //总数量 productCount: 0, //总数量
id: this.carList1[i].productId, id: this.carList1[i].productId,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture, productPicture: this.carList1[i].productPicture,
@ -971,11 +973,11 @@
categoryId:this.carList1[i].categoryId, categoryId:this.carList1[i].categoryId,
productId:this.carList1[i].productId, productId:this.carList1[i].productId,
unitPrice: this.carList1[i].price || 0, //单价 unitPrice: this.carList1[i].price || 0, //单价
discountAmount: this.carList1[i].unitPrice || 0, //折后价 discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
disNoAmount:this.carList1[i].unitPrice || 0, //折前价,用于计算整体折扣 disNoAmount:this.carList1[i].wholesalePrice || 0, //折前价,用于计算整体折扣
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 wholesalePrice: this.carList1[i].wholesalePrice, //批发价
lsprice: this.carList1[i].price, //零售价 lsprice: this.carList1[i].price, //零售价
productCount: this.carList1[i].productCount, //总数量 productCount: 0, //总数量
id: this.carList1[i].productId, id: this.carList1[i].productId,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture, productPicture: this.carList1[i].productPicture,
@ -1005,22 +1007,25 @@
} }
} }
console.log(that.priceType)
this.carList1 = [] this.$nextTick(() =>{
this.carList.forEach(function(value, key) { this.carList1 = []
if (that.priceType == '') { this.carList.forEach(function(value, key) {
// value.unitPrice = value.unitPrice if (that.priceType == '') {
} else if (that.priceType == 0) { //零售 // value.unitPrice = value.unitPrice
value.unitPrice = value.lsprice } else if (that.priceType == 0) { //零售
} else if (that.priceType == 1) { //批发 value.unitPrice = value.lsprice
value.unitPrice = value.wholesalePrice } else if (that.priceType == 1) { //批发
} value.unitPrice = value.wholesalePrice
if (that.discountType == 1) { //整体折扣 }
value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000 if (that.discountType == 1) { //整体折扣
} value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000
}
})
this.getAllPrice()
this.getAmountAndWho()
}) })
this.getAllPrice() // 2019002均色M码1件2019005黑色S码一件
this.getAmountAndWho()
}, },
//保存已选 //保存已选
saveCheck() { saveCheck() {
@ -1385,12 +1390,17 @@
this.relPrice = e.target.value this.relPrice = e.target.value
this.noPay = this.relPrice - this.priceOk; this.noPay = this.relPrice - this.priceOk;
}, },
changePrice(e) { changePrice(e) {
e.detail.value = e.detail.value > this.relPrice ? this.relPrice : e.detail.value console.log(this.relPrice)
this.priceOk = e.detail.value console.log(e.detail.value)
if(Number(e.detail.value) > Number(this.relPrice)){
this.priceOk = this.relPrice
}else{
this.priceOk =e.detail.value
}
this.$forceUpdate() this.$forceUpdate()
this.noPay = this.relPrice - this.priceOk; this.noPay = this.relPrice - this.priceOk;
this.noPay = this.noPay.toFixed(2)
}, },
getImg(key) { getImg(key) {
return this.carList.get(key).productPicture return this.carList.get(key).productPicture
@ -1431,9 +1441,10 @@
convertChineseToArabic(str) { convertChineseToArabic(str) {
const chineseNumToArabic = { const chineseNumToArabic = {
'零': 0, '一': 1, '二': 2, '两': 2, '三': 3, '零': 0, '一': 1, '二': 2, '两': 2, '三': 3,
'四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9,'杠':'-','刚':'-' '四': 4, '五': 5, '六': 6, '七': 7, '八': 8,
'九': 9,'杠':'-','刚':'-','军色':'均色'
}; };
const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚)/g; const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色)/g;
return str.replace(regex, match => chineseNumToArabic[match]); return str.replace(regex, match => chineseNumToArabic[match]);
}, },
//编辑挂单信息 //编辑挂单信息
@ -1457,7 +1468,7 @@
for(let i=0;i<res.result.data.length;i++){ for(let i=0;i<res.result.data.length;i++){
let newList = [] let newList = []
res.result.data[i].productCount = 0 // res.result.data[i].productCount = 0
for(let m=0;m<res.result.data[i].stockLogList1.length;m++){ for(let m=0;m<res.result.data[i].stockLogList1.length;m++){
if(res.result.data[i].stockLogList1[m].stockCount != null){ if(res.result.data[i].stockLogList1[m].stockCount != null){
newList.push(res.result.data[i].stockLogList1[m]) newList.push(res.result.data[i].stockLogList1[m])
@ -1483,7 +1494,7 @@
} }
this.AiHandleData() this.AiHandleData()
} else { } else {
this.tui.toast(res.message) this.tui.toast("抱歉:小助手对"+this.getMsg+"的部分商品未识别,请检查识别信息是否正确")
} }
}).catch((res) => { }).catch((res) => {
this.tui.toast(res) this.tui.toast(res)
@ -1573,18 +1584,17 @@
let that = this; let that = this;
this.priceType = e this.priceType = e
that.priceCurrent = index that.priceCurrent = index
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
that.index = value.productId || value.id
if (e == '0') { //零售
that.index = value.productId || value.id value.discountAmount = value.lsprice
} else { //批发
if (e == 0) { //零售 value.discountAmount = value.wholesalePrice
that.checkPay(value.lsprice)
} else { //批发
that.checkPay(value.wholesalePrice)
} }
}) })
that.$nextTick(() => { that.$nextTick(() => {
this.getAllPrice()
this.getAmountAndWho()
setTimeout(res => { setTimeout(res => {
uni.hideLoading(); uni.hideLoading();
}, 500) }, 500)
@ -1606,7 +1616,7 @@
num.price = price * num.productCount; num.price = price * num.productCount;
this.$refs.inputDialog.close() this.$refs.inputDialog.close()
this.$refs.historyPopup.close() this.$refs.historyPopup.close()
num.discountAmount = num.unitPrice * num.discount / 10 // num.discountAmount = num.unitPrice * num.discount / 10
num.disNoAmount = num.discountAmount num.disNoAmount = num.discountAmount
num.price = num.unitPrice * num.discount / 10 * num.productCount num.price = num.unitPrice * num.discount / 10 * num.productCount
that.relPrice = that.shouldPay that.relPrice = that.shouldPay
@ -1632,24 +1642,25 @@
value.unitPrice = price; value.unitPrice = price;
if (that.discountType == 1) { //整体折扣 if (that.discountType == 1) { //整体折扣
value.discountAmount = value.unitPrice * 10000 * that.discountNum / 10 / 10000 value.discountAmount = value.unitPrice * (that.discountNum / 10)
value.discountAmount = value.discountAmount.toFixed(2) value.discountAmount = value.discountAmount.toFixed(2)
value.price = value.discountAmount * value.productCount value.price = value.discountAmount * value.productCount
value.price = value.price.toFixed(2)
} else if (that.discountType == 0) { //单品折扣 } else if (that.discountType == 0) { //单品折扣
value.discountAmount = value.unitPrice * value.discount / 10 value.discountAmount = value.unitPrice * (value.discount / 10)
value.discountAmount = value.discountAmount.toFixed(2) value.discountAmount = value.discountAmount.toFixed(2)
value.price = value.unitPrice * value.discount / 10 * value.productCount value.price = (value.unitPrice * (value.discount / 10)) * value.productCount
value.price = value.price.toFixed(2) value.price = value.price.toFixed(2)
} }
}) })
this.getAllPrice(); this.getAllPrice();
if (this.relPrice == '' || this.relPrice == 0) { // if (this.relPrice == '' || this.relPrice == 0) {
that.noPay = that.shouldPay // that.noPay = that.shouldPay
} else if (this.relPrice != '' && this.priceOk != '') { // } else if (this.relPrice != '' && this.priceOk != '') {
that.noPay = this.relPrice - this.priceOk // that.noPay = this.relPrice - this.priceOk
} // }
}, },
AiAddSpec(value){ AiAddSpec(value){
this.getById(value.productId || value.id); this.getById(value.productId || value.id);
@ -1666,10 +1677,7 @@
} }
that.goodsDetail = res.result; that.goodsDetail = res.result;
that.temporaryList = [] that.temporaryList = []
if (that.carList.size > 0) { if (that.carList.size > 0) {
// let isTrue = false
that.carList.forEach(function(value, key) { that.carList.forEach(function(value, key) {
value.stockLogList.forEach(function(values, keys) { value.stockLogList.forEach(function(values, keys) {
if(value.stockLogList1.length == 0){ if(value.stockLogList1.length == 0){
@ -1694,9 +1702,7 @@
} }
} }
} }
} }
}) })
}) })
that.zNum = 0 that.zNum = 0
@ -1711,14 +1717,12 @@
value.stockLogList1 = [] value.stockLogList1 = []
}) })
}) })
} }
that.$nextTick(() => { that.$nextTick(() => {
console.log('temporaryList', that.temporaryList) console.log('temporaryList', that.temporaryList)
console.log('pageOldTemList', that.pageOldTemList) console.log('pageOldTemList', that.pageOldTemList)
}) })
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", { this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
categoryId: this.goodsDetail.categoryId categoryId: this.goodsDetail.categoryId
}, false, true).then((res1) => { }, false, true).then((res1) => {
@ -1731,30 +1735,12 @@
let dataArr = [] let dataArr = []
for (let val in newObj) { for (let val in newObj) {
let valueObj = []; let valueObj = [];
// let isTrue = false
for (var i = 0; i < newObj[val].length; i++) { for (var i = 0; i < newObj[val].length; i++) {
// for (var m = 0; m < this.oldTemList.length; m++) {
// var data = this.oldTemList[m].name.split('/')
// for (var j = 0; j < data.length; j++) {
// if (data[j] == newObj[val][i]) {
// isTrue = true
// }
// }
// }
// for (var m = 0; m < this.pageOldTemList.length; m++) {
// var data = this.pageOldTemList[m].name.split('/')
// for (var j = 0; j < data.length; j++) {
// if (data[j] == newObj[val][i]) {
// isTrue = true
// }
// }
// }
valueObj.push({ valueObj.push({
value: newObj[val][i], value: newObj[val][i],
isChecked: false isChecked: false
}) })
this.dataObj.set(newObj[val][i], val) this.dataObj.set(newObj[val][i], val)
// isTrue = false
} }
newArr.push({ newArr.push({
name: val, name: val,
@ -1772,26 +1758,16 @@
oldValue.push(this.goodsDetail.attributeList[i].value[m].value) oldValue.push(this.goodsDetail.attributeList[i].value[m].value)
} }
} }
// if (oldCheck) { let specs1 = {
// let specs1 = { specs: []
// specs: [] }
// } this.goodsList.push(specs1)
// specs1.specs = oldValue
// this.goodsList.push(specs1)
// } else {
let specs1 = {
specs: []
}
this.goodsList.push(specs1)
// }
oldCheck = false oldCheck = false
oldValue = [] oldValue = []
} }
} else { } else {
this.tui.toast('失败了') this.tui.toast('失败了')
} }
} else { } else {
this.tui.toast(res1.message) this.tui.toast(res1.message)
} }
@ -1836,9 +1812,9 @@
}) })
this.price = this.shouldPay this.price = this.shouldPay
this.relPrice = this.shouldPay this.relPrice = this.shouldPay
if(this.priceOk != ''){ // if(this.priceOk != ''){
this.priceOk = this.relPrice // this.priceOk = this.relPrice
} // }
this.$forceUpdate() this.$forceUpdate()
this.discountNum = 10 this.discountNum = 10
@ -1942,7 +1918,6 @@
this.goodsDetail.attributeList[i].value[m].isChecked = false this.goodsDetail.attributeList[i].value[m].isChecked = false
} }
} }
if (this.carList.size == 0) { //当前页没有数据 if (this.carList.size == 0) { //当前页没有数据
for (let i = 0; i < carList1.length; i++) { for (let i = 0; i < carList1.length; i++) {
let obj = { let obj = {
@ -2316,7 +2291,7 @@
} }
value.stockLogList.forEach(function(value1, key1) { value.stockLogList.forEach(function(value1, key1) {
if (that.countPrint() < that.printTotal) { if (that.countPrint() < that.printTotal) {
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, (that.slicePrint( strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, '□ '+(that.slicePrint(
key1)) + '*' + value1.productCount) key1)) + '*' + value1.productCount)
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value
.discountAmount) .discountAmount)
@ -2329,9 +2304,8 @@
strCmd = '' strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0); strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, (that strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '□ '+(that
.slicePrint( .slicePrint(key1)) + '*' + value1.productCount)
key1)) + '*' + value1.productCount)
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value
.discountAmount) .discountAmount)
strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value
@ -2371,7 +2345,7 @@
} }
if (that.countPrint() < this.printTotal) { if (that.countPrint() < this.printTotal) {
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk) strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)) strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk).toFixed(2))
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 :
this.otherExpense)) this.otherExpense))
} else { } else {
@ -2382,7 +2356,7 @@
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0); strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '实收:' + this.priceOk) strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '实收:' + this.priceOk)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)) strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk).toFixed(2))
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 :
this.otherExpense)) this.otherExpense))
@ -2506,15 +2480,15 @@
this.temporaryChange() this.temporaryChange()
}, },
//删除整条商品 //删除整条商品
delShop(id) { delShop(id) {
uni.showLoading({
title: '加载中...'
})
var that = this; var that = this;
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "确定删除此条商品吗?", content: "确定删除此条商品吗?",
success: function(res) { success: function(res) {
uni.showLoading({
title: '加载中...'
})
if (res.confirm) { if (res.confirm) {
if (that.carList.has(id) == true) { if (that.carList.has(id) == true) {
that.carList.delete(id) that.carList.delete(id)
@ -2522,19 +2496,20 @@
that.$forceUpdate() that.$forceUpdate()
that.getAllPrice() that.getAllPrice()
that.getAmountAndWho() that.getAmountAndWho()
} }
setTimeout(res => {
uni.hideLoading();
}, 500)
} }
}) })
setTimeout(res => {
uni.hideLoading();
}, 500)
}, },
//删除商品下的某一个规格 //删除商品下的某一个规格
delShopSpec(id, name) { delShopSpec(id, name) {
var that = this; var that = this;
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "确定删除此条商品吗?", content: "确定删除此条规格吗?",
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name).productCount; that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name).productCount;
@ -2559,13 +2534,15 @@
this.totalAmount = 0 this.totalAmount = 0
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
that.shouldPay = Number(that.shouldPay) + Number(value.price) that.shouldPay = Number(that.shouldPay) + Number(value.price)
that.totalAmount = that.totalAmount + value.productCount that.totalAmount = that.totalAmount + value.productCount
}) })
that.shouldPay = that.shouldPay.toFixed(2)
this.relPrice = this.shouldPay this.relPrice = this.shouldPay
this.$forceUpdate() this.$forceUpdate()
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk)
that.noPay = that.noPay.toFixed(2)
}, },
//修改已选规格的数量 //修改已选规格的数量
GoodsNumChange(e, index, index1) { GoodsNumChange(e, index, index1) {
@ -2580,9 +2557,7 @@
// that.carList.get(index[0]).price = that.carList.get(index[0]).price.toFixed(2) // that.carList.get(index[0]).price = that.carList.get(index[0]).price.toFixed(2)
// console.log(that.carList.get(index[0]).price) // console.log(that.carList.get(index[0]).price)
} else { } else {
that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * that.carList.get( that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * that.carList.get(index[0]).unitPrice
index[0])
.unitPrice
} }
}) })
that.getAllPrice() that.getAllPrice()
@ -2617,15 +2592,15 @@
that.$forceUpdate() that.$forceUpdate()
}, },
//清空全部数据 //清空全部数据
clearAll() { clearAll() {
uni.showLoading({
title: '加载中...'
})
let that = this; let that = this;
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "确定清空全部已选商品吗?", content: "确定清空全部已选商品吗?",
success: function(res) { success: function(res) {
uni.showLoading({
title: '加载中...'
})
if (res.confirm) { if (res.confirm) {
console.log(that.priceCurrent) console.log(that.priceCurrent)
that.carList.clear() that.carList.clear()
@ -2653,13 +2628,13 @@
that.totalAmount = 0 that.totalAmount = 0
that.saleId = '' that.saleId = ''
that.priceCurrent = null that.priceCurrent = null
that.$forceUpdate() that.$forceUpdate()
setTimeout(res => {
uni.hideLoading();
}, 500)
} }
} }
}) })
setTimeout(res => {
uni.hideLoading();
}, 500)
} }
} }
} }

Loading…
Cancel
Save