You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/news/consult/storeEdit.vue

235 lines
5.5 KiB

10 months ago
<template>
<view class="addressList">
10 months ago
<view class="addressList-hd">
10 months ago
<!-- <view class="items">
10 months ago
<view class="a">门店相册图片<text>(最多可上传 5 尺寸 230px*236px 大小5M</text></view>
10 months ago
<view class="c">
10 months ago
<u-upload :action="action" :header="header" width="160" @on-uploaded="success" max-count="5"
height="160" :file-list="fileList" :custom-btn="true" :max-size="1 * 1024 * 1024">
10 months ago
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image src="/static/news/icon-upload.png"></image>
<view class="1">上传图片</view>
</view>
</template>
</u-upload>
</view>
10 months ago
</view> -->
10 months ago
<view class="items">
10 months ago
<view class="a">进群分享图<text></text></view>
10 months ago
<view class="c">
<u-upload :action="action" :header="header" @on-remove="onRemove" @on-uploaded="success" width="160"
height="160" :file-list="fileList" :custom-btn="true" max-count="1">
10 months ago
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image :src="$picUrl + '/static/news/icon-upload.png'"></image>
10 months ago
<view class="1">上传图片</view>
</view>
</template>
</u-upload>
</view>
</view>
9 months ago
<view class="items" style="margin-top: 20rpx;">
<view class="a">店铺Logo<text></text></view>
<view class="c">
<u-upload :action="action" :header="header" @on-remove="onRemoveLogo" @on-uploaded="successLogo" width="160"
height="160" :file-list="fileLogoList" :custom-btn="true" max-count="1">
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image :src="$picUrl + '/static/news/icon-upload.png'"></image>
<view class="1">上传图片</view>
</view>
</template>
</u-upload>
</view>
</view>
10 months ago
</view>
10 months ago
<view class="addressList-fd" @click="onSaveSubmit">
10 months ago
<view class="btn">保存</view>
10 months ago
</view>
</view>
</template>
<script>
import Config from '@/core/config'
import * as help from '@/api/help'
export default {
data() {
return {
action: '',
header: {},
fileList: [],
image_id: '',
9 months ago
logo_image_id:'',
fileLogoList:[]
10 months ago
};
},
onReady() {
this.action = (Config.get('apiUrl') + 'upload/image').replace("index.php?s=/", "")
this.header = {
'Storeid': uni.getStorageSync('Store').storeInfo.store_id,
'Access-Token': uni.getStorageSync('AccessToken'),
'platform': "MP-WEIXIN",
}
},
onLoad() {
this.onShowInfo()
},
10 months ago
methods: {
//接受上传返回的数据
success(list) {
if (list.length > 0) {
const { response } = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
this.image_id = response.data.fileInfo.file_id
10 months ago
}
}
},
9 months ago
//接受上传返回的数据
successLogo(list) {
if (list.length > 0) {
const { response } = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
this.logo_image_id = response.data.fileInfo.file_id
}
}
},
onRemoveLogo() {
this.logo_image_id = ''
this.fileLogoList = []
},
10 months ago
onSaveSubmit() {
if (!this.image_id) {
uni.showToast({
9 months ago
title: '请先上传店铺分享图片!',
icon: 'none',
duration: 2000
})
return
}
9 months ago
if (!this.logo_image_id) {
uni.showToast({
title: '请先上传店铺Logo图片!',
icon: 'none',
duration: 2000
})
return
}
help.storeSet({ group_share_img_id: this.image_id,logo_image_id:this.logo_image_id })
10 months ago
.then(res => {
if (res.status) {
uni.showToast({
title: '设置成功',
icon: 'none',
duration: 2000
})
10 months ago
}
10 months ago
})
.finally()
},
onRemove() {
this.image_id = ''
this.fileList = []
},
onShowInfo() {
help.storeInfo()
.then(res => {
if (res.status == 200) {
this.fileList = [{
url: res.data.group_share_img
}]
9 months ago
this.fileLogoList = [{
url: res.data.logo_image
}]
this.image_id = res.data.group_share_img_id
}
})
.finally()
10 months ago
}
}
}
</script>
<style lang="scss" scoped>
.addressList {
10 months ago
margin-top: 16rpx;
padding: 24rpx 40rpx 40rpx;
10 months ago
background: #fff;
10 months ago
&-hd {
background-color: #fff;
.items {
10 months ago
line-height: 50rpx;
font-size: 28rpx;
color: #212121;
10 months ago
.a {
10 months ago
font-size: 28rpx;
color: #3B3B3B;
10 months ago
text {
10 months ago
font-size: 24rpx;
font-weight: 400;
color: #ABABAB;
margin-left: 10rpx;
10 months ago
}
}
10 months ago
.c {
10 months ago
padding-top: 20rpx;
overflow: hidden;
10 months ago
.slot-btn {
10 months ago
width: 184rpx;
height: 184rpx;
background: #F6F6F6;
10 months ago
border-radius: 8rpx;
10 months ago
border: 1px solid #C0C0C0;
text-align: center;
font-size: 24rpx;
font-weight: 500;
color: #757575;
10 months ago
image {
10 months ago
width: 50rpx;
height: 50rpx;
10 months ago
margin-top: 40rpx;
10 months ago
}
}
}
}
10 months ago
10 months ago
}
10 months ago
&-fd {
10 months ago
width: 100%;
position: fixed;
left: 0;
bottom: 0;
padding: 30rpx;
10 months ago
text-align: center;
10 months ago
background-color: #fafafa;
box-sizing: border-box;
10 months ago
.btn {
width: 630rpx;
line-height: 88rpx;
10 months ago
background: #F34A40;
10 months ago
border-radius: 72rpx;
10 months ago
text-align: center;
10 months ago
display: inline-block;
10 months ago
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
}
}
10 months ago
}
</style>