diff --git a/src/pages/client/order/create.vue b/src/pages/client/order/create.vue index 0551744..b5bb122 100644 --- a/src/pages/client/order/create.vue +++ b/src/pages/client/order/create.vue @@ -120,132 +120,64 @@ const sliverList = [ ]; export default { - components: { - SelectModal, - GoodInfoModal, - RechargeCouponModal, - DraggableContact, - }, - data() { - return { - orderData:[], - payPrice: 0, - orPrice:0, - type: "", - orderData: [], - addressInfo: {}, - sliverInfo: {}, - selectSliverInfo: {}, - showSliverModal: false, - sliverTypeList: sliverList, - showGoodInfoModal: false, - showCouponModal: false, - couponList: [], - serviceOrderList: [], - useCouponInfo: null, - petOrderId: "", - petOrderAddressId: "", - orderPrice: 0, - confirmPrice: 0, - selected1: false, - selected2: false, - selected3: false, - selected4: true, - recharge: true, - record: false, - walletBalance: "1000.00", - imgPrefix, - WeChat: undefined, - wallet: "2", - orderId: "", - outOrderNo: "", - }; - }, - computed: { - goodsImgs() { - return this.orderData.map((item) => item.goods_pic).filter((v) => !!v); - }, - sliverFee() { - return this.orderData.reduce((total, prev) => total + +prev.yunfei, 0); - }, - couponFee() { - return +this.useCouponInfo?.card_money || 0; - }, - usefullCouponList() { - return this.couponList.filter((v) => +v.card_money < this.orderPrice); - }, - }, - onLoad(option) { - console.log(option,'?') - 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); - // }); - }, +components: { +SelectModal, +GoodInfoModal, +RechargeCouponModal, +DraggableContact, +}, +data() { +return { +orderData:[], +payPrice: 0, +orPrice:0, +type: "", +orderData: [], +addressInfo: {}, +sliverInfo: {}, +selectSliverInfo: {}, +showSliverModal: false, +sliverTypeList: sliverList, +showGoodInfoModal: false, +showCouponModal: false, +couponList: [], +serviceOrderList: [], +useCouponInfo: null, +petOrderId: "", +petOrderAddressId: "", +orderPrice: 0, +confirmPrice: 0, +selected1: false, +selected2: false, +selected3: false, +selected4: true, +recharge: true, +record: false, +imgPrefix, +WeChat: undefined, +wallet: "2", +orderId: "", +outOrderNo: "", +}; +}, +computed: { + goodsImgs() { + return this.orderData.map((item) => item.goods_pic).filter((v) => !!v); + }, + sliverFee() { + return this.orderData.reduce((total, prev) => total + +prev.yunfei, 0); + }, + couponFee() { + return +this.useCouponInfo?.card_money || 0; + }, + usefullCouponList() { + return this.couponList.filter((v) => +v.card_money < this.orderPrice); + }, + }, + onLoad(option) { +// console.log(option,'?') + this.getGoodsList(option.product_id) +}, methods: { getGoodsList(id) { getGoodsDetail({ @@ -255,7 +187,7 @@ export default { this.orderData = res.data this.orPrice = res.data.price this.orderPrice = res.data[0].price - // console.log(res,'--=') + console.log( this.orderData,'--=??') }) }, createOrder(isPrePay) { @@ -266,6 +198,7 @@ export default { mask: true, }); } + console.log(this.orderData[0].goods_id,'-=-') const params = { id: Number(this.orderData[0].goods_id), };