This commit is contained in:
18631081161 2026-02-28 01:10:29 +08:00
parent a8b3793ee4
commit c51cfc3b29
4 changed files with 69 additions and 18 deletions

View File

@ -11,8 +11,8 @@
// 测试环境配置 - .NET 10 后端
const testing = {
baseUrl: 'https://app.zpc-xy.com/honey/api',
// baseUrl: 'https://api.hanimanghe.top',
// baseUrl: 'https://app.zpc-xy.com/honey/api',
baseUrl: 'https://api.hanimanghe.top',
// baseUrl: 'http://192.168.1.24:5238',
// baseUrl: 'http://192.168.195.15:2822',
imageUrl: 'https://youdas-1308826010.cos.ap-shanghai.myqcloud.com',

View File

@ -143,6 +143,7 @@
<script>
import { calcMallOrderMoney, createOrder, createMallOrder } from '@/common/server/order.js';
import { getGoodsDetail } from '@/common/server/goods.js';
export default {
data() {
@ -159,12 +160,23 @@ export default {
onLoad(options) {
if (options.goods_id) {
this.goodsId = options.goods_id;
//
if (options.imgurl) {
this.goodsInfo = { imgurl: decodeURIComponent(options.imgurl) };
}
this.loadDetail();
}
this.$c.getRule(10).then(res => {
if (res.status == 1) this.sendRuleData = res.data;
});
},
onShow() {
//
const token = uni.getStorageSync('token');
if (token && !this.orderData && this.goodsId) {
this.loadDetail();
}
},
watch: {
showRule(val) {
if (val) {
@ -178,26 +190,63 @@ export default {
uni.navigateBack();
},
async loadDetail() {
// mall_ordermoney
const res = await calcMallOrderMoney({
prize_num: 1,
goods_id: this.goodsId,
num: 1,
});
if (res.status == 1) {
this.orderData = res.data;
this.goodsInfo = res.data.goods || {};
const ext = res.data.goods_extend || {};
if (ext.pay_wechat == 1) {
this.zhifu = 0;
} else if (ext.pay_currency2 == 1) {
this.zhifu = 1;
// 1. goods_detail
try {
const detailRes = await getGoodsDetail(this.goodsId);
if (detailRes.status == 1 && detailRes.data) {
// goods_detail { data: { goods: {...}, goodslist: [...] } }
this.goodsInfo = detailRes.data.goods || detailRes.data;
}
} catch (e) {
console.log('获取商品详情失败', e);
}
// 2. calcMallOrderMoney
const token = uni.getStorageSync('token');
if (token) {
try {
const res = await calcMallOrderMoney({
prize_num: 1,
goods_id: this.goodsId,
num: 1,
});
if (res.status == 1) {
this.orderData = res.data;
// imgurl_detailgoods_describe
if (res.data.goods) {
this.goodsInfo = { ...this.goodsInfo, ...res.data.goods };
}
const ext = res.data.goods_extend || {};
if (ext.pay_wechat == 1) {
this.zhifu = 0;
} else if (ext.pay_currency2 == 1) {
this.zhifu = 1;
}
}
} catch (e) {
console.log('获取支付信息失败', e);
}
}
},
onBuy() {
if (!this.orderData) return;
const token = uni.getStorageSync('token');
if (!token) {
uni.showToast({ title: '请先登录', icon: 'none' });
setTimeout(() => {
uni.navigateTo({ url: '/pages/user/login' });
}, 300);
return;
}
//
if (!this.orderData) {
this.loadDetail().then(() => {
if (this.orderData) {
this.$refs.orderPop.open();
}
});
return;
}
this.$refs.orderPop.open();
},

View File

@ -213,7 +213,7 @@ export default {
order_money(data) {
uni.navigateTo({
url: '/pages/mall/detail?goods_id=' + data.id
url: '/pages/mall/detail?goods_id=' + data.id + '&imgurl=' + encodeURIComponent(data.imgurl || '')
});
},

View File

@ -339,6 +339,7 @@ public class GoodsService : IGoodsService
{
g.Id,
g.Title,
g.ImgUrl,
g.ImgUrlDetail,
g.Price,
g.Stock,
@ -454,6 +455,7 @@ public class GoodsService : IGoodsService
{
Id = goods.Id,
Title = goods.Title,
ImgUrl = FormatImageUrl(goods.ImgUrl),
ImgUrlDetail = FormatImageUrl(goods.ImgUrlDetail),
Price = goods.Price.ToString("0.##"),
Stock = goods.Stock,