创建版本
This commit is contained in:
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索单号" @confirm="search" />
|
||||
</view>
|
||||
<view class="line-h"></view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<view class="uni-media-list-text-top">
|
||||
<text>{{ row.master_sn }}</text>
|
||||
<text>{{ row.master_customer_id_name }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">{{ htmlClear(row.master_status) }}</text>
|
||||
<text class="desc">{{ row.master_created_at }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import {dateUtils} from '@/util.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
tabBars: [{
|
||||
name: '审核中',
|
||||
id: 'flow.todo',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已生效',
|
||||
id: 'flow.done',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.getList(0);
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
methods: {
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
htmlClear(str) {
|
||||
// 正则去掉所有的html标记
|
||||
return str.replace(/<[^>]+>/g, "");
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('approach/approach/index', {by: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(row) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/webview?title=进店详情&url=' + encodeURIComponent('approach/approach/show?id=' + row.master_id),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
margin-top: 103px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom .desc {
|
||||
margin-bottom: 15rpx;
|
||||
display: block;
|
||||
}
|
||||
.uni-media-list-text-bottom .desc:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,299 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索主题" @confirm="search" />
|
||||
</view>
|
||||
<view class="line-h"></view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<view class="uni-media-list-text-top">
|
||||
<text>{{ row.name }}</text>
|
||||
<text>{{ row.description }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">{{ row.created_by }}</text>
|
||||
<text class="desc">{{ row.created_at }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import {dateUtils} from '@/util.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
tabBars: [{
|
||||
name: '全部',
|
||||
id: 'all',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '未读',
|
||||
id: 'unread',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已读',
|
||||
id: 'done',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.getList(0);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
|
||||
methods: {
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('article/article/index', {tab: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(row) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/webview?title=公告详情&url=' + encodeURIComponent('article/article/show?id=' + row.id),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
margin-top: 103px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
font-size: 28rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom .desc {
|
||||
margin-bottom: 15rpx;
|
||||
display: block;
|
||||
}
|
||||
.uni-media-list-text-bottom .desc:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 33.33333%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,313 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索单号" @confirm="search" />
|
||||
</view>
|
||||
<view class="line-h"></view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<view class="uni-media-list-text-top">
|
||||
<text>{{ row.master_sn }}</text>
|
||||
<text>{{ htmlClear(row.master_status) }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">{{ row.master_customer_id_name }}</text>
|
||||
<text class="desc">{{ row.master_invoice_dt }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">预计到货日期:{{ row.master_invoice_dt }}</text>
|
||||
<text class="desc">实发数量:{{ row.total_quantity }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">收货地址:{{ row.master_warehouse_address }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">物流公司:{{ row.master_freight_logistics_id_name }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">物流电话:{{ row.master_freight_logistics_phone }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">运输单号:{{ row.master_freight_sn }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">配件吨位(T):{{ row.master_freight_part_weight }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">发运方式:{{ row.master_freight_type_name }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">承担运费:{{ row.master_freight_customer_money }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">物流备注:{{ row.master_freight_remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import {dateUtils} from '@/util.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
tabBars: [{
|
||||
name: '审核中',
|
||||
id: 'flow.todo',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已生效',
|
||||
id: 'flow.done',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.getList(0);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
|
||||
methods: {
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
htmlClear(str) {
|
||||
// 正则去掉所有的html标记
|
||||
return str.replace(/<[^>]+>/g, "");
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('stock/delivery/count', {by: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(row) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/webview?title=发货详情&url=' + encodeURIComponent('stock/delivery/show?id=' + row.master_id),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
margin-top: 103px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-top: 15rpx;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索单号" @confirm="search" />
|
||||
</view>
|
||||
<view class="line-h"></view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<view class="uni-media-list-text-top">
|
||||
<text>{{ row.master_sn }}</text>
|
||||
<text>{{ row.master_customer_id_name }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text>{{ htmlClear(row.master_status) }}</text>
|
||||
<text>{{ row.master_created_at }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text>开始日期:{{ row.master_start_dt }}</text>
|
||||
<text>结束日期:{{ row.master_end_dt }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import {dateUtils} from '@/util.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
tabBars: [{
|
||||
name: '审核中',
|
||||
id: 'flow.todo',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已生效',
|
||||
id: 'flow.done',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.getList(0);
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
methods: {
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
htmlClear(str) {
|
||||
// 正则去掉所有的html标记
|
||||
return str.replace(/<[^>]+>/g, "");
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('promotion/promotion/index', {by: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(row) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/webview?title=促销详情&url=' + encodeURIComponent('promotion/promotion/show?id=' + row.master_id),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
margin-top: 103px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<uni-nav-bar color="#ffffff" background-color="#007AFF" status-bar="true" left-icon="arrowleft" left-text="返回" :right-text="is_add ? '新增' : ''" @clickLeft="back" @clickRight="add" />
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view v-for="(row, key) in tabBars[tabIndex].data" :key="key">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<img :src=" baseURL + '/uploads/' + row.path" style="width:100%;">
|
||||
<view class="uni-media-list-text">
|
||||
<view class="uni-media-list-text-top">
|
||||
<text>{{ row.created_by }}</text>
|
||||
<text>{{ formatDate(row.created_at) }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text>{{ row.location }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
|
||||
import {dateUtils} from '@/util.js';
|
||||
import {baseURL} from '@/api.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore,
|
||||
uniNavBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
is_add: false,
|
||||
promotion_id: 0,
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
baseURL: baseURL,
|
||||
tabBars: [{
|
||||
name: '审核中',
|
||||
id: '0',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已审核不合格',
|
||||
id: '1',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已审核合格',
|
||||
id: '2',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
var me = this;
|
||||
me.promotion_id = options.promotion_id;
|
||||
|
||||
// 判断谁可以上传资料
|
||||
var user = uni.getStorageSync('user');
|
||||
if (user.group_id == 3 || user.id == 1) {
|
||||
me.is_add = true;
|
||||
}
|
||||
|
||||
me.getList(0);
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
add() {
|
||||
let me = this;
|
||||
uni.navigateTo({
|
||||
url: '/pages/app/promotionMaterial/upload?promotion_id=' + me.promotion_id
|
||||
});
|
||||
},
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
htmlClear(str) {
|
||||
// 正则去掉所有的html标记
|
||||
return str.replace(/<[^>]+>/g, "");
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('promotion/material/index', {by: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
margin-top: 103px;
|
||||
background-color: #f1f1f1;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list {
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
background-color: #fff;
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-text {
|
||||
width: calc(100% - 30rpx);
|
||||
padding: 15rpx;
|
||||
}
|
||||
.uni-media-list-text-top {
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 33.333333%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="upload-box">
|
||||
<view class="uni-form-item">
|
||||
<view class="title">位置信息</view>
|
||||
<input class="uni-input" disabled="disabled" v-model="location" />
|
||||
</view>
|
||||
|
||||
<view class="uni-form-item">
|
||||
<view class="title">门店名称</view>
|
||||
<input class="uni-input" placeholder="请输入门店名称" v-model="name" />
|
||||
</view>
|
||||
|
||||
<view class="uni-form-item" style="border:0;">
|
||||
<img-upload :imgArr="images" imgCount="3" ref="imgUpload" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="notice-box">
|
||||
<uni-notice-bar :show-close="true" :single="true" :text="'页面将在' + second + '秒后失效'" />
|
||||
</view>
|
||||
|
||||
<view class="submit-box">
|
||||
<button type="primary" @click="submit">提交</button>
|
||||
<button type="info" @click="refresh">刷新</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.submit-box {
|
||||
display: flex;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.submit-box uni-button {
|
||||
margin-left: 15rpx;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.notice-box {
|
||||
padding: 0 15rpx;
|
||||
}
|
||||
|
||||
.upload-box {
|
||||
padding-left: 15rpx;
|
||||
}
|
||||
|
||||
.uni-form-item {
|
||||
border-bottom: 1px solid #F1F1F1;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.uni-input {
|
||||
color: #222;
|
||||
padding: 4px 12px 6px 12px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
var wx = require('weixin');
|
||||
import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue'
|
||||
import imgUpload from '@/components/my-components/uImgUpload.vue';
|
||||
var InterTimer = null;
|
||||
export default {
|
||||
components: {
|
||||
imgUpload,
|
||||
uniNoticeBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
location: '位置获取中...',
|
||||
promotion_id: 0,
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
images: [],
|
||||
second: 180,
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
var me = this;
|
||||
me.promotion_id = options.promotion_id;
|
||||
},
|
||||
methods: {
|
||||
getLocation() {
|
||||
let me = this;
|
||||
wx.getLocation({
|
||||
type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||
success: function(res) {
|
||||
console.log('微信定位成功');
|
||||
me.latitude = res.latitude;
|
||||
me.longitude = res.longitude;
|
||||
me.$api.post('wap/wechat/mapGeocoder', {
|
||||
location: res.latitude + ',' + res.longitude
|
||||
})
|
||||
.then(ret => {
|
||||
if (ret.status == 0) {
|
||||
me.location = ret.result.address;
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
setRemainTime() {
|
||||
let me = this;
|
||||
if (me.second > 0) {
|
||||
me.second = me.second - 1;
|
||||
} else {
|
||||
window.clearInterval(InterTimer);
|
||||
}
|
||||
},
|
||||
refresh() {
|
||||
let me = this;
|
||||
me.name = '';
|
||||
me.location = '';
|
||||
me.latitude = 0;
|
||||
me.longitude = 0;
|
||||
me.images = [];
|
||||
me.second = 180;
|
||||
me.$refs.imgUpload.imgArray = [];
|
||||
me.getLocation();
|
||||
},
|
||||
submit() {
|
||||
let me = this;
|
||||
|
||||
if (me.second <= 0) {
|
||||
uni.showModal({
|
||||
content: "无法提交,表单已超时",
|
||||
confirmText: "确定",
|
||||
showCancel: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.name == '') {
|
||||
uni.showModal({
|
||||
content: "门店信息不能为空",
|
||||
confirmText: "确定",
|
||||
showCancel: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.location == '') {
|
||||
uni.showModal({
|
||||
content: "位置信息不能为空",
|
||||
confirmText: "确定",
|
||||
showCancel: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.latitude == 0 || me.longitude == 0) {
|
||||
uni.showModal({
|
||||
content: "经纬度不能为空",
|
||||
confirmText: "确定",
|
||||
showCancel: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.promotion_id == 0) {
|
||||
uni.showModal({
|
||||
content: "促销编号不能为空",
|
||||
confirmText: "确定",
|
||||
showCancel: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let files = me.$refs.imgUpload.imgArray.map((uri, index) => {
|
||||
return {
|
||||
name: "images[" + index + "]",
|
||||
uri: uri
|
||||
}
|
||||
});
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '数据处理中...'
|
||||
});
|
||||
uni.uploadFile({
|
||||
url: me.$api.baseURL + "/promotion/material/store",
|
||||
files: files,
|
||||
formData: {
|
||||
name: me.name,
|
||||
location: me.location,
|
||||
lat: me.latitude,
|
||||
lng: me.longitude,
|
||||
promotion_id: me.promotion_id,
|
||||
},
|
||||
header: {
|
||||
'x-auth-token': uni.getStorageSync('token')
|
||||
},
|
||||
success: function(res) {
|
||||
uni.hideLoading();
|
||||
let ret = JSON.parse(res.data);
|
||||
if (ret.status) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/app/promotionMaterial/index?promotion_id=' + me.promotion_id
|
||||
});
|
||||
} else {
|
||||
uni.showModal({
|
||||
content: ret.data,
|
||||
confirmText: "确定",
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
var me = this;
|
||||
|
||||
InterTimer = window.setInterval(me.setRemainTime, 1000);
|
||||
|
||||
me.$api.post('wap/wechat/jsConfig', {
|
||||
url: window.location.href
|
||||
}).then(ret => {
|
||||
wx.config(ret);
|
||||
wx.ready(function() {
|
||||
me.getLocation();
|
||||
});
|
||||
wx.error(function(res) {
|
||||
console.log(res.errMsg);
|
||||
});
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索单号" @confirm="search" />
|
||||
</view>
|
||||
<view class="line-h"></view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<view class="uni-media-list-text-top">
|
||||
<text>{{ row.master_sn }}</text>
|
||||
<text>{{ row.master_customer_id_name }}</text>
|
||||
</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">{{ htmlClear(row.master_status) }}</text>
|
||||
<text class="desc">{{ row.master_created_at }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import {dateUtils} from '@/util.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
tabBars: [{
|
||||
name: '审核中',
|
||||
id: 'flow.todo',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已生效',
|
||||
id: 'flow.done',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.getList(0);
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
methods: {
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
htmlClear(str) {
|
||||
// 正则去掉所有的html标记
|
||||
return str.replace(/<[^>]+>/g, "");
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('order/order/count', {by: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(row) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/webview?title=销售订单详情&url=' + encodeURIComponent('order/order/show?id=' + row.master_id),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
margin-top: 103px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom .desc {
|
||||
margin-bottom: 15rpx;
|
||||
display: block;
|
||||
}
|
||||
.uni-media-list-text-bottom .desc:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header" id="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索主题或文号" @confirm="search" />
|
||||
</view>
|
||||
<view class="line-h"></view>
|
||||
</view>
|
||||
|
||||
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
|
||||
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
|
||||
<view class="uni-media-list">
|
||||
<view class="uni-media-list-body">
|
||||
<view class="uni-media-list-text-top">{{ row.title }}</view>
|
||||
<view class="uni-media-list-text-bottom">
|
||||
<text class="desc">{{ row.name }}</text>
|
||||
<text class="desc">{{ row.step.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabIndex: 0,
|
||||
listTop: 103,
|
||||
tabBars: [{
|
||||
name: '待办中',
|
||||
id: 'todo',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已办理',
|
||||
id: 'trans',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}, {
|
||||
name: '已结束',
|
||||
id: 'done',
|
||||
page: 1,
|
||||
data: [],
|
||||
status: 'more',
|
||||
contentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
contentnomore: '没有更多'
|
||||
}
|
||||
}],
|
||||
reload: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.getList(0);
|
||||
},
|
||||
mounted() {
|
||||
let me = this;
|
||||
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
|
||||
me.listTop = e.height - 1;
|
||||
}).exec();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
let me = this;
|
||||
me.reload = true;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
tab.page = 1;
|
||||
tab.status = 'more';
|
||||
me.getList(me.tabIndex);
|
||||
},
|
||||
onReachBottom() {
|
||||
let me = this;
|
||||
let tab = me.tabBars[me.tabIndex];
|
||||
if (tab.status == 'noMore') {
|
||||
return;
|
||||
}
|
||||
tab.status = 'more';
|
||||
this.getList(me.tabIndex);
|
||||
},
|
||||
|
||||
methods: {
|
||||
ontabtap(index) {
|
||||
var me = this;
|
||||
me.tabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
if (tab.data.length == 0) {
|
||||
me.getList(index);
|
||||
}
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.tabBars[index];
|
||||
|
||||
if (tab.status == 'noMore') {
|
||||
if (me.reload) {
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('workflow/workflow/index', {option: tab.id, page: tab.page}).then(res => {
|
||||
|
||||
if (me.reload) {
|
||||
tab.data = [];
|
||||
me.reload = false;
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.status = 'noMore';
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(row) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/webview?title=流程详情&url=' + encodeURIComponent('workflow/workflow/edit?process_id=' + row.process_id),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
background: rgba(249, 249, 249, 1);
|
||||
}
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-list-controller {
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
font-size: 28rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
/*
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
*/
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom .desc {
|
||||
margin-bottom: 15rpx;
|
||||
display: block;
|
||||
}
|
||||
.uni-media-list-text-bottom .desc:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 33.33333%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,409 @@
|
||||
<template>
|
||||
<view class="tabs">
|
||||
|
||||
<view class="header">
|
||||
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
|
||||
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" :data-current="index" @click="ontabtap">
|
||||
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="search-controller">
|
||||
<uni-search-bar radius="50" placeholder="搜索主题或文号" @confirm="search" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="line-h"></view>
|
||||
|
||||
<swiper :current="tabIndex" class="swiper-box" style="flex:1;" :duration="300" @change="ontabchange">
|
||||
<swiper-item class="swiper-item" v-for="(tab, index1) in newsList" :key="index1">
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<scroll-view class="scroll-v list" :show-scrollbar="true" refresher-enabled="true" enableBackToTop="true" scroll-y @scrolltolower="loadMore(index1)">
|
||||
<view v-for="(newsitem, index2) in tab.data" :key="index2">
|
||||
<media-item :options="newsitem" @click="goDetail(newsitem)"></media-item>
|
||||
</view>
|
||||
<view class="loading-more" v-if="tab.isLoading">
|
||||
<text class="loading-more-text">{{tab.loadingText}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- #endif -->
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
import mediaItem from '@/pages/app/workflow/item.nvue';
|
||||
import {dateUtils} from '@/util.js';
|
||||
export default {
|
||||
components: {
|
||||
uniLoadMore,
|
||||
mediaItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
newsList: [],
|
||||
cacheTab: [],
|
||||
tabIndex: 0,
|
||||
tabBars: [{
|
||||
name: '待办中',
|
||||
id: 'todo'
|
||||
}, {
|
||||
name: '已办理',
|
||||
id: 'trans'
|
||||
}, {
|
||||
name: '已结束',
|
||||
id: 'done'
|
||||
}],
|
||||
|
||||
page: 1,
|
||||
scrollInto: "",
|
||||
showTips: false,
|
||||
navigateFlag: false,
|
||||
pulling: false,
|
||||
refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=="
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
var me = this;
|
||||
me.tabBars.forEach((tabBar) => {
|
||||
me.newsList.push({
|
||||
data: [],
|
||||
page: 1,
|
||||
isLoading: false,
|
||||
isComplete: false,
|
||||
refreshText: "",
|
||||
loadingText: '加载更多...'
|
||||
});
|
||||
});
|
||||
this.getList(0);
|
||||
},
|
||||
methods: {
|
||||
loadMore(e) {
|
||||
this.getList(this.tabIndex);
|
||||
},
|
||||
ontabtap(e) {
|
||||
var me = this;
|
||||
let index = e.target.dataset.current || e.currentTarget.dataset.current;
|
||||
// this.switchTab(index);
|
||||
me.tabIndex = index;
|
||||
//me.scrollInto = me.tabBars[index].id;
|
||||
},
|
||||
ontabchange(e) {
|
||||
let index = e.target.current || e.detail.current;
|
||||
this.switchTab(index);
|
||||
},
|
||||
switchTab(index) {
|
||||
var me = this;
|
||||
|
||||
me.getList(index);
|
||||
|
||||
console.log(22);
|
||||
|
||||
/*
|
||||
// 缓存 tabId
|
||||
if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) {
|
||||
let isExist = this.cacheTab.indexOf(this.tabIndex);
|
||||
if (isExist < 0) {
|
||||
this.cacheTab.push(this.tabIndex);
|
||||
//console.log("cache index:: " + this.tabIndex);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
me.tabIndex = index;
|
||||
me.scrollInto = me.tabBars[index].id;
|
||||
/*
|
||||
// 释放 tabId
|
||||
if (this.cacheTab.length > MAX_CACHE_PAGE) {
|
||||
let cacheIndex = this.cacheTab[0];
|
||||
this.clearTabData(cacheIndex);
|
||||
this.cacheTab.splice(0, 1);
|
||||
//console.log("remove cache index:: " + cacheIndex);
|
||||
}
|
||||
*/
|
||||
},
|
||||
clearTabData(e) {
|
||||
this.newsList[e].data.length = 0;
|
||||
this.newsList[e].loadingText = "加载更多...";
|
||||
},
|
||||
refreshData() {
|
||||
|
||||
},
|
||||
onrefresh(e) {
|
||||
var tab = this.newsList[this.tabIndex];
|
||||
if (!tab.refreshFlag) {
|
||||
return;
|
||||
}
|
||||
tab.refreshing = true;
|
||||
tab.refreshText = "正在刷新...";
|
||||
|
||||
setTimeout(() => {
|
||||
this.refreshData();
|
||||
this.pulling = true;
|
||||
tab.refreshing = false;
|
||||
tab.refreshFlag = false;
|
||||
tab.refreshText = "已刷新";
|
||||
setTimeout(() => { // TODO fix ios和Android 动画时间相反问题
|
||||
this.pulling = false;
|
||||
}, 500);
|
||||
|
||||
}, 2000);
|
||||
},
|
||||
onpullingdown(e) {
|
||||
var tab = this.newsList[this.tabIndex];
|
||||
if (tab.refreshing || this.pulling) {
|
||||
return;
|
||||
}
|
||||
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
|
||||
tab.refreshFlag = true;
|
||||
tab.refreshText = "释放立即刷新";
|
||||
} else {
|
||||
tab.refreshFlag = false;
|
||||
tab.refreshText = "下拉可以刷新";
|
||||
}
|
||||
},
|
||||
formatDate(value) {
|
||||
return dateUtils.formatDate(value);
|
||||
},
|
||||
getList(index) {
|
||||
var me = this;
|
||||
let tab = me.newsList[index];
|
||||
let option = me.tabBars[index].id;
|
||||
|
||||
if (tab.isComplete) {
|
||||
return;
|
||||
}
|
||||
|
||||
me.$api.post('workflow/workflow/index', {option: option, page: tab.page}).then(res => {
|
||||
|
||||
tab.data = tab.data.concat(res.data);
|
||||
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
if (res.current_page >= res.last_page) {
|
||||
tab.isComplete = true;
|
||||
} else {
|
||||
tab.page = res.current_page + 1;
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
});
|
||||
},
|
||||
goDetail: function(e) {
|
||||
// if (!/前|刚刚/.test(e.published_at)) {
|
||||
// e.published_at = dateUtils.format(e.published_at);
|
||||
// }
|
||||
let detail = {
|
||||
author_name: e.author_name,
|
||||
cover: e.cover,
|
||||
id: e.id,
|
||||
post_id: e.post_id,
|
||||
published_at: e.published_at,
|
||||
title: e.title
|
||||
};
|
||||
uni.navigateTo({
|
||||
url: '../list2detail-detail/list2detail-detail?detailDate=' + encodeURIComponent(JSON.stringify(detail))
|
||||
});
|
||||
},
|
||||
setTime: function(items) {
|
||||
var newItems = [];
|
||||
items.forEach(e => {
|
||||
newItems.push({
|
||||
author_name: e.author_name,
|
||||
cover: e.cover,
|
||||
id: e.id,
|
||||
post_id: e.post_id,
|
||||
published_at: dateUtils.format(e.published_at),
|
||||
title: e.title
|
||||
});
|
||||
});
|
||||
return newItems;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.uni-media-list-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.uni-media-list-body {
|
||||
height: auto;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.uni-media-list-text-top {
|
||||
height: 50rpx;
|
||||
font-size: 28rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom {
|
||||
/*
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
*/
|
||||
}
|
||||
|
||||
.uni-media-list-text-bottom .desc {
|
||||
margin-bottom: 15rpx;
|
||||
display: block;
|
||||
}
|
||||
.uni-media-list-text-bottom .desc:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #c8c7cc;
|
||||
}
|
||||
|
||||
.line-h {
|
||||
height: 1rpx;
|
||||
background-color: #cccccc;
|
||||
}
|
||||
|
||||
.uni-tab-item {
|
||||
display: inline-block;
|
||||
/*
|
||||
padding-left: 70rpx;
|
||||
padding-right: 70rpx;
|
||||
*/
|
||||
text-align: center;
|
||||
width: 33.33333%;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: 30rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
flex: 1;
|
||||
/* #ifndef MP-ALIPAY */
|
||||
flex-direction: column;
|
||||
/* #endif */
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.update-tips {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 41px;
|
||||
right: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
background-color: #FDDD9B;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.update-tips-text {
|
||||
font-size: 14px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.refresh {
|
||||
width: 750rpx;
|
||||
height: 64px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.refresh-view {
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.refresh-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
transition-duration: .5s;
|
||||
transition-property: transform;
|
||||
transform: rotate(0deg);
|
||||
transform-origin: 15px 15px;
|
||||
}
|
||||
|
||||
.refresh-icon-active {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.loading-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 5px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
margin-left: 2px;
|
||||
font-size: 16px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.loading-more {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.loading-more-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.search-controller {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.search-result {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-result-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<!-- remove list-cell layer fix android 4.x overflow limit error: 28 layers! -->
|
||||
<!-- <view class="list-cell view" @click="click"></view> -->
|
||||
<view class="media-item view" hover-class="media-item-hover" v-if="options.title" @click="click">
|
||||
<!-- <view class="view" :style="options.article_type === 2 ? 'flex-direction: row';" :class="{'media-image-right': options.article_type === 2, 'media-image-left': options.article_type === 1}"> -->
|
||||
<!-- TODO 在支付宝小程序下 需要用 style 覆盖标签的默认样式 -->
|
||||
<view class="view" :style="{flexDirection: (options.article_type === 1 || options.article_type === 2)?(options.article_type === 2 ?'row':'row-reverse'):'column' }">
|
||||
<text class="media-title" :class="{'media-title2': options.article_type === 1 || options.article_type === 2}">{{options.title}}</text>
|
||||
<view v-if="options.image_list || options.image_url" class="image-section flex-row" :class="{'image-section-right': options.article_type === 2, 'image-section-left': options.article_type === 1}"
|
||||
:style="{flexDirection: 'row' }">
|
||||
<image class="image-list1" :class="{'image-list2': options.article_type === 1 || options.article_type === 2}" v-if="options.image_url"
|
||||
:src="options.image_url"></image>
|
||||
<image class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list"
|
||||
:key="i" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="media-foot flex-row" style="flex-direction: row;">
|
||||
<view class="media-info flex-row" style="flex-direction: row;">
|
||||
<text class="info-text">{{options.source}}</text>
|
||||
<text class="info-text">{{options.comment_count}}条评论</text>
|
||||
<text class="info-text">{{options.datetime}}</text>
|
||||
</view>
|
||||
<!--
|
||||
<view class="max-close-view" @click.stop="close">
|
||||
<view class="close-l close-h"></view>
|
||||
<view class="close-l close-v"></view>
|
||||
</view>
|
||||
-->
|
||||
</view>
|
||||
<view class="media-item-line" style="position: absolute;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
options: {
|
||||
type: Object,
|
||||
default: function(e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
click() {
|
||||
this.$emit('click');
|
||||
},
|
||||
close(e) {
|
||||
this.$emit('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.view {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flex-row {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.list-cell {
|
||||
width: 750rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.uni-list-cell-hover {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.media-item {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
/* border-bottom-width: 1rpx;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: #ebebeb; */
|
||||
padding: 20rpx 30rpx 21rpx 30rpx;
|
||||
}
|
||||
|
||||
.media-item-hover{
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.media-item-line {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
bottom: 0;
|
||||
height: 1rpx;
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
|
||||
.media-image-right {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.media-image-left {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.media-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.media-title {
|
||||
lines: 3;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 30rpx;
|
||||
color: #555555;
|
||||
}
|
||||
|
||||
.media-title2 {
|
||||
flex: 1;
|
||||
margin-top: 6rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.image-section {
|
||||
margin-top: 20rpx;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.image-section-right {
|
||||
margin-top: 0rpx;
|
||||
margin-left: 10rpx;
|
||||
width: 225rpx;
|
||||
height: 146rpx;
|
||||
}
|
||||
|
||||
.image-section-left {
|
||||
margin-top: 0rpx;
|
||||
margin-right: 10rpx;
|
||||
width: 225rpx;
|
||||
height: 146rpx;
|
||||
}
|
||||
|
||||
.image-list1 {
|
||||
width: 690rpx;
|
||||
height: 481rpx;
|
||||
}
|
||||
|
||||
.image-list2 {
|
||||
width: 225rpx;
|
||||
height: 146rpx;
|
||||
}
|
||||
|
||||
.image-list3 {
|
||||
width: 225rpx;
|
||||
height: 146rpx;
|
||||
}
|
||||
|
||||
.media-info {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.info-text {
|
||||
margin-right: 20rpx;
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.media-foot {
|
||||
margin-top: 25rpx;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.max-close-view {
|
||||
position: relative;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
width: 40rpx;
|
||||
height: 30rpx;
|
||||
line-height: 30rpx;
|
||||
border-width: 1rpx;
|
||||
border-style: solid;
|
||||
border-color: #aaaaaa;
|
||||
border-radius: 4px;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.close-l {
|
||||
position: absolute;
|
||||
width: 18rpx;
|
||||
height: 1rpx;
|
||||
background-color: #aaaaaa;
|
||||
}
|
||||
|
||||
.close-h {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.close-v {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user