From fc9c22e27f7a8e1d137b38b2a292ec7c07d3d639 Mon Sep 17 00:00:00 2001
From: lion <120344285@qq.com>
Date: Mon, 19 Jan 2026 10:02:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config.js | 7 +-
.../pages/shopDetail/shopDetail.vue | 344 +++++++++---------
2 files changed, 183 insertions(+), 168 deletions(-)
diff --git a/config.js b/config.js
index b5a321e..c56f2e8 100644
--- a/config.js
+++ b/config.js
@@ -4,11 +4,10 @@ export const appConfig = {
// baseUrl: 'http://yunyubang.localhost.com',
baseUrl:'https://yunyubang.ali251.langye.net',// 'https://yunyubang2021.langye.net', //孕育邦
- // baseUrl: 'https://yybtest.ali251.langye.net',
+ // baseUrl: 'http://yunyubang-test.ali251.langye.net',
newBaseUrl: 'https://yunyubang.ali251.langye.net',
- // newBaseUrl: 'http://yybtest.ali251.langye.net',
-
- //baseUrl:'https://yybtest2021.langye.net',//孕育咨询
+ // newBaseUrl: 'http://yunyubang-test.ali251.langye.net',
+
openidInfoKey: 'openid_info_yunyubang'
}
diff --git a/packages/packageBuy/pages/shopDetail/shopDetail.vue b/packages/packageBuy/pages/shopDetail/shopDetail.vue
index ff3213d..d07be62 100644
--- a/packages/packageBuy/pages/shopDetail/shopDetail.vue
+++ b/packages/packageBuy/pages/shopDetail/shopDetail.vue
@@ -4,10 +4,10 @@
- {{info.name}}
-
- ¥{{info.price}}
- 免费
+ {{info.name}}
+
+ ¥{{info.price}}
+ 免费
@@ -38,7 +38,7 @@
暂无
- 电话:{{tel}}
+ 电话:{{tel}}
@@ -52,10 +52,10 @@
周一至周日 09:00-18:00
- 电话:{{tel}}
+ 电话:{{tel}}
-
- {{info.merchant.address}}
+
+ {{info.merchant.address}}
@@ -119,17 +119,17 @@
客服
-
-
- {{buyName}}
- {{buyName}}
+
+
+ {{buyName}}
+ {{buyName}}
请输入您的联系方式
-
+
宝妈姓名*
@@ -146,25 +146,25 @@
{{form.due_date}}
-
-
- 产品型号*
-
-
- {{modelList[mindex]}}
-
-
+
+
+ 产品型号*
+
+
+ {{modelList[mindex]}}
+
+
所属区域*
{{arrRegion[rindex]}}
-
-
- *
-
+
+
+ *
+
@@ -259,11 +259,11 @@
id: "",
tel: "18550406975",
showPass: false,
- info: {},
+ info: {},
viewCounts:'',
- dataList: [],
- buyName:'',
- mindex:0,
+ dataList: [],
+ buyName:'',
+ mindex:0,
modelList:['请选择产品型号'],
form: {
product_type: "product",
@@ -272,7 +272,7 @@
phone: '',
member_name: "",
member_comment: "",
- promotion: "",
+ promotion: "",
model_name:'',
region: '',
address: '',
@@ -333,7 +333,7 @@
that.form.member_name = info.user_info.wechat_nickname;
}
that.loadInfo();
- that.loadPage();
+ that.loadPage();
that.getHospital()
that.getArea()
@@ -364,47 +364,58 @@
},
- methods: {
- // 跳转微信客服
- jumpToWeChatCustomerService() {
- this.openWeChatCustomerService("https://work.weixin.qq.com/kfid/kfccc6609d51a87324d?enc_scene=ENC5n1b6XBY2paqReUMjwNmTGay8jwTZQuyn17jL8n5xK9T7ZwfJx36T5EHqVbFWTzP8s", "wwe480a61872b54394");
- },
-
-
- // 打开微信客服
- openWeChatCustomerService (
- weiXinCustomerServiceUrl = "",
- corpId = "",
- showMessageCard = false,
- sendMessageTitle = "",
- sendMessagePath = "",
- sendMessageImg = ""
- ) {
- if (!weiXinCustomerServiceUrl || !corpId)
- return Toast("请配置好客服链接或者企业ID");
- // eslint-disable-next-line no-undef
- wx.openCustomerServiceChat({
- // 客服信息
- extInfo: {
- url: weiXinCustomerServiceUrl, // 客服链接 https://work.weixin.qq.com/xxxxxxxx
- },
- corpId, // 企业ID wwed1ca4d3597eXXXX
- showMessageCard, // 是否发送小程序气泡消息
- sendMessageTitle, // 气泡消息标题
- sendMessagePath, // 气泡消息小程序路径(一定要在小程序路径后面加上“.html”,如:pages/index/index.html)
- sendMessageImg, // 气泡消息图片
- success(res) {
- console.log("success", JSON.stringify(res));
- },
- fail(err) {
- console.log("fail", JSON.stringify(err));
- // eslint-disable-next-line no-undef
- return wx.showToast({
- title: err.errMsg,
- icon: "none"
- });
- },
- });
+ methods: {
+ // 处理富文本中的图片路径
+ processContentImages: function(content) {
+ if (!content || typeof content !== 'string') {
+ return content;
+ }
+ // 替换 ../storage/files/ 开头的路径(先处理相对路径,避免和绝对路径冲突)
+ content = content.replace(/(["'=:])(\.\.\/storage\/files\/)([^"'\s<>]+)/g, `$1${this.baseUrl}/storage/files/$3`);
+ // 替换 /storage/files/ 开头的路径
+ content = content.replace(/(["'=:])(\/storage\/files\/)([^"'\s<>]+)/g, `$1${this.baseUrl}/storage/files/$3`);
+ return content;
+ },
+ // 跳转微信客服
+ jumpToWeChatCustomerService() {
+ this.openWeChatCustomerService("https://work.weixin.qq.com/kfid/kfccc6609d51a87324d?enc_scene=ENC5n1b6XBY2paqReUMjwNmTGay8jwTZQuyn17jL8n5xK9T7ZwfJx36T5EHqVbFWTzP8s", "wwe480a61872b54394");
+ },
+
+
+ // 打开微信客服
+ openWeChatCustomerService (
+ weiXinCustomerServiceUrl = "",
+ corpId = "",
+ showMessageCard = false,
+ sendMessageTitle = "",
+ sendMessagePath = "",
+ sendMessageImg = ""
+ ) {
+ if (!weiXinCustomerServiceUrl || !corpId)
+ return Toast("请配置好客服链接或者企业ID");
+ // eslint-disable-next-line no-undef
+ wx.openCustomerServiceChat({
+ // 客服信息
+ extInfo: {
+ url: weiXinCustomerServiceUrl, // 客服链接 https://work.weixin.qq.com/xxxxxxxx
+ },
+ corpId, // 企业ID wwed1ca4d3597eXXXX
+ showMessageCard, // 是否发送小程序气泡消息
+ sendMessageTitle, // 气泡消息标题
+ sendMessagePath, // 气泡消息小程序路径(一定要在小程序路径后面加上“.html”,如:pages/index/index.html)
+ sendMessageImg, // 气泡消息图片
+ success(res) {
+ console.log("success", JSON.stringify(res));
+ },
+ fail(err) {
+ console.log("fail", JSON.stringify(err));
+ // eslint-disable-next-line no-undef
+ return wx.showToast({
+ title: err.errMsg,
+ icon: "none"
+ });
+ },
+ });
},
calltel(phone) {
const res = uni.getSystemInfoSync();
@@ -512,7 +523,7 @@
})
})
}
- },
+ },
bindModelChange:function(e) {
this.mindex = e.target.value;
this.form.model_name = this.modelList[e.target.value];
@@ -526,42 +537,42 @@
if (this.arrHospital[e.target.value] != '其他') {
this.form.hospital = this.arrHospital[e.target.value];
}
- },
- async getArea(code) {
- await weixin.request({
- newUrl: true,
- api: '/api/member/parameter/show',
- data: {
- number: 'area'
- },
- utilSuccess: (res) => {
- this.arrRegion = []
-
- this.arrRegion.push("请选择区域")
- res.detail.map(item => {
- this.arrRegion.push(item.value)
- })
-
- }
- })
},
- async getHospital(code) {
- await weixin.request({
- newUrl: true,
- api: '/api/member/parameter/show',
- data: {
- number: 'hospital'
- },
- utilSuccess: (res) => {
- this.arrHospital = []
-
- this.arrHospital.push("请选择建卡医院")
- res.detail.map(item => {
- this.arrHospital.push(item.value)
- })
-
- }
- })
+ async getArea(code) {
+ await weixin.request({
+ newUrl: true,
+ api: '/api/member/parameter/show',
+ data: {
+ number: 'area'
+ },
+ utilSuccess: (res) => {
+ this.arrRegion = []
+
+ this.arrRegion.push("请选择区域")
+ res.detail.map(item => {
+ this.arrRegion.push(item.value)
+ })
+
+ }
+ })
+ },
+ async getHospital(code) {
+ await weixin.request({
+ newUrl: true,
+ api: '/api/member/parameter/show',
+ data: {
+ number: 'hospital'
+ },
+ utilSuccess: (res) => {
+ this.arrHospital = []
+
+ this.arrHospital.push("请选择建卡医院")
+ res.detail.map(item => {
+ this.arrHospital.push(item.value)
+ })
+
+ }
+ })
},
getPoster: function() {
var that = this;
@@ -601,7 +612,7 @@
this.$refs.shareCode.open();
this.getPoster();
},
- draw: function() {
+ draw: function() {
var that = this;
uni.request({
@@ -814,23 +825,23 @@
return false;
}
- if (this.modelList.length>1 && (this.form.model_name == "请选择产品型号" || weixin.isNull(this.form.model_name))) {
- this.alert('请选择产品型号')
- return
+ if (this.modelList.length>1 && (this.form.model_name == "请选择产品型号" || weixin.isNull(this.form.model_name))) {
+ this.alert('请选择产品型号')
+ return
}
if (this.form.region == "请选择区域" || weixin.isNull(this.form.region)) {
this.alert('请选择区域')
return
- }
- if(this.info.product_type.name==='实物' && weixin.isNull(this.form.address)){
- this.alert('请填写具体地址')
- return
+ }
+ if(this.info.product_type.name==='实物' && weixin.isNull(this.form.address)){
+ this.alert('请填写具体地址')
+ return
}
if (this.form.hospital == "请选择建卡医院") {
this.alert('请选择建卡医院')
return
}
- // console.log(this.form)
+ // console.log(this.form)
// return
// 此处用法为在js中调用,需要写uni.$u.throttle()
uni.$u.throttle(this.toDoBuy, 1000);
@@ -923,8 +934,8 @@
url: "../shopDetail/shopDetail?id=" + id
})
},
- loadInfo: function() {
- this.loadView();
+ loadInfo: function() {
+ this.loadView();
let that = this
weixin.request({
api: '/api/member/get-product/' + this.id,
@@ -933,15 +944,20 @@
//r.data.poster = this.baseUrl + r.data.poster;
that.info = r.data;
that.info.poster = (weixin.isNull(that.info.poster) ? "../../static/750x500.jpg" :
- that.info.poster_url)
- that.buyName = that.info.state=='active'?'立即购买':'已下架'
-
- let _marr = r.data.model?JSON.parse(r.data.model):[]
- if(_marr.length>0){
- _marr.map(item=>{
- that.modelList.push(item.name)
- })
-
+ that.info.poster_url)
+ that.buyName = that.info.state=='active'?'立即购买':'已下架'
+
+ // 处理富文本中的图片路径
+ if (that.info.content) {
+ that.info.content = that.processContentImages(that.info.content);
+ }
+
+ let _marr = r.data.model?JSON.parse(r.data.model):[]
+ if(_marr.length>0){
+ _marr.map(item=>{
+ that.modelList.push(item.name)
+ })
+
}
},
utilFail: r => {
@@ -957,8 +973,8 @@
customLoading: false,
data: {
page: 1,
- page_size: 3,
- sort_name:'sortnumber',
+ page_size: 3,
+ sort_name:'sortnumber',
sort_type:"ASC"
},
utilSuccess: function(r) {
@@ -979,35 +995,35 @@
util.alert(res);
}
});
- },
- loadView: function() {
- var that = this;
- weixin.request({
- bindThis: that,
- api: '/api/member/other/pv-count',
- customLoading: false,
- data: {
- url:'/api/member/get-product/' + that.id
- },
- utilSuccess: function(r) {
- console.log("r",r)
- that.viewCounts = r.total
- },
- utilFail: function(res) {
- util.alert(res);
- }
- });
+ },
+ loadView: function() {
+ var that = this;
+ weixin.request({
+ bindThis: that,
+ api: '/api/member/other/pv-count',
+ customLoading: false,
+ data: {
+ url:'/api/member/get-product/' + that.id
+ },
+ utilSuccess: function(r) {
+ console.log("r",r)
+ that.viewCounts = r.total
+ },
+ utilFail: function(res) {
+ util.alert(res);
+ }
+ });
}
}
}
-
+
@@ -1134,9 +1150,9 @@
text-align: center;
line-height: 72rpx;
color: #fff;
- }
- .buyNoBtn{
- background: linear-gradient(90deg, #ddd 0%, #ddd 100%);
+ }
+ .buyNoBtn{
+ background: linear-gradient(90deg, #ddd 0%, #ddd 100%);
}
}
@@ -1221,7 +1237,7 @@
.banner {
display: block;
- width: 100%;
+ width: 100%;
height: 535rpx;
// height: 500rpx;
}
@@ -1314,7 +1330,7 @@
.discuss {
display: flex;
justify-content: flex-start;
- margin: 25rpx 0;
+ margin: 25rpx 0;
margin-bottom:0;
position: relative;
align-items: center;
@@ -1355,7 +1371,7 @@
display: inline-block;
font-size: 36rpx;
font-weight: 500;
- color: #333333;
+ color: #333333;
width:90%;
}
@@ -1547,8 +1563,8 @@
margin-left: 24rpx;
display: inline-block;
vertical-align: top;
- view{
- margin-bottom:10rpx
+ view{
+ margin-bottom:10rpx
}
.name {
font-size: 32rpx;
@@ -1568,7 +1584,7 @@
display: inline-block;
margin-right: 7rpx;
height: 100%;
- line-height: 20rpx;
+ line-height: 20rpx;
vertical-align: middle;
}
}
@@ -1631,14 +1647,14 @@
font-size: 28rpx;
color: #333333;
line-height: 45rpx;
- }
+ }
}
image {
width: 100%;
margin-top: 30rpx;
- }
+ }
}
@@ -1900,4 +1916,4 @@
color: #666;
}
}
-
+