| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <view>
- <!-- <tui-list-cell class="line-cell" :hover="false" :arrow="true">-->
- <!-- <div class="tui-title">{{ dateLabel }}</div>-->
- <!-- <!– <picker-->
- <!-- mode="date"-->
- <!-- :value="sendTime"-->
- <!-- @change="selTimeFn"-->
- <!-- class="tui-input"-->
- <!-- >-->
- <!-- <div v-if="form.sendTime">{{ sendTime }}</div>-->
- <!-- <div class="tui-placeholder" v-else>请选择送达时间</div>-->
- <!-- </picker> –>-->
- <!-- <text>今天</text>-->
- <!-- </tui-list-cell>-->
- <tui-list-cell class="line-cell" :hover="false" :arrow="true">
- <div class="tui-title">{{ timeLabel }}</div>
- <picker style="width: 100%"
- mode="multiSelector"
- :range="timeList"
- :value="timeValue"
- @change="changeTimeFn"
- class="inp-select"
- >
- <div v-if="sendTime">{{ sendTime }}</div>
- <div class="tui-placeholder" v-else>{{ placeholder }}</div>
- </picker>
- </tui-list-cell>
- </view>
- </template>
- <script>
- import TuiListCell from "@/components/plugin/list-cell";
- export default {
- name: "AppSendTime",
- components: {
- TuiListCell
- },
- props: {
- sendDate: {
- type: String,
- default: ""
- },
- sendTime: {
- type: String,
- default: ""
- },
- dateLabel: {
- type: String,
- default: "配送日期"
- },
- timeLabel: {
- type: String,
- default: "配送时间"
- },
- placeholder: {
- type: String,
- default: "请选择具体时间"
- }
- },
- data() {
- return {
- timeList: [
- [
- "01",
- "02",
- "03",
- "04",
- "05",
- "06",
- "07",
- "08",
- "09",
- "10",
- "11",
- "12",
- "13",
- "14",
- "15",
- "16",
- "17",
- "18",
- "19",
- "20",
- "21",
- "22",
- "23",
- "24"
- ],
- ["00", "10", "20", "30", "40", "50"]
- ],
- timeValue: [0, 0]
- };
- },
- created() {
- let nowDate = new Date();
- this.$emit("update:sendDate", nowDate.Format("yyyy-MM-dd"));
- },
- methods: {
- changeTimeFn(e) {
- console.log(e);
- let oneIndex = e.detail.value[0] || 0;
- let twoIndex = e.detail.value[1] || 0;
- this.timeValue = e.detail.value;
- this.$emit("alterTime")
- this.$emit(
- "update:sendTime",
- this.timeList[0][oneIndex] + ":" + this.timeList[1][twoIndex]
- );
- }
- },
- watch: {
- sendTime(val) {
- if (val) {
- let indexList = val.split(":");
- let oneIndex = indexList[0] || 0;
- let twoIndex = indexList[1] || 0;
- this.timeValue = [oneIndex, twoIndex];
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped></style>
|