|
|
<template> <view> <view class="head"> <view class="lf-row-between list"> <view>订单编号</view> <view class="lf-color-black">{{ order.q_sn }}</view> </view> <view class="lf-row-between list"> <view>订单状态</view> <view :class="stateClass(order.state)">{{ order.state }}</view> </view> <view class="lf-row-between list"> <view>报价商</view> <view class="lf-color-black">{{ order.q_name }}</view> </view> </view> <self-line></self-line> <view class="lf-m-t-30 lf-m-l-32 lf-m-r-32"> <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">报价明细</view> <wyb-table :headers="headers" :contents="contents" :first-line-fixed="true" contentBgColor="#eef6fe" width="max-content" height="550rpx"></wyb-table> </view> <view style="height: 100rpx;"></view> <!-- 操作按钮 --> <view class="fixed-bottom" v-if="$isRight(order) && type != 0"> <view v-if="type == 1" class="lf-row-flex-end"> <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('待发起')">撤销订单</button> </view> <view v-if="type == 2" class="lf-row-flex-end"> <button class="btn btn1" @click="$url('/pages/offer/index?type=1&code='+ order.q_sn)">编辑</button> <button class="btn btn2" @click="orderStateChange('待审核')">发起报价</button> </view> <view v-if="type == 3 || type == 4" class="lf-row-between"> <button class="btn btn1" @click="$url('/pages/offer/index?type=2&code='+ order.q_sn)">复用报价单</button> <button class="btn btn1" @click="$url('/pages/offer/index?type=3&code='+ order.batch_sn)">复用批次号</button> <view class="lf-font-32" style="color: #11D189;" v-if="type == 3">报价已通过</view> <view class="lf-font-32" style="color: #FF0000;" v-if="type == 4">报价已被拒绝</view> </view> </view> </view></template>
<script> import wybTable from '@/components/wyb-table/wyb-table'; export default { components: { wybTable }, data(){ return { type: 0, order: {}, headers: [{ label: '物资名称', key: 'name' },{ label: '规格', key: 'spec' },{ label: '品牌', key: 'brand' },{ label: '品级', key: 'quality_level' },{ label: '编号', key: 'number' },{ label: '起购数', key: 'purchase_limit' },{ label: '含税价', key: 'tax_price' },{ label: '非含税价', key: 'non_tax_price' }], contents: [], q_sn: '', // 订单号
show_count: 0 } }, computed: { stateClass(){ return function(val){ let class_name = { '已通过': 'passed', '待发起': 'wait', '待审核': 'quoted-price', '未通过': 'refuse' } return class_name[val]; } } }, onLoad(options){ this.q_sn = options.q_sn; this.getDetail(); }, onShow(options){ this.show_count++; if(this.show_count > 1){ this.getDetail(); } }, methods: { stateType(val){ let type = 0; switch(val){ case '待审核': type = 1; break; case '待发起': type = 2; break; case '已通过': type = 3; break; case '未通过': type = 4; break; } this.type = type; }, getDetail(){ this.$http(this.API.API_SUPPLIER_QUOTATIONDETAIL, { q_sn: this.q_sn }).then(res => { console.log("getDetail", res); this.stateType(res.data.order.state); this.order = res.data.order || {}; let list = res.data.order.item || []; let contents = list.map(item => { let obj = { name: item.material?.m_name || '', material_id: item.material?.id, spec: item.spec?.name || '', spec_id: item.spec?.id, brand: item?.material?.brand || '', quality_level: item?.material?.quality_level || '', number: item?.material?.m_sn || '', tax_price: item.tax_price, non_tax_price: item.non_tax_price, purchase_limit: item.purchase_limit } return obj; }); this.contents = contents; }).catch(err => { this.$toBack(); }) }, // 改变订单状态
orderStateChange(state){ this.$http(this.API.API_SUPPLIER_QUOTATIONUPDATE, { q_sn: this.q_sn, state: state }).then(res => { console.log("revokeOrder", res); this.$msg('操作成功'); this.getDetail(); // 更新当前页面数据
}) } } }</script>
<style lang="scss" scoped="scoped"> .head{ padding: 0 32rpx; width: 750rpx; box-sizing: border-box; height: auto; .list{ padding: 30rpx 0; border-bottom: 1rpx solid #e5e5e5; font-size: 28rpx; color: #555555; &:last-child{ border-bottom: none; } } } .fixed-bottom{ position: fixed; bottom: 0rpx; left: 0rpx; z-index: 99; width: 750rpx; height: 98rpx; display: flex; // justify-content: flex-end;
align-items: center; border-top: 1rpx solid #E5E5E5; background-color: #FFFFFF; box-sizing: border-box; padding: 0 32rpx; .btn{ width: 212rpx; height: 82rpx; border-radius: 41rpx; margin: 0; padding: 0; font-size: 32rpx; display: flex; justify-content: center; align-items: center; } .btn1{ border: 2rpx solid #555555; opacity: .5; } .btn2{ background: #1833F2; color: #FFFFFF; margin-left: 20rpx; } } .fixed-bottom>view{ width: 100%; } // 已报价,等待审核
.quoted-price{ color: #777777; } // 等待报价
.wait{ color: #1833F2; } // 已通过审核
.passed{ color: #0BCE5F; } // 报价被拒绝
.refuse{ color: #FF0000; }</style>
|