|
@@ -12,7 +12,7 @@
|
|
|
<view v-for="(sonItem,xjIndex) in sonItemList" :key="xjIndex">
|
|
<view v-for="(sonItem,xjIndex) in sonItemList" :key="xjIndex">
|
|
|
<view>
|
|
<view>
|
|
|
<view class="item-cmd_bx">
|
|
<view class="item-cmd_bx">
|
|
|
- <view class="img_bx" style="background:#eeeeee">
|
|
|
|
|
|
|
+ <view class="img_bx" @click="pageTo({url:'/admin/item/detail?id='+ sonItem.id})" style="background:#eeeeee;z-index:999;">
|
|
|
<image :src="sonItem.cover"></image>
|
|
<image :src="sonItem.cover"></image>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="cmd-info_bx">
|
|
<view class="cmd-info_bx">
|
|
@@ -50,7 +50,9 @@
|
|
|
<script>
|
|
<script>
|
|
|
import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
import { mapGetters } from "vuex";
|
|
import { mapGetters } from "vuex";
|
|
|
- import { getSonList,delMsItem,sendStockFn } from "@/api/item"
|
|
|
|
|
|
|
+ import { getSonList,delMsItem } from "@/api/item"
|
|
|
|
|
+ import { batchChangePrice } from '@/api/product'
|
|
|
|
|
+ import { checkOrderApi } from "@/api/inventory";
|
|
|
export default {
|
|
export default {
|
|
|
name: "sendStock",
|
|
name: "sendStock",
|
|
|
components: {
|
|
components: {
|
|
@@ -62,11 +64,15 @@
|
|
|
sonItemList:[],
|
|
sonItemList:[],
|
|
|
stock:0,
|
|
stock:0,
|
|
|
price:0,
|
|
price:0,
|
|
|
- remain:0
|
|
|
|
|
|
|
+ remain:0,
|
|
|
|
|
+ addItemOk:0
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onShow(){
|
|
onShow(){
|
|
|
- this.init()
|
|
|
|
|
|
|
+ if(this.addItemOk == 1){
|
|
|
|
|
+ this.init()
|
|
|
|
|
+ this.addItemOk = 0
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
onLoad(){
|
|
onLoad(){
|
|
|
this.price = this.option.price ? parseFloat(this.option.price) : 0
|
|
this.price = this.option.price ? parseFloat(this.option.price) : 0
|
|
@@ -131,7 +137,8 @@
|
|
|
}
|
|
}
|
|
|
let hasErr = false
|
|
let hasErr = false
|
|
|
let errText = ''
|
|
let errText = ''
|
|
|
- let productList = []
|
|
|
|
|
|
|
+ let priceList = []
|
|
|
|
|
+ let stockList = []
|
|
|
for (const item of this.sonItemList) {
|
|
for (const item of this.sonItemList) {
|
|
|
if(Number(item.sendSonStock)>0){
|
|
if(Number(item.sendSonStock)>0){
|
|
|
if(Number(item.sendHyPrice)<=0){
|
|
if(Number(item.sendHyPrice)<=0){
|
|
@@ -149,8 +156,10 @@
|
|
|
errText = '请填写 '+item.name+' 批发价'
|
|
errText = '请填写 '+item.name+' 批发价'
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
- let groupItem = {id:item.id,stock:item.sendSonStock,lsPrice:item.sendLsPrice,pfPrice:item.sendPfPrice,hyPrice:item.sendHyPrice}
|
|
|
|
|
- productList.push(groupItem)
|
|
|
|
|
|
|
+ let priceGroup = {id:item.id,skPrice:item.sendLsPrice,price:item.sendPfPrice,hjPrice:item.sendHyPrice}
|
|
|
|
|
+ priceList.push(priceGroup)
|
|
|
|
|
+ let stockGroup ={productId:item.id,bigNum:item.sendSonStock,smallNum:null}
|
|
|
|
|
+ stockList.push(stockGroup)
|
|
|
}else{
|
|
}else{
|
|
|
if(Number(item.sendPfPrice)>0){
|
|
if(Number(item.sendPfPrice)>0){
|
|
|
hasErr = true
|
|
hasErr = true
|
|
@@ -163,23 +172,29 @@
|
|
|
that.$msg(errText)
|
|
that.$msg(errText)
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- if (this.$util.isEmpty(productList)){
|
|
|
|
|
|
|
+ if (this.$util.isEmpty(priceList)){
|
|
|
this.$msg('请填写数量和价格')
|
|
this.$msg('请填写数量和价格')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- console.log(productList)
|
|
|
|
|
- console.log('---------')
|
|
|
|
|
- let jsonProduct = JSON.stringify(productList)
|
|
|
|
|
- let params = {product:jsonProduct}
|
|
|
|
|
|
|
+
|
|
|
this.$util.confirmModal({content:'确认分配?'},() => {
|
|
this.$util.confirmModal({content:'确认分配?'},() => {
|
|
|
- sendStockFn(params).then(res=>{
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let jsonPriceList = JSON.stringify(priceList);
|
|
|
|
|
+ batchChangePrice({data:jsonPriceList,appVersion:1}).then(res => {
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
- that.$msg('分配成功')
|
|
|
|
|
- setTimeout(function(){
|
|
|
|
|
- //that.goBack()
|
|
|
|
|
- },1200)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let jsonStock = JSON.stringify(stockList);
|
|
|
|
|
+ let name = this.option.name ? this.option.name : ''
|
|
|
|
|
+ checkOrderApi({pdType:'',itemInfo:jsonStock,remark:name+'分配增加库存'}).then(res => {
|
|
|
|
|
+ if(res.code == 1){
|
|
|
|
|
+ this.$msg(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
init(){
|
|
init(){
|