Blame view

pages/activityAdd/activityAdd.vue 3.15 KB
4dfe89e4   monkeyhouyi   初始化
1
2
  <template>
  	<view class="page">
4c26c806   monkeyhouyi   活动参与,活动申请
3
4
5
6
7
  		<u-form :model="form" ref="uForm" label-position="left" :label-width="150">
  			<view class="add-list" style="padding-bottom: 0;">
  				<u-form-item label="封面图片" borderBottom labelPosition="top">
  					<u-upload :active="active" :file-list="form.fileList" :max-count="1"></u-upload>
  				</u-form-item>
4dfe89e4   monkeyhouyi   初始化
8
  			</view>
4c26c806   monkeyhouyi   活动参与,活动申请
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  			<view class="add-list" style="padding-bottom: 0;">
  				<u-form-item label="活动名称" borderBottom>
  					<u-input v-model="form.name" />
  				</u-form-item>
  				<u-form-item label="开始时间" borderBottom>
  					<u-input v-model="form.startTime" type="select" @click="startShow = true" placeholder="请选择"/>
  					<u-picker mode="time" v-model="startShow" :params="params" @confirm="startTimeChange"></u-picker>
  				</u-form-item>
  				<u-form-item label="结束时间" borderBottom>
  					<u-input v-model="form.endTime" type="select" @click="endShow = true" placeholder="请选择"/>
  					<u-picker mode="time" v-model="endShow" :params="params" @confirm="endTimeChange"></u-picker>
  				</u-form-item>
  				<u-form-item label="活动类型" borderBottom>
  					<u-input v-model="form.type" type="select" @click="typeShow = true" placeholder="请选择"/>
  					<u-select v-model="typeShow" :list="typeList" @confirm="typeChange"></u-select>
  				</u-form-item>
  				<u-form-item label="可参与人数" borderBottom>
  					<u-number-box v-model="form.num" :input-width="'100%'" :min="0"></u-number-box>
  				</u-form-item>
  				<u-form-item label="举办区域" borderBottom>
  					<u-input v-model="form.name" />
  				</u-form-item>
4dfe89e4   monkeyhouyi   初始化
31
  			</view>
4c26c806   monkeyhouyi   活动参与,活动申请
32
33
  			<!-- <view class="add-list" style="padding-bottom: 0;">
  				<u-form-item label="活动内容" borderBottom labelPosition="top">
4c26c806   monkeyhouyi   活动参与,活动申请
34
35
36
37
  				</u-form-item>
  			</view> -->
  		</u-form>
  		<u-toast ref="uToast" />
4dfe89e4   monkeyhouyi   初始化
38
  		<!-- 保存按钮 -->
4c26c806   monkeyhouyi   活动参与,活动申请
39
  		<view style="height: 120rpx;"></view>
4dfe89e4   monkeyhouyi   初始化
40
  		<view class="page-footer">
4c26c806   monkeyhouyi   活动参与,活动申请
41
  			<u-button type="success">提交</u-button>
4dfe89e4   monkeyhouyi   初始化
42
43
44
45
46
47
48
49
  		</view>
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
4c26c806   monkeyhouyi   活动参与,活动申请
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  				form: {
  					fileList: [],
  					name: '',
  					type: '',
  					num: 0,
  					startTime: '',
  					endTime: '',
  				},
  				active: '', // 文件上传地址
  				startShow: false,
  				endShow: false,
  				params: {
  					year: true,
  					month: true,
  					day: true,
  					hour: true,
  					minute: true,
  					second: true
  				},
  				typeShow: false,
  				typeList: [{ value: '1', label: '类型1' }, { value: '2', label: '类型2' }],
1b38b4ce   monkeyhouyi   商铺、广告-列表、详情
71
72
  				readOnly: false,
  				formats: {}
4dfe89e4   monkeyhouyi   初始化
73
74
75
  			};
  		},
  		methods:{
4c26c806   monkeyhouyi   活动参与,活动申请
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  			startTimeChange(val) {
  				this.form.startTime = this.timeChange(val);
  				this.form.endTime = '';
  			},
  			endTimeChange(val) {
  				const time = this.timeChange(val);
  				if(new Date(time).getTime() > new Date(this.form.startTime).getTime()) {
  					this.form.endTime = time
  				} else {
  					this.$refs.uToast.show({
  						title: '结束时间不能小于开始时间',
  						type: 'error',
  					})
  				}
  			},
  			timeChange(val) {
  				const { year, month, day, hour, minute, second } = val;
  				return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
  			},
  			typeChange(val) {
  				this.form.type = val[0].name;
1b38b4ce   monkeyhouyi   商铺、广告-列表、详情
97
  			},
4dfe89e4   monkeyhouyi   初始化
98
99
100
101
102
103
104
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'activityAdd.scss';
  </style>