wangfukang 3 years ago
parent
commit
cce8468ce3
  1. 125
      pages/inventory/AIInventory.vue
  2. 3
      pages/inventory/addinventory.vue
  3. 85
      pages/inventory/gategoryLow.vue
  4. 2
      pages/inventory/goodsList1.vue

125
pages/inventory/AIInventory.vue

@ -29,12 +29,15 @@
:key="key"> :key="key">
<view class="shop-name"> <view class="shop-name">
<view class="new-logo" v-if="value[1].isNew">新</view> <view class="new-logo" v-if="value[1].isNew">新</view>
<view class="u-upload" @tap="uploadFilePromise(value)"></view> <view class="u-upload" v-if="value[1].isNew" @tap="uploadFilePromise(value)"></view>
<view class="" style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;"> <view class="" style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;">
<img class="img-radius" style="width: 140rpx;height: 140rpx;" @tap="" :src="value[1].productPicture" alt=""> <img v-if="value[1].productPicture" class="img-radius" style="width: 140rpx;height: 140rpx;display: block;overflow: hidden;" :src="value[1].productPicture" alt="">
<view style="width: 140rpx;height:34rpx;line-height: 34rpx;display: flex;margin-top: -10rpx;"> <view v-else style="width: 100%;height: 140rpx;border-radius: 10px;border: 1px solid #eee;line-height: 140rpx;text-align: center;">
<uni-icons type='plusempty' size='26'></uni-icons>
</view>
<view style="width: 140rpx;height:34rpx;line-height: 34rpx;display: flex;margin-top: 20rpx;">
<view @tap.stop="delShop(value[0])" style="background:#088FEB" class="left-btn">删除</view> <view @tap.stop="delShop(value[0])" style="background:#088FEB" class="left-btn">删除</view>
<view class="left-btn" style="margin-left: 20rpx;">合并</view> <view @tap="toggle('mergePopup',value[0])" class="left-btn" style="margin-left: 20rpx;">合并</view>
</view> </view>
</view> </view>
@ -51,7 +54,9 @@
</view> </view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;"> <view style="display: flex;height: 55rpx;line-height: 55rpx;">
单价:<input type="number" v-model="value[1].purchasePrice" @blur="clickCollapse($event,value[0])" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 319rpx;padding-left: 20rpx;"> 单价:<input type="number" v-model="value[1].purchasePrice" @blur="clickCollapse($event,value[0])" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 319rpx;padding-left: 20rpx;">
<view style="height: 27px;width: 70px;background: #088FEB;color: #fff;border-radius: 5px;margin-top: -10rpx;text-align: center;">添加规格</view> <view @tap="AiAddSpec(value[1])" style="height: 27px;width: 70px;background: #088FEB;color: #fff;border-radius: 5px;margin-top: -10rpx;text-align: center;">
添加规格
</view>
</view> </view>
</view> </view>
@ -206,6 +211,36 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<!-- 弹出合并商品 -->
<uni-popup ref="mergePopup" background-color="#fff" :is-mask-click="true">
<view class="type-popup" style="max-height: 1000rpx;overflow: scroll;margin-bottom: 0;border-radius: 0;">
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
请选择要合并到的商品
</view>
<view class="shop-box" v-for="(value,key) in Array.from(carList)" :key="key" v-if="value[1].id != mergeId" @tap="clickMerge(value[0])">
<view class="shop-name" style="height: 150rpx;">
<view class="" style="width: 100rpx;height: 100rpx;margin: 20rpx 0 0 20rpx;font-size: 22rpx;">
<img v-if="value[1].productPicture" class="img-radius" style="width: 100rpx;height: 100rpx;display: block;overflow: hidden;" :src="value[1].productPicture" alt="">
<view v-else class="img-radius" style="width: 100rpx;height: 100rpx;display: block;overflow: hidden;text-align: center;line-height: 100rpx;border: 1px solid #eee;">暂无图片</view>
</view>
<view class="shop-productName" style="height: 130rpx;">
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
{{value[1].productName}}
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
货号:{{value[1].productSn}}
</view>
</view>
</view>
</view>
<view style="line-height: 80rpx;font-size: 22rpx;color: #777;text-align: center;">
没有要合并的商品?那就去库存里看看吧~ ↓↓
</view>
<view @tap="goChooseGoods" style="width: 100%;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;">
<view>同库存商品合并</view>
</view>
</view>
</uni-popup>
<!-- 弹出规格选择 --> <!-- 弹出规格选择 -->
<uni-popup ref="getaPopup" background-color="#fff" :is-mask-click="true"> <uni-popup ref="getaPopup" background-color="#fff" :is-mask-click="true">
<view class="type-popup"> <view class="type-popup">
@ -270,7 +305,8 @@
pageOldTemList: [], pageOldTemList: [],
oldTemList: [], oldTemList: [],
attrList: [], attrList: [],
goodsList: [], goodsList: [],
mergeId:'',
newTemList: [], newTemList: [],
pecsList: [], pecsList: [],
dataObj: new Map(), dataObj: new Map(),
@ -296,7 +332,22 @@
title: '加载中...' title: '加载中...'
}) })
let that = this; let that = this;
if(this.merge ==1){
this.$refs.mergePopup.close();
this.carList.get(this.mergeId).productId = this.carList1.id
this.carList.get(this.mergeId).id = this.carList1.id
this.carList.get(this.mergeId).productName = this.carList1.productName
this.carList.get(this.mergeId).productPicture = this.carList1.productPicture
this.carList.get(this.mergeId).productSn = this.carList1.productSn
this.carList.get(this.mergeId).categoryId = this.carList1.categoryId
this.carList.get(this.mergeId).isNew=false
setTimeout(res => {
uni.hideLoading();
}, 300)
this.$forceUpdate()
this.merge ==0
return;
}
if(uni.getStorageSync('carList1') != ''){ if(uni.getStorageSync('carList1') != ''){
this.carList1 = uni.getStorageSync('carList1') this.carList1 = uni.getStorageSync('carList1')
}else{ }else{
@ -310,8 +361,9 @@
purchasePrice: this.carList1[i].price, //进货价 purchasePrice: this.carList1[i].price, //进货价
price: 0, price: 0,
productCount: 0, productCount: 0,
id:this.carList1[i].id,
isNew:this.carList1[i].isNew, isNew:this.carList1[i].isNew,
productId: this.carList1[i].id, productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
wholesalePrice: this.carList1[i].wholesalePrice, wholesalePrice: this.carList1[i].wholesalePrice,
categoryName:'', categoryName:'',
@ -366,8 +418,9 @@
let obj = { let obj = {
purchasePrice: "", //进货价 purchasePrice: "", //进货价
price: 0, price: 0,
productCount: 0, productCount: 0,
productId: this.carList1[i].id, id:this.carList1[i].id,
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
isNew:this.carList1[i].isNew, isNew:this.carList1[i].isNew,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
wholesalePrice: this.carList1[i].wholesalePrice, wholesalePrice: this.carList1[i].wholesalePrice,
@ -634,6 +687,9 @@
uni.navigateTo({ uni.navigateTo({
url: "/pages/inventory/changeGoods1" url: "/pages/inventory/changeGoods1"
}) })
},
mergeGoods(){
}, },
addGategory(){ addGategory(){
this.tui.request("/app/productCategory/save", "post", { this.tui.request("/app/productCategory/save", "post", {
@ -683,6 +739,11 @@
this.temporaryList[i].productCount-- this.temporaryList[i].productCount--
} }
this.temporaryChange() this.temporaryChange()
},
goChooseGoods(){
uni.navigateTo({
url: '/package1/AI/AiChangeGoods'
})
}, },
attrNameChange(index, data1, index1) { attrNameChange(index, data1, index1) {
let that= this; let that= this;
@ -837,7 +898,39 @@
this.$refs.typePopup.open() this.$refs.typePopup.open()
}else if(type== 'addGateDialog'){ }else if(type== 'addGateDialog'){
this.$refs.addGateDialog.open() this.$refs.addGateDialog.open()
}else if(type== "mergePopup"){
console.log(id)
this.mergeId = id
this.$refs.mergePopup.open()
} }
},
//合并已有
clickMerge(value,key){
let that = this;
console.log('key',this.mergeId)
console.log('11',this.carList.get(this.mergeId)) // 旧的
console.log('订单',this.carList.get(value)) // 新的
this.carList.get(this.mergeId).stockLogList.forEach(function(values, keys) {
if(that.carList.get(value).stockLogList.has(keys)){
console.log('找到了')
that.carList.get(value).stockLogList.get(keys).productCount += that.carList.get(that.mergeId).stockLogList.get(keys).productCount
}else{
console.log('没找到',that.carList.get(that.mergeId).stockLogList.get(keys))
console.log('没找到',keys)
that.carList.get(value).stockLogList.set(keys,that.carList.get(that.mergeId).stockLogList.get(keys))
}
that.carList.get(value).productCount += that.carList.get(that.mergeId).stockLogList.get(keys).productCount
that.carList.get(value).price = that.carList.get(value).productCount * that.carList.get(value).purchasePrice
})
this.carList.delete(this.mergeId)
this.$forceUpdate()
console.log(this.carList)
this.getAllPrice()
this.$refs.mergePopup.close()
},
AiAddSpec(value){
console.log(value)
this.toggle('bottom', value.id);
}, },
//通过商品id查询商品详细信息 //通过商品id查询商品详细信息
getById(id) { getById(id) {
@ -1018,7 +1111,8 @@
let data = { let data = {
id: this.goodsDetail.id, id: this.goodsDetail.id,
price: 0, price: 0,
num: this.zNum, num: this.zNum,
productId:this.goodsDetail.id,
productName: this.goodsDetail.productName, productName: this.goodsDetail.productName,
wholesalePrice: this.goodsDetail.wholesalePrice, wholesalePrice: this.goodsDetail.wholesalePrice,
categoryName:'', categoryName:'',
@ -1046,7 +1140,8 @@
let obj = { let obj = {
purchasePrice: "", //进货价 purchasePrice: "", //进货价
price: 0, price: 0,
productCount: 0, productCount: 0,
id: carList1[i].id,
productId: carList1[i].id, productId: carList1[i].id,
wholesalePrice: this.goodsDetail.wholesalePrice, wholesalePrice: this.goodsDetail.wholesalePrice,
categoryName:'', categoryName:'',
@ -1241,7 +1336,8 @@
supplierId: this.khName.id, //供应商id和姓名 supplierId: this.khName.id, //供应商id和姓名
supplierName: this.khName.consigneeName supplierName: this.khName.consigneeName
} }
let purchaseDetails = []; let purchaseDetails = [];
console.log(this.carList)
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
value.stockLogList1 = [] value.stockLogList1 = []
if (value.purchasePrice == '' || value.purchasePrice == 0) { if (value.purchasePrice == '' || value.purchasePrice == 0) {
@ -1265,7 +1361,8 @@
attributeList: keys attributeList: keys
} }
value.stockLogList1.push(obj) value.stockLogList1.push(obj)
}) })
delete value.id;
purchaseDetails.push(value) purchaseDetails.push(value)
}) })
console.log(purchaseDetails) console.log(purchaseDetails)

3
pages/inventory/addinventory.vue

@ -864,7 +864,8 @@
let obj = { let obj = {
purchasePrice: "", //进货价 purchasePrice: "", //进货价
price: 0, price: 0,
productCount: 0, productCount: 0,
id:carList1[i].id,
productId: carList1[i].id, productId: carList1[i].id,
productName: carList1[i].productName, productName: carList1[i].productName,
wholesalePrice: this.goodsDetail.wholesalePrice, wholesalePrice: this.goodsDetail.wholesalePrice,

85
pages/inventory/gategoryLow.vue

@ -111,15 +111,15 @@
}, },
methods: { methods: {
//初始化获取子分类列表 //初始化获取子分类列表
getGategoryList() { getGategoryList() {
let data = []
this.tui.request("/app/productAttribute/selectByCategoryId", "POST", { this.tui.request("/app/productAttribute/selectByCategoryId", "POST", {
categoryId: this.categoryId categoryId: this.categoryId
}, false, true).then((res1) => { }, false, true).then((res1) => {
if (res1.code == 200) { if (res1.code == 200) {
this.attrList = res1.result; data = res1.result;
if (res1.result.length > 0) { if (res1.result.length > 0) {
this.attrList.forEach((items) => { data.forEach((items) => {
this.tui.request( this.tui.request(
"/app/productAttributeValue/selectByAttributeId", "/app/productAttributeValue/selectByAttributeId",
"get", { "get", {
@ -127,7 +127,6 @@
}, false, true).then((res2) => { }, false, true).then((res2) => {
if (res2.code == 200) { if (res2.code == 200) {
items.attributeValue = res2.result; items.attributeValue = res2.result;
//
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
@ -135,13 +134,15 @@
}).catch((res) => {}) }).catch((res) => {})
}) })
} }
setTimeout(() => {
this.showList = this.attrList;
}, 1000)
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
}).catch((res) => {}) }).catch((res) => {})
this.$forceUpdate()
setTimeout(() => {
this.attrList = data
}, 1000)
}, },
//查询分类下有没有库存 //查询分类下有没有库存
getTypeToNum() { getTypeToNum() {
@ -156,76 +157,10 @@
this.$refs.carPopup.open('bottom') this.$refs.carPopup.open('bottom')
} else { } else {
that.show = true that.show = true
// this.tui.request("/app/productAttribute/selectByCategoryId", "POST", {
// categoryId: this.delItems.id
// }, false, true).then((res1) => {
// if (res1.code == 200) {
// if (res1.result.length > 0) {
// uni.showModal({
// title: "提示",
// content: "此分类已经维护了子分类,确定继续删除吗?",
// success: function(res2) {
// if (res2.confirm) {
// that.delItemModal()
// }
// }
// })
// } else {
// that.show = true
// }
// }
// }).catch((res) => {})
} }
} }
}).catch((res) => {}) }).catch((res) => {})
}, },
// 获取属性名
getProductAttribute() {
this.attrList.forEach((item, index) => {
this.tui.request("/app/productAttribute/selectByCategoryId", "get", {
categoryId: this.categoryId
}, false, true).then((res) => {
if (res.code == 200) {
item.attrName = res.result;
if (item.attrName.length > 0) {
item.attrName.forEach((items) => {
this.tui.request(
"/app/productAttributeValue/selectByAttributeId",
"get", {
id: items.id
}, false, true).then((res) => {
if (res.code == 200) {
items.attributeValue = res.result;
this.showList = this.attrList
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
})
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
})
},
// 获取属性值
getProductAttributeValue(index) {
this.attrList.forEach((item) => {
this.tui.request("/app/productAttributeValue/selectByAttributeId", "get", {
id: item.id
}, false, true).then((res) => {
if (res.code == 200) {
item.attributeValue = res.result;
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
})
this.showList = JSON.parse(JSON.stringify(this.attrList))
},
inputDialogToggle(type, item, parent) { inputDialogToggle(type, item, parent) {
this.typeModel = type; this.typeModel = type;
if (type == 'edit') { if (type == 'edit') {

2
pages/inventory/goodsList1.vue

@ -352,7 +352,7 @@
<uni-icons @tap='this.$refs.historyPopup.close()' type="closeempty" color='red' size="16" <uni-icons @tap='this.$refs.historyPopup.close()' type="closeempty" color='red' size="16"
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons> style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
</view> </view>
<view class="popup-container" v-if="historyList != null"> <view class="popup-container" v-if="historyList != null && historyList.discountAmount != null">
<view style="height: 60rpx;line-height: 60rpx;">上次拿货时间:</view> <view style="height: 60rpx;line-height: 60rpx;">上次拿货时间:</view>
<view style="height: 60rpx;line-height: 60rpx;">{{historyList.createTime}}</view> <view style="height: 60rpx;line-height: 60rpx;">{{historyList.createTime}}</view>
<view style="height: 60rpx;line-height: 60rpx;">上次拿货数:{{historyList.productCount}}</view> <view style="height: 60rpx;line-height: 60rpx;">上次拿货数:{{historyList.productCount}}</view>

Loading…
Cancel
Save