123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- <template>
- <view class="list-content">
- <pageHead pageTitle="议价审批" :showBack="true" :showHistory="true" @jumpHistory="jumpPage" style="margin-bottom: 10px;"></pageHead>
- <view class="list-card">
- <u--form ref="form" :model="bargainInfo" labelPosition="left" labelWidth="80" :labelStyle="{'color': '#6B7688','fontSize':'16px'}" >
- <u-form-item label="项目名称" prop="projectName">
- <view class="val-posi">{{bargainInfo.projectName}}</view>
- </u-form-item>
- <u-form-item label="报价编号" prop="quotationNo">
- <view class="val-posi">{{bargainInfo.quotationNo}}</view>
- </u-form-item>
- <u-form-item label="报价人" prop="quoter">
- <view class="val-posi">{{bargainInfo.quoter}}</view>
- </u-form-item>
- <u-form-item label="地区" prop="nickName" >
- <view class="val-posi">{{bargainInfo.countryName+'/'+bargainInfo.city}}</view>
- </u-form-item>
- <!-- <u-form-item label="销售" prop="saler" >
- <view class="val-posi">{{bargainInfo.saler}}</view>
- </u-form-item> -->
- <u-form-item label="代理商" prop="agentName" >
- <view class="val-posi">{{bargainInfo.agentName}}</view>
- </u-form-item>
- </u--form>
- </view>
- <view class="list-card" >
- <view class="card-title">电梯列表</view>
- <view v-for="(item, index) in bargainInfo.elevatorList">
- <u--form ref="form" :model="item" labelPosition="left" labelWidth="80" :labelStyle="{'color': '#6B7688','fontSize':'16px'}" >
- <u-form-item label="型号" prop="elevatorModel">
- <view class="val-posi">{{item.elevatorModel}}</view>
- </u-form-item>
- <u-form-item label="编号" prop="elevatorCode">
- <!-- <uni-tooltip :content="item.elevatorCode" placement="bottom">
- <view class="val-posi" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{{item.elevatorCode}}</view>
- </uni-tooltip> -->
- <view class="val-posi">{{item.elevatorCode}}</view>
- </u-form-item>
- <u-form-item label="规格" prop="specification" >
- <view class="val-posi">{{item.specification}}</view>
- </u-form-item>
- <u-form-item label="数量" prop="elevatorNumber" >
- <view class="val-posi">{{item.elevatorNumber}}</view>
- </u-form-item>
- <u-form-item label="价格" prop="price" >
- <view class="val-posi">{{stateFormatLow(item.price,0)}}</view>
- </u-form-item>
- <u-form-item label="基价折率" prop="discountRate">
- <u-input v-model="item.discountRate" placeholder="请输入基价折率" type="digit" inputAlign="right" border="surround"
- style="font-size: 16px;" :maxlength="30" @blur="changeRate(item)" :customStyle="{width:'150px'}"></u-input>
- <span style="margin-left: 5px;">%</span>
- </u-form-item>
- <u-form-item label="折后价格" prop="price" >
- <view class="val-posi">{{stateFormatLow(item.discountPrice,2)}}</view>
- </u-form-item>
- </u--form>
- <u-divider class="divider"></u-divider>
- </view>
- </view>
- <view class="list-card" style="padding: 16px 10px;">
- <view class="card-title">价格信息</view>
- <u-row gutter="4" style="margin-bottom: 8px;">
- <u-col span="4" >
- <view class="card__price">
- <view class="txt-label">价格合计</view>
- <view class="txt-value">¥{{stateFormatLow(bargainInfo.priceTotal,0)}}</view>
- </view>
- </u-col>
- <u-col span="4">
- <view class="card__price">
- <view class="txt-label">基价合计</view>
- <view class="txt-value">¥{{stateFormatLow(bargainInfo.basicPriceTotal,0)}}</view>
- </view>
- </u-col>
- <u-col span="4">
- <view class="card__price">
- <view class="txt-label">选配合计</view>
- <view class="txt-value">¥{{stateFormatLow(bargainInfo.optionalPriceTotal,0)}}</view>
- </view>
- </u-col>
- </u-row>
- <u-row gutter="4">
- <u-col span="4">
- <view class="card__price">
- <view class="txt-label">希望价格</view>
- <view class="txt-value2">¥{{stateFormatLow(bargainInfo.expectedPrice,0)}}</view>
- </view>
- </u-col>
- <u-col span="4">
- <view class="card__price">
- <view class="txt-label">希望基价折率</view>
- <view class="txt-value2">{{bargainInfo.basicPriceRate}}%</view>
- </view>
- </u-col>
- <u-col span="4">
- <view class="card__price">
- <view class="txt-label">实际基价折率</view>
- <view class="txt-value2">{{bargainInfo.discountRate}}%</view>
- </view>
- </u-col>
- </u-row>
- </view>
- <view style="height: 75px;"></view>
- <view class="card_bottom ">
- <view class="flex-center" style="width: 100%;">
- <view class="list-card__price" >
- <view class="txt-label" style="font-size: 14px;">同意价格</view>
- <view class="txt-value2" style="font-size: 20px;">¥{{stateFormatLow(bargainInfo.acceptPrice,0)}}</view>
- </view>
- <view class="flex-center" style="width: 60%;padding: 0px 8px;">
- <view class="button-left flex-center-middle" @click="toggle('02')">
- <img class="button-icon" src="@/static/img/approve/reject.png" alt="" />
- <view class="reject-text">驳回</view>
- </view>
- <view class="button-right flex-center-middle" @click="toggle('01')">
- <img class="button-icon" src="@/static/img/approve/pass.png" alt="" />
- <view class="pass-text">通过</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 弹窗 -->
- <view>
- <!-- 驳回弹窗 -->
- <uni-popup ref="popup" type="bottom" background-color="#fff" style="border-radius: 8rpx;">
- <view class="popup-content" >
- <view class="return_title">
- <text style="color: rgba(0, 0, 0, 0.85);">驳回原因:</text>
- </view>
- <view class="uni-textarea">
- <textarea v-model.trim="returnMsg" placeholder-style="color:#6B7688" placeholder="请输入驳回原因…" class="return_content" maxlength="200"/>
- </view>
- <view class="flex-center mt32">
- <view class="button-left flex-center-middle" @click="closePup()">
- <img class="button-icon" src="@/static/img/approve/reject.png" alt="" />
- <view class="reject-text">取消</view>
- </view>
- <view class="button-right flex-center-middle" @click="doSP('02')">
- <img class="button-icon" src="@/static/img/approve/pass.png" alt="" />
- <view class="pass-text">提交</view>
- </view>
- </view>
- </view>
- </uni-popup>
- <!-- 通过弹窗 -->
- <uni-popup ref="popupPass" background-color="#fff" borderRadius="10px 10px 10px 10px" style="width: 90%;">
- <view class="popup-content" style="padding: 20rpx 40rpx" >
- <view class="flex-center" style="justify-content: center;margin-bottom: 20rpx 0 30rpx">
- <view><img style="height: 100%;width: 300rpx;" src="@/static/img/approve/nomessage.png" alt="" /></view>
- </view>
- <view style="text-align: center;margin-bottom: 30rpx">
- <img class="button-icon" src="@/static/img/approve/warning.png" alt="" />
- <text style="color: rgba(0, 0, 0, 0.85);">确认无误并通过审核?</text>
- </view>
- <view class="flex-center mt32" style="margin-bottom: 30rpx;">
- <view class="button-left-one flex-center-middle" @click="closePup()">
- <img class="button-icon" src="@/static/img/approve/reject.png" alt="" />
- <view class="reject-text">取消</view>
- </view>
- <view style="width: 50rpx;"></view>
- <view class="button-right-one flex-center-middle" @click="doSP('01')">
- <img class="button-icon" src="@/static/img/approve/pass.png" alt="" />
- <view class="pass-text">通过</view>
- </view>
- </view>
- </view>
- </uni-popup>
- <!-- 确认弹窗 -->
- <uni-popup ref="popupConfirm" background-color="#fff" borderRadius="10px 10px 10px 10px" style="width: 90%;">
- <view class="popup-content" style="padding: 20rpx 40rpx" >
- <view style="text-align: center;margin: 50rpx 0 30rpx">
- <img class="button-icon" src="@/static/img/approve/warning.png" alt="" />
- <text style="color: rgba(0, 0, 0, 0.85);">该报价单的折扣超出您的折扣范围</text>
- </view>
- <view style="text-align: center;margin: 30rpx 0">
- <text style="color: rgba(0, 0, 0, 0.85);">是否确认?</text>
- </view>
- <view class="flex-center mt32" style="margin-bottom: 30rpx;">
- <view class="button-left-one flex-center-middle" @click="closePup()">
- <img class="button-icon" src="@/static/img/approve/reject.png" alt="" />
- <view class="reject-text">取消</view>
- </view>
- <view style="width: 50rpx;"></view>
- <view class="button-right-one flex-center-middle" @click="handleApprove('01')">
- <img class="button-icon" src="@/static/img/approve/pass.png" alt="" />
- <view class="pass-text">确定</view>
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </view>
- </template>
- <script>
- import * as ApproveApi from '@/api/work/approve'
- import { stateFormat,stateFormatLow } from '@/utils/common.js'
- export default {
- data() {
- return {
- projectPageParam: {
- pageNum: 1,
- pageSize: 5
- },
- bargainInfo:{},
- bargainLoadAll: false,
- bargainId:'',
- quotationId:'',
- returnMsg:"",
- jumpUrl:"/pages/work/approve/bargainAduit?businessId="
- }
- },
- onLoad (params) {
- this.quotationId = params.quotationId
- this.jumpUrl = this.jumpUrl+this.quotationId
- this.getBargainInfo()
- },
- methods: {
- jumpPage(){
- uni.navigateTo({
- url: this.jumpUrl
- })
- },
- closePup(){
- this.returnMsg = "";
- this.$refs.popup.close()
- this.$refs.popupPass.close()
- this.$refs.popupConfirm.close()
- },
- toggle(status) {
- // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
- if(status == '02'){
- this.$refs.popup.open()
- }else{
- this.$refs.popupPass.open()
- }
- },
- handleApprove(status){
- if(status == '02' && this.returnMsg == ""){
- uni.showToast({
- icon: 'error',
- mask: true,
- title: '请输入驳回原因..',
- })
- return
- }
- //设置实体
- let bargainObj = {}
- let auditForm = {}
- if (status == '02') {
- //驳回
- bargainObj = {
- quotationId: this.quotationId,
- }
- auditForm = {
- // 审批流
- auditFlow: 2,
- // 业务id 报价id
- businessId: this.quotationId,
- // 审批结果
- status: 30,
- // 备注
- remark: '基价折率:' + this.bargainInfo.discountRate + '%',
- // 业务参数
- businessObj: bargainObj
- }
- }else{
- //通过
- bargainObj = {
- bargainId: this.bargainInfo.bargainId,
- quotationId: this.quotationId,
- tableList: this.bargainInfo.elevatorList,
- discountRate: this.bargainInfo.discountRate
- }
- auditForm = {
- // 审批流
- auditFlow: 2,
- // 业务id 报价id
- businessId: this.quotationId,
- // 审批结果
- status: 200,
- // 备注
- remark: '基价折率:' + this.bargainInfo.discountRate + '%',
- // 业务参数
- businessObj: bargainObj
- }
- }
- if (status == '02') {
- auditForm.remark += ',驳回原因:'+ this.returnMsg
- }
- ApproveApi.audit(auditForm).then(res => {
- if (res.code == 200) {
- setTimeout(() => {
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '操作成功',
- })
- }, 500)
- //调回上一页
- this.goBack()
- }
- })
- },
- changeRate(item){
- if(item.discountRate < 1){
- item.discountRate = 1
- }
- if(item.discountRate > 100){
- item.discountRate = 100
- }
- //格式化
- item.discountRate = Number(item.discountRate).toFixed(4)
- //重新计算该梯形的折后价
- item.discountPrice = ((item.originalBasicPrice * item.discountRate) / 100 ) + item.originalOptionalPrice
- console.log("item.discountPrice"+item.discountPrice)
- //重新计算同意价格
- let sum = 0
- //计算折扣前后的基价
- let basicPricePre = 0
- let basicPriceAft = 0
- let elevators = this.bargainInfo.elevatorList
- elevators.some(it=>{
- sum += it.discountPrice * it.elevatorNumber
- basicPricePre += it.originalBasicPrice * it.elevatorNumber
- basicPriceAft += ((it.originalBasicPrice * it.discountRate * it.elevatorNumber) / 100 )
- })
- //重新计算折扣率
- let discountRate = (basicPriceAft / basicPricePre) * 100
- //重新设置接受价格
- this.bargainInfo.acceptPrice = sum
- //折扣率格式化
- this.bargainInfo.discountRate = Number(discountRate).toFixed(4)
- },
- stateFormat,
- stateFormatLow,
- getBargainInfo() {
- ApproveApi.bargainById(this.quotationId).then(res => {
- if (res.code == 200) {
- this.bargainInfo = res.data
- if(this.bargainInfo.elevatorList){
- let list = this.bargainInfo.elevatorList
- //this.bargainInfo.discountRate = Number(this.bargainInfo.discountRate).toFixed(4)
- this.bargainInfo.elevatorList.some(item=>{
- item.discountRate = Number(item.discountRate).toFixed(4)
- })
- //赋值完成后重新计算一下折率
- this.changeRate(this.bargainInfo.elevatorList[0])
- }
- }
- })
- },
- async doSP(status){
- const that = this
- let res = await ApproveApi.getSalesDiscount(this.quotationId);
- let minRate = res.data.minDiscount
- let maxRate = res.data.maxDiscount
- let realRate = this.bargainInfo.discountRate
- console.log(this.bargainInfo.priceTotal)
- console.log(this.bargainInfo.originOptionalPrice)
- console.log(this.bargainInfo.originBasicPrice)
- console.log(Math.round((this.bargainInfo.priceTotal - this.bargainInfo.originOptionalPrice)))
- //20240828新算法
- let ratePoint = Math.round((this.bargainInfo.priceTotal - this.bargainInfo.originOptionalPrice) * 100000 /this.bargainInfo.originBasicPrice) / 1000 - Number(realRate)
- console.log('ratePoint', ratePoint)
- console.log('minRate', minRate)
- console.log('maxRate', maxRate)
- if ((ratePoint >= 0 && minRate >= ratePoint) || (ratePoint < 0 && maxRate >= Math.abs(ratePoint))) {
- //可以掉通过
- this.handleApprove(status)
- }else {
- //不行还需确认
- this.$refs.popupConfirm.open()
- }
- },
- // 审批
- handleApproveOld(status) {
- let bargainObj = {}
- let auditForm = {}
- if (status == '02') {
- //驳回
- bargainObj = {
- quotationId: this.quotationId,
- }
- auditForm = {
- // 审批流
- auditFlow: 2,
- // 业务id 报价id
- businessId: this.quotationId,
- // 审批结果
- status: 30,
- // 备注
- remark: '基价折率:' + this.bargainInfo.discountRate + '%',
- // 业务参数
- businessObj: bargainObj
- }
- }else{
- //通过
- bargainObj = {
- bargainId: this.bargainInfo.bargainId,
- quotationId: this.quotationId,
- tableList: this.bargainInfo.elevatorList,
- discountRate: this.bargainInfo.discountRate
- }
- auditForm = {
- // 审批流
- auditFlow: 2,
- // 业务id 报价id
- businessId: this.quotationId,
- // 审批结果
- status: 200,
- // 备注
- remark: '基价折率:' + this.bargainInfo.discountRate + '%',
- // 业务参数
- businessObj: bargainObj
- }
- }
- const that = this
- uni.showModal({
- title: status == '02' ? '是否确认驳回' : '是否确认通过',
- editable: status == '02',
- placeholderText: status == '02' ? '请输入驳回原因' : null,
- cancelColor: '#6B7688',
- confirmColor: '#E60114',
- success: function(res) {
- if (res.confirm) {
- if (status == '02') {
- auditForm.remark += ',驳回原因:'+res.content
- }
- ApproveApi.audit(auditForm).then(res => {
- if (res.code == 200) {
- setTimeout(() => {
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '操作成功',
- })
- }, 500)
- //调回上一页
- that.goBack()
- }
- })
- }
- }
- })
- },
- goBack () {
- //uni.navigateBack({ delta: 1});
- uni.navigateTo({
- url: '/pages/work/approve/list'
- })
- }
- }
- }
- </script>
- <style>
- page {
- background-color: #EFF2F6;
- }
- </style>
- <style lang="scss" scoped>
- .list-card__price {
- width: 40%;
- }
- .card_bottom{
- display:flex;
- width: 100%;
- align-items: center;
- height: 75px;
- position:fixed;
- bottom: 0px;
- margin-left: 0px;
- background: #FFFFFF;
- .button-left {
- width: 48%;
- height: 84rpx;
- background: #FFF8F8;
- border-radius: 200rpx 0rpx 0rpx 200rpx;
- box-shadow: 0px 5px 6px 0px #EADEDF;
- .reject-text {
- font-size: 32rpx;
- color: #E60114;
- line-height: 44rpx;
- }
- }
- .button-right {
- width: 48%;
- height: 84rpx;
- background: linear-gradient(90deg, #DC0736 0%, #E60114 100%);
- box-shadow: 0px 5px 6px 0px #EADEDF;
- border-radius: 0rpx 200rpx 200rpx 0rpx;
- .pass-text {
- font-size: 32rpx;
- color: #FFFFFF;
- line-height: 44rpx;
- }
- }
- }
- .card-title{
- font-weight: 600;
- font-size: 16px;
- margin-bottom: 10px;
- }
- .txt-label {
- color: #3C485B;
- font-weight: 400;
- font-size: 12px;
- text-align: center;
- margin-bottom: 5px;
- }
- .txt-value {
- color: #000000;
- text-align: center;
- font-size: 16px;
- font-weight: 600;
- }
- .txt-value2 {
- color: #E60012;
- text-align: center;
- font-size: 16px;
- font-weight: 600;
- }
- .card__price{
- text-align: center;
- width: 90%;
- background-color: #FFF5F6;
- border-radius: 4px;
- padding:7px 5px;
- }
- .val-posi{
- width: 100%;
- text-align: right;
- font-size: 16px;
- }
- ::v-deep .u-badge--error {
- background-color: #E60114;
- }
- .flex-center {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .flex-center-between {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 10px;
- }
- .flex-center-middle {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .ml40 {
- margin-left: 40rpx
- }
- .mt32 {
- margin-top: 32rpx;
- }
- .list-content {
- // padding: 20rpx 24rpx;
- .button-icon {
- width: 28rpx;
- height: 28rpx;
- margin-right: 8rpx;
- }
- .divider {
- margin: 32rpx 0;
- border: 2rpx solid #E9EEF3;
- }
- .list-card {
- margin: 0px 24rpx;
- background: #FFFFFF;
- border-radius: 8rpx;
- padding: 32rpx;
- margin-bottom: 20rpx;
- &__title {
- font-weight: 600;
- font-size: 34rpx;
- color: #000000;
- line-height: 48rpx;
- width: 480rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- &__area {
- font-size: 32rpx;
- color: rgba(0, 0, 0, 0.85);
- line-height: 32rpx;
- }
- &__text {
- font-size: 32rpx;
- color: #6B7688;
- line-height: 40rpx;
- }
- .developer {
- color: rgba(0, 0, 0, 0.85);
- width: 490rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .button-icon {
- width: 28rpx;
- height: 28rpx;
- margin-right: 8rpx;
- }
- .button-left {
- width: 350rpx;
- height: 84rpx;
- background: #FFF8F8;
- border-radius: 200rpx 0rpx 0rpx 200rpx;
- box-shadow: 0rpx 4rpx 16rpx 0rpx #DFDFDF;
- .reject-text {
- font-size: 32rpx;
- color: #E60114;
- line-height: 44rpx;
- }
- }
- .button-right {
- width: 350rpx;
- height: 84rpx;
- background: linear-gradient(90deg, #DC0736 0%, #E60114 100%);
- box-shadow: 0rpx 4rpx 16rpx 0rpx #DFDFDF;
- border-radius: 0rpx 200rpx 200rpx 0rpx;
- .pass-text {
- font-size: 32rpx;
- color: #FFFFFF;
- line-height: 44rpx;
- }
- }
- }
- .popup-content {
- padding: 20rpx 20rpx;
- .return_content{
- width: 92%;
- padding: 20rpx 28rpx;
- background: #EFF2F6;
- border-radius: 4px;
- }
- .return_title{
- font-family: PingFangSC, PingFang SC;
- font-weight: 600;
- font-size: 16px;
- color: rgba(0,0,0,0.85);
- margin-bottom: 10rpx;
- }
- .button-icon {
- width: 28rpx;
- height: 28rpx;
- margin-right: 8rpx;
- }
- .button-left {
- width: 350rpx;
- height: 84rpx;
- background: #FFF8F8;
- border-radius: 200rpx 0rpx 0rpx 200rpx;
- box-shadow: 0px 2px 8px 0px #DFDFDF;
- .reject-text {
- font-size: 32rpx;
- color: #E60114;
- line-height: 44rpx;
- }
- }
- .button-right {
- width: 350rpx;
- height: 84rpx;
- background: linear-gradient(90deg, #DC0736 0%, #E60114 100%);
- border-radius: 0rpx 200rpx 200rpx 0rpx;
- box-shadow: 0px 2px 8px 0px #DFDFDF;
- .pass-text {
- font-size: 32rpx;
- color: #FFFFFF;
- line-height: 44rpx;
- }
- }
- .button-left-one {
- width: 220rpx;
- height: 84rpx;
- background: #FFF8F8;
- border-radius: 200rpx;
- box-shadow: 0px 2px 8px 0px #DFDFDF;
- .reject-text {
- font-size: 32rpx;
- color: #E60114;
- line-height: 44rpx;
- }
- }
- .button-right-one {
- width: 220rpx;
- height: 84rpx;
- background: linear-gradient(90deg, #DC0736 0%, #E60114 100%);
- border-radius: 200rpx;
- box-shadow: 0px 2px 8px 0px #DFDFDF;
- .pass-text {
- font-size: 32rpx;
- color: #FFFFFF;
- line-height: 44rpx;
- }
- }
- }
- }
- </style>
|