Commit 13cd3522 by wangyalan-git

领用记录

parent e1e14a27
......@@ -16,3 +16,11 @@ export function checkQcode (params) {
params
})
}
// 万科h5_领用记录分页查询
export function getOutboundOrderList (params) {
return request({
url: 'vankeOutboundOrder/getPageList',
method: 'get',
params
})
}
// date.js
/* eslint-disable */
export function formatDate (date, fmt) {
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
const o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds()
}
for (const k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
const str = o[k] + ''
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str))
}
}
return fmt
}
function padLeftZero (str) {
return ('00' + str).substr(str.length)
}
export function str2Date (dateStr, separator) {
if (!separator) {
separator = '-'
}
const dateArr = dateStr.split(separator)
const year = parseInt(dateArr[0])
let month
// 处理月份为04这样的情况
if (dateArr[1].indexOf('0') == 0) {
month = parseInt(dateArr[1].substring(1))
} else {
month = parseInt(dateArr[1])
}
const day = parseInt(dateArr[2])
const date = new Date(year, month - 1, day)
return date
}
......@@ -7,7 +7,7 @@
<div class="wrap">
<p>我的动态二维码</p>
</div>
<div id="qrcode" class="qr"></div>
<div id="qrcode" class="qr" @click="generateQrcode"></div>
<p class="notice" v-if="onlyId">领用办公用品时请出示该二维码</p>
</div>
</div>
......
......@@ -2,8 +2,9 @@
<div class="page">
<navbar title="领用记录" @rightClick="goRecords"></navbar>
<div class="container">
<van-pull-refresh class="list" v-model="refreshing" @refresh="onRefresh">
<van-pull-refresh class="width_100" v-model="refreshing" @refresh="onRefresh">
<van-list
:immediate-check="false"
v-model="loading"
:finished="finished"
finished-text="没有更多了"
......@@ -11,14 +12,14 @@
>
<div class="row" v-for="(item,index) in list" :key="index">
<p class="title">
<span>领用编号:98293023</span>
<span>2020-03-02 19:30</span>
<span>领用编号:{{item.outboundNo}}</span>
<span>{{item.createtime | formatTime}}</span>
</p>
<div class="info" v-for="(item,index) in 4" :key="index">
<p>16开记事本</p>
<div class="info" v-for="(vor,v_index) in item.vorList" :key="v_index">
<p>{{vor.goodsName}}</p>
<p>
<span class="num">数量:</span>
<span>3</span>
<span>{{vor.outboundNum}}</span>
</p>
</div>
</div>
......@@ -30,15 +31,23 @@
</template>
<script>
import { getOutboundOrderList } from '@/api/code'
import { formatDate } from '@/utils/date'
export default {
name: 'index',
components: {},
data () {
return {
total: null,
list: [],
loading: false,
finished: false,
refreshing: false
refreshing: false,
params: {
pageNum: 1,
pageSize: 5
}
}
},
mounted () {
......@@ -47,24 +56,32 @@ export default {
goRecords () {
console.log(1111)
},
onLoad () {
setTimeout(() => {
if (this.refreshing) {
this.list = []
this.refreshing = false
}
for (let i = 0; i < 10; i++) {
this.list.push(this.list.length + 1)
getList () {
getOutboundOrderList(this.params).then(res => {
console.log('列表', this.params, res)
for (var i of res.data.list) {
this.list.push(i)
}
this.total = Number(res.data.total)
this.params.pageNum++
this.loading = false
if (this.list.length >= 10) {
if (this.list.length >= this.total) {
this.finished = true
}
}, 1000)
})
},
onLoad () {
console.log('onload')
if (this.refreshing) {
this.list = []
this.params.pageNum = 1
this.refreshing = false
}
this.getList()
},
onRefresh () {
console.log('onrefresh')
// 清空列表数据
this.finished = false
......@@ -73,17 +90,35 @@ export default {
this.loading = true
this.onLoad()
}
},
filters: {
formatTime (time) {
if (!time) {
return '--'
}
const date = new Date(time)
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
}
}
}
</script>
<style lang='scss' scoped>
.page{
height: 100%;
}
.width_100 {
width: 100%;
}
.row {
width: 100%;
}
.row+.row{
margin-top: 10px;
}
.row + .row {
margin-top: 10px;
}
.row .title {
display: flex;
justify-content: space-between;
......@@ -91,10 +126,12 @@ export default {
padding: 10px 15px;
background: #f6f7f9;
}
.title span:last-child, .num{
.title span:last-child, .num {
color: #999;
}
.row .info{
.row .info {
display: flex;
justify-content: space-between;
align-items: center;
......@@ -102,7 +139,8 @@ export default {
padding: 15px;
font-size: 14px;
}
.info +.info{
.info + .info {
border-top: 1px solid #e8e8e8;
}
</style>
......@@ -38,7 +38,7 @@ export default {
getToken () {
this.$store.dispatch('Login', { jobNo: this.$route.query.jobNo }).then(() => {
this.$store.dispatch('GetUserInfo').then(res => {
// res.data.accouuntType = 0
res.data.accouuntType = 0
this.userInfo = res.data
console.log('userInof', this.userInfo)
}).catch(() => {
......
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