This commit is contained in:
浅念
2025-12-26 11:53:13 +08:00
parent 4d6c0d6901
commit ea2e2fec25
6 changed files with 253 additions and 126 deletions
+1 -1
View File
@@ -94,7 +94,7 @@
"versionCode" : 100
},
"mp-weixin" : {
"appid" : "wx62c3f16d37f2c2a2",
"appid" : "wx58c09d95a245d0bb",
"setting" : {
"urlCheck" : false,
"minified" : true,
+3 -4
View File
@@ -26,9 +26,9 @@
<image v-if="danmuVisible" src="/static/image/dan1.png" mode=""></image>
<image v-else src="/static/image/danm.png" mode=""></image>
</view>
<button open-type="share" class="circle-btn">
<!-- <button open-type="share" class="circle-btn">
<image src="/static/image/shares.png" class="share" mode=""></image>
</button>
</button> -->
</view>
</view>
@@ -314,10 +314,9 @@ export default {
data:{ code: loginRes.code }
}).then(res => {
if (res.data.code === 200) {
uni.setStorageSync('openid', res.data.data.openid);
uni.setStorageSync('token', res.data.data.token);
uni.setStorageSync('is_release', res.data.data.is_release);
if (res.data.data.mobile) {
uni.setStorageSync('is_login', true);
} else {
+97 -70
View File
@@ -1,57 +1,61 @@
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.changinfo')"></uni-nav-bar>
<view class="content">
<view class="cell">
<view>{{$t('mine.avatar')}}</view>
<view class="right">
<uni-file-picker fileMediatype="image" limit="1" @select="select" @delete="delfn" :del-icon="false" disable-preview :imageStyles="imageStyles">
<image :src="userinfo.avatar_pull==''?'/static/image/mine/user.png':userinfo.avatar_pull" mode="" class="addimg"></image>
</uni-file-picker>
<form @submit="bcFn">
<view class="content">
<view class="cell">
<view>{{$t('mine.avatar')}}</view>
<view class="right">
<button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar" >
<image :src="userinfo.avatar_pull==''?'/static/image/mine/user.png':userinfo.avatar_pull" mode="" class="addimg"></image>
</button>
</view>
</view>
<view class="cell1">
<view>{{$t('mine.nickname')}}</view>
<view class="right select" @click="chackfn()">
<text v-if="ischack">{{ userinfo.nickname }}</text>
<input v-else :placeholder="$t('mine.nickinput')" type="nickname" name="nickname" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view class="cell1">
<view>门店名称</view>
<view class="right select">
<input placeholder="请填写门店名称" v-model="userinfo.shop_name" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view class="cell1">
<view>门店电话</view>
<view class="right select">
<input placeholder="请填写门店电话" v-model="userinfo.mobile" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view class="cell1">
<view>门店位置</view>
<view class="right select">
<input placeholder="请选择门店位置" v-model="userinfo.location_name" disabled="disabled" @focus="showMap = true" @click="showMap = true" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view v-show="showMap" style="height: 300px; margin: 0 20px 20px 20px;">
<map
style="width: 100%; height: 100%;"
:latitude="centerLat"
:longitude="centerLng"
:markers="markers"
scale="14"
@tap="onMapTap"
/>
</view>
</view>
<view class="cell1">
<view>{{$t('mine.nickname')}}</view>
<view class="right select">
<input :placeholder="$t('mine.nickinput')" v-model="userinfo.nickname" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view class="cell1">
<view>店铺名称</view>
<view class="right select">
<input placeholder="请填写名称" v-model="userinfo.shop_name" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view class="cell1">
<view>店铺电话</view>
<view class="right select">
<input placeholder="请填写店铺电话" v-model="userinfo.mobile" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view class="cell1">
<view>店铺位置</view>
<view class="right select">
<input placeholder="请选择店铺位置" v-model="userinfo.location_name" disabled="disabled" @focus="showMap = true" @click="showMap = true" />
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
<view v-show="showMap" style="height: 300px; margin: 0 20px 20px 20px;">
<map
style="width: 100%; height: 100%;"
:latitude="centerLat"
:longitude="centerLng"
:markers="markers"
scale="14"
@tap="onMapTap"
/>
</view>
</view>
<view class="foot">
<button class="btn" @click="bcFn">{{$t('button.save')}}</button>
</view>
<view class="foot">
<button class="btn" form-type="submit">{{$t('button.save')}}</button>
</view>
</form>
</view>
</template>
<script>
@@ -62,6 +66,7 @@
centerLat: 39.9042,
centerLng: 116.4074,
markers: [],
ischack:true,
// 若需逆地理,请配置腾讯地图 key(可存储在此或通过 storage 注入)
qqMapKey: 'HQBBZ-SC76W-YUNRZ-34IAD-ARN6K-TZBZ4',
showMap: false,
@@ -89,6 +94,9 @@
this.getinfo()
},
methods: {
chackfn(){
this.ischack = false
},
getFuzzy() {
return new Promise((resolve, reject) => {
wx.getSetting({
@@ -222,6 +230,12 @@
}
});
},
onChooseAvatar(e) {
// 微信返回的是临时文件地址
this.userinfo.avatar = e.detail.avatarUrl
this.userinfo.avatar_pull = e.detail.avatarUrl
this.uploadfn(e.detail.avatarUrl)
},
delfn(){
this.userinfo.avatar =''
},
@@ -233,39 +247,52 @@
leftClick(){
uni.navigateBack({})
},
bcFn(){
bcFn(e) {
const nickname = e.detail.value.nickname
if (nickname) {
this.userinfo.nickname = nickname
}
// 同步到 userinfo,方便后续使用
request({
url:'common/user/update',
method:'POST',
data:{
nickname:this.userinfo.nickname,
avatar:this.userinfo.avatar,
mobile:this.userinfo.mobile,
shop_name:this.userinfo.shop_name,
location_name:this.userinfo.location_name,
latitude:this.userinfo.latitude,
longitude:this.userinfo.longitude
url: 'common/user/update',
method: 'POST',
data: {
nickname:this.userinfo.nickname,
avatar: this.userinfo.avatar,
mobile: this.userinfo.mobile,
shop_name: this.userinfo.shop_name,
location_name: this.userinfo.location_name,
latitude: this.userinfo.latitude,
longitude: this.userinfo.longitude
}
}).then(res => {
uni.showToast({
title: res.data.message,
icon: 'none'
});
if(res.data.code ==200){
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/mine',// 替换为你要跳转的页面路径
});
}, 1000);
title: res.data.message,
icon: 'none'
})
if (res.data.code == 200) {
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/mine'
})
}, 1000)
}
})
}
}
}
</script>
<style>
.avatar-btn{
background: #fff;
}
.avatar-btn::after{
border: 1px solid #fff !important;
}
.uniui-right{
position: absolute;
top: 2px;
+2 -1
View File
@@ -124,7 +124,8 @@ export default {
data: {
current: this.page,
size: this.pageSize,
status: this.status
status: this.status,
scene:'self'
}
}).then(res => {
this.loading = false
+141 -45
View File
@@ -2,11 +2,33 @@
<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="onSelectCategory()">
<view class="select-input gradient-bg position" @click="onSelectCategory()">
<view class="category-content">
<text class="category-text">{{form.category || '请输入/选择型号'}}</text>
</view>
<u-icon name="arrow-down" color="#3BC8BE" size="20"></u-icon>
<!-- 型号选择弹层 -->
<view v-if="showSelect1" class="select-popup">
<!-- 点击空白处关闭下拉 -->
<view class="popup-mask" @click="showSelect1=false"></view>
<view class="popup-panel" @click.stop>
<view class="popup-header">
<input class="popup-search" v-model="searchKey1" placeholder="搜索型号" />
<text class="popup-close" @click="showSelect1=false">取消</text>
</view>
<scroll-view scroll-y class="popup-list">
<view
v-for="item in filteredCategories"
:key="item.id"
class="popup-item"
@click.stop="selectCategory(item)"
>
{{ item.model }} ({{item.product_name}})
</view>
<view v-if="!filteredCategories.length" class="popup-empty">暂无数据</view>
</scroll-view>
</view>
</view>
</view>
<view class="conts mag-top">
<view class="">
@@ -36,11 +58,19 @@
</view>
</picker>
</view>
<view class="mag-top">
<input class="uni-input" focus v-model="form.price" @focus="checkLogin()" placeholder="请输入折扣价格" />
<view class="mag-top prices">
<input
class="uni-input"
type="digit"
:value="form.price"
placeholder="请输入折扣价格"
@input="onPriceInput"
@blur="onPriceBlur"
/>
<text>元</text>
</view>
<view class="mag-top">
<view style="margin-bottom: 10rpx;">是否包邮:</view>
<view style="margin-bottom: 10rpx;"><span style="color: red;">*</span> 是否包邮:</view>
<uni-data-checkbox v-model="form.is_free" :localdata="freeshipping" />
</view>
@@ -65,27 +95,7 @@
</view>
</view>
<!-- 型号选择弹层 -->
<view v-if="showSelect1" class="select-popup">
<view class="popup-mask" @click="showSelect1=false"></view>
<view class="popup-panel">
<view class="popup-header">
<input class="popup-search" v-model="searchKey1" placeholder="搜索型号" />
<text class="popup-close" @click="showSelect1=false">取消</text>
</view>
<scroll-view scroll-y class="popup-list">
<view
v-for="item in filteredCategories"
:key="item.id"
class="popup-item"
@click="selectCategory(item)"
>
{{ item.model }}
</view>
<view v-if="!filteredCategories.length" class="popup-empty">暂无数据</view>
</scroll-view>
</view>
</view>
<view class="foot">
<view class="agreement">
@@ -94,16 +104,16 @@
<text>我已阅读并同意</text>
<text class="link" @click.stop="viewAgreement">《发布协议》</text>
</label>
<button class="primary-btn gradient-btn" @click="submitForm">立即发布</button>
<button class="primary-btn gradient-btn" :disabled="userinfo.is_release!=1" @click="submitForm">立即发布</button>
</view>
</view>
<u-popup :show="show" :closeOnClickOverlay="false" :round="10" mode="center">
<view class="cont-text" >
<rich-text :nodes="viewAgreementcont"></rich-text>
</view>
<view class="cent">
<button class="btn1" @click="show = !show">取消</button>
<button class="btn" @click="agreementbtn">确定</button>
<view class="cents">
<button class="btns1" @click="show = !show">取消</button>
<button class="btns" @click="agreementbtn">确定</button>
</view>
</u-popup>
<u-popup :show="showlogin" :closeOnClickOverlay="false" :round="20" mode="center">
@@ -141,6 +151,7 @@ export default {
showSelect2:false,
searchKey1:'',
productcontents:'',
userinfo:'',
skudetils:'',
// 单选数据源
freeshipping: [ {
@@ -172,7 +183,7 @@ export default {
content:'',
media:[],
price:'',
is_free:1
is_free:''
},
selfChecked: false,
showlogin:false,
@@ -197,6 +208,7 @@ export default {
}
},
onLoad() {
this.getinfo()
},
onShow() {
@@ -204,6 +216,15 @@ export default {
// this.syncTabbar()
},
methods:{
getinfo(){
request({
url:'common/user/info',
method:'POST',
}).then(res => {
this.userinfo=res.data.data.user
uni.setStorageSync('is_release', res.data.data.user.is_release);
})
},
onSelectCategory() {
if (!uni.getStorageSync('is_login')) {
this.showlogin = true
@@ -261,8 +282,10 @@ export default {
this.form.category = item.model || ''
this.form.sku_id = item.id || ''
// 处理富文本,让图片自适应
this.productcontents = this.processRichText(item.desc || '')
console.log(this.productcontents)
if(item.desc !=''&& item.desc !=null){
this.productcontents = this.processRichText(item.desc || '')
console.log(this.productcontents)
}
this.showSelect1 = false
},
goprivacy(){
@@ -345,6 +368,33 @@ export default {
this.form.content = e.detail.value.slice(0,this.maxWords)
}
},
sanitize(v) {
v = String(v || '');
v = v.replace(/[^\d.]/g, ''); // 只留数字和点
const i = v.indexOf('.');
if (i !== -1) {
v = v.slice(0, i + 1) + v.slice(i + 1).replace(/\./g, '');
}
return v;
},
onPriceInput(e) {
const v = this.sanitize(e.detail.value);
// 关键:先更新数据,再 nextTick 强制触发视图回写
if (v !== this.form.price) {
this.form.price = v;
this.$nextTick(() => {
// 再写一次,逼迫输入框用受控值覆盖(对合成态更稳)
this.form.price = v;
});
}
},
onPriceBlur(e) {
// 兜底:失焦时彻底清洗,保证最终不会残留中文
const v = this.sanitize(e.detail.value);
if (v !== this.form.price) this.form.price = v;
},
uploadfn(imgUrl){
return new Promise((resolve, reject) => {
uni.uploadFile({
@@ -421,7 +471,7 @@ export default {
this.form.content='';
this.form.media=[];
this.form.price='';
this.form.is_free=1;
this.form.is_free='';
this.productcontents=''
// 同步清理文件选择器内部的文件列表
this.$nextTick(() => {
@@ -460,6 +510,14 @@ export default {
});
return
}
if(this.form.is_free==''){
uni.showToast({
title: '请选择包邮方式',
icon: 'none'
});
return
}
if(!this.form.media || this.form.media.length === 0){
uni.showToast({
title: '请至少上传一张图片',
@@ -503,6 +561,11 @@ export default {
</script>
<style lang="scss">
.prices{
display: flex;
align-items: center;
gap: 10px;
}
.detils{
margin-top: 40rpx;
overflow: hidden;
@@ -747,29 +810,32 @@ export default {
background: #3BC8BE;
margin-top: 20rpx;
}
.select-popup{
position: fixed;
inset: 0;
z-index: 999;
.position{
position: relative;
}
.popup-mask{
.select-popup{
position: absolute;
inset: 0;
background: rgba(0,0,0,0.35);
left: 0;
right: 0;
top: 100%; /* 紧贴选择框下方 */
z-index: 1000;
}
.popup-panel{
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 8rpx; /* 与选择框留一点间距 */
background: #fff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
max-height: 40vh; /* 控制整体可视高度 */
border-bottom-left-radius: 20rpx;
border-bottom-right-radius: 20rpx;
max-height: 40vh; /* 控制整体可视高度,下拉列表形式 */
display: flex;
flex-direction: column;
padding: 20rpx;
box-sizing: border-box;
z-index: 1001;
}
.popup-header{
display: flex;
@@ -788,6 +854,11 @@ export default {
margin-right: 12rpx;
box-sizing: border-box;
}
.popup-mask{
position: fixed;
inset: 0;
background: transparent;
}
.popup-title{
font-size: 28rpx;
color: #333;
@@ -816,10 +887,10 @@ export default {
padding: 30rpx 0;
}
.cont-text{
max-width: 350px;
max-height: 450px;
max-width: 300px;
max-height: 480px;
overflow: scroll;
padding: 10px;
padding: 10px 20px;
}
.popupcontent{
background-size: 100% 100%;
@@ -869,6 +940,31 @@ export default {
line-height: 50px;
}
}
.cents{
display: flex;
align-items: center;
justify-content: space-around;
padding: 0px 10px 20px;
.btns1{
background-color: #fff;
border: 1px solid #206ff4;
color: #206ff4;
border-radius: 50px;
width: 46%;
margin: 10px 0px 0px;
height: 40px;
line-height: 40px;
}
.btns{
background-color: #206ff4;
color: white;
border-radius: 50px;
width: 46%;
margin: 10px 0px 0px;
height: 40px;
line-height: 40px;
}
}
.product-card {
background: #fff;
margin-top: 16rpx;
+9 -5
View File
@@ -2,9 +2,6 @@
<view class="detail-page">
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000"
backgroundColor="#fff" :statusBar="true" :title="detail.sku.product_name"></uni-nav-bar>
<button open-type="share" class="circle-btn">
<image src="/static/image/shares.png" class="share" mode=""></image>
</button>
<scroll-view scroll-y class="page-scroll">
<!-- 图集 -->
<view class="gallery">
@@ -45,6 +42,9 @@
<text class="spec-label">是否包邮:</text>
<text class="spec-value">{{ detail.is_free==0?'不包邮':detail.is_free==1?'全国包邮':detail.is_free==2?'省内包邮':'邮费电联' }}</text>
</view>
<button open-type="share" class="circle-btn">
<image src="/static/image/shares.png" class="share" mode=""></image>
</button>
</view>
<view class="product-card" v-if="detail.sku.point">
<view class="product-point-title"> 产品卖点 </view>
@@ -736,6 +736,7 @@ page,
background: #fff;
margin-top: 16rpx;
padding: 24rpx 24rpx 12rpx;
position: relative;
}
.title {
font-size: 32rpx;
@@ -1043,12 +1044,15 @@ page,
align-items: center;
gap: 6rpx;
}
.circle-btn::after{
border: 1px solid #fff !important;
}
.circle-btn {
z-index: 11;
position: fixed;
position: absolute;
right: 20rpx;
margin-top: 20rpx;
top: 180rpx;
bottom: 32%;
border-radius: 50%;
width: 80rpx;
height: 80rpx;