jufubao-admin-library 1.1.10 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,39 @@
44
44
  </div> -->
45
45
  </el-form-item>
46
46
  </el-form>
47
+ </template>
48
+ <template slot="time">
49
+ <el-form-item label="">
50
+ <div class="time_pick" v-for="(item,index) in handTimeOptions" :key="index" style="margin-bottom:5px">
51
+ <el-select
52
+ v-model="item.start"
53
+ placeholder="开始时间"
54
+ clearable
55
+ >
56
+ <el-option
57
+ :key="item.value"
58
+ v-for="item in timeList"
59
+ :label="item.label"
60
+ :value="item.value"
61
+ ></el-option>
62
+ </el-select>
63
+ <span class="dis_in_mar10">至</span>
64
+ <el-select
65
+ v-model="item.end"
66
+ placeholder="结束时间"
67
+ clearable
68
+ >
69
+ <el-option
70
+ :key="item.value"
71
+ v-for="item in timeList"
72
+ :label="item.label"
73
+ :value="item.value"
74
+ ></el-option>
75
+ </el-select>
76
+ <i v-if="(index + 1) === handTimeOptions.length" class="el-icon-circle-plus ml5" @click="add(item)" ></i>
77
+ <i v-if="handTimeOptions.length > 1" class="el-icon-remove ml5" @click="remove(index)"></i>
78
+ </div>
79
+ </el-form-item>
47
80
  </template>
48
81
  </xd-base-dynamic-field>
49
82
  <div class="adjust-btn" style="margin-left: 140px">
@@ -92,6 +125,81 @@
92
125
  { required: true, message: '请选择标签', trigger: 'change' }
93
126
  ],
94
127
  },
128
+ valueFormat: 'HH',
129
+ pickerOptions: { start: '01',end:'00',step:'01' },
130
+ handTimeOptions:[{start:'',end:''}],
131
+ timeList:[
132
+ {
133
+ lebel:'1',
134
+ value:'1',
135
+ },{
136
+ lebel:'2',
137
+ value:'2',
138
+ },{
139
+ lebel:'3',
140
+ value:'3',
141
+ },{
142
+ lebel:'4',
143
+ value:'4',
144
+ },{
145
+ lebel:'5',
146
+ value:'5',
147
+ },{
148
+ lebel:'6',
149
+ value:'6',
150
+ },{
151
+ lebel:'7',
152
+ value:'7',
153
+ },{
154
+ lebel:'8',
155
+ value:'8',
156
+ },{
157
+ lebel:'9',
158
+ value:'9',
159
+ },{
160
+ lebel:'10',
161
+ value:'10',
162
+ },{
163
+ lebel:'11',
164
+ value:'11',
165
+ },{
166
+ lebel:'12',
167
+ value:'12',
168
+ },{
169
+ lebel:'13',
170
+ value:'13',
171
+ },{
172
+ lebel:'14',
173
+ value:'14',
174
+ },{
175
+ lebel:'15',
176
+ value:'15',
177
+ },{
178
+ lebel:'16',
179
+ value:'16',
180
+ },{
181
+ lebel:'17',
182
+ value:'17',
183
+ },{
184
+ lebel:'18',
185
+ value:'18',
186
+ },{
187
+ lebel:'19',
188
+ value:'19',
189
+ },{
190
+ lebel:'20',
191
+ value:'20',
192
+ },{
193
+ lebel:'21',
194
+ value:'21',
195
+ },{
196
+ lebel:'22',
197
+ value:'22',
198
+ },{
199
+ lebel:'23',
200
+ value:'23',
201
+ },
202
+ ]
95
203
  }
96
204
  },
97
205
  computed: {
@@ -138,6 +246,13 @@
138
246
  //电影
139
247
  if(this.isMovie) {
140
248
  formData = this.setMovieForm(res.data)
249
+ if(res.data.valid_week_hours){
250
+ if(!JSON.parse(res.data.valid_week_hours).length){
251
+ this.handTimeOptions = [{start:'',end:''}]
252
+ }else{
253
+ this.handTimeOptions = JSON.parse(res.data.valid_week_hours)
254
+ }
255
+ }
141
256
  }
142
257
 
143
258
  //非电影初始化
@@ -299,6 +414,25 @@
299
414
  .then(() => {
300
415
  const {select_policy_id} = this;
301
416
  let postData = this.getSectionParams();
417
+ if(this.handTimeOptions.length){
418
+ let noData = [];
419
+ for(let i=0;i<this.handTimeOptions.length;i++){
420
+ if((!this.handTimeOptions[i]['start']&&this.handTimeOptions[i]['end'])||(this.handTimeOptions[i]['start']&&!this.handTimeOptions[i]['end'])){
421
+ this.$message.error('请选择时间')
422
+ return
423
+ }
424
+ if(this.handTimeOptions[i]['end']<this.handTimeOptions[i]['start']){
425
+ this.$message.error('开始时间不能大于结束时间')
426
+ return
427
+ }
428
+ if(this.handTimeOptions[i]['start']&&this.handTimeOptions[i]['end']){
429
+ postData.valid_week_hours = JSON.stringify(this.handTimeOptions)
430
+ }
431
+ }
432
+ if(this.handTimeOptions.length==1&&!this.handTimeOptions[0]['start']&&!this.handTimeOptions[0]['end']){
433
+ postData.valid_week_hours = JSON.stringify(noData)
434
+ }
435
+ }
302
436
 
303
437
  let fn = 'createRole';
304
438
  let params = {
@@ -353,7 +487,23 @@
353
487
 
354
488
  handleBack(){
355
489
  this.$router.back()
356
- }
490
+ },
491
+
492
+ add(item) {
493
+ console.log(item,this.handTimeOptions,'this.handTimeOptions')
494
+ if(!item.start||!item.end){
495
+ this.$message.error('请选择时间')
496
+ return
497
+ }
498
+ if(this.handTimeOptions.length>=10){
499
+ this.$message.error('最多支持设置10条')
500
+ return
501
+ }
502
+ this.handTimeOptions.push({start:'',end:''});
503
+ },
504
+ remove(index) {
505
+ this.handTimeOptions.splice(index, 1);
506
+ },
357
507
 
358
508
  }
359
509
  }
@@ -420,4 +570,20 @@
420
570
  .mr10{
421
571
  margin-right: 10px;
422
572
  }
573
+ .el-icon-circle-plus {
574
+ font-size: 22px;
575
+ color: #42B983;
576
+ }
577
+
578
+ .el-icon-remove {
579
+ font-size: 22px;
580
+ color: #F56C6C;
581
+ }
582
+ .dis_in_mar10{
583
+ display: inline-block;
584
+ margin: 0 10px;
585
+ }
586
+ .ml5{
587
+ margin-left: 5px;
588
+ }
423
589
  </style>
@@ -30,7 +30,16 @@ export default {
30
30
  if (n && n !== o) {
31
31
  this.initForm(this.listValue)
32
32
  }
33
- }
33
+ },
34
+ 'listValue.valid_weeks': {
35
+ handler (n, o) {
36
+ console.log(n,o,'pppppp')
37
+ if (n && JSON.stringify(n) !== JSON.stringify(o)) {
38
+ console.log(n, o, 'pppp')
39
+ this.initForm(this.listValue)
40
+ }
41
+ }
42
+ },
34
43
  },
35
44
  data () {
36
45
  return {
@@ -692,6 +701,11 @@ export default {
692
701
  { "label": "星期日", "value": 0 }
693
702
  ]
694
703
  },
704
+ params.valid_weeks && params.valid_weeks.length&&{
705
+ lebel: '',
706
+ ele: 'slot',
707
+ slot:'time'
708
+ },
695
709
  {
696
710
  label: '按价格:',
697
711
  ele: 'xd-input-range',
@@ -108,7 +108,7 @@
108
108
  this.formData = {};
109
109
  this.formData.formula_unit = res.data.change_json.method;
110
110
  this.formData.formula_value = res.data.change_json.value;
111
- this.initFormList(this.formData,false)
111
+ this.initFormList({...res.data,...this.formData},false)
112
112
  } else {
113
113
  this.initFormList({},false)
114
114
  }
@@ -180,7 +180,7 @@
180
180
  valueKey: 'formula_value',
181
181
  value: params.formula_unit===this.formData.formula_unit?this.formData.formula_value:'',
182
182
  setting: {
183
- unit: params.formula_unit == 'money' ? '' : '%',
183
+ unit: params.formula_unit == 'discount' ? '%' : '',
184
184
  tips: params.formula_unit == 'money' ? '可设置正负值' : '可设置正负值',
185
185
  pos: 'append'
186
186
  },
@@ -195,7 +195,7 @@
195
195
  valueKey: ["start_time", "end_time"],
196
196
  value:
197
197
  params.start_time && params.end_time
198
- ? [params.start_time * 1000, params.end_time * 1000]
198
+ ? [params.start_time.toString().length===10? params.start_time* 1000:params.start_time, params.end_time.toString().length===10? params.end_time* 1000:params.end_time]
199
199
  : [],
200
200
  format: "yyyy/MM/dd HH:mm:ss",
201
201
  formatValue: "timestamp",
@@ -220,9 +220,17 @@
220
220
  handleSearch({action, form}) {
221
221
  console.log(action, 'action')
222
222
  },
223
+ isInter(num){
224
+ return num%1===0
225
+ },
223
226
  /**保存**/
224
227
  handleConfirm() {
225
- console.log(this.formParams, 'this.formParams')
228
+ this.$refs.form.submit().then(res => {
229
+ console.log(this.formParams, 'this.formParams')
230
+ if(this.formParams.formula_unit==='money'&&!this.isInter(this.formParams.formula_value)){
231
+ this.$message.error('金额必须是整数')
232
+ return
233
+ }
226
234
  let data = {
227
235
  change_json:{
228
236
  method:'',
@@ -263,6 +271,11 @@
263
271
 
264
272
  })
265
273
  }
274
+ })
275
+ .catch(err=>{
276
+ console.log(err,'err')
277
+ })
278
+
266
279
  },
267
280
  }
268
281
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-admin-library",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "聚福宝福利后台管理系统公共模块",
5
5
  "author": "goashiyong <gaoshiyong1272@vip.163.com>",
6
6
  "scripts": {