|
|
<template> <view> <block v-if="$isRight(order)"> <view class="head"> <view class="lf-row-between list"> <image :src="order.supplier.logo" class="image"></image> <view class="info"> <view class="lf-font-32 lf-color-black lf-font-bold">{{ order.supplier.supplier_name }}</view> <view class="lf-font-24 lf-color-555">{{ order.supplier.address }}</view> <view class="lf-font-24 lf-color-555" @click="call(order.supplier.ctl_phone)">{{order.supplier.ctl_man}} {{ order.supplier.ctl_phone }}</view> </view> </view> </view> <self-line></self-line> <view class="lf-bg-white"> <lf-stepbar :list="order.state_log" themeColor="#11D189" v-if="order.state_log"></lf-stepbar> </view> <self-line></self-line> <view class="head"> <view class="lf-row-between list" v-if="order.car_license"> <view>车辆</view> <view class="lf-font-bold">{{order.car_license}}</view> </view> <view class="lf-row-between list" v-if="order.deliver_man"> <view>司机</view> <view class="lf-font-bold">{{order.deliver_man}}</view> </view> <view class="lf-row-between list" @click="call(order.deliver_phone)" v-if="order.deliver_phone"> <view>联系电话</view> <view class="lf-font-bold" style="color: rgb(17, 209, 137);">{{order.deliver_phone}}</view> </view> <view class="lf-row-between list"> <view>采购单</view> <view class="lf-font-bold">{{ order.p_sn }}</view> </view> <view class="lf-row-between list"> <view>批次号</view> <view class="lf-font-bold">{{ order.batch_sn }}</view> </view> <view class="lf-row-between list"> <view>预计收货时间</view> <view class="lf-font-bold">{{order.deadline_text}}</view> </view> <view class="list" v-if="supplier_voucher.length"> <view>证明材料-供应端</view> <view class="lf-flex-wrap lf-m-t-10"> <image :src="item" @click="lookImage(index, 'supplier_voucher')" class="ms-img" v-for="(item, index) in supplier_voucher" :key="index"></image> </view> </view> <view class="list" v-if="canteen_voucher.length"> <view>证明材料-食堂端</view> <view class="lf-flex-wrap lf-m-t-10"> <image :src="item" @click="lookImage(index, 'canteen_voucher')" class="ms-img" v-for="(item, index) in canteen_voucher" :key="index"></image> </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 :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" width="max-content" height="80vh"></wyb-table> </view> <view style="height: 140rpx;"></view> <!-- 操作按钮 --> <view class="fixed-bottom" v-if="type && type != '备货中'"> <view v-if="type == '待发单'" class="lf-row-flex-end"> <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button> <button class="btn btn2" @click="orderStateChange('待接单')">立即发单</button> </view> <view v-else-if="type == '待接单'" class="lf-row-flex-end"> <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button> </view> <view v-else-if="type == '已发货'" class="lf-row-flex-end"> <button class="btn btn1" @click="orderStateChange('已退单')">退单</button> <button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">清点物资</button> </view> <view v-else-if="type == '已收货' || type == '已入库'" class="lf-row-between"> <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button> <view class="lf-font-32" style="color: #11D189;">{{order.state}}</view> </view> <view v-else-if="type == '已撤销'" class="lf-row-between"> <button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=2')">复用采购单</button> <view class="lf-font-32" style="color: #ff0000;">{{ type }}</view> </view> <view v-else class="lf-row-flex-end"> <view class="lf-font-32">{{ type }}</view> </view> </view> </block> </view></template>
<script> import wybTable from '@/components/wyb-table/wyb-table'; export default { components: { wybTable }, data(){ return { headers: [{ key: 'name', label: '物资名称' },{ key: 'spec', label: '规格' },{ label: '单位', key: 'unit' },{ label: '分类', key: 'category' },{ key: 'brand', label: '品牌' },{ key: 'quality_level', label: '品级' },{ label: '编号', key: 'm_sn' },{ label: '供应商', key: 'supplier_name' },{ key: 'pre_tax_price', label: '税前价格' },{ key: 'total_tax_amount', label: '含税合计' },{ key: 'after_tax_price', label: '税后价格' },{ key: 'total_non_tax_amount', label: '不含税合计' },{ key: 'purchase_limit', label: '起购数' },{ key: 'purchase_number', label: '采购数量' }], contents: [], order: {}, p_sn: '', type: '', is_show_voucher: false, voucher_list: [], voucher_count: 6, show_count: 0, canteen_voucher: [], // 食堂端凭证
supplier_voucher: [] // 供应端凭证
} }, onLoad(options){ this.p_sn = options.p_sn || ''; this.getData(); }, onShow(){ this.show_count++; if(this.show_count > 1){ this.getData(); } }, methods: { // 拨打电话
call(phone) { uni.makePhoneCall({ phoneNumber: String(phone) }); }, getData(){ this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, { p_sn: this.p_sn }).then(res => { let order = res.data.order; order.state_log.forEach((item, index) => { item.isFinished = false; if(index == order.state_log.length - 1){ let actionState = [ '订单已完成', '订单已退款', '订单已撤销', '订单已确认,物资入库' ]; if(actionState.includes(item.action)){ item.isFinished = true; } } }) let supplier_voucher = []; let canteen_voucher = []; order.voucher.map(item => { if(item.client_type == '供应商'){ supplier_voucher.push(item.voucher_pic); }else if(item.client_type == '食堂'){ canteen_voucher.push(item.voucher_pic); } }) this.supplier_voucher = supplier_voucher; this.canteen_voucher = canteen_voucher; this.order = order; let list = order.items || []; let contents = list.map(item => { return { name: item?.material?.m_name, spec: item?.spec?.name, brand: item?.material?.brand, quality_level: item?.material?.quality_level, m_sn: item?.material?.m_sn, supplier_name: order?.supplier?.supplier_name, pre_tax_price: item.total_tax_amount, after_tax_price: item.total_non_tax_amount, purchase_limit: item?.p_order_item.purchase_limit, purchase_number: item.purchase_number, unit: item?.material?.unit?.unit_name || '', category: item?.material?.category?.m_cate_name || '', total_tax_amount: item.total_tax_amount, total_non_tax_amount: item.total_non_tax_amount } }) this.contents = contents; this.type = order.state; }).catch(err => this.$toBack()); }, // 预览图片
lookImage(index, list){ if(this[list].length <= 0) return; this.$u.throttle(() => { uni.previewImage({ urls: this[list], current: index }) }, 500); }, // 改变订单状态
orderStateChange(state){ let that = this; if(state == '已退单'){ uni.showModal({ title: '温馨提示', content: '退单前请与供应商协商,以免造成损失!确定继续退单操作吗?', confirmColor: '#FF0000', cancelColor: '#11D189', success: result => { if(result.confirm){ $change(); } } }) }else{ $change(); } function $change(){ that.$http(that.API.API_CANTEEN_PURCHASEUPDATE, { p_sn: that.p_sn, state: state }).then(res => { that.$msg('操作成功').then(()=> that.getData()); }) } } } }</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; } .image{ width: 140rpx; height: 140rpx; border-radius: 10rpx; background-color: #EEEEEE; } .info{ display: flex; flex-direction: column; justify-content: space-around; width: 530rpx; height: 140rpx; } } } .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: #11D189; color: #FFFFFF; margin-left: 20rpx; } } .fixed-bottom>view{ width: 100%; } .ms-img{ width: 160rpx; height: 160rpx; margin-right: 15rpx; margin-top: 15rpx; background-color: #EEEEEE; &:nth-of-type(4n){ margin-right: 0rpx; } }</style>
|