|
@@ -18,7 +18,7 @@
|
|
|
<text class="item-type"></text>
|
|
<text class="item-type"></text>
|
|
|
<view class="item-count">
|
|
<view class="item-count">
|
|
|
<input type="number" class="num" v-model="s.xhNum" placeholder="到货数量" />
|
|
<input type="number" class="num" v-model="s.xhNum" placeholder="到货数量" />
|
|
|
- <input type="digit" class="price" v-model="s.currentCost" placeholder="成本" />
|
|
|
|
|
|
|
+ <text>¥{{s.xhPrePrice?parseFloat(s.xhPrePrice):0}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -40,35 +40,16 @@
|
|
|
<view class="detail-price_box" style="font-size: 28upx;">{{ detailInfo.customName||'' }}</view>
|
|
<view class="detail-price_box" style="font-size: 28upx;">{{ detailInfo.customName||'' }}</view>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">重量(公斤)</view>
|
|
|
|
|
- <view class="detail-price_box" style="font-size: 28upx;">
|
|
|
|
|
- <text v-if="Number(miniKilo) > Number(totalWeight)" style="color:#CCCCCC;margin-right:15upx;">不足{{parseFloat(miniKilo)}}公斤按{{parseFloat(miniKilo)}}公斤算</text>
|
|
|
|
|
- <text>{{ totalWeight }}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </tui-list-cell>
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
- <view class="tui-title">每公斤服务费</view>
|
|
|
|
|
- <view class="detail-price_box" style="font-size: 28upx;">¥{{ kiloFee ? parseFloat(kiloFee) : 0}}</view>
|
|
|
|
|
- </tui-list-cell>
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
- <view class="tui-title">总服务费</view>
|
|
|
|
|
- <view class="detail-price_box" style="font-size: 28upx;">¥{{totalKiloFee}}</view>
|
|
|
|
|
- </tui-list-cell>
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
- <view class="tui-title">商品金额</view>
|
|
|
|
|
- <view class="detail-price_box" style="font-size: 28upx;">¥{{itemPrice}}</view>
|
|
|
|
|
- </tui-list-cell>
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
- <view class="tui-title">总计</view>
|
|
|
|
|
- <view class="detail-price_box red" style="font-size: 28upx;">¥{{allPrice}}</view>
|
|
|
|
|
|
|
+ <view class="tui-title">应付</view>
|
|
|
|
|
+ <view class="detail-price_box" style="font-size: 28upx;">¥{{allPrice}}</view>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">预付金额</view>
|
|
|
|
|
|
|
+ <view class="tui-title">已付</view>
|
|
|
<view class="detail-price_box red" style="font-size: 28upx;">¥{{ detailInfo.bookPrice ? parseFloat(detailInfo.bookPrice) : 0}}</view>
|
|
<view class="detail-price_box red" style="font-size: 28upx;">¥{{ detailInfo.bookPrice ? parseFloat(detailInfo.bookPrice) : 0}}</view>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">结账</view>
|
|
|
|
|
|
|
+ <view class="tui-title">结算</view>
|
|
|
<view class="detail-price_box" style="font-size: 28upx;color:green;" v-if="settlePrice > 0">退 ¥{{settlePrice}},确认后自动退款</view>
|
|
<view class="detail-price_box" style="font-size: 28upx;color:green;" v-if="settlePrice > 0">退 ¥{{settlePrice}},确认后自动退款</view>
|
|
|
<view class="detail-price_box" style="font-size: 28upx;color:red;" v-else-if="settlePrice < 0">欠 ¥{{Math.abs(settlePrice)}},确认后变成欠款单</view>
|
|
<view class="detail-price_box" style="font-size: 28upx;color:red;" v-else-if="settlePrice < 0">欠 ¥{{Math.abs(settlePrice)}},确认后变成欠款单</view>
|
|
|
<view class="detail-price_box" style="font-size: 28upx;" v-else>0</view>
|
|
<view class="detail-price_box" style="font-size: 28upx;" v-else>0</view>
|
|
@@ -100,11 +81,7 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
detailInfo: {},
|
|
detailInfo: {},
|
|
|
miniKilo:0,
|
|
miniKilo:0,
|
|
|
- kiloFee:0,
|
|
|
|
|
- totalKiloFee:0,
|
|
|
|
|
- itemPrice:0,
|
|
|
|
|
- totalWeight:0,
|
|
|
|
|
- settlePrice:0
|
|
|
|
|
|
|
+ totalWeight:0
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
@@ -113,40 +90,24 @@ export default {
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapGetters({ loginInfo: "getLoginInfo" }),
|
|
...mapGetters({ loginInfo: "getLoginInfo" }),
|
|
|
allPrice() {
|
|
allPrice() {
|
|
|
|
|
+ let price = this.itemPrice
|
|
|
|
|
+ return price
|
|
|
|
|
+ },
|
|
|
|
|
+ itemPrice(){
|
|
|
let price = 0
|
|
let price = 0
|
|
|
- this.itemPrice = 0
|
|
|
|
|
- this.totalWeight = 0
|
|
|
|
|
if (this.detailInfo && this.detailInfo.product) {
|
|
if (this.detailInfo && this.detailInfo.product) {
|
|
|
for (const item of this.detailInfo.product) {
|
|
for (const item of this.detailInfo.product) {
|
|
|
- if(item.currentCost){
|
|
|
|
|
- //花材价格
|
|
|
|
|
- let currentPrice = Number(item.xhNum) * Number(item.currentCost)
|
|
|
|
|
- currentPrice = currentPrice.toFixed(2)
|
|
|
|
|
- this.itemPrice = Number(this.itemPrice) + Number(currentPrice)
|
|
|
|
|
- this.itemPrice.toFixed(2)
|
|
|
|
|
-
|
|
|
|
|
- //总重量
|
|
|
|
|
- let thisWeight = Number(item.unitWeight)*Number(item.xhNum)
|
|
|
|
|
- this.totalWeight = Number(this.totalWeight)+Number(thisWeight)
|
|
|
|
|
- this.totalWeight = parseFloat(this.totalWeight.toFixed(2))
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let current = Number(item.xhPrePrice)*Number(item.xhNum)
|
|
|
|
|
+ price = Number(price)+Number(current)
|
|
|
|
|
+ price = parseFloat(price.toFixed(2))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.itemPrice = parseFloat(this.itemPrice.toFixed(2))
|
|
|
|
|
-
|
|
|
|
|
- //总服务费
|
|
|
|
|
- let calcWeight = Number(this.totalWeight)>Number(this.miniKilo) ? Number(this.totalWeight) : this.miniKilo
|
|
|
|
|
- this.totalKiloFee = Number(this.kiloFee)*calcWeight
|
|
|
|
|
- this.totalKiloFee = parseFloat(this.totalKiloFee.toFixed(2))
|
|
|
|
|
-
|
|
|
|
|
- //总计
|
|
|
|
|
- price = Number(this.itemPrice) + Number(this.totalKiloFee)
|
|
|
|
|
- price = parseFloat(price.toFixed(2))
|
|
|
|
|
-
|
|
|
|
|
- this.settlePrice = Number(this.detailInfo.bookPrice) - Number(price)
|
|
|
|
|
- this.settlePrice = parseFloat(this.settlePrice.toFixed(2))
|
|
|
|
|
-
|
|
|
|
|
|
|
+ return price
|
|
|
|
|
+ },
|
|
|
|
|
+ settlePrice(){
|
|
|
|
|
+ let bookPrice = this.detailInfo.bookPrice ? parseFloat(this.detailInfo.bookPrice):0
|
|
|
|
|
+ let price = Number(bookPrice) - Number(this.allPrice)
|
|
|
|
|
+ price = parseFloat(Number(price))
|
|
|
return price
|
|
return price
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -160,7 +121,6 @@ export default {
|
|
|
});
|
|
});
|
|
|
this.detailInfo = res.data;
|
|
this.detailInfo = res.data;
|
|
|
this.miniKilo = res.data.miniKilo
|
|
this.miniKilo = res.data.miniKilo
|
|
|
- this.kiloFee = res.data.kiloFee
|
|
|
|
|
},
|
|
},
|
|
|
commitItem(){
|
|
commitItem(){
|
|
|
let product = []
|
|
let product = []
|
|
@@ -168,8 +128,9 @@ export default {
|
|
|
let that = this
|
|
let that = this
|
|
|
if (this.detailInfo && this.detailInfo.product) {
|
|
if (this.detailInfo && this.detailInfo.product) {
|
|
|
for (const item of this.detailInfo.product) {
|
|
for (const item of this.detailInfo.product) {
|
|
|
- if(item.currentCost.length <= 0){
|
|
|
|
|
- this.$msg('请填写进货价,价格要大于0')
|
|
|
|
|
|
|
+ let name = item.name
|
|
|
|
|
+ if(item.xhPrePrice.length <= 0){
|
|
|
|
|
+ this.$msg(name+' 没有价格')
|
|
|
hasError = true;
|
|
hasError = true;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -178,16 +139,26 @@ export default {
|
|
|
hasError = true;
|
|
hasError = true;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ let preNum = item.xhPreNum ? Number(item.xhPreNum):0
|
|
|
let num = item.xhNum ? Number(item.xhNum) : 0
|
|
let num = item.xhNum ? Number(item.xhNum) : 0
|
|
|
- let price = item.currentCost ? Number(item.currentCost) : 0
|
|
|
|
|
|
|
+ if(num > preNum){
|
|
|
|
|
+ this.$msg(name+' 超过预定数量')
|
|
|
|
|
+ hasError = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ let price = item.xhPrePrice ? Number(item.xhPrePrice) : 0
|
|
|
let productId = item.productId || 0
|
|
let productId = item.productId || 0
|
|
|
- let unitType =
|
|
|
|
|
- product = [...product,{productId,price,num}]
|
|
|
|
|
|
|
+ let unitType = 0
|
|
|
|
|
+ product = [...product,{productId,price,num,unitType}]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(hasError == true){
|
|
if(hasError == true){
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
+ if(Number(this.settlePrice) < 0){
|
|
|
|
|
+ this.$msg('结账金额有问题')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
that.$util.confirmModal({content:'确认提交'},() => {
|
|
that.$util.confirmModal({content:'确认提交'},() => {
|
|
|
arrival({id:that.option.id,product:JSON.stringify(product)}).then(res=>{
|
|
arrival({id:that.option.id,product:JSON.stringify(product)}).then(res=>{
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|