|
|
@@ -1,5 +1,11 @@
|
|
|
<template>
|
|
|
<view class="app-content">
|
|
|
+ <view class="page-top-bar">
|
|
|
+ <view class="page-top-icon-btn" @click="openOpenTimePopup">
|
|
|
+ <image class="page-top-icon" :src="iconSrc('shop_rest')" mode="aspectFit" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<view class="img_box">
|
|
|
<image :src="imgUrl" mode="heightFix" class="img_url"></image>
|
|
|
</view>
|
|
|
@@ -20,13 +26,57 @@
|
|
|
</htz-image-upload>
|
|
|
</view>
|
|
|
|
|
|
+ <uni-popup ref="openTimeRef" background-color="#fff" type="center" :animation="false" class="open-time-popup">
|
|
|
+ <view class="open-time-panel">
|
|
|
+ <view class="open-time-title">经营时间</view>
|
|
|
+ <view class="module-com input-line-wrap">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">状态</view>
|
|
|
+ <view class="select-button-wrap">
|
|
|
+ <button class="admin-button-com middle" :class="[openForm.open == 1 ? 'blue' : 'default']" @click="setOpenStatus(1)">营业</button>
|
|
|
+ <button class="admin-button-com middle" :class="[openForm.open == 0 ? 'blue' : 'default']" @click="setOpenStatus(0)">休息</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <template v-if="visible">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">时间</view>
|
|
|
+ <view class="select-button-wrap time-button-wrap">
|
|
|
+ <button class="admin-button-com middle" :class="[openForm.openType == 0 ? 'blue' : 'default']" @click="setOpenType(0)">24小时</button>
|
|
|
+ <button class="admin-button-com middle" :class="[openForm.openType == 1 ? 'blue' : 'default']" @click="setOpenType(1)">自定义</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <template v-if="openTimeVisible">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">开店时间</view>
|
|
|
+ <picker mode="time" :value="start_time" start="00:00" end="24:00" @change="startTimeChange">
|
|
|
+ <view class="uni-input">{{ start_time }}</view>
|
|
|
+ </picker>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">关店时间</view>
|
|
|
+ <picker mode="time" :value="end_time" start="00:00" end="24:00" @change="endTimeChange">
|
|
|
+ <view class="uni-input">{{ end_time }}</view>
|
|
|
+ </picker>
|
|
|
+ </tui-list-cell>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </view>
|
|
|
+ <view class="open-time-actions">
|
|
|
+ <button class="admin-button-com big default open-time-btn" @click="closeOpenTimePopup">取消</button>
|
|
|
+ <button class="admin-button-com big blue open-time-btn" @click="submitOpenTime">保存</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mainGetMallPoster } from '@/api/main'
|
|
|
import { getWeixinId } from "@/api/invite";
|
|
|
-import { modifyWx } from "@/api/shop"
|
|
|
+import { modifyWx, getDetail, updateShopOpenTime } from "@/api/shop"
|
|
|
import { mapGetters } from "vuex";
|
|
|
+import { iconSrc } from '@/utils/iconSrc'
|
|
|
+import TuiListCell from '@/components/plugin/list-cell'
|
|
|
//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
|
export default {
|
|
|
@@ -36,11 +86,24 @@ export default {
|
|
|
getappIdList: {},
|
|
|
headers:{token:''},
|
|
|
currentImgData: [],
|
|
|
- isApple:1
|
|
|
+ isApple:1,
|
|
|
+ visible: true,
|
|
|
+ openTimeVisible: false,
|
|
|
+ start_time: '09:00',
|
|
|
+ end_time: '18:00',
|
|
|
+ openForm: {
|
|
|
+ id: 0,
|
|
|
+ open: 1,
|
|
|
+ openType: 0,
|
|
|
+ openStartTime: '',
|
|
|
+ openEndTime: ''
|
|
|
+ },
|
|
|
+ openTimeLoading: false
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
- htzImageUpload
|
|
|
+ htzImageUpload,
|
|
|
+ TuiListCell
|
|
|
},
|
|
|
onLoad() {
|
|
|
const token = uni.getStorageSync('token')
|
|
|
@@ -60,6 +123,106 @@ export default {
|
|
|
...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo" })
|
|
|
},
|
|
|
methods: {
|
|
|
+ iconSrc,
|
|
|
+ openOpenTimePopup() {
|
|
|
+ const shopId = this.loginInfo && this.loginInfo.shopId
|
|
|
+ if (!shopId) {
|
|
|
+ this.$msg('未获取到门店信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.openTimeLoading) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.openTimeLoading = true
|
|
|
+ getDetail({ shopId }).then(res => {
|
|
|
+ const data = res.data && res.data.info
|
|
|
+ if (this.$util.isEmpty(data)) {
|
|
|
+ this.$msg('获取门店详情失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.applyOpenTimeData(data)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.openTimeRef && this.$refs.openTimeRef.open()
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$msg('获取门店详情失败')
|
|
|
+ }).finally(() => {
|
|
|
+ this.openTimeLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ applyOpenTimeData(data) {
|
|
|
+ this.openForm.id = data.id
|
|
|
+ this.openForm.open = data.open == null ? 1 : Number(data.open)
|
|
|
+ this.visible = this.openForm.open === 1
|
|
|
+ this.openForm.openType = 1
|
|
|
+ this.openTimeVisible = true
|
|
|
+ this.start_time = data.openStartTime || '09:00'
|
|
|
+ this.end_time = data.openEndTime || '18:00'
|
|
|
+ this.openForm.openStartTime = this.start_time
|
|
|
+ this.openForm.openEndTime = this.end_time
|
|
|
+ if (!data.openStartTime) {
|
|
|
+ this.openTimeVisible = false
|
|
|
+ this.openForm.openType = 0
|
|
|
+ this.start_time = '09:00'
|
|
|
+ this.openForm.openStartTime = this.start_time
|
|
|
+ }
|
|
|
+ if (!data.openEndTime) {
|
|
|
+ this.end_time = '18:00'
|
|
|
+ this.openForm.openEndTime = this.end_time
|
|
|
+ }
|
|
|
+ },
|
|
|
+ closeOpenTimePopup() {
|
|
|
+ this.$refs.openTimeRef.close()
|
|
|
+ },
|
|
|
+ setOpenStatus(value) {
|
|
|
+ const selected = Number(value)
|
|
|
+ this.visible = selected === 1
|
|
|
+ this.openForm.open = selected
|
|
|
+ },
|
|
|
+ setOpenType(value) {
|
|
|
+ const selected = Number(value)
|
|
|
+ this.openTimeVisible = selected === 1
|
|
|
+ this.openForm.openType = selected === 0 ? 0 : 1
|
|
|
+ if (this.openTimeVisible) {
|
|
|
+ this.start_time = '09:00'
|
|
|
+ this.end_time = '18:00'
|
|
|
+ this.openForm.openStartTime = this.start_time
|
|
|
+ this.openForm.openEndTime = this.end_time
|
|
|
+ }
|
|
|
+ },
|
|
|
+ startTimeChange(e) {
|
|
|
+ this.start_time = e.detail.value
|
|
|
+ this.openForm.openStartTime = e.detail.value
|
|
|
+ },
|
|
|
+ endTimeChange(e) {
|
|
|
+ this.end_time = e.detail.value
|
|
|
+ this.openForm.openEndTime = e.detail.value
|
|
|
+ },
|
|
|
+ submitOpenTime() {
|
|
|
+ if (!this.openForm.id) {
|
|
|
+ this.$msg('门店信息异常')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const payload = {
|
|
|
+ shopId: this.openForm.id,
|
|
|
+ open: this.openForm.open,
|
|
|
+ openType: this.openForm.openType
|
|
|
+ }
|
|
|
+ if (this.openForm.openType === 1) {
|
|
|
+ payload.openStartTime = this.openForm.openStartTime
|
|
|
+ payload.openEndTime = this.openForm.openEndTime
|
|
|
+ } else {
|
|
|
+ payload.openStartTime = ''
|
|
|
+ payload.openEndTime = ''
|
|
|
+ }
|
|
|
+ updateShopOpenTime(payload).then(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ this.$msg('修改成功')
|
|
|
+ this.closeOpenTimePopup()
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ },
|
|
|
imgDeleteFn(res){
|
|
|
|
|
|
},
|
|
|
@@ -244,6 +407,22 @@ export default {
|
|
|
.app-content{
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+.page-top-bar {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ padding: 16upx 30upx 0;
|
|
|
+}
|
|
|
+.page-top-icon-btn {
|
|
|
+ width: 74upx;
|
|
|
+ height: 74upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.page-top-icon {
|
|
|
+ width: 54upx;
|
|
|
+ height: 54upx;
|
|
|
+}
|
|
|
.img_box{
|
|
|
height: 450upx;
|
|
|
box-sizing: border-box;
|
|
|
@@ -267,4 +446,49 @@ export default {
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
|
+.open-time-popup {
|
|
|
+ z-index: 99999;
|
|
|
+ border-radius: 20upx;
|
|
|
+}
|
|
|
+.open-time-panel {
|
|
|
+ width: 640upx;
|
|
|
+ max-width: 90vw;
|
|
|
+ padding: 30upx 20upx 20upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+.open-time-title {
|
|
|
+ font-size: 34upx;
|
|
|
+ font-weight: bold;
|
|
|
+ text-align: center;
|
|
|
+ margin-bottom: 20upx;
|
|
|
+}
|
|
|
+.open-time-actions {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 30upx;
|
|
|
+ padding: 0 10upx;
|
|
|
+}
|
|
|
+.open-time-btn {
|
|
|
+ flex: 1;
|
|
|
+ margin: 0;
|
|
|
+}
|
|
|
+.open-time-btn + .open-time-btn {
|
|
|
+ margin-left: 20upx;
|
|
|
+}
|
|
|
+.select-button-wrap {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .admin-button-com {
|
|
|
+ width: 150upx;
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+ .admin-button-com + .admin-button-com {
|
|
|
+ margin-left: 15upx;
|
|
|
+ }
|
|
|
+}
|
|
|
+.time-button-wrap {
|
|
|
+ .admin-button-com {
|
|
|
+ width: 150upx;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|