Init project
This commit is contained in:
@@ -0,0 +1,484 @@
|
||||
<template name="sunui-upimg">
|
||||
<view class="sunui-uploader-bd">
|
||||
<view class="sunui-uploader-files">
|
||||
<block v-for="(item, index) in upload_before_list" :key="index">
|
||||
<view class="sunui-uploader-file" :class="[item.upload_percent < 100 ? 'sunui-uploader-file-status' : '']" :style="'width:' + upload_img_wh + 'rpx; height:' + upload_img_wh + 'rpx;'">
|
||||
<image class="sunui-uploader-img" :style="'width:' + upload_img_wh + 'rpx; height:' + upload_img_wh + 'rpx;'" :src="item.path" mode="aspectFill" @tap="preview(index)" v-if="type === 'image'" />
|
||||
<video :id="`myVideo_${index}`" :src="item.path" :data-index="index" @play="videoPlay" @error="videoError" controls :enable-play-gesture="true" objectFit="contain" :style="'width:' + upload_img_wh + 'rpx; height:' + upload_img_wh + 'rpx;'" v-if="type === 'video'"></video>
|
||||
<view class="sunui-img-removeicon right" @tap.stop="remove(index)" v-show="upimg_move">x</view>
|
||||
<view class="sunui-loader-filecontent" v-if="item.upload_percent < 100">{{item.upload_percent}}%</view>
|
||||
</view>
|
||||
</block>
|
||||
<view v-show="upload_before_list.length < upload_count" hover-class="sunui-uploader-hover" class="sunui-uploader-inputbox" @tap="choose" :style="'width:' + upload_img_wh + 'rpx; height:' + upload_img_wh + 'rpx;'">
|
||||
<view :style="'line-height:'+ upload_img_wh + 'rpx;'"><text class="iconfont icon-mn_shangchuantupian" style="color: #666;"></text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 选择图片tempFile
|
||||
upload_cache: [],
|
||||
// 预览数组->支持从服务器拉取
|
||||
upload_cache_list: [],
|
||||
// 上传数组
|
||||
upload_before_list: [],
|
||||
// 图片大小
|
||||
upload_img_size: [],
|
||||
// 超出限制数组
|
||||
upload_exceeded_list: [],
|
||||
|
||||
// 上传数量
|
||||
// upload_count: 9,
|
||||
// 最大上传容量(M)
|
||||
// upload_max: 1,
|
||||
// 图片/选择宽高
|
||||
// upload_img_wh: 162,
|
||||
// 测试接口(建议七牛、阿里云、腾讯云都采用后端对接,直接调用后端上传)
|
||||
//url: 'https://www.xdd618.com/api/api/upload',
|
||||
// type: 'image', //上传视频为video
|
||||
// header: {
|
||||
|
||||
// },
|
||||
videoContext: [],
|
||||
}
|
||||
},
|
||||
name: 'sunui-upimg',
|
||||
props: {
|
||||
upload_video_max: {
|
||||
type: Number,
|
||||
default: 30 // 最大上传容量(M)
|
||||
},
|
||||
upload_max: {
|
||||
type: Number,
|
||||
default: 1 // 最大上传容量(M)
|
||||
},
|
||||
upload_count: {
|
||||
type: Number,
|
||||
default: 9 // 上传数量
|
||||
},
|
||||
upload_img_wh: {
|
||||
type: Number,
|
||||
default: 162 // 图片/选择宽高
|
||||
},
|
||||
header: {
|
||||
type: Object,
|
||||
default:function() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'image'//上传视频为video
|
||||
},
|
||||
// 测试接口(建议七牛、阿里云、腾讯云都采用后端对接,直接调用后端上传)
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
upload_auto: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
upimg_move: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
onReady(res) {
|
||||
this.$nextTick(() => {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
this.videoContext[i] = uni.createVideoContext(`myVideo_${i}`);
|
||||
}
|
||||
});
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
watch: {
|
||||
// url(val) {
|
||||
// this.upload_before_list.map((item) => {
|
||||
// this.upload_cache_list.push(item.path);
|
||||
// });
|
||||
// this.emit();
|
||||
// }
|
||||
dataList:{
|
||||
handler(val){
|
||||
console.log('dataList change'+JSON.stringify(val));
|
||||
this.upload_before_list = val;
|
||||
if(this.upload_before_list.length>0){
|
||||
this.upload_cache_list = [];
|
||||
this.upload_before_list.map((item) => {
|
||||
//过滤掉非网络图片
|
||||
if(item.path.substring(0,4) == 'http' && item.path.substring(0,11) != 'http://tmp/')
|
||||
{
|
||||
this.upload_cache_list.push(item.path);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.upload_cache_list = [];
|
||||
}
|
||||
this.emit();
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
videoPlay(e) {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
this.videoContext[index].requestFullScreen();
|
||||
|
||||
for (let i = 0; i < this.upload_before_list.length; i++) {
|
||||
if (i != index) this.videoContext[i].pause();
|
||||
}
|
||||
},
|
||||
videoError(e) {
|
||||
uni.showModal({
|
||||
content: '网络错误,请稍后重试!',
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
uploadFile(paths) {
|
||||
const promises = paths.map((path) => {
|
||||
return this.promisify(this.uploader)({
|
||||
url: this.url,
|
||||
path: path,
|
||||
name: 'file',
|
||||
header: this.header,
|
||||
extra: {},
|
||||
});
|
||||
});
|
||||
|
||||
/* uni.showLoading({
|
||||
title: `正在上传...`,
|
||||
}); */
|
||||
|
||||
Promise.all(promises).then((data) => {
|
||||
// uni.hideLoading();
|
||||
console.log("uploaded img:"+JSON.stringify(data))
|
||||
this.upload_cache_list.push(...data);
|
||||
console.log("after uploaded upload_cache_list:"+JSON.stringify(this.upload_cache_list))
|
||||
this.emit();
|
||||
}).catch((res) => {
|
||||
console.log(res);
|
||||
// uni.hideLoading();
|
||||
});
|
||||
},
|
||||
choose() {
|
||||
switch (this.type) {
|
||||
case 'video':
|
||||
uni.chooseVideo({
|
||||
count: this.upload_count - this.upload_before_list.length,
|
||||
compressed: true,
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async (res) => {
|
||||
res.path = res.tempFilePath;
|
||||
res.upload_percent = 0;
|
||||
|
||||
if (Math.ceil(res.size / 1024) < this.upload_video_max * 1024) {
|
||||
await this.upload_img_size.push(Math.ceil(res.size / 1024));
|
||||
await this.upload_before_list.push(res);
|
||||
} else {
|
||||
this.upload_exceeded_list.push(1);
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `视频超出限制${this.upload_video_max}MB,已忽略`,
|
||||
showCancel: false,
|
||||
confirmText: '确认',
|
||||
success(res) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
this.upload_cache = [];
|
||||
this.upload_cache.push(res.tempFilePath);
|
||||
this.upload(this.upload_auto);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'image':
|
||||
uni.chooseImage({
|
||||
count: this.upload_count - this.upload_before_list.length,
|
||||
sizeType: ['compressed', 'original'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async (res) => {
|
||||
for (let i = 0, len = res.tempFiles.length; i < len; i++) {
|
||||
res.tempFiles[i].upload_percent = 0;
|
||||
|
||||
if (Math.ceil(res.tempFiles[i].size / 1024) < this.upload_max * 1024) {
|
||||
await this.upload_img_size.push(Math.ceil(res.tempFiles[i].size / 1024));
|
||||
await this.upload_before_list.push(res.tempFiles[i]);
|
||||
// TODO v3.1增加图片格式限制
|
||||
} else {
|
||||
res.tempFilePaths.splice(i, 1);
|
||||
this.upload_exceeded_list.push(i === 0 ? 1 : i + 1);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `第${[...new Set(this.upload_exceeded_list)].join(',')}张图片超出限制${this.upload_max}MB,已过滤`,
|
||||
showCancel: false,
|
||||
confirmText: '确认',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
this.upload_img_size.splice(i--, 1);
|
||||
this.upload_exceeded_list.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
this.upload_cache = await res.tempFilePaths;
|
||||
this.upload(this.upload_auto);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async upload(upload_auto) {
|
||||
upload_auto ? await this.uploadFile(this.upload_cache) : console.warn(
|
||||
`传输参数:this.$refs.xx.upload(true)才可上传,默认false`);
|
||||
},
|
||||
preview(idx) {
|
||||
uni.previewImage({
|
||||
current: idx,
|
||||
urls: this.upload_cache_list
|
||||
});
|
||||
},
|
||||
remove(idx) {
|
||||
console.log("tmupload remove");
|
||||
this.upload_before_list.splice(idx, 1);
|
||||
this.upload_cache_list.splice(idx, 1);
|
||||
this.emit();
|
||||
},
|
||||
emit() {
|
||||
console.log("tmupload emit change");
|
||||
this.$emit('change', this.upload_cache_list);
|
||||
},
|
||||
promisify(api) {
|
||||
return (options, ...params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
api(Object.assign({}, options, {
|
||||
success: resolve,
|
||||
fail: reject
|
||||
}), ...params);
|
||||
});
|
||||
}
|
||||
},
|
||||
uploader(options) {
|
||||
var url = options.url,
|
||||
path = options.path,
|
||||
name = options.name,
|
||||
header = options.header,
|
||||
// data = options.data,
|
||||
extra = options.extra,
|
||||
success = options.success,
|
||||
progress = options.progress,
|
||||
fail = options.fail;
|
||||
|
||||
const uploadTask = uni.uploadFile({
|
||||
url: url,
|
||||
filePath: path,
|
||||
name: name,
|
||||
header: header,
|
||||
formData: extra,
|
||||
success(res) {
|
||||
console.log(res);
|
||||
if (res.data != null) {
|
||||
let d = JSON.parse(res.data);
|
||||
var furl = JSON.parse(res.data).link
|
||||
success(furl);
|
||||
} else{
|
||||
fail(res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// let data = d.data;
|
||||
// console.log(res);
|
||||
// if (res.statusCode === 200) {
|
||||
// if (data.id) {
|
||||
// success(data.fullPath);
|
||||
// } else {
|
||||
// fail(data);
|
||||
// }
|
||||
// } else {
|
||||
// fail(data);
|
||||
|
||||
// if (res.statusCode === 401) {
|
||||
// this.$tui.toast('未登录或登录状态过期', 2000);
|
||||
// let _this = this;
|
||||
|
||||
// setTimeout(() => {
|
||||
// _this.$utils.goAuth();
|
||||
// }, 2000);
|
||||
// } else if (data.statusCode === 403) {
|
||||
// this.$tui.toast(item.message, 2000);
|
||||
// }
|
||||
// }
|
||||
},
|
||||
fail(res) {
|
||||
fail(res);
|
||||
}
|
||||
});
|
||||
|
||||
uploadTask.onProgressUpdate(async (res) => {
|
||||
// this.upload_before_list[this.upload_before_list.length-1].upload_percent = await res.progress;
|
||||
for(let i in this.upload_before_list) { if(this.upload_before_list[i].upload_percent != 100) { this.upload_before_list[i].upload_percent = await res.progress; break; } };
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@font-face {
|
||||
font-family: "iconfont";
|
||||
src: url('//at.alicdn.com/iconfont.eot?t=1574391686418');
|
||||
/* IE9 */
|
||||
src: url('//at.alicdn.com/iconfont.eot?t=1574391686418#iefix') format('embedded-opentype'),
|
||||
/* IE6-IE8 */
|
||||
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAMkAAsAAAAAB2QAAALYAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcAqCYIJEATYCJAMICwYABCAFhG0HPRt3BhEVlCNkH4dxmzUXNsJHc1SNfR9KTkCtiXv/l+QDBQSFRBJdKoEsg60HUgCsOpWVnWxNx3BvVITqkj3fepbtzM/OfDo4D86iFEIiJAeX02+Bh/O84TLmsrEnYBxQoHtgm6xACoxTkN0zFsgEdQynCShpq7cwbsK0eTKROSkgbNu8cbUspRFrkoNMkC9ZGYWjcrJkX/IIR/zPhz/6hIxELmWmzdowfp1RvxdbYWm1VrUMCO54JvDrSNEbkTCv1DJDGvp6S5VUX9SRdSUHfi+u1cBZ7R+PQMgzEyugNcU5J67DO9VfJiCigD042iuNQqXSunGRfvrWV6/mvX49/+3bhW/eLHr4puOFtxMfvO5w9tX8yv7rIbf3Rrl84Mbe66XSzWet46nn/etMuALua5LqNZUqpKdfDKjsv2qef+yambJsTWM2zDtKIQ0pS7msvSTUpn1tNyts2xZmWUyw3LI4bPisSZNyOUc2y4/scfZs3QZ1UcgqUWtkVednsvnVs7NOHzmqglXIBnqU7+/M9Hp3y3L2RLWYA9uhlat61/LGGwVqt9Nvafv/8R2fmg/pu7LesH9ZOYL3/6e3P6Z2O0rbIztra+Dtc1u2RY1vapOocEtDiT0Kd1VUUkIN42joS19Fk1s1BVmKy0OioA2kMp1REdcbcsr6QV5mJJT0MnF9mbQRchZiET29CAT1fSBR1y1I1fdFRdwPcpr6Q179cIaSBaHRjmVdgxFjCSvGFuonmGYcpK1nESRfUC1dRUm+T3ggeeOEOIiywRwHpDHm+FUlzBIkjT1k5DzsuhEmGi02HGjmKQ1DWfaioBn7gzAWQRWGWqD2BIzGaCDRm4nc+y+QsuhUqKaqyviAiGcGB7FA1AKVS4ZWVddyibdSEoxJQCKjHsjIMNTpjMBUPsxCDRbQPTyTVGh1k20lwfyy/un2QYmpTII1I9Vo+1B4XQ2q0QvwvExGfTgA') format('woff2'),
|
||||
url('//at.alicdn.com/iconfont.woff?t=1574391686418') format('woff'),
|
||||
url('//at.alicdn.com/iconfont.ttf?t=1574391686418') format('truetype'),
|
||||
/* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
|
||||
url('//at.alicdn.com/iconfont.svg?t=1574391686418#iconfont') format('svg');
|
||||
/* iOS 4.1- */
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-mn_shangchuantupian:before {
|
||||
content: "\e559";
|
||||
}
|
||||
|
||||
.icon-mn_shangchuantupian {
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
.sunui-uploader-img {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sunui-uploader-input {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sunui-uploader-inputbox {
|
||||
position: relative;
|
||||
margin-bottom: 16rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #ededed;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sunui-img-removeicon {
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
width: 40upx;
|
||||
height: 40upx;
|
||||
line-height: 40upx;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
background-color: #E54D42;
|
||||
|
||||
&.right {
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.sunui-uploader-file {
|
||||
position: relative;
|
||||
margin-right: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.sunui-uploader-file-status:before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.sunui-loader-filecontent {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: #fff;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.sunui-uploader-bd {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sunui-uploader-files {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sunui-uploader-file:nth-child(4n+0) {
|
||||
// margin-right: 0;
|
||||
}
|
||||
|
||||
.sunui-uploader-inputbox {
|
||||
&>view {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.sunui-uploader-file-status:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.sunui-uploader-hover {
|
||||
box-shadow: 0 0 0 #e5e5e5;
|
||||
background: #e5e5e5;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,782 @@
|
||||
<template>
|
||||
<view class="container" style="padding-bottom: 150rpx;">
|
||||
<view class="base-info-section">
|
||||
<text class="section-title">基本信息</text>
|
||||
<view class="item is_required">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20210228103509027781.png'"/>
|
||||
</view>
|
||||
<view class="cell acea-row row-between row-middle">
|
||||
<view class="cell-title">店铺名称</view>
|
||||
<view class="cell-value">
|
||||
<input type="text" v-model="innApplyInfo.name" placeholder="请输入店铺中文名称"
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <text class="iconfont icon-jiantou"></text> -->
|
||||
</view>
|
||||
|
||||
<view class="item is_required">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20210405104608775924.png'"/>
|
||||
</view>
|
||||
<view class="cell acea-row row-between row-middle" style="flex-wrap: nowrap;">
|
||||
<view class="cell-title">店铺类型</view>
|
||||
<view class="cell-value">
|
||||
<picker :value="typeIndex" @change="typePickerChange" :range="typeRange">
|
||||
<!-- <view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-if="typeList.length>0">{{typeList[typeIndex].name}}</view> -->
|
||||
<view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-if="parseInt(innApplyInfo.type)>0">
|
||||
{{ typeList[typeIndex].name }}
|
||||
</view>
|
||||
<view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-else>请选择店铺类型</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view class="item is_required">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20210228103432722049.png'"/>
|
||||
</view>
|
||||
<view class="cell acea-row row-between row-middle">
|
||||
<view class="cell-title">店铺省市区</view>
|
||||
<view class="">
|
||||
<CitySelect
|
||||
ref="cityselect"
|
||||
:defaultValue="addressText"
|
||||
@callback="result"
|
||||
:items="district"
|
||||
></CitySelect>
|
||||
</view>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view class="item is_required">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20210228103348614918.png'"/>
|
||||
</view>
|
||||
<view class="cell acea-row row-between row-middle">
|
||||
<view class="cell-title">详细地址</view>
|
||||
<view class="cell-value">
|
||||
<input type="text" v-model="innApplyInfo.address" placeholder="请输入详细地址"
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="item is_required">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20210228103518230014.png'"/>
|
||||
</view>
|
||||
<view class="cell acea-row row-between row-middle">
|
||||
<view class="cell-title">联系电话</view>
|
||||
<view class="cell-value">
|
||||
<input type="text" v-model="innApplyInfo.tel" placeholder="请输入联系电话"
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="item is_required" @click="chooLocation()">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20210228103444957710.png'"/>
|
||||
</view>
|
||||
<view class="cell acea-row row-between row-middle" style="flex-wrap: nowrap;">
|
||||
<view class="cell-title">地图定位选择</view>
|
||||
<view v-if="innApplyInfo.position.length>0" class="cell-value" style="text-align: right;">
|
||||
{{ innApplyInfo.position }}
|
||||
</view>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view class="base-info-section" style="margin-bottom: 150rpx !important;margin-top: 20rpx;">
|
||||
<text class="section-title">详细信息</text>
|
||||
<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>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view 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>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view class="item" @click="chooseQrcodeImg()">
|
||||
<view class="cell acea-row row-between row-middle" style="flex-wrap: nowrap;">
|
||||
<view class="cell-title acea-row row-column">
|
||||
<view class="">店主微信二维码</view>
|
||||
<view style="color:#B9B9BC;font-size: 24rpx;">(注意:不是商城二维码,是个人微信二维码)</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<image style="width: 64rpx;height: 64rpx;"
|
||||
:src="innApplyInfo.qrcode.length>0?innApplyInfo.qrcode:webUrl+'/20210228103411271415.png'"
|
||||
mode=""></image>
|
||||
</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">
|
||||
<input type="text" v-model="innApplyInfo.ownerName" 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">
|
||||
<input type="text" v-model="innApplyInfo.content" 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">-->
|
||||
<!-- <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-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>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="item">
|
||||
<view class="img-upload">
|
||||
<tmUpload
|
||||
:dataList="picsArray"
|
||||
:upload_img_wh="uploadImgWH"
|
||||
:url="uploadUrl"
|
||||
:type='uploadType'
|
||||
:header="uploadHeader"
|
||||
@change="uploadedImgChange"/>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="bottom-wrap acea-row row-between savepadding">
|
||||
<view class="acea-row">
|
||||
<view class="acea-row"
|
||||
style="border-top: #BFBFBF;border-width: 1rpx;font-size: 24rpx;color: #BFBFBF;padding-left: 32rpx;">
|
||||
<checkbox-group @change="agreementChange">
|
||||
<label>
|
||||
<checkbox :checked="isAgreementChecked" style="border-radius: 50%;transform:scale(0.7)"/>
|
||||
<text>阅读并同意遵守</text>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
<text class="" style="margin-left: 4rpx;text-decoration: underline;" @tap="showPartnerAgreement">
|
||||
《店主合伙人协议条款》
|
||||
</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="submit-btn" @tap="submit">提交申请</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CitySelect from "@/components/CitySelect";
|
||||
import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue';
|
||||
import {getCity} from "@/api/user";
|
||||
import {chooseImage, isWeixin} from "@/utils";
|
||||
import {getHomeData} from "@/api/public";
|
||||
import {VUE_APP_API_URL} from "@/config"
|
||||
import {getHotelTypeList, postHotelApply, postHotelReApply} from "@/api/inn.js";
|
||||
|
||||
let that;
|
||||
export default {
|
||||
components: {
|
||||
CitySelect,
|
||||
tmUpload
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
partnerAgreement: '',
|
||||
isAgreementChecked: true,
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
uploadUrl: VUE_APP_API_URL + '/api/upload',
|
||||
uploadType: 'image',
|
||||
uploadImgWH: (750 - 3 * 16 - 2 * 32) / 3.0,
|
||||
uploadHeader: {
|
||||
Authorization: "Bearer " + this.$store.getters.token
|
||||
},
|
||||
type: 0,//0-申请 -1-重新申请 2-修改
|
||||
innHistory: {},//历史信息
|
||||
picsArray: [],
|
||||
typeList: [],//类型列表
|
||||
typeIndex: 0,//选中的类型
|
||||
typeRange: [],
|
||||
uploadedFilesArray: [],
|
||||
innApplyInfo: {
|
||||
"address": "",
|
||||
"areaId": 0,
|
||||
"cityId": 0,
|
||||
"provinceId": 0,
|
||||
"content": "",
|
||||
"cover": "",
|
||||
"desc": "",
|
||||
"logo": "",
|
||||
"name": "",
|
||||
"ownerName": "",
|
||||
"pics": [],
|
||||
"position": "",
|
||||
"qrcode": "",
|
||||
"tel": "",
|
||||
"tips": "",
|
||||
"type": "",
|
||||
},//申请信息
|
||||
district: [],
|
||||
isWechat: isWeixin(),
|
||||
addressText: ""
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
this.getHotelType();
|
||||
},
|
||||
onLoad: function (e) {
|
||||
that = this;
|
||||
this.type = e.type;
|
||||
console.log('this.type', this.type);
|
||||
var title = '申请我的店铺';
|
||||
switch (this.type) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
title = '修改店铺申请';
|
||||
break;
|
||||
case 2:
|
||||
title = '修改店铺资料';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
;
|
||||
//改变title
|
||||
uni.setNavigationBarTitle({
|
||||
title: title
|
||||
});
|
||||
|
||||
//
|
||||
if (e.hotel) {
|
||||
//赋值
|
||||
var hotel = JSON.parse(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;
|
||||
|
||||
//图片填充
|
||||
this.picsArray = hotel.pics.map(function (item) {
|
||||
var obj = {
|
||||
path: item,
|
||||
upload_percent: 100
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
|
||||
this.getCityList();
|
||||
|
||||
//this.fetchCompanyData()
|
||||
},
|
||||
methods: {
|
||||
agreementChange: function (e) {
|
||||
this.isAgreementChecked = !this.isAgreementChecked;
|
||||
},
|
||||
showPartnerAgreement: function () {
|
||||
this.$yrouter.push('/pagesInn/inn/innPartnerAgreement');
|
||||
},
|
||||
fetchCompanyData: function () {
|
||||
var that = this;
|
||||
getHomeData().then(res => {
|
||||
// that.buyNotice = res.data.buyNotice;
|
||||
that.partnerAgreement = res.data.partnerAgreement.replace(
|
||||
/\<img/gi,
|
||||
'<img style="max-width:100%;height:auto;"'
|
||||
);
|
||||
});
|
||||
},
|
||||
typePickerChange: function (e) {
|
||||
this.typeIndex = e.target.value;
|
||||
|
||||
//修改type
|
||||
if (this.typeList.length > 0) {
|
||||
this.$set(this.innApplyInfo, 'type', this.typeList[this.typeIndex].id);
|
||||
//this.$forceUpdate();
|
||||
console.log("type:" + this.innApplyInfo.type);
|
||||
}
|
||||
},
|
||||
getHotelType: function () {
|
||||
getHotelTypeList().then((res) => {
|
||||
|
||||
that.typeList = res.data;
|
||||
|
||||
//构建数据源
|
||||
that.typeRange = [];
|
||||
that.typeList.forEach((item, index) => {
|
||||
that.typeRange.push(item.name);
|
||||
});
|
||||
|
||||
//重新填写模式预填充type
|
||||
if (that.type == 1 && Object.keys(that.innHistory).length != 0) {
|
||||
for (var i = 0; i < that.typeList.length; i++) {
|
||||
var item = that.typeList[i];
|
||||
//找到类型id相同的索引
|
||||
if (item.id === that.innHistory.type) {
|
||||
that.typeIndex = i;
|
||||
//设置type
|
||||
if (that.typeList.length > 0) {
|
||||
that.$set(that.innApplyInfo, 'type', item.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}).catch((err) => {
|
||||
|
||||
}).finally(() => {
|
||||
|
||||
})
|
||||
},
|
||||
fillData: function (target, source) {
|
||||
//var keys = Object.keys(target);
|
||||
|
||||
Object.keys(target).forEach((value, key) => {
|
||||
target[value] = source[value];
|
||||
console.log('key:' + value);
|
||||
});
|
||||
|
||||
|
||||
//预填充type
|
||||
for (var i = 0; i < this.typeList.length; i++) {
|
||||
var item = this.typeList[i];
|
||||
//找到类型id相同的索引
|
||||
if (item.id === that.innHistory.type) {
|
||||
this.typeIndex = i;
|
||||
//设置type
|
||||
if (this.typeList.length > 0) {
|
||||
this.$set(this.innApplyInfo, 'type', item.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
result(values) {
|
||||
|
||||
console.log(values);
|
||||
// this.address = {
|
||||
// province: values.province.name || "",
|
||||
// city: values.city.name || "",
|
||||
// district: values.district.name || "",
|
||||
// city_id: values.city.id
|
||||
// };
|
||||
|
||||
this.innApplyInfo.cityId = values.city.id;
|
||||
this.innApplyInfo.provinceId = values.province.id;
|
||||
this.innApplyInfo.areaId = values.district.id;
|
||||
this.addressText = values.province.name + " " + values.city.name + " " + values.district.name;
|
||||
//this.addressText = `${this.address.province} ${this.address.city} ${this.address.district}`;
|
||||
|
||||
},
|
||||
chooLocation() {
|
||||
uni.chooseLocation({
|
||||
success: function (res) {
|
||||
console.log('位置名称:' + res.name);
|
||||
console.log('详细地址:' + res.address);
|
||||
console.log('纬度:' + res.latitude);
|
||||
console.log('经度:' + res.longitude);
|
||||
|
||||
that.innApplyInfo.address = res.address;
|
||||
|
||||
that.innApplyInfo.position = that.$forceToDecimal(res.longitude, 6) + ',' + that.$forceToDecimal(res.latitude, 6);
|
||||
}
|
||||
});
|
||||
},
|
||||
getIndex(value, arr) {
|
||||
var idx = -1;
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (arr[i].n == value) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return idx;
|
||||
},
|
||||
getCityList: function () {
|
||||
let that = this;
|
||||
getCity()
|
||||
.then(res => {
|
||||
that.district = res.data;
|
||||
// that.ready = true;
|
||||
|
||||
// if(this.id){
|
||||
// //设置city_id
|
||||
// var pIdx = that.getIndex(that.address.province,that.district);
|
||||
// if(pIdx>-1){
|
||||
// var citys = that.district[pIdx].c;
|
||||
// var cIdx = that.getIndex(that.address.city,citys);
|
||||
// if(cIdx>-1){
|
||||
// var city = citys[cIdx];
|
||||
// that.address.city_id = city.v;
|
||||
// console.log('city_id:'+city.v);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
that.$dialog.error(err.msg);
|
||||
});
|
||||
},
|
||||
chooseQrcodeImg: function () {
|
||||
chooseImage(img => {
|
||||
console.log(img)
|
||||
that.$set(that.innApplyInfo, 'qrcode', img);
|
||||
|
||||
});
|
||||
},
|
||||
chooseLogoImg: function () {
|
||||
chooseImage(img => {
|
||||
console.log(img)
|
||||
|
||||
that.innApplyInfo.logo = img;
|
||||
|
||||
});
|
||||
},
|
||||
chooseCoverImg: function () {
|
||||
chooseImage(img => {
|
||||
console.log(img)
|
||||
|
||||
that.innApplyInfo.cover = img;
|
||||
|
||||
});
|
||||
},
|
||||
//文件上传结果
|
||||
uploadedImgChange: function (uploadedFilesList) {
|
||||
this.uploadedFilesArray = uploadedFilesList;
|
||||
},
|
||||
submit: function () {
|
||||
|
||||
if (this.innApplyInfo.name.length == 0) {
|
||||
this.$dialog.error("请输入店铺名称");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.type.length == 0) {
|
||||
this.$dialog.error("请选择店铺类型");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.addressText.length == 0) {
|
||||
this.$dialog.error("请选择店铺所在省市区");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.address.length == 0) {
|
||||
this.$dialog.error("请输入店铺详细地址");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.tel.length == 0) {
|
||||
this.$dialog.error("请输入店铺联系电话");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.position.length == 0) {
|
||||
this.$dialog.error("请选择店铺地图定位坐标");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.logo.length == 0) {
|
||||
this.$dialog.error("请上传店铺LOGO图片");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.cover.length == 0) {
|
||||
this.$dialog.error("请上传店铺封面图片");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.ownerName.length == 0) {
|
||||
this.$dialog.error("请输入店主名字");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.content.length == 0) {
|
||||
this.$dialog.error("请输入一句话介绍");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (this.innApplyInfo.tips.length == 0) {
|
||||
// this.$dialog.error("请输入关键词");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this.innApplyInfo.desc.length == 0) {
|
||||
this.$dialog.error("请输入店铺简介");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.uploadedFilesArray.length == 0) {
|
||||
this.$dialog.error("请上传至少一张店铺图片");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isAgreementChecked == false) {
|
||||
this.$dialog.error("请勾选同意店主合伙人协议条款");
|
||||
return;
|
||||
}
|
||||
|
||||
var param = {};
|
||||
//深拷贝
|
||||
param = JSON.parse(JSON.stringify(this.innApplyInfo));
|
||||
if (this.uploadedFilesArray.length > 0) {
|
||||
param.pics = this.uploadedFilesArray.join(',');
|
||||
}
|
||||
|
||||
//设置type
|
||||
if (this.typeList.length > 0) {
|
||||
this.$set(this.innApplyInfo, 'type', this.typeList[this.typeIndex].id);
|
||||
}
|
||||
|
||||
//提交请求
|
||||
if (this.type == 0) {//申请
|
||||
this.submitApplyInfo(param);
|
||||
} else if (this.type == 1) {//重新申请
|
||||
//如果是编辑,把id赋值
|
||||
param.id = this.innHistory.id;
|
||||
this.resubmitApplyInfo(param);
|
||||
}
|
||||
|
||||
},
|
||||
submitApplyInfo: function (param) {
|
||||
|
||||
uni.showLoading();
|
||||
postHotelApply(param).then((res) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '提交成功!',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
|
||||
//返回
|
||||
setTimeout(function () {
|
||||
that.$yrouter.back();
|
||||
}, 1500);
|
||||
|
||||
}).catch((err) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
icon: 'none',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
}).finally(() => {
|
||||
|
||||
})
|
||||
},
|
||||
resubmitApplyInfo: function (param) {
|
||||
uni.showLoading();
|
||||
postHotelReApply(param).then((res) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '提交成功!',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
|
||||
//返回
|
||||
setTimeout(function () {
|
||||
that.$yrouter.back();
|
||||
}, 1500);
|
||||
|
||||
}).catch((err) => {
|
||||
uni.hideLoading()
|
||||
|
||||
var msg = '提交出错,请重试';
|
||||
if (err.msg != null) {
|
||||
msg = err.msg + '';
|
||||
}
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
icon: 'none',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
}).finally(() => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
|
||||
.base-info-section {
|
||||
padding: 32rpx;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.base-info-section .section-title {
|
||||
font-size: 28rpx;
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: 500;
|
||||
color: #080F1A;
|
||||
}
|
||||
|
||||
.base-info-section .item {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
padding: 20rpx 0rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.base-info-section .item .iconfont {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.base-info-section .item::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0rpx;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
z-index: 1;
|
||||
height: 1rpx;
|
||||
}
|
||||
|
||||
.base-info-section .item .pictrue {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.base-info-section .item .cell {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.base-info-section .item .cell input {
|
||||
text-align: right;
|
||||
color: #C2C5CC;
|
||||
}
|
||||
|
||||
.base-info-section .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.base-info-section .item.is_required .cell .cell-title {
|
||||
flex-shrink: 0;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.base-info-section .item.is_required .cell .cell-value {
|
||||
flex-grow: 1;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.base-info-section .item.is_required .cell .cell-title::before {
|
||||
content: "*";
|
||||
color: #ff4949;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
// .bottom-cover{
|
||||
// position: fixed;
|
||||
// height: 86rpx;
|
||||
// width: 100%;
|
||||
// left: 0;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// }
|
||||
.bottom-wrap {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 86rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
line-height: 86rpx;
|
||||
// margin: 50rpx auto 30rpx auto;
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
background: #fff;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 160rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
background: #0DC5C5;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,387 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<hx-navbar
|
||||
title=" "
|
||||
:fixed="true"
|
||||
statusBarFontColor="#ffffff"
|
||||
barPlaceholder="hidden"
|
||||
transparent="auto"
|
||||
color="#FFFFFF"
|
||||
:background-color="[[254,150,107],[255, 88, 75]]"
|
||||
:pageScroll.sync="scrollData"/>
|
||||
<!-- <block slot="right">
|
||||
<view class="">
|
||||
<text class="iconfont icon-fenxiang" style="font-size: 48rpx;"></text>
|
||||
<view class="" @click="like">
|
||||
<image v-if="innInfo.isLike==0" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210302161110012686.png'" mode=""></image>
|
||||
<image v-if="innInfo.isLike>0" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210302161135069143.png'" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</block> -->
|
||||
</hx-navbar>
|
||||
|
||||
<block v-if="innInfo">
|
||||
<view v-if="innInfo.type=='NT_TEXT'" class="banner">
|
||||
<swiper :current="swiperCurrentIndex" indicatorDots="true" indicator-active-color='rgba(255, 255, 255, 1)' indicator-color='rgba(255, 255, 255, 0.3)' v-if="innInfo.resources.length > 0" autoplay circular>
|
||||
<block v-for="(imgUrl, index) in innInfo.resources" :key="index">
|
||||
<swiper-item>
|
||||
<view class="swiper-item">
|
||||
<image class="swiper-item-content" :src="imgUrl" style="object-fit: cover;" mode="aspectFill" />
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
|
||||
<!-- <view class="share-section" style="position: absolute;left: 0;right: 0;">
|
||||
<view class="acea-row row-middle row-right pad20" style="flex-shrink: 0;">
|
||||
<view class="" style="margin-right: 20rpx;"><image @click="shareInfo" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210304153545482917.png'" mode=""></image></view>
|
||||
|
||||
<view class="" @click="likeInfo">
|
||||
<image v-if="innInfo.isLike == null || parseInt(innInfo.isLike)==0" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210302161110012686.png'" mode=""></image>
|
||||
<image v-if="innInfo.isLike != null && parseInt(innInfo.isLike)==1" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210302161135069143.png'" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="cover">
|
||||
|
||||
</view>
|
||||
<view class="title-section acea-row row-middle">
|
||||
<view class="" style="font-size: 32rpx;color: #ffffff;flex-grow: 1;">{{innInfo.name}}</view>
|
||||
<!-- <view class="acea-row row-column pad20" style="flex-shrink: 0;">
|
||||
<image @click="shareInfo" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210304153545482917.png'" mode=""></image>
|
||||
|
||||
<view class="" @click="likeInfo">
|
||||
<image v-if="innInfo.isLike == null || parseInt(innInfo.isLike)==0" style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210302161110012686.png'" mode=""></image>
|
||||
<image v-else style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210302161135069143.png'" mode=""></image>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- <image style="width: 750rpx;position: absolute;left: 0;bottom: 0;" :src="webUrl+'/20210227115029488890.png'" mode="widthFix"></image> -->
|
||||
</view>
|
||||
|
||||
<view v-if="innInfo.type=='NT_VIDEO'" class="banner">
|
||||
<block v-if="innInfo.resources.length > 0">
|
||||
<video style="width: 100%;height: 100%;" autoplay :src="innInfo.resources[0]"></video>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view class="hotel-section acea-row row-center">
|
||||
<view class="hotel-logo">
|
||||
<image :src="innInfo.hotelLogo" mode=""></image>
|
||||
</view>
|
||||
<view class="acea-row row-column" style="flex-grow: 1;">
|
||||
<view class="hotel-name">{{innInfo.hotelName}}</view>
|
||||
<view class="hotel-date">{{formattedDateStr(innInfo.createdTime)}}</view>
|
||||
</view>
|
||||
|
||||
<view class="enrollInnBtn acea-row row-center row-middle" @click="enrollInn">进入主页</view>
|
||||
</view>
|
||||
|
||||
<view class="detail-section" v-html="innInfo.content">
|
||||
<!-- {{innInfo.content}} -->
|
||||
</view>
|
||||
|
||||
<view class="bottom-holder acea-row row-middle row-right savebottom">
|
||||
<view class="acea-row row-middle">
|
||||
<view class="acea-row row-middle">
|
||||
<image style="width: 28rpx;height: 28rpx;margin-right: 4rpx;" :src="webUrl+'/20220901224017781784.png'" mode=""></image>
|
||||
<text class="seeNum-txt">{{innInfo.pv}}</text>
|
||||
</view>
|
||||
<view class="acea-row row-middle" style="margin-left: 20rpx;" @click="likeInfo">
|
||||
<block v-if="innInfo.zanVo != null">
|
||||
<image style="width: 28rpx;height: 28rpx;margin-right: 4rpx;" :src="webUrl+'/20210302161135069143.png'" mode=""></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image style="width: 28rpx;height: 28rpx;margin-right: 4rpx;" :src="webUrl+'/20220901224304100136.png'" mode=""></image>
|
||||
</block>
|
||||
<text class="likeNum-txt">{{innInfo.zan}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getHotelNewsDetail,getHotelNewsZan} from "@/api/inn.js";
|
||||
import { formatDateTime,isNullOrEmpty} from "@/utils";
|
||||
import ShareInfo from "@/components/ShareInfo";
|
||||
var that;
|
||||
export default {
|
||||
components:{
|
||||
ShareInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webUrl:this.$VUE_APP_RESOURCES_URL,
|
||||
scrollData: {},
|
||||
shareInfoStatus: false,
|
||||
innInfo:null,
|
||||
swiperHeight:300,
|
||||
swiperCurrentIndex:0,
|
||||
// innInfo:{
|
||||
// isLike:0,
|
||||
// type:'NT_TEXT',
|
||||
// resources:[
|
||||
// 'http://resource.xdd618.com/黄精.jpg',
|
||||
// 'http://resource.xdd618.com/黄精.jpg',
|
||||
// ]
|
||||
// },
|
||||
innId:0
|
||||
}
|
||||
},
|
||||
//必须在页面加 onPageScroll(e){} ,才能滑动显示背景
|
||||
onPageScroll(e){
|
||||
this.scrollData = e;
|
||||
},
|
||||
onLoad:function(e){
|
||||
that = this;
|
||||
this.innId = e.id;
|
||||
|
||||
this.fetchInnInfoDetail();
|
||||
},
|
||||
methods: {
|
||||
// changeSwiper:function(e){
|
||||
// this.swiperCurrentIndex = e.detail.current;
|
||||
// this.getCurrentSwiperHeight('.swiper-item-content');
|
||||
// },
|
||||
// getCurrentSwiperHeight(element) {
|
||||
// let query = uni.createSelectorQuery().in(this);
|
||||
// query.selectAll(element).boundingClientRect();
|
||||
// query.exec((res) => {
|
||||
// that.swiperHeight = res[0][this.swiperCurrentIndex].height;
|
||||
// console.log("swiperHeight:"+that.swiperHeight);
|
||||
// })
|
||||
// },
|
||||
setShareInfoStatus: function() {
|
||||
this.shareInfoStatus = !this.shareInfoStatus;
|
||||
},
|
||||
shareInfo:function(){
|
||||
this.setShareInfoStatus();
|
||||
},
|
||||
likeInfo:function(){
|
||||
var id = this.innId;
|
||||
uni.showLoading();
|
||||
getHotelNewsZan(id).then((res)=>{
|
||||
uni.hideLoading();
|
||||
var msg = '操作成功!';
|
||||
if(res.msg.length>0){
|
||||
msg = res.msg;
|
||||
}
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
setTimeout(function(){
|
||||
//刷新界面
|
||||
that.fetchInnInfoDetail();
|
||||
},1500);
|
||||
|
||||
}).catch((err)=>{
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: err.msg+'',
|
||||
icon:'none',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
}).finally(()=>{
|
||||
|
||||
})
|
||||
},
|
||||
enrollInn:function(){
|
||||
//this.$yrouter.redirectTo('');
|
||||
var id = this.innInfo.hotelId;
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length>1) {
|
||||
var prePage = pages[pages.length - 2];
|
||||
//判断上一页是不是客栈主页
|
||||
if(prePage.route == 'pagesInn/inn/innHome'){
|
||||
this.$yrouter.back();
|
||||
}else{
|
||||
this.$yrouter.replace({
|
||||
path: "/pagesInn/inn/innHome",
|
||||
query: { id: id }
|
||||
});
|
||||
}
|
||||
}else{
|
||||
this.$yrouter.replace({
|
||||
path: "/pagesInn/inn/innHome",
|
||||
query: { id: id }
|
||||
});
|
||||
}
|
||||
},
|
||||
formattedDateStr:function(str){
|
||||
return formatDateTime(str,'yyyy/MM/dd HH:mm:ss');
|
||||
},
|
||||
fetchInnInfoDetail:function(){
|
||||
|
||||
getHotelNewsDetail(this.innId).then((res)=>{
|
||||
that.innInfo = res.data;
|
||||
}).catch((err)=>{
|
||||
|
||||
uni.showToast({
|
||||
title: err.msg+'',
|
||||
icon:'none',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
}).finally(()=>{
|
||||
|
||||
})
|
||||
},
|
||||
like:function(){
|
||||
uni.showLoading();
|
||||
getHotelNewsZan(this.innId).then((res)=>{
|
||||
uni.hideLoading();
|
||||
//刷新界面
|
||||
that.fetchInnDetail();
|
||||
|
||||
}).catch((err)=>{
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err+'',
|
||||
icon:'none',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
}).finally(()=>{
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.container{
|
||||
position: relative;
|
||||
background: #ffffff;
|
||||
}
|
||||
.cover{
|
||||
width: 100%;
|
||||
height: 218rpx;
|
||||
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
|
||||
opacity: 0.6;
|
||||
// background-color:transparent;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.title-section{
|
||||
padding: 32rpx;
|
||||
// width: 100%;
|
||||
// height: 218rpx;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.banner {
|
||||
height: 750rpx;
|
||||
-webkit-transform:rotate(0);
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner swiper{
|
||||
// height: 600rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner .swiper-item{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.banner image{
|
||||
width: 100%;
|
||||
// height: 600rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.hotel-section{
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.hotel-logo{
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.hotel-logo image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.hotel-name{
|
||||
font-size: 28rpx;
|
||||
color: #080F1A;
|
||||
}
|
||||
|
||||
.hotel-date{
|
||||
font-size: 22rpx;
|
||||
color: #C2C5CC;
|
||||
}
|
||||
|
||||
.enrollInnBtn{
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
width: 122rpx;
|
||||
height: 48rpx;
|
||||
background: #0DC5C5;
|
||||
opacity: 1;
|
||||
border-radius: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.likeNum-txt{
|
||||
font-size: 22rpx;
|
||||
color: #080F1A;
|
||||
}
|
||||
|
||||
.seeNum-txt{
|
||||
font-size: 22rpx;
|
||||
color: #080F1A;
|
||||
}
|
||||
|
||||
|
||||
.detail-section{
|
||||
padding: 32rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #080F1A;
|
||||
margin-bottom: 114rpx;
|
||||
}
|
||||
|
||||
.bottom-holder{
|
||||
position: fixed;
|
||||
background-color: transparent;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 114rpx;
|
||||
padding: 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.share-section{
|
||||
top: var(--status-bar-height);
|
||||
padding-top: 44px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<view class="page-info-publish">
|
||||
<view class="tab-box flex jc-center">
|
||||
<text :class="{'active':tabIndex==index}" v-for="(item,index) in tabData" :key="item"
|
||||
@click="changeTab(index)">{{item.label}}</text>
|
||||
</view>
|
||||
|
||||
<form @submit="formSubmit">
|
||||
<view class="form-item">
|
||||
<view class="title">标题:</view>
|
||||
<input v-model="title" type="text" placeholder="请输入动态标题..."
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<textarea class="content-style" v-model="content" placeholder="请输入动态内容..."
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;" />
|
||||
</view>
|
||||
|
||||
<view class="form-item" v-if="showUpload">
|
||||
<tm-upload :dataList="picsArray" :upload_img_wh="uploadImgWH" :upload_max="uploadMax" :url="uploadUrl" :type='uploadType'
|
||||
:header="uploadHeader" @change="uploadedImgChange" />
|
||||
</view>
|
||||
|
||||
<view class="form-btn">
|
||||
<button form-type="submit">发布</button>
|
||||
</view>
|
||||
</form>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue';
|
||||
import {
|
||||
VUE_APP_API_URL
|
||||
} from "@/config";
|
||||
import {
|
||||
postHotelNewsAdd
|
||||
} from "@/api/inn.js";
|
||||
export default {
|
||||
components: {
|
||||
tmUpload
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
uploadUrl: VUE_APP_API_URL + '/api/upload',
|
||||
uploadType: 'image',
|
||||
uploadCount: 9,
|
||||
uploadImgWH: (750 - 3 * 16 - 2 * 32) / 3.0,
|
||||
uploadHeader: {
|
||||
Authorization: "Bearer " + this.$store.getters.token
|
||||
},
|
||||
uploadedFilesArray: [],
|
||||
uploadMax:10,
|
||||
picsArray: [],
|
||||
showUpload:true,
|
||||
|
||||
hotelId: 0,
|
||||
tabData: [{
|
||||
label: "图文动态",
|
||||
type: "NT_TEXT",
|
||||
uploadType: "image",
|
||||
uploadCount: 9
|
||||
},
|
||||
{
|
||||
label: "视频动态",
|
||||
type: "NT_VIDEO",
|
||||
uploadType: "video",
|
||||
uploadCount: 1
|
||||
}
|
||||
],
|
||||
tabIndex: 0,
|
||||
title: "",
|
||||
content: ""
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.hotelId = option.hotelId;
|
||||
},
|
||||
methods: {
|
||||
changeTab(index) {
|
||||
this.tabIndex = index;
|
||||
this.showUpload=false;
|
||||
this.uploadType= this.tabData[index].uploadType;
|
||||
this.uploadCount= this.tabData[index].uploadCount;
|
||||
|
||||
setTimeout(()=>{
|
||||
this.showUpload=true;
|
||||
},100)
|
||||
},
|
||||
|
||||
//文件上传结果
|
||||
uploadedImgChange: function(uploadedFilesList) {
|
||||
this.uploadedFilesArray = uploadedFilesList;
|
||||
},
|
||||
|
||||
formSubmit(e) {
|
||||
if (this.title.length == 0) {
|
||||
this.$dialog.error("请输入动态标题");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.content.length == 0) {
|
||||
this.$dialog.error("请输入动态内容");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.uploadedFilesArray.length == 0) {
|
||||
this.$dialog.error("请上传动态图片或视频");
|
||||
return;
|
||||
}
|
||||
|
||||
let param = {
|
||||
hotelId: this.hotelId,
|
||||
name: this.title,
|
||||
content: this.content,
|
||||
type: this.tabData[this.tabIndex].type,
|
||||
resources: this.uploadedFilesArray.join(",")
|
||||
};
|
||||
|
||||
uni.showLoading();
|
||||
postHotelNewsAdd(param).then(res => {
|
||||
uni.hideLoading();
|
||||
this.$dialog.toast({
|
||||
mes: "发布成功!"
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$yrouter.back();
|
||||
}, 1000);
|
||||
}).catch((err) => {
|
||||
uni.hideLoading();
|
||||
this.$dialog.error(err.msg);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page-info-publish {
|
||||
font-size: 28rpx;
|
||||
|
||||
.tab-box {
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
line-height: 1;
|
||||
|
||||
.active {
|
||||
background: #0DC5C5;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
text {
|
||||
padding: 8rpx 10rpx;
|
||||
border: 1rpx solid #0DC5C5;
|
||||
color: #0DC5C5;
|
||||
}
|
||||
|
||||
text:first-child {
|
||||
border-radius: 8rpx 0 0 8rpx;
|
||||
}
|
||||
|
||||
text:last-child {
|
||||
border-radius: 0 8rpx 8rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.form-item {
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
|
||||
.content-style {
|
||||
height: 200rpx;
|
||||
color: #C2C5CC;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.form-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
|
||||
button {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 0;
|
||||
background: #0DC5C5;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="content">
|
||||
<view v-if="partnerAgreement" v-html="partnerAgreement"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { imageBase64,getHomeData } from "@/api/public";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
partnerAgreement:null
|
||||
}
|
||||
},
|
||||
|
||||
onLoad:function(e){
|
||||
this.fetchCompanyData();
|
||||
},
|
||||
onShow:function(){
|
||||
|
||||
},
|
||||
methods: {
|
||||
fetchCompanyData:function(){
|
||||
var that = this;
|
||||
getHomeData().then(res => {
|
||||
// that.buyNotice = res.data.buyNotice;
|
||||
that.partnerAgreement = res.data.partnerAgreement.replace(
|
||||
/\<img/gi,
|
||||
'<img style="max-width:100%;height:auto;"'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content{
|
||||
background-color: #fff;
|
||||
margin: 20rpx;
|
||||
padding:20rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: normal;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,433 @@
|
||||
<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="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>
|
||||
</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">
|
||||
<view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-if="typeList.length>0">
|
||||
{{ typeList[typeIndex].name }}
|
||||
</view>
|
||||
<view style="text-align: right;font-size:24rpx;color:#C2C5CC;" v-else>请选择店铺类型</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view 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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</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"/>
|
||||
</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;
|
||||
export default {
|
||||
components: {
|
||||
CitySelect,
|
||||
tmUpload
|
||||
},
|
||||
data() {
|
||||
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
|
||||
},
|
||||
innHistory: {},//历史信息
|
||||
picsArray: [],
|
||||
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": "",
|
||||
}
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
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;
|
||||
|
||||
//图片填充
|
||||
this.picsArray = hotel.pics.map(function (item) {
|
||||
var obj = {
|
||||
path: item,
|
||||
upload_percent: 100
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
typePickerChange: function (e) {
|
||||
this.typeIndex = e.target.value;
|
||||
|
||||
//修改type
|
||||
if (this.typeList.length > 0) {
|
||||
this.$set(this.innApplyInfo, 'type', this.typeList[this.typeIndex].id);
|
||||
}
|
||||
},
|
||||
getHotelType: function () {
|
||||
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;
|
||||
if (len > 0) {
|
||||
for (let i = 0; i < len; 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);
|
||||
});
|
||||
},
|
||||
//文件上传结果
|
||||
uploadedImgChange: function (uploadedFilesList) {
|
||||
this.uploadedFilesArray = uploadedFilesList;
|
||||
},
|
||||
chooseQrcodeImg: function () {
|
||||
chooseImage(img => {
|
||||
that.$set(that.innApplyInfo, 'qrcode', img);
|
||||
});
|
||||
},
|
||||
chooseLogoImg: function () {
|
||||
chooseImage(img => {
|
||||
that.innApplyInfo.logo = img;
|
||||
});
|
||||
},
|
||||
chooseCoverImg: function () {
|
||||
chooseImage(img => {
|
||||
that.innApplyInfo.cover = img;
|
||||
});
|
||||
},
|
||||
// successImage(e){
|
||||
// uni.showModal({
|
||||
// content : '上传成功,详细信息请看控制台'
|
||||
// })
|
||||
// },
|
||||
// successvideo(e){
|
||||
// },
|
||||
submit: function () {
|
||||
|
||||
if (this.innApplyInfo.logo.length == 0) {
|
||||
this.$dialog.error("请上传店铺LOGO图片");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.cover.length == 0) {
|
||||
this.$dialog.error("请上传店铺封面图片");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.innApplyInfo.ownerName.length == 0) {
|
||||
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.desc.length == 0) {
|
||||
this.$dialog.error("请输入店铺简介");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.uploadedFilesArray.length == 0) {
|
||||
this.$dialog.error("请上传至少一张店铺图片");
|
||||
return;
|
||||
}
|
||||
|
||||
var param = {};
|
||||
//深拷贝
|
||||
param = JSON.parse(JSON.stringify(this.innApplyInfo));
|
||||
if (this.uploadedFilesArray.length > 0) {
|
||||
param.pics = this.uploadedFilesArray.join(',');
|
||||
}
|
||||
|
||||
param.id = this.innHistory.id;
|
||||
|
||||
|
||||
uni.showLoading();
|
||||
postHotelInfoEdit(param).then((res) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '修改成功!',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
that.$yrouter.back();
|
||||
|
||||
}, 1000);
|
||||
}).catch((err) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: err.msg + '',
|
||||
icon: 'none',
|
||||
mask: false,
|
||||
duration: 1500
|
||||
});
|
||||
}).finally(() => {
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
|
||||
.base-info-section {
|
||||
padding: 32rpx;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.base-info-section .section-title {
|
||||
font-size: 28rpx;
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: 500;
|
||||
color: #080F1A;
|
||||
}
|
||||
|
||||
.base-info-section .item {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
padding: 20rpx 0rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.base-info-section .item .iconfont {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.base-info-section .item::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0rpx;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
z-index: 1;
|
||||
height: 1rpx;
|
||||
}
|
||||
|
||||
.base-info-section .item .pictrue {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.base-info-section .item .cell {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.base-info-section .item .cell input {
|
||||
text-align: right;
|
||||
color: #C2C5CC;
|
||||
}
|
||||
|
||||
.base-info-section .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.base-info-section .item.is_required .cell .cell-title {
|
||||
flex-shrink: 0;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.base-info-section .item.is_required .cell .cell-value {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.base-info-section .item.is_required .cell .cell-title::before {
|
||||
content: "*";
|
||||
color: #ff4949;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
|
||||
.submit-btn {
|
||||
height: 86rpx;
|
||||
text-align: center;
|
||||
line-height: 86rpx;
|
||||
// margin: 50rpx auto 30rpx auto;
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
background: #0DC5C5;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user