Browse Source

[对接] 食堂端页面相关接口

[新增] 全局时间获取方法
[新增] h5端落地页和登录页隐藏返回按钮
master
邓平艺 5 years ago
parent
commit
09b54b53c5
  1. 14
      common/api.js
  2. 13
      common/http.interceptor.js
  3. 26
      common/shared.js
  4. 112
      pages/canteen/delivery/apply.vue
  5. 20
      pages/canteen/delivery/order.vue
  6. 82
      pages/canteen/index/index.vue
  7. 40
      pages/canteen/login/index.vue
  8. 122
      pages/canteen/purchase/launch.vue
  9. 21
      pages/canteen/purchase/order.vue
  10. 21
      pages/supply/gonghuo/order.vue
  11. 6
      pages/supply/index/index.vue
  12. 6
      pages/supply/login/index.vue
  13. 140
      pages/supply/offer/index.vue
  14. 20
      pages/supply/order/index.vue

14
common/api.js

@ -7,7 +7,19 @@ export const PRODURL = ''; // 正式服请求地址
/* 供应商相关接口 */
export const API_SUPPLIER_INDEX = '/api/supplier/index'; // 落地页
export const API_SUPPLIER_LOGIN = '/api/supplier/login'; // 登录
export const API_SUPPLIER_CANTEENLIST = '/api/supplier/canteenList'; // 关联食堂列表
export const API_SUPPLIER_MATERIALLIST = '/api/supplier/materialList'; // 物资列表
export const API_SUPPLIER_QUOTATIONAPPLY = '/api/supplier/quotationApply'; // 申请报价
export const API_SUPPLIER_QUOTATIONORDERLIST = '/api/supplier/quotationOrderList'; // 申请报价-订单列表
export const API_SUPPLIER_PURCHASEORDERLIST = '/api/supplier/purchaseOrderList'; // 供货订单列表
export const API_SUPPLIER_PURCHASEORDERLIST = '/api/supplier/purchaseOrderList'; // 供货订单列表
/* 食堂相关接口 */
export const API_CANTEEN_LOGIN = '/api/canteen/login'; // 登录
export const API_CANTEEN_INDEX = '/api/canteen/index'; // 落地页
export const API_CANTEEN_PURCHASEAPPLY = '/api/canteen/purchaseApply'; // 发起采购
export const API_CANTEEN_MATERIALLIST = '/api/canteen/materialList'; // 物资列表
export const API_CANTEEN_PURCHASEORDERLIST = '/api/canteen/purchaseOrderList'; // 供货订单列表
export const API_CANTEEN_WAREHOUSEOUT = '/api/canteen/warehouseOut'; // 出库申请
export const API_CANTEEN_WAREHOUSEOUTLIST = '/api/canteen/warehouseOutList'; // 出库申请列表
// export const API_CANTEEN_ = '/api/'; //
// export const API_CANTEEN_ = '/api/'; //

13
common/http.interceptor.js

@ -14,14 +14,17 @@ const install = (Vue, vm) => {
loadingTime: 800 // 延迟800毫秒时显示加载框
});
// 请求前拦截, 现在不做拦截
// 请求前拦截
Vue.prototype.$u.http.interceptor.request = config => {
// console.log("config", config, config.url)
// TODO 缺少食堂端config.url判断
if(!config.data.token && config.url != '/api/supplier/login'){
return false;
let release_apis = [
'/api/supplier/login',
'/api/canteen/login'
];
if(!config.data.token && !release_apis.includes(config.url)){
return false; // 拦截,拦截没有token的页面,但不包括登录页的api
}else{
return true;
return true; // 放行
}
};

26
common/shared.js

@ -24,4 +24,28 @@ export function isRight(obj) {
export function isValueType(value) {
let str = Object.prototype.toString.call(value);
return str.match(/\[object (.*?)\]/)[1].toLowerCase();
}
}
// 解析时间戳,参数非必传,不传参时默认显示当前最新日期+时间;
// 第一个参数为当前日期时间戳,第二个日期分隔符,第三个不传参或传all显示日期+时间,传date显示日期,time显示时间
export function recordTime(time = new Date(), separator = "-", swf = 'all'){
let year = time.getFullYear();
let month = time.getMonth() + 1;
let day = time.getDate();
let hour = time.getHours();
let min = time.getMinutes();
let ppn = time.getSeconds();
if(swf === "time"){
return [hour, min, ppn].map(cover).join(":");
}else if(swf === "date"){
return [year, month, day].map(cover).join(String(separator));
}else{
return [year, month, day].map(cover).join(String(separator)) +" "+ [hour, min, ppn].map(cover).join(":");
}
}
// 位数不足2,前面补0
var cover = function(par) {
par = par.toString()[1] ? par : "0" + par;
return par;
};

112
pages/canteen/delivery/apply.vue

@ -3,7 +3,7 @@
<view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box">
<view class="lf-font-28 lf-color-black lf-row-between">
<view>出库清单</view>
<view class="lf-icon" @click="$url('/pages/canteen/classification/index')">
<view class="lf-icon" @click="$url('/pages/canteen/classification/index?type=3')">
<u-icon name="plus-circle" size="42"></u-icon>
</view>
</view>
@ -14,12 +14,12 @@
<!-- 物料table -->
<view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box">
<view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
<wyb-table :headers="headers" contentBgColor="#ecfaf5" :first-line-fixed="true" :contents="contents" @onInputChange="onInputChange" width="100%" height="800rpx"></wyb-table>
<wyb-table :headers="headers" contentBgColor="#ecfaf5" :first-line-fixed="true" :contents="contents" @onInputChange="onInputChange" width="max-content" height="800rpx"></wyb-table>
</view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1">临时保存</button>
<button class="btn btn2">直接申请</button>
<button class="btn btn1" @click="save(1)">临时保存</button>
<button class="btn btn2" @click="save(2)">直接申请</button>
</view>
</view>
</template>
@ -41,81 +41,57 @@
key: 'spec'
},{
label: '税前价',
key: 'preTax'
key: 'pre_tax_price'
},{
label: '税后价',
key: 'afterTax'
key: 'after_tax_price'
}],
contents: [{
name: '黄瓜',
spec: '一打/500g',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
}]
contents: []
}
},
onLoad(){
this.getMaterialList();
},
methods: {
getMaterialList(){
this.$http(this.API.API_CANTEEN_MATERIALLIST, {
// category_id: 1 // id
}).then(res => {
let list = res.data.material || [];
let contents = list.map(item => {
return {
name: item.material.m_name,
spec: item.name,
pre_tax_price: {edit: true, value: item.tax_standard_price},
after_tax_price: {edit: true, value: item.non_tax_standard_price},
spec_id: item.id,
material_id: item.material.id
}
})
this.contents = contents;
})
},
onInputChange(event){
console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue;
},
save(_t){
// todo
console.log("dddddd", this.contents)
let list = this.contents.map(item => {
return {
m_id: item.material_id,
m_spec_id: item.spec_id,
tax_price: item.pre_tax_price.value,
non_tax_price: item.after_tax_price.value
}
});
this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, {
data: list
}).then(res => {
console.log("save", res);
this.$msg('操作成功');
})
}
}
}

20
pages/canteen/delivery/order.vue

@ -7,14 +7,15 @@
:current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box" :scroll-y="true">
<view class="card" v-for="(item, index) in 10" :key="index" @click="$url('/pages/canteen/delivery/detail')">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/canteen/delivery/detail?id='+ item.id)">
<view class="lf-row-between item">
<view class="lf-color-gray">申请人</view>
<view class="lf-color-black">李清玉</view>
<view class="lf-color-black">{{ item.o_name }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">申请时间</view>
<view class="lf-color-black">2021-07-23 17:24:23</view>
<!-- todo 申请时间和种类 -->
<view class="lf-color-black">{{ item.o_sn }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">商品种类</view>
@ -22,12 +23,12 @@
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">订单状态</view>
<view class="quoted-price">等待审核</view>
<view class="quoted-price">{{ item.state }}</view>
</view>
</view>
<view class="loading-more">
<text :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<!-- <lf-nocontent></lf-nocontent> -->
<text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
</view>
</scroll-view>
</swiper-item>
@ -68,8 +69,15 @@
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_CANTEEN_WAREHOUSEOUTLIST).then(res => {
console.log("getData", res);
this.tab_list[this.current].list = res.data.list || [];
});
},
tabsChange(current){
this.current = current;
},

82
pages/canteen/index/index.vue

@ -1,50 +1,26 @@
<template>
<view>
<view class="lf-row-center lf-flex-column head">
<image src="../../../static/logo.png"></image>
<view class="lf-m-t-20 lf-font-32 lf-font-bold lf-color-black">李青云</view>
<view class="lf-font-28 lf-color-555 lf-m-t-10">食堂阿姨</view>
<image :src="canteen.logo"></image>
<view class="lf-m-t-20 lf-font-32 lf-font-bold lf-color-black">{{ canteen.ctl_man }}</view>
<view class="lf-font-28 lf-color-555 lf-m-t-10">{{ canteen.purchase_man }}</view>
</view>
<view class="list">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/canteen/purchase/launch')">
<view class="lf-row-between list-item" hover-class="lf-opacity"
v-for="(item, index) in block_list" :key="index"
@click="$url(item.path)">
<view class="lf-row-center">
<image class="icon-img" src="../../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">发起采购</text>
</view>
<view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/canteen/purchase/order')">
<view class="lf-row-center">
<image class="icon-img" src="../../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">采购记录</text>
</view>
<view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/canteen/delivery/apply')">
<view class="lf-row-center">
<image class="icon-img" src="../../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">申请出库</text>
</view>
<view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/canteen/delivery/order')">
<view class="lf-row-center">
<image class="icon-img" src="../../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">出库记录</text>
<image class="icon-img" :src="item.icon"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">{{ item.name }}</text>
</view>
<view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
<view style="height: 170rpx;"></view>
<view class="btn-bottom exit">
<button class="lf-w-100" @click="$msg('敬请期待...')">退出登录</button>
<button class="lf-w-100" @click="loginOut">退出登录</button>
</view>
</view>
</template>
@ -53,14 +29,41 @@
export default {
data(){
return {
canteen: {},
block_list: []
}
},
onLoad(){
this.getHomeData();
},
onReady(){
// #ifndef MP
var a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
// #endif
},
methods: {
getHomeData(){
this.$http(this.API.API_CANTEEN_INDEX).then(res => {
console.log("getHomeData", res);
this.block_list = res.data.block;
this.canteen = res.data.canteen;
})
},
// 退
loginOut(){
uni.showModal({
title: '温馨提示',
content: '确定退出登录吗?',
confirmColor: '#11D189',
success: result => {
if(result.confirm){
uni.removeStorageSync('canteen_token');
this.$redirectToLogin('您已退出登录, 即将跳转...');
}
}
})
}
}
}
</script>
@ -111,8 +114,11 @@
}
.exit{
padding: 0 32rpx;
bottom: 50rpx;
// bottom: 50rpx;
padding-top: 10rpx;
padding-bottom: 50rpx;
box-sizing: border-box;
background-color: #F6F6F6;
button{
background-color: #f0f0f0;
color: #777777;

40
pages/canteen/login/index.vue

@ -8,13 +8,13 @@
<u-icon name="account-fill"></u-icon>
<text class="lf-m-l-10 lf-font-28 lf-color-333">登录账号</text>
</view>
<input class="input" :adjust-position="false" :auto-blur="true" placeholder="请输入账号" @focus="inputFocus(170)" @blur="is_focus = false" />
<input class="input" v-model="user_key" :adjust-position="false" :auto-blur="true" placeholder="请输入账号" @focus="inputFocus(170)" @blur="inputBlur" />
<!-- 密码 -->
<view class="lf-flex lf-m-b-10 lf-m-t-60">
<u-icon name="lock-fill"></u-icon>
<text class="lf-m-l-10 lf-font-28 lf-color-333">登录密码</text>
</view>
<input class="input" :adjust-position="false" :auto-blur="true" placeholder="请输入密码" :password="true" @focus="inputFocus(220)" @blur="is_focus = false" />
<input class="input" v-model="user_pw" :adjust-position="false" :auto-blur="true" placeholder="请输入密码" :password="true" @focus="inputFocus(220)" @blur="inputBlur" />
</view>
<view>
<!-- 登录按钮 -->
@ -26,18 +26,30 @@
</template>
<script>
let time = null;
export default {
data(){
return {
is_focus: false
is_focus: false,
user_key: '',
user_pw: ''
}
},
onLoad(options){
},
onReady(){
// #ifndef MP
var a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
// #endif
},
methods: {
inputFocus(scrollTop){
this.is_focus = true;
time = setTimeout(() => {
this.is_focus = true;
}, 0); // blur
setTimeout(() => {
uni.pageScrollTo({
scrollTop: scrollTop,
@ -45,8 +57,26 @@
})
}, 200);
},
inputBlur(){
time = setTimeout(() => {
this.is_focus = false;
}, 0); // click
},
login(){
this.$url('/pages/canteen/index/index');
if(!this.user_key){
this.$msg('账号不能为空');
}else if(!this.user_pw){
this.$msg('密码不能为空');
}else{
this.$http(this.API.API_CANTEEN_LOGIN, {
username: this.user_key,
password: this.user_pw
}).then(res => {
console.log("login", res);
uni.setStorageSync('canteen_token', res.data.token);
this.$url('/pages/canteen/index/index');
})
}
}
}
}

122
pages/canteen/purchase/launch.vue

@ -4,7 +4,7 @@
<view class="list">
<view class="lf-row-between">
<view>供应商</view>
<view class="lf-icon" @click="$url('/pages/canteen/classification/index')">
<view class="lf-icon" @click="$url('/pages/canteen/classification/index?type=1')">
<u-icon name="plus-circle" size="42"></u-icon>
</view>
</view>
@ -12,7 +12,7 @@
<view class="list">
<view class="lf-row-between">
<view>采购清单</view>
<view class="lf-icon" @click="$url('/pages/canteen/classification/index')">
<view class="lf-icon" @click="$url('/pages/canteen/classification/index?type=2')">
<u-icon name="plus-circle" size="42"></u-icon>
</view>
</view>
@ -24,19 +24,21 @@
<!-- 收货时间 -->
<view class="lf-row-between lf-p-30 lf-p-l-32 lf-p-r-32 lf-font-28">
<view class="lf-color-black">收货时间</view>
<view class="lf-color-555">2021-07-23</view>
<picker mode="date" :value="date" @change="pickerChange">
<view class="lf-color-555 lf-text-right" style="width: 400rpx;">{{ date }}</view>
</picker>
</view>
<self-line></self-line>
<!-- 物料table -->
<view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box">
<view class="lf-m-b-20 lf-font-32 lf-font-bold">物资明细</view>
<wyb-table :headers="headers" contentBgColor="#ecfaf5" :first-line-fixed="true" :contents="contents" @onInputChange="onInputChange" width="100%" height="800rpx"></wyb-table>
<wyb-table :headers="headers" contentBgColor="#ecfaf5" :first-line-fixed="true" :contents="contents" @onInputChange="onInputChange" width="max-content" height="800rpx"></wyb-table>
</view>
<!-- 操作按钮 -->
<view style="height: 100rpx;"></view>
<view class="fixed-bottom">
<button class="btn btn1">临时保存</button>
<button class="btn btn2">保存并发单</button>
<button class="btn btn1" @click="save(1)">临时保存</button>
<button class="btn btn2" @click="save(2)">保存并发单</button>
</view>
</view>
</template>
@ -58,81 +60,61 @@
key: 'spec'
},{
label: '税前价',
key: 'preTax'
key: 'pre_tax_price'
},{
label: '税后价',
key: 'afterTax'
key: 'after_tax_price'
}],
contents: [{
name: '黄瓜',
spec: '一打/500g',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
}]
contents: [],
date: this.$shared.recordTime(new Date(), '-', 'date')
}
},
onLoad(){
this.getMaterialList();
},
methods: {
getMaterialList(){
this.$http(this.API.API_CANTEEN_MATERIALLIST, {
// category_id: 1 // id
}).then(res => {
let list = res.data.material || [];
let contents = list.map(item => {
return {
name: item.material.m_name,
spec: item.name,
pre_tax_price: {edit: true, value: item.tax_standard_price},
after_tax_price: {edit: true, value: item.non_tax_standard_price},
spec_id: item.id,
material_id: item.material.id
}
})
this.contents = contents;
})
},
onInputChange(event){
console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue;
},
pickerChange(event){
this.date = event.detail.value;
},
save(){
// todo
console.log("dddddd", this.contents)
let list = this.contents.map(item => {
return {
m_id: item.material_id,
m_spec_id: item.spec_id,
tax_price: item.pre_tax_price.value,
non_tax_price: item.after_tax_price.value
}
});
this.$http(this.API.API_CANTEEN_PURCHASEAPPLY, {
data: list
}).then(res => {
console.log("save", res);
this.$msg('操作成功');
})
}
}
}

21
pages/canteen/purchase/order.vue

@ -7,18 +7,18 @@
:current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box" :scroll-y="true">
<view class="card" v-for="(item, index) in 10" :key="index" @click="$url('/pages/canteen/purchase/detail')">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/canteen/purchase/detail?id='+ item.id)">
<view class="lf-row-between item">
<view class="lf-color-gray">采购方</view>
<view class="lf-color-black">广西美味生活食堂有限公司</view>
<view class="lf-color-black">{{ item.contact_name }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">发单时间</view>
<view class="lf-color-black">2021-07-23 17:24:23</view>
<view class="lf-color-black">{{ item.receiving_start }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">送达时间</view>
<view class="lf-color-black">2021-07-23 17:24:23</view>
<view class="lf-color-black">{{ item.receiving_end }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">商品种类</view>
@ -26,12 +26,12 @@
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">订单状态</view>
<view class="quoted-price">等待接单</view>
<view class="quoted-price">{{ item.state }}</view>
</view>
</view>
<view class="loading-more">
<text :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<!-- <lf-nocontent></lf-nocontent> -->
<text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
</view>
</scroll-view>
</swiper-item>
@ -93,8 +93,15 @@
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_CANTEEN_PURCHASEORDERLIST).then(res => {
console.log("getData", res);
this.tab_list[this.current].list = res.data.list || [];
});
},
tabsChange(current){
this.current = current;
},

21
pages/supply/gonghuo/order.vue

@ -7,18 +7,18 @@
:current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box" :scroll-y="true">
<view class="card" v-for="(item, index) in 10" :key="index" @click="$url('/pages/supply/gonghuo/detail')">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/supply/gonghuo/detail?id='+ item.id)">
<view class="lf-row-between item">
<view class="lf-color-gray">采购方</view>
<view class="lf-color-black">广西美味生活食堂有限公司</view>
<view class="lf-color-black">{{ item.contact_name }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">发单时间</view>
<view class="lf-color-black">2021-07-23 17:24:23</view>
<view class="lf-color-black">{{ item.receiving_start }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">送达时间</view>
<view class="lf-color-black">2021-07-23 17:24:23</view>
<view class="lf-color-black">{{ item.receiving_end }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">商品种类</view>
@ -26,12 +26,12 @@
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">订单状态</view>
<view class="quoted-price">等待接单</view>
<view class="quoted-price">{{ item.state }}</view>
</view>
</view>
<view class="loading-more">
<text :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<!-- <lf-nocontent></lf-nocontent> -->
<text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
</view>
</scroll-view>
</swiper-item>
@ -86,8 +86,15 @@
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_SUPPLIER_PURCHASEORDERLIST).then(res => {
console.log("res", res)
this.tab_list[this.current].list = res.data.list || [];
})
},
tabsChange(current){
this.current = current;
},

6
pages/supply/index/index.vue

@ -35,6 +35,12 @@
onLoad(){
this.getData();
},
onReady(){
// #ifndef MP
var a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
// #endif
},
methods: {
// 退
loginOut(){

6
pages/supply/login/index.vue

@ -36,6 +36,12 @@
user_pw: ''
}
},
onReady(){
// #ifndef MP
var a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
// #endif
},
methods: {
inputFocus(scrollTop){
time = setTimeout(() => {

140
pages/supply/offer/index.vue

@ -18,7 +18,7 @@
<view class="mask" :style="{top: node_top +'px'}" v-if="is_show" @click="is_show = false">
<view class="list">
<view class="lf-row-between item" v-for="(item, index) in relation_list" :key="index" @click.stop="selectItem(index)">
<view>{{ item.name }}</view>
<view>{{ item.canteen_name }}</view>
<u-icon name="checkmark-circle" color="#1833F2" size="40" v-if="item.checked"></u-icon>
</view>
</view>
@ -27,12 +27,12 @@
<self-line></self-line>
<!-- 物料table -->
<view class="box">
<wyb-table :first-line-fixed="true" contentBgColor="#eef6fe" :headers="headers" :contents="contents" @onInputChange="onInputChange" width="100%" height="800rpx"></wyb-table>
<wyb-table :first-line-fixed="true" contentBgColor="#eef6fe" :headers="headers" :contents="contents" @onInputChange="onInputChange" width="max-content" height="800rpx"></wyb-table>
</view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1">临时保存</button>
<button class="btn btn2">直接报价</button>
<button class="btn btn1" @click="save(1)">临时保存</button>
<button class="btn btn2" @click="save(2)">直接报价</button>
</view>
</view>
</template>
@ -55,80 +55,14 @@
key: 'spec'
},{
label: '税前价',
key: 'preTax'
key: 'pre_tax_price'
},{
label: '税后价',
key: 'afterTax'
}],
contents: [{
name: '黄瓜',
spec: '一打/500g',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
},{
name: '黄豆',
spec: '5kg',
preTax: {edit: true, value: ''},
afterTax: {edit: true, value: ''}
key: 'after_tax_price'
}],
contents: [],
is_show: false,
relation_list: [{
name: '美妙食堂',
checked: false
},{
name: '合适烧烤',
checked: false
}],
relation_list: [],
node_top: 0
}
},
@ -137,7 +71,7 @@
let arr = [];
this.relation_list.map(item => {
if(item.checked){
arr.push(item.name);
arr.push(item.canteen_name);
}
});
let str = '请选择...';
@ -148,12 +82,13 @@
}
},
onLoad(){
this.getMaterialList();
this.getCanteenList();
},
onReady(){
let that = this;
let info = uni.createSelectorQuery().select(".relation");
      info.boundingClientRect(function(data) {
    info.boundingClientRect(function(data) {
let num = app.globalData.customBarH;
num += data.height;
num += data.top;
@ -161,15 +96,66 @@
   }).exec()
},
methods: {
//
getMaterialList(){
this.$http(this.API.API_SUPPLIER_MATERIALLIST, {
supplier_id: 1
}).then(res => {
let list = res.data.material || [];
let contents = list.map(item => {
return {
name: item.material.m_name,
spec: item.name,
pre_tax_price: {edit: true, value: item.tax_standard_price},
after_tax_price: {edit: true, value: item.non_tax_standard_price},
spec_id: item.id,
material_id: item.material.id
}
})
this.contents = contents;
})
},
//
getCanteenList(){
this.$http(this.API.API_SUPPLIER_CANTEENLIST).then(res => {
let list = res.data.list.map(item => {
item.checked = false;
return item;
})
this.relation_list = list;
})
},
//
onInputChange(event){
console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue;
},
// modal
switchRelation(){
this.is_show = !this.is_show;
},
//
selectItem(index){
this.relation_list[index].checked = !this.relation_list[index].checked;
},
//
save(_t){
// TODO: & & tax_pricenon_tax_price
console.log("dddddd", this.contents)
let list = this.contents.map(item => {
return {
m_id: item.material_id,
m_spec_id: item.spec_id,
tax_price: item.pre_tax_price.value,
non_tax_price: item.after_tax_price.value
}
});
this.$http(this.API.API_SUPPLIER_QUOTATIONAPPLY, {
data: list
}).then(res => {
console.log("save", res);
this.$msg('操作成功');
})
}
}
}

20
pages/supply/order/index.vue

@ -7,19 +7,20 @@
:current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box" :scroll-y="true">
<view class="card" v-for="(item, index) in 16" :key="index" @click="$url('/pages/supply/order/detail')">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/supply/order/detail?id='+ item.id)">
<view class="lf-row-between upper">
<view class="lf-font-28 lf-color-333">订单状态</view>
<view class="order-btn quoted-price">已报价等待审核</view>
<!-- TODO 状态颜色 -->
<view class="order-btn quoted-price">{{ item.state }}</view>
</view>
<view class="lf-row-between lower">
<view>报价单号 327684287343874</view>
<view>2021-7-6 23:24:46</view>
<view>报价单号 {{ item.q_sn }}</view>
<view>{{ item.deadline }}</view>
</view>
</view>
<view class="loading-more">
<text :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<!-- <lf-nocontent></lf-nocontent> -->
<text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
<lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
</view>
</scroll-view>
</swiper-item>
@ -60,8 +61,15 @@
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_SUPPLIER_QUOTATIONORDERLIST).then(res => {
console.log("ssss", res);
this.tab_list[this.current].list = res.data.list;
})
},
tabsChange(current){
this.current = current;
},

Loading…
Cancel
Save