<template>
	<!-- 选择流转步骤 -->
	<view>
		<u-navbar title="选择流转步骤" autoBack placeholder></u-navbar>
		<view style="display: flex;flex-direction: column;">
			<view class="step_title_item frame" v-for="(item,index) in columns" :key="index" @click="selectStep(item)">
				<span>{{item}}</span>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				columns: [],
				current: '',
			}
		},
		onLoad(value) {
			this.current = value.current
		},
		mounted() {
			var userInfo = this.$cache.getCache('userInfo')
			let arrData = []
			if (userInfo.provUser) {
				if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {
					// 送气员端
					if (this.current == '1') {
						arrData.push('门店确认未配送重瓶返库')
					} else if (this.current == '2') {
						arrData.push('门店回收空瓶')
					} else {
						arrData.push('门店回收不合格瓶')
					}
				} else if (userInfo.provUser.userType == 3) {
					// 门店端
					if (this.current == '1') {
						let arrmd = ['送气员领重瓶出库', '司机确认重瓶从门店出库']
						arrData = arrmd
					} else if (this.current == '2') {
						arrData.push('司机确认空瓶装车')
					} else {
						arrData.push('司机回收不合格瓶')
					}
				} else if (userInfo.provUser.userType == 4) {
					// 司机端
					if (this.current == '1') {
						let arrsj = ['门店确认重瓶卸货入库', '气站确认重瓶到达气站']
						arrData = arrsj
					} else if (this.current == '2') {
						arrData.push('气站确认空瓶到达气站')
					} else {
						let arrsjbhg = ['门店回收不合格瓶', '气站回收不合格瓶']
						arrData = arrsjbhg
					}
				} else if (userInfo.provUser.userType == 5) {
					// 气站端
					if (this.current == '1') {
						arrData.push('司机确定重瓶从气站出库')
					} else if (this.current == '2') {
						arrData.push('')
					} else {
						arrData.push('司机回收不合格瓶')
					}
				}
			} else {
				// 送气员端
				if (this.current == '1') {
					arrData.push('门店确认未配送重瓶返库')
				} else if (this.current == '2') {
					arrData.push('门店回收空瓶')
				} else {
					arrData.push('门店回收不合格瓶')
				}
			}
			this.columns = arrData
		},
		methods: {
			selectStep(value) {
				let flowId = ''
				if (value == '门店确认未配送重瓶返库') {
					flowId = '35'
				} else if (value == '门店回收空瓶') {
					flowId = '21'
				} else if (value == '门店回收不合格瓶') {
					flowId = 'md' + this.current
				} else if (value == '送气员领重瓶出库') {
					flowId = '25'
				} else if (value == '司机确认重瓶从门店出库') {
					flowId = '033'
				} else if (value == '司机确定重瓶从气站出库') {
					flowId = '17'
				} else if (value == '司机确认空瓶装车') {
					flowId = '11'
				} else if (value == '司机回收不合格瓶') {
					flowId = 'sj' + this.current
				} else if (value == '门店确认重瓶卸货入库') {
					flowId = '31'
				} else if (value == '气站确认重瓶到达气站') {
					flowId = '016'
				} else if (value == '气站确认空瓶到达气站') {
					flowId = '13'
				} else if (value == '门店回收不合格瓶') {
					flowId = 'md' + this.current
				} else if (value == '气站回收不合格瓶') {
					flowId = 'qz' + this.current
				}
				uni.navigateTo({
					url: '/pages/information/storePersonnel?flowId=' + flowId + '&flowName=' + value
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.step_title_item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx;
	}
</style>