|
@@ -66,7 +66,20 @@
|
|
|
<el-form-item
|
|
|
:prop="'classs.' + type + '.cycle.' + scope.$index + '.time'"
|
|
|
inline-message>
|
|
|
- <el-input disabled v-model="scope.row.time" placeholder="请输入课程时长"/>
|
|
|
+ <el-select v-model.trim="scope.row.time"
|
|
|
+ style="width:100%!important"
|
|
|
+ placeholder="请选择课程时长"
|
|
|
+ clearable
|
|
|
+ :disabled="!!selectPrice"
|
|
|
+ @change="startTimeChange(scope.row)"
|
|
|
+ filterable>
|
|
|
+ <el-option v-for="(item,index) in pricesArray"
|
|
|
+ :key="index"
|
|
|
+ :label="item"
|
|
|
+ :value="item">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <!-- <el-input disabled v-model="scope.row.time" placeholder="请输入课程时长"/> -->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -84,7 +97,7 @@
|
|
|
format='HH:mm'
|
|
|
value-format='HH:mm'
|
|
|
placeholder="请选择时间"
|
|
|
- @change="val => startTimeChange(val, scope.row)"
|
|
|
+ @change="startTimeChange(scope.row)"
|
|
|
:picker-options="{
|
|
|
selectableRange: ['04:30:00 - 23:59:59']
|
|
|
}">
|
|
@@ -127,7 +140,7 @@
|
|
|
type="info"
|
|
|
size="small"
|
|
|
plain
|
|
|
- :disabled="surplustime < classTimeListByType[type]"
|
|
|
+ :disabled="surplustime < (selectPrice || 0) || Math.min(...pricesArray)"
|
|
|
@click="create"
|
|
|
style="margin-top: 10px;width: 100%;"
|
|
|
>添加循环</el-button>
|
|
@@ -144,7 +157,7 @@ for (const item of classTimeList) {
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
- props: ['form', 'type', 'surplustime'],
|
|
|
+ props: ['form', 'type', 'surplustime', 'prices', 'selectPrice'],
|
|
|
data() {
|
|
|
return {
|
|
|
classTimeListByType,
|
|
@@ -169,21 +182,27 @@ export default {
|
|
|
{ value: "6", label: "星期六" },
|
|
|
{ value: "7", label: "星期日" }
|
|
|
]
|
|
|
+ },
|
|
|
+ pricesArray() {
|
|
|
+ console.log(this.prices, this.type)
|
|
|
+ return (this.prices[this.type] || '').split(',') || []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
create() {
|
|
|
- this.form.cycle.push({
|
|
|
- time: classTimeListByType[this.type]
|
|
|
- })
|
|
|
+ const initVal = {}
|
|
|
+ if (this.selectPrice) {
|
|
|
+ initVal.time = this.selectPrice
|
|
|
+ }
|
|
|
+ this.form.cycle.push(initVal)
|
|
|
},
|
|
|
remove(index) {
|
|
|
this.form.cycle.splice(index, 1)
|
|
|
},
|
|
|
- startTimeChange(val, item) {
|
|
|
- if (val) {
|
|
|
+ startTimeChange(item) {
|
|
|
+ if (item.time && item.startClassTime) {
|
|
|
let str = dayjs(new Date()).format('YYYY-MM-DD')
|
|
|
- this.$set(item, 'endClassTime', addTimerFormMinute(str, val, item.time))
|
|
|
+ this.$set(item, 'endClassTime', addTimerFormMinute(str, item.startClassTime, item.time))
|
|
|
} else {
|
|
|
this.$set(item, 'endClassTime', '')
|
|
|
}
|