Feat(店铺):编辑可以上传店铺资质

This commit is contained in:
lifizer
2024-06-26 15:40:08 +08:00
parent 86422f0f14
commit 2bac749ca4
+58 -1
View File
@@ -136,6 +136,14 @@
</view>
</view>
</view> -->
<view class="item is_required">
<view class="cell acea-row row-between row-middle">
<view class="cell-title">
店铺图片
<text class="txt">最多上传9张图片</text>
</view>
</view>
</view>
<view v-if="picsArray.length > 0" class="item">
<view class="img-upload">
<tm-upload
@@ -148,6 +156,26 @@
/>
</view>
</view>
<view class="item is_required">
<view class="cell acea-row row-between row-middle">
<view class="cell-title">
店铺资质
<text class="txt">最多上传9张图片</text>
</view>
</view>
</view>
<view v-if="picsArray.length > 0" class="item">
<view class="img-upload">
<tm-upload
:dataList="qualificationsArray"
:upload_img_wh="(750 - 3 * 16 - 2 * 32) / 3.0"
:upload_max="10"
:url="uploadUrl"
:header="uploadHeader"
@change="uploadedImg2Change"
/>
</view>
</view>
</view>
<view class="submit-btn" @tap="submit">确定修改</view>
</view>
@@ -176,10 +204,12 @@ export default {
},
innHistory: {}, // 历史信息
picsArray: [],
qualificationsArray: [],
typeList: [], // 类型列表
typeIndex: 0, // 选中的类型
typeRange: [], // 类型数据源
uploadedFilesArray: [],
uploadedQualificationFilesArray: [],
innApplyInfo: {
'address': '',
'areaId': 0,
@@ -193,6 +223,7 @@ export default {
'name': '',
'ownerName': '',
'pics': [],
'qualification': [],
'position': '',
'tel': '',
'qrcode': '',
@@ -209,6 +240,7 @@ export default {
if (id) {
// 赋值
const hotel = JSON.parse(uni.getStorageSync('MY_HOTEL_INFO'))
console.log(hotel)
this.innHistory = hotel
this.fillData(this.innApplyInfo, this.innHistory)
if (hotel.coverType === 2) {
@@ -216,7 +248,7 @@ export default {
} else {
this.innApplyInfo.coverVideo = ''
}
// 图片填充
// 店铺图片
this.picsArray = hotel.pics.map(item => {
return {
path: item,
@@ -224,6 +256,17 @@ export default {
}
})
this.uploadedFilesArray = hotel.pics || []
// 资质
const uploadedQualificationFilesArray = []
this.qualificationsArray = hotel.qualifications.map(item => {
const image = item.image || ''
uploadedQualificationFilesArray.push(image)
return {
path: item.image,
upload_percent: 100
}
})
this.uploadedQualificationFilesArray = uploadedQualificationFilesArray
}
},
methods: {
@@ -261,6 +304,10 @@ export default {
uploadedImgChange: function (uploadedFilesList) {
this.uploadedFilesArray = uploadedFilesList
},
// 文件上传结果
uploadedImg2Change: function (uploadedFilesList) {
this.uploadedQualificationFilesArray = uploadedFilesList
},
chooseQrcodeImg() {
chooseImage(img => {
this.$set(this.innApplyInfo, 'qrcode', img)
@@ -311,11 +358,16 @@ export default {
this.$dialog.error('请上传至少一张店铺图片')
return
}
if (this.uploadedQualificationFilesArray.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.qualification = this.uploadedQualificationFilesArray
param.id = this.innHistory.id
if (param.coverType === 2) {
param.cover = param.coverVideo
@@ -430,6 +482,11 @@ export default {
flex-shrink: 0;
margin-right: 10rpx;
}
.base-info-section .item.is_required .cell .cell-title .txt {
margin: 0 0 0 8px;
color: red;
font-size: 22rpx;
}
.base-info-section .item.is_required .cell .cell-value {
flex-grow: 1;