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 后端 // 测试环境配置 - .NET 10 后端
const testing = { const testing = {
baseUrl: 'https://app.zpc-xy.com/honey/api', // baseUrl: 'https://app.zpc-xy.com/honey/api',
// baseUrl: 'https://api.hanimanghe.top', baseUrl: 'https://api.hanimanghe.top',
// baseUrl: 'http://192.168.1.24:5238', // baseUrl: 'http://192.168.1.24:5238',
// baseUrl: 'http://192.168.195.15:2822', // baseUrl: 'http://192.168.195.15:2822',
imageUrl: 'https://youdas-1308826010.cos.ap-shanghai.myqcloud.com', imageUrl: 'https://youdas-1308826010.cos.ap-shanghai.myqcloud.com',

View File

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

View File

@ -213,7 +213,7 @@ export default {
order_money(data) { order_money(data) {
uni.navigateTo({ 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.Id,
g.Title, g.Title,
g.ImgUrl,
g.ImgUrlDetail, g.ImgUrlDetail,
g.Price, g.Price,
g.Stock, g.Stock,
@ -454,6 +455,7 @@ public class GoodsService : IGoodsService
{ {
Id = goods.Id, Id = goods.Id,
Title = goods.Title, Title = goods.Title,
ImgUrl = FormatImageUrl(goods.ImgUrl),
ImgUrlDetail = FormatImageUrl(goods.ImgUrlDetail), ImgUrlDetail = FormatImageUrl(goods.ImgUrlDetail),
Price = goods.Price.ToString("0.##"), Price = goods.Price.ToString("0.##"),
Stock = goods.Stock, Stock = goods.Stock,