You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
233 lines
5.6 KiB
233 lines
5.6 KiB
<template> |
|
<view class="add"> |
|
<!-- 设备信息 --> |
|
<view class="main"> |
|
<u--form labelPosition="left" labelAlign="center" :model="form" ref="form1"> |
|
<u-form-item label="设备名称" prop="equipName" borderBottom labelWidth="auto" ref="item1"> |
|
<u-text :text="form.equipName"></u-text> |
|
</u-form-item> |
|
<u-form-item label="设备编号" prop="equipNo" labelWidth="auto" borderBottom> |
|
<u-text :text="form.equipNo"></u-text> |
|
</u-form-item> |
|
<u-form-item label="设备批次" prop="batch" borderBottom labelWidth="auto" ref="item1"> |
|
<u-text :text="form.batch"></u-text> |
|
</u-form-item> |
|
<u-form-item label="供应商" prop="supplierName" labelWidth="auto" borderBottom> |
|
<u-text :text="form.supplierName"></u-text> |
|
</u-form-item> |
|
<u-form-item label="采购数量" prop="num" labelWidth="auto" borderBottom> |
|
<u-text :text="form.num"></u-text> |
|
</u-form-item> |
|
<u-form-item label="采购价格" prop="price" labelWidth="auto" borderBottom> |
|
<u-text :text="form.price"></u-text> |
|
</u-form-item> |
|
<u-form-item label="生产日期" prop="productionTime" labelWidth="auto" borderBottom> |
|
<u-text :text="form.productionTime"></u-text> |
|
</u-form-item> |
|
<u-form-item label="采购日期" prop="purchaseTime" labelWidth="auto" borderBottom> |
|
<u-text :text="form.purchaseTime"></u-text> |
|
</u-form-item> |
|
<u-form-item label="入库日期" prop="inTime" labelWidth="auto" borderBottom v-if="form.status!=1"> |
|
<u-text :text="form.inTime"></u-text> |
|
</u-form-item> |
|
<u-form-item label="采购状态" prop="inTime" labelWidth="auto" borderBottom> |
|
<view class="c-status"> |
|
<u-tag text="采购中" plain size="mini" type="warning" v-if="form.status=='0'"></u-tag> |
|
<u-tag text="采购完成" plain size="mini" v-if="form.status=='1'"></u-tag> |
|
<u-tag text="已入库" plain size="mini" type="success" v-if="form.status=='2'"></u-tag> |
|
<u-tag text="已失效" plain size="mini" type="error" v-if="form.status=='3'"></u-tag> |
|
</view> |
|
</u-form-item> |
|
<u-form-item label="采购图片" labelWidth="auto" borderBottom> |
|
<view class="vvv"> |
|
<view class="u-img" v-for="i in fileList1" :key="i.id"> |
|
<u--image :src="i.url" width='80' height='80' |
|
@click="showImg(i.url)" ></u--image> |
|
</view> |
|
</view> |
|
</u-form-item> |
|
</u--form> |
|
</view> |
|
|
|
<view v-if="form.status==1"> |
|
<view class="submit"> |
|
<view style='width: 140px;float: left;margin-left: 2px;'> |
|
<u-button type="primary" |
|
@click="warehousing" text="确 认 入 库"></u-button> |
|
</view> |
|
<view style='width: 140px;float: right;margin-right: 2px;'> |
|
<u-button type="error" |
|
@click="cancelPurchase" text="取 消 入 库"></u-button> |
|
</view> |
|
</view> |
|
</view> |
|
|
|
</view> |
|
</template> |
|
|
|
<script> |
|
export default { |
|
|
|
data() { |
|
return { |
|
form: { |
|
id: null, |
|
equipNo: null, |
|
equipName: null, |
|
price: null, |
|
supplierId: null, |
|
supplierName: null, |
|
num: null, |
|
// 采购日期 |
|
purchaseTime: null, |
|
// 生产日期 |
|
productionTime: null, |
|
pzImg: null, |
|
batch: null, |
|
inTime: null, |
|
status: null, |
|
}, |
|
fileList1: [], |
|
pId: null, |
|
} |
|
}, |
|
|
|
onLoad: function(options) { |
|
if (options.form) { |
|
let data = JSON.parse(options.form); |
|
this.form = data |
|
this.pId = data.id |
|
this.getVoucherList(); |
|
} |
|
}, |
|
onShow: function() { |
|
this.getList() |
|
|
|
}, |
|
created() { |
|
}, |
|
methods: { |
|
// 图片预览 |
|
showImg(item) { |
|
var urlList = [] |
|
urlList.push(item) |
|
uni.previewImage({ |
|
indicator:"number", |
|
loop:true, |
|
urls: urlList |
|
}) |
|
}, |
|
async getVoucherList() { |
|
const { |
|
data: res |
|
} = await this.$http('/app/voucherList',{pId:this.pId + ''}) |
|
if (res.code) return |
|
for (var i = 0; i < res.data.length; i++) { |
|
this.fileList1.push({ |
|
id: res.data[i].id, |
|
url: this.BASE_URL + res.data[i].img |
|
}) |
|
} |
|
}, |
|
async getList() { |
|
const { |
|
data: res |
|
} = await this.$http('/app/equipList') |
|
if (res.code) return |
|
this.deviceList = res.data |
|
}, |
|
// 取消入库 |
|
async cancelPurchase() { |
|
const { |
|
data: res |
|
} = await this.$http('/app/cancelPurchase/'+this.pId) |
|
if (res.code) return |
|
uni.showToast({ |
|
title: res.msg, |
|
icon: 'success' |
|
}); |
|
wx.switchTab({ |
|
url: 'purchaseList', |
|
}) |
|
}, |
|
|
|
// 确认入库 |
|
async warehousing() { |
|
const { |
|
data: res |
|
} = await this.$http('/app/warehousing/'+this.pId) |
|
if (res.code) return |
|
uni.showToast({ |
|
title: "入库成功!", |
|
icon: 'success' |
|
}); |
|
wx.switchTab({ |
|
url: 'purchaseList', |
|
}) |
|
}, |
|
reset() { |
|
this.form = { |
|
id: null, |
|
equipNo: null, |
|
equipName: null, |
|
price: null, |
|
supplierId: null, |
|
supplierName: null, |
|
num: null, |
|
// 采购日期 |
|
purchaseTime: null, |
|
// 生产日期 |
|
productionTime: null, |
|
pzImg: null, |
|
batch: null, |
|
inTime: null, |
|
} |
|
this.fileList1 = [] |
|
}, |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss"> |
|
.submit { |
|
margin: 1vh 2.667vw; |
|
} |
|
|
|
.add { |
|
background: #f6f6f6; |
|
padding: 2.667vw; |
|
height: 95vh; |
|
|
|
.main { |
|
background: #ffffff; |
|
margin-bottom: 2.667vw; |
|
padding: 2vw; |
|
border-radius: 8px; |
|
|
|
.u-form-item__body__right { |
|
padding-left: 20vw; |
|
} |
|
.c-status { |
|
display: flex; |
|
} |
|
.u-button { |
|
border: none !important; |
|
padding: 0 !important; |
|
justify-content: flex-start; |
|
} |
|
.vvv{ |
|
display: flex; |
|
flex-wrap: wrap; |
|
.u-img { |
|
height: calc(14vh-80px); |
|
|
|
img { |
|
height: 80px; |
|
width: 80px; |
|
margin-right: 5px; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
</style>
|
|
|