Style(店铺):界面调整

This commit is contained in:
lifizer
2024-03-21 14:38:30 +08:00
parent c10a120fa8
commit 0febe3a5a4
4 changed files with 341 additions and 399 deletions
+136 -199
View File
@@ -263,9 +263,9 @@
class="more-wrapper" class="more-wrapper"
> >
<view <view
v-show="item.isTop === 0" v-if="item.isTop === 0"
class="more-item" class="more-item"
@click="setTopInfoHandle(item, index)" @click="setTopInfoHandle(item, 1)"
> >
<image <image
:src="webUrl + '/page/hotel/settop.png'" :src="webUrl + '/page/hotel/settop.png'"
@@ -273,6 +273,17 @@
/> />
置顶动态 置顶动态
</view> </view>
<view
v-else
class="more-item"
@click="setTopInfoHandle(item, 0)"
>
<image
:src="webUrl + '/page/hotel/delete.png'"
class="more-icon"
/>
取消置顶
</view>
<view class="more-item" @click="deleteInnInfo(item, index)"> <view class="more-item" @click="deleteInnInfo(item, index)">
<image <image
:src="webUrl + '/page/hotel/delete.png'" :src="webUrl + '/page/hotel/delete.png'"
@@ -376,12 +387,12 @@ import {
getHotelGoodList, getHotelGoodList,
postHotelNewsDel, postHotelNewsDel,
setTopHotelNew setTopHotelNew
} from "@/api/inn.js"; } from "@/api/inn.js"
import {formatDateTime} from "@/utils"; import {formatDateTime} from "@/utils"
import {getUrlParam} from "@/utils/common.js"; import {getUrlParam} from "@/utils/common.js"
import imgBox from '@/components/imageTypeSet/imagebox.vue' import imgBox from '@/components/imageTypeSet/imagebox.vue'
import cookie from "@/utils/store/cookie"; import cookie from "@/utils/store/cookie"
import {addStore, removeStore} from "@/api/favorite"; import {addStore, removeStore} from "@/api/favorite"
import GooSkeleton from '@/components/GooSkeleton/index.vue' import GooSkeleton from '@/components/GooSkeleton/index.vue'
export default { export default {
@@ -393,12 +404,8 @@ export default {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
isLoad: false, isLoad: false,
isExpand: false,
activeIndex: 0, activeIndex: 0,
page: 1,
limit: 20,
loading: false, loading: false,
loadend: false,
picColumnWidth: '325rpx', picColumnWidth: '325rpx',
scrollData: {}, scrollData: {},
infoArray: [], infoArray: [],
@@ -411,9 +418,8 @@ export default {
}, },
isMyInn: false, //是否是自己的客栈 isMyInn: false, //是否是自己的客栈
goodsList: [], goodsList: [],
goodsPage: 1,
showShare: false, showShare: false,
posterUrl: "", // 分享海报 posterUrl: '', // 分享海报
id: null, id: null,
partnerId: null, partnerId: null,
isLike: false, //点赞 isLike: false, //点赞
@@ -431,54 +437,47 @@ export default {
] ]
} }
}, },
//必须在页面加 onPageScroll(e){} ,才能滑动显示背景 // 必须在页面加 onPageScroll(e){} ,才能滑动显示背景
onPageScroll(e) { onPageScroll(e) {
this.scrollData = e; this.scrollData = e
},
onShow: function () {
this.page = 1;
this.loading = false;
this.loadend = false;
}, },
onLoad: function (options) { onLoad: function (options) {
if (options.id) { if (options.id) {
this.id = options.id || null; this.id = options.id || null
this.partnerId = options.partnerId || null; this.partnerId = options.partnerId || null
} else { } else {
let obj = uni.getEnterOptionsSync(); let obj = uni.getEnterOptionsSync()
if (options.scene || obj.query.scene) { if (options.scene || obj.query.scene) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene); const query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene)
this.id = getUrlParam(query, "id") || null; this.id = getUrlParam(query, 'id') || null
this.partnerId = getUrlParam(query, "partnerId") || null; this.partnerId = getUrlParam(query, 'partnerId') || null
} }
} }
if (this.partnerId) cookie.set("spread", this.partnerId); if (this.partnerId) cookie.set('spread', this.partnerId)
this.fetchInnDetail(); this.fetchInnDetail()
this.fetchInnInfoList(); this.fetchInnInfoList()
this.initPoster(); this.initPoster()
let that = this; this.isMyInn = (this.$yroute.query.isMyInn != null ? true : false)
this.isMyInn = (this.$yroute.query.isMyInn != null ? true : false);
uni.getSystemInfo({ uni.getSystemInfo({
success: (e) => { success: (e) => {
//两列商品宽度 // 两列商品宽度
that.picColumnWidth = (e.screenWidth - uni.upx2px(92)) / 2 + 'px'; this.picColumnWidth = (e.screenWidth - uni.upx2px(92)) / 2 + 'px'
} }
}); })
}, },
// 下拉刷新 onShow() {
onPullDownRefresh() { if (!this.isLoad) {
if (this.activeIndex == 0) { return
this.page = 1;
this.loading = false;
this.loadend = false;
this.fetchInnInfoList();
} else {
this.fetchInnDetail();
} }
if (this.inn.hasProduct <= 0) {
this.fetchGoods()
}
this.fetchInnInfoList()
this.fetchInnDetail()
}, },
methods: { methods: {
changeShare() { changeShare() {
this.showShare = !this.showShare; this.showShare = !this.showShare
}, },
goGoodsConByID(item) { goGoodsConByID(item) {
this.$yrouter.push({ this.$yrouter.push({
@@ -486,22 +485,21 @@ export default {
query: { query: {
id: item.id id: item.id
} }
}); })
}, },
saveImg() { saveImg() {
let that = this; const _this = this
uni.getSetting({ uni.getSetting({
success: getRes => { success: getRes => {
if (getRes.authSetting["scope.writePhotosAlbum"]) { if (getRes.authSetting["scope.writePhotosAlbum"]) {
that.downloadImage(); _this.downloadImage()
} else { } else {
uni.authorize({ uni.authorize({
scope: "scope.writePhotosAlbum", scope: "scope.writePhotosAlbum",
success: () => { success: () => {
that.downloadImage(); _this.downloadImage()
}, },
fail: () => { fail: () => {
console.log("authorize fail")
uni.openSetting({ uni.openSetting({
success: openRes => { success: openRes => {
console.log(typeof openRes, openRes) console.log(typeof openRes, openRes)
@@ -523,20 +521,20 @@ export default {
}) })
}, },
downloadImage() { downloadImage() {
let that = this; const _this = this
const randomID = () => Math.random().toString(36).substring(2); const randomID = () => Math.random().toString(36).substring(2)
uni.downloadFile({ uni.downloadFile({
url: this.posterUrl, //网络图片的地址 url: this.posterUrl, // 网络图片的地址
filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", //指定的本地文件路径 filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", // 指定的本地文件路径
success: downRes => { success: downRes => {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: downRes.filePath, //临时文件地址 filePath: downRes.filePath, // 临时文件地址
success: function () { success: function () {
uni.showToast({ uni.showToast({
title: "保存成功", title: "保存成功",
icon: "success", icon: "success",
success() { success() {
that.showShare = false; _this.showShare = false
} }
}) })
}, },
@@ -556,147 +554,122 @@ export default {
} }
}) })
}, },
doExpandDesc: function () {
this.isExpand = !this.isExpand;
},
showQrcode: function () {
uni.previewImage({
current: 0,
urls: [this.inn.qrcode]
});
},
zanInn: function () { zanInn: function () {
getHotelZan(this.inn.id).then(() => { getHotelZan(this.inn.id).then(() => {
this.isLike = !this.isLike; this.isLike = !this.isLike
this.fetchInnDetail(); this.fetchInnDetail()
}).catch((err) => { }).catch((err) => {
uni.showToast({ uni.showToast({
title: err.msg + '', title: err.msg + '',
icon: 'none', icon: 'none',
mask: false, mask: false,
duration: 1500 duration: 1500
}); })
}) })
}, },
infoClick: function (info) { infoClick: function (info) {
this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id); this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id)
}, },
publishBtnClick: function () { publishBtnClick: function () {
this.$yrouter.push('/pagesInn/inn/innInfoPublish?hotelId=' + this.inn.id); this.$yrouter.push('/pagesInn/inn/innInfoPublish?hotelId=' + this.inn.id)
}, },
modifyBtnClick: function () { modifyBtnClick: function () {
this.$yrouter.push("/pagesInn/inn/innProfileEdit?hotel=" + encodeURIComponent(JSON.stringify(this.inn))); uni.setStorageSync('MY_HOTEL_INFO', JSON.stringify(this.inn))
// this.$yrouter.push('/pagesInn/inn/innProfileEdit'); this.$yrouter.push("/pagesInn/inn/innProfileEdit?id=" + this.inn.id)
}, },
//删除客栈动态 // 删除客栈动态
deleteInnInfo: function (info, index) { deleteInnInfo: function (info, index) {
let that = this; const _this = this
that.toggleMoreHandle(index) _this.toggleMoreHandle(index)
uni.showModal({ uni.showModal({
title: '确认删除此动态?', title: '提示',
content: '', content: '确认删除此动态?',
showCancel: true, showCancel: true,
cancelText: '取消', cancelText: '取消',
confirmText: '确认', confirmText: '确认',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
uni.showLoading(); uni.showLoading()
postHotelNewsDel({ postHotelNewsDel({
id: info.id, id: info.id,
hotelId: that.inn.id hotelId: _this.inn.id
}).then((res1) => { }).then((res1) => {
uni.hideLoading(); uni.hideLoading()
that.$dialog.toast({ _this.$dialog.toast({
mes: '删除成功!' mes: '删除成功!'
}); })
// 删除成功刷新动态列表 // 删除成功刷新动态列表
that.page = 1; _this.fetchInnInfoList()
that.loading = false;
that.loadend = false;
that.fetchInnInfoList();
}).catch((err) => { }).catch((err) => {
uni.hideLoading(); uni.hideLoading()
uni.showToast({ uni.showToast({
title: err.msg, title: err.msg,
icon: "none", icon: "none",
duration: 1500 duration: 1500
}); })
}) })
} }
} }
}); })
}, },
fetchInnInfoList: function () { fetchInnInfoList: function () {
let that = this; const _this = this
if (that.loading) return; //阻止下次请求(false可以进行请求); if (_this.loading) {
if (that.loadend) return; //阻止结束当前请求(false可以进行请求); return
that.loading = true;
getHotelNewsList({
page: that.page,
limit: that.limit,
hotelId: that.id
}).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
if (that.page == 1) {
that.infoArray = [];
}
that.infoArray.push.apply(that.infoArray, res.data.map((info) => {
var pt = info.createdTime.replace(/-/g, "/");
info.year = formatDateTime(pt, 'yyyy');
info.monthDay = formatDateTime(pt, 'MM/dd');
info.time = formatDateTime(pt, 'HH:mm:ss');
info.showMore = false
return info;
}));
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
}).catch((err) => {
}).finally(() => {
uni.stopPullDownRefresh();
});
},
handleRichText: function (str) {
if (str != null) {
return `<span class="fixed">简介:</span>` + str.replace(/<\/?[^>]*>/g, '');
} else {
return '';
} }
_this.loading = true
_this.infoArray = []
getHotelNewsList({
page: 1,
limit: 9999,
hotelId: _this.id
}).then(res => {
_this.loading = false
_this.infoArray.push.apply(_this.infoArray, res.data.map((info) => {
var pt = info.createdTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
info.showMore = false
return info
}))
}).finally(() => {
_this.loading = false
uni.stopPullDownRefresh()
})
}, },
fetchInnDetail: function () { fetchInnDetail: function () {
const that = this const _this = this
let reqFn = null let reqFn = null
if (that.isMyInn) { if (_this.isMyInn) {
reqFn = getHotelDetail reqFn = getHotelDetail
} else { } else {
reqFn = getHomeHotelDetail reqFn = getHomeHotelDetail
} }
reqFn(that.id).then((res) => { reqFn(_this.id).then((res) => {
const { success, data } = res const { success, data } = res
if (success) { if (success) {
that.isLoad = true _this.isLoad = true
that.inn = data _this.inn = data
that.isLike = data.zanVo !== null _this.isLike = data.zanVo !== null
that.isFavorite = data.hasFavorite _this.isFavorite = data.hasFavorite
that.favoriteCount = data.favoriteCount _this.favoriteCount = data.favoriteCount
that.inn.latitude = that.inn.latitude ? parseFloat(that.inn.latitude) : 24.993587 _this.inn.latitude = _this.inn.latitude ? parseFloat(_this.inn.latitude) : 24.993587
that.inn.longitude = that.inn.longitude ? parseFloat(that.inn.longitude) : 102.779656 _this.inn.longitude = _this.inn.longitude ? parseFloat(_this.inn.longitude) : 102.779656
// 该店铺无商品则不显示“精选商品” // 该店铺无商品则不显示“精选商品”
if (data.hasProduct <= 0) { if (data.hasProduct <= 0) {
that.activeIndex = 1 _this.activeIndex = 1
that.tabList[0].isShow = false _this.tabList[0].isShow = false
} else { } else {
that.fetchGoods() _this.fetchGoods()
} }
// coverType: 1-图片,2-视频 // coverType: 1-图片,2-视频
if (data.coverType === 2) { if (data.coverType === 2) {
uni.getSystemInfo({ uni.getSystemInfo({
success: info => { success: info => {
const screenWidth = info.windowWidth const screenWidth = info.windowWidth
that.videoStyle.width = screenWidth + 'px' _this.videoStyle.width = screenWidth + 'px'
that.videoStyle.height = screenWidth * 500 / 750 + 'px' _this.videoStyle.height = screenWidth * 500 / 750 + 'px'
} }
}) })
// 视频宽高自适应 // 视频宽高自适应
@@ -728,23 +701,21 @@ export default {
*/ */
} }
} }
}).catch((err) => {
}).finally(() => { }).finally(() => {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh()
}); })
}, },
initPoster() { initPoster() {
getPoster(this.id).then(({data}) => this.posterUrl = data); getPoster(this.id).then(({data}) => this.posterUrl = data)
}, },
showLocation: function () { showLocation: function () {
if (!this.inn.latitude || !this.inn.longitude) { if (!this.inn.latitude || !this.inn.longitude) {
this.$dialog.error('暂无位置信息'); this.$dialog.error('暂无位置信息')
} else { } else {
uni.openLocation({ uni.openLocation({
latitude: this.inn.latitude, latitude: this.inn.latitude,
longitude: this.inn.longitude longitude: this.inn.longitude
}); })
} }
}, },
showPic: function (index) { showPic: function (index) {
@@ -754,28 +725,25 @@ export default {
}) })
}, },
changeTab: function (index) { changeTab: function (index) {
this.activeIndex = index; this.activeIndex = index
this.page = 1; this.loading = false
this.loading = false; // 刷新数据
this.loadend = false;
//刷新数据
switch (this.activeIndex) { switch (this.activeIndex) {
case 1: case 1:
this.fetchInnInfoList(); this.fetchInnInfoList()
break; break
case 0: case 0:
this.goodsPage = 1; this.goodsList = []
this.goodsList = []; this.fetchGoods()
this.fetchGoods(); break
break;
default: default:
break; break
} }
}, },
fetchGoods() { fetchGoods() {
getHotelGoodList({ getHotelGoodList({
id: this.inn.id, id: this.inn.id,
page: this.goodsPage, page: 1,
limit: 12 limit: 12
}).then(res => { }).then(res => {
const { success, data } = res const { success, data } = res
@@ -802,9 +770,9 @@ export default {
fail: (res) => { fail: (res) => {
console.log('调用失败!') console.log('调用失败!')
} }
}); })
} else { } else {
this.$dialog.error('电话为空'); this.$dialog.error('电话为空')
} }
}, },
async doneFavorite() { async doneFavorite() {
@@ -827,14 +795,14 @@ export default {
}, },
viewAllGoodHandle() { viewAllGoodHandle() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesInn/inn/innGoodList?id=' + this.inn.id, url: '/pagesInn/inn/innGoodList?id=' + this.inn.id
}) })
}, },
setTopInfoHandle(item) { setTopInfoHandle(item, isTop) {
uni.showLoading() uni.showLoading()
setTopHotelNew({ setTopHotelNew({
id: item.id, id: item.id,
isTop: 1 isTop
}).then(res => { }).then(res => {
const { success } = res const { success } = res
if (success) { if (success) {
@@ -851,37 +819,6 @@ export default {
} }
</script> </script>
<style>
.conter {
/* width:600upx; */
height: auto;
min-height: 100rpx;
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
/* 要显示多少行就改变line-clamp的数据,此处折叠起来显示一行*/
-webkit-line-clamp: 5;
overflow: hidden;
text-overflow: ellipsis;
background-color: #F5F5F5;
padding: 10rpx;
}
.hide {
display: -webkit-box;
}
.show {
display: block;
}
.conter >>> img {
display: block;
max-width: 100% !important;
}
</style>
<style scoped lang="less"> <style scoped lang="less">
@import "@/assets/css/store.less"; @import "@/assets/css/store.less";
.my-inn-page { .my-inn-page {
@@ -1333,6 +1270,9 @@ export default {
border-radius: 12rpx; border-radius: 12rpx;
background-color: #fff; background-color: #fff;
box-shadow: 0px 1px 6px rgba(0,0,0,0.16); box-shadow: 0px 1px 6px rgba(0,0,0,0.16);
.more-item + .more-item {
border-top: 1px solid #d5d5d5;
}
.more-item { .more-item {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1340,9 +1280,6 @@ export default {
height: 70rpx; height: 70rpx;
font-size: 14px; font-size: 14px;
color: #333; color: #333;
&:first-child {
border-bottom: 1px solid #d5d5d5;
}
.more-icon { .more-icon {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
+3 -2
View File
@@ -223,8 +223,9 @@
border-radius: 6rpx; border-radius: 6rpx;
} }
.inp-input { .inp-input {
height: 72rpx; padding: 0 16rpx;
line-height: 72rpx; height: 76rpx;
line-height: 76rpx;
} }
.title { .title {
margin: 0 0 10rpx 0; margin: 0 0 10rpx 0;
+199 -197
View File
@@ -1,25 +1,30 @@
<template> <template>
<view class="container"> <view class="container">
<view class="base-info-section">
<view class="base-info-section" style="margin-bottom: 86rpx;margin-bottom: 86rpx;"> <view
<!-- <text class="section-title">详细信息</text> --> class="item is_required"
<view class="item is_required" @click="chooseLogoImg()"> @click="chooseLogoImg()"
>
<view class="cell acea-row row-between row-middle"> <view class="cell acea-row row-between row-middle">
<view class="cell-title">店铺LOGO</view> <view class="cell-title">店铺LOGO</view>
<view class=""> <view>
<image style="width: 64rpx;height: 64rpx;" <image
:src="innApplyInfo.logo.length>0?innApplyInfo.logo:webUrl+'/20210228103411271415.png'" :src="innApplyInfo.logo ? innApplyInfo.logo : webUrl + '/20210228103411271415.png'"
mode=""></image> class="img-item"
/>
</view> </view>
</view> </view>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
<view class="item is_required"> <view class="item is_required">
<view class="cell acea-row row-between row-middle"> <view class="cell acea-row row-between row-middle">
<view class="cell-title">店铺类型</view> <view class="cell-title">店铺类型</view>
<view class="cell-value"> <view class="cell-value">
<picker :value="typeIndex" @change="typePickerChange" :range="typeRange"> <picker
:value="typeIndex"
:range="typeRange"
@change="typePickerChange"
>
<view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-if="typeList.length>0"> <view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-if="typeList.length>0">
{{ typeList[typeIndex].name }} {{ typeList[typeIndex].name }}
</view> </view>
@@ -29,97 +34,110 @@
</view> </view>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
<view v-if="innApplyInfo.coverType === 1" class="item is_required" @click="chooseCoverImg()">
<view class="item is_required" @click="chooseCoverImg()">
<view class="cell acea-row row-between row-middle"> <view class="cell acea-row row-between row-middle">
<view class="cell-title">封面照片</view> <view class="cell-title">封面照片</view>
<view class=""> <view>
<image style="width: 64rpx;height: 64rpx;" <image
:src="innApplyInfo.cover.length>0?innApplyInfo.cover:webUrl+'/20210228103411271415.png'" :src="innApplyInfo.cover ? innApplyInfo.cover : webUrl + '/20210228103411271415.png'"
mode=""></image> class="img-item"
/>
</view>
</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view v-if="innApplyInfo.coverType === 2" class="item is_required" @click="chooseLogoVideo()">
<view class="cell acea-row row-between row-middle">
<view class="cell-title">封面视频</view>
<view>
<video
:src="innApplyInfo.coverVideo"
:poster="innApplyInfo.coverVideo + '?vframe/jpg/offset/1'"
:controls="false"
play-btn-position="center"
class="video-item"
/>
</view> </view>
</view> </view>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
<view class="item" @click="chooseQrcodeImg()"> <view class="item" @click="chooseQrcodeImg()">
<view class="cell acea-row row-between row-middle"> <view class="cell acea-row row-between row-middle">
<view class="cell-title">微信二维码</view> <view class="cell-title">微信二维码</view>
<view class=""> <view>
<image style="width: 64rpx;height: 64rpx;" <image
:src="innApplyInfo.qrcode.length>0?innApplyInfo.qrcode:webUrl+'/20210228103411271415.png'" :src="innApplyInfo.qrcode ? innApplyInfo.qrcode : webUrl + '/20210228103411271415.png'"
mode=""></image> class="img-item"
/>
</view> </view>
</view> </view>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
<view class="item is_required"> <view class="item is_required">
<view class="cell acea-row row-between row-middle"> <view class="cell acea-row row-between row-middle">
<view class="cell-title">店主名字</view> <view class="cell-title">店主名字</view>
<view class="cell-value" style="text-align: right;"> <view class="cell-value">
<input type="text" v-model="innApplyInfo.ownerName" placeholder="请输入店主名字" <input
placeholder-style="font-size:24rpx;color:#C2C5CC;"/> v-model="innApplyInfo.ownerName"
type="text"
placeholder="请输入店主名字"
placeholder-style="font-size:24rpx;color:#C2C5CC;"
/>
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="item is_required">-->
<!-- <view class="cell acea-row row-between row-middle">-->
<!-- <view class="cell-title">关键词</view>-->
<!-- <view class="cell-value" style="text-align: right;">-->
<!-- <input type="text" v-model="innApplyInfo.tips" placeholder="店主想对游客说的话" placeholder-style="font-size:24rpx;color:#C2C5CC;" />-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<view class="item is_required"> <view class="item is_required">
<view class="cell acea-row row-between row-middle"> <view class="cell acea-row row-between row-middle">
<view class="cell-title">一句话介绍</view> <view class="cell-title">一句话介绍</view>
<view class="cell-value" style="text-align: right;"> <view class="cell-value">
<input type="text" v-model="innApplyInfo.content" placeholder="店铺风格一句话描述" <input
placeholder-style="font-size:24rpx;color:#C2C5CC;"/> v-model="innApplyInfo.content"
type="text"
placeholder="店铺风格一句话描述"
placeholder-style="font-size:24rpx;color:#C2C5CC;"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="item is_required"> <view class="item is_required">
<view class="cell acea-row row-column"> <view class="cell acea-row row-column">
<view class="cell-title">店铺简介</view> <view class="cell-title">店铺简介</view>
<view class=""> <view>
<textarea style="height: 200rpx;color:#C2C5CC;" v-model="innApplyInfo.desc" placeholder="请输入店铺简介..." <textarea
placeholder-style="font-size:24rpx;color:#C2C5CC;"/> v-model="innApplyInfo.desc"
placeholder="请输入店铺简介..."
placeholder-style="font-size:24rpx;color:#C2C5CC;"
class="inp-textarea"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="img-upload"> <view class="img-upload">
<tm-upload <tm-upload
:dataList="picsArray" :dataList="picsArray"
:upload_img_wh="uploadImgWH" :upload_img_wh="(750 - 3 * 16 - 2 * 32) / 3.0"
:upload_max="uploadMax" :upload_max="10"
:url="uploadUrl" :url="uploadUrl"
:header="uploadHeader" :header="uploadHeader"
@change="uploadedImgChange"/> @change="uploadedImgChange"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="submit-btn" @tap="submit">确定修改</view> <view class="submit-btn" @tap="submit">确定修改</view>
</view> </view>
</template> </template>
<script> <script>
import CitySelect from "@/components/CitySelect"; import CitySelect from '@/components/CitySelect'
import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue'; import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue'
import {chooseImage} from "@/utils"; import {
import {VUE_APP_API_URL} from "@/config" chooseImage,
import {getHotelTypeList, postHotelInfoEdit} from "@/api/inn.js"; chooseVideoToUpload
} from '@/utils'
var that; import {VUE_APP_API_URL} from '@/config'
import {getHotelTypeList, postHotelInfoEdit} from '@/api/inn.js'
export default { export default {
components: { components: {
CitySelect, CitySelect,
@@ -129,190 +147,164 @@ export default {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
uploadUrl: VUE_APP_API_URL + '/api/upload', uploadUrl: VUE_APP_API_URL + '/api/upload',
uploadImgWH: (750 - 3 * 16 - 2 * 32) / 3.0,
uploadHeader: { uploadHeader: {
Authorization: "Bearer " + this.$store.getters.token Authorization: 'Bearer ' + this.$store.getters.token
}, },
innHistory: {},//历史信息 innHistory: {}, // 历史信息
picsArray: [], picsArray: [],
typeList: [],//类型列表 typeList: [], // 类型列表
typeIndex: 0,//选中的类型 typeIndex: 0, // 选中的类型
typeRange: [],//类型数据源 typeRange: [], // 类型数据源
uploadedFilesArray: [], uploadedFilesArray: [],
uploadMax: 10,
innApplyInfo: { innApplyInfo: {
"address": "", 'address': '',
"areaId": 0, 'areaId': 0,
"cityId": 0, 'cityId': 0,
"provinceId": 0, 'provinceId': 0,
"content": "", 'content': '',
"cover": "", 'cover': '',
"desc": "", 'coverType': 1, // coverType: 1-图片,2-视频
"logo": "", 'desc': '',
"name": "", 'logo': '',
"ownerName": "", 'name': '',
"pics": [], 'ownerName': '',
"position": "", 'pics': [],
"tel": "", 'position': '',
"qrcode": "", 'tel': '',
"tips": "", 'qrcode': '',
"type": "", 'tips': '',
'type': ''
} }
} }
}, },
onShow: function () { onShow() {
this.getHotelType(); this.getHotelType()
}, },
onLoad: function (e) { onLoad(options) {
that = this; const id = options.id
if (e.hotel) { if (id) {
//赋值 // 赋值
var hotel = JSON.parse(decodeURIComponent(e.hotel)); const hotel = JSON.parse(uni.getStorageSync('MY_HOTEL_INFO'))
this.innHistory = hotel; this.innHistory = hotel
this.fillData(this.innApplyInfo, this.innHistory)
this.fillData(this.innApplyInfo, this.innHistory); if (hotel.coverType === 2) {
this.innApplyInfo.coverVideo = hotel.cover
//Object.assign(this.innApplyInfo,hotel); } else {
this.innApplyInfo.coverVideo = ''
}
//this.addressText = this.innHistory.provinceName+" "+this.innHistory.cityName+" "+this.innHistory.areaName; // 图片填充
//图片填充
this.picsArray = hotel.pics.map(function (item) { this.picsArray = hotel.pics.map(function (item) {
var obj = { return {
path: item, path: item,
upload_percent: 100 upload_percent: 100
} }
return obj; })
});
} }
}, },
methods: { methods: {
typePickerChange: function (e) { typePickerChange: function (e) {
this.typeIndex = e.target.value; this.typeIndex = e.target.value
// 修改type
//修改type
if (this.typeList.length > 0) { if (this.typeList.length > 0) {
this.$set(this.innApplyInfo, 'type', this.typeList[this.typeIndex].id); this.$set(this.innApplyInfo, 'type', this.typeList[this.typeIndex].id)
} }
}, },
getHotelType: function () { getHotelType() {
const _this = this
getHotelTypeList().then((res) => { getHotelTypeList().then((res) => {
that.typeList = res.data; _this.typeList = res.data
// 构建数据源
//构建数据源 _this.typeRange = [];
that.typeRange = []; _this.typeList.forEach((item, index) => {
that.typeList.forEach((item, index) => { _this.typeRange.push(item.name)
that.typeRange.push(item.name); })
}); // 重新填写模式预填充type
const len = this.typeList.length
//重新填写模式预填充type
let len = this.typeList.length;
if (len > 0) { if (len > 0) {
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
if (this.typeList[i].id === this.innHistory.type) this.typeIndex = i; if (this.typeList[i].id === this.innHistory.type) this.typeIndex = i
} }
} }
}).catch((err) => {
}).finally(() => {
}) })
}, },
fillData: function (target, source) { fillData: function (target, source) {
//var keys = Object.keys(target);
//this.uploadedFilesArray = source.pics;
Object.keys(target).forEach((value, key) => { Object.keys(target).forEach((value, key) => {
target[value] = source[value]; target[value] = source[value]
// console.log('key:'+value); })
});
}, },
//文件上传结果 // 文件上传结果
uploadedImgChange: function (uploadedFilesList) { uploadedImgChange: function (uploadedFilesList) {
this.uploadedFilesArray = uploadedFilesList; this.uploadedFilesArray = uploadedFilesList
}, },
chooseQrcodeImg: function () { chooseQrcodeImg() {
chooseImage(img => { chooseImage(img => {
that.$set(that.innApplyInfo, 'qrcode', img); this.$set(this.innApplyInfo, 'qrcode', img)
}); })
}, },
chooseLogoImg: function () { chooseLogoImg() {
chooseImage(img => { chooseImage(img => {
that.innApplyInfo.logo = img; this.$set(this.innApplyInfo, 'logo', img)
}); })
}, },
chooseCoverImg: function () { chooseLogoVideo() {
chooseVideoToUpload(path => {
this.$set(this.innApplyInfo, 'coverVideo', path)
})
},
chooseCoverImg() {
chooseImage(img => { chooseImage(img => {
that.innApplyInfo.cover = img; this.$set(this.innApplyInfo, 'cover', img)
}); })
}, },
// successImage(e){ submit() {
// uni.showModal({ if (this.innApplyInfo.logo.length === 0) {
// content : '上传成功,详细信息请看控制台' this.$dialog.error('请上传店铺LOGO图片')
// }) return
// },
// successvideo(e){
// },
submit: function () {
if (this.innApplyInfo.logo.length == 0) {
this.$dialog.error("请上传店铺LOGO图片");
return;
} }
if (this.innApplyInfo.cover.length === 0 && this.innApplyInfo.coverType === 1) {
if (this.innApplyInfo.cover.length == 0) { this.$dialog.error('请上传店铺封面图片')
this.$dialog.error("请上传店铺封面图片"); return
return;
} }
if (this.innApplyInfo.coverVideo.length === 0 && this.innApplyInfo.coverType === 2) {
if (this.innApplyInfo.ownerName.length == 0) { this.$dialog.error('请上传店铺封面视频')
this.$dialog.error("请输入店主名字"); return
return;
} }
if (this.innApplyInfo.ownerName.length === 0) {
// if (this.innApplyInfo.tips.length == 0) { this.$dialog.error('请输入店主名字')
// this.$dialog.error("请输入关键词"); return
// return;
// }
if (this.innApplyInfo.content.length == 0) {
this.$dialog.error("请输入一句话介绍");
return;
} }
if (this.innApplyInfo.content.length === 0) {
if (this.innApplyInfo.desc.length == 0) { this.$dialog.error('请输入一句话介绍')
this.$dialog.error("请输入店铺简介"); return
return;
} }
if (this.innApplyInfo.desc.length === 0) {
if (this.uploadedFilesArray.length == 0) { this.$dialog.error('请输入店铺简介')
this.$dialog.error("请上传至少一张店铺图片"); return
return;
} }
if (this.uploadedFilesArray.length === 0) {
var param = {}; this.$dialog.error('请上传至少一张店铺图片')
//深拷贝 return
param = JSON.parse(JSON.stringify(this.innApplyInfo)); }
// 深拷贝
const param = JSON.parse(JSON.stringify(this.innApplyInfo))
if (this.uploadedFilesArray.length > 0) { if (this.uploadedFilesArray.length > 0) {
param.pics = this.uploadedFilesArray.join(','); param.pics = this.uploadedFilesArray.join(',')
} }
param.id = this.innHistory.id
param.id = this.innHistory.id; if (param.coverType === 2) {
param.cover = param.coverVideo
}
uni.showLoading(); uni.showLoading()
postHotelInfoEdit(param).then((res) => { postHotelInfoEdit(param).then((res) => {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: '修改成功!', title: '修改成功!',
mask: false, mask: false,
duration: 1500 duration: 1500
}); })
setTimeout(function () { setTimeout(function () {
uni.navigateBack()
that.$yrouter.back(); }, 1000)
}, 1000);
}).catch((err) => { }).catch((err) => {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
@@ -320,22 +312,31 @@ export default {
icon: 'none', icon: 'none',
mask: false, mask: false,
duration: 1500 duration: 1500
}); })
}).finally(() => {
}) })
} }
} }
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.base-info-section { .base-info-section {
padding: 32rpx; padding: 32rpx 32rpx 120rpx 32rpx;
background: #FFFFFF; background: #FFFFFF;
.img-item {
display: block;
width: 64rpx;
height: 64rpx;
}
.video-item {
width: 64rpx;
height: 64rpx;
}
.inp-textarea {
width: 100%;
height: 200rpx;
color:#C2C5CC;
}
} }
.base-info-section .section-title { .base-info-section .section-title {
@@ -406,6 +407,7 @@ export default {
.base-info-section .item.is_required .cell .cell-value { .base-info-section .item.is_required .cell .cell-value {
flex-grow: 1; flex-grow: 1;
text-align: right;
} }
.base-info-section .item.is_required .cell .cell-title::before { .base-info-section .item.is_required .cell .cell-title::before {
+3 -1
View File
@@ -287,7 +287,9 @@
<u-popup :show="show" mode="center" round="10" closeable @close="show=false"> <u-popup :show="show" mode="center" round="10" closeable @close="show=false">
<view class="popup-body"> <view class="popup-body">
<view class="tc bold">入驻申请须知</view> <view class="tc bold">入驻申请须知</view>
<view class="content" v-html="notice"></view> <view class="content">
<rich-text :nodes="notice" />
</view>
<view class="agree-box"> <view class="agree-box">
<checkbox-group @change="changeAgree"> <checkbox-group @change="changeAgree">
<label> <label>