|
|
@@ -18,7 +18,7 @@
|
|
|
<text class="item-type"></text>
|
|
|
<view class="item-count">
|
|
|
<input type="number" class="num" v-model="s.xhNum" placeholder="到货数量" />
|
|
|
- <text>¥{{s.xhPreUnitPrice?parseFloat(s.xhPreUnitPrice):0}}</text>
|
|
|
+ <input type="digit" class="price" v-model="s.currentHdPrice" placeholder="售价" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -32,7 +32,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
<view class="content-box price-detail">
|
|
|
<view class="module-com input-line-wrap">
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
@@ -40,31 +39,31 @@
|
|
|
<view class="detail-price_box" style="font-size: 28upx;">{{ detailInfo.customName||'' }}</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;">¥{{allPrice}}</view>
|
|
|
+ <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>
|
|
|
</tui-list-cell>
|
|
|
<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>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<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:red;" v-else-if="settlePrice < 0">欠 ¥{{Math.abs(settlePrice)}},确认后变成欠款单</view>
|
|
|
<view class="detail-price_box" style="font-size: 28upx;" v-else>0</view>
|
|
|
</tui-list-cell>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
-
|
|
|
<view class="app-footer">
|
|
|
<button class="admin-button-com big default" @click="goBack()">取消</button>
|
|
|
<button class="admin-button-com big blue" @click="commitItem()">确认</button>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -80,8 +79,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
detailInfo: {},
|
|
|
- miniKilo:0,
|
|
|
- totalWeight:0
|
|
|
+ itemPrice:0,
|
|
|
+ settlePrice:0
|
|
|
};
|
|
|
},
|
|
|
onShow() {
|
|
|
@@ -90,26 +89,24 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters({ loginInfo: "getLoginInfo" }),
|
|
|
allPrice() {
|
|
|
- let price = this.itemPrice
|
|
|
- return price
|
|
|
- },
|
|
|
- itemPrice(){
|
|
|
let price = 0
|
|
|
+ this.itemPrice = 0
|
|
|
+ this.totalWeight = 0
|
|
|
if (this.detailInfo && this.detailInfo.product) {
|
|
|
for (const item of this.detailInfo.product) {
|
|
|
- let current = Number(item.xhPreUnitPrice)*Number(item.xhNum)
|
|
|
- price = Number(price)+Number(current)
|
|
|
- price = parseFloat(price.toFixed(2))
|
|
|
+ if(item.currentHdPrice){
|
|
|
+ let currentPrice = Number(item.xhNum) * Number(item.currentHdPrice)
|
|
|
+ currentPrice = currentPrice.toFixed(2)
|
|
|
+ this.itemPrice = Number(this.itemPrice) + Number(currentPrice)
|
|
|
+ this.itemPrice.toFixed(2)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return price
|
|
|
- },
|
|
|
- settlePrice(){
|
|
|
- let bookPrice = this.detailInfo.bookPrice ? parseFloat(this.detailInfo.bookPrice) : 0
|
|
|
- let price = Number(bookPrice) - Number(this.allPrice)
|
|
|
- price = Number(price)
|
|
|
- price = price.toFixed(2)
|
|
|
- price = parseFloat(price)
|
|
|
+ this.itemPrice = parseFloat(this.itemPrice.toFixed(2))
|
|
|
+ price = Number(this.itemPrice)
|
|
|
+ price = parseFloat(price.toFixed(2))
|
|
|
+ this.settlePrice = Number(this.detailInfo.bookPrice) - Number(price)
|
|
|
+ this.settlePrice = parseFloat(this.settlePrice.toFixed(2))
|
|
|
return price
|
|
|
}
|
|
|
},
|
|
|
@@ -122,7 +119,6 @@ export default {
|
|
|
id: this.option.id
|
|
|
});
|
|
|
this.detailInfo = res.data;
|
|
|
- this.miniKilo = res.data.miniKilo
|
|
|
},
|
|
|
commitItem(){
|
|
|
let product = []
|
|
|
@@ -130,37 +126,26 @@ export default {
|
|
|
let that = this
|
|
|
if (this.detailInfo && this.detailInfo.product) {
|
|
|
for (const item of this.detailInfo.product) {
|
|
|
- let name = item.name
|
|
|
- if(item.xhPreUnitPrice.length <= 0){
|
|
|
- this.$msg(name+' 没有价格')
|
|
|
+ if(item.currentHdPrice.length <= 0){
|
|
|
+ this.$msg('请填写价格,价格要大于0')
|
|
|
hasError = true;
|
|
|
break;
|
|
|
}
|
|
|
if(this.$util.isEmpty(item.xhNum) || Number(item.xhNum) < 0){
|
|
|
- this.$msg('请填写 '+name+' 到货数,没有填0')
|
|
|
+ this.$msg('请填写到货数,没有填0')
|
|
|
hasError = true;
|
|
|
break;
|
|
|
}
|
|
|
- let preNum = item.xhPreNum ? Number(item.xhPreNum):0
|
|
|
let num = item.xhNum ? Number(item.xhNum) : 0
|
|
|
- if(num > preNum){
|
|
|
- this.$msg(name+' 超过预定数量')
|
|
|
- hasError = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- let price = item.xhPreUnitPrice ? Number(item.xhPreUnitPrice) : 0
|
|
|
+ let price = item.currentHdPrice ? Number(item.currentHdPrice) : 0
|
|
|
let productId = item.productId || 0
|
|
|
- let unitType = 0
|
|
|
- product = [...product,{productId,price,num,unitType}]
|
|
|
+ let unitType =
|
|
|
+ product = [...product,{productId,price,num}]
|
|
|
}
|
|
|
}
|
|
|
if(hasError == true){
|
|
|
return false
|
|
|
}
|
|
|
- if(Number(this.settlePrice) < 0){
|
|
|
- this.$msg('结账金额有问题')
|
|
|
- return
|
|
|
- }
|
|
|
that.$util.confirmModal({content:'确认提交'},() => {
|
|
|
arrival({id:that.option.id,product:JSON.stringify(product)}).then(res=>{
|
|
|
if(res.code == 1){
|