Commit 430724e1 authored by Morson's avatar Morson

修复首页数据初始化问题

我的仓库页面搭建和页面交互对接
parent c098ad03
...@@ -131,6 +131,16 @@ let orderApiFun = function(vm){ ...@@ -131,6 +131,16 @@ let orderApiFun = function(vm){
*/ */
let addressToCoordinate= async (orderId) => await vm.$u.get(prefix+'order/specialfee/'+ vm.vuex_token +'/address/coordinate/'+orderId); let addressToCoordinate= async (orderId) => await vm.$u.get(prefix+'order/specialfee/'+ vm.vuex_token +'/address/coordinate/'+orderId);
/**
* 我的库存明细(物料)
*/
let listBystock= async () => await vm.$u.get(prefix + vm.vuex_token +'/myinfo/stock', {}, {'content-type': 'application/json'});
/**
* 我的出入库流水
*/
let listAccessHistory= async (params = {}) => await vm.$u.get(prefix + vm.vuex_token +'/myinfo/access/history', params, {'content-type': 'application/json'});
const orderApi = { const orderApi = {
listByRecommendOrder, listByRecommendOrder,
...@@ -159,7 +169,9 @@ let orderApiFun = function(vm){ ...@@ -159,7 +169,9 @@ let orderApiFun = function(vm){
saveCompleteData, saveCompleteData,
inOrderFinish, inOrderFinish,
outOrderFinish, outOrderFinish,
addressToCoordinate addressToCoordinate,
listBystock,
listAccessHistory
} }
return orderApi return orderApi
} }
......
...@@ -196,6 +196,14 @@ ...@@ -196,6 +196,14 @@
"navigationBarTitleText": "配件押金", "navigationBarTitleText": "配件押金",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "warehouse/index",
"style": {
"navigationStyle":"custom",
"navigationBarTitleText": "我的仓库",
"enablePullDownRefresh": false
}
} }
] ]
}, },
......
...@@ -100,16 +100,17 @@ ...@@ -100,16 +100,17 @@
token: "", token: "",
pageNumber: 0, pageNumber: 0,
pageSize: 100, pageSize: 100,
}, },
waitInit: false, // 当token为空时,等待自动登录结束
triggered: false, triggered: false,
_freshing: false, _freshing: false,
}; };
}, },
watch: { watch: {
// vuex_token(val, oldVal) { vuex_token(val, oldVal) {
// // 监听token变化,如果更新则重新加载页面数据 // 监听token变化,如果更新则重新加载页面数据
// val && this.initSettleInfo() val && this.waitInit && this.getData()
// } }
}, },
computed: { computed: {
buttonStyle() { buttonStyle() {
...@@ -139,7 +140,11 @@ ...@@ -139,7 +140,11 @@
}, },
onLoad() { onLoad() {
this._freshing = false; this._freshing = false;
this.getOrderCount() if(this.vuex_token) {
this.getOrderCount()
} else {
this.waitInit = true
}
}, },
onShow() { onShow() {
// 每次进入页面都刷新入驻状态 // 每次进入页面都刷新入驻状态
...@@ -164,6 +169,10 @@ ...@@ -164,6 +169,10 @@
// console.log('---------scroll---------', obj) // console.log('---------scroll---------', obj)
// }, // },
methods: { methods: {
getData() {
this.getOrderCount()
this.initSettleInfo();
},
handleClick(orderId) { // 点击了cell handleClick(orderId) { // 点击了cell
console.log('点击了cell') console.log('点击了cell')
this.viewOderItem(orderId) this.viewOderItem(orderId)
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
return process.uniEnv.qn_base_url return process.uniEnv.qn_base_url
}, },
pages() { pages() {
return ['wallet', 'deposit', 'contract', 'cert', 'address', '', 'customer'] return ['wallet', 'deposit', 'contract', 'cert', 'address', 'warehouse', 'customer']
}, },
headImageUrl() { headImageUrl() {
return this.info.headImage || this.placeholderImage return this.info.headImage || this.placeholderImage
......
...@@ -154,7 +154,6 @@ export default { ...@@ -154,7 +154,6 @@ export default {
goBackPage() { goBackPage() {
let pages = getCurrentPages(); let pages = getCurrentPages();
debugger
if(pages.length) { if(pages.length) {
let index = pages.length - 1; let index = pages.length - 1;
if(index) { if(index) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="cus-wrap"> <view class="cus-wrap">
<w-navbar title="联系客服"></w-navbar> <w-navbar title="联系客服"></w-navbar>
<view class="content"> <view class="content">
<u-image class="qrcode" :src="cusQrcode" width="400" mode="widthFix" @longtap="download"> <u-image class="qrcode" :src="cusQrcode" width="400" height="400" mode="widthFix" @longtap="download" :fade="true" duration="450">
<u-loading slot="loading"></u-loading> <u-loading slot="loading"></u-loading>
<view slot="error" style="font-size: 24rpx;">加载失败</view> <view slot="error" style="font-size: 24rpx;">加载失败</view>
</u-image> </u-image>
......
<template>
<view class="ware-wrap">
<w-navbar title="我的仓库" :background="{backgroundColor: '#F4F5F7'}"></w-navbar>
<view class="content">
<view class="panel">
<view class="title">物料明细</view>
<view class="item-table">
<view class="item-header">
<view>物料名称</view>
<view>库存数量</view>
</view>
<u-divider half-width="315" border-color="#F4F5F7" height="2"></u-divider>
<view class="item-row" v-for="(item, index) in details" :key="index">
<view class="width-504 break">{{ item.skuName }}</view>
<view class="width-106 center">{{ item.systemStock }}</view>
</view>
</view>
</view>
<view class="panel">
<view class="title">操作记录</view>
<view class="item-table">
<view class="item-header">
<view class="width-132">订单编号</view>
<view class="width-210">物料名称</view>
<view class="width-80">出库量</view>
<view class="width-140 right">操作时间</view>
</view>
<u-divider half-width="315" border-color="#F4F5F7" height="2"></u-divider>
<view class="item-row" v-for="(item, index) in record" :key="index">
<view class="width-132 break">{{ item.businessNumber }}</view>
<view class="width-210 break">{{ item.skuName }}</view>
<view class="width-80 center">{{ item.outAmount }}</view>
<view class="width-140 break">{{ item.createTime | datefmt('YYYY.MM.DD HH:mm:ss')}}</view>
</view>
<u-loadmore :status="status" @loadmore="loadRecord" />
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
status: 'loadmore',
details: [],
record: [],
total: 100,
search: {
pageNumber: 0,
pageSize: 20,
},
};
},
onReachBottom() {
if(this.status == 'nomore') return ;
this.status = 'loading';
this.search.pageNumber = ++ this.search.pageNumber;
this.loadAccess()
},
computed: {},
onLoad() {
this.getData();
},
methods: {
getData() {
let self = this
self.initDetails()
self.search.pageNumber = ++ self.search.pageNumber;
self.loadAccess()
},
async initDetails() {
let self = this
let res = await self.$u.api.listBystock()
if(res && res.code == 200) {
self.details = res.data.list
}
// 测试数据
self.details = [
{skuName: '广汽新能源立柱-特来电', systemStock: 1},
{skuName: '广汽新能源-星星', systemStock: 14}
]
},
loadRecord() {
if(this.status == 'nomore') return ;
this.status = 'loading';
this.search.pageNumber = ++ this.search.pageNumber;
this.loadAccess()
},
async loadAccess() {
let self = this
/*
/wxh-worker-rest/rest/{token}/myinfo/access/history
路径参数:
token=xxxx
Headers:
Content-Type: application/json
Query:
pageNumber=0
pageSize=10
*/
let res = await self.$u.api.listAccessHistory(self.search)
if(res && res.code == 200) {
self.total = res.data && res.data.total || self.total
let list = res.data && res.data.list && self.$u.deepClone(res.data.list) || [];
// 测试数据
list = [
{businessNumber: 'OR20210507332669', skuName: '广汽新能源立柱红红火火恍恍惚惚', outAmount: 1, createTime: Date.now()},
{businessNumber: 'OR20210507332775', skuName: '广汽新能源星星点灯', outAmount: 1, createTime: Date.now()},
{businessNumber: 'OR20210507332020', skuName: '广汽新能源星星点灯', outAmount: 6, createTime: Date.now()},
{businessNumber: 'OR20210507332333', skuName: '广汽新能源立柱啦啦啦啦啦啦啦', outAmount: 1, createTime: Date.now()},
{businessNumber: 'OR20210507334689', skuName: '广汽新能源立柱', outAmount: 12, createTime: Date.now()},
{businessNumber: 'OR20210507339991', skuName: '广汽新能源立柱啦啦啦啦啦啦啦', outAmount: 12, createTime: Date.now()},
{businessNumber: 'OR20210507332660', skuName: '广汽新能源立柱', outAmount: 12, createTime: Date.now()},
{businessNumber: 'OR20210507332669', skuName: '广汽新能源立柱红红火火恍恍惚惚', outAmount: 1, createTime: Date.now()},
{businessNumber: 'OR20210507332775', skuName: '广汽新能源星星点灯', outAmount: 1, createTime: Date.now()},
{businessNumber: 'OR20210507332333', skuName: '广汽新能源立柱啦啦啦啦啦啦啦', outAmount: 1, createTime: Date.now()},
]
if(list && list.length) {
self.record.push(...list)
if(self.total > self.record.length) {
self.status = "loadmore"
} else {
self.status = "nomore"
}
} else {
self.status = "nomore"
}
} else {
}
},
}
}
</script>
<style lang="scss" scoped>
.ware-wrap {
background-color: #F4F5F7;
.content {
padding: 34rpx 30rpx;
display: flex;
flex-direction: column;
align-items: center;
.panel {
.title {
margin-bottom: 30rpx;
font-size: 32rpx;
font-weight: bold;
color: #333333;
line-height: 44rpx;
}
.item-table {
margin-bottom: 46rpx;
padding: 34rpx 30rpx;
width: 690rpx;
background: #FFFFFF;
border-radius: 12rpx;
.item-header {
margin-bottom: 24rpx;
font-size: 26rpx;
font-weight: bold;
color: #333333;
line-height: 38rpx;
display: flex;
justify-content: space-between;
}
.item-row {
margin: 24rpx 0;
font-size: 26rpx;
font-weight: 400;
color: #333333;
line-height: 38rpx;
display: flex;
justify-content: space-between;
}
}
}
}
}
.width-504 {
width: 504rpx;
}
.width-106 {
width: 106rpx;
}
.width-132 {
width: 132rpx;
}
.width-210 {
width: 210rpx;
}
.width-80 {
width: 80rpx;
}
.width-140 {
width: 140rpx;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
.break {
word-break:break-all;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment