this.$getUrlType()<template>
	<view>
		<view style="padding: 30rpx;">
			<view style="font-size: 30rpx;color: #b8b8b8;">
				下单备注：
			</view>
			<view style="font-size: 40rpx;color: #9d9d9d;padding: 0 20rpx;">
				<view v-if="data.remark">
					{{data.remark}}
				</view>
				<view v-else>
					无
				</view>
			</view>
		</view>
		<view style="padding: 30rpx;overflow: auto; height:650rpx;">
			<uni-steps :options="list" :active="active" direction="column" active-color="rgb(55,186,189)" />
			<view v-if="data.statusText === '已回收'">
				<button style="width: 600rpx;" @click="backOd">退单</button>
			</view>
			<view v-if="data.statusText === '已下单'">
				<button style="width: 600rpx;" @click="backOd">退单</button>
			</view>
		</view>
		<view v-if="data.statusText !== '已完成'" style="padding: 0 30rpx 30rpx 30rpx;background-color: #f5f5f5;">
			<view style="color: #9a9a9a;padding: 10rpx;">
				问题反馈
			</view>
			<view style="margin-bottom: 40rpx;">
				<u-textarea v-model="form.processDesc" border></u-textarea>
			</view>
			<u-button text="发送" color="rgb(55,186,189)" @click="clientSubmit"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					orderNo: uni.getStorageSync("order").orderNumber,
					userCode: uni.getStorageSync("setUserName"),
					processDesc: '',
				},
				list: [],
				data: uni.getStorageSync("order"),
				active: 0
			}
		},
		onLoad() {
			this.getList()
			this.newsToOne()
		},
		onShow() {
			this.newsToOne()
		},
		methods: {
			async backOd() {
				const {
					data: res
				} = await this.$httpRequest({
					url: '/app/backOd?on=' + this.data.orderNumber,
					method: 'get',
					urlType: this.$getUrlType()
				});
				if (res.code === 200) {
					this.data.statusText = '已完成'
					uni.redirectTo({
						url: '../../pages/user/index',
						success() {
							uni.showModal({
								title: "提示",
								content: "积分已退还，订单结束",
								showCancel: false,
								confirmColor: 'rgb(55,186,189)'
							})
						}
					})
				}
			},
			async clientSubmit() {
				if (!this.form.processDesc) {
					this.$showModal("请填写反馈")
					return
				}
				const {
					data: res
				} = await this.$httpRequest({
					url: '/app/clientSubmit',
					method: 'post',
					data: this.form,
					urlType: 2
				});
				if (res.code === 200) {
					this.form.processDesc = ''
					this.getList()
				}
			},
			async newsToOne() {
				const {
					data: res
				} = await this.$httpRequest({
					url: '/app/nto?on=' + this.data.orderNumber,
					method: 'get',
					urlType: this.$getUrlType()
				});
			},
			async getList() {
				this.list = []
				const {
					data: res
				} = await this.$httpRequest({
					url: '/app/opl?uc=' + uni.getStorageSync("userInfo").userName + "&on=" + this.data
						.orderNumber,
					method: 'get',
					urlType: this.$getUrlType()
				});
				if (res.code === 200) {
					let data = res.data
					for (var i = 0; i < data.length; i++) {
						if (data[i].processStatus) {
							this.list.push({
								title: data[i].processStatus + " : " + data[i].processDesc,
								desc: data[i].processDate
							})
						} else {
							this.list.push({
								title: data[i].processDesc,
								desc: data[i].processDate
							})
						}
						if (data[i].processDate) {
							this.active = i
						}
					}
				} else {
					uni.showToast({
						duration: 2500,
						title: res.msg,
						icon: 'error',
					});
				}
			}
		}
	}
</script>

<style>

</style>
