Browse Source

联调接口

master
邓宏 2 years ago
parent
commit
f3c0343e99
  1. 4
      App.vue
  2. 4
      common/request.js
  3. 2
      pages.js
  4. 7
      pages/home/index.vue
  5. 38
      pages/purchase/detail.vue
  6. 57
      pages/purchase/record.vue
  7. 6
      store/index.js

4
App.vue

@ -20,9 +20,7 @@
if(this.$store.getters.token){
}else{
// uni.reLaunch({
// url:"pages/home/login",
// })
this.$store.commit('outLogin')
}
},
onShow: function() {

4
common/request.js

@ -2,8 +2,8 @@ import store from "@/store"
export function host(host='default',suffix='/plant_manage'){
var url=process.env.NODE_ENV === 'development'?{
default:`http://2uktvr.natappfree.cc` //陈
// default:`http://6h8nxd.natappfree.cc` //马
// default:`http://zrxsae.natappfree.cc` //陈
default:`http://k3megd.natappfree.cc` //马
}:{
default:`http://qv6mj8.natappfree.cc`
}

2
pages.js

@ -37,12 +37,12 @@ module.exports = hot((pagesJson)=>{
current: 0,
list: [
// {name:"测试页面",path:"pages/demo"},
{name: "地块管理",path: "pages/massif/mana/index","query": ""},
{name: "登录",path: "pages/home/login","query": ""},
{name: "首页",path: "pages/home/index","query": ""},
{name: "仓库管理",path: "pages/warehouse/mana","query": ""},
{name: "仓库基本信息",path: "pages/warehouse/info","query": ""},
{name: "仓库详情",path: "pages/warehouse/detail","query": ""},
{name: "地块管理",path: "pages/massifMana","query": ""},
{name: "地块详情",path: "pages/massifDetail","query": ""},
{name: "地块基本信息",path: "pages/massifInfo","query": ""}
]

7
pages/home/index.vue

@ -349,8 +349,11 @@ import request from '@/common/request.js'
},
},
onLoad() {
// this.getMassif()
this.isAdmin && this.getPlantBase()
if(this.isAdmin){
this.getPlantBase()
}else{
this.getMassif(this.$store.getters['userInfo'].plantBaseInfoId)
}
},
onShow(){

38
pages/purchase/detail.vue

@ -63,25 +63,51 @@
</style>
<template>
<view class="container">
<view style="margin:0 30rpx;">申请日期2022-12-29</view>
<view style="margin:0 30rpx;">申请日期{{date}}</view>
<view class="card">
<view v-for="k in 5" :key="k">
<view v-for="(v,k) in list" :key="k">
<view class="head">
<text>化肥</text> <text>中量元素水溶肥</text> <text>(100kg/)</text>
<text>{{v.goodsName}}</text> <text>{{v.detailedType}}</text> <text>({{v.goodsSpecification}})</text>
</view>
<view class="info">
<text>微量元素肥</text> <text class="over">云南云天化股份有限公司</text> <text data-total="200kg">2</text>
<text>微量元素肥</text> <text class="over">{{v.supplier}}</text> <text data-total="200kg">{{v.num}}</text>
</view>
</view>
<u-empty v-if="list.length==0" icon="http://cdn.uviewui.com/uview/empty/data.png"/>
</view>
</view>
</template>
<script>
import request from '@/common/request'
export default {
data(){
return{
}
date:"",
list:[],
}
},
onLoad(options){
this.date=options.date
this.getPurchaseDetail(options.id)
},
methods:{
async getPurchaseDetail(purchaseId){
var res=await request("/api/purchase/purchaseSubList",{
params:{
purchaseId,
pageSize:40,
}
})
if(res.statu){
this.list=res.data.records
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取采购详情失败!",
showCancel:false,
})
}
},
}
}
</script>

57
pages/purchase/record.vue

@ -74,18 +74,18 @@
</style>
<template>
<view class="container flex">
<d-search/>
<d-search v-model="searchVal.baseName" @search="clean();search()"/>
<scroll-view scroll-y>
<view class="card" @click="$u.route({url:'pages/purchase/detail'})">
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k" @click="$u.route({url:'pages/purchase/detail',params:{id:v.id,date:v.applicantTime}})">
<view class="head">
<text class="plant-edifice"/>
<text>一号基地</text>
<text>张召忠</text>
<text>{{v.baseName}}</text>
<text>{{v.applicantName}}</text>
</view>
<view class="item">
<text>申请日期</text>
<text>2022-12-29</text>
<text>{{v.applicantTime}}</text>
</view>
<view class="item">
<text>种类</text>
@ -94,21 +94,56 @@
</view>
<view class="foot">
<view class="examine">
<text>审核人章晓华</text>
<text class="over">原因此处是原因此处是原因此处是处是原因此处是原因此处是</text>
<text v-if="false">审核人章晓华</text>
<text v-if="false" class="over">原因此处是原因此处是原因此处是处是原因此处是原因此处是</text>
</view>
<text class="type">审核中</text>
<text class="type" :style="{'--bg':({2:'#FFCB69',3:'#10C176',4:'#EE263A',5:'#2196f3'})[v.applicantStatus]}">{{({2:"审核中",3:"通过",4:"未通过",5:"农资入库"})[v.applicantStatus]}}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import request from '@/common/request'
export default {
data(){
return{
}
searchVal:{
baseName:"",
pageNo:1,
pageSize:6,
companyId:this.$store.getters['userInfo'].companyId
},
total:0,
list:[],
}
},
onLoad(){
this.search()
},
methods:{
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
if(this.total==0||this.list.length<this.total){
var res = await request("/api/purchase/purchaseList",{
params:this.searchVal
})
if(res.statu){
this.list=this.list.concat(res.data.records)
this.total=res.data.total
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取采购记录失败!",
showCancel:false,
})
}
}
},
}
}
</script>

6
store/index.js

@ -22,9 +22,9 @@ export default new Vuex.Store({
outLogin(state){
state.userInfo={}
state.token=''
uni.reLaunch({
url:"/pages/home/login",
})
// uni.reLaunch({
// url:"/pages/home/login",
// })
},
setHeadImg(state,val){
state.userInfo.avatar=val

Loading…
Cancel
Save