<template>
	<view>
		<view class="con">
			<view class="cons">
				<view class="top ddflex">
					<view class="fflex">
						<view>使用兑换码</view>
						<text>绿萝云会员</text>
					</view>
					<image src="../static/product/image/dh_vip.png"></image>
				</view>
				<input v-model="code" placeholder="请输入兑换码" placeholder-class="placeholder" class="ma-ipt" />
				<view class="btn" @click="exchange">立即兑换</view>
			</view>
			<view class="tits">兑换须知</view>
			<view class="tip">
				<view>1.手动输入时，必须区分大小写。</view>
				<view>2.手动输入时，注意区分数字 0 和字母 0、大写的i和小写的L。</view>
				<view>3.按以上方法输入时，如仍无法兑换，可在[我的]页面 - 帮助中心反馈问题，并带上截图。</view>
			</view>
		</view>
	</view>
</template>

<script>
const app = getApp();
const req = require('../../utils/request.js');
const api = require('../../utils/api.js');
const util = require('../../utils/util.js');
export default {
	data() {
		return {
			picUrlss: req.public.picUrls,
			code: ''
		};
	},

	onLoad() {
	},
	methods: {
		exchange(){
			if(!this.code) return req.msg('请输入兑换码');
			req.msgConfirm('兑换后不可撤销，确认兑换吗？',suc=>{
				req.getRequest(api.coupon_exchange,{code: this.code},data=>{
					this.code = '';
					req.msg('兑换成功');
					setTimeout(res=>{
						uni.navigateTo({
							url: '/mine/coupons/coupons'
						})
					},300)
				})
			})
		},
		jumpUrl(url){
			uni.navigateTo({
				url: url
			})
		}
	}
};
</script>

<style>
@import './index.css';
</style>
