<!-- 帮助反馈页面 -->
<template>
	<view>
		<view class="xsads">
			<view class="" style="font-size: 38rpx;color: #ffffff;font-weight: 600;">投诉中心</view>
			<view class="" style="font-size: 28rpx;color: #ffffff;margin-top: 10rpx;">倾听您的声音，保障您的权益</view>
		</view>
		<view class="uselist flex align-center" style="justify-content: space-evenly;">
			<view class="" style="text-align: center;" @click="goHistory">
				<view class="">
					<image src="../../static/jdskald.png" style="width: 74rpx;height: 60rpx;"></image>
				</view>
				<view class="text-feedback" hover-class="hover">历史消息</view>
			</view>
			<view class="" style="text-align: center;" @click="showType = true">
				<view class="">
					<image src="../../static/bbn.png" style="width: 62rpx;height: 60rpx;"></image>
				</view>
				<view class="text-feedback" hover-class="hover">我要投诉</view>
			</view>
		</view>

		<u-action-sheet :list="typeList" v-model="showType" @click="typeCallback"></u-action-sheet>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				helpClassifyList: [],
				typeList: [{
					text: '投诉技师',
					label: '/my/feedback/tsjsForm'
				}, {
					text: '投诉平台',
					label: '/my/feedback/indexts?type=7'
				}],
				showType: false,
				newTypeList: [],
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			typeCallback(index) {
				uni.navigateTo({
					url: this.typeList[index].label,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			openList(item) {
				var oldhelpClassifyList = item
				if (oldhelpClassifyList.parentId == 1) {
					item.parentId = 0
				} else {
					item.parentId = 1
				}
			},
			getlist() {
				let data = {
					types: 1
				}
				this.$Request.get("/app/helpWord/selectHelpList", data).then(res => {
					if (res.code == 0) {
						this.helpClassifyList = res.data
						for (var i = 0; i < this.helpClassifyList.length; i++) {
							this.helpClassifyList[i].parentId = 1
						}
						// this.helpClassifyList.isTrue = false

					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				});
			},
			onClick(item) {
				console.log(item.helpWordId)
				// return
				uni.navigateTo({

					url: '/my/help/helpDetail?helpWordId=' + item.helpWordId
				})

			},
			goChat() {
				let kefu = this.$queue.getData('kefu'); // 用户端联系方式 1 手机号 2企业微信 
				let kefuPhone = this.$queue.getData('kefuPhone');
				if (kefu == 1) {
					uni.makePhoneCall({
						phoneNumber: kefuPhone //仅为示例
					});
				} else if (kefu == 3) {
					uni.navigateTo({
						url: '/my/setting/customer'
					});
				} else {
					// #ifdef MP-WEIXIN
					let that = this
					try {
						wx.openCustomerServiceChat({
							extInfo: {
								url: that.$queue.getData('kefuUrl')
							},
							corpId: that.$queue.getData('kefuAppId'),
							success(res) {},
							fail(res) {
								console.error(res)
							}
						})
					} catch (error) {
						console.error("catchcatch" + error)
						uni.showToast({
							title: '请更新至微信最新版本'
						});
					}
					// #endif
					// #ifndef MP-WEIXIN
					let url = that.$queue.getData('kefuUrl');
					if (url.indexOf('/pages/') !== -1 || url.indexOf('/my/') !== -1) {
						uni.navigateTo({
							url
						});
					} else {
						//#ifndef H5
						uni.navigateTo({
							url: '/pages/index/webView?url=' + url
						});
						//#endif
						//#ifdef H5
						window.location.href = url;
						//#endif
					}
					// #endif
				}
			},
			goHistory() {
				uni.navigateTo({
					url: '/my/feedback/tshistory',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	page {
		background-color: #f7f7f7;
		height: 100%;
	}

	.xsads {
		width: 100%;
		height: 380rpx;
		background: url(../../static/wentias.png) center;
		background-size: cover;
		padding: 40rpx 30rpx;
	}


	.bg-box {
		background-color: #FFFFFF;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
	}

	.uselist {
		background-color: #FFFFFF;
		padding: 50rpx 30rpx;
		margin-top: -200rpx;
		border-radius: 10px;
		width: 92%;
		margin-left: 4%;
	}

	.bg-list {
		width: 92%;
		margin-left: 4%;
		margin-bottom: 100rpx;
		background-color: #FFFFFF;
		padding: 50rpx 30rpx;
		margin-top: 20rpx;
		border-radius: 10px;
	}



	.vertical-line {
		height: 20rpx;
		background-color: #cecece;
		width: 2rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
	}

	.line {
		width: 100%;
		height: 1rpx;
		background-color: #d3d3d3;
	}



	.text-title {
		color: #000;
		font-size: 32rpx;
		font-weight: bold;
	}

	.text-item {
		color: #999999;
		font-size: 28rpx;
		padding: 24rpx 0rpx;
	}

	.list-title {
		margin-bottom: 30rpx;
	}

	.list-question {
		color: #000;
		font-size: 28rpx;
	}

	.hover {
		background-color: #ffffff;
		opacity: 0.6;
	}

	.image {
		width: 40rpx;
		height: 40rpx;
		margin-left: 20rpx;
	}

	.text-feedback {
		font-size: 30rpx;
		font-weight: 600;
		margin-top: 8rpx;
	}

	.text-top {
		margin: 30rpx;
		color: #000;
		font-size: 34rpx;
	}
</style>