<style>
	.activityList {
		background-color: #F3F5F7;
		padding: 15px;
	}

	.activityList .activeList {
		background-color: #fff;
		margin-bottom: 15px;
		padding: 15px;
	}

	.activityList .activeTop {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.activityList .zixunLeftTitle {
		color: #111111;
		font-size: 14px;
		font-weight: bold;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.activityList .activeBtm {
		display: flex;
		margin-top: 10px;
		font-size:12px;
		color:#B9B9B9;
		justify-content: space-between;
	}
	.zixunComLeft{
		display: inline-block;
		width:60px;
		text-align: right;
		flex-shrink: 0;
	}
	.zixunMainList{
		display:flex;
		width:50%;
	}
	.zixunRight{
		width:100%;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.zixunStatus{
		font-size: 13px;
		color:#111111;
	}
</style>
<template>
	<view class="activityList" style="height:100vh;display: flex; flex-direction: column;">
		<view style="width: 100%;text-align: right;margin-bottom: 20rpx;">
			<u-button :ripple="true" type="primary" size="mini" @click="navigatorToAdd" v-if="type!=0">填写投诉建议</u-button>
		</view>
		<u-empty v-if="dataList.length==0" text="暂无数据" mode="data"></u-empty>
		<scroll-view v-else :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" @scrolltolower="lower" style="flex:1;width: 100%;height: 1rpx;">
			<view v-if="type==0">
				<view class="activeList" v-for="(item,index) in dataList" :key="index" @click="goZixunDetail(item)">
					<view class="activeTop">
						<view class="zixunLeftTitle">{{item.FatQuestion}}</view>
						<view style="display: flex;align-items: center;">
							<text class="zixunStatus">{{item.AskStatusStr}}</text>
							<image style="width:20px;height:20px;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/arrow_right.png"
							 mode=""></image>
						</view>
					</view>
					<view class="activeBtm">
						<view class="zixunMainList">
							<view class="zixunComLeft">公司名称：</view>
							<view class="zixunRight">{{item.CompanyName}}</view>
						</view>
						<view class="zixunMainList">
							<view class="zixunComLeft">海关编码：</view>
							<view class="zixunRight">{{item.FatCode}}</view>
						</view>
					</view>
					<view class="activeBtm">
						<view class="zixunMainList">
							<view class="zixunComLeft">联系人：</view>
							<view class="zixunRight">{{item.Principal}}</view>
						</view>
						<view class="zixunMainList">
							<view class="zixunComLeft">联系电话：</view>
							<view class="zixunRight">{{item.Mobile}}</view>
						</view>
					</view>
					<view class="activeBtm">
						<view class="zixunMainList">
							<view class="zixunComLeft">邮箱：</view>
							<view class="zixunRight">{{item.EMail}}</view>
						</view>
						<view class="zixunMainList">
							<view class="zixunComLeft">咨询标题：</view>
							<view class="zixunRight">{{item.FatTitle}}</view>
						</view>
					</view>
				</view>
			</view>
			<view v-else>
				<view class="activeList" v-for="(item,index) in dataList" :key="index" @click="goZixunDetail(item)">
					<view class="activeTop">
						<view class="zixunLeftTitle">{{item.FatQuestion}}</view>
						<view style="display: flex;align-items: center;">
							<text class="zixunStatus">{{item.AskStatusStr}}</text>
							<image style="width:20px;height:20px;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/arrow_right.png"
							 mode=""></image>
						</view>
					</view>
					<view class="activeBtm">
						<view class="zixunMainList" style="width: 100%;font-size: 22rpx; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;">
							<view class="zixunComLeft">提交时间：</view>
							<view class="zixunRight">{{item.CreateDate.replace('T',' ')}}</view>
						</view>
					</view>
				</view>
			</view>
			<view style="padding:10px 0;">
				<u-loadmore :status="status" :load-text="loadText" bg-color="#F3F5F7" :font-size="24" :margin-top="0" :margin-bottom="0" />
			</view>
		</scroll-view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				pageTitle: '咨询信息',
				qmsg: {
					pageIndex: 1,
					pageSize: 20
				},
				pageCount: 1,
				dataList: [],
				loadText: {
					loadmore: "轻轻上拉，加载更多",
					loading: "努力加载中",
					nomore: "没有更多了",
				},
				status:'',
				type:0, //0表示咨询，1表示投诉
			}
		},
		created() {},
		mounted() {
			uni.setNavigationBarTitle({
				title: this.pageTitle,
			});
		},
		onLoad(option) {
			if(option.t){
				this.type=option.t
			}
			this.pageTitle = this.type==0?'咨询信息':'投诉建议'
			this.getList(1);
		},
		methods: {
			getList(num) {
				if (num == 1) {
					this.dataList = [];
				}
				this.request2({
						url: "/api/AppletTrade/GetCommerceAskPage",
						data: this.qmsg,
					},
					(res) => {
						if (res.resultCode == 1) {
							this.dataList = res.data.pageData;
							this.pageCount = res.data.pageCount;
						}
					}
				);
			},
			//滚动加载
			lower(e) {
				if (this.msg.pageIndex < this.pageCount) {
					this.msg.pageIndex++;
					this.status = "loading";
					this.getList();
				} else {
					this.status = "nomore";
				}
			},
			//跳转至活动详情
			goZixunDetail(item){
				uni.navigateTo({
					url: '/pages/kotra/zixunDetail?Id=' + item.Id+'&t='+this.type,					
				});
			},
			navigatorToAdd(){
				uni.navigateTo({
					url:'/pages/kotra/fat?t='+this.type
				})
			}
		}
	}
</script>
