Browse Source

对接接口完成50%,未调式

master
邓平艺 5 years ago
parent
commit
a360f31d40
  1. 2
      App.vue
  2. 14
      common/api.js
  3. 2
      common/http.interceptor.js
  4. 10
      common/http.js
  5. 4
      common/mixin.js
  6. 6
      common/styles/common.css
  7. 71
      common/uploadFile.js
  8. 129
      components/lf-stepbar/lf-stepbar.vue
  9. 3
      main.js
  10. 8
      pages.json
  11. 119
      pages/canteen/classification/index.vue
  12. 327
      pages/canteen/classification/material.vue
  13. 239
      pages/canteen/classification/supplier.vue
  14. 3
      pages/canteen/delivery/apply.vue
  15. 1
      pages/canteen/index/index.vue
  16. 2
      pages/canteen/login/index.vue
  17. 79
      pages/canteen/purchase/detail.vue
  18. 35
      pages/canteen/purchase/launch.vue
  19. 2
      pages/canteen/purchase/order.vue
  20. 189
      pages/supply/gonghuo/detail.vue
  21. 67
      pages/supply/gonghuo/order.vue
  22. 4
      pages/supply/index/index.vue
  23. 2
      pages/supply/login/index.vue
  24. 93
      pages/supply/offer/index.vue
  25. 90
      pages/supply/order/detail.vue
  26. 91
      pages/supply/order/index.vue

2
App.vue

@ -6,6 +6,8 @@
screenHeight: 0, // screenHeight: 0, //
customBarH: 0, // customBarH: 0, //
windowHeight: 0, // - windowHeight: 0, // -
supplier_id: 0, // id
canteen_id: 0, // id
}, },
onLaunch: function() { onLaunch: function() {
this.disableConsole(); this.disableConsole();

14
common/api.js

@ -1,7 +1,8 @@
// appId: 正式 null | 测试 null // appId: 正式 null | 测试 null
export const DEV = "dev"; // dev 测试 | prod 正式 export const DEV = "dev"; // dev 测试 | prod 正式
export const VERSION = '1.0.0'; // 版本号 export const VERSION = '1.0.0'; // 版本号
export const DEVURL = 'http://192.168.3.29'; // 测试服请求地址
export const DEVURL = 'http://192.168.3.78'; // 测试服请求地址
// export const DEVURL = 'http://192.168.3.5'; // 测试服请求地址
export const PRODURL = ''; // 正式服请求地址 export const PRODURL = ''; // 正式服请求地址
/* 供应商相关接口 */ /* 供应商相关接口 */
@ -13,6 +14,13 @@ export const API_SUPPLIER_QUOTATIONAPPLY = '/api/supplier/quotationApply'; //
export const API_SUPPLIER_QUOTATIONORDERLIST = '/api/supplier/quotationOrderList'; // 申请报价-订单列表 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_SUPPLIER_QUOTATIONDETAIL = '/api/supplier/quotationDetail'; // 报价订单详情 export const API_SUPPLIER_QUOTATIONDETAIL = '/api/supplier/quotationDetail'; // 报价订单详情
export const API_SUPPLIER_TEMPORARYQUOTATION = '/api/supplier/temporaryQuotation'; // 报价订单 临时保存
export const API_SUPPLIER_QUOTATIONUPDATE = '/api/supplier/quotationUpdate'; // 改变报价订单状态
export const API_SUPPLIER_PURCHASEORDERACCEPT = '/api/supplier/purchaseOrderAccept'; // 供应商接单
export const API_SUPPLIER_PURCHASEDETAIL = '/api/supplier/purchaseDetail'; // 供货订单详情
export const API_SUPPLIER_PURCHASEORDERSENDOUT = '/api/supplier/purchaseOrderSendout'; // 供应商确认发货
export const API_SUPPLIER_PURCHASEUPLOADVOUCHER = '/api/supplier/purchaseUploadVoucher'; // 上传凭证
export const API_SUPPLIER_PURCHASESAVEVOUCHER = '/api/supplier/purchaseSaveVoucher'; // 保存凭证
/* 食堂相关接口 */ /* 食堂相关接口 */
export const API_CANTEEN_LOGIN = '/api/canteen/login'; // 登录 export const API_CANTEEN_LOGIN = '/api/canteen/login'; // 登录
@ -22,5 +30,5 @@ export const API_CANTEEN_MATERIALLIST = '/api/canteen/materialList'; // 物资
export const API_CANTEEN_PURCHASEORDERLIST = '/api/canteen/purchaseOrderList'; // 供货订单列表 export const API_CANTEEN_PURCHASEORDERLIST = '/api/canteen/purchaseOrderList'; // 供货订单列表
export const API_CANTEEN_WAREHOUSEOUT = '/api/canteen/warehouseOut'; // 出库申请 export const API_CANTEEN_WAREHOUSEOUT = '/api/canteen/warehouseOut'; // 出库申请
export const API_CANTEEN_WAREHOUSEOUTLIST = '/api/canteen/warehouseOutList'; // 出库申请列表 export const API_CANTEEN_WAREHOUSEOUTLIST = '/api/canteen/warehouseOutList'; // 出库申请列表
// export const API_CANTEEN_ = '/api/'; //
// export const API_CANTEEN_ = '/api/'; //
export const API_CANTEEN_PURCHASEDETAIL = '/api/canteen/purchaseDetail'; // 采购单详情
export const API_CANTEEN_SUPPLIERLIST = '/api/canteen/supplierList'; // 供应商列表

2
common/http.interceptor.js

@ -21,7 +21,7 @@ const install = (Vue, vm) => {
'/api/supplier/login', '/api/supplier/login',
'/api/canteen/login' '/api/canteen/login'
]; ];
if(!config.data.token && !release_apis.includes(config.url)){
if(!config.header.token && !release_apis.includes(config.url)){
return false; // 拦截,拦截没有token的页面,但不包括登录页的api return false; // 拦截,拦截没有token的页面,但不包括登录页的api
}else{ }else{
return true; // 放行 return true; // 放行

10
common/http.js

@ -65,13 +65,13 @@ function $http(url, data = {}, options = {}){
// 判断传入用户token // 判断传入用户token
if(that.$getPageType() == 'supply'){ if(that.$getPageType() == 'supply'){
let user_token = uni.getStorageSync('supply_token'); let user_token = uni.getStorageSync('supply_token');
if(user_token && !data.token){
data.token = user_token;
if(user_token && !options.token){
options.token = user_token;
} }
}else if(that.$getPageType() == 'canteen'){ }else if(that.$getPageType() == 'canteen'){
let user_token = uni.getStorageSync('canteen_token'); let user_token = uni.getStorageSync('canteen_token');
if(user_token && !data.token){
data.token = user_token;
if(user_token && !options.token){
options.token = user_token;
} }
} }
@ -94,7 +94,7 @@ function $http(url, data = {}, options = {}){
} }
// 发起请求 // 发起请求
that.$u.post(url, data).then(res => {
that.$u.post(url, data, options).then(res => {
resolve(res); resolve(res);
}).catch(err => { }).catch(err => {
reject(err); reject(err);

4
common/mixin.js

@ -108,9 +108,9 @@ export default{
} }
}, 100); }, 100);
}, },
$toBack(){
$toBack(page = 1){
let pages = getCurrentPages(); // 当前页 let pages = getCurrentPages(); // 当前页
let beforePage = pages[pages.length - 2]; // 上个页面
let beforePage = pages[pages.length - (page + 1)]; // 上个页面
if(beforePage && beforePage.route){ if(beforePage && beforePage.route){
uni.navigateBack(); uni.navigateBack();
}else{ }else{

6
common/styles/common.css

@ -58,6 +58,12 @@
justify-content: right; justify-content: right;
} }
.lf-row-flex-end{
display: flex;
align-items: center;
justify-content: flex-end;
}
.lf-flex-column { .lf-flex-column {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

71
common/uploadFile.js

@ -0,0 +1,71 @@
/*
*上传文件
*@param - filePath :图片的本地资源路径
*@param - dir:表示要传到哪个目录下
*@param - successc:成功回调
*@param - failc:失败回调
*/
const uploadFile = (filePath, successc, failc, that) => {
if (!filePath || filePath.length < 9) {
uni.showModal({
title: '图片错误',
content: '请重试',
showCancel: false,
})
return;
}
// 上传的服务器地址
let url = that.API.DEVURL;
if (that.API.DEV == 'prod') {
url = that.API.PRODURL;
}
const url_a = that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER;
// 上传图片的目录
var nowTime = formatTime(new Date());
// const dir = 'wxmini/images/' + nowTime + '/';
const dir = 'h5/images/' + nowTime + '/';
// 获取上传的文件类型 fileType
let fileTypeIndex = filePath.lastIndexOf('.');
let fileType = filePath.substring(fileTypeIndex);
uni.uploadFile({
url: url + url_a,//开发者服务器 url
filePath: filePath,//要上传文件资源的路径
name: 'image',
header: {
token: uni.getStorageSync('supply_token') // 目前写死供应端
},
success: function (res) {
console.log('上传文件...', res)
if (res.statusCode != 200 || !res.data) {
failc(new Error('上传错误:' + JSON.stringify(res)))
return;
}
let res_data = JSON.parse(res.data);
successc && successc(res_data.data);
},
fail: function (err) {
failc(err);
},
})
}
// 获取当前日期(年-月-日),并不足十位补零
function formatTime(date) {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-')
// + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
uploadFile
};

129
components/lf-stepbar/lf-stepbar.vue

@ -0,0 +1,129 @@
<template>
<view class="content">
<view v-for="(item, index) in list" :key="index"
class="list"
:style="index == list.length - 1 ? 'padding-bottom: 60rpx' : ''">
<view class="left">
<view class="up-line" :class="{'remove-line': index == 0}"
:style="{'border-color': themeColor, 'background-color': themeColor}"></view>
<view class="icon" :style="{
'background-color': index == list.length - 1 && !item.isFinished ? themeColor : '#fff',
'border-color': themeColor,
'color': themeColor}">
<u-icon name="arrow-down" color="#fff" v-if="index == list.length - 1 && !item.isFinished"></u-icon>
<u-icon name="checkmark" v-else></u-icon>
</view>
<view class="down-line" :class="{
'dotted-line': index == list.length - 1 && !item.isFinished,
'remove-line': index == list.length - 1 && item.isFinished
}" :style="{'border-color': themeColor, 'background-color': themeColor}">
</view>
</view>
<view class="right">
<view class="desc">
<text class="lf-line-2">{{ item.action }}</text>
<text class="date">{{ item.created_at }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'lf-step-bar',
props: {
themeColor: {
type: String,
default: '#1833F2'
},
list: {
type: Array,
default(){
return [{
desc: '订单创建',
date: '2021-07-23 13:23:52',
isFinished: false
},{
desc: '订单发货',
date: '2021-07-23 13:23:52',
isFinished: false
},{
desc: '订单发货',
date: '2021-07-23 13:23:52',
isFinished: false
}]
}
}
}
}
</script>
<style lang="scss" scoped="scoped">
.content{
width: 100%;
height: max-content;
padding: 0 32rpx;
}
.list{
display: flex;
align-items: center;
justify-content: space-between;
min-height: 110rpx;
.left{
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
align-items: center;
margin-right: 15rpx;
.up-line,.down-line{
height: 40rpx;
width: 2rpx;
border: 1rpx solid #1833F2;
background-color: #1833F2;
position: relative;
}
.remove-line{
border: none !important;
background-color: transparent !important;
}
.dotted-line::after{
content: '';
position: absolute;
left: -1rpx;
bottom: -40rpx;
height: 40rpx;
width: 0rpx;
border: 1rpx dashed #999999;
}
.icon{
width: 60rpx;
height: 60rpx;
box-sizing: border-box;
border: 2rpx solid #1833F2;
color: #1833F2;
border-radius: 50%;
background-color: #fff;
display: flex;
justify-content: center;
align-content: center;
}
}
.right{
flex: auto;
.desc{
position: relative;
font-size: 28rpx;
color: #222222;
.date{
position: absolute;
bottom: -36rpx;
left: 0;
font-size: 24rpx;
color: #999999;
}
}
}
}
</style>

3
main.js

@ -27,6 +27,9 @@ Vue.component('lf-nocontent', lfNocontent);
// 页面间隙修饰 // 页面间隙修饰
import selfLine from '@/components/self-line/self-line'; import selfLine from '@/components/self-line/self-line';
Vue.component('self-line', selfLine); Vue.component('self-line', selfLine);
// 将步骤条组件注入全局
import lfStepbar from '@/components/lf-stepbar/lf-stepbar';
Vue.component('lf-stepbar', lfStepbar);
const app = new Vue({ const app = new Vue({
...App ...App

8
pages.json

@ -90,11 +90,17 @@
} }
}, },
{ {
"path": "pages/canteen/classification/index",
"path": "pages/canteen/classification/supplier",
"style": { "style": {
"navigationBarTitleText": "添加供应商" "navigationBarTitleText": "添加供应商"
} }
}, },
{
"path": "pages/canteen/classification/material",
"style": {
"navigationBarTitleText": "添加物资"
}
},
{ {
"path": "pages/canteen/delivery/apply", "path": "pages/canteen/delivery/apply",
"style": { "style": {

119
pages/canteen/classification/index.vue

@ -1,119 +0,0 @@
<template>
<view>
<view class="head">
<uni-search-bar @confirm="search" placeholder="搜索供应商" radius="90" bgColor="#f6f6f6" ></uni-search-bar>
</view>
<view class="lf-flex content">
<scroll-view :scroll-y="true" class="scroll-left"
:style="{height: 'calc('+ windowHeight +'px - 222rpx)'}">
<view class="tab-item" :class="{'activa': index == 0}" v-for="(item, index) in 3" :key="index">{{ '分类'+ (item + 1) }}</view>
</scroll-view>
<scroll-view :scroll-y="true" class="scroll-right"
:style="{height: 'calc('+ windowHeight +'px - 222rpx)'}">
<view class="supplier-item" v-for="(item, index) in 20" :key="index">
<label class="lf-row-between">
<view>供应商</view>
<u-icon name="checkmark-circle-fill" size="40" color="#11D189"></u-icon>
</label>
</view>
<view class="loading-more">
<text class="loading-more-text">正在加载中...</text>
</view>
</scroll-view>
</view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1">取消</button>
<button class="btn btn2">确定</button>
</view>
</view>
</template>
<script>
export default {
data(){
return {
windowHeight: 0
}
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
},
methods: {
search(event){
console.log("search.event", event);
}
}
}
</script>
<style lang="scss" scoped="scoped">
/deep/.uni-searchbar__box{
border: none;
}
.head{
padding: 14rpx 16rpx;
}
.scroll-left{
width: 200rpx;
background-color: #F6F6F6;
.tab-item{
height: 90rpx;
width: 100%;
text-align: center;
line-height: 90rpx;
font-size: 28rpx;
color: #555555;
}
.activa{
color: #11D189;
}
}
.scroll-right{
width: 550rpx;
background-color: #FFFFFF;
.supplier-item{
padding: 30rpx 32rpx 30rpx 30rpx;
width: 100%;
height: max-content;
box-sizing: border-box;
border-bottom: 1rpx solid #e5e5e5;
font-size: 28rpx;
color: #222222;
}
}
.fixed-bottom{
position: fixed;
bottom: 0rpx;
left: 0rpx;
z-index: 99;
width: 750rpx;
height: 98rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1rpx solid #E5E5E5;
background-color: #FFFFFF;
box-sizing: border-box;
padding: 0 32rpx;
.btn{
width: 320rpx;
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;
}
}
</style>

327
pages/canteen/classification/material.vue

@ -0,0 +1,327 @@
<template>
<view>
<view class="head" v-if="tab_list.length">
<uni-search-bar @confirm="search" @cancel="cancelSearch" placeholder="搜索物资" radius="90" bgColor="#f6f6f6" ></uni-search-bar>
</view>
<view class="lf-flex content" v-if="tab_list.length">
<scroll-view :scroll-y="true" class="scroll-left"
v-if="!is_search_ing"
:style="{height: 'calc('+ windowHeight +'px - 222rpx)'}">
<view class="tab-item" :class="{'activa': index == current}" v-for="(item, index) in tab_list" :key="index" @click="switchTab(index)">{{ item.m_cate_name }}</view>
</scroll-view>
<scroll-view :scroll-y="true" class="scroll-right"
:style="{height: 'calc('+ windowHeight +'px - 222rpx)', width:is_search_ing?'100%':'550rpx'}">
<view class="supplier-item" v-for="(item, index) in tab_list[current].list" :key="index">
<label class="lf-row-between" @click="switchChecked(item)">
<view style="height: 40rpx;">{{ item.material_name }}</view>
<u-icon name="checkmark-circle-fill" size="40" color="#11D189" v-if="item.checked"></u-icon>
</label>
</view>
<view class="loading-more">
<lf-nocontent v-if="!tab_list[current].list.length"></lf-nocontent>
</view>
</scroll-view>
</view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1" @click="prev">上一步</button>
<button class="btn btn2" @click="submit">确定</button>
</view>
</view>
</template>
<script>
export default {
data(){
return {
windowHeight: 0,
tab_list: [],
current: 0, // tab
material_name: '', //
checked_list: {},
is_search_ing: false, //
request_count: 0, //
}
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
let pages = getCurrentPages();
let prevPage = pages[pages.length - 3]; //
if(!prevPage){
let path_url = '/pages/canteen/index/index';
this.$msg('页面异常, 即将跳转').then(result => {
this.$url(path_url, {type: 'launch'});
})
return;
}
this.checked_list = prevPage.$data.material_list;
/*
this.checked_list = {
"1": {
address: "广西南宁市青秀区青秀万达店",
admin_uid: 1,
area_id: 2165,
checked: true,
city_id: 2163,
corporate_account: "6214456799861234",
corporate_account_name: "刘淑怡粮油店",
corporate_bank: "招商银行",
corporate_bank_sub: "青秀区支行",
corporate_name: "法人",
corporate_phone: "15699896658",
created_at: "2021-07-17 11:34:50",
created_uid: 1,
ctl_man: "刘淑怡",
ctl_phone: "13397706896",
deleted_at: null,
deleted_uid: 0,
id: 1,
license_number: "11559896646",
license_pic: "admin_images/5bbbc1e4f96bc5566c43bb006d36cc37.jpg",
logo: "admin_images/83e16f0d0c9dd01f1bfd62ddf150607e.jpeg",
material_list: {},
private_account: "",
private_account_name: "",
private_bank: "",
private_bank_sub: "",
province_id: 2162,
qualification_pic: "",
remark: "测试备注,我只改个备注",
s_cate_id: 1,
state: "启用",
subject_name: "主体名称",
subject_type: "公司",
supplier_name: "供应商001",
updated_at: "2021-07-17 16:25:58",
updated_uid: 1
},
"2": {
address: "F座6楼",
admin_uid: 3,
area_id: 2165,
checked: true,
city_id: 2163,
corporate_account: "",
corporate_account_name: "",
corporate_bank: "",
corporate_bank_sub: "",
corporate_name: "",
corporate_phone: "",
created_at: "2021-07-17 20:28:17",
created_uid: 1,
ctl_man: "芳芳",
ctl_phone: "13397706896",
deleted_at: null,
deleted_uid: 0,
id: 2,
license_number: "",
license_pic: "",
logo: "admin_images/skyshareimg.jpeg",
material_list: {},
private_account: "",
private_account_name: "",
private_bank: "",
private_bank_sub: "",
province_id: 2162,
qualification_pic: "",
remark: "",
s_cate_id: 2,
state: "启用",
subject_name: "",
subject_type: "公司",
supplier_name: "供应商002",
updated_at: "2021-07-27 12:00:01",
updated_uid: 1
}
};
*/
this.getData();
},
methods: {
//
search(event){
this.is_search_ing = true;
this.material_name = event.value;
this.current = this.tab_list.length; //
this.tab_list.push({m_cate_name: '搜索', list: []});
this.getData({keyword: event.value});
},
//
cancelSearch(){
this.is_search_ing = false;
this.material_name = '';
this.current = 0;
this.tab_list.pop();
},
//
getData(options){
let supplier_ids = Object.keys(this.checked_list);
this.request_count++;
this.$http(this.API.API_CANTEEN_MATERIALLIST, {
supplier_ids: supplier_ids, // id
...options
}).then(res => {
if(this.request_count <= 1){
let category = res.data.category || [];
let tab_list = category.map(item => {
item.list = [];
return item;
})
let list = res.data.material.map(item => {
if(this.checked_list[item.supplier_id]){
item.checked = false;
if(this.checked_list[item.supplier_id].material_list[item.material_id]){
item.checked = true;
}
}else{
item.checked = false;
}
return item;
})
tab_list[this.current].list = list;
this.tab_list = tab_list;
}else{
let list = res.data.material.map(item => {
if(this.checked_list[item.supplier_id]){
item.checked = false;
if(this.checked_list[item.supplier_id].material_list[item.material_id]){
item.checked = true;
}
}else{
item.checked = false;
}
return item;
})
this.tab_list[this.current].list = list;
}
})
},
// tab
switchTab(current){
this.current = current;
let item = this.tab_list[this.current];
if(item && item.list.length <= 0){ //
this.getData({cate_id: item.id});
}
},
//
switchChecked(item){
// item.checked
// let tabItem = this.tab_list[this.current];
// let item = tabItem.list[index];
// item.checked = !item.checked;
// this.tab_list[this.current] = tabItem;
//
item.checked = !item.checked;
if(this.is_search_ing){
this.tab_list.forEach(t_item => {
t_item.list.forEach(l_item => {
if(l_item.material_id == item.material_id){
l_item.checked = item.checked;
}
})
})
}
if(item.checked){
this.checked_list[item.supplier_id].material_list[item.material_id] = item;
}else{
delete this.checked_list[item.supplier_id].material_list[item.material_id];
}
uni.$emit('addMaterialList', this.checked_list);
console.log("checked_list", this.checked_list)
},
//
submit(){
console.log("sssss",this.tab_list);
console.log("kkkk", this.checked_list);
// todo
// this.$url('/pages/canteen/purchase/launch', {type: 'launch'})
// this.$toBack(2); //
},
//
prev(){
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //
this.checked_list = prevPage.$data.checked_list;
uni.$emit('addMaterialList', this.checked_list);
this.$toBack();
}
}
}
</script>
<style lang="scss" scoped="scoped">
/deep/.uni-searchbar__box{
border: none;
}
.head{
padding: 14rpx 16rpx;
}
.scroll-left{
width: 200rpx;
background-color: #F6F6F6;
.tab-item{
height: 90rpx;
width: 100%;
text-align: center;
line-height: 90rpx;
font-size: 28rpx;
color: #555555;
}
.activa{
color: #11D189;
}
}
.scroll-right{
width: 550rpx;
background-color: #FFFFFF;
.supplier-item{
padding: 30rpx 32rpx 30rpx 30rpx;
width: 100%;
height: max-content;
box-sizing: border-box;
border-bottom: 1rpx solid #e5e5e5;
font-size: 28rpx;
color: #222222;
}
}
.fixed-bottom{
position: fixed;
bottom: 0rpx;
left: 0rpx;
z-index: 99;
width: 750rpx;
height: 98rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1rpx solid #E5E5E5;
background-color: #FFFFFF;
box-sizing: border-box;
padding: 0 32rpx;
.btn{
width: 320rpx;
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;
}
}
</style>

239
pages/canteen/classification/supplier.vue

@ -0,0 +1,239 @@
<template>
<view>
<view class="head" v-if="tab_list.length">
<uni-search-bar @confirm="search" @cancel="cancelSearch" placeholder="搜索供应商" radius="90" bgColor="#f6f6f6" ></uni-search-bar>
</view>
<view class="lf-flex content" v-if="tab_list.length">
<scroll-view :scroll-y="true" class="scroll-left"
v-if="!is_search_ing"
:style="{height: 'calc('+ windowHeight +'px - 222rpx)'}">
<view class="tab-item" :class="{'activa': index == current}" v-for="(item, index) in tab_list" :key="index" @click="switchTab(index)">{{ item.c_cate_name }}</view>
</scroll-view>
<scroll-view :scroll-y="true" class="scroll-right"
:style="{height: 'calc('+ windowHeight +'px - 222rpx)', width:is_search_ing?'100%':'550rpx'}">
<view class="supplier-item" v-for="(item, index) in tab_list[current].list" :key="index">
<label class="lf-row-between" @click="switchChecked(item)">
<view style="height: 40rpx;">{{ item.supplier_name }}</view>
<u-icon name="checkmark-circle-fill" size="40" color="#11D189" v-if="item.checked"></u-icon>
</label>
</view>
<view class="loading-more">
<lf-nocontent v-if="!tab_list[current].list.length"></lf-nocontent>
</view>
</scroll-view>
</view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1" @click="cancel">取消</button>
<button class="btn btn2" @click="next">下一步</button>
</view>
</view>
</template>
<script>
let app = getApp();
export default {
data(){
return {
windowHeight: 0,
tab_list: [],
checked_list: {},
current: 0, // tab
supplier_name: '', //
is_search_ing: false, //
request_count: 0, //
show_count: 0, //
}
},
onLoad(){
this.windowHeight = uni.getSystemInfoSync().windowHeight;
},
onShow(){
this.show_count++;
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //
if(!prevPage){
let path_url = '/pages/canteen/index/index';
this.$msg('页面异常, 即将跳转').then(result => {
this.$url(path_url, {type: 'launch'});
})
return;
}
this.checked_list = prevPage.$data.material_list;
if(this.show_count <= 1){
this.getData();
}
},
methods: {
//
search(event){
this.is_search_ing = true;
this.supplier_name = event.value;
this.current = this.tab_list.length; //
this.tab_list.push({c_cate_name: '搜索', list: []});
this.getData({supplier_name: event.value});
},
//
cancelSearch(){
this.is_search_ing = false;
this.supplier_name = '';
this.current = 0;
this.tab_list.pop();
},
//
getData(options){
// let requestData = {
// canteen_id: 6, // todo
// ...options
// }
this.request_count++;
this.$http(this.API.API_CANTEEN_SUPPLIERLIST, {
...options
}).then(res => {
if(this.request_count <= 1){
let category = res.data.category || [];
let tab_list = category.map(item => {
item.list = [];
return item;
})
let list = res.data.list.map(item => {
if(this.checked_list[item.id]){
item.checked = true;
}else{
item.checked = false;
}
return item;
})
tab_list[this.current].list = list;
this.tab_list = tab_list;
}else{
let list = res.data.list.map(item => {
if(this.checked_list[item.id]){
item.checked = true;
}else{
item.checked = false;
}
return item;
})
this.tab_list[this.current].list = list;
}
})
},
// tab
switchTab(current){
this.current = current;
let item = this.tab_list[this.current];
if(item && item.list.length <= 0){ //
this.getData({s_cate_id: item.id});
}
},
//
switchChecked(item){
item.checked = !item.checked;
// [tablist]
if(this.is_search_ing){
this.tab_list.forEach(t_item => {
t_item.list.forEach(l_item => {
if(l_item.id == item.id){
l_item.checked = item.checked;
}
})
})
}
if(item.checked){
item.material_list = {}; //
this.checked_list[item.id] = item;
}else{
delete this.checked_list[item.id];
}
uni.$emit('addMaterialList', this.checked_list);
console.log("checked_list", this.checked_list)
},
//
cancel(){
this.checked_list = {};
uni.$emit('addMaterialList', this.checked_list);
this.$toBack();
},
//
next(){
this.$url('/pages/canteen/classification/material');
}
}
}
</script>
<style lang="scss" scoped="scoped">
/deep/.uni-searchbar__box{
border: none;
}
.head{
padding: 14rpx 16rpx;
}
.scroll-left{
width: 200rpx;
background-color: #F6F6F6;
.tab-item{
height: 90rpx;
width: 100%;
text-align: center;
line-height: 90rpx;
font-size: 28rpx;
color: #555555;
}
.activa{
color: #11D189;
}
}
.scroll-right{
width: 550rpx;
background-color: #FFFFFF;
.supplier-item{
padding: 30rpx 32rpx 30rpx 30rpx;
width: 100%;
height: max-content;
box-sizing: border-box;
border-bottom: 1rpx solid #e5e5e5;
font-size: 28rpx;
color: #222222;
}
}
.fixed-bottom{
position: fixed;
bottom: 0rpx;
left: 0rpx;
z-index: 99;
width: 750rpx;
height: 98rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1rpx solid #E5E5E5;
background-color: #FFFFFF;
box-sizing: border-box;
padding: 0 32rpx;
.btn{
width: 320rpx;
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;
}
}
</style>

3
pages/canteen/delivery/apply.vue

@ -3,7 +3,8 @@
<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-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 class="lf-font-28 lf-color-black lf-row-between">
<view>出库清单</view> <view>出库清单</view>
<view class="lf-icon" @click="$url('/pages/canteen/classification/index?type=3')">
<!-- <view class="lf-icon" @click="$url('/pages/canteen/classification/index?type=3')"> -->
<view class="lf-icon" @click="$url('')">
<u-icon name="plus-circle" size="42"></u-icon> <u-icon name="plus-circle" size="42"></u-icon>
</view> </view>
</view> </view>

1
pages/canteen/index/index.vue

@ -48,6 +48,7 @@
console.log("getHomeData", res); console.log("getHomeData", res);
this.block_list = res.data.block; this.block_list = res.data.block;
this.canteen = res.data.canteen; this.canteen = res.data.canteen;
getApp().globalData.canteen_id = res.data.canteen.id;
}) })
}, },
// 退 // 退

2
pages/canteen/login/index.vue

@ -74,7 +74,7 @@
}).then(res => { }).then(res => {
console.log("login", res); console.log("login", res);
uni.setStorageSync('canteen_token', res.data.token); uni.setStorageSync('canteen_token', res.data.token);
this.$url('/pages/canteen/index/index');
this.$url('/pages/canteen/index/index', {tyep: 'redirect'});
}) })
} }
} }

79
pages/canteen/purchase/detail.vue

@ -2,7 +2,7 @@
<view> <view>
<view class="head"> <view class="head">
<view class="lf-row-between lf-color-gray list"> <view class="lf-row-between lf-color-gray list">
<view>采购单 492461046128742764</view>
<view>采购单 {{ order.p_sn }}</view>
</view> </view>
<view class="lf-row-between list"> <view class="lf-row-between list">
<image src="../../../static/logo.png" class="image"></image> <image src="../../../static/logo.png" class="image"></image>
@ -28,7 +28,7 @@
</view> </view>
<view class="lf-row-between list"> <view class="lf-row-between list">
<view>联系电话</view> <view>联系电话</view>
<view class="lf-font-bold">13200000000</view>
<view class="lf-font-bold">{{ order.contact_phone }}</view>
</view> </view>
<view class="list"> <view class="list">
<view>证明材料</view> <view>证明材料</view>
@ -40,7 +40,7 @@
<self-line></self-line> <self-line></self-line>
<view class="lf-m-t-30 lf-m-l-32"> <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> <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" @onButtonClick="onButtonClick" width="100%" height="350rpx"></wyb-table>
<wyb-table :first-line-fixed="true" contentBgColor="#ecfaf5" :headers="headers" :contents="contents" @onButtonClick="onButtonClick" width="max-content" height="350rpx"></wyb-table>
</view> </view>
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
@ -90,55 +90,46 @@
], ],
headers: [{ headers: [{
key: 'name', key: 'name',
label: '名'
label: '名'
},{ },{
key: 'age',
label: '年龄'
key: 'spec',
label: '规格'
},{ },{
key: 'sex',
label: '性别'
key: 'pre_tax_price',
label: '税前价格'
},{ },{
key: 'height',
label: '身高'
},{
key: 'info',
label: '描述'
},{
key: 'operation',
label: '操作'
key: 'after_tax_price',
label: '税后价格'
}], }],
contents: [{
name: '张三',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是',
operation: {button: true, key: 'delete', value: '删除'}
}, {
name: '李四',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是'
}, {
name: '赵五',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是'
},{
name: '王六',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是'
}]
contents: [],
order: {}
} }
}, },
onLoad(){
onLoad(options){
this.getData(options.p_sn);
}, },
methods: { methods: {
getData(p_sn){
this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, {
p_sn: p_sn
// p_sn: '802316269455228606'
}).then(res => {
console.log("xxx",res)
this.order = res.data.order;
let list = res.data.order.sheet || [];
let contents = list.map(item => {
return {
name: item.material.m_name,
spec: item.spec.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.spec.id,
material_id: item.material.id
}
})
this.contents = contents;
})
},
onButtonClick(event){ onButtonClick(event){
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',

35
pages/canteen/purchase/launch.vue

@ -4,7 +4,7 @@
<view class="list"> <view class="list">
<view class="lf-row-between"> <view class="lf-row-between">
<view>供应商</view> <view>供应商</view>
<view class="lf-icon" @click="$url('/pages/canteen/classification/index?type=1')">
<view class="lf-icon" @click="$url('/pages/canteen/classification/supplier')">
<u-icon name="plus-circle" size="42"></u-icon> <u-icon name="plus-circle" size="42"></u-icon>
</view> </view>
</view> </view>
@ -31,8 +31,15 @@
<self-line></self-line> <self-line></self-line>
<!-- 物料table --> <!-- 物料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-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="max-content" height="800rpx"></wyb-table>
<view class="lf-font-32 lf-font-bold">物资明细</view>
<!-- 多个供应商多个table :headers="headers" :contents="contents" -->
<view v-for="(item,index) in 2" class="lf-m-t-20">
<view class="lf-m-b-10 lf-row-between">
<text>我是供应商</text>
<text>删除</text>
</view>
<wyb-table contentBgColor="#ecfaf5" :first-line-fixed="true" @onInputChange="onInputChange" width="max-content" height="800rpx"></wyb-table>
</view>
</view> </view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
@ -66,13 +73,22 @@
key: 'after_tax_price' key: 'after_tax_price'
}], }],
contents: [], contents: [],
date: this.$shared.recordTime(new Date(), '-', 'date')
date: this.$shared.recordTime(new Date(), '-', 'date'), //
material_list: {} //
} }
}, },
onLoad(){ onLoad(){
this.getMaterialList();
// MaterialList
uni.$on('addMaterialList', res => {
this.material_list = res;
})
},
onShow(){
console.log("material_list", this.material_list)
}, },
methods: { methods: {
//
getMaterialList(){ getMaterialList(){
this.$http(this.API.API_CANTEEN_MATERIALLIST, { this.$http(this.API.API_CANTEEN_MATERIALLIST, {
// category_id: 1 // id // category_id: 1 // id
@ -91,16 +107,23 @@
this.contents = contents; this.contents = contents;
}) })
}, },
// table-input todo
onInputChange(event){ onInputChange(event){
console.log("检测到table input被更改", event); console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue;
// this.contents[event.contentIndex][event.key].value = event.detailValue;
}, },
//
pickerChange(event){ pickerChange(event){
this.date = event.detail.value; this.date = event.detail.value;
}, },
//
save(){ save(){
// todo // todo
console.log("dddddd", this.contents) console.log("dddddd", this.contents)
return;
let list = this.contents.map(item => { let list = this.contents.map(item => {
return { return {
m_id: item.material_id, m_id: item.material_id,

2
pages/canteen/purchase/order.vue

@ -7,7 +7,7 @@
:current="current" @change="swiperChange"> :current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"> <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"> <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 tabItem.list" :key="item.id" @click="$url('/pages/canteen/purchase/detail?id='+ item.id)">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/canteen/purchase/detail?p_sn='+ item.p_sn)">
<view class="lf-row-between item"> <view class="lf-row-between item">
<view class="lf-color-gray">采购方</view> <view class="lf-color-gray">采购方</view>
<view class="lf-color-black">{{ item.contact_name }}</view> <view class="lf-color-black">{{ item.contact_name }}</view>

189
pages/supply/gonghuo/detail.vue

@ -2,32 +2,43 @@
<view> <view>
<view class="head"> <view class="head">
<view class="lf-row-between lf-color-gray list"> <view class="lf-row-between lf-color-gray list">
<view>采购单 492461046128742764</view>
<view>采购单 {{ order.p_sn }}</view>
</view> </view>
<view class="lf-row-between list">
<image src="../../../static/logo.png" class="image"></image>
<view class="lf-row-between list" v-if="order.canteen">
<image :src="order.canteen.logo" class="image"></image>
<view class="info"> <view class="info">
<view class="lf-font-32 lf-color-black lf-font-bold">广西美味生活有限公司</view>
<view class="lf-font-24 lf-color-555">广西南宁青秀区民族大道118号可爱大厦A座0930室</view>
<view class="lf-font-32 lf-color-black lf-font-bold">{{ order.canteen.canteen_name }}</view>
<view class="lf-font-24 lf-color-555">{{ order.canteen.address }}</view>
</view> </view>
</view> </view>
</view> </view>
<self-line></self-line> <self-line></self-line>
<view class="lf-p-l-32 lf-p-r-32 lf-border-box lf-bg-white">
<lf-ysteps :stepList="stepList"></lf-ysteps>
<view class="lf-border-box lf-bg-white">
<lf-stepbar :list="stepList"></lf-stepbar>
</view> </view>
<self-line></self-line> <self-line></self-line>
<view class="lf-m-t-30 lf-m-l-32"> <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> <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view>
<wyb-table :first-line-fixed="true" contentBgColor="#eef6fe" :headers="headers" :contents="contents" @onButtonClick="onButtonClick" width="100%" height="350rpx"></wyb-table>
<wyb-table v-if="contents.length" :first-line-fixed="true" contentBgColor="#eef6fe" :headers="headers" :contents="contents" @onButtonClick="onButtonClick" width="max-content" height="350rpx"></wyb-table>
</view> </view>
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view class="fixed-bottom"> <view class="fixed-bottom">
<button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
<button class="btn btn2">确认发货</button>
<view v-if="type == 1" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #1833F2;" @click="orderTaking">立即接单</button>
</view>
<view v-if="type == 2" class="lf-row-flex-end">
<button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
<button class="btn btn2" @click="confirmDeliver">确认发货</button>
</view>
<view v-if="type == 3" class="lf-row-flex-end">
<view class="lf-font-32" style="color: #11D189;">已完成</view>
</view>
<view v-if="type == 4" class="lf-row-flex-end">
<view class="lf-font-32" style="color: #222222;">已退单</view>
</view>
</view> </view>
<!-- 弹出层-上传凭证 --> <!-- 弹出层-上传凭证 -->
<u-popup v-model="is_show_voucher" mode="center" border-radius="20"> <u-popup v-model="is_show_voucher" mode="center" border-radius="20">
@ -55,89 +66,63 @@
</template> </template>
<script> <script>
import { uploadFile } from '@/common/uploadFile.js'
import lfYsteps from '@/components/lf-ysteps/lf-ysteps'; import lfYsteps from '@/components/lf-ysteps/lf-ysteps';
import wybTable from '@/components/wyb-table/wyb-table'; import wybTable from '@/components/wyb-table/wyb-table';
export default { export default {
components: { lfYsteps, wybTable }, components: { lfYsteps, wybTable },
data(){ data(){
return { return {
stepList: [
{
time: '2021-07-23 13:23:52', // --
info: '订单创建', // --
isFinished: true, // index --
isActive: false, // Active 使 index --
isShowSlot: false // Slot --
},
{
time: '2021-07-23 13:23:52',
info: '采购订单发起,等待供应商接单',
isFinished: false,
isActive: true,
isShowSlot: true
},
{
time: '2021-07-23 13:23:52',
info: '供应商已接单,正在装车',
isFinished: false,
isActive: true,
isShowSlot: true
}
],
stepList: [],
headers: [{ headers: [{
key: 'name',
label: '姓名'
},{
key: 'age',
label: '年龄'
},{
key: 'sex',
label: '性别'
},{
key: 'height',
label: '身高'
},{
key: 'info',
label: '描述'
},{
key: 'operation',
label: '操作'
}],
contents: [{
name: '张三',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是',
operation: {button: true, key: 'delete', value: '删除'}
}, {
name: '李四',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是'
}, {
name: '赵五',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是'
},{
name: '王六',
age: '18',
sex: '男',
height: '192cm',
info: '无敌叫是'
}],
is_show_voucher: false, //
label: '菜品名称',
key: 'name'
},{
label: '规格',
key: 'spec'
},{
label: '税前价',
key: 'pre_tax_price'
},{
label: '税后价',
key: 'after_tax_price'
}],
contents: [],
is_show_voucher: true, //
voucher_list: [], // voucher_list: [], //
voucher_count: 6 //
voucher_count: 6, //
type: 2, //
p_sn: '',
order: {}
} }
}, },
onLoad(){
onLoad(options){
this.p_sn = options.p_sn;
this.getData();
}, },
methods: { methods: {
getData(){
this.$http(this.API.API_SUPPLIER_PURCHASEDETAIL, {
p_sn: this.p_sn
}).then(res => {
console.log("getData", res);
let order = res.data.order || {};
this.order = order;
this.stepList = order.state_log.map((item, index) => {
item.isFinished = false;
if(index == order.state_log.length - 1){
if(item.action == '订单已完成' || item.action == '订单已退款'){
item.isFinished = true;
}
}
return item;
})
// todo contents
});
},
// table // table
onButtonClick(event){ onButtonClick(event){
uni.showModal({ uni.showModal({
@ -191,19 +176,24 @@
let http_list = []; let http_list = [];
voucher_list.map(item => { voucher_list.map(item => {
let itemP = new Promise((resolve, reject) => { let itemP = new Promise((resolve, reject) => {
that.$http(that.API.XXXX, {url: item})
.then(res => resolve(res))
.catch(err => reject(err));
uploadFile(item, (res) => {
resolve(res);
}, (err) => {
reject(err);
}, this);
}) })
http_list.push(itemP); http_list.push(itemP);
}) })
// todo
Promise.all(http_list).then(res => { Promise.all(http_list).then(res => {
console.log("上传完毕", res); console.log("上传完毕", res);
// resres.data.images
that.$http(that.API.XXXX, {urls: res}).then(result => {
let images = res.map(item => item.url);
that.$http(that.API.API_SUPPLIER_PURCHASESAVEVOUCHER, {
p_sn: that.p_sn,
images: images,
}).then(result => {
uni.hideLoading(); uni.hideLoading();
that.voucher_list = [];
that.$msg('凭证已上传成功!') that.$msg('凭证已上传成功!')
}).catch(err => uni.hideLoading()); }).catch(err => uni.hideLoading());
@ -216,6 +206,24 @@
confirmColor: '#1833F2' confirmColor: '#1833F2'
}) })
}) })
},
//
orderTaking(){
this.$http(this.API.API_SUPPLIER_PURCHASEORDERACCEPT, {
p_sn: this.p_sn
}).then(res => {
console.log("orderTaking", res);
this.$msg('接单成功')
});
},
//
confirmDeliver(){
this.$http(this.API.API_SUPPLIER_PURCHASEORDERSENDOUT, {
p_sn: this.p_sn
}).then(res => {
console.log("confirmDeliver", res);
this.$msg('确认收货成功')
});
} }
} }
} }
@ -257,7 +265,7 @@
width: 750rpx; width: 750rpx;
height: 98rpx; height: 98rpx;
display: flex; display: flex;
justify-content: flex-end;
// justify-content: flex-end;
align-items: center; align-items: center;
border-top: 1rpx solid #E5E5E5; border-top: 1rpx solid #E5E5E5;
background-color: #FFFFFF; background-color: #FFFFFF;
@ -284,6 +292,9 @@
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
.fixed-bottom>view{
width: 100%;
}
.popup-box{ .popup-box{
width: 686rpx; width: 686rpx;
// height: 727rpx; // height: 727rpx;

67
pages/supply/gonghuo/order.vue

@ -6,8 +6,13 @@
<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}" <swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}"
:current="current" @change="swiperChange"> :current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"> <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 tabItem.list" :key="item.id" @click="$url('/pages/supply/gonghuo/detail?id='+ item.id)">
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box"
:scroll-y="true" :refresher-enabled="true"
refresher-background="#f6f6f6"
@scrolltolower="scrolltolower"
:refresher-triggered="tabItem.isRefresher"
@refresherrefresh="onRefresherrefresh">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/supply/gonghuo/detail?p_sn='+ item.p_sn)">
<view class="lf-row-between item"> <view class="lf-row-between item">
<view class="lf-color-gray">采购方</view> <view class="lf-color-gray">采购方</view>
<view class="lf-color-black">{{ item.contact_name }}</view> <view class="lf-color-black">{{ item.contact_name }}</view>
@ -50,6 +55,7 @@
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
state_name: '',
list: [] list: []
},{ },{
name: '待接单', name: '待接单',
@ -57,6 +63,7 @@
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
state_name: '待接单',
list: [] list: []
},{ },{
name: '待发货', name: '待发货',
@ -64,6 +71,7 @@
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
state_name: '待发货',
list: [] list: []
},{ },{
name: '已完成', name: '已完成',
@ -71,6 +79,7 @@
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
state_name: '已完成',
list: [] list: []
},{ },{
name: '已退单', name: '已退单',
@ -78,6 +87,7 @@
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
state_name: '已退单',
list: [] list: []
}], }],
page_size: 10, page_size: 10,
@ -89,17 +99,62 @@
this.getData(); this.getData();
}, },
methods: { methods: {
getData(){
this.$http(this.API.API_SUPPLIER_PURCHASEORDERLIST).then(res => {
console.log("res", res)
this.tab_list[this.current].list = res.data.list || [];
getData(options){
let item = this.tab_list[this.current];
this.$http(this.API.API_SUPPLIER_PURCHASEORDERLIST, {
state: item.state_name,
page: item.page,
page_size: this.page_size
}).then(res => {
console.log("res", res);
if(options && options.refresh){
item.isRefresher = false;
}
// item.isPage = res.isPage; //
if(!item.isPage){
item.loading_class = false;
item.loading_text = '已加载全部数据~'
}
if(item.page == 1){
item.list = res.data.list;
}else{
item.list.push(...res.data.list);
}
}) })
}, },
tabsChange(current){ tabsChange(current){
this.current = current; this.current = current;
if(this.tab_list[this.current].list.length <= 0){
this.getData();
}
}, },
swiperChange(event){ swiperChange(event){
this.current = event.detail.current; this.current = event.detail.current;
if(event.detail.source == '') return; //
if(this.tab_list[this.current].list.length <= 0){
this.getData();
}
},
//
scrolltolower(){
let item = this.tab_list[this.current];
if(item.isPage){
item.page++;
this.getData();
}
},
//
onRefresherrefresh(){
this.$u.throttle(() => {
let item = this.tab_list[this.current];
item.isRefresher = true;
item.page = 1;
item.isPage = true;
item.loading_class = true;
item.loading_text = '正在加载中...';
item.list = [];
this.getData({refresh: true});
}, 200);
} }
} }
} }

4
pages/supply/index/index.vue

@ -38,7 +38,7 @@
onReady(){ onReady(){
// #ifndef MP // #ifndef MP
var a = document.getElementsByClassName('uni-page-head-hd')[0]; var a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
a.style.display = 'none'; //
// #endif // #endif
}, },
methods: { methods: {
@ -59,9 +59,9 @@
// //
getData(){ getData(){
this.$http(this.API.API_SUPPLIER_INDEX).then(res => { this.$http(this.API.API_SUPPLIER_INDEX).then(res => {
console.log("data", res);
this.supplier = res.data.supplier; this.supplier = res.data.supplier;
this.block_list = res.data.block; this.block_list = res.data.block;
getApp().globalData.supplier_id = res.data.supplier.id;
}); });
} }
} }

2
pages/supply/login/index.vue

@ -71,7 +71,7 @@
}).then(res => { }).then(res => {
console.log("login", res); console.log("login", res);
uni.setStorageSync('supply_token', res.data.token); uni.setStorageSync('supply_token', res.data.token);
this.$url('/pages/supply/index/index');
this.$url('/pages/supply/index/index', {tyep: 'redirect'});
}) })
} }
} }

93
pages/supply/offer/index.vue

@ -31,8 +31,8 @@
</view> </view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view class="fixed-bottom"> <view class="fixed-bottom">
<button class="btn btn1" @click="save(1)">临时保存</button>
<button class="btn btn2" @click="save(2)">直接报价</button>
<button class="btn btn1" @click="save(0)">临时保存</button>
<button class="btn btn2" @click="save(1)">直接报价</button>
</view> </view>
</view> </view>
</template> </template>
@ -63,7 +63,8 @@
contents: [], contents: [],
is_show: false, is_show: false,
relation_list: [], relation_list: [],
node_top: 0
node_top: 0,
q_sn: '' //
} }
}, },
computed: { computed: {
@ -81,9 +82,11 @@
return str; return str;
} }
}, },
onLoad(){
onLoad(options){
this.q_sn = options.q_sn || '';
// todo
this.getMaterialList(); this.getMaterialList();
this.getCanteenList();
// this.getCanteenList();
}, },
onReady(){ onReady(){
let that = this; let that = this;
@ -98,28 +101,53 @@
methods: { methods: {
// //
getMaterialList(){ getMaterialList(){
this.$http(this.API.API_SUPPLIER_MATERIALLIST, {
supplier_id: 1
this.$http(this.API.API_SUPPLIER_TEMPORARYQUOTATION, {
supplier_id: getApp().globalData.supplier_id,
// q_sn: this.q_sn //
}).then(res => { }).then(res => {
let list = res.data.material || [];
let list = res.data.order || [];
let contents = list.map(item => { let contents = list.map(item => {
return {
name: item.material.m_name,
let obj = {
name: item.material?.m_name,
material_id: item.material?.id,
spec: item.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, spec_id: item.id,
material_id: item.material.id
pre_tax_price: {edit: true, value: ''},
after_tax_price: {edit: true, value: ''}
} }
})
if(item.quotation && Object.keys(item.quotation).length){
obj.pre_tax_price.value = item.quotation.tax_price;
obj.after_tax_price.value = item.quotation.non_tax_price;
}
return obj;
});
this.contents = contents; this.contents = contents;
this.getCanteenList(res.data.canteen || []);
// let list = res.data.material || [];
// let contents = list.map(item => {
// console.log("item", 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(){
getCanteenList(canteen){
this.$http(this.API.API_SUPPLIER_CANTEENLIST).then(res => { this.$http(this.API.API_SUPPLIER_CANTEENLIST).then(res => {
let list = res.data.list.map(item => { let list = res.data.list.map(item => {
item.checked = false; item.checked = false;
canteen.map(ct => {
if(ct == item.id){
item.checked = true;
}
})
return item; return item;
}) })
this.relation_list = list; this.relation_list = list;
@ -127,7 +155,6 @@
}, },
// //
onInputChange(event){ onInputChange(event){
console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue; this.contents[event.contentIndex][event.key].value = event.detailValue;
}, },
// modal // modal
@ -140,18 +167,34 @@
}, },
// //
save(_t){ 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
//
let list = [];
this.contents.map(item => {
if(item.pre_tax_price.value || item.after_tax_price.value){
list.push({
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
})
} }
}); });
//
let canteen_ids = [];
this.relation_list.map(item => {
if(item.checked){
canteen_ids.push(item.id);
}
})
if(canteen_ids.length <= 0){
return this.$msg('您未选择关联食堂哦')
}
//
let state = ['待发单', '待审核'][_t];
this.$http(this.API.API_SUPPLIER_QUOTATIONAPPLY, { this.$http(this.API.API_SUPPLIER_QUOTATIONAPPLY, {
data: list
data: list,
state: state,
canteen_ids: canteen_ids
}).then(res => { }).then(res => {
console.log("save", res); console.log("save", res);
this.$msg('操作成功'); this.$msg('操作成功');

90
pages/supply/order/detail.vue

@ -7,7 +7,7 @@
</view> </view>
<view class="lf-row-between list"> <view class="lf-row-between list">
<view>订单状态</view> <view>订单状态</view>
<view class="quoted-price">{{ order.state }}</view>
<view :class="stateClass(order.state)">{{ order.state }}</view>
</view> </view>
<view class="lf-row-between list"> <view class="lf-row-between list">
<view>报价商</view> <view>报价商</view>
@ -17,14 +17,23 @@
<self-line></self-line> <self-line></self-line>
<view class="lf-m-t-30 lf-m-l-32"> <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> <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">报价明细</view>
<!-- TODO 表格对接 -->
<wyb-table :first-line-fixed="true" contentBgColor="#eef6fe" width="100%" height="350rpx"></wyb-table>
<wyb-table :headers="headers" :contents="contents" :first-line-fixed="true" contentBgColor="#eef6fe" width="max-content" height="350rpx"></wyb-table>
</view> </view>
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view class="fixed-bottom"> <view class="fixed-bottom">
<button class="btn btn1">编辑</button>
<button class="btn btn2">发起报价</button>
<view v-if="type == 1" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #FF0000;" @click="revokeOrder">撤销订单</button>
</view>
<view v-if="type == 2" class="lf-row-flex-end">
<button class="btn btn1" @click="$url('/pages/supply/offer/index?q_sn='+ order.q_sn)">编辑</button>
<button class="btn btn2" @click="initiateQuotation">发起报价</button>
</view>
<view v-if="type == 3 || type == 4" class="lf-row-between">
<button class="btn btn1" @click="$url('/pages/supply/offer/index?q_sn='+ order.q_sn)">复用报价单</button>
<view class="lf-font-32" style="color: #11D189;" v-if="type == 3">报价已通过</view>
<view class="lf-font-32" style="color: #FF0000;" v-if="type == 4">报价已被拒绝</view>
</view>
</view> </view>
</view> </view>
</template> </template>
@ -35,19 +44,77 @@
components: { wybTable }, components: { wybTable },
data(){ data(){
return { return {
order: {}
type: 1,
order: {},
headers: [{
label: '菜品名称',
key: 'name'
},{
label: '规格',
key: 'spec'
},{
label: '税前价',
key: 'pre_tax_price'
},{
label: '税后价',
key: 'after_tax_price'
}],
contents: [],
q_sn: '' //
}
},
computed: {
stateClass(){
return function(val){
let class_name = {
'已通过': 'quoted-price',
'待发起': 'wait',
'待审核': 'passed',
'未通过': 'refuse'
}
return class_name[val];
}
} }
}, },
onLoad(options){ onLoad(options){
this.getDetail(options.q_sn)
this.q_sn = options.q_sn;
this.getDetail();
}, },
methods: { methods: {
getDetail(q_sn){
getDetail(){
this.$http(this.API.API_SUPPLIER_QUOTATIONDETAIL, { this.$http(this.API.API_SUPPLIER_QUOTATIONDETAIL, {
q_sn: q_sn
q_sn: this.q_sn
}).then(res => { }).then(res => {
console.log("getDetail", res); console.log("getDetail", res);
this.order = res.data.order || {}; this.order = res.data.order || {};
let list = res.data.order.item || [];
let contents = list.map(item => {
let obj = {
name: item.material?.m_name,
material_id: item.material?.id,
spec: item.spec?.name,
spec_id: item.spec?.id,
pre_tax_price: item.tax_price,
after_tax_price: item.non_tax_price
}
return obj;
});
this.contents = contents;
})
},
//
initiateQuotation(){
// todo
},
//
revokeOrder(){
this.$http(this.API.API_SUPPLIER_QUOTATIONUPDATE, {
q_sn: this.q_sn,
state: '待发起'
}).then(res => {
console.log("revokeOrder", res);
}) })
} }
} }
@ -78,7 +145,7 @@
width: 750rpx; width: 750rpx;
height: 98rpx; height: 98rpx;
display: flex; display: flex;
justify-content: flex-end;
// justify-content: flex-end;
align-items: center; align-items: center;
border-top: 1rpx solid #E5E5E5; border-top: 1rpx solid #E5E5E5;
background-color: #FFFFFF; background-color: #FFFFFF;
@ -105,6 +172,9 @@
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
.fixed-bottom>view{
width: 100%;
}
// //
.quoted-price{ .quoted-price{
color: #777777; color: #777777;

91
pages/supply/order/index.vue

@ -6,12 +6,16 @@
<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}" <swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}"
:current="current" @change="swiperChange"> :current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"> <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">
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box"
:scroll-y="true" :refresher-enabled="true"
refresher-background="#f6f6f6"
@scrolltolower="scrolltolower"
:refresher-triggered="tabItem.isRefresher"
@refresherrefresh="onRefresherrefresh">
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/supply/order/detail?q_sn='+ item.q_sn)"> <view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/supply/order/detail?q_sn='+ item.q_sn)">
<view class="lf-row-between upper"> <view class="lf-row-between upper">
<view class="lf-font-28 lf-color-333">订单状态</view> <view class="lf-font-28 lf-color-333">订单状态</view>
<!-- TODO 状态颜色 -->
<view class="order-btn quoted-price">{{ item.state }}</view>
<view class="order-btn" :class="stateClass(item.state)">{{ item.state }}</view>
</view> </view>
<view class="lf-row-between lower"> <view class="lf-row-between lower">
<view>报价单号 {{ item.q_sn }}</view> <view>报价单号 {{ item.q_sn }}</view>
@ -35,28 +39,47 @@
current: 0, current: 0,
tab_list: [{ tab_list: [{
name: '全部', name: '全部',
state_name: '',
loading_class: true, loading_class: true,
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
isRefresher: false, // scroll-view
list: [] list: []
},{ },{
name: '审核中', name: '审核中',
state_name: '审核中',
loading_class: true, loading_class: true,
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
isRefresher: false,
list: [] list: []
},{ },{
name: '已完成', name: '已完成',
state_name: '已完成',
loading_class: true, loading_class: true,
loading_text: '正在加载中...', loading_text: '正在加载中...',
page: 1, page: 1,
isPage: true, isPage: true,
isRefresher: false,
list: [] list: []
}], }],
page_size: 10, page_size: 10,
windowHeight: 0
windowHeight: 0,
}
},
computed: {
stateClass(){
return function(val){
let class_name = {
'已通过': 'quoted-price',
'待发起': 'wait',
'待审核': 'passed',
'未通过': 'refuse'
}
return class_name[val];
}
} }
}, },
onLoad(){ onLoad(){
@ -64,17 +87,61 @@
this.getData(); this.getData();
}, },
methods: { methods: {
getData(){
this.$http(this.API.API_SUPPLIER_QUOTATIONORDERLIST).then(res => {
console.log("ssss", res);
this.tab_list[this.current].list = res.data.list;
getData(options){
let item = this.tab_list[this.current];
this.$http(this.API.API_SUPPLIER_QUOTATIONORDERLIST, {
state: item.state_name,
page: item.page,
page_size: this.page_size
}).then(res => {
if(options && options.refresh){
item.isRefresher = false;
}
// item.isPage = res.isPage; //
if(!item.isPage){
item.loading_class = false;
item.loading_text = '已加载全部数据~'
}
if(item.page == 1){
item.list = res.data.list;
}else{
item.list.push(...res.data.list);
}
}) })
}, },
tabsChange(current){ tabsChange(current){
this.current = current; this.current = current;
if(this.tab_list[this.current].list.length <= 0){
this.getData();
}
}, },
swiperChange(event){ swiperChange(event){
this.current = event.detail.current; this.current = event.detail.current;
if(event.detail.source == '') return; //
if(this.tab_list[this.current].list.length <= 0){
this.getData();
}
},
//
scrolltolower(){
let item = this.tab_list[this.current];
if(item.isPage){
item.page++;
this.getData();
}
},
//
onRefresherrefresh(){
this.$u.throttle(() => {
let item = this.tab_list[this.current];
item.isRefresher = true;
item.page = 1;
item.isPage = true;
item.loading_class = true;
item.loading_text = '正在加载中...';
item.list = [];
this.getData({refresh: true});
}, 200);
} }
} }
} }
@ -108,19 +175,19 @@
line-height: 60rpx; line-height: 60rpx;
font-size: 28rpx; font-size: 28rpx;
} }
//
//
.quoted-price{ .quoted-price{
color: #777777; color: #777777;
} }
//
//
.wait{ .wait{
color: #1833F2; color: #1833F2;
} }
//
//
.passed{ .passed{
color: #0BCE5F; color: #0BCE5F;
} }
//
//
.refuse{ .refuse{
color: #FF0000; color: #FF0000;
} }

Loading…
Cancel
Save