|
|
@@ -2,8 +2,8 @@
|
|
|
<view class="app-content">
|
|
|
<view class="billing_box_bg">
|
|
|
<view class="input-wrap">
|
|
|
- <text style="margin-right:15upx;font-size:42upx;">库存:{{stock}}扎</text>
|
|
|
- <text style="margin-right:20upx;font-size:42upx;">批发价:¥{{ price }}</text>
|
|
|
+ <text style="margin-right:15upx;font-size:40upx;">库存:{{stock}}扎</text>
|
|
|
+ <text style="margin-right:20upx;font-size:40upx;">批发价:¥{{ price }}</text>
|
|
|
<button class="admin-button-com middle blue" @click="setSon()">新增子花材</button>
|
|
|
</view>
|
|
|
<view class="scroll-middle_bx">
|
|
|
@@ -20,11 +20,11 @@
|
|
|
<view class="kc">剩 {{sonItem.stock ? parseFloat(sonItem.stock) : 0}}</view>
|
|
|
<view class="num-open_bx">
|
|
|
<view class="open-bx">
|
|
|
- <button class="admin-button-com mini-btn blue del-button" @click="delItem(sonItem)">删除</button>
|
|
|
- <input class="hy-ok-price" placeholder-style="color:#CCCCCC" v-model="sonItem.sendHyPrice" type="number" placeholder="会员价" />
|
|
|
- <input class="add-ok-stock" placeholder-style="color:#CCCCCC" v-model="sonItem.sendSonStock" type="digit" placeholder="库存数量" />
|
|
|
- <input class="ls-ok-price" placeholder-style="color:#CCCCCC" v-model="sonItem.sendLsPrice" type="digit" placeholder="零售价" />
|
|
|
- <input class="pf-ok-price" placeholder-style="color:#CCCCCC" @input="linkChange(sonItem)" v-model="sonItem.sendPfPrice" type="digit" placeholder="批发价" />
|
|
|
+<button class="admin-button-com mini-btn blue del-button" @click="delItem(sonItem)">删除</button>
|
|
|
+<input class="hy-ok-price" placeholder-style="color:#CCCCCC" v-model="sonItem.sendHyPrice" type="number" placeholder="会员价" />
|
|
|
+<input class="add-ok-stock" placeholder-style="color:#CCCCCC" @input="stockToggle(sonItem)" v-model="sonItem.sendSonStock" type="digit" placeholder="库存数量" />
|
|
|
+<input class="ls-ok-price" placeholder-style="color:#CCCCCC" v-model="sonItem.sendLsPrice" type="digit" placeholder="零售价" />
|
|
|
+<input class="pf-ok-price" placeholder-style="color:#CCCCCC" @input="linkChange(sonItem)" v-model="sonItem.sendPfPrice" type="digit" placeholder="批发价" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -38,17 +38,19 @@
|
|
|
<div class="app-footer footer-button">
|
|
|
<button class="admin-button-com big default" @click="goBack()"
|
|
|
style="margin-left:58upx;padding:30upx 55upx 30upx 55upx;">返回</button>
|
|
|
- <button class="admin-button-com big blue" @click="confirmSend()"
|
|
|
- style="margin-left:58upx;padding:30upx 65upx; 30upx 65upx;" >确认</button>
|
|
|
+ <button class="admin-button-com big blue" @click="toSend()"
|
|
|
+ style="margin-left:58upx;padding:30upx 65upx; 30upx 65upx;" >确认分配</button>
|
|
|
</div>
|
|
|
-
|
|
|
+ <view v-if="remain>=0" style="width:200upx;position:fixed;bottom:40upx;left:10upx;z-index:99999;font-size:32upx;">
|
|
|
+ 还剩{{ remain }}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
import { mapGetters } from "vuex";
|
|
|
- import { getSonList,delMsItem } from "@/api/item"
|
|
|
+ import { getSonList,delMsItem,sendStockFn } from "@/api/item"
|
|
|
export default {
|
|
|
name: "sendStock",
|
|
|
components: {
|
|
|
@@ -59,7 +61,8 @@
|
|
|
return {
|
|
|
sonItemList:[],
|
|
|
stock:0,
|
|
|
- price:0
|
|
|
+ price:0,
|
|
|
+ remain:0
|
|
|
};
|
|
|
},
|
|
|
onShow(){
|
|
|
@@ -68,11 +71,39 @@
|
|
|
onLoad(){
|
|
|
this.price = this.option.price ? parseFloat(this.option.price) : 0
|
|
|
this.stock = this.option.stock ? parseFloat(this.option.stock) : 0
|
|
|
+ this.remain = this.stock
|
|
|
},
|
|
|
methods: {
|
|
|
+ stockToggle(item){
|
|
|
+ let totalNum = 0
|
|
|
+ if (!this.$util.isEmpty(this.sonItemList)){
|
|
|
+ this.sonItemList.forEach((item,idx,arr) => {
|
|
|
+ if(Number(item.sendSonStock)>0){
|
|
|
+ totalNum = totalNum + Number(item.sendSonStock)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let remain = Number(this.stock) - Number(totalNum)
|
|
|
+ remain = parseFloat(remain.toFixed(2))
|
|
|
+ this.remain = remain
|
|
|
+ },
|
|
|
linkChange(item){
|
|
|
- let skMore = item.skMore
|
|
|
- let hj
|
|
|
+ let skMore = item.skMore ? parseFloat(item.skMore) : 0
|
|
|
+ let hjAddPrice = item.hjAddPrice ? parseFloat(item.hjAddPrice) : 0
|
|
|
+ let addPrice = item.addPrice ? parseFloat(item.addPrice) : 0
|
|
|
+ if(Number(item.sendPfPrice)>0){
|
|
|
+ let lsDiff = Number(skMore) - Number(addPrice)
|
|
|
+ let lsPrice = Number(item.sendPfPrice) + Number(lsDiff)
|
|
|
+ lsPrice = parseFloat(lsPrice.toFixed(2))
|
|
|
+ item.sendLsPrice = lsPrice
|
|
|
+ let hyDiff = Number(addPrice) - Number(hjAddPrice)
|
|
|
+ let hyPrice = Number(item.sendPfPrice) - Number(hyDiff)
|
|
|
+ hyPrice = parseFloat(hyPrice.toFixed(2))
|
|
|
+ item.sendHyPrice = hyPrice
|
|
|
+ }else{
|
|
|
+ item.sendLsPrice = ''
|
|
|
+ item.sendHyPrice = ''
|
|
|
+ }
|
|
|
},
|
|
|
delItem(item){
|
|
|
let that = this
|
|
|
@@ -80,7 +111,6 @@
|
|
|
this.$util.confirmModal({content:'确认删除?'},() => {
|
|
|
delMsItem({motherId:motherId,id:item.id}).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
- that.$msg(res.msg)
|
|
|
that.init()
|
|
|
}
|
|
|
})
|
|
|
@@ -93,17 +123,64 @@
|
|
|
goBack(){
|
|
|
uni.navigateBack({});
|
|
|
},
|
|
|
- confirmSend(){
|
|
|
- if (!this.$util.isEmpty(this.sonItemList)){
|
|
|
- this.sonItemList.forEach((item,idx,arr) => {
|
|
|
- if(Number(item.sendSonStock)>0){
|
|
|
-
|
|
|
- }else{
|
|
|
-
|
|
|
+ toSend(){
|
|
|
+ let that = this
|
|
|
+ if (this.$util.isEmpty(this.sonItemList)){
|
|
|
+ this.$msg('没有花材')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let hasErr = false
|
|
|
+ let errText = ''
|
|
|
+ let productList = []
|
|
|
+ for (const item of this.sonItemList) {
|
|
|
+ if(Number(item.sendSonStock)>0){
|
|
|
+ if(Number(item.sendHyPrice)<=0){
|
|
|
+ hasErr = true
|
|
|
+ errText = '请填写 '+item.name+' 会员价'
|
|
|
+ break
|
|
|
}
|
|
|
- })
|
|
|
+ if(Number(item.sendLsPrice)<=0){
|
|
|
+ hasErr = true
|
|
|
+ errText = '请填写 '+item.name+' 零售价'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if(Number(item.sendPfPrice)<=0){
|
|
|
+ hasErr = true
|
|
|
+ errText = '请填写 '+item.name+' 批发价'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ let groupItem = {id:item.id,stock:item.sendSonStock,lsPrice:item.sendLsPrice,pfPrice:item.sendPfPrice,hyPrice:item.sendHyPrice}
|
|
|
+ productList.push(groupItem)
|
|
|
+ }else{
|
|
|
+ if(Number(item.sendPfPrice)>0){
|
|
|
+ hasErr = true
|
|
|
+ errText = '请填写 '+item.name+' 数量'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+ if(hasErr == true){
|
|
|
+ that.$msg(errText)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.$util.isEmpty(productList)){
|
|
|
+ this.$msg('请填写数量和价格')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ console.log(productList)
|
|
|
+ console.log('---------')
|
|
|
+ let jsonProduct = JSON.stringify(productList)
|
|
|
+ let params = {product:jsonProduct}
|
|
|
+ this.$util.confirmModal({content:'确认分配?'},() => {
|
|
|
+ sendStockFn(params).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg('分配成功')
|
|
|
+ setTimeout(function(){
|
|
|
+ //that.goBack()
|
|
|
+ },1200)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
init(){
|
|
|
let productId = this.option.id ? this.option.id : 0
|
|
|
@@ -297,10 +374,10 @@
|
|
|
line-height: 60upx;
|
|
|
text-align: center;
|
|
|
background: #ffffff;
|
|
|
- border: 1upx solid #b4b4b4;
|
|
|
+ border: 1upx solid #568014;
|
|
|
border-radius: 4upx;
|
|
|
- font-size: 25upx;
|
|
|
- color:#5e5d5d;
|
|
|
+ font-size: 30upx;
|
|
|
+ color:#568014;
|
|
|
position: absolute;
|
|
|
left:180upx;
|
|
|
top:15upx;
|
|
|
@@ -313,7 +390,7 @@
|
|
|
background: #ffffff;
|
|
|
border: 1upx solid #3385FF;
|
|
|
border-radius: 4upx;
|
|
|
- font-size: 25upx;
|
|
|
+ font-size: 30upx;
|
|
|
color:#3385FF;
|
|
|
position: absolute;
|
|
|
left:180upx;
|
|
|
@@ -325,10 +402,10 @@
|
|
|
line-height: 60upx;
|
|
|
text-align: center;
|
|
|
background: #ffffff;
|
|
|
- border: 1upx solid #b4b4b4;
|
|
|
+ border: 1upx solid #568014;
|
|
|
border-radius: 4upx;
|
|
|
- font-size: 25upx;
|
|
|
- color:#5e5d5d;
|
|
|
+ font-size: 30upx;
|
|
|
+ color:#568014;
|
|
|
position: absolute;
|
|
|
left:350upx;
|
|
|
top:15upx;
|
|
|
@@ -339,10 +416,10 @@
|
|
|
line-height: 60upx;
|
|
|
text-align: center;
|
|
|
background: #ffffff;
|
|
|
- border: 1upx solid #3385FF;
|
|
|
+ border: 1upx solid #568014;
|
|
|
border-radius: 4upx;
|
|
|
- font-size: 25upx;
|
|
|
- color:#3385FF;
|
|
|
+ font-size: 30upx;
|
|
|
+ color:#568014;
|
|
|
position: absolute;
|
|
|
left:350upx;
|
|
|
top:-58upx;
|