This commit is contained in:
2026-04-14 18:11:00 +08:00
parent e894689918
commit 6deef6cdce

View File

@ -120,132 +120,64 @@ const sliverList = [
]; ];
export default { export default {
components: { components: {
SelectModal, SelectModal,
GoodInfoModal, GoodInfoModal,
RechargeCouponModal, RechargeCouponModal,
DraggableContact, DraggableContact,
}, },
data() { data() {
return { return {
orderData:[], orderData:[],
payPrice: 0, payPrice: 0,
orPrice:0, orPrice:0,
type: "", type: "",
orderData: [], orderData: [],
addressInfo: {}, addressInfo: {},
sliverInfo: {}, sliverInfo: {},
selectSliverInfo: {}, selectSliverInfo: {},
showSliverModal: false, showSliverModal: false,
sliverTypeList: sliverList, sliverTypeList: sliverList,
showGoodInfoModal: false, showGoodInfoModal: false,
showCouponModal: false, showCouponModal: false,
couponList: [], couponList: [],
serviceOrderList: [], serviceOrderList: [],
useCouponInfo: null, useCouponInfo: null,
petOrderId: "", petOrderId: "",
petOrderAddressId: "", petOrderAddressId: "",
orderPrice: 0, orderPrice: 0,
confirmPrice: 0, confirmPrice: 0,
selected1: false, selected1: false,
selected2: false, selected2: false,
selected3: false, selected3: false,
selected4: true, selected4: true,
recharge: true, recharge: true,
record: false, record: false,
walletBalance: "1000.00", imgPrefix,
imgPrefix, WeChat: undefined,
WeChat: undefined, wallet: "2",
wallet: "2", orderId: "",
orderId: "", outOrderNo: "",
outOrderNo: "", };
}; },
}, computed: {
computed: { goodsImgs() {
goodsImgs() { return this.orderData.map((item) => item.goods_pic).filter((v) => !!v);
return this.orderData.map((item) => item.goods_pic).filter((v) => !!v); },
}, sliverFee() {
sliverFee() { return this.orderData.reduce((total, prev) => total + +prev.yunfei, 0);
return this.orderData.reduce((total, prev) => total + +prev.yunfei, 0); },
}, couponFee() {
couponFee() { return +this.useCouponInfo?.card_money || 0;
return +this.useCouponInfo?.card_money || 0; },
}, usefullCouponList() {
usefullCouponList() { return this.couponList.filter((v) => +v.card_money < this.orderPrice);
return this.couponList.filter((v) => +v.card_money < this.orderPrice); },
}, },
}, onLoad(option) {
onLoad(option) { // console.log(option,'?')
console.log(option,'?') this.getGoodsList(option.product_id)
this.getGoodsList(option.product_id ) },
// const { type, petOrderId = "", petOrderAddressId = "" } = option;
// this.type = type;
// this.petOrderId = petOrderId;
// this.petOrderAddressId = petOrderAddressId;
// if (petOrderAddressId) {
// getAddressInfo(petOrderAddressId).then((res) => {
// this.addressInfo = {
// ...res?.info,
// };
// });
// }
// uni.$on("selectAddress", this.addressChange);
// const eventChannel = this.getOpenerEventChannel();
// eventChannel.on("createOrder", (data) => {
// console.log(data,'--=?')
// const extractFirstImage = (imageList) => {
// if (!imageList) return "";
// try {
// const parsedList =
// typeof imageList === "string" ? JSON.parse(imageList) : imageList;
// if (Array.isArray(parsedList) && parsedList.length > 0) {
// return parsedList[0].url || parsedList[0] || "";
// }
// } catch (e) {
// console.error("Error parsing image_list:", e);
// }
// return "";
// };
// this.orderData = (data?.goodList || []).map((item) => {
// let processedItem = { ...item };
// if (processedItem.product_pic) {
// if (
// typeof processedItem.product_pic === "string" &&
// (processedItem.product_pic.startsWith("[") ||
// processedItem.product_pic.startsWith("{"))
// ) {
// const extractedUrl = extractFirstImage(processedItem.product_pic);
// if (extractedUrl) {
// processedItem.product_pic = extractedUrl;
// }
// } else if (Array.isArray(processedItem.product_pic)) {
// const extractedUrl = extractFirstImage(processedItem.product_pic);
// if (extractedUrl) {
// processedItem.product_pic = extractedUrl;
// }
// }
// }
// return processedItem;
// });
// this.payPrice = this.orderData.reduce(
// (sum, item) =>
// sum +
// Number((item.product_price || item.goods_price) * item.number || 0),
// 0
// );
// console.log(data, "--=?");
// const price = this.orderData.reduce(
// (total, prev) => total + +prev.item_price,
// 0
// );
// this.orderPrice = +price.toFixed(2);
// this.confirmPrice = +(this.orderPrice - this.couponFee).toFixed(2);
// });
},
methods: { methods: {
getGoodsList(id) { getGoodsList(id) {
getGoodsDetail({ getGoodsDetail({
@ -255,7 +187,7 @@ export default {
this.orderData = res.data this.orderData = res.data
this.orPrice = res.data.price this.orPrice = res.data.price
this.orderPrice = res.data[0].price this.orderPrice = res.data[0].price
// console.log(res,'--=') console.log( this.orderData,'--=??')
}) })
}, },
createOrder(isPrePay) { createOrder(isPrePay) {
@ -266,6 +198,7 @@ export default {
mask: true, mask: true,
}); });
} }
console.log(this.orderData[0].goods_id,'-=-')
const params = { const params = {
id: Number(this.orderData[0].goods_id), id: Number(this.orderData[0].goods_id),
}; };