|
|
@@ -4,19 +4,46 @@
|
|
|
<block slot="content">添加营业时间</block>
|
|
|
</cu-custom>
|
|
|
<view class="tab-top bg-fff">
|
|
|
- <view class="title">营业日</view>
|
|
|
+ <view class="title ">营业日</view>
|
|
|
<view style="padding-bottom:20upx;border-bottom: 1px solid #EEEEEE;">
|
|
|
<text v-for="(tag, index) in tags" :key="index" class="tag-type"
|
|
|
- :class="{ 'selected-background': isSelected(index) }"
|
|
|
- :style="tag == '周四' || tag == '整周' ? 'margin-right:0' : ''" @click="toggleSelection(index)">
|
|
|
+ :class="{ 'selected-background': isSelected(tag) }"
|
|
|
+ :style="tag == '周四' || tag == '整周' ? 'margin-right:0' : ''" @click="toggleSelection(tag)">
|
|
|
{{ tag }}
|
|
|
</text>
|
|
|
</view>
|
|
|
- <view style="padding-top:18upx">营业时段</view>
|
|
|
- <view class="cu-form-group" style="margin:0">
|
|
|
- <input placeholder="添加营业时段(2/3)" v-model="corporateName" name="input"></input>
|
|
|
- <button class="cu-btn bg-blue " @click="add">添加</button>
|
|
|
-
|
|
|
+ <view style="padding-top:18upx">营业时段</view>
|
|
|
+ <view style="border-bottom: 1upx solid #eee;margin:0" v-for="(tim,timInd) in timeArr" :key="timInd">
|
|
|
+ <view class="cu-form-group" style="margin:0" v-if="timInd==0 && timeArr.length<3">
|
|
|
+ <input placeholder="添加营业时段(1/3)" v-model="tim.value" name="input" @click="open(timInd)"></input>
|
|
|
+ <view @click="add()" class="add-style">添加</view>
|
|
|
+ </view>
|
|
|
+ <view v-else >
|
|
|
+ <uni-swipe-action>
|
|
|
+ <uni-swipe-action-item
|
|
|
+ :right-options="options2"
|
|
|
+ :show="timInd.show"
|
|
|
+ :auto-close="false"
|
|
|
+ >
|
|
|
+ <view class="cu-form-group" style="margin:0">
|
|
|
+ <input :placeholder='"添加营业时段("+(timInd+1)+"/3)"' v-model="tim.value" name="input" @click="open(timInd)"></input>
|
|
|
+ <text class='cuIcon-right' style="color: #C7C6CA ;" @click="open(timInd)"></text>
|
|
|
+ </view>
|
|
|
+ <template v-slot:right>
|
|
|
+ <view>
|
|
|
+ <view @click="bindClick" class="add-style" style="background: #FF6067;">删除</view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </uni-swipe-action-item>
|
|
|
+ </uni-swipe-action>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="flex align-center justify-between date24" >
|
|
|
+ <view>24小时营业</view>
|
|
|
+ <uni-data-checkbox multiple :localdata="sex" v-model="timeType" active-color="#FF852D "
|
|
|
+ ></uni-data-checkbox>
|
|
|
</view>
|
|
|
</view>
|
|
|
<rangTime ref="rangTime"
|
|
|
@@ -24,36 +51,57 @@
|
|
|
@onSubmit="onEndTimeChange" />
|
|
|
<view class="padding flex flex-direction sub-bottom">
|
|
|
<button class="cu-btn bg-blue round " @click="sumbit">提交</button>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import rangTime from '../../components/dengrq-datetime-picker/dateSelector/index.vue'
|
|
|
-
|
|
|
+import rangTime from '../../components/dengrq-datetime-picker/dateSelector/index.vue'
|
|
|
+import { USER_INFO } from "@/common/util/constants"
|
|
|
export default {
|
|
|
components: {
|
|
|
rangTime
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ options2:[{
|
|
|
+ text: '删除',
|
|
|
+ style: {
|
|
|
+ backgroundColor: '#FF6067',
|
|
|
+ fontSize: '28upx',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ timeArr:[{
|
|
|
+ value:'',
|
|
|
+ show:false ,
|
|
|
+
|
|
|
+ }],
|
|
|
+ timeType:[],
|
|
|
+ sex: [{
|
|
|
+ text: '',
|
|
|
+ value: 1
|
|
|
+ }],
|
|
|
mode: 6,
|
|
|
corporateName:'',
|
|
|
tags: ['周一', '周二', '周三', '周四', '周五', '周六', '周日', '整周'], // 你的标签数组
|
|
|
selectedIndices: [], // 用于存储被选中的标签索引
|
|
|
- isSelectDate: false,
|
|
|
- selectedTime: [],
|
|
|
+ timeIndex: '',
|
|
|
+ merchantId: '',
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
+ async onLoad() {
|
|
|
+ this.merchantId = uni.getStorageSync(USER_INFO).merchantId;
|
|
|
+ },
|
|
|
methods: {
|
|
|
- customDataChange(e) {
|
|
|
- //通过e.detail.value获取值,获取的是自定义数据的下标
|
|
|
- const val = e.detail.value
|
|
|
- console.log(val);
|
|
|
- },
|
|
|
- cancelSelect(e){
|
|
|
- console.log("您已取消选择");
|
|
|
- },
|
|
|
+ open(index){
|
|
|
+ this.timeIndex=index
|
|
|
+ this.$refs.rangTime.open()
|
|
|
+ },
|
|
|
+
|
|
|
+ bindClick(e){
|
|
|
+ this.timeArr.splice(this.timeIndex, 1);
|
|
|
+ },
|
|
|
// 检查一个标签是否被选中
|
|
|
isSelected(index) {
|
|
|
return this.selectedIndices.includes(index);
|
|
|
@@ -70,12 +118,38 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
add(){
|
|
|
- this.$refs.rangTime.open()
|
|
|
+ this.timeArr.push({
|
|
|
+ value:'',
|
|
|
+ show:false ,
|
|
|
+ })
|
|
|
},
|
|
|
onEndTimeChange(val){
|
|
|
- console.log(val,99999 );
|
|
|
+ this.timeArr[this.timeIndex].value=val.startDate+'-'+val.endDate
|
|
|
+ // this.time=val.startDate+'-'+val.endDate
|
|
|
|
|
|
- }
|
|
|
+ },
|
|
|
+ sumbit(){
|
|
|
+ let data={
|
|
|
+ merchantId: this.merchantId,
|
|
|
+ timeType:this.timeType.length>0?1:0,
|
|
|
+ period:this.selectedIndices.length>0?this.selectedIndices.join(','):null,
|
|
|
+ middleTime: this.timeArr.length>=1?this.timeArr[0].value :null,
|
|
|
+ beginTime: this.timeArr.length>=2? this.timeArr[1].value:null,
|
|
|
+ endTime:this.timeArr.length>=3? this.timeArr[2].value:null
|
|
|
+ }
|
|
|
+ console.log(data,444444444);
|
|
|
+ this.$http.post('/merchant/localMerchantTime/add', data).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.$tip.success(res.data.result || '成功')
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1 // 返回的页面数,默认为1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.$tip.error(res.data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -131,4 +205,21 @@ page {
|
|
|
border-top: 1px solid #EEEEEE;
|
|
|
}
|
|
|
|
|
|
+.add-style{
|
|
|
+ padding: 0 30upx;
|
|
|
+ background: #449AFF;
|
|
|
+ color: #fff;
|
|
|
+ line-height: 58upx;
|
|
|
+ margin-top: 22upx;
|
|
|
+ border-radius: 4px 4px 4px 4px;
|
|
|
+}
|
|
|
+.date24{
|
|
|
+ line-height:80upx;
|
|
|
+ /deep/ .uni-data-checklist{
|
|
|
+ flex: none;
|
|
|
+ .checklist-group .checklist-box{
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|