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 "versionCode" : 100
}, },
"mp-weixin" : { "mp-weixin" : {
"appid" : "wx62c3f16d37f2c2a2", "appid" : "wx58c09d95a245d0bb",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"minified" : true, "minified" : true,
+3 -4
View File
@@ -26,9 +26,9 @@
<image v-if="danmuVisible" src="/static/image/dan1.png" mode=""></image> <image v-if="danmuVisible" src="/static/image/dan1.png" mode=""></image>
<image v-else src="/static/image/danm.png" mode=""></image> <image v-else src="/static/image/danm.png" mode=""></image>
</view> </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> <image src="/static/image/shares.png" class="share" mode=""></image>
</button> </button> -->
</view> </view>
</view> </view>
@@ -314,10 +314,9 @@ export default {
data:{ code: loginRes.code } data:{ code: loginRes.code }
}).then(res => { }).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
uni.setStorageSync('openid', res.data.data.openid); uni.setStorageSync('openid', res.data.data.openid);
uni.setStorageSync('token', res.data.data.token); uni.setStorageSync('token', res.data.data.token);
uni.setStorageSync('is_release', res.data.data.is_release);
if (res.data.data.mobile) { if (res.data.data.mobile) {
uni.setStorageSync('is_login', true); uni.setStorageSync('is_login', true);
} else { } else {
+97 -70
View File
@@ -1,57 +1,61 @@
<template> <template>
<view> <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> <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"> <form @submit="bcFn">
<view class="cell"> <view class="content">
<view>{{$t('mine.avatar')}}</view>
<view class="right"> <view class="cell">
<uni-file-picker fileMediatype="image" limit="1" @select="select" @delete="delfn" :del-icon="false" disable-preview :imageStyles="imageStyles"> <view>{{$t('mine.avatar')}}</view>
<image :src="userinfo.avatar_pull==''?'/static/image/mine/user.png':userinfo.avatar_pull" mode="" class="addimg"></image> <view class="right">
</uni-file-picker> <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> </view>
<view class="cell1"> <view class="foot">
<view>{{$t('mine.nickname')}}</view> <button class="btn" form-type="submit">{{$t('button.save')}}</button>
<view class="right select"> </view>
<input :placeholder="$t('mine.nickinput')" v-model="userinfo.nickname" /> </form>
<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> </view>
</template> </template>
<script> <script>
@@ -62,6 +66,7 @@
centerLat: 39.9042, centerLat: 39.9042,
centerLng: 116.4074, centerLng: 116.4074,
markers: [], markers: [],
ischack:true,
// 若需逆地理,请配置腾讯地图 key(可存储在此或通过 storage 注入) // 若需逆地理,请配置腾讯地图 key(可存储在此或通过 storage 注入)
qqMapKey: 'HQBBZ-SC76W-YUNRZ-34IAD-ARN6K-TZBZ4', qqMapKey: 'HQBBZ-SC76W-YUNRZ-34IAD-ARN6K-TZBZ4',
showMap: false, showMap: false,
@@ -89,6 +94,9 @@
this.getinfo() this.getinfo()
}, },
methods: { methods: {
chackfn(){
this.ischack = false
},
getFuzzy() { getFuzzy() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.getSetting({ 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(){ delfn(){
this.userinfo.avatar ='' this.userinfo.avatar =''
}, },
@@ -233,39 +247,52 @@
leftClick(){ leftClick(){
uni.navigateBack({}) uni.navigateBack({})
}, },
bcFn(){ bcFn(e) {
const nickname = e.detail.value.nickname
if (nickname) {
this.userinfo.nickname = nickname
}
// 同步到 userinfo,方便后续使用
request({ request({
url:'common/user/update', url: 'common/user/update',
method:'POST', method: 'POST',
data:{ data: {
nickname:this.userinfo.nickname, nickname:this.userinfo.nickname,
avatar:this.userinfo.avatar, avatar: this.userinfo.avatar,
mobile:this.userinfo.mobile, mobile: this.userinfo.mobile,
shop_name:this.userinfo.shop_name, shop_name: this.userinfo.shop_name,
location_name:this.userinfo.location_name, location_name: this.userinfo.location_name,
latitude:this.userinfo.latitude, latitude: this.userinfo.latitude,
longitude:this.userinfo.longitude longitude: this.userinfo.longitude
} }
}).then(res => { }).then(res => {
uni.showToast({ uni.showToast({
title: res.data.message, title: res.data.message,
icon: 'none' icon: 'none'
}); })
if(res.data.code ==200){
setTimeout(() => { if (res.data.code == 200) {
uni.reLaunch({ setTimeout(() => {
url: '/pages/index/mine',// 替换为你要跳转的页面路径 uni.reLaunch({
}); url: '/pages/index/mine'
}, 1000); })
}, 1000)
} }
}) })
} }
} }
} }
</script> </script>
<style> <style>
.avatar-btn{
background: #fff;
}
.avatar-btn::after{
border: 1px solid #fff !important;
}
.uniui-right{ .uniui-right{
position: absolute; position: absolute;
top: 2px; top: 2px;
+2 -1
View File
@@ -124,7 +124,8 @@ export default {
data: { data: {
current: this.page, current: this.page,
size: this.pageSize, size: this.pageSize,
status: this.status status: this.status,
scene:'self'
} }
}).then(res => { }).then(res => {
this.loading = false this.loading = false
+141 -45
View File
@@ -2,11 +2,33 @@
<view class="publish-page"> <view class="publish-page">
<uni-nav-bar leftText=" " :fixed="true" :border="false" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" title="样机发布"></uni-nav-bar> <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="form-card">
<view class="select-input gradient-bg" @click="onSelectCategory()"> <view class="select-input gradient-bg position" @click="onSelectCategory()">
<view class="category-content"> <view class="category-content">
<text class="category-text">{{form.category || '请输入/选择型号'}}</text> <text class="category-text">{{form.category || '请输入/选择型号'}}</text>
</view> </view>
<u-icon name="arrow-down" color="#3BC8BE" size="20"></u-icon> <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>
<view class="conts mag-top"> <view class="conts mag-top">
<view class=""> <view class="">
@@ -36,11 +58,19 @@
</view> </view>
</picker> </picker>
</view> </view>
<view class="mag-top"> <view class="mag-top prices">
<input class="uni-input" focus v-model="form.price" @focus="checkLogin()" placeholder="请输入折扣价格" /> <input
class="uni-input"
type="digit"
:value="form.price"
placeholder="请输入折扣价格"
@input="onPriceInput"
@blur="onPriceBlur"
/>
<text>元</text>
</view> </view>
<view class="mag-top"> <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" /> <uni-data-checkbox v-model="form.is_free" :localdata="freeshipping" />
</view> </view>
@@ -65,27 +95,7 @@
</view> </view>
</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="foot">
<view class="agreement"> <view class="agreement">
@@ -94,16 +104,16 @@
<text>我已阅读并同意</text> <text>我已阅读并同意</text>
<text class="link" @click.stop="viewAgreement">《发布协议》</text> <text class="link" @click.stop="viewAgreement">《发布协议》</text>
</label> </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>
</view> </view>
<u-popup :show="show" :closeOnClickOverlay="false" :round="10" mode="center"> <u-popup :show="show" :closeOnClickOverlay="false" :round="10" mode="center">
<view class="cont-text" > <view class="cont-text" >
<rich-text :nodes="viewAgreementcont"></rich-text> <rich-text :nodes="viewAgreementcont"></rich-text>
</view> </view>
<view class="cent"> <view class="cents">
<button class="btn1" @click="show = !show">取消</button> <button class="btns1" @click="show = !show">取消</button>
<button class="btn" @click="agreementbtn">确定</button> <button class="btns" @click="agreementbtn">确定</button>
</view> </view>
</u-popup> </u-popup>
<u-popup :show="showlogin" :closeOnClickOverlay="false" :round="20" mode="center"> <u-popup :show="showlogin" :closeOnClickOverlay="false" :round="20" mode="center">
@@ -141,6 +151,7 @@ export default {
showSelect2:false, showSelect2:false,
searchKey1:'', searchKey1:'',
productcontents:'', productcontents:'',
userinfo:'',
skudetils:'', skudetils:'',
// 单选数据源 // 单选数据源
freeshipping: [ { freeshipping: [ {
@@ -172,7 +183,7 @@ export default {
content:'', content:'',
media:[], media:[],
price:'', price:'',
is_free:1 is_free:''
}, },
selfChecked: false, selfChecked: false,
showlogin:false, showlogin:false,
@@ -197,6 +208,7 @@ export default {
} }
}, },
onLoad() { onLoad() {
this.getinfo()
}, },
onShow() { onShow() {
@@ -204,6 +216,15 @@ export default {
// this.syncTabbar() // this.syncTabbar()
}, },
methods:{ 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() { onSelectCategory() {
if (!uni.getStorageSync('is_login')) { if (!uni.getStorageSync('is_login')) {
this.showlogin = true this.showlogin = true
@@ -261,8 +282,10 @@ export default {
this.form.category = item.model || '' this.form.category = item.model || ''
this.form.sku_id = item.id || '' this.form.sku_id = item.id || ''
// 处理富文本,让图片自适应 // 处理富文本,让图片自适应
this.productcontents = this.processRichText(item.desc || '') if(item.desc !=''&& item.desc !=null){
console.log(this.productcontents) this.productcontents = this.processRichText(item.desc || '')
console.log(this.productcontents)
}
this.showSelect1 = false this.showSelect1 = false
}, },
goprivacy(){ goprivacy(){
@@ -345,6 +368,33 @@ export default {
this.form.content = e.detail.value.slice(0,this.maxWords) 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){ uploadfn(imgUrl){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
@@ -421,7 +471,7 @@ export default {
this.form.content=''; this.form.content='';
this.form.media=[]; this.form.media=[];
this.form.price=''; this.form.price='';
this.form.is_free=1; this.form.is_free='';
this.productcontents='' this.productcontents=''
// 同步清理文件选择器内部的文件列表 // 同步清理文件选择器内部的文件列表
this.$nextTick(() => { this.$nextTick(() => {
@@ -460,6 +510,14 @@ export default {
}); });
return return
} }
if(this.form.is_free==''){
uni.showToast({
title: '请选择包邮方式',
icon: 'none'
});
return
}
if(!this.form.media || this.form.media.length === 0){ if(!this.form.media || this.form.media.length === 0){
uni.showToast({ uni.showToast({
title: '请至少上传一张图片', title: '请至少上传一张图片',
@@ -503,6 +561,11 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.prices{
display: flex;
align-items: center;
gap: 10px;
}
.detils{ .detils{
margin-top: 40rpx; margin-top: 40rpx;
overflow: hidden; overflow: hidden;
@@ -747,29 +810,32 @@ export default {
background: #3BC8BE; background: #3BC8BE;
margin-top: 20rpx; margin-top: 20rpx;
} }
.select-popup{ .position{
position: fixed; position: relative;
inset: 0;
z-index: 999;
} }
.popup-mask{ .select-popup{
position: absolute; position: absolute;
inset: 0; left: 0;
background: rgba(0,0,0,0.35); right: 0;
top: 100%; /* 紧贴选择框下方 */
z-index: 1000;
} }
.popup-panel{ .popup-panel{
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; top: 8rpx; /* 与选择框留一点间距 */
background: #fff; background: #fff;
border-top-left-radius: 20rpx; border-top-left-radius: 20rpx;
border-top-right-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; display: flex;
flex-direction: column; flex-direction: column;
padding: 20rpx; padding: 20rpx;
box-sizing: border-box; box-sizing: border-box;
z-index: 1001;
} }
.popup-header{ .popup-header{
display: flex; display: flex;
@@ -788,6 +854,11 @@ export default {
margin-right: 12rpx; margin-right: 12rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.popup-mask{
position: fixed;
inset: 0;
background: transparent;
}
.popup-title{ .popup-title{
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
@@ -816,10 +887,10 @@ export default {
padding: 30rpx 0; padding: 30rpx 0;
} }
.cont-text{ .cont-text{
max-width: 350px; max-width: 300px;
max-height: 450px; max-height: 480px;
overflow: scroll; overflow: scroll;
padding: 10px; padding: 10px 20px;
} }
.popupcontent{ .popupcontent{
background-size: 100% 100%; background-size: 100% 100%;
@@ -869,6 +940,31 @@ export default {
line-height: 50px; 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 { .product-card {
background: #fff; background: #fff;
margin-top: 16rpx; margin-top: 16rpx;
+9 -5
View File
@@ -2,9 +2,6 @@
<view class="detail-page"> <view class="detail-page">
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000" <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> 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"> <scroll-view scroll-y class="page-scroll">
<!-- 图集 --> <!-- 图集 -->
<view class="gallery"> <view class="gallery">
@@ -45,6 +42,9 @@
<text class="spec-label">是否包邮:</text> <text class="spec-label">是否包邮:</text>
<text class="spec-value">{{ detail.is_free==0?'不包邮':detail.is_free==1?'全国包邮':detail.is_free==2?'省内包邮':'邮费电联' }}</text> <text class="spec-value">{{ detail.is_free==0?'不包邮':detail.is_free==1?'全国包邮':detail.is_free==2?'省内包邮':'邮费电联' }}</text>
</view> </view>
<button open-type="share" class="circle-btn">
<image src="/static/image/shares.png" class="share" mode=""></image>
</button>
</view> </view>
<view class="product-card" v-if="detail.sku.point"> <view class="product-card" v-if="detail.sku.point">
<view class="product-point-title"> 产品卖点 </view> <view class="product-point-title"> 产品卖点 </view>
@@ -736,6 +736,7 @@ page,
background: #fff; background: #fff;
margin-top: 16rpx; margin-top: 16rpx;
padding: 24rpx 24rpx 12rpx; padding: 24rpx 24rpx 12rpx;
position: relative;
} }
.title { .title {
font-size: 32rpx; font-size: 32rpx;
@@ -1043,12 +1044,15 @@ page,
align-items: center; align-items: center;
gap: 6rpx; gap: 6rpx;
} }
.circle-btn::after{
border: 1px solid #fff !important;
}
.circle-btn { .circle-btn {
z-index: 11; z-index: 11;
position: fixed; position: absolute;
right: 20rpx; right: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
top: 180rpx; bottom: 32%;
border-radius: 50%; border-radius: 50%;
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;