Browse Source

出库接口

master
Enzo 5 years ago
parent
commit
9bdfef65c4
  1. 15
      canteen/common/api.js
  2. 4
      canteen/common/uploadFile.js
  3. 34
      canteen/pages/purchase/detail.vue
  4. 3
      canteen/pages/purchase/launch.vue
  5. 2
      canteen/pages/purchase/order.vue
  6. 56
      canteen/pages/purchase/receipt.vue

15
canteen/common/api.js

@ -2,7 +2,8 @@
export const DEV = "dev"; // dev 测试 | prod 正式
export const VERSION = '1.0.0'; // 版本号
// export const DEVURL = 'http://192.168.3.78'; // 测试服请求地址
export const DEVURL = 'http://192.168.3.96'; // 测试服请求地址
export const DEVURL = 'http://fsc.lanzulive.com'; // 测试服请求地址
// export const DEVURL = 'http://192.168.3.96'; // 测试服请求地址
export const PRODURL = ''; // 正式服请求地址
export const API_CANTEEN_LOGIN = '/api/canteen/login'; // 登录
@ -15,4 +16,14 @@ export const API_CANTEEN_WAREHOUSEOUTLIST = '/api/canteen/warehouseOutList'; //
export const API_CANTEEN_PURCHASEDETAIL = '/api/canteen/purchaseDetail'; // 采购单详情
export const API_CANTEEN_SUPPLIERLIST = '/api/canteen/supplierList'; // 供应商列表
export const API_CANTEEN_MATERIALLISTBYWAREHOUSE = '/api/canteen/materialListByWarehouse'; // 仓库物资列表
export const API_CANTEEN_PURCHASEUPDATE = '/api/canteen/purchaseUpdate'; // 改变采购单状态
export const API_CANTEEN_PURCHASEUPDATE = '/api/canteen/purchaseUpdate'; // 改变采购单状态
export const API_SUPPLIER_PURCHASEUPLOADVOUCHER_IMG = '/api/canteen/purchaseUploadVoucher'; // 上传凭证图片
export const API_SUPPLIER_PURCHASEUPLOADVOUCHER = '/api/canteen/purchaseSaveVoucher'; // 保存凭证
export const API_CONFIRM = '/api/canteen/purchaseConfirm'; // 食堂采购详情确认收货
export const API_BUYREUSE= '/api/canteen/purchaseReuse'; // 食堂采购复用订单

4
canteen/common/uploadFile.js

@ -19,7 +19,7 @@ const uploadFile = (filePath, successc, failc, that) => {
if (that.API.DEV == 'prod') {
url = that.API.PRODURL;
}
const url_a = that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER;
const url_a = that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER_IMG;
// 上传图片的目录
var nowTime = formatTime(new Date());
@ -33,7 +33,7 @@ const uploadFile = (filePath, successc, failc, that) => {
filePath: filePath,//要上传文件资源的路径
name: 'image',
header: {
token: uni.getStorageSync('supply_token') // 目前写死供应端
token: uni.getStorageSync('canteen_token') // 目前写死供应端
},
success: function (res) {
console.log('上传文件...', res)

34
canteen/pages/purchase/detail.vue

@ -53,7 +53,7 @@
<!-- 操作按钮 -->
<view class="fixed-bottom" v-if="type != '备货中'">
<view v-if="type == '待发单'" class="lf-row-flex-end">
<button class="btn btn1">编辑</button>
<button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
<button class="btn btn2">立即发单</button>
</view>
<view v-else-if="type == '待接单'" class="lf-row-flex-end">
@ -65,7 +65,7 @@
<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">复用采购单</button>
<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;">已完成</view>
</view>
</view>
@ -95,6 +95,7 @@
</template>
<script>
import { uploadFile } from '@/common/uploadFile.js'
import lfYsteps from '@/components/lf-ysteps/lf-ysteps';
import wybTable from '@/components/wyb-table/wyb-table';
export default {
@ -119,7 +120,8 @@
p_sn: '',
type: 4,
is_show_voucher: false,
voucher_list: []
voucher_list: [],
voucher_count: 6
}
},
onLoad(options){
@ -153,6 +155,7 @@
count: current_count,
complete: result => {
this.voucher_list.push(...result.tempFilePaths);
console.log(this.voucher_list)
}
})
},
@ -181,19 +184,20 @@
Promise.all(http_list).then(res => {
console.log("上传完毕", res);
let images = res.map(item => item.url);
let images = res.map(item => item.path);
console.log(images)
// todo url
// that.$http(that.API.API_SUPPLIER_PURCHASESAVEVOUCHER, {
// p_sn: that.p_sn,
// images: images,
// }).then(result => {
// uni.hideLoading();
// that.voucher_list = [];
// that.$msg('!')
// }).catch(err => uni.hideLoading());
that.$http(that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER, {
p_sn: that.p_sn,
images: images,
}).then(result => {
uni.hideLoading();
that.voucher_list = [];
that.$msg('凭证已上传成功!')
}).catch(err => uni.hideLoading());
}).catch(err => {
console.log(err)
uni.hideLoading();
uni.showModal({
title: '',
@ -215,8 +219,8 @@
return {
name: item.material.m_name,
spec: item.spec.name,
pre_tax_price: {edit: true, value: item.total_tax_amount},
after_tax_price: {edit: true, value: item.total_non_tax_amount},
pre_tax_price: item.total_tax_amount,
after_tax_price: item.total_non_tax_amount,
spec_id: item.spec.id,
material_id: item.material.id
}

3
canteen/pages/purchase/launch.vue

@ -210,6 +210,7 @@
};
return {
m_id: item.material_id,
quotation_item_id: item.item_id,
m_spec_id: item.spec_id,
tax_price: item.tax_price,
non_tax_price: item.non_tax_price,
@ -255,7 +256,7 @@
deadline: deadline
}).then(res => {
console.log("save", res);
this.$msg('操作成功');
this.$msg('操作成功').then(()=>{this.$toBack()});
})
}
}

2
canteen/pages/purchase/order.vue

@ -35,7 +35,7 @@
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">商品种类</view>
<view class="lf-color-black">{{item.items_count}}</view>
<view class="lf-color-black">{{item.cate_number}}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">订单状态</view>

56
canteen/pages/purchase/receipt.vue

@ -2,25 +2,25 @@
<view class="content">
<view class="card" v-for="(item, index) in list" :key="index">
<view class="lf-row-between">
<view class="lf-color-black lf-font-bold">{{ item.title }}</view>
<view class="lf-color-black lf-font-bold" v-if="item.material.m_name">{{ item.material.m_name }}</view>
<!-- 修改功能先隐藏 -->
<!-- <view style="color: #11D189;" @click="showEdit">修改</view> -->
</view>
<view class="lf-row-between lf-m-t-30">
<view>订购数</view>
<view class="lf-color-black">{{ item.orderNum }}</view>
<view class="lf-color-black">{{ item.purchase_number }}</view>
</view>
<view class="lf-row-between lf-m-t-30">
<view>实到数</view>
<view class="lf-flex">
<input class="input" placeholder="0" type="number" :value="item.realNum" @blur="inputBlur(index, 'realNum', $event)" />
<input class="input" placeholder="0" type="number" v-model="item.reachNum" @blur="inputBlur(index, 'real_reach_number', $event)" />
<text class="lf-color-black"></text>
</view>
</view>
<view class="lf-row-between lf-m-t-30">
<view>实收数</view>
<view class="lf-flex">
<input class="input" placeholder="0" type="number" :value="item.receiptsNum" @blur="inputBlur(index, 'receiptsNum', $event)" />
<input class="input" placeholder="0" type="number" v-model="item.receiveNum" @blur="inputBlur(index, 'real_receive_number', $event)" />
<text class="lf-color-black"></text>
</view>
</view>
@ -105,7 +105,13 @@
},{
name: '嘿嘿嘿',
checked: false
}]
}],
p_sn: '',
contents: [],
order: {},
type: 4,
reachNum: 0,
receiveNum: 0
}
},
computed: {
@ -116,20 +122,48 @@
}
}
},
onLoad(){
onLoad(options){
this.p_sn = options.p_sn || '';
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
p_sn: this.p_sn
// p_sn: '802316269455228606'
}).then(res => {
console.log("xxx",res)
this.order = res.data.order;
this.list = res.data.order.items || [];
this.list.forEach(item => {
item.reachNum = item.purchase_number
item.receiveNum = item.purchase_number
})
})
},
inputBlur(current, key, event){
console.log("inputBlur", current, key, event);
this.list[current][key] = event.detail.value;
},
comfirm(){
// 使input
setTimeout(() => {
console.log("comfirm", this.list);
this.$msg('确认收货成功!');
}, 100);
let real_count_item = []
this.list.forEach(item => {
real_count_item.push({
id:item.id,
real_receive_number: item.receiveNum,
real_reach_number: item.reachNum
})
})
this.$http(this.API.API_CONFIRM, {
p_sn: this.p_sn,
state: '已入库',
real_count_item
}).then(res => {
this.$msg('确认收货成功').then(()=>{this.$toBack()});
})
},
switchItem(current){
let current_show = this.current_show;

Loading…
Cancel
Save