提交修改
This commit is contained in:
+152
-26
@@ -2,7 +2,7 @@
|
||||
<view class="publish-page">
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" title="样机发布"></uni-nav-bar>
|
||||
<view class="form-card">
|
||||
<view class="select-input gradient-bg" @click="showSelect1 = true">
|
||||
<view class="select-input gradient-bg" @click="onSelectCategory()">
|
||||
<view class="category-content">
|
||||
<text class="category-text">{{form.category || '请输入/选择型号'}}</text>
|
||||
</view>
|
||||
@@ -10,12 +10,12 @@
|
||||
</view>
|
||||
<view class="conts mag-top">
|
||||
<view class="">
|
||||
<textarea v-model="form.content" class="content-textarea" placeholder="请输入文字内容"
|
||||
:maxlength="maxWords" @input="handleContentInput" />
|
||||
<textarea v-model="form.content" class="content-textarea" placeholder="例如:西门子 超氧 十字门冰箱,门店展示样机,位于郑州市商都路品牌店,展示年限不足1年外观全新、配件齐全;"
|
||||
:maxlength="maxWords" @input="handleContentInput" @focus="checkLogin()" />
|
||||
</view>
|
||||
|
||||
<view class="media-upload-wrapper">
|
||||
<uni-file-picker fileMediatype="image" limit="9" @select="selectMedia" @delete="delfn" :imageStyles="imageStyles">
|
||||
<uni-file-picker ref="mediaPicker" fileMediatype="image" limit="9" :disabled="!isLogin" @select="selectMedia" @delete="delfn" :imageStyles="imageStyles">
|
||||
<view class="upload-icon-wrapper">
|
||||
<image src="/static/image/photo.png" mode="" class="addimg"></image>
|
||||
</view>
|
||||
@@ -23,11 +23,11 @@
|
||||
</view>
|
||||
<view class="help-text">
|
||||
<u-icon name="info-circle" size="18" color="#A6ABB7"></u-icon>
|
||||
<text>文字不多于2000字,图片不多于9张</text>
|
||||
<text>请上传产品实物的正、侧、背多角度照片(禁止效果图),图片不多于9张</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mag-top">
|
||||
<picker mode="selector" :range="conditionOptions" range-key="name" @change="onCategoryChange">
|
||||
<picker mode="selector" :range="conditionOptions" range-key="name" :disabled="!isLogin" @tap="checkLogin()" @change="onCategoryChange">
|
||||
<view class="select-input gradient-bg">
|
||||
<view class="category-content">
|
||||
<text class="category-text">{{form.agename || '请选择样机新旧程度'}}</text>
|
||||
@@ -37,9 +37,30 @@
|
||||
</picker>
|
||||
</view>
|
||||
<view class="mag-top">
|
||||
<input class="uni-input" focus v-model="form.price" placeholder="请输入折扣价格" />
|
||||
<input class="uni-input" focus v-model="form.price" @focus="checkLogin()" placeholder="请输入折扣价格" />
|
||||
</view>
|
||||
<view class="detils">
|
||||
<view class="mag-top">
|
||||
<view style="margin-bottom: 10rpx;">是否包邮:</view>
|
||||
<uni-data-checkbox v-model="form.is_free" :localdata="freeshipping" />
|
||||
</view>
|
||||
|
||||
<view class="detils" v-if="skudetils!=''">
|
||||
<view class="product-card">
|
||||
<view class="title">产品名称:{{skudetils.product_name}}</view>
|
||||
<view class="price-row">
|
||||
<text class="spec-label">零售价:</text>
|
||||
<text class="spec-value">{{ skudetils.price }}</text>
|
||||
<!-- <text class="model">产品型号:{{ skudetils.model }}</text> -->
|
||||
</view>
|
||||
<view class="spec-row">
|
||||
<text class="spec-label">品牌:</text>
|
||||
<text class="spec-value">{{ skudetils.brand }}</text>
|
||||
</view>
|
||||
<view class="spec-row" v-for="(item, idx) in skudetils.spec_json" :key="idx">
|
||||
<text class="spec-label">{{item.attr_name}}:</text>
|
||||
<text class="spec-value">{{ item.attr_value }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<rich-text :nodes="productcontents"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -88,7 +109,7 @@
|
||||
<u-popup :show="showlogin" :closeOnClickOverlay="false" :round="20" mode="center">
|
||||
<view class="popupcontent">
|
||||
<image class="log1" src="/static/image/log1.png"></image>
|
||||
<view class="title">{{$t('home.loginmsg')}}</view>
|
||||
<view class="title">您还未登录!登录后方可发布内容!</view>
|
||||
<view class="yhxy">
|
||||
<checkbox-group name="" style="width: 28px;display: inline-block;">
|
||||
<label @tap="selfChangde()">
|
||||
@@ -120,18 +141,28 @@ export default {
|
||||
showSelect2:false,
|
||||
searchKey1:'',
|
||||
productcontents:'',
|
||||
skudetils:'',
|
||||
// 单选数据源
|
||||
freeshipping: [ {
|
||||
text: '全国包邮',
|
||||
value: 1
|
||||
}, {
|
||||
text: '省内包邮',
|
||||
value: 2
|
||||
}, {
|
||||
text: '邮费电联',
|
||||
value: 3
|
||||
}],
|
||||
categoryOptions:[],
|
||||
conditionOptions:[
|
||||
{name:'全新',value:'10'},
|
||||
{name:'9成新',value:'9'},
|
||||
{name:'8成新',value:'8'},
|
||||
{name:'7成新',value:'7'},
|
||||
{name:'6成新',value:'6'},
|
||||
{name:'5成新',value:'5'},
|
||||
{name:'4成新',value:'4'},
|
||||
{name:'3成新',value:'3'},
|
||||
{name:'2成新',value:'2'},
|
||||
{name:'1成新',value:'1'},
|
||||
{name:'全新(未开箱)',value:'10'},
|
||||
{name:'95%新(开箱无瑕)',value:'9'},
|
||||
{name:'90%新(外观轻损<2处)',value:'8'},
|
||||
{name:'85%新(外观轻损<3处)',value:'7'},
|
||||
{name:'75%新(外观轻损<5处)',value:'6'},
|
||||
{name:'70%新(外观轻损<6处)',value:'5'},
|
||||
{name:'60%新(外观轻损<7处)',value:'4'},
|
||||
{name:'不足60%新(外观损伤>7处)',value:'3'}
|
||||
],
|
||||
form:{
|
||||
agename:'',
|
||||
@@ -140,7 +171,8 @@ export default {
|
||||
sku_id:'',
|
||||
content:'',
|
||||
media:[],
|
||||
price:''
|
||||
price:'',
|
||||
is_free:1
|
||||
},
|
||||
selfChecked: false,
|
||||
showlogin:false,
|
||||
@@ -153,6 +185,9 @@ export default {
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
isLogin() {
|
||||
return !!uni.getStorageSync('is_login')
|
||||
},
|
||||
canSubmit(){
|
||||
return this.agree && this.form.content.trim().length>0 && this.form.media.length>0
|
||||
},
|
||||
@@ -162,13 +197,30 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getcategory()
|
||||
},
|
||||
onShow() {
|
||||
|
||||
// this.getset()
|
||||
// this.syncTabbar()
|
||||
},
|
||||
methods:{
|
||||
onSelectCategory() {
|
||||
if (!uni.getStorageSync('is_login')) {
|
||||
this.showlogin = true
|
||||
return
|
||||
}
|
||||
this.getcategory()
|
||||
this.showSelect1 = true
|
||||
},
|
||||
checkLogin(cb) {
|
||||
if (!this.isLogin) {
|
||||
this.showlogin = true
|
||||
return
|
||||
}
|
||||
if (typeof cb === 'function') {
|
||||
cb()
|
||||
}
|
||||
},
|
||||
getlocation(){
|
||||
wx.getFuzzyLocation({
|
||||
type: 'wgs84',
|
||||
@@ -205,6 +257,7 @@ export default {
|
||||
})
|
||||
},
|
||||
selectCategory(item){
|
||||
this.skudetils = item
|
||||
this.form.category = item.model || ''
|
||||
this.form.sku_id = item.id || ''
|
||||
// 处理富文本,让图片自适应
|
||||
@@ -243,6 +296,7 @@ export default {
|
||||
phone_code: e.detail.code,
|
||||
}
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.data.code == -1) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
@@ -256,7 +310,7 @@ export default {
|
||||
});
|
||||
//返回数据接收成功
|
||||
uni.setStorageSync('is_login', true);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//商品下拉
|
||||
@@ -294,7 +348,7 @@ export default {
|
||||
uploadfn(imgUrl){
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: 'https://cb.hnxinyouhe.com/upload/image?scene=postlist',
|
||||
url: 'https://bsh.info.yw.hnzhwlkj.cn/upload/image?scene=postlist',
|
||||
filePath: imgUrl,
|
||||
name: 'image',
|
||||
header:{'content-type': 'application/x-www-form-urlencoded','Fdesk-Auth-Token': 'Bearer ' + uni.getStorageSync('token'),'Fdesk-Language': uni.getStorageSync('i18locale')?uni.getStorageSync('i18locale'):'zh','Fdesk-Login-Type': 'wechat','Fdesk-System-Code':'wechat'},
|
||||
@@ -359,6 +413,23 @@ export default {
|
||||
this.agree = true
|
||||
this.show = false
|
||||
},
|
||||
reset(){
|
||||
this.form.agename='';
|
||||
this.form.age='';
|
||||
this.form.category='';
|
||||
this.form.sku_id='';
|
||||
this.form.content='';
|
||||
this.form.media=[];
|
||||
this.form.price='';
|
||||
this.form.is_free=1;
|
||||
this.productcontents=''
|
||||
// 同步清理文件选择器内部的文件列表
|
||||
this.$nextTick(() => {
|
||||
if(this.$refs.mediaPicker && this.$refs.mediaPicker.clearFiles){
|
||||
this.$refs.mediaPicker.clearFiles()
|
||||
}
|
||||
})
|
||||
},
|
||||
submitForm(){
|
||||
// 必填校验
|
||||
if(!this.form.category || !this.form.sku_id){
|
||||
@@ -413,10 +484,12 @@ export default {
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
if(res.data.code ==200){
|
||||
this.reset()
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/square/index',// 替换为你要跳转的页面路径
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/my_favorites',// 替换为你要跳转的页面路径
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
@@ -563,6 +636,11 @@ export default {
|
||||
.mag-top{
|
||||
margin-top: 15px;
|
||||
}
|
||||
.free{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.content-textarea{
|
||||
width: 100%;
|
||||
// background: #F7F8FB;
|
||||
@@ -638,8 +716,9 @@ export default {
|
||||
.foot{
|
||||
background: #fff;
|
||||
position: fixed;
|
||||
bottom: 1rpx;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
z-index: 11;
|
||||
}
|
||||
.agreement{
|
||||
margin: 20px 12px;
|
||||
@@ -790,4 +869,51 @@ export default {
|
||||
line-height: 50px;
|
||||
}
|
||||
}
|
||||
.product-card {
|
||||
background: #fff;
|
||||
margin-top: 16rpx;
|
||||
padding: 24rpx 24rpx 12rpx;
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
color: #111;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.price-row {
|
||||
margin-top: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.price {
|
||||
font-size: 36rpx;
|
||||
color: #111;
|
||||
font-weight: 700;
|
||||
}
|
||||
.retail {
|
||||
font-size: 22rpx;
|
||||
color: #888;
|
||||
}
|
||||
.model {
|
||||
margin-left: auto;
|
||||
font-size: 22rpx;
|
||||
color: #777;
|
||||
}
|
||||
.spec-row {
|
||||
margin-top: 18rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
font-size: 26rpx;
|
||||
color: #555;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.spec-label {
|
||||
color: #777;
|
||||
}
|
||||
.spec-value {
|
||||
color: #444;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user