|
|
<template> <view v-if="$isRight(order)"> <view class="head" style="padding: 0 16px 0 0;"> <!-- <view class="lf-row-between lf-color-gray list"> <view>采购单 </view> </view> --> <view class="list"> <lf-stepbar :list="stepList" themeColor="#11D189"></lf-stepbar> </view> </view> <self-line></self-line> <view class="head"> <view class="lf-row-between list"> <view>申请人</view> <view class="lf-font-bold">{{order.sheet[0].purchase.contact_name}}</view> </view> <view class="lf-row-between list"> <view>采购单</view> <view class="lf-font-bold">{{order.sheet[0].purchase.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" @click="call(order.sheet[0].purchase.contact_phone)"> <view>联系电话</view> <view class="lf-font-bold" style="color: rgb(17, 209, 137);">{{order.sheet[0].purchase.contact_phone}}</view> </view> </view> <self-line></self-line> <view class="lf-m-t-30 lf-m-l-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="100%" height="80vh"></wyb-table> </view> <view style="height: 140rpx;"></view> <!-- 操作按钮 --> <view class="fixed-bottom"> <view v-if="type == '待确认'" class="lf-row-flex-end" style="justify-content: space-between;width: 100%;"> <button class="btn btn1" @click="$url('/pages/delivery/apply?o_sn='+ o_sn+'&enter_type=1')">编辑</button> <button class="btn btn2" @click="orderStateChange('已确认')">立即申请</button> </view> <view v-else-if="type == '已出库'" class="lf-row-between" style="justify-content: space-between;width: 100%;"> <button class="btn btn1" @click="$url('/pages/delivery/apply?o_sn='+ o_sn+'&enter_type=2')">复用出库单</button> <view class="lf-font-32" style="color: #11D189;">已出库</view> </view> <view v-else class="lf-row-between"> <view></view> <view class="lf-font-32" style="color: #1833F2;">{{type}}</view> </view> </view> </view></template>
<script> import wybTable from '@/components/wyb-table/wyb-table'; export default { components: { wybTable }, data(){ return { stepList: [], headers: [{ label: '物资名称', key: 'material_name' },{ label: '规格', key: 'spec_name' },{ key: 'brand', label: '品牌' },{ key: 'quality_level', label: '品级' },{ label: '编号', key: 'm_sn' },{ label: '供应商', key: 'supplier_name' },{ label: '批次', key: 'purchase_id' },{ key: 'delivery_number', label: '出库数量' }], contents: [], o_sn: '', order: {}, type: 4, show_count: 0 } }, onLoad(options){ this.o_sn = options.id || ''; this.getData(); }, onShow(){ this.show_count++; if(this.show_count > 1){ this.getData(); } }, methods: { call(phone) { uni.makePhoneCall({ phoneNumber: phone //仅为示例
}); }, getData(){ this.$http(this.API.API_CANTEEN_OUTDETAIL, { o_sn: this.o_sn }).then(res => { this.order = res.data; this.stepList = this.order.state_log.map((item, index) => { item.isFinished = false; if(index == this.order.state_log.length - 1){ let actionState = [ '订单已完成', '订单已退款', '订单已撤销' ]; if(actionState.includes(item.action)){ item.isFinished = true; } } return item; }) let list = res.data.sheet || []; let contents = list.map(item => { console.log(item) return { material_name: item.material.m_name, spec_name: item.spec.name, brand: item.material.brand, quality_level: item.material.quality_level, m_sn: item.material.m_sn, supplier_name: item.purchase.supplier.supplier_name, purchase_id: item.purchase_id, delivery_number: item.out_number } }) this.contents = contents; console.log(this.contents) this.type = res.data.state }) }, // 改变订单状态
orderStateChange(state){ this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, { w_sn: this.o_sn, state: state }).then(res => { console.log("res", res); this.$msg('操作成功'); this.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; } .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; } } .ms-img{ width: 160rpx; height: 160rpx; margin-right: 15rpx; margin-top: 15rpx; &:nth-of-type(4n){ margin-right: 0rpx; } }</style>
|