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
+199 -197
View File
@@ -1,25 +1,30 @@
<template>
<view class="container">
<view class="base-info-section" style="margin-bottom: 86rpx;margin-bottom: 86rpx;">
<!-- <text class="section-title">详细信息</text> -->
<view class="item is_required" @click="chooseLogoImg()">
<view class="base-info-section">
<view
class="item is_required"
@click="chooseLogoImg()"
>
<view class="cell acea-row row-between row-middle">
<view class="cell-title">店铺LOGO</view>
<view class="">
<image style="width: 64rpx;height: 64rpx;"
:src="innApplyInfo.logo.length>0?innApplyInfo.logo:webUrl+'/20210228103411271415.png'"
mode=""></image>
<view>
<image
:src="innApplyInfo.logo ? innApplyInfo.logo : webUrl + '/20210228103411271415.png'"
class="img-item"
/>
</view>
</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item is_required">
<view class="cell acea-row row-between row-middle">
<view class="cell-title">店铺类型</view>
<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">
{{ typeList[typeIndex].name }}
</view>
@@ -29,97 +34,110 @@
</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item is_required" @click="chooseCoverImg()">
<view v-if="innApplyInfo.coverType === 1" class="item is_required" @click="chooseCoverImg()">
<view class="cell acea-row row-between row-middle">
<view class="cell-title">封面照片</view>
<view class="">
<image style="width: 64rpx;height: 64rpx;"
:src="innApplyInfo.cover.length>0?innApplyInfo.cover:webUrl+'/20210228103411271415.png'"
mode=""></image>
<view>
<image
:src="innApplyInfo.cover ? innApplyInfo.cover : webUrl + '/20210228103411271415.png'"
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>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item" @click="chooseQrcodeImg()">
<view class="cell acea-row row-between row-middle">
<view class="cell-title">微信二维码</view>
<view class="">
<image style="width: 64rpx;height: 64rpx;"
:src="innApplyInfo.qrcode.length>0?innApplyInfo.qrcode:webUrl+'/20210228103411271415.png'"
mode=""></image>
<view>
<image
:src="innApplyInfo.qrcode ? innApplyInfo.qrcode : webUrl + '/20210228103411271415.png'"
class="img-item"
/>
</view>
</view>
<text class="iconfont icon-jiantou"></text>
</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.ownerName" placeholder="请输入店主名字"
placeholder-style="font-size:24rpx;color:#C2C5CC;"/>
<view class="cell-value">
<input
v-model="innApplyInfo.ownerName"
type="text"
placeholder="请输入店主名字"
placeholder-style="font-size:24rpx;color:#C2C5CC;"
/>
</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="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.content" placeholder="店铺风格一句话描述"
placeholder-style="font-size:24rpx;color:#C2C5CC;"/>
<view class="cell-value">
<input
v-model="innApplyInfo.content"
type="text"
placeholder="店铺风格一句话描述"
placeholder-style="font-size:24rpx;color:#C2C5CC;"
/>
</view>
</view>
</view>
<view class="item is_required">
<view class="cell acea-row row-column">
<view class="cell-title">店铺简介</view>
<view class="">
<textarea style="height: 200rpx;color:#C2C5CC;" v-model="innApplyInfo.desc" placeholder="请输入店铺简介..."
placeholder-style="font-size:24rpx;color:#C2C5CC;"/>
<view>
<textarea
v-model="innApplyInfo.desc"
placeholder="请输入店铺简介..."
placeholder-style="font-size:24rpx;color:#C2C5CC;"
class="inp-textarea"
/>
</view>
</view>
</view>
<view class="item">
<view class="img-upload">
<tm-upload
:dataList="picsArray"
:upload_img_wh="uploadImgWH"
:upload_max="uploadMax"
:url="uploadUrl"
:header="uploadHeader"
@change="uploadedImgChange"/>
:dataList="picsArray"
:upload_img_wh="(750 - 3 * 16 - 2 * 32) / 3.0"
:upload_max="10"
:url="uploadUrl"
:header="uploadHeader"
@change="uploadedImgChange"
/>
</view>
</view>
</view>
<view class="submit-btn" @tap="submit">确定修改</view>
</view>
</template>
<script>
import CitySelect from "@/components/CitySelect";
import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue';
import {chooseImage} from "@/utils";
import {VUE_APP_API_URL} from "@/config"
import {getHotelTypeList, postHotelInfoEdit} from "@/api/inn.js";
var that;
import CitySelect from '@/components/CitySelect'
import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue'
import {
chooseImage,
chooseVideoToUpload
} from '@/utils'
import {VUE_APP_API_URL} from '@/config'
import {getHotelTypeList, postHotelInfoEdit} from '@/api/inn.js'
export default {
components: {
CitySelect,
@@ -129,190 +147,164 @@ export default {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
uploadUrl: VUE_APP_API_URL + '/api/upload',
uploadImgWH: (750 - 3 * 16 - 2 * 32) / 3.0,
uploadHeader: {
Authorization: "Bearer " + this.$store.getters.token
Authorization: 'Bearer ' + this.$store.getters.token
},
innHistory: {},//历史信息
innHistory: {}, // 历史信息
picsArray: [],
typeList: [],//类型列表
typeIndex: 0,//选中的类型
typeRange: [],//类型数据源
typeList: [], // 类型列表
typeIndex: 0, // 选中的类型
typeRange: [], // 类型数据源
uploadedFilesArray: [],
uploadMax: 10,
innApplyInfo: {
"address": "",
"areaId": 0,
"cityId": 0,
"provinceId": 0,
"content": "",
"cover": "",
"desc": "",
"logo": "",
"name": "",
"ownerName": "",
"pics": [],
"position": "",
"tel": "",
"qrcode": "",
"tips": "",
"type": "",
'address': '',
'areaId': 0,
'cityId': 0,
'provinceId': 0,
'content': '',
'cover': '',
'coverType': 1, // coverType: 1-图片,2-视频
'desc': '',
'logo': '',
'name': '',
'ownerName': '',
'pics': [],
'position': '',
'tel': '',
'qrcode': '',
'tips': '',
'type': ''
}
}
},
onShow: function () {
this.getHotelType();
onShow() {
this.getHotelType()
},
onLoad: function (e) {
that = this;
if (e.hotel) {
//赋值
var hotel = JSON.parse(decodeURIComponent(e.hotel));
this.innHistory = hotel;
this.fillData(this.innApplyInfo, this.innHistory);
//Object.assign(this.innApplyInfo,hotel);
//this.addressText = this.innHistory.provinceName+" "+this.innHistory.cityName+" "+this.innHistory.areaName;
//图片填充
onLoad(options) {
const id = options.id
if (id) {
// 赋值
const hotel = JSON.parse(uni.getStorageSync('MY_HOTEL_INFO'))
this.innHistory = hotel
this.fillData(this.innApplyInfo, this.innHistory)
if (hotel.coverType === 2) {
this.innApplyInfo.coverVideo = hotel.cover
} else {
this.innApplyInfo.coverVideo = ''
}
// 图片填充
this.picsArray = hotel.pics.map(function (item) {
var obj = {
return {
path: item,
upload_percent: 100
}
return obj;
});
})
}
},
methods: {
typePickerChange: function (e) {
this.typeIndex = e.target.value;
//修改type
this.typeIndex = e.target.value
// 修改type
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) => {
that.typeList = res.data;
//构建数据源
that.typeRange = [];
that.typeList.forEach((item, index) => {
that.typeRange.push(item.name);
});
//重新填写模式预填充type
let len = this.typeList.length;
_this.typeList = res.data
// 构建数据源
_this.typeRange = [];
_this.typeList.forEach((item, index) => {
_this.typeRange.push(item.name)
})
// 重新填写模式预填充type
const len = this.typeList.length
if (len > 0) {
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) {
//var keys = Object.keys(target);
//this.uploadedFilesArray = source.pics;
Object.keys(target).forEach((value, key) => {
target[value] = source[value];
// console.log('key:'+value);
});
target[value] = source[value]
})
},
//文件上传结果
// 文件上传结果
uploadedImgChange: function (uploadedFilesList) {
this.uploadedFilesArray = uploadedFilesList;
this.uploadedFilesArray = uploadedFilesList
},
chooseQrcodeImg: function () {
chooseQrcodeImg() {
chooseImage(img => {
that.$set(that.innApplyInfo, 'qrcode', img);
});
this.$set(this.innApplyInfo, 'qrcode', img)
})
},
chooseLogoImg: function () {
chooseLogoImg() {
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 => {
that.innApplyInfo.cover = img;
});
this.$set(this.innApplyInfo, 'cover', img)
})
},
// successImage(e){
// uni.showModal({
// content : '上传成功,详细信息请看控制台'
// })
// },
// successvideo(e){
// },
submit: function () {
if (this.innApplyInfo.logo.length == 0) {
this.$dialog.error("请上传店铺LOGO图片");
return;
submit() {
if (this.innApplyInfo.logo.length === 0) {
this.$dialog.error('请上传店铺LOGO图片')
return
}
if (this.innApplyInfo.cover.length == 0) {
this.$dialog.error("请上传店铺封面图片");
return;
if (this.innApplyInfo.cover.length === 0 && this.innApplyInfo.coverType === 1) {
this.$dialog.error('请上传店铺封面图片')
return
}
if (this.innApplyInfo.ownerName.length == 0) {
this.$dialog.error("请输入店主名字");
return;
if (this.innApplyInfo.coverVideo.length === 0 && this.innApplyInfo.coverType === 2) {
this.$dialog.error('请上传店铺封面视频')
return
}
// if (this.innApplyInfo.tips.length == 0) {
// this.$dialog.error("请输入关键词");
// return;
// }
if (this.innApplyInfo.content.length == 0) {
this.$dialog.error("请输入一句话介绍");
return;
if (this.innApplyInfo.ownerName.length === 0) {
this.$dialog.error('请输入店主名字')
return
}
if (this.innApplyInfo.desc.length == 0) {
this.$dialog.error("请输入店铺简介");
return;
if (this.innApplyInfo.content.length === 0) {
this.$dialog.error('请输入一句话介绍')
return
}
if (this.uploadedFilesArray.length == 0) {
this.$dialog.error("请上传至少一张店铺图片");
return;
if (this.innApplyInfo.desc.length === 0) {
this.$dialog.error('请输入店铺简介')
return
}
var param = {};
//深拷贝
param = JSON.parse(JSON.stringify(this.innApplyInfo));
if (this.uploadedFilesArray.length === 0) {
this.$dialog.error('请上传至少一张店铺图片')
return
}
// 深拷贝
const param = JSON.parse(JSON.stringify(this.innApplyInfo))
if (this.uploadedFilesArray.length > 0) {
param.pics = this.uploadedFilesArray.join(',');
param.pics = this.uploadedFilesArray.join(',')
}
param.id = this.innHistory.id;
uni.showLoading();
param.id = this.innHistory.id
if (param.coverType === 2) {
param.cover = param.coverVideo
}
uni.showLoading()
postHotelInfoEdit(param).then((res) => {
uni.hideLoading()
uni.showToast({
title: '修改成功!',
mask: false,
duration: 1500
});
})
setTimeout(function () {
that.$yrouter.back();
}, 1000);
uni.navigateBack()
}, 1000)
}).catch((err) => {
uni.hideLoading()
uni.showToast({
@@ -320,22 +312,31 @@ export default {
icon: 'none',
mask: false,
duration: 1500
});
}).finally(() => {
})
})
}
}
}
</script>
<style scoped lang="less">
.base-info-section {
padding: 32rpx;
padding: 32rpx 32rpx 120rpx 32rpx;
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 {
@@ -406,6 +407,7 @@ export default {
.base-info-section .item.is_required .cell .cell-value {
flex-grow: 1;
text-align: right;
}
.base-info-section .item.is_required .cell .cell-title::before {