|
|
|
@ -114,9 +114,9 @@ |
|
|
|
|
</view> |
|
|
|
|
<view class="info"> |
|
|
|
|
总采购成本: |
|
|
|
|
<text class="num num1">{{ purchase }}</text>元 |
|
|
|
|
<text class="num num1">{{ form.purchaseCost }}</text>元 |
|
|
|
|
总产品利润: |
|
|
|
|
<text class="num"> {{ profit }}</text> 元 |
|
|
|
|
<text class="num"> {{ form.profit }}</text> 元 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view v-if="!isDetail" class="btn" @click="submit">提交</view> |
|
|
|
@ -164,12 +164,13 @@ |
|
|
|
|
phone: '', |
|
|
|
|
orderAmount: 0, |
|
|
|
|
customerName: '', |
|
|
|
|
profit: 0, // 利润 |
|
|
|
|
purchaseCost: '', // 采购成本 |
|
|
|
|
teamId: uni.getStorageSync('team').teamId, |
|
|
|
|
businessManagerId: this.$util.getBmId() |
|
|
|
|
}, |
|
|
|
|
courseList: {}, |
|
|
|
|
courses: [], // 缓存的产品列表 |
|
|
|
|
purchase: 0, |
|
|
|
|
profit: 0, |
|
|
|
|
contract: { // 合同信息 |
|
|
|
|
contractName: '', // 合同名称 |
|
|
|
|
contractFile: '', // 合同文件 |
|
|
|
@ -335,29 +336,33 @@ |
|
|
|
|
}, |
|
|
|
|
// 计算订单总额 |
|
|
|
|
calcTotal() { |
|
|
|
|
let total = 0 |
|
|
|
|
const list = this.courses |
|
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
|
let profit = 0 // 总利润 |
|
|
|
|
/** |
|
|
|
|
* 1)总采购成本+总产品利润=总成交价格 |
|
|
|
|
|
|
|
|
|
(2)单个产品采购成本 =结算价+平台服务费 |
|
|
|
|
|
|
|
|
|
(3)平台服务费=结算价*10% |
|
|
|
|
|
|
|
|
|
(4)单个产品的利润=成交价-采购成本 |
|
|
|
|
|
|
|
|
|
总成本和总利润为单个产品的采购成本价和利润的和 |
|
|
|
|
*/ |
|
|
|
|
list.map(e => { |
|
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
|
purchase += curPurchase |
|
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
|
}) |
|
|
|
|
this.purchase = Math.round(purchase) |
|
|
|
|
this.profit = Math.round(profit) |
|
|
|
|
this.form.orderAmount = +this.purchase + +this.profit |
|
|
|
|
const { form } = this |
|
|
|
|
// 老数据没有这两个字段,则手动计算 |
|
|
|
|
if (!form.purchaseCost && !form.profit) { |
|
|
|
|
let total = 0 |
|
|
|
|
const list = this.courses |
|
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
|
let profit = 0 // 总利润 |
|
|
|
|
/** |
|
|
|
|
* 1)总采购成本+总产品利润=总成交价格 |
|
|
|
|
|
|
|
|
|
(2)单个产品采购成本 =结算价+平台服务费 |
|
|
|
|
|
|
|
|
|
(3)平台服务费=结算价*10% |
|
|
|
|
|
|
|
|
|
(4)单个产品的利润=成交价-采购成本 |
|
|
|
|
|
|
|
|
|
总成本和总利润为单个产品的采购成本价和利润的和 |
|
|
|
|
*/ |
|
|
|
|
list.map(e => { |
|
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
|
purchase += curPurchase |
|
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
|
}) |
|
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
|
form.profit = Math.round(profit) |
|
|
|
|
} |
|
|
|
|
form.orderAmount = +form.purchaseCost + +form.profit |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit() { |
|
|
|
@ -395,11 +400,11 @@ |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
.page { |
|
|
|
|
height: calc(100vh - 300rpx); |
|
|
|
|
height: calc(100vh - 300rpx - env(safe-area-inset-bottom)); |
|
|
|
|
overflow: auto; |
|
|
|
|
} |
|
|
|
|
.show { |
|
|
|
|
height: calc(100vh - 130rpx); |
|
|
|
|
height: calc(100vh - 130rpx - env(safe-area-inset-bottom)); |
|
|
|
|
} |
|
|
|
|
.pro-wrap { |
|
|
|
|
position: relative; |
|
|
|
@ -465,7 +470,7 @@ |
|
|
|
|
} |
|
|
|
|
.bottom { |
|
|
|
|
position: fixed; |
|
|
|
|
bottom: 0; |
|
|
|
|
bottom: env(safe-area-inset-bottom); |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
/deep/.add-btn { |
|
|
|
@ -498,7 +503,8 @@ |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #666; |
|
|
|
|
.num { |
|
|
|
|
font-size: 30rpx; |
|
|
|
|
margin: 0 5rpx; |
|
|
|
|
font-size: 34rpx; |
|
|
|
|
color: #007EFF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -506,7 +512,8 @@ |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #333; |
|
|
|
|
.num { |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
margin: 0 5rpx; |
|
|
|
|
font-size: 32rpx; |
|
|
|
|
color: #007EFF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -517,7 +524,7 @@ |
|
|
|
|
width: 196rpx; |
|
|
|
|
margin-left: 27rpx; |
|
|
|
|
line-height: 80rpx; |
|
|
|
|
font-size: 30rpx; |
|
|
|
|
font-size: 32rpx; |
|
|
|
|
text-align: center; |
|
|
|
|
color: #fff; |
|
|
|
|
border-radius: 10rpx; |
|
|
|
|