调整 添加贸易条款
This commit is contained in:
+136
-8
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="pages">
|
||||
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="二手车录入"></uni-nav-bar> -->
|
||||
<view class="content">
|
||||
<view class="cell">
|
||||
@@ -76,7 +77,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view>里程</view>
|
||||
<view>里程(Km)</view>
|
||||
<view class="right">
|
||||
<input placeholder="请输入里程" v-model="carinfo.mileage" />
|
||||
</view>
|
||||
@@ -90,11 +91,25 @@
|
||||
<view class="cont">
|
||||
<view class="conts">产品图</view>
|
||||
<view class="media-upload-wrapper">
|
||||
<uni-file-picker ref="mediaPicker" limit="20" fileMediatype="image" @select="selectMedia" @delete="delfn" >
|
||||
<!-- #ifdef H5 -->
|
||||
<view class="h5-picker-grid">
|
||||
<view class="h5-thumb" v-for="(u, idx) in imagesurl" :key="idx">
|
||||
<image :src="u" mode="aspectFill" class="h5-thumb-img"></image>
|
||||
<view class="h5-thumb-del" @tap.stop="delfn({ index: idx })">删除</view>
|
||||
</view>
|
||||
<view class="upload-icon-wrapper" @tap="pickImagesH5">
|
||||
<image src="/static/image/img.png" class="addimg"></image>
|
||||
<!-- <view class="h5-count">{{ carinfo.images.length }}/{{ maxMedia }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef H5 -->
|
||||
<uni-file-picker ref="mediaPicker" :limit="maxMedia" fileMediatype="image" @select="selectMedia" @delete="delfn" >
|
||||
<view class="upload-icon-wrapper">
|
||||
<image src="/static/image/img.png" mode="" class="addimg"></image>
|
||||
<image src="/static/image/img.png" class="addimg"></image>
|
||||
</view>
|
||||
</uni-file-picker>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="cont">
|
||||
@@ -161,7 +176,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { request,showToast } from '@/api/apiT.js'
|
||||
@@ -177,6 +192,7 @@
|
||||
boundProduct:null,
|
||||
keyword:''
|
||||
},
|
||||
imagesurl:[],
|
||||
carinfo:{
|
||||
product_name:'',
|
||||
vin:'',
|
||||
@@ -196,7 +212,9 @@
|
||||
crawl_series:'',
|
||||
crawl_year:'',
|
||||
crawl_msrp:'',
|
||||
crawl_car_id:''
|
||||
crawl_car_id:'',
|
||||
crawl_brand_id:'',
|
||||
crawl_series_id:''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -288,6 +306,8 @@
|
||||
this.carinfo.crawl_year = it.year
|
||||
this.carinfo.crawl_msrp = it.msrp
|
||||
this.carinfo.crawl_car_id = it.car_id
|
||||
this.carinfo.crawl_brand_id = it.brand_id
|
||||
this.carinfo.crawl_series_id = it.series_id
|
||||
console.log(it)
|
||||
this.closeBindDialog()
|
||||
uni.showToast({ title: '绑定成功', icon: 'none' })
|
||||
@@ -299,6 +319,8 @@
|
||||
this.carinfo.crawl_year = ''
|
||||
this.carinfo.crawl_msrp = ''
|
||||
this.carinfo.crawl_car_id = ''
|
||||
this.carinfo.crawl_brand_id = ''
|
||||
this.carinfo.crawl_series_id = ''
|
||||
this.bindState.boundProduct = null
|
||||
uni.showToast({ title: '已清除绑定', icon: 'none' })
|
||||
},
|
||||
@@ -350,13 +372,63 @@
|
||||
if(res && res.data && res.data.file_name){
|
||||
resolve(res.data)
|
||||
}else{
|
||||
reject('上传失败')
|
||||
reject(res)
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
// H5 专用:绕过 uni.chooseImage/chooseMedia 的 9 张限制,使用 uni.chooseFile 支持最多 20 个
|
||||
pickImagesH5() {
|
||||
// const remain = this.maxMedia - this.carinfo.images.length
|
||||
// if (remain <= 0) {
|
||||
// return uni.showToast({ title: `最多只能上传${this.maxMedia}张`, icon: 'none' })
|
||||
// }
|
||||
uni.chooseFile({
|
||||
count: 100,
|
||||
type: 'image',
|
||||
success: (res) => {
|
||||
const paths = (res.tempFilePaths || (res.tempFiles || []).map(it => it.path)).filter(Boolean)
|
||||
if (!paths.length) return
|
||||
Promise.all(paths.map(p => this.uploadfndile(p, 'usedcarimg'))).then(urls => {
|
||||
urls.forEach(url => {
|
||||
this.imagesurl.push(url.file_url)
|
||||
this.carinfo.images.push(url.file_name)
|
||||
})
|
||||
}).catch((e) => {
|
||||
uni.showToast({ title: e.message, icon: 'none' })
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
pickAttachmentH5() {
|
||||
const remain = this.maxMedia - this.carinfo.attachment.length
|
||||
if (remain <= 0) {
|
||||
return uni.showToast({ title: `最多只能上传${this.maxMedia}个`, icon: 'none' })
|
||||
}
|
||||
uni.chooseFile({
|
||||
count: remain,
|
||||
type: 'all',
|
||||
success: (res) => {
|
||||
const files = res.tempFiles || []
|
||||
const paths = (res.tempFilePaths || files.map(it => it.path)).filter(Boolean)
|
||||
if (!paths.length) return
|
||||
Promise.all(paths.map(p => this.uploadfndile(p, 'usedcarfile'))).then(urls => {
|
||||
urls.forEach((url, idx) => {
|
||||
const obj = {}
|
||||
obj.name = url.original_name || files[idx]?.name || '附件'
|
||||
obj.src = url.file_name
|
||||
this.carinfo.attachment.push(obj)
|
||||
})
|
||||
}).catch(() => {
|
||||
uni.showToast({ title:e.message, icon: 'none' })
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
selectMedia(e){
|
||||
const allowCount = this.maxMedia - this.carinfo.images.length
|
||||
const tempFilePaths = e.tempFilePaths || (e.tempFiles || []).map(item => item.path || item.url)
|
||||
@@ -376,6 +448,7 @@
|
||||
})
|
||||
},
|
||||
delfn(e){
|
||||
this.imagesurl.splice(e.index, 1)
|
||||
this.carinfo.images.splice(e.index, 1)
|
||||
},
|
||||
selectMedia1(e){
|
||||
@@ -432,6 +505,9 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.pages{
|
||||
max-width: 650px;
|
||||
}
|
||||
.uniui-right{
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
@@ -739,4 +815,56 @@
|
||||
opacity: .45;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
/* H5 自定义选择器:用于突破 9 个限制(H5 最多 20) */
|
||||
.h5-picker-grid{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap: 16rpx;
|
||||
align-items:flex-start;
|
||||
}
|
||||
.h5-thumb{
|
||||
width: 210rpx;
|
||||
height: 210rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow:hidden;
|
||||
position: relative;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
.h5-thumb-img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.h5-thumb-del{
|
||||
position:absolute;
|
||||
right: 8rpx;
|
||||
top: 8rpx;
|
||||
background: rgba(0,0,0,0.45);
|
||||
color:#fff;
|
||||
font-size: 22rpx;
|
||||
padding: 6rpx 10rpx;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
.h5-count{
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color:#999;
|
||||
text-align:center;
|
||||
}
|
||||
.h5-attach-grid .h5-attach{
|
||||
width: 210rpx;
|
||||
min-height: 120rpx;
|
||||
padding: 16rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 12rpx;
|
||||
background: #fafafa;
|
||||
position: relative;
|
||||
}
|
||||
.h5-attach-name{
|
||||
font-size: 24rpx;
|
||||
color:#333;
|
||||
word-break: break-all;
|
||||
padding-right: 60rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user